[PATCH] for control-center bug #'s 112151, 112152 and 112153



FYI:

I posted a patch for control-center 2.3.1 that fixes bug #'s 112151,
112152 and 112153 in b.g.o. I'm posting it to the list just in case
someone overlooks it in bugzilla.

And on a similar subject, is there any formal way that a patch should be
named?

James T. Richardson, Jr.
james richardsons us
tkf-ml teknofile org

*** ./2.3.x/control-center-2.3.1/capplets/display/main.c	2003-04-23 10:01:16.000000000 -0500
--- ./control-center-2.3.1/capplets/display/main.c	2003-06-20 16:05:30.000000000 -0500
***************
*** 12,18 ****
  
  #define REVERT_COUNT 20
  
! struct ScreenInfo {
    int current_width;
    int current_height;
    SizeID current_size;
--- 12,21 ----
  
  #define REVERT_COUNT 20
  
! #define DEBUG 1
! 
! struct ScreenInfo
! {
  	int current_width;
  	int current_height;
  	SizeID current_size;
***************
*** 36,41 ****
--- 39,47 ----
  };
  
  
+ static void generate_rate_menu (struct ScreenInfo *screen_info);
+ static void generate_resolution_menu(struct ScreenInfo* screen_info);
+ 
  struct DisplayInfo *
  read_display_info (GdkDisplay *display)
  {
***************
*** 43,54 ****
    struct ScreenInfo *screen_info;
    GdkScreen *screen;
    GdkWindow *root_window;
-   int i;
  
    info = g_new (struct DisplayInfo, 1);
    info->n_screens = gdk_display_get_n_screens (display);
    info->screens = g_new (struct ScreenInfo, info->n_screens);
! 
    for (i = 0; i < info->n_screens; i++)
      {
        screen = gdk_display_get_screen (display, i);
--- 49,59 ----
  	struct ScreenInfo *screen_info;
  	GdkScreen *screen;
  	GdkWindow *root_window;
  
  	info = g_new (struct DisplayInfo, 1);
  	info->n_screens = gdk_display_get_n_screens (display);
  	info->screens = g_new (struct ScreenInfo, info->n_screens);
! 	int i;
  	for (i = 0; i < info->n_screens; i++)
  	{
  		screen = gdk_display_get_screen (display, i);
***************
*** 177,182 ****
--- 182,190 ----
  					  screen_info->current_rotation,
  					  screen_info->current_rate,
  					  GDK_CURRENT_TIME);
+ 
+ 		generate_resolution_menu(screen_info);
+ 		generate_rate_menu(screen_info);
      }
    return 0;
  }
***************
*** 238,243 ****
--- 246,257 ----
  }
  
  static void
+ resolution_changed_callback (GtkWidget *optionmenu, struct ScreenInfo *screen_info)
+ {
+ 	generate_rate_menu(screen_info);
+ }
+ 
+ static void
  generate_rate_menu (struct ScreenInfo *screen_info)
  {
    GtkWidget *menu;
***************
*** 280,295 ****
  }
  
  static void
! resolution_changed_callback (GtkWidget *optionmenu,
! 			     struct ScreenInfo *screen_info)
! {
!   generate_rate_menu (screen_info);
! }
! 
! static GtkWidget *
! create_resolution_menu (struct ScreenInfo *screen_info)
  {
-   GtkWidget *optionmenu;
    GtkWidget *menu;
    GtkWidget *menuitem;
    int i, item, current_item;
--- 294,301 ----
  }
  
  static void
! generate_resolution_menu(struct ScreenInfo* screen_info)
  {
  	GtkWidget *menu;
  	GtkWidget *menuitem;
  	int i, item, current_item;
***************
*** 298,307 ****
    SizeID current_size;
    Rotation rot;
  
!   screen_info->resolution_widget = optionmenu = gtk_option_menu_new ();
! 
    menu = gtk_menu_new ();
- 
    current_size = XRRConfigCurrentConfiguration (screen_info->config, &rot);
    
    current_item = 0;
--- 304,311 ----
  	SizeID current_size;
  	Rotation rot;
  
! 	gtk_option_menu_remove_menu(GTK_OPTION_MENU(screen_info->resolution_widget));
  	menu = gtk_menu_new ();
  	current_size = XRRConfigCurrentConfiguration (screen_info->config, &rot);
    
  	current_item = 0;
***************
*** 327,340 ****
  	}
      }
    
!   gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
!   gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu),
! 			       current_item);
  
!   g_signal_connect (optionmenu, "changed",
! 		    G_CALLBACK (resolution_changed_callback), screen_info);
    
!   gtk_widget_show (optionmenu);
    return optionmenu;
  }
  
--- 331,350 ----
  		}
  	}
    
! 	gtk_option_menu_set_menu (GTK_OPTION_MENU (screen_info->resolution_widget), menu);
! 	gtk_option_menu_set_history (GTK_OPTION_MENU (screen_info->resolution_widget), current_item);
  
! 	g_signal_connect (screen_info->resolution_widget, "changed", G_CALLBACK (resolution_changed_callback), screen_info);
  
! 	gtk_widget_show (screen_info->resolution_widget);
! }
! 
! static GtkWidget *
! create_resolution_menu (struct ScreenInfo *screen_info) 
! {
! 	GtkWidget *optionmenu;
! 	screen_info->resolution_widget = optionmenu = gtk_option_menu_new ();
! 	generate_resolution_menu(screen_info);
  	return optionmenu;
  }
  
***************
*** 431,443 ****
    
    dialog = gtk_dialog_new_with_buttons (_("Screen Resolution Preferences"),
  					NULL,
! 					GTK_DIALOG_NO_SEPARATOR,
  					"gtk-apply",
  					GTK_RESPONSE_APPLY,
  					"gtk-help",
  					GTK_RESPONSE_HELP,
  					NULL);
  					
    gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
    gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 12);
    capplet_set_icon (dialog, "display-capplet.png");
--- 441,456 ----
    
    dialog = gtk_dialog_new_with_buttons (_("Screen Resolution Preferences"),
  					NULL,
! 					0,
! 					"gtk-close",
! 					GTK_RESPONSE_CLOSE,
  					"gtk-apply",
  					GTK_RESPONSE_APPLY,
  					"gtk-help",
  					GTK_RESPONSE_HELP,
  					NULL);
  
+   gtk_window_set_resizable(GTK_DIALOG(dialog), FALSE);					
    gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
    gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 12);
    capplet_set_icon (dialog, "display-capplet.png");
***************
*** 537,544 ****
    char *str;
  
    dialog = gtk_dialog_new ();
!   gtk_window_set_transient_for (GTK_WINDOW (dialog),
! 				GTK_WINDOW (parent));
    gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
    gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
    gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
--- 550,556 ----
    char *str;
  
    dialog = gtk_dialog_new ();
!   gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
    gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
    gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
    gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
***************
*** 566,593 ****
    hbox = gtk_hbox_new (FALSE, 6);
    vbox = gtk_vbox_new (FALSE, 6);
  
!   gtk_box_pack_start (GTK_BOX (vbox), label,
!                       TRUE, TRUE, 0);
! 			     
!   gtk_box_pack_start (GTK_BOX (vbox), label_sec,
!                       TRUE, TRUE, 0);
!   
!   gtk_box_pack_start (GTK_BOX (hbox), image,
!                       FALSE, FALSE, 0);
!   
!   gtk_box_pack_start (GTK_BOX (hbox), vbox,
!                       TRUE, TRUE, 0);
! 
!   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
!                       hbox,
!                       FALSE, FALSE, 0);
! 
!   gtk_dialog_add_buttons (GTK_DIALOG (dialog),
! 			  _("Use _previous resolution"),
! 			  GTK_RESPONSE_NO,
! 			  _("_Keep resolution"),
! 			  GTK_RESPONSE_YES,
! 			  NULL);
    
    gtk_widget_show_all (hbox);
  
--- 578,589 ----
    hbox = gtk_hbox_new (FALSE, 6);
    vbox = gtk_vbox_new (FALSE, 6);
  
!   gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
!   gtk_box_pack_start (GTK_BOX (vbox), label_sec, TRUE, TRUE, 0);
!   gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
!   gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
!   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
!   gtk_dialog_add_buttons (GTK_DIALOG (dialog),_("Use _previous resolution"), GTK_RESPONSE_NO, _("_Keep resolution"), GTK_RESPONSE_YES, NULL);
    
    gtk_widget_show_all (hbox);
  
***************
*** 596,605 ****
    timeout_data.dialog = GTK_DIALOG (dialog);
    timeout_data.timed_out = FALSE;
    
!   timeout = g_timeout_add (1000,
! 			   save_timeout_callback,
! 			   &timeout_data);
!   
    res = gtk_dialog_run (GTK_DIALOG (dialog));
  
    if (!timeout_data.timed_out)
--- 592,598 ----
    timeout_data.dialog = GTK_DIALOG (dialog);
    timeout_data.timed_out = FALSE;
    
!   timeout = g_timeout_add (1000, save_timeout_callback, &timeout_data);
    res = gtk_dialog_run (GTK_DIALOG (dialog));
  
    if (!timeout_data.timed_out)
***************
*** 682,688 ****
  cb_dialog_response (GtkDialog *dialog, gint response_id, struct DisplayInfo *info)
  {
    gboolean save_computer, clear_computer;
-   
    switch (response_id)
      {
      case GTK_RESPONSE_DELETE_EVENT:
--- 675,680 ----
***************
*** 691,699 ****
      case GTK_RESPONSE_HELP:
        /* FIXME: This needs to be changed to the right section
         * when the docs have been written. */
!       capplet_help (GTK_WINDOW (dialog),
! 		    "wgoscustdesk.xml",
! 		    "goscustdesk-38");
        break;
      case GTK_RESPONSE_APPLY:
        save_computer = info->per_computer_check != NULL && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (info->per_computer_check));
--- 683,689 ----
  	case GTK_RESPONSE_HELP:
  		/* FIXME: This needs to be changed to the right section
  		 * when the docs have been written. */
! 		capplet_help (GTK_WINDOW (dialog), "wgoscustdesk.xml", "goscustdesk-38");
  		break;
  	case GTK_RESPONSE_APPLY:
  		save_computer = info->per_computer_check != NULL && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (info->per_computer_check));
***************
*** 711,720 ****
        save_to_gconf (info, save_computer, clear_computer);
        gtk_main_quit ();
        break;
      }
  }
  
- 
  int
  main (int argc, char *argv[])
  {
--- 701,712 ----
  		save_to_gconf (info, save_computer, clear_computer);
  		gtk_main_quit ();
  		break;
+ 	case GTK_RESPONSE_CLOSE:
+ 		gtk_main_quit ();
+ 		break;
      }
  }
  
  int
  main (int argc, char *argv[])
  {
***************
*** 734,778 ****
  		      GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
  		      NULL);
  
    display = gdk_display_get_default ();
    xdisplay = gdk_x11_display_get_xdisplay (display);
    
!   if (!XRRQueryExtension (xdisplay, &event_base, &error_base) ||
        XRRQueryVersion (xdisplay, &major, &minor) == 0)
      {
!       dialog = gtk_message_dialog_new (NULL,
!                                        GTK_DIALOG_MODAL,
!                                        GTK_MESSAGE_ERROR,
!                                        GTK_BUTTONS_OK,
! 				       _("The Xserver doesn't support the XRandR extension, runtime resolution changes aren't possible."));
        gtk_dialog_run (GTK_DIALOG (dialog));
        gtk_widget_destroy (dialog);
!       exit (0);
      }
!   
!   if (major != 1 || minor < 1)
      {
!       dialog = gtk_message_dialog_new (NULL,
!                                        GTK_DIALOG_MODAL,
!                                        GTK_MESSAGE_ERROR,
!                                        GTK_BUTTONS_OK,
! 				       _("The version of the XRandR extension is incompatible with this program, runtime resolution changes aren't possible."));
        gtk_dialog_run (GTK_DIALOG (dialog));
        gtk_widget_destroy (dialog);
!       exit (0);
      }
  
    info = read_display_info (display);
-   
    dialog = create_dialog (info);
  
!   g_signal_connect (G_OBJECT (dialog),
! 		    "response",
! 		    G_CALLBACK (cb_dialog_response), info);
! 
    gtk_widget_show (dialog);
  
    gtk_main ();
- 
    return 0;
  }
--- 726,759 ----
  		      GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
  		      NULL);
  
+ 
  	display = gdk_display_get_default ();
  	xdisplay = gdk_x11_display_get_xdisplay (display);
    
! 	if(!XRRQueryExtension (xdisplay, &event_base, &error_base) ||
  		XRRQueryVersion (xdisplay, &major, &minor) == 0)
  	{
! 		GdkDisplay *dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, 
! 				_("The XServer does not support the XRandR extenstion, runtime resolution changes aren't available."));
  		gtk_dialog_run (GTK_DIALOG (dialog));
  		gtk_widget_destroy (dialog);
! 		exit(0);
      	}
!   	else if (major != 1 || minor < 1)
  	{
! 		GdkDisplay *dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, 
! 				_("The version of the XRandR extension is incompatible with this program. Runtime changes are not available."));
  		gtk_dialog_run (GTK_DIALOG (dialog));
  		gtk_widget_destroy (dialog);
! 		exit(0);
      	}
  
  	info = read_display_info (display);
  	dialog = create_dialog (info);
  
! 	gtk_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (cb_dialog_response), info);
  	gtk_widget_show (dialog);
  
  	gtk_main ();
  	return 0;
  }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]