Change shell_global_get_modifier_keys to shell_global_get_pointer.

We can't use gdk_display_get_pointer/gdk_window_get_pointer from gjs
when XKB is active. We already had a wrapper that did the
get-modifier-state part of that, but some places also need the
get-pointer-location part of it. So update our wrapper to return both,
and update js code to use it.

https://bugzilla.gnome.org/show_bug.cgi?id=613428
This commit is contained in:
Dan Winship
2010-04-08 14:41:54 -04:00
parent 1d2f0e0e15
commit d42263c1bc
4 changed files with 23 additions and 18 deletions

View File

@ -1170,23 +1170,27 @@ shell_global_get_focus_monitor (ShellGlobal *global)
}
/**
* shell_global_get_modifier_keys:
* shell_global_get_pointer:
* @global: the #ShellGlobal
* @x: (out): the X coordinate of the pointer, in global coordinates
* @y: (out): the Y coordinate of the pointer, in global coordinates
* @mods: (out): the current set of modifier keys that are pressed down
*
* Gets the current set of modifier keys that are pressed down;
* this is a wrapper around gdk_display_get_pointer() that strips
* Gets the pointer coordinates and current modifier key state.
* 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)
void
shell_global_get_pointer (ShellGlobal *global,
int *x,
int *y,
ClutterModifierType *mods)
{
GdkModifierType mods;
GdkModifierType raw_mods;
gdk_display_get_pointer (gdk_display_get_default (), NULL, NULL, NULL, &mods);
return mods & GDK_MODIFIER_MASK;
gdk_display_get_pointer (gdk_display_get_default (), NULL, x, y, &raw_mods);
*mods = raw_mods & GDK_MODIFIER_MASK;
}
/**