[gnome-screensaver] Request shell exit overview when locking screen
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-screensaver] Request shell exit overview when locking screen
- Date: Mon, 21 Mar 2011 20:46:13 +0000 (UTC)
commit c8b9123d4540f2b8055822b857b534a27ca8e8c2
Author: Colin Walters <walters verbum org>
Date: Sat Dec 18 17:10:39 2010 -0500
Request shell exit overview when locking screen
Shell has a keyboard grab in the overview; request that we bounce
out of the overview before dropping into the try-to-grab loop.
We do this asynchronously, since the try-to-grab loop exists anyways.
https://bugzilla.gnome.org/show_bug.cgi?id=637540
src/gs-grab-x11.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c
index a8c1de0..1169388 100644
--- a/src/gs-grab-x11.c
+++ b/src/gs-grab-x11.c
@@ -49,6 +49,8 @@ static gpointer grab_object = NULL;
struct GSGrabPrivate
{
+ GDBusConnection *session_bus;
+
guint mouse_hide_cursor : 1;
GdkWindow *mouse_grab_window;
GdkWindow *keyboard_grab_window;
@@ -406,6 +408,39 @@ gs_grab_release (GSGrab *grab)
gdk_flush ();
}
+/* The GNOME 3 Shell holds an X grab when we're in the overview;
+ * ask it to bounce out before we try locking the screen.
+ */
+static void
+request_shell_exit_overview (GSGrab *grab)
+{
+ GDBusMessage *reply;
+ GDBusMessage *message;
+ GError *error = NULL;
+
+ /* Shouldn't happen, but... */
+ if (!grab->priv->session_bus)
+ return;
+
+ message = g_dbus_message_new_method_call ("org.gnome.Shell",
+ "/org/gnome/Shell",
+ "org.freedesktop.DBus.Properties",
+ "Set");
+ g_dbus_message_set_body (message,
+ g_variant_new ("(ssv)",
+ "org.gnome.Shell",
+ "OverviewActive",
+ g_variant_new ("b",
+ FALSE)));
+
+ g_dbus_connection_send_message (grab->priv->session_bus,
+ message,
+ G_DBUS_SEND_MESSAGE_FLAGS_NONE,
+ NULL,
+ NULL);
+ g_object_unref (message);
+}
+
gboolean
gs_grab_grab_window (GSGrab *grab,
GdkWindow *window,
@@ -418,6 +453,9 @@ gs_grab_grab_window (GSGrab *grab,
int retries = 4;
gboolean focus_fuckus = FALSE;
+ /* First, have stuff we control in GNOME un-grab */
+ request_shell_exit_overview (grab);
+
AGAIN:
for (i = 0; i < retries; i++) {
@@ -563,6 +601,8 @@ gs_grab_init (GSGrab *grab)
{
grab->priv = GS_GRAB_GET_PRIVATE (grab);
+ grab->priv->session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+
grab->priv->mouse_hide_cursor = FALSE;
grab->priv->invisible = gtk_invisible_new ();
gtk_widget_show (grab->priv->invisible);
@@ -578,6 +618,8 @@ gs_grab_finalize (GObject *object)
grab = GS_GRAB (object);
+ g_object_unref (grab->priv->session_bus);
+
g_return_if_fail (grab->priv != NULL);
gtk_widget_destroy (grab->priv->invisible);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]