2022-02-21 03:18:38 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Helpers for view server side decorations
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) Johan Malm 2020-2021
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <assert.h>
|
2022-11-26 16:46:28 -05:00
|
|
|
#include "common/mem.h"
|
2022-11-21 10:10:39 -05:00
|
|
|
#include "common/scene-helpers.h"
|
2022-02-21 03:18:38 +01:00
|
|
|
#include "labwc.h"
|
2022-11-26 16:53:35 -05:00
|
|
|
#include "ssd-internal.h"
|
2022-11-21 10:10:39 -05:00
|
|
|
#include "theme.h"
|
|
|
|
|
#include "view.h"
|
2022-02-21 03:18:38 +01:00
|
|
|
|
|
|
|
|
struct border
|
|
|
|
|
ssd_thickness(struct view *view)
|
|
|
|
|
{
|
2022-11-26 16:46:28 -05:00
|
|
|
assert(view);
|
2022-11-26 02:25:02 -05:00
|
|
|
/*
|
|
|
|
|
* Check preconditions for displaying SSD. Note that this
|
|
|
|
|
* needs to work even before ssd_create() has been called.
|
2023-09-17 22:41:46 +02:00
|
|
|
*
|
|
|
|
|
* For that reason we are not using the .enabled state of
|
|
|
|
|
* the titlebar node here but rather check for the view
|
|
|
|
|
* boolean. If we were to use the .enabled state this would
|
|
|
|
|
* cause issues on Reconfigure events with views which were
|
|
|
|
|
* in border-only deco mode as view->ssd would only be set
|
|
|
|
|
* after ssd_create() returns.
|
2022-11-26 02:25:02 -05:00
|
|
|
*/
|
|
|
|
|
if (!view->ssd_enabled || view->fullscreen) {
|
2022-11-26 02:22:03 -05:00
|
|
|
return (struct border){ 0 };
|
2022-06-28 19:42:40 +02:00
|
|
|
}
|
2023-04-14 09:01:13 +02:00
|
|
|
|
2022-02-21 03:18:38 +01:00
|
|
|
struct theme *theme = view->server->theme;
|
2023-08-23 01:04:40 +02:00
|
|
|
|
|
|
|
|
if (view->maximized) {
|
|
|
|
|
struct border thickness = { 0 };
|
2023-09-17 22:41:46 +02:00
|
|
|
if (!view->ssd_titlebar_hidden) {
|
2023-08-23 01:04:40 +02:00
|
|
|
thickness.top += theme->title_height;
|
|
|
|
|
}
|
|
|
|
|
return thickness;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 09:01:13 +02:00
|
|
|
struct border thickness = {
|
2022-03-09 08:52:33 +01:00
|
|
|
.top = theme->title_height + theme->border_width,
|
2022-02-21 03:18:38 +01:00
|
|
|
.bottom = theme->border_width,
|
|
|
|
|
.left = theme->border_width,
|
|
|
|
|
.right = theme->border_width,
|
|
|
|
|
};
|
2023-04-14 09:01:13 +02:00
|
|
|
|
2023-09-17 22:41:46 +02:00
|
|
|
if (view->ssd_titlebar_hidden) {
|
2023-04-14 09:01:13 +02:00
|
|
|
thickness.top -= theme->title_height;
|
|
|
|
|
}
|
|
|
|
|
return thickness;
|
2022-02-21 03:18:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct wlr_box
|
|
|
|
|
ssd_max_extents(struct view *view)
|
|
|
|
|
{
|
2022-11-26 16:46:28 -05:00
|
|
|
assert(view);
|
2022-02-21 03:18:38 +01:00
|
|
|
struct border border = ssd_thickness(view);
|
2022-11-26 02:22:03 -05:00
|
|
|
return (struct wlr_box){
|
2023-02-08 23:19:14 -05:00
|
|
|
.x = view->current.x - border.left,
|
|
|
|
|
.y = view->current.y - border.top,
|
|
|
|
|
.width = view->current.width + border.left + border.right,
|
|
|
|
|
.height = view->current.height + border.top + border.bottom,
|
2022-02-21 03:18:38 +01:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
ssd_is_button(enum ssd_part_type type)
|
|
|
|
|
{
|
|
|
|
|
return type == LAB_SSD_BUTTON_CLOSE
|
|
|
|
|
|| type == LAB_SSD_BUTTON_MAXIMIZE
|
|
|
|
|
|| type == LAB_SSD_BUTTON_ICONIFY
|
|
|
|
|
|| type == LAB_SSD_BUTTON_WINDOW_MENU;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum ssd_part_type
|
2022-11-26 16:06:22 -05:00
|
|
|
ssd_get_part_type(const struct ssd *ssd, struct wlr_scene_node *node)
|
2022-02-21 03:18:38 +01:00
|
|
|
{
|
|
|
|
|
if (!node) {
|
|
|
|
|
return LAB_SSD_NONE;
|
2022-05-26 00:39:04 +02:00
|
|
|
} else if (node->type == WLR_SCENE_NODE_BUFFER
|
|
|
|
|
&& lab_wlr_surface_from_node(node)) {
|
2022-02-21 03:18:38 +01:00
|
|
|
return LAB_SSD_CLIENT;
|
2022-11-26 16:46:28 -05:00
|
|
|
} else if (!ssd) {
|
2022-02-21 03:18:38 +01:00
|
|
|
return LAB_SSD_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-26 16:06:22 -05:00
|
|
|
const struct wl_list *part_list = NULL;
|
2022-06-05 15:17:35 +02:00
|
|
|
struct wlr_scene_tree *grandparent =
|
|
|
|
|
node->parent ? node->parent->node.parent : NULL;
|
2022-09-08 13:16:19 -04:00
|
|
|
struct wlr_scene_tree *greatgrandparent =
|
|
|
|
|
grandparent ? grandparent->node.parent : NULL;
|
2022-02-21 03:18:38 +01:00
|
|
|
|
|
|
|
|
/* active titlebar */
|
2022-11-26 16:06:22 -05:00
|
|
|
if (node->parent == ssd->titlebar.active.tree) {
|
|
|
|
|
part_list = &ssd->titlebar.active.parts;
|
|
|
|
|
} else if (grandparent == ssd->titlebar.active.tree) {
|
|
|
|
|
part_list = &ssd->titlebar.active.parts;
|
|
|
|
|
} else if (greatgrandparent == ssd->titlebar.active.tree) {
|
|
|
|
|
part_list = &ssd->titlebar.active.parts;
|
2022-02-21 03:18:38 +01:00
|
|
|
|
|
|
|
|
/* extents */
|
2022-11-26 16:06:22 -05:00
|
|
|
} else if (node->parent == ssd->extents.tree) {
|
|
|
|
|
part_list = &ssd->extents.parts;
|
2022-02-21 03:18:38 +01:00
|
|
|
|
|
|
|
|
/* active border */
|
2022-11-26 16:06:22 -05:00
|
|
|
} else if (node->parent == ssd->border.active.tree) {
|
|
|
|
|
part_list = &ssd->border.active.parts;
|
2022-02-21 03:18:38 +01:00
|
|
|
|
|
|
|
|
/* inactive titlebar */
|
2022-11-26 16:06:22 -05:00
|
|
|
} else if (node->parent == ssd->titlebar.inactive.tree) {
|
|
|
|
|
part_list = &ssd->titlebar.inactive.parts;
|
|
|
|
|
} else if (grandparent == ssd->titlebar.inactive.tree) {
|
|
|
|
|
part_list = &ssd->titlebar.inactive.parts;
|
|
|
|
|
} else if (greatgrandparent == ssd->titlebar.inactive.tree) {
|
|
|
|
|
part_list = &ssd->titlebar.inactive.parts;
|
2022-02-21 03:18:38 +01:00
|
|
|
|
|
|
|
|
/* inactive border */
|
2022-11-26 16:06:22 -05:00
|
|
|
} else if (node->parent == ssd->border.inactive.tree) {
|
|
|
|
|
part_list = &ssd->border.inactive.parts;
|
2022-02-21 03:18:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (part_list) {
|
|
|
|
|
struct ssd_part *part;
|
|
|
|
|
wl_list_for_each(part, part_list, link) {
|
|
|
|
|
if (node == part->node) {
|
|
|
|
|
return part->type;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return LAB_SSD_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum ssd_part_type
|
2022-11-26 16:06:22 -05:00
|
|
|
ssd_at(const struct ssd *ssd, struct wlr_scene *scene, double lx, double ly)
|
2022-02-21 03:18:38 +01:00
|
|
|
{
|
2022-11-26 16:46:28 -05:00
|
|
|
assert(scene);
|
2022-02-21 03:18:38 +01:00
|
|
|
double sx, sy;
|
|
|
|
|
struct wlr_scene_node *node = wlr_scene_node_at(
|
2022-11-26 16:06:22 -05:00
|
|
|
&scene->tree.node, lx, ly, &sx, &sy);
|
|
|
|
|
return ssd_get_part_type(ssd, node);
|
2022-02-21 03:18:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
ssd_resize_edges(enum ssd_part_type type)
|
|
|
|
|
{
|
|
|
|
|
switch (type) {
|
|
|
|
|
case LAB_SSD_PART_TOP:
|
|
|
|
|
return WLR_EDGE_TOP;
|
|
|
|
|
case LAB_SSD_PART_RIGHT:
|
|
|
|
|
return WLR_EDGE_RIGHT;
|
|
|
|
|
case LAB_SSD_PART_BOTTOM:
|
|
|
|
|
return WLR_EDGE_BOTTOM;
|
|
|
|
|
case LAB_SSD_PART_LEFT:
|
|
|
|
|
return WLR_EDGE_LEFT;
|
|
|
|
|
case LAB_SSD_PART_CORNER_TOP_LEFT:
|
|
|
|
|
return WLR_EDGE_TOP | WLR_EDGE_LEFT;
|
|
|
|
|
case LAB_SSD_PART_CORNER_TOP_RIGHT:
|
|
|
|
|
return WLR_EDGE_RIGHT | WLR_EDGE_TOP;
|
|
|
|
|
case LAB_SSD_PART_CORNER_BOTTOM_RIGHT:
|
|
|
|
|
return WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT;
|
|
|
|
|
case LAB_SSD_PART_CORNER_BOTTOM_LEFT:
|
|
|
|
|
return WLR_EDGE_BOTTOM | WLR_EDGE_LEFT;
|
|
|
|
|
default:
|
2022-09-16 02:23:44 +02:00
|
|
|
return WLR_EDGE_NONE;
|
2022-02-21 03:18:38 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-26 16:46:28 -05:00
|
|
|
struct ssd *
|
2022-11-26 02:17:04 -05:00
|
|
|
ssd_create(struct view *view, bool active)
|
2022-02-21 03:18:38 +01:00
|
|
|
{
|
2022-11-26 16:46:28 -05:00
|
|
|
assert(view);
|
|
|
|
|
struct ssd *ssd = znew(*ssd);
|
2022-02-21 03:18:38 +01:00
|
|
|
|
2022-11-26 16:46:28 -05:00
|
|
|
ssd->view = view;
|
2022-11-26 16:06:22 -05:00
|
|
|
ssd->tree = wlr_scene_tree_create(view->scene_tree);
|
|
|
|
|
wlr_scene_node_lower_to_bottom(&ssd->tree->node);
|
2023-04-14 09:01:13 +02:00
|
|
|
ssd->titlebar.height = view->server->theme->title_height;
|
2022-11-26 16:06:22 -05:00
|
|
|
ssd_extents_create(ssd);
|
|
|
|
|
ssd_border_create(ssd);
|
|
|
|
|
ssd_titlebar_create(ssd);
|
2023-09-17 22:41:46 +02:00
|
|
|
if (view->ssd_titlebar_hidden) {
|
|
|
|
|
/* Ensure we keep the old state on Reconfigure or when exiting fullscreen */
|
2023-04-14 09:01:13 +02:00
|
|
|
ssd_titlebar_hide(ssd);
|
|
|
|
|
}
|
2022-11-26 16:06:22 -05:00
|
|
|
ssd->margin = ssd_thickness(view);
|
2022-11-26 16:46:28 -05:00
|
|
|
ssd_set_active(ssd, active);
|
2023-03-05 10:35:56 +01:00
|
|
|
ssd_enable_keybind_inhibit_indicator(ssd, view->inhibits_keybinds);
|
2023-02-08 23:19:14 -05:00
|
|
|
ssd->state.geometry = view->current;
|
2022-11-26 16:46:28 -05:00
|
|
|
|
|
|
|
|
return ssd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct border
|
|
|
|
|
ssd_get_margin(const struct ssd *ssd)
|
|
|
|
|
{
|
|
|
|
|
return ssd ? ssd->margin : (struct border){ 0 };
|
2022-02-21 03:18:38 +01:00
|
|
|
}
|
|
|
|
|
|
2023-08-25 13:22:23 +02:00
|
|
|
void
|
|
|
|
|
ssd_update_margin(struct ssd *ssd)
|
|
|
|
|
{
|
|
|
|
|
if (!ssd) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ssd->margin = ssd_thickness(ssd->view);
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-21 03:18:38 +01:00
|
|
|
void
|
2022-11-26 16:46:28 -05:00
|
|
|
ssd_update_geometry(struct ssd *ssd)
|
2022-02-21 03:18:38 +01:00
|
|
|
{
|
2022-11-26 16:46:28 -05:00
|
|
|
if (!ssd) {
|
2022-03-10 06:50:42 +01:00
|
|
|
return;
|
2022-02-21 03:18:38 +01:00
|
|
|
}
|
|
|
|
|
|
2023-02-08 23:19:14 -05:00
|
|
|
struct wlr_box cached = ssd->state.geometry;
|
|
|
|
|
struct wlr_box current = ssd->view->current;
|
|
|
|
|
if (current.width == cached.width && current.height == cached.height) {
|
|
|
|
|
if (current.x != cached.x || current.y != cached.y) {
|
2022-03-10 06:50:42 +01:00
|
|
|
/* Dynamically resize extents based on position and usable_area */
|
2022-11-26 16:06:22 -05:00
|
|
|
ssd_extents_update(ssd);
|
2023-02-08 23:19:14 -05:00
|
|
|
ssd->state.geometry = current;
|
2022-03-10 06:50:42 +01:00
|
|
|
}
|
2023-08-25 13:22:23 +02:00
|
|
|
if (ssd->state.squared_corners != ssd->view->maximized) {
|
|
|
|
|
ssd_border_update(ssd);
|
|
|
|
|
ssd_titlebar_update(ssd);
|
|
|
|
|
}
|
2022-02-21 03:18:38 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2022-11-26 16:06:22 -05:00
|
|
|
ssd_extents_update(ssd);
|
|
|
|
|
ssd_border_update(ssd);
|
|
|
|
|
ssd_titlebar_update(ssd);
|
2023-02-08 23:19:14 -05:00
|
|
|
ssd->state.geometry = current;
|
2022-02-21 03:18:38 +01:00
|
|
|
}
|
|
|
|
|
|
2023-04-14 09:01:13 +02:00
|
|
|
void
|
|
|
|
|
ssd_titlebar_hide(struct ssd *ssd)
|
|
|
|
|
{
|
|
|
|
|
if (!ssd || !ssd->titlebar.tree->node.enabled) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
wlr_scene_node_set_enabled(&ssd->titlebar.tree->node, false);
|
|
|
|
|
ssd->titlebar.height = 0;
|
|
|
|
|
ssd_border_update(ssd);
|
|
|
|
|
ssd_extents_update(ssd);
|
|
|
|
|
ssd->margin = ssd_thickness(ssd->view);
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-21 03:18:38 +01:00
|
|
|
void
|
2022-11-26 16:46:28 -05:00
|
|
|
ssd_destroy(struct ssd *ssd)
|
2022-02-21 03:18:38 +01:00
|
|
|
{
|
2022-11-26 16:46:28 -05:00
|
|
|
if (!ssd) {
|
2022-02-21 03:18:38 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Maybe reset hover view */
|
2022-11-26 16:46:28 -05:00
|
|
|
struct view *view = ssd->view;
|
2022-02-21 03:18:38 +01:00
|
|
|
struct ssd_hover_state *hover_state;
|
2022-11-26 16:46:28 -05:00
|
|
|
hover_state = view->server->ssd_hover_state;
|
2022-02-21 03:18:38 +01:00
|
|
|
if (hover_state->view == view) {
|
|
|
|
|
hover_state->view = NULL;
|
|
|
|
|
hover_state->node = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Destroy subcomponents */
|
2022-11-26 16:06:22 -05:00
|
|
|
ssd_titlebar_destroy(ssd);
|
|
|
|
|
ssd_border_destroy(ssd);
|
|
|
|
|
ssd_extents_destroy(ssd);
|
|
|
|
|
wlr_scene_node_destroy(&ssd->tree->node);
|
2022-11-26 16:46:28 -05:00
|
|
|
|
|
|
|
|
free(ssd);
|
2022-02-21 03:18:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate)
|
|
|
|
|
{
|
|
|
|
|
if (whole == candidate) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (whole == LAB_SSD_PART_TITLEBAR) {
|
|
|
|
|
return candidate >= LAB_SSD_BUTTON_CLOSE
|
|
|
|
|
&& candidate <= LAB_SSD_PART_TITLE;
|
|
|
|
|
}
|
2022-09-08 13:20:48 -04:00
|
|
|
if (whole == LAB_SSD_PART_TITLE) {
|
|
|
|
|
/* "Title" includes blank areas of "Titlebar" as well */
|
|
|
|
|
return candidate >= LAB_SSD_PART_TITLEBAR
|
|
|
|
|
&& candidate <= LAB_SSD_PART_TITLE;
|
|
|
|
|
}
|
2022-02-21 03:18:38 +01:00
|
|
|
if (whole == LAB_SSD_FRAME) {
|
|
|
|
|
return candidate >= LAB_SSD_BUTTON_CLOSE
|
|
|
|
|
&& candidate <= LAB_SSD_CLIENT;
|
|
|
|
|
}
|
|
|
|
|
if (whole == LAB_SSD_PART_TOP) {
|
|
|
|
|
return candidate == LAB_SSD_PART_CORNER_TOP_LEFT
|
|
|
|
|
|| candidate == LAB_SSD_PART_CORNER_BOTTOM_LEFT;
|
|
|
|
|
}
|
|
|
|
|
if (whole == LAB_SSD_PART_RIGHT) {
|
|
|
|
|
return candidate == LAB_SSD_PART_CORNER_TOP_RIGHT
|
|
|
|
|
|| candidate == LAB_SSD_PART_CORNER_BOTTOM_RIGHT;
|
|
|
|
|
}
|
|
|
|
|
if (whole == LAB_SSD_PART_BOTTOM) {
|
|
|
|
|
return candidate == LAB_SSD_PART_CORNER_BOTTOM_RIGHT
|
|
|
|
|
|| candidate == LAB_SSD_PART_CORNER_BOTTOM_LEFT;
|
|
|
|
|
}
|
|
|
|
|
if (whole == LAB_SSD_PART_LEFT) {
|
|
|
|
|
return candidate == LAB_SSD_PART_CORNER_TOP_LEFT
|
|
|
|
|
|| candidate == LAB_SSD_PART_CORNER_BOTTOM_LEFT;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2022-11-26 16:46:28 -05:00
|
|
|
ssd_set_active(struct ssd *ssd, bool active)
|
2022-02-21 03:18:38 +01:00
|
|
|
{
|
2022-11-26 16:46:28 -05:00
|
|
|
if (!ssd) {
|
2022-02-21 03:18:38 +01:00
|
|
|
return;
|
|
|
|
|
}
|
2022-11-26 16:06:22 -05:00
|
|
|
wlr_scene_node_set_enabled(&ssd->border.active.tree->node, active);
|
|
|
|
|
wlr_scene_node_set_enabled(&ssd->titlebar.active.tree->node, active);
|
|
|
|
|
wlr_scene_node_set_enabled(&ssd->border.inactive.tree->node, !active);
|
|
|
|
|
wlr_scene_node_set_enabled(&ssd->titlebar.inactive.tree->node, !active);
|
2022-02-21 03:18:38 +01:00
|
|
|
}
|
2022-11-26 16:13:09 -05:00
|
|
|
|
2023-03-05 10:35:56 +01:00
|
|
|
void
|
|
|
|
|
ssd_enable_keybind_inhibit_indicator(struct ssd *ssd, bool enable)
|
|
|
|
|
{
|
|
|
|
|
if (!ssd) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float *color = enable
|
|
|
|
|
? rc.theme->window_toggled_keybinds_color
|
|
|
|
|
: rc.theme->window_active_border_color;
|
|
|
|
|
|
|
|
|
|
struct ssd_part *part = ssd_get_part(&ssd->border.active.parts, LAB_SSD_PART_TOP);
|
|
|
|
|
struct wlr_scene_rect *rect = lab_wlr_scene_get_rect(part->node);
|
|
|
|
|
wlr_scene_rect_set_color(rect, color);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-26 16:46:28 -05:00
|
|
|
struct ssd_hover_state *
|
|
|
|
|
ssd_hover_state_new(void)
|
|
|
|
|
{
|
|
|
|
|
return znew(struct ssd_hover_state);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-26 16:53:35 -05:00
|
|
|
enum ssd_part_type
|
|
|
|
|
ssd_button_get_type(const struct ssd_button *button)
|
|
|
|
|
{
|
|
|
|
|
return button ? button->type : LAB_SSD_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct view *
|
|
|
|
|
ssd_button_get_view(const struct ssd_button *button)
|
|
|
|
|
{
|
|
|
|
|
return button ? button->view : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-26 16:13:09 -05:00
|
|
|
bool
|
|
|
|
|
ssd_debug_is_root_node(const struct ssd *ssd, struct wlr_scene_node *node)
|
|
|
|
|
{
|
2022-11-26 16:46:28 -05:00
|
|
|
if (!ssd || !node) {
|
2022-11-26 16:13:09 -05:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return node == &ssd->tree->node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *
|
|
|
|
|
ssd_debug_get_node_name(const struct ssd *ssd, struct wlr_scene_node *node)
|
|
|
|
|
{
|
2022-11-26 16:46:28 -05:00
|
|
|
if (!ssd || !node) {
|
2022-11-26 16:13:09 -05:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (node == &ssd->tree->node) {
|
|
|
|
|
return "view->ssd";
|
|
|
|
|
}
|
|
|
|
|
if (node == &ssd->titlebar.active.tree->node) {
|
|
|
|
|
return "titlebar.active";
|
|
|
|
|
}
|
|
|
|
|
if (node == &ssd->titlebar.inactive.tree->node) {
|
|
|
|
|
return "titlebar.inactive";
|
|
|
|
|
}
|
|
|
|
|
if (node == &ssd->border.active.tree->node) {
|
|
|
|
|
return "border.active";
|
|
|
|
|
}
|
|
|
|
|
if (node == &ssd->border.inactive.tree->node) {
|
|
|
|
|
return "border.inactive";
|
|
|
|
|
}
|
|
|
|
|
if (node == &ssd->extents.tree->node) {
|
|
|
|
|
return "extents";
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|