input->grab_button = 0;
}
+/* NB: This function should be called just before shell move and shell resize
+ * functions. Those requests will trigger a mouse/touch implicit grab on the
+ * compositor that will prevent the respective mouse/touch up events being
+ * released after the end of the operation. This function checks if such grab
+ * is in place for those windows and, if so, emit the respective mouse up
+ * event. It's a workaround to the fact that wayland doesn't inform the
+ * application about this move or resize grab being finished.
+ */
+void
+_ecore_wl_input_grab_release(Ecore_Wl_Input *input, Ecore_Wl_Window *win)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!input) return;
+ if (input->grab != win) return;
+
+ _ecore_wl_input_mouse_up_send(input, input->grab,
+ input->grab_button, input->grab_timestamp);
+ ecore_wl_input_ungrab(input);
+}
+
EAPI void
ecore_wl_input_pointer_set(Ecore_Wl_Input *input, struct wl_surface *surface, int hot_x, int hot_y)
{
if (state)
{
if ((input->pointer_focus) && (!input->grab) && (state))
- ecore_wl_input_grab(input, input->pointer_focus, button);
+ {
+ ecore_wl_input_grab(input, input->pointer_focus, button);
+ input->grab_timestamp = timestamp;
+ }
_ecore_wl_input_mouse_down_send(input, input->pointer_focus,
button, timestamp);
input->pointer_enter_serial = serial;
/* The cursor on the surface is undefined until we set it */
- ecore_wl_input_cursor_from_name_set(input, "left_ptr");
+ if (input->pointer)
+ ecore_wl_input_cursor_from_name_set(input, "left_ptr");
if ((win = wl_surface_get_user_data(surface)))
{
_ecore_wl_input_mouse_in_send(input, win, input->timestamp);
}
-
- /* NB: This whole 'if' below is a major HACK due to wayland's stupidness
- * of not sending a mouse_up (or any notification at all for that matter)
- * when a move or resize grab is finished */
- if (input->grab)
- {
- /* NB: This COULD mean a move has finished, or it could mean that
- * a 'drag' is being done to a different surface */
-
- if ((input->grab == win) && (win->moving))
- {
- /* NB: 'Fake' a mouse_up for move finished */
- win->moving = EINA_FALSE;
- _ecore_wl_input_mouse_up_send(input, win, BTN_LEFT,
- input->timestamp);
-
- if ((input->grab) && (input->grab_button == BTN_LEFT))
- ecore_wl_input_ungrab(input);
- }
- else if ((input->grab == win) && (win->resizing))
- {
- /* NB: 'Fake' a mouse_up for resize finished */
- win->resizing = EINA_FALSE;
- _ecore_wl_input_mouse_up_send(input, win, BTN_LEFT,
- input->timestamp);
-
- if ((input->grab) && (input->grab_button == BTN_LEFT))
- ecore_wl_input_ungrab(input);
- }
- /* FIXME: Test d-n-d and potentially add needed case here */
- }
}
static void
input->sx = wl_fixed_to_int(x);
input->sy = wl_fixed_to_int(y);
_ecore_wl_input_cb_pointer_enter(data, NULL, serial, surface, x, y);
+ if ((input->pointer_focus) && (!input->grab))
+ {
+ ecore_wl_input_grab(input, input->pointer_focus, BTN_LEFT);
+ input->grab_timestamp = timestamp;
+ }
+
_ecore_wl_input_mouse_down_send(input, input->pointer_focus, BTN_LEFT, timestamp);
}
/* input->timestamp = timestamp; */
input->display->serial = serial;
_ecore_wl_input_mouse_up_send(input, input->pointer_focus, BTN_LEFT, timestamp);
+ if ((input->grab) && (input->grab_button == BTN_LEFT))
+ ecore_wl_input_ungrab(input);
}
static void