From f13ff93f8fcda22566bc9128330bce096356c98c Mon Sep 17 00:00:00 2001 From: Jody Goldberg Date: Thu, 15 Apr 2004 21:14:50 +0000 Subject: [PATCH] For Alex Larsson : 2004-04-15 Jody Goldberg For Alex Larsson : https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=119494 * main.c : fix reverting size change --- NEWS | 4 +++ capplets/display/ChangeLog | 6 ++++ capplets/display/main.c | 66 ++++++++++++++++++++++++++++++++++---- control-center/ChangeLog | 6 ++++ 4 files changed, 76 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 06161a795..78fa187c4 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ gnome-control-center 2.6.1 +Alex Larsson: + https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=119494 + * Fix reverting a size change. + Chris Lahey: * Fix ordering of themes in theme manager * Fix sizing of svg backgrounds diff --git a/capplets/display/ChangeLog b/capplets/display/ChangeLog index 71b919f60..50ba5a8ca 100644 --- a/capplets/display/ChangeLog +++ b/capplets/display/ChangeLog @@ -1,3 +1,9 @@ +2004-04-15 Jody Goldberg + + For Alex Larsson : + https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=119494 + * main.c : fix reverting size change + 2004-04-01 Jody Goldberg * Release 2.6.0.3 diff --git a/capplets/display/main.c b/capplets/display/main.c index ef681342d..eefa4c60d 100644 --- a/capplets/display/main.c +++ b/capplets/display/main.c @@ -19,6 +19,10 @@ struct ScreenInfo SizeID current_size; short current_rate; Rotation current_rotation; + + SizeID old_size; + short old_rate; + Rotation old_rotation; XRRScreenConfiguration *config; XRRScreenSize *sizes; @@ -73,6 +77,40 @@ read_display_info (GdkDisplay *display) return info; } +void +update_display_info (struct DisplayInfo *info, GdkDisplay *display) +{ + struct ScreenInfo *screen_info; + GdkScreen *screen; + GdkWindow *root_window; + int i; + + g_assert (info->n_screens == gdk_display_get_n_screens (display)); + + for (i = 0; i < info->n_screens; i++) + { + screen = gdk_display_get_screen (display, i); + + screen_info = &info->screens[i]; + + screen_info->old_rate = screen_info->current_rate; + screen_info->old_size = screen_info->current_size; + screen_info->old_rotation = screen_info->current_rotation; + + screen_info->current_width = gdk_screen_get_width (screen); + screen_info->current_height = gdk_screen_get_height (screen); + + root_window = gdk_screen_get_root_window (screen); + XRRFreeScreenConfigInfo (screen_info->config); + screen_info->config = XRRGetScreenInfo (gdk_x11_display_get_xdisplay (display), + gdk_x11_drawable_get_xid (GDK_DRAWABLE (root_window))); + + screen_info->current_rate = XRRConfigCurrentRate (screen_info->config); + screen_info->current_size = XRRConfigCurrentConfiguration (screen_info->config, &screen_info->current_rotation); + screen_info->sizes = XRRConfigSizes (screen_info->config, &screen_info->n_sizes); + } +} + static int get_current_resolution (struct ScreenInfo *screen_info) { @@ -150,6 +188,8 @@ apply_config (struct DisplayInfo *info) GDK_CURRENT_TIME); } } + + update_display_info (info, display); /* xscreensaver should handle this itself, but does not currently so we hack * it. Ignore failures in case xscreensaver is not installed */ @@ -182,14 +222,28 @@ revert_config (struct DisplayInfo *info) status = XRRSetScreenConfigAndRate (xdisplay, screen_info->config, gdk_x11_drawable_get_xid (GDK_DRAWABLE (root_window)), - screen_info->current_size, - screen_info->current_rotation, - screen_info->current_rate, + screen_info->old_size, + screen_info->old_rotation, + screen_info->old_rate, GDK_CURRENT_TIME); - - generate_resolution_menu(screen_info); - generate_rate_menu(screen_info); + } + + update_display_info (info, display); + + /* Need to update the menus to the new settings */ + for (i = 0; i < info->n_screens; i++) + { + struct ScreenInfo *screen_info = &info->screens[i]; + + generate_resolution_menu (screen_info); + generate_rate_menu (screen_info); + } + + /* xscreensaver should handle this itself, but does not currently so we hack + * it. Ignore failures in case xscreensaver is not installed */ + g_spawn_command_line_async ("xscreensaver-command -restart", NULL); + return 0; } diff --git a/control-center/ChangeLog b/control-center/ChangeLog index 30802f2f1..6a0537235 100644 --- a/control-center/ChangeLog +++ b/control-center/ChangeLog @@ -1,3 +1,9 @@ +2004-04-15 Jody Goldberg + + * capplet-dir.c (find_icon) : pull in some code from nautilus and eel + to ignore some image extensions. Themed icons should have + extensions. + 2004-04-01 Jody Goldberg * Release 2.6.0.3