summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2009-10-06 14:53:25 (GMT)
committerDan Winship <danw@gnome.org>2009-10-06 20:07:37 (GMT)
commit439daf828f89e64c0090140e27ea0f337b51ac3a (patch)
tree396215710b650c3a1c74401c86b3943d6914b7b6
parentd120d03de9b758366c3ae3e040b765f26a12f6e8 (diff)
downloadgnome-shell-439daf828f89e64c0090140e27ea0f337b51ac3a.tar.gz
gnome-shell-439daf828f89e64c0090140e27ea0f337b51ac3a.tar.xz
[AppSwitcher] add a workaround for a gjs problem with GdkModifierType
gdk_display_get_pointer() sometimes returns values for the mask that aren't part of the GdkModifierType enumeration, which gjs doesn't like (bug 597292). Work around that by adding a C wrapper that strips out the extra flags. https://bugzilla.gnome.org/show_bug.cgi?id=597559
-rw-r--r--js/ui/altTab.js2
-rw-r--r--src/shell-global.c20
-rw-r--r--src/shell-global.h2
3 files changed, 23 insertions, 1 deletions
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 532c20a..f3d3d6a 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -158,7 +158,7 @@ AltTabPopup.prototype = {
// https://bugzilla.gnome.org/show_bug.cgi?id=596695 for
// details.) So we check now. (Have to do this after calling
// _updateSelection.)
- let [screen, x, y, mods] = Gdk.Display.get_default().get_pointer();
+ let mods = global.get_modifier_keys();
if (!(mods & Gdk.ModifierType.MOD1_MASK)) {
this._finish();
return false;
diff --git a/src/shell-global.c b/src/shell-global.c
index 96e1c3c..65688e7 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -978,3 +978,23 @@ shell_global_get_focus_monitor (ShellGlobal *global)
meta_screen_get_monitor_geometry (screen, 0, &rect);
return g_boxed_copy (GDK_TYPE_RECTANGLE, &rect);
}
+
+/**
+ * shell_global_get_modifier_keys:
+ * @global: the #ShellGlobal
+ *
+ * Gets the current set of modifier keys that are pressed down;
+ * this is a wrapper around gdk_display_get_pointer() that strips
+ * out any un-declared modifier flags, to make gjs happy; see
+ * https://bugzilla.gnome.org/show_bug.cgi?id=597292.
+ *
+ * Return value: the current modifiers
+ */
+GdkModifierType
+shell_global_get_modifier_keys (ShellGlobal *global)
+{
+ GdkModifierType mods;
+
+ gdk_display_get_pointer (gdk_display_get_default (), NULL, NULL, NULL, &mods);
+ return mods & GDK_MODIFIER_MASK;
+}
diff --git a/src/shell-global.h b/src/shell-global.h
index ca389ce..fe01aeb 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -77,6 +77,8 @@ GSList *shell_global_get_monitors (ShellGlobal *global);
GdkRectangle *shell_global_get_primary_monitor (ShellGlobal *global);
GdkRectangle *shell_global_get_focus_monitor (ShellGlobal *global);
+GdkModifierType shell_global_get_modifier_keys (ShellGlobal *global);
+
G_END_DECLS
#endif /* __SHELL_GLOBAL_H__ */