diff options
-rw-r--r-- | include/wlr/types/wlr_xdg_shell.h | 1 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_shell_v6.h | 1 | ||||
-rw-r--r-- | types/wlr_box.c | 4 | ||||
-rw-r--r-- | types/wlr_surface.c | 10 | ||||
-rw-r--r-- | types/xdg_shell/wlr_xdg_toplevel.c | 2 | ||||
-rw-r--r-- | types/xdg_shell_v6/wlr_xdg_toplevel_v6.c | 2 |
6 files changed, 13 insertions, 7 deletions
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 6a967bc7..01dc17fe 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -118,6 +118,7 @@ struct wlr_xdg_toplevel { struct wl_signal request_move; struct wl_signal request_resize; struct wl_signal request_show_window_menu; + struct wl_signal set_parent; } events; }; diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index 07c831ce..5f98eb13 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -126,6 +126,7 @@ struct wlr_xdg_toplevel_v6 { struct wl_signal request_move; struct wl_signal request_resize; struct wl_signal request_show_window_menu; + struct wl_signal set_parent; } events; }; diff --git a/types/wlr_box.c b/types/wlr_box.c index f8fe9dfe..ada6a733 100644 --- a/types/wlr_box.c +++ b/types/wlr_box.c @@ -46,8 +46,8 @@ bool wlr_box_intersection(const struct wlr_box *box_a, int x1 = fmax(box_a->x, box_b->x); int y1 = fmax(box_a->y, box_b->y); - int x2 = fmin(box_a->x + box_a->width - 1, box_b->x + box_b->width - 1); - int y2 = fmin(box_a->y + box_a->height - 1, box_b->y + box_b->height - 1); + int x2 = fmin(box_a->x + box_a->width, box_b->x + box_b->width); + int y2 = fmin(box_a->y + box_a->height, box_b->y + box_b->height); dest->x = x1; dest->y = y1; diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 46a39a39..9c3eb86d 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -805,7 +805,7 @@ static void subsurface_handle_place_above(struct wl_client *client, } wl_list_remove(&subsurface->parent_pending_link); - wl_list_insert(sibling->parent_pending_link.prev, + wl_list_insert(&sibling->parent_pending_link, &subsurface->parent_pending_link); subsurface->reordered = true; @@ -832,7 +832,7 @@ static void subsurface_handle_place_below(struct wl_client *client, } wl_list_remove(&subsurface->parent_pending_link); - wl_list_insert(&sibling->parent_pending_link, + wl_list_insert(sibling->parent_pending_link.prev, &subsurface->parent_pending_link); subsurface->reordered = true; @@ -933,8 +933,8 @@ struct wlr_subsurface *wlr_subsurface_create(struct wlr_surface *surface, subsurface->parent = parent; wl_signal_add(&parent->events.destroy, &subsurface->parent_destroy); subsurface->parent_destroy.notify = subsurface_handle_parent_destroy; - wl_list_insert(&parent->subsurfaces, &subsurface->parent_link); - wl_list_insert(&parent->subsurface_pending_list, + wl_list_insert(parent->subsurfaces.prev, &subsurface->parent_link); + wl_list_insert(parent->subsurface_pending_list.prev, &subsurface->parent_pending_link); surface->role_data = subsurface; @@ -971,7 +971,7 @@ bool wlr_surface_point_accepts_input(struct wlr_surface *surface, struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface, double sx, double sy, double *sub_x, double *sub_y) { struct wlr_subsurface *subsurface; - wl_list_for_each(subsurface, &surface->subsurfaces, parent_link) { + wl_list_for_each_reverse(subsurface, &surface->subsurfaces, parent_link) { double _sub_x = subsurface->surface->current->subsurface_position.x; double _sub_y = subsurface->surface->current->subsurface_position.y; struct wlr_surface *sub = wlr_surface_surface_at(subsurface->surface, diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c index 5968c835..fa0ec929 100644 --- a/types/xdg_shell/wlr_xdg_toplevel.c +++ b/types/xdg_shell/wlr_xdg_toplevel.c @@ -218,6 +218,7 @@ static void xdg_toplevel_handle_set_parent(struct wl_client *client, } surface->toplevel->parent = parent; + wlr_signal_emit_safe(&surface->toplevel->events.set_parent, surface); } static void xdg_toplevel_handle_set_title(struct wl_client *client, @@ -464,6 +465,7 @@ void create_xdg_toplevel(struct wlr_xdg_surface *xdg_surface, wl_signal_init(&xdg_surface->toplevel->events.request_move); wl_signal_init(&xdg_surface->toplevel->events.request_resize); wl_signal_init(&xdg_surface->toplevel->events.request_show_window_menu); + wl_signal_init(&xdg_surface->toplevel->events.set_parent); xdg_surface->role = WLR_XDG_SURFACE_ROLE_TOPLEVEL; xdg_surface->toplevel->base = xdg_surface; diff --git a/types/xdg_shell_v6/wlr_xdg_toplevel_v6.c b/types/xdg_shell_v6/wlr_xdg_toplevel_v6.c index 2bcfaf0d..0f9a26d3 100644 --- a/types/xdg_shell_v6/wlr_xdg_toplevel_v6.c +++ b/types/xdg_shell_v6/wlr_xdg_toplevel_v6.c @@ -42,6 +42,7 @@ static void xdg_toplevel_handle_set_parent(struct wl_client *client, } surface->toplevel->parent = parent; + wlr_signal_emit_safe(&surface->toplevel->events.set_parent, surface); } static void xdg_toplevel_handle_set_title(struct wl_client *client, @@ -434,6 +435,7 @@ void create_xdg_toplevel_v6(struct wlr_xdg_surface_v6 *xdg_surface, wl_signal_init(&xdg_surface->toplevel->events.request_move); wl_signal_init(&xdg_surface->toplevel->events.request_resize); wl_signal_init(&xdg_surface->toplevel->events.request_show_window_menu); + wl_signal_init(&xdg_surface->toplevel->events.set_parent); xdg_surface->role = WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL; xdg_surface->toplevel->base = xdg_surface; |