static Ecore_Wl2_Input *
_wl_default_seat_get(Ecore_Wl2_Window *win, Evas_Object *obj)
{
- Eo *seat;
+ Eo *seat, *parent2;
+ // FIXME: In wayland the default seat is not named "default" but "seat-X"
+ // where X may be 0 or really anything else.
if (!obj) return ecore_wl2_display_input_find_by_name(ecore_wl2_window_display_get(win), "default");
- seat = evas_device_get(evas_object_evas_get(obj), "default");
+
+ // FIXME (there might be a better solution):
+ // In case of inwin, we want to use the main wl2 window for cnp, but obj
+ // obj belongs to the buffer canvas, so the default seat for obj does not
+ // match the window win.
+ parent2 = elm_widget_parent2_get(elm_widget_top_get(obj));
+ if (parent2) obj = elm_widget_top_get(parent2) ?: parent2;
+
+ seat = evas_canvas_default_device_get(evas_object_evas_get(obj), EFL_INPUT_DEVICE_TYPE_SEAT);
EINA_SAFETY_ON_NULL_RETURN_VAL(seat, NULL);
return ecore_wl2_display_input_find(ecore_wl2_window_display_get(win),
evas_device_seat_id_get(seat));
(data, EFL_UI_EVENT_SELECTION_PASTE, NULL);
top = elm_widget_top_get(data);
+ if (!elm_win_window_id_get(top))
+ top = elm_widget_parent2_get(top);
if ((top) && (elm_win_window_id_get(top)))
{
Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_TEXT;