[mutter] MetaScreen::keyboard-grabbed property



commit 2a8c160569c146d436bf94ac0babc46e1f21a7e9
Author: Tomas Frydrych <tf linux intel com>
Date:   Tue May 5 09:39:29 2009 +0100

    MetaScreen::keyboard-grabbed property
    
      gboolean read-only property that tracks the all_keys_grabbed flag of
      MetaScreen.
---
 src/core/keybindings.c |    6 +++++-
 src/core/screen.c      |   16 +++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 7de3b8c..a7c6ade 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -940,7 +940,10 @@ meta_screen_grab_all_keys (MetaScreen *screen, guint32 timestamp)
               "Grabbing all keys on RootWindow\n");
   retval = grab_keyboard (screen->display, screen->xroot, timestamp);
   if (retval)
-    screen->all_keys_grabbed = TRUE;
+    {
+      screen->all_keys_grabbed = TRUE;
+      g_object_notify (G_OBJECT (screen), "keyboard-grabbed");
+    }
   else
     meta_screen_grab_keys (screen);
 
@@ -959,6 +962,7 @@ meta_screen_ungrab_all_keys (MetaScreen *screen, guint32 timestamp)
 
       /* Re-establish our standard bindings */
       meta_screen_grab_keys (screen);
+      g_object_notify (G_OBJECT (screen), "keyboard-grabbed");
     }
 }
 
diff --git a/src/core/screen.c b/src/core/screen.c
index 10fc336..777bd73 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -72,7 +72,8 @@ static void meta_screen_sn_event   (SnMonitorEvent *event,
 
 enum
 {
-  PROP_N_WORKSPACES = 1
+  PROP_N_WORKSPACES = 1,
+  PROP_KEYBOARD_GRABBED,
 };
 
 enum
@@ -118,6 +119,9 @@ meta_screen_get_property (GObject      *object,
     case PROP_N_WORKSPACES:
       g_value_set_int (value, meta_screen_get_n_workspaces (screen));
       break;
+    case PROP_KEYBOARD_GRABBED:
+      g_value_set_boolean (value, screen->all_keys_grabbed ? TRUE : FALSE);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -167,6 +171,16 @@ meta_screen_class_init (MetaScreenClass *klass)
   g_object_class_install_property (object_class,
                                    PROP_N_WORKSPACES,
                                    pspec);
+
+  pspec = g_param_spec_boolean ("keyboard-grabbed",
+                                "Keyboard grabbed",
+                                "Whether the keyboard is grabbed",
+                                FALSE,
+                                G_PARAM_READABLE);
+
+  g_object_class_install_property (object_class,
+                                   PROP_KEYBOARD_GRABBED,
+                                   pspec);
 }
 
 static void



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