validate xdg-shell move/resize requests against latest button serial

these are supposed to match in order to initiate the corresponding action
This commit is contained in:
Mike Blumenkrantz 2017-01-13 11:35:26 -05:00
parent 7716f58b5d
commit 0c56e19a64
4 changed files with 12 additions and 3 deletions

View File

@ -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)
{

View File

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

View File

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

View File

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