ssd: Make ssd_get_part_type() work for corner buttons

Corner buttons (WINDOW_MENU and CLOSE) are one more level down in
the scene-tree (see add_scene_button_corner() in ssd_part.c).

This fixes a minor issue where, when right-clicking on the CLOSE
button, the client-menu would be displayed in the wrong location.
This commit is contained in:
John Lindgren 2022-09-08 13:16:19 -04:00
parent ebd0a5d526
commit 48fde32e62

View file

@ -68,12 +68,16 @@ ssd_get_part_type(struct view *view, struct wlr_scene_node *node)
struct wl_list *part_list = NULL; struct wl_list *part_list = NULL;
struct wlr_scene_tree *grandparent = struct wlr_scene_tree *grandparent =
node->parent ? node->parent->node.parent : NULL; node->parent ? node->parent->node.parent : NULL;
struct wlr_scene_tree *greatgrandparent =
grandparent ? grandparent->node.parent : NULL;
/* active titlebar */ /* active titlebar */
if (node->parent == view->ssd.titlebar.active.tree) { if (node->parent == view->ssd.titlebar.active.tree) {
part_list = &view->ssd.titlebar.active.parts; part_list = &view->ssd.titlebar.active.parts;
} else if (grandparent == view->ssd.titlebar.active.tree) { } else if (grandparent == view->ssd.titlebar.active.tree) {
part_list = &view->ssd.titlebar.active.parts; part_list = &view->ssd.titlebar.active.parts;
} else if (greatgrandparent == view->ssd.titlebar.active.tree) {
part_list = &view->ssd.titlebar.active.parts;
/* extents */ /* extents */
} else if (node->parent == view->ssd.extents.tree) { } else if (node->parent == view->ssd.extents.tree) {
@ -88,6 +92,8 @@ ssd_get_part_type(struct view *view, struct wlr_scene_node *node)
part_list = &view->ssd.titlebar.inactive.parts; part_list = &view->ssd.titlebar.inactive.parts;
} else if (grandparent == view->ssd.titlebar.inactive.tree) { } else if (grandparent == view->ssd.titlebar.inactive.tree) {
part_list = &view->ssd.titlebar.inactive.parts; part_list = &view->ssd.titlebar.inactive.parts;
} else if (greatgrandparent == view->ssd.titlebar.inactive.tree) {
part_list = &view->ssd.titlebar.inactive.parts;
/* inactive border */ /* inactive border */
} else if (node->parent == view->ssd.border.inactive.tree) { } else if (node->parent == view->ssd.border.inactive.tree) {