summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-01-13 11:35:26 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-01-13 11:35:20 -0500
commit0c56e19a64ea46649fb933dc5a368dddaf8bb937 (patch)
tree0a9bf59130da6525ccb7fafc3a928fd7551593ba
parent7716f58b5d10ac3159488e69cd8d37cc0318da71 (diff)
validate xdg-shell move/resize requests against latest button serial
these are supposed to match in order to initiate the corresponding action
-rw-r--r--src/bin/e_comp_wl.c10
-rw-r--r--src/bin/e_comp_wl.h1
-rw-r--r--src/modules/wl_desktop_shell/xdg5.c2
-rw-r--r--src/modules/wl_desktop_shell/xdg6.c2
4 files changed, 12 insertions, 3 deletions
diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index d7746a0e2..deaa6f404 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -3321,7 +3321,7 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu
3321{ 3321{
3322 Eina_List *l; 3322 Eina_List *l;
3323 struct wl_client *wc; 3323 struct wl_client *wc;
3324 uint32_t serial, btn; 3324 uint32_t serial, btn, *state_serial;
3325 struct wl_resource *res; 3325 struct wl_resource *res;
3326 3326
3327 if (ec->cur_mouse_action || ec->border_menu || e_comp_wl->drag) 3327 if (ec->cur_mouse_action || ec->border_menu || e_comp_wl->drag)
@@ -3353,12 +3353,16 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu
3353 } 3353 }
3354 3354
3355 if (state == WL_POINTER_BUTTON_STATE_PRESSED) 3355 if (state == WL_POINTER_BUTTON_STATE_PRESSED)
3356 e_comp_wl->ptr.button_mask |= 1 << button_id; 3356 {
3357 e_comp_wl->ptr.button_mask |= 1 << button_id;
3358 state_serial = &e_comp_wl->ptr.serial[0];
3359 }
3357 else 3360 else
3358 { 3361 {
3359 /* reject release events if button is not pressed */ 3362 /* reject release events if button is not pressed */
3360 if (!(e_comp_wl->ptr.button_mask & (1 << button_id))) return EINA_FALSE; 3363 if (!(e_comp_wl->ptr.button_mask & (1 << button_id))) return EINA_FALSE;
3361 e_comp_wl->ptr.button_mask &= ~(1 << button_id); 3364 e_comp_wl->ptr.button_mask &= ~(1 << button_id);
3365 state_serial = &e_comp_wl->ptr.serial[1];
3362 } 3366 }
3363 e_comp_wl->ptr.button = btn; 3367 e_comp_wl->ptr.button = btn;
3364 3368
@@ -3368,7 +3372,7 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t bu
3368 return EINA_TRUE; 3372 return EINA_TRUE;
3369 3373
3370 wc = wl_resource_get_client(ec->comp_data->surface); 3374 wc = wl_resource_get_client(ec->comp_data->surface);
3371 serial = wl_display_next_serial(e_comp_wl->wl.disp); 3375 *state_serial = serial = wl_display_next_serial(e_comp_wl->wl.disp);
3372 3376
3373 EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) 3377 EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res)
3374 { 3378 {
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index 8d0ac5a90..a78f5cd0c 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -188,6 +188,7 @@ struct _E_Comp_Wl_Data
188 wl_fixed_t x, y; 188 wl_fixed_t x, y;
189 wl_fixed_t grab_x, grab_y; 189 wl_fixed_t grab_x, grab_y;
190 uint32_t button; 190 uint32_t button;
191 uint32_t serial[2]; //down/up
191 uint32_t button_mask; 192 uint32_t button_mask;
192 E_Client *ec; 193 E_Client *ec;
193 Eina_Bool enabled : 1; 194 Eina_Bool enabled : 1;
diff --git a/src/modules/wl_desktop_shell/xdg5.c b/src/modules/wl_desktop_shell/xdg5.c
index 7d21c6196..4d4857ab4 100644
--- a/src/modules/wl_desktop_shell/xdg5.c
+++ b/src/modules/wl_desktop_shell/xdg5.c
@@ -237,6 +237,7 @@ _e_xdg_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_res
237 if (e_object_is_del(E_OBJECT(ec))) return; 237 if (e_object_is_del(E_OBJECT(ec))) return;
238 238
239 if ((ec->maximized) || (ec->fullscreen)) return; 239 if ((ec->maximized) || (ec->fullscreen)) return;
240 if (serial != e_comp_wl->ptr.serial[0]) return;
240 241
241 switch (e_comp_wl->ptr.button) 242 switch (e_comp_wl->ptr.button)
242 { 243 {
@@ -280,6 +281,7 @@ _e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_r
280 return; 281 return;
281 } 282 }
282 if (e_object_is_del(E_OBJECT(ec))) return; 283 if (e_object_is_del(E_OBJECT(ec))) return;
284 if (serial != e_comp_wl->ptr.serial[0]) return;
283 285
284 if ((edges == 0) || (edges > 15) || 286 if ((edges == 0) || (edges > 15) ||
285 ((edges & 3) == 3) || ((edges & 12) == 12)) return; 287 ((edges & 3) == 3) || ((edges & 12) == 12)) return;
diff --git a/src/modules/wl_desktop_shell/xdg6.c b/src/modules/wl_desktop_shell/xdg6.c
index f9bfd5a9a..8045b450d 100644
--- a/src/modules/wl_desktop_shell/xdg6.c
+++ b/src/modules/wl_desktop_shell/xdg6.c
@@ -1043,6 +1043,7 @@ _e_xdg_toplevel_cb_move(struct wl_client *client EINA_UNUSED, struct wl_resource
1043 if (e_object_is_del(E_OBJECT(ec))) return; 1043 if (e_object_is_del(E_OBJECT(ec))) return;
1044 1044
1045 if ((ec->maximized) || (ec->fullscreen)) return; 1045 if ((ec->maximized) || (ec->fullscreen)) return;
1046 if (serial != e_comp_wl->ptr.serial[0]) return;
1046 1047
1047 switch (e_comp_wl->ptr.button) 1048 switch (e_comp_wl->ptr.button)
1048 { 1049 {
@@ -1086,6 +1087,7 @@ _e_xdg_toplevel_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resour
1086 return; 1087 return;
1087 } 1088 }
1088 if (e_object_is_del(E_OBJECT(ec))) return; 1089 if (e_object_is_del(E_OBJECT(ec))) return;
1090 if (serial != e_comp_wl->ptr.serial[0]) return;
1089 1091
1090 if ((edges == 0) || (edges > 15) || 1092 if ((edges == 0) || (edges > 15) ||
1091 ((edges & 3) == 3) || ((edges & 12) == 12)) return; 1093 ((edges & 3) == 3) || ((edges & 12) == 12)) return;