discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=0c56e19a64ea46649fb933dc5a368dddaf8bb937

commit 0c56e19a64ea46649fb933dc5a368dddaf8bb937
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Fri Jan 13 11:35:26 2017 -0500

    validate xdg-shell move/resize requests against latest button serial
    
    these are supposed to match in order to initiate the corresponding action
---
 src/bin/e_comp_wl.c                 | 10 +++++++---
 src/bin/e_comp_wl.h                 |  1 +
 src/modules/wl_desktop_shell/xdg5.c |  2 ++
 src/modules/wl_desktop_shell/xdg6.c |  2 ++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index d7746a0..deaa6f4 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
 {
    Eina_List *l;
    struct wl_client *wc;
-   uint32_t serial, btn;
+   uint32_t serial, btn, *state_serial;
    struct wl_resource *res;
 
    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
      }
 
    if (state == WL_POINTER_BUTTON_STATE_PRESSED)
-     e_comp_wl->ptr.button_mask |= 1 << button_id;
+     {
+        e_comp_wl->ptr.button_mask |= 1 << button_id;
+        state_serial = &e_comp_wl->ptr.serial[0];
+     }
    else
      {
         /* reject release events if button is not pressed */
         if (!(e_comp_wl->ptr.button_mask & (1 << button_id))) return 
EINA_FALSE;
         e_comp_wl->ptr.button_mask &= ~(1 << button_id);
+        state_serial = &e_comp_wl->ptr.serial[1];
      }
    e_comp_wl->ptr.button = btn;
 
@@ -3368,7 +3372,7 @@ e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t 
timestamp, uint32_t bu
      return EINA_TRUE;
 
    wc = wl_resource_get_client(ec->comp_data->surface);
-   serial = wl_display_next_serial(e_comp_wl->wl.disp);
+   *state_serial = serial = wl_display_next_serial(e_comp_wl->wl.disp);
 
    EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res)
      {
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index 8d0ac5a..a78f5cd 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -188,6 +188,7 @@ struct _E_Comp_Wl_Data
         wl_fixed_t x, y;
         wl_fixed_t grab_x, grab_y;
         uint32_t button;
+        uint32_t serial[2]; //down/up
         uint32_t button_mask;
         E_Client *ec;
         Eina_Bool enabled : 1;
diff --git a/src/modules/wl_desktop_shell/xdg5.c 
b/src/modules/wl_desktop_shell/xdg5.c
index 7d21c61..4d4857a 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
    if (e_object_is_del(E_OBJECT(ec))) return;
 
    if ((ec->maximized) || (ec->fullscreen)) return;
+   if (serial != e_comp_wl->ptr.serial[0]) return;
 
    switch (e_comp_wl->ptr.button)
      {
@@ -280,6 +281,7 @@ _e_xdg_shell_surface_cb_resize(struct wl_client *client 
EINA_UNUSED, struct wl_r
         return;
      }
    if (e_object_is_del(E_OBJECT(ec))) return;
+   if (serial != e_comp_wl->ptr.serial[0]) return;
 
    if ((edges == 0) || (edges > 15) ||
        ((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 f9bfd5a..8045b45 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
    if (e_object_is_del(E_OBJECT(ec))) return;
 
    if ((ec->maximized) || (ec->fullscreen)) return;
+   if (serial != e_comp_wl->ptr.serial[0]) return;
 
    switch (e_comp_wl->ptr.button)
      {
@@ -1086,6 +1087,7 @@ _e_xdg_toplevel_cb_resize(struct wl_client *client 
EINA_UNUSED, struct wl_resour
         return;
      }
    if (e_object_is_del(E_OBJECT(ec))) return;
+   if (serial != e_comp_wl->ptr.serial[0]) return;
 
    if ((edges == 0) || (edges > 15) ||
        ((edges & 3) == 3) || ((edges & 12) == 12)) return;

-- 


Reply via email to