[gnome-shell] Change shell_global_get_modifier_keys to shell_global_get_pointer.
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Change shell_global_get_modifier_keys to shell_global_get_pointer.
- Date: Thu, 8 Apr 2010 18:52:23 +0000 (UTC)
commit d42263c1bca758f98911be4f0eb843436be6bfcf
Author: Dan Winship <danw gnome org>
Date: Thu Apr 8 14:41:54 2010 -0400
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
js/ui/altTab.js | 2 +-
js/ui/workspace.js | 10 ++++------
src/shell-global.c | 24 ++++++++++++++----------
src/shell-global.h | 5 ++++-
4 files changed, 23 insertions(+), 18 deletions(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index 350fe8d..e0c36de 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -173,7 +173,7 @@ AltTabPopup.prototype = {
// https://bugzilla.gnome.org/show_bug.cgi?id=596695 for
// details.) So we check now. (Have to do this after updating
// selection.)
- let mods = global.get_modifier_keys();
+ let [x, y, mods] = global.get_pointer();
if (!(mods & Gdk.ModifierType.MOD1_MASK)) {
this._finish();
return false;
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 63ee3fc..77d41b4 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -423,7 +423,7 @@ WindowOverlay.prototype = {
},
show: function() {
- let [child, x, y, mask] = Gdk.Screen.get_default().get_root_window().get_pointer();
+ let [x, y, mask] = global.get_pointer();
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE,
x, y);
if (actor == this._windowClone.actor) {
@@ -533,7 +533,7 @@ WindowOverlay.prototype = {
_idleToggleCloseButton: function() {
this._idleToggleCloseId = 0;
- let [child, x, y, mask] = Gdk.Screen.get_default().get_root_window().get_pointer();
+ let [x, y, mask] = global.get_pointer();
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE,
x, y);
if (actor != this._windowClone.actor && actor != this.closeButton) {
@@ -1185,8 +1185,7 @@ Workspace.prototype = {
if (this._windowIsZooming)
return true;
- let [child, x, y, mask] =
- Gdk.Screen.get_default().get_root_window().get_pointer();
+ let [x, y, mask] = global.get_pointer();
let wsWidth = this.actor.width * this.scale;
let wsHeight = this.actor.height * this.scale;
@@ -1258,8 +1257,7 @@ Workspace.prototype = {
}
// setup new handler
- let [child, x, y, mask] =
- Gdk.Screen.get_default().get_root_window().get_pointer();
+ let [x, y, mask] = global.get_pointer();
this._cursorX = x;
this._cursorY = y;
diff --git a/src/shell-global.c b/src/shell-global.c
index 3d78780..d2d2908 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -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;
}
/**
diff --git a/src/shell-global.h b/src/shell-global.h
index a3cd89c..5ac31d8 100644
--- a/src/shell-global.h
+++ b/src/shell-global.h
@@ -82,7 +82,10 @@ 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);
+void shell_global_get_pointer (ShellGlobal *global,
+ int *x,
+ int *y,
+ ClutterModifierType *mods);
ClutterModifierType shell_get_event_state (ClutterEvent *event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]