include/ssd.h: prefix defines with SSD_

This commit is contained in:
Consolatis 2023-01-06 15:56:44 +01:00
parent 7790da7b4e
commit 9d7386effd
6 changed files with 27 additions and 27 deletions

View file

@ -4,9 +4,9 @@
#include <wayland-server-core.h> #include <wayland-server-core.h>
#define BUTTON_COUNT 4 #define SSD_BUTTON_COUNT 4
#define BUTTON_WIDTH 26 #define SSD_BUTTON_WIDTH 26
#define EXTENDED_AREA 8 #define SSD_EXTENDED_AREA 8
/* /*
* Sequence these according to the order they should be processed for * Sequence these according to the order they should be processed for

View file

@ -42,8 +42,8 @@ ssd_border_create(struct ssd *ssd)
add_scene_rect(&subtree->parts, LAB_SSD_PART_BOTTOM, parent, add_scene_rect(&subtree->parts, LAB_SSD_PART_BOTTOM, parent,
full_width, theme->border_width, 0, height, color); full_width, theme->border_width, 0, height, color);
add_scene_rect(&subtree->parts, LAB_SSD_PART_TOP, parent, add_scene_rect(&subtree->parts, LAB_SSD_PART_TOP, parent,
width - 2 * BUTTON_WIDTH, theme->border_width, width - 2 * SSD_BUTTON_WIDTH, theme->border_width,
theme->border_width + BUTTON_WIDTH, theme->border_width + SSD_BUTTON_WIDTH,
-(theme->title_height + theme->border_width), color); -(theme->title_height + theme->border_width), color);
} FOR_EACH_END } FOR_EACH_END
} }
@ -83,7 +83,7 @@ ssd_border_update(struct ssd *ssd)
continue; continue;
case LAB_SSD_PART_TOP: case LAB_SSD_PART_TOP:
wlr_scene_rect_set_size(rect, wlr_scene_rect_set_size(rect,
width - 2 * BUTTON_WIDTH, width - 2 * SSD_BUTTON_WIDTH,
theme->border_width); theme->border_width);
continue; continue;
default: default:

View file

@ -40,8 +40,8 @@ ssd_extents_create(struct ssd *ssd)
struct view *view = ssd->view; struct view *view = ssd->view;
struct theme *theme = view->server->theme; struct theme *theme = view->server->theme;
struct wl_list *part_list = &ssd->extents.parts; struct wl_list *part_list = &ssd->extents.parts;
int extended_area = EXTENDED_AREA; int extended_area = SSD_EXTENDED_AREA;
int corner_size = extended_area + theme->border_width + BUTTON_WIDTH / 2; int corner_size = extended_area + theme->border_width + SSD_BUTTON_WIDTH / 2;
ssd->extents.tree = wlr_scene_tree_create(ssd->tree); ssd->extents.tree = wlr_scene_tree_create(ssd->tree);
struct wlr_scene_tree *parent = ssd->extents.tree; struct wlr_scene_tree *parent = ssd->extents.tree;
@ -117,8 +117,8 @@ ssd_extents_update(struct ssd *ssd)
int height = view->h; int height = view->h;
int full_height = height + theme->border_width * 2 + theme->title_height; int full_height = height + theme->border_width * 2 + theme->title_height;
int full_width = width + 2 * theme->border_width; int full_width = width + 2 * theme->border_width;
int extended_area = EXTENDED_AREA; int extended_area = SSD_EXTENDED_AREA;
int corner_size = extended_area + theme->border_width + BUTTON_WIDTH / 2; int corner_size = extended_area + theme->border_width + SSD_BUTTON_WIDTH / 2;
int side_width = full_width + extended_area * 2 - corner_size * 2; int side_width = full_width + extended_area * 2 - corner_size * 2;
int side_height = full_height + extended_area * 2 - corner_size * 2; int side_height = full_height + extended_area * 2 - corner_size * 2;

View file

@ -155,11 +155,11 @@ add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
/* Background */ /* Background */
add_scene_rect(part_list, type, parent, add_scene_rect(part_list, type, parent,
BUTTON_WIDTH, rc.theme->title_height, 0, 0, bg_color); SSD_BUTTON_WIDTH, rc.theme->title_height, 0, 0, bg_color);
/* Icon */ /* Icon */
struct wlr_box icon_geo = get_scale_box(icon_buffer, struct wlr_box icon_geo = get_scale_box(icon_buffer,
BUTTON_WIDTH, rc.theme->title_height); SSD_BUTTON_WIDTH, rc.theme->title_height);
struct ssd_part *icon_part = add_scene_buffer(part_list, type, struct ssd_part *icon_part = add_scene_buffer(part_list, type,
parent, icon_buffer, icon_geo.x, icon_geo.y); parent, icon_buffer, icon_geo.x, icon_geo.y);
@ -169,7 +169,7 @@ add_scene_button(struct wl_list *part_list, enum ssd_part_type type,
icon_geo.width, icon_geo.height); icon_geo.width, icon_geo.height);
/* Hover overlay */ /* Hover overlay */
hover = add_scene_rect(part_list, type, parent, BUTTON_WIDTH, hover = add_scene_rect(part_list, type, parent, SSD_BUTTON_WIDTH,
rc.theme->title_height, 0, 0, hover_bg)->node; rc.theme->title_height, 0, 0, hover_bg)->node;
wlr_scene_node_set_enabled(hover, false); wlr_scene_node_set_enabled(hover, false);

View file

@ -61,22 +61,22 @@ ssd_titlebar_create(struct ssd *ssd)
/* Title */ /* Title */
add_scene_rect(&subtree->parts, LAB_SSD_PART_TITLEBAR, parent, add_scene_rect(&subtree->parts, LAB_SSD_PART_TITLEBAR, parent,
width - BUTTON_WIDTH * BUTTON_COUNT, theme->title_height, width - SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT, theme->title_height,
BUTTON_WIDTH, 0, color); SSD_BUTTON_WIDTH, 0, color);
/* Buttons */ /* Buttons */
add_scene_button_corner(&subtree->parts, add_scene_button_corner(&subtree->parts,
LAB_SSD_BUTTON_WINDOW_MENU, LAB_SSD_PART_CORNER_TOP_LEFT, parent, LAB_SSD_BUTTON_WINDOW_MENU, LAB_SSD_PART_CORNER_TOP_LEFT, parent,
corner_top_left, menu_button_unpressed, 0, view); corner_top_left, menu_button_unpressed, 0, view);
add_scene_button(&subtree->parts, LAB_SSD_BUTTON_ICONIFY, parent, add_scene_button(&subtree->parts, LAB_SSD_BUTTON_ICONIFY, parent,
color, iconify_button_unpressed, color, iconify_button_unpressed,
width - BUTTON_WIDTH * 3, view); width - SSD_BUTTON_WIDTH * 3, view);
add_scene_button(&subtree->parts, LAB_SSD_BUTTON_MAXIMIZE, parent, add_scene_button(&subtree->parts, LAB_SSD_BUTTON_MAXIMIZE, parent,
color, maximize_button_unpressed, color, maximize_button_unpressed,
width - BUTTON_WIDTH * 2, view); width - SSD_BUTTON_WIDTH * 2, view);
add_scene_button_corner(&subtree->parts, add_scene_button_corner(&subtree->parts,
LAB_SSD_BUTTON_CLOSE, LAB_SSD_PART_CORNER_TOP_RIGHT, parent, LAB_SSD_BUTTON_CLOSE, LAB_SSD_PART_CORNER_TOP_RIGHT, parent,
corner_top_right, close_button_unpressed, corner_top_right, close_button_unpressed,
width - BUTTON_WIDTH * 1, view); width - SSD_BUTTON_WIDTH * 1, view);
} FOR_EACH_END } FOR_EACH_END
ssd_update_title(ssd); ssd_update_title(ssd);
} }
@ -105,25 +105,25 @@ ssd_titlebar_update(struct ssd *ssd)
case LAB_SSD_PART_TITLEBAR: case LAB_SSD_PART_TITLEBAR:
wlr_scene_rect_set_size( wlr_scene_rect_set_size(
lab_wlr_scene_get_rect(part->node), lab_wlr_scene_get_rect(part->node),
width - BUTTON_WIDTH * BUTTON_COUNT, width - SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT,
theme->title_height); theme->title_height);
continue; continue;
case LAB_SSD_BUTTON_ICONIFY: case LAB_SSD_BUTTON_ICONIFY:
if (is_direct_child(part->node, subtree)) { if (is_direct_child(part->node, subtree)) {
wlr_scene_node_set_position(part->node, wlr_scene_node_set_position(part->node,
width - BUTTON_WIDTH * 3, 0); width - SSD_BUTTON_WIDTH * 3, 0);
} }
continue; continue;
case LAB_SSD_BUTTON_MAXIMIZE: case LAB_SSD_BUTTON_MAXIMIZE:
if (is_direct_child(part->node, subtree)) { if (is_direct_child(part->node, subtree)) {
wlr_scene_node_set_position(part->node, wlr_scene_node_set_position(part->node,
width - BUTTON_WIDTH * 2, 0); width - SSD_BUTTON_WIDTH * 2, 0);
} }
continue; continue;
case LAB_SSD_PART_CORNER_TOP_RIGHT: case LAB_SSD_PART_CORNER_TOP_RIGHT:
if (is_direct_child(part->node, subtree)) { if (is_direct_child(part->node, subtree)) {
wlr_scene_node_set_position(part->node, wlr_scene_node_set_position(part->node,
width - BUTTON_WIDTH * 1, 0); width - SSD_BUTTON_WIDTH * 1, 0);
} }
continue; continue;
default: default:
@ -172,7 +172,7 @@ ssd_update_title_positions(struct ssd *ssd)
struct view *view = ssd->view; struct view *view = ssd->view;
struct theme *theme = view->server->theme; struct theme *theme = view->server->theme;
int width = view->w; int width = view->w;
int title_bg_width = width - BUTTON_WIDTH * BUTTON_COUNT; int title_bg_width = width - SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT;
int x, y; int x, y;
int buffer_height, buffer_width; int buffer_height, buffer_width;
@ -188,7 +188,7 @@ ssd_update_title_positions(struct ssd *ssd)
buffer_width = part->buffer ? part->buffer->width : 0; buffer_width = part->buffer ? part->buffer->width : 0;
buffer_height = part->buffer ? part->buffer->height : 0; buffer_height = part->buffer ? part->buffer->height : 0;
x = BUTTON_WIDTH; x = SSD_BUTTON_WIDTH;
y = (theme->title_height - buffer_height) / 2; y = (theme->title_height - buffer_height) / 2;
if (title_bg_width <= 0) { if (title_bg_width <= 0) {
@ -198,7 +198,7 @@ ssd_update_title_positions(struct ssd *ssd)
wlr_scene_node_set_enabled(part->node, true); wlr_scene_node_set_enabled(part->node, true);
if (theme->window_label_text_justify == LAB_JUSTIFY_CENTER) { if (theme->window_label_text_justify == LAB_JUSTIFY_CENTER) {
if (buffer_width + BUTTON_WIDTH * 2 <= title_bg_width) { if (buffer_width + SSD_BUTTON_WIDTH * 2 <= title_bg_width) {
/* Center based on the full width */ /* Center based on the full width */
x = (width - buffer_width) / 2; x = (width - buffer_width) / 2;
} else { } else {
@ -239,7 +239,7 @@ ssd_update_title(struct ssd *ssd)
struct ssd_part *part; struct ssd_part *part;
struct ssd_sub_tree *subtree; struct ssd_sub_tree *subtree;
struct ssd_state_title_width *dstate; struct ssd_state_title_width *dstate;
int title_bg_width = view->w - BUTTON_WIDTH * BUTTON_COUNT; int title_bg_width = view->w - SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT;
FOR_EACH_STATE(ssd, subtree) { FOR_EACH_STATE(ssd, subtree) {
if (subtree == &ssd->titlebar.active) { if (subtree == &ssd->titlebar.active) {

View file

@ -494,7 +494,7 @@ create_corners(struct theme *theme)
struct wlr_box box = { struct wlr_box box = {
.x = 0, .x = 0,
.y = 0, .y = 0,
.width = BUTTON_WIDTH + theme->border_width, .width = SSD_BUTTON_WIDTH + theme->border_width,
.height = theme->title_height + theme->border_width, .height = theme->title_height + theme->border_width,
}; };