aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry <thierry@substantiel.fr>2019-02-13 11:28:01 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-02-13 11:39:39 -0500
commit56f06d21c19cddb056f6ced6822b275c08ebfc3a (patch)
tree3d83873e8af26882b49377c6e6e4744d1c6faabf
parentecore_wl2: Make our wayland socket handling thread safe (diff)
downloadefl-56f06d21c19cddb056f6ced6822b275c08ebfc3a.tar.gz
ecore-x: only modify _ecore_key_grabs when key is toggled
A New entry is added to _ecore_key_grabs even when no key was grabbed. Summary: The key grab and ungrab functions should return which keycode was used. Proposed by pascal@ordissimo.com Reviewers: zmike Reviewed By: zmike Subscribers: zmike, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7923
-rw-r--r--src/lib/ecore_x/ecore_x.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/lib/ecore_x/ecore_x.c b/src/lib/ecore_x/ecore_x.c
index bab8a41f6d..ae357df542 100644
--- a/src/lib/ecore_x/ecore_x.c
+++ b/src/lib/ecore_x/ecore_x.c
@@ -1921,7 +1921,7 @@ struct _Keygrab
};
Keygrab *_ecore_key_grabs = NULL;
-static void
+static KeyCode
_ecore_x_window_key_grab_internal(Ecore_X_Window win,
const char *key,
int mod,
@@ -1940,13 +1940,13 @@ _ecore_x_window_key_grab_internal(Ecore_X_Window win,
{
keysym = XStringToKeysym(key);
if (keysym == NoSymbol)
- return;
+ return 0;
keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
}
if (keycode == 0)
- return;
+ return 0;
m = _ecore_x_event_modifier(mod);
if (any_mod)
@@ -1966,6 +1966,7 @@ _ecore_x_window_key_grab_internal(Ecore_X_Window win,
win, False, GrabModeAsync, GrabModeAsync);
if (_ecore_xlib_sync) ecore_x_sync();
}
+ return keycode;
}
EAPI void
@@ -1975,9 +1976,11 @@ ecore_x_window_key_grab(Ecore_X_Window win,
int any_mod)
{
Keygrab *t;
+ KeyCode keycode;
EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
- _ecore_x_window_key_grab_internal(win, key, mod, any_mod);
+ if (!(keycode = _ecore_x_window_key_grab_internal(win, key, mod, any_mod)))
+ return;
_ecore_key_grabs_num++;
t = realloc(_ecore_key_grabs,
_ecore_key_grabs_num * sizeof(Keygrab));
@@ -2034,7 +2037,7 @@ _ecore_x_key_grab_remove(Ecore_X_Window win,
return shuffle;
}
-static void
+static KeyCode
_ecore_x_window_key_ungrab_internal(Ecore_X_Window win,
const char *key,
int mod,
@@ -2053,13 +2056,13 @@ _ecore_x_window_key_ungrab_internal(Ecore_X_Window win,
{
keysym = XStringToKeysym(key);
if (keysym == NoSymbol)
- return;
+ return 0;
keycode = XKeysymToKeycode(_ecore_x_disp, keysym);
}
if (keycode == 0)
- return;
+ return 0;
m = _ecore_x_event_modifier(mod);
if (any_mod)
@@ -2075,6 +2078,7 @@ _ecore_x_window_key_ungrab_internal(Ecore_X_Window win,
locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL;
for (i = 0; i < 8; i++)
XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win);
+ return keycode;
}
EAPI void