diff options
author | Ray Strode <rstrode@redhat.com> | 2010-09-09 13:33:07 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@novell.com> | 2010-09-09 13:33:51 -0500 |
commit | de124b667434d0f15d22cbd0e654e9fc31f83116 (patch) | |
tree | accbbe9692fb5922bb6797e2ac3ea1210a40189f | |
parent | 34075e423857379c79edd4f27ab1071aebd90acc (diff) | |
download | gnome-desktop-de124b667434d0f15d22cbd0e654e9fc31f83116.tar.gz |
bgo#621046 - [randr] Force a refresh of timestamps so other clients won't think this is a server-generated event
'Detect displays' in the control center's display capplet works by calling
gnome_rr_screen_refresh(). However, this causes gnome-settings-daemon's
RANDR plug-in to get an event, which makes it think that it should reconfigure
the displays. Here, we grab the X server and do a no-op XRRSetCrtcConfig() so
that when we ungrab, the X server will send out an RRNotify event with an
updated timestamp. This will cause g-s-d not to reconfigure the displays, thus
making 'Detect displays' really be 'detect only', not 'detect and reconfigure'.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
-rw-r--r-- | libgnome-desktop/gnome-rr.c | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c index edfc2a97..e1dacac3 100644 --- a/libgnome-desktop/gnome-rr.c +++ b/libgnome-desktop/gnome-rr.c @@ -801,6 +801,51 @@ gnome_rr_screen_get_timestamps (GnomeRRScreen *screen, #endif } +static gboolean +force_timestamp_update (GnomeRRScreen *screen) +{ + GnomeRRCrtc *crtc; + XRRCrtcInfo *current_info; + Status status; + gboolean timestamp_updated; + + timestamp_updated = FALSE; + + crtc = screen->info->crtcs[0]; + + if (crtc == NULL) + goto out; + + current_info = XRRGetCrtcInfo (screen->xdisplay, + screen->info->resources, + crtc->id); + + if (current_info == NULL) + goto out; + + gdk_error_trap_push (); + status = XRRSetCrtcConfig (screen->xdisplay, + screen->info->resources, + crtc->id, + current_info->timestamp, + current_info->x, + current_info->y, + current_info->mode, + current_info->rotation, + current_info->outputs, + current_info->noutput); + + XRRFreeCrtcInfo (current_info); + + gdk_flush (); + if (gdk_error_trap_pop ()) + goto out; + + if (status == RRSetConfigSuccess) + timestamp_updated = TRUE; +out: + return timestamp_updated; +} /** * gnome_rr_screen_refresh @@ -819,8 +864,18 @@ gboolean gnome_rr_screen_refresh (GnomeRRScreen *screen, GError **error) { + gboolean refreshed; + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - return screen_update (screen, FALSE, TRUE, error); + + gdk_x11_display_grab (gdk_screen_get_display (screen->gdk_screen)); + + refreshed = screen_update (screen, FALSE, TRUE, error); + force_timestamp_update (screen); /* this is to keep other clients from thinking that the X server re-detected things by itself - bgo#621046 */ + + gdk_x11_display_ungrab (gdk_screen_get_display (screen->gdk_screen)); + + return refreshed; } GnomeRRMode ** |