[gnome-desktop/gnome-2-32] bgo#621046 - [randr] Force a refresh of timestamps so other clients won't think this is a server-gen
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop/gnome-2-32] bgo#621046 - [randr] Force a refresh of timestamps so other clients won't think this is a server-gen
- Date: Thu, 9 Sep 2010 18:23:58 +0000 (UTC)
commit 6879786fe221ec1023f6e3c73d3d8c3fdcc5e576
Author: Ray Strode <rstrode redhat com>
Date: Thu Sep 9 13:33:07 2010 -0500
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>
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 edfc2a9..e1dacac 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 **
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]