summaryrefslogtreecommitdiff
path: root/src/lib/ecore_x
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-09-22 09:54:37 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-09-22 10:10:07 -0400
commit72e9d604a36d18aa18740323ddcbd99f6f9bf8a7 (patch)
tree6a1f6e3231f5893df160bff80ad689838efe8ca4 /src/lib/ecore_x
parent0cdd50124690ea0d72bef304fff15b4be2adee41 (diff)
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
Diffstat (limited to 'src/lib/ecore_x')
-rw-r--r--src/lib/ecore_x/ecore_x_events.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/lib/ecore_x/ecore_x_events.c b/src/lib/ecore_x/ecore_x_events.c
index acd0d67..11d0988 100644
--- a/src/lib/ecore_x/ecore_x_events.c
+++ b/src/lib/ecore_x/ecore_x_events.c
@@ -2047,34 +2047,40 @@ void
2047_ecore_x_event_handle_mapping_notify(XEvent *xevent) 2047_ecore_x_event_handle_mapping_notify(XEvent *xevent)
2048{ 2048{
2049 Ecore_X_Event_Mapping_Change *e; 2049 Ecore_X_Event_Mapping_Change *e;
2050 static unsigned long last_serial;
2051 int type;
2050 2052
2051 _ecore_x_last_event_mouse_move = 0; 2053 _ecore_x_last_event_mouse_move = 0;
2052 2054
2053 _ecore_x_window_grab_suspend();
2054 _ecore_x_key_grab_suspend();
2055
2056 XRefreshKeyboardMapping((XMappingEvent *)xevent);
2057 _ecore_x_modifiers_get();
2058
2059 _ecore_x_window_grab_resume();
2060 _ecore_x_key_grab_resume();
2061 e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change));
2062 if (!e) return;
2063 switch (xevent->xmapping.request) 2055 switch (xevent->xmapping.request)
2064 { 2056 {
2065 case MappingModifier: 2057 case MappingModifier:
2066 e->type = ECORE_X_MAPPING_MODIFIER; 2058 type = ECORE_X_MAPPING_MODIFIER;
2067 break; 2059 break;
2068 2060
2069 case MappingKeyboard: 2061 case MappingKeyboard:
2070 e->type = ECORE_X_MAPPING_KEYBOARD; 2062 if ((last_serial && (xevent->xmapping.serial == last_serial))) return;
2063 type = ECORE_X_MAPPING_KEYBOARD;
2064 last_serial = xevent->xmapping.serial;
2071 break; 2065 break;
2072 2066
2073 case MappingPointer: 2067 case MappingPointer:
2074 default: 2068 default:
2075 e->type = ECORE_X_MAPPING_MOUSE; 2069 type = ECORE_X_MAPPING_MOUSE;
2076 break; 2070 break;
2077 } 2071 }
2072
2073 _ecore_x_window_grab_suspend();
2074 _ecore_x_key_grab_suspend();
2075
2076 XRefreshKeyboardMapping((XMappingEvent *)xevent);
2077 _ecore_x_modifiers_get();
2078
2079 _ecore_x_window_grab_resume();
2080 _ecore_x_key_grab_resume();
2081 e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change));
2082 if (!e) return;
2083 e->type = type;
2078 e->keycode = xevent->xmapping.first_keycode; 2084 e->keycode = xevent->xmapping.first_keycode;
2079 e->num = xevent->xmapping.count; 2085 e->num = xevent->xmapping.count;
2080 ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL); 2086 ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL);