diff --git a/include/Mw/LowLevel/Wayland.h b/include/Mw/LowLevel/Wayland.h index 3babbaf..d6474bb 100644 --- a/include/Mw/LowLevel/Wayland.h +++ b/include/Mw/LowLevel/Wayland.h @@ -562,6 +562,8 @@ struct _MwLLWayland { cairo_t* back_cairo; /* The cairo to actually use for draw operations. Typically is front_cairo, but MwLLBeginDraw can change this to the back_cairo so it can be used to draw window decorations. */ cairo_t* selected_cairo; + + MwBool is_subwindow; }; struct _MwLLWaylandColor { diff --git a/src/backend/wayland/interfaces.c b/src/backend/wayland/interfaces.c index b9f089b..427be52 100644 --- a/src/backend/wayland/interfaces.c +++ b/src/backend/wayland/interfaces.c @@ -495,7 +495,6 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time MwLL topmost_parent = self; MwMouse p; MwBool inArea = MwFALSE; - MwBool h = MwFALSE; MwLL currentlyHeldWidget = NULL; (void)time; @@ -514,20 +513,18 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time inArea |= self->wayland.backbuffer.surface == curSurface; } - if(currentlyHeldWidget) { - currentlyHeldWidget->wayland.cur_mouse_pos.x = wl_fixed_to_int(surface_x); - currentlyHeldWidget->wayland.cur_mouse_pos.y = wl_fixed_to_int(surface_y); - p.point = currentlyHeldWidget->wayland.cur_mouse_pos; - MwLLDispatch(currentlyHeldWidget, down, &p); - h = MwTRUE; - } - if(inArea) { self->wayland.cur_mouse_pos.x = wl_fixed_to_int(surface_x); self->wayland.cur_mouse_pos.y = wl_fixed_to_int(surface_y); p.point = self->wayland.cur_mouse_pos; MwLLDispatch(self, move, &p); + wl_pointer_set_cursor(self->wayland.pointer, self->wayland.pointer_serial, self->wayland.cursor.surface, 0, 0); + } else if(currentlyHeldWidget == self) { + currentlyHeldWidget->wayland.cur_mouse_pos.x = wl_fixed_to_int(surface_x); + currentlyHeldWidget->wayland.cur_mouse_pos.y = wl_fixed_to_int(surface_y); + p.point = currentlyHeldWidget->wayland.cur_mouse_pos; + MwLLDispatch(currentlyHeldWidget, move, &p); } WAYLAND_EVENT_OP_END(self); diff --git a/src/widget/subwindow.c b/src/widget/subwindow.c index 3a9b427..a8dcbb9 100644 --- a/src/widget/subwindow.c +++ b/src/widget/subwindow.c @@ -279,6 +279,10 @@ static int wcreate(MwWidget handle) { MwSetDefault(handle); + if(handle->lowlevel->common.type == MwLLBackendWayland) { + handle->lowlevel->wayland.is_subwindow = MwTRUE; + } + return 0; }