diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-09-22 09:54:37 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-09-22 10:10:07 -0400 |
commit | 72e9d604a36d18aa18740323ddcbd99f6f9bf8a7 (patch) | |
tree | 6a1f6e3231f5893df160bff80ad689838efe8ca4 | |
parent | 0cdd50124690ea0d72bef304fff15b4be2adee41 (diff) | |
download | efl-72e9d604a36d18aa18740323ddcbd99f6f9bf8a7.tar.gz |
ecore-x: reject successive MappingNotify events if they are identical
in some cases loading an xmodmap on enlightenment startup can trigger an infinite
number of identical events which hard locks the xserver for a very, very long time
@fix
-rw-r--r-- | src/lib/ecore_x/ecore_x_events.c | 32 | ||||
-rw-r--r-- | src/lib/efl_wl/efl_wl.c | 2 |
2 files changed, 20 insertions, 14 deletions
diff --git a/src/lib/ecore_x/ecore_x_events.c b/src/lib/ecore_x/ecore_x_events.c index acd0d67176..11d098826e 100644 --- a/src/lib/ecore_x/ecore_x_events.c +++ b/src/lib/ecore_x/ecore_x_events.c @@ -2047,34 +2047,40 @@ void _ecore_x_event_handle_mapping_notify(XEvent *xevent) { Ecore_X_Event_Mapping_Change *e; + static unsigned long last_serial; + int type; _ecore_x_last_event_mouse_move = 0; - _ecore_x_window_grab_suspend(); - _ecore_x_key_grab_suspend(); - - XRefreshKeyboardMapping((XMappingEvent *)xevent); - _ecore_x_modifiers_get(); - - _ecore_x_window_grab_resume(); - _ecore_x_key_grab_resume(); - e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)); - if (!e) return; switch (xevent->xmapping.request) { case MappingModifier: - e->type = ECORE_X_MAPPING_MODIFIER; + type = ECORE_X_MAPPING_MODIFIER; break; case MappingKeyboard: - e->type = ECORE_X_MAPPING_KEYBOARD; + if ((last_serial && (xevent->xmapping.serial == last_serial))) return; + type = ECORE_X_MAPPING_KEYBOARD; + last_serial = xevent->xmapping.serial; break; case MappingPointer: default: - e->type = ECORE_X_MAPPING_MOUSE; + type = ECORE_X_MAPPING_MOUSE; break; } + + _ecore_x_window_grab_suspend(); + _ecore_x_key_grab_suspend(); + + XRefreshKeyboardMapping((XMappingEvent *)xevent); + _ecore_x_modifiers_get(); + + _ecore_x_window_grab_resume(); + _ecore_x_key_grab_resume(); + e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)); + if (!e) return; + e->type = type; e->keycode = xevent->xmapping.first_keycode; e->num = xevent->xmapping.count; ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL); diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c index 5c317141af..8a1a7c2b7c 100644 --- a/src/lib/efl_wl/efl_wl.c +++ b/src/lib/efl_wl/efl_wl.c @@ -5355,7 +5355,7 @@ efl_wl_run(Evas_Object *obj, const char *cmd) if (gl) gl = strdup(gl); setenv("ELM_ACCEL", "gl", 1); } - exe = ecore_exe_run(cmd, c); + exe = ecore_exe_pipe_run(cmd, ECORE_EXE_TERM_WITH_PARENT, c); if (disp) setenv("DISPLAY", disp, 1); if (env) setenv("WAYLAND_DISPLAY", env, 1); else unsetenv("WAYLAND_DISPLAY"); |