MetaScreen::keyboard-grabbed property

gboolean read-only property that tracks the all_keys_grabbed flag of
  MetaScreen.
This commit is contained in:
Tomas Frydrych 2009-05-05 09:39:29 +01:00
parent 1d5117a607
commit 2a8c160569
2 changed files with 20 additions and 2 deletions

View File

@ -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");
}
}

View File

@ -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