ecore_wl2: Fix dnd breakage when focus leaves window

Summary:
If dnd in the same window is activated, the focus goes away from the
ecore_wl2 window to the dnd window, after that focus.pointer is NULL.
After focus.pointer is NULL ev->win of all the events will be 0 which
breaks dnd-motions, drop and end.

With prev_pointer beeing the last focused window, we can simply set this
window as event window. After that dnd with jesus works perfectly.

@fix

Reviewers: devilhorns

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D4093
This commit is contained in:
Marcel Hollerbach 2016-06-27 11:31:59 -04:00 committed by Chris Michael
parent c162288287
commit 5ce3c4a049
3 changed files with 13 additions and 0 deletions

View File

@ -147,6 +147,8 @@ data_source_event_emit(Ecore_Wl2_Input *input, int event)
if (input->focus.pointer)
ev->win = input->focus.pointer->id;
else if (input->focus.prev_pointer)
ev->win = input->focus.prev_pointer->id;
if (input->focus.keyboard)
ev->source = input->focus.keyboard->id;
@ -360,6 +362,8 @@ _ecore_wl2_dnd_leave(Ecore_Wl2_Input *input)
if (input->focus.pointer)
ev->win = input->focus.pointer->id;
else if (input->focus.prev_pointer)
ev->win = input->focus.prev_pointer->id;
if (input->focus.keyboard)
ev->source = input->focus.keyboard->id;
@ -381,6 +385,8 @@ _ecore_wl2_dnd_motion(Ecore_Wl2_Input *input, int x, int y, uint32_t serial)
if (input->focus.pointer)
ev->win = input->focus.pointer->id;
else if (input->focus.prev_pointer)
ev->win = input->focus.prev_pointer->id;
if (input->focus.keyboard)
ev->source = input->focus.keyboard->id;
@ -405,6 +411,8 @@ _ecore_wl2_dnd_drop(Ecore_Wl2_Input *input)
{
if (input->focus.pointer)
ev->win = input->focus.pointer->id;
else if (input->focus.prev_pointer)
ev->win = input->focus.prev_pointer->id;
if (input->focus.keyboard)
ev->source = input->focus.keyboard->id;
@ -562,6 +570,8 @@ ecore_wl2_dnd_drag_end(Ecore_Wl2_Input *input)
if (input->focus.pointer)
ev->win = input->focus.pointer->id;
else if (input->focus.prev_pointer)
ev->win = input->focus.prev_pointer->id;
if (input->focus.keyboard)
ev->source = input->focus.keyboard->id;

View File

@ -514,6 +514,7 @@ _pointer_cb_enter(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned i
if (!window) return;
window->input = input;
input->focus.prev_pointer = NULL;
input->focus.pointer = window;
_ecore_wl2_input_mouse_in_send(input, window);
@ -536,6 +537,7 @@ _pointer_cb_leave(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned i
if (!input) return;
input->display->serial = serial;
input->focus.prev_pointer = input->focus.pointer;
input->focus.pointer = NULL;
/* trap for a surface that was just destroyed */

View File

@ -370,6 +370,7 @@ struct _Ecore_Wl2_Input
struct
{
Ecore_Wl2_Window *pointer;
Ecore_Wl2_Window *prev_pointer;
Ecore_Wl2_Window *keyboard;
Ecore_Wl2_Window *touch;
} focus;