diff --git a/src/backend/wayland/interfaces.c b/src/backend/wayland/interfaces.c index ef2bd50..e382845 100644 --- a/src/backend/wayland/interfaces.c +++ b/src/backend/wayland/interfaces.c @@ -495,6 +495,7 @@ 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; @@ -505,11 +506,12 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time currentlyHeldWidget = topmost_parent->wayland.currentlyHeldWidget; - if(currentlyHeldWidget == self) { - 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); + 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, move, &p); + h = MwTRUE; } if(self->wayland.framebuffer.surface) { @@ -520,10 +522,12 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time inArea |= self->wayland.backbuffer.surface == curSurface; } 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); + if(h) { + 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); } WAYLAND_EVENT_OP_END(self); diff --git a/src/backend/wayland/wayland.c b/src/backend/wayland/wayland.c index 3697c44..9711210 100644 --- a/src/backend/wayland/wayland.c +++ b/src/backend/wayland/wayland.c @@ -1472,7 +1472,7 @@ static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) { WIDGET_CHECK(handle); while(topmost_parent->wayland.parent) topmost_parent = topmost_parent->wayland.parent; - *point = handle->wayland.cur_mouse_pos; + *point = topmost_parent->wayland.cur_mouse_pos; } static void MwLLGetScreenSizeImpl(MwLL handle, MwRect* rect) { @@ -1558,6 +1558,20 @@ static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { static void MwLLRaiseImpl(MwLL handle) { (void)handle; + /* WIDGET_CHECK(handle); + + if(handle->wayland.type == MwLL_WAYLAND_SUBLEVEL) { + MwLL topmost_parent = handle; + int children_num; + while(topmost_parent->wayland.parent) topmost_parent = topmost_parent->wayland.parent; + children_num = arrlen(((MwWidget)topmost_parent->common.user)->children); + + if(children_num > 1) { + printf("%d\n", children_num); + MwWidget last_child = ((MwWidget)topmost_parent->common.user)->children[children_num - 1]; + wl_subsurface_place_above(handle->wayland.sublevel->subsurface, last_child->lowlevel->wayland.framebuffer.surface); + } + }*/ } static int MwLLWaylandCallInitImpl(void) {