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
This commit is contained in:
Mike Blumenkrantz 2017-09-22 09:54:37 -04:00
parent 0cdd501246
commit 72e9d604a3
2 changed files with 22 additions and 16 deletions

View File

@ -2047,9 +2047,29 @@ 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;
switch (xevent->xmapping.request)
{
case MappingModifier:
type = ECORE_X_MAPPING_MODIFIER;
break;
case MappingKeyboard:
if ((last_serial && (xevent->xmapping.serial == last_serial))) return;
type = ECORE_X_MAPPING_KEYBOARD;
last_serial = xevent->xmapping.serial;
break;
case MappingPointer:
default:
type = ECORE_X_MAPPING_MOUSE;
break;
}
_ecore_x_window_grab_suspend();
_ecore_x_key_grab_suspend();
@ -2060,21 +2080,7 @@ _ecore_x_event_handle_mapping_notify(XEvent *xevent)
_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;
break;
case MappingKeyboard:
e->type = ECORE_X_MAPPING_KEYBOARD;
break;
case MappingPointer:
default:
e->type = ECORE_X_MAPPING_MOUSE;
break;
}
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);

View File

@ -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");