Deal with unknown flags from ClutterEvent.get_state()
When we get a ClutterModifierType from Clutter, it might contain bits not in the enumeration. See bug 59771 for a similar problem with GdkModifierType. Add a wrapper Shell.get_event_state() around clutter_event_get_state() to mask these bits out and only return approved bits. https://bugzilla.gnome.org/show_bug.cgi?id=597735
This commit is contained in:
parent
a81a16801d
commit
ff39edd1ee
@ -148,7 +148,7 @@ AltTabPopup.prototype = {
|
|||||||
|
|
||||||
_keyPressEvent : function(actor, event) {
|
_keyPressEvent : function(actor, event) {
|
||||||
let keysym = event.get_key_symbol();
|
let keysym = event.get_key_symbol();
|
||||||
let shift = (event.get_state() & Clutter.ModifierType.SHIFT_MASK);
|
let shift = (Shell.get_event_state(event) & Clutter.ModifierType.SHIFT_MASK);
|
||||||
|
|
||||||
// The WASD stuff is for debugging in Xephyr, where the arrow
|
// The WASD stuff is for debugging in Xephyr, where the arrow
|
||||||
// keys aren't mapped correctly
|
// keys aren't mapped correctly
|
||||||
|
@ -554,7 +554,7 @@ RunningWellItem.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onActivate: function (actor, event) {
|
_onActivate: function (actor, event) {
|
||||||
let modifiers = event.get_state();
|
let modifiers = Shell.get_event_state(event);
|
||||||
|
|
||||||
if (modifiers & Clutter.ModifierType.CONTROL_MASK) {
|
if (modifiers & Clutter.ModifierType.CONTROL_MASK) {
|
||||||
this.appInfo.launch();
|
this.appInfo.launch();
|
||||||
|
@ -201,7 +201,7 @@ function _globalKeyPressHandler(actor, event) {
|
|||||||
overview.hide();
|
overview.hide();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (symbol == Clutter.F2 && (event.get_state() & Clutter.ModifierType.MOD1_MASK)) {
|
} else if (symbol == Clutter.F2 && (Shell.get_event_state(event) & Clutter.ModifierType.MOD1_MASK)) {
|
||||||
getRunDialog().open();
|
getRunDialog().open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -998,3 +998,22 @@ shell_global_get_modifier_keys (ShellGlobal *global)
|
|||||||
gdk_display_get_pointer (gdk_display_get_default (), NULL, NULL, NULL, &mods);
|
gdk_display_get_pointer (gdk_display_get_default (), NULL, NULL, NULL, &mods);
|
||||||
return mods & GDK_MODIFIER_MASK;
|
return mods & GDK_MODIFIER_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* shell_get_event_state:
|
||||||
|
* @event: a #ClutterEvent
|
||||||
|
*
|
||||||
|
* Gets the current state of the event (the set of modifier keys that
|
||||||
|
* are pressed down). Thhis is a wrapper around
|
||||||
|
* clutter_event_get_state() 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 state from the event
|
||||||
|
*/
|
||||||
|
ClutterModifierType
|
||||||
|
shell_get_event_state (ClutterEvent *event)
|
||||||
|
{
|
||||||
|
ClutterModifierType state = clutter_event_get_state (event);
|
||||||
|
return state & CLUTTER_MODIFIER_MASK;
|
||||||
|
}
|
||||||
|
@ -79,6 +79,8 @@ GdkRectangle *shell_global_get_focus_monitor (ShellGlobal *global);
|
|||||||
|
|
||||||
GdkModifierType shell_global_get_modifier_keys (ShellGlobal *global);
|
GdkModifierType shell_global_get_modifier_keys (ShellGlobal *global);
|
||||||
|
|
||||||
|
ClutterModifierType shell_get_event_state (ClutterEvent *event);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __SHELL_GLOBAL_H__ */
|
#endif /* __SHELL_GLOBAL_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user