mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
common: add node-type.c/h (renaming ssd_part_type to lab_node_type)
ssd_part_type contains several node types that are not actually part of server-side decorations (ROOT, MENU, OSD, etc.) Rename it accordingly and move it to a common location, along with some related conversion/comparison functions.
This commit is contained in:
parent
502473f343
commit
1188534876
28 changed files with 345 additions and 315 deletions
63
include/common/node-type.h
Normal file
63
include/common/node-type.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LABWC_NODE_TYPE_H
|
||||
#define LABWC_NODE_TYPE_H
|
||||
|
||||
#include "common/edge.h"
|
||||
|
||||
/*
|
||||
* In labwc, "node type" indicates the role of a wlr_scene_node in the
|
||||
* overall desktop. It also maps more-or-less to the openbox concept of
|
||||
* "context" (as used when defining mouse bindings).
|
||||
*
|
||||
* Some types (BUTTON, BORDER, etc.) refer to groups or categories of
|
||||
* other node types rather than individual nodes. These categories are
|
||||
* defined as ranges (e.g. BUTTON means anything from BUTTON_FIRST to
|
||||
* BUTTON_LAST), therefore order is significant.
|
||||
*
|
||||
* Be sure to keep node_type_contains() in sync with any changes!
|
||||
*/
|
||||
enum lab_node_type {
|
||||
LAB_NODE_NONE = 0,
|
||||
|
||||
LAB_NODE_BUTTON_CLOSE = 1,
|
||||
LAB_NODE_BUTTON_MAXIMIZE,
|
||||
LAB_NODE_BUTTON_ICONIFY,
|
||||
LAB_NODE_BUTTON_WINDOW_ICON,
|
||||
LAB_NODE_BUTTON_WINDOW_MENU,
|
||||
LAB_NODE_BUTTON_SHADE,
|
||||
LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
LAB_NODE_BUTTON_FIRST = LAB_NODE_BUTTON_CLOSE,
|
||||
LAB_NODE_BUTTON_LAST = LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
LAB_NODE_BUTTON,
|
||||
|
||||
LAB_NODE_TITLEBAR,
|
||||
LAB_NODE_TITLE,
|
||||
|
||||
LAB_NODE_CORNER_TOP_LEFT,
|
||||
LAB_NODE_CORNER_TOP_RIGHT,
|
||||
LAB_NODE_CORNER_BOTTOM_RIGHT,
|
||||
LAB_NODE_CORNER_BOTTOM_LEFT,
|
||||
LAB_NODE_BORDER_TOP,
|
||||
LAB_NODE_BORDER_RIGHT,
|
||||
LAB_NODE_BORDER_BOTTOM,
|
||||
LAB_NODE_BORDER_LEFT,
|
||||
LAB_NODE_BORDER,
|
||||
|
||||
LAB_NODE_CLIENT,
|
||||
LAB_NODE_FRAME,
|
||||
LAB_NODE_ROOT,
|
||||
LAB_NODE_MENU,
|
||||
LAB_NODE_OSD,
|
||||
LAB_NODE_LAYER_SURFACE,
|
||||
LAB_NODE_LAYER_SUBSURFACE,
|
||||
LAB_NODE_UNMANAGED,
|
||||
LAB_NODE_ALL,
|
||||
};
|
||||
|
||||
enum lab_node_type node_type_parse(const char *context);
|
||||
|
||||
bool node_type_contains(enum lab_node_type whole, enum lab_node_type part);
|
||||
|
||||
enum lab_edge node_type_to_edges(enum lab_node_type type);
|
||||
|
||||
#endif /* LABWC_NODE_TYPE_H */
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
#ifndef LABWC_MOUSEBIND_H
|
||||
#define LABWC_MOUSEBIND_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <wayland-util.h>
|
||||
#include "ssd.h"
|
||||
#include "config/keybind.h"
|
||||
#include "common/node-type.h"
|
||||
|
||||
enum mouse_event {
|
||||
MOUSE_ACTION_NONE = 0,
|
||||
|
|
@ -25,7 +25,7 @@ enum direction {
|
|||
};
|
||||
|
||||
struct mousebind {
|
||||
enum ssd_part_type context;
|
||||
enum lab_node_type context;
|
||||
|
||||
/* ex: BTN_LEFT, BTN_RIGHT from linux/input_event_codes.h */
|
||||
uint32_t button;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
#include "common/border.h"
|
||||
#include "common/buf.h"
|
||||
#include "common/font.h"
|
||||
#include "common/node-type.h"
|
||||
#include "config/types.h"
|
||||
#include "ssd.h"
|
||||
|
||||
#define BUTTON_MAP_MAX 16
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ struct button_map_entry {
|
|||
};
|
||||
|
||||
struct title_button {
|
||||
enum ssd_part_type type;
|
||||
enum lab_node_type type;
|
||||
struct wl_list link;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include "common/edge.h"
|
||||
#include "ssd.h"
|
||||
#include "common/node-type.h"
|
||||
|
||||
struct view;
|
||||
struct seat;
|
||||
|
|
@ -32,7 +32,7 @@ struct cursor_context {
|
|||
struct view *view;
|
||||
struct wlr_scene_node *node;
|
||||
struct wlr_surface *surface;
|
||||
enum ssd_part_type type;
|
||||
enum lab_node_type type;
|
||||
double sx, sy;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#define LABWC_SSD_INTERNAL_H
|
||||
|
||||
#include <wlr/util/box.h>
|
||||
#include "ssd.h"
|
||||
#include "common/border.h"
|
||||
#include "theme.h"
|
||||
#include "view.h"
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ struct ssd {
|
|||
* the cursor.
|
||||
*/
|
||||
struct ssd_part {
|
||||
enum ssd_part_type type;
|
||||
enum lab_node_type type;
|
||||
struct view *view;
|
||||
|
||||
/* This part represented in scene graph */
|
||||
|
|
@ -183,10 +183,10 @@ struct wlr_buffer;
|
|||
struct wlr_scene_tree;
|
||||
|
||||
/* SSD internal helpers to create various SSD elements */
|
||||
struct ssd_part *attach_ssd_part(enum ssd_part_type type, struct view *view,
|
||||
struct ssd_part *attach_ssd_part(enum lab_node_type type, struct view *view,
|
||||
struct wlr_scene_node *node);
|
||||
struct ssd_part_button *attach_ssd_part_button(struct wl_list *button_parts,
|
||||
enum ssd_part_type type, struct wlr_scene_tree *parent,
|
||||
enum lab_node_type type, struct wlr_scene_tree *parent,
|
||||
struct lab_img *imgs[LAB_BS_ALL + 1], int x, int y,
|
||||
struct view *view);
|
||||
struct ssd_part_button *button_try_from_ssd_part(struct ssd_part *part);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#define LABWC_SSD_H
|
||||
|
||||
#include "common/border.h"
|
||||
#include "common/edge.h"
|
||||
#include "common/node-type.h"
|
||||
#include "config/types.h"
|
||||
|
||||
enum ssd_active_state {
|
||||
|
|
@ -22,51 +22,6 @@ struct wlr_cursor;
|
|||
*/
|
||||
#define SSD_SHADOW_INSET 0.3
|
||||
|
||||
/*
|
||||
* Sequence these according to the order they should be processed for
|
||||
* press and hover events. Bear in mind that some of their respective
|
||||
* interactive areas overlap, so for example buttons need to come before title.
|
||||
*/
|
||||
enum ssd_part_type {
|
||||
LAB_SSD_NONE = 0,
|
||||
|
||||
LAB_SSD_BUTTON_CLOSE = 1,
|
||||
LAB_SSD_BUTTON_MAXIMIZE,
|
||||
LAB_SSD_BUTTON_ICONIFY,
|
||||
LAB_SSD_BUTTON_WINDOW_ICON,
|
||||
LAB_SSD_BUTTON_WINDOW_MENU,
|
||||
LAB_SSD_BUTTON_SHADE,
|
||||
LAB_SSD_BUTTON_OMNIPRESENT,
|
||||
/* only for internal use */
|
||||
LAB_SSD_BUTTON_FIRST = LAB_SSD_BUTTON_CLOSE,
|
||||
LAB_SSD_BUTTON_LAST = LAB_SSD_BUTTON_OMNIPRESENT,
|
||||
LAB_SSD_BUTTON,
|
||||
|
||||
LAB_SSD_PART_TITLEBAR,
|
||||
LAB_SSD_PART_TITLE,
|
||||
|
||||
LAB_SSD_PART_CORNER_TOP_LEFT,
|
||||
LAB_SSD_PART_CORNER_TOP_RIGHT,
|
||||
LAB_SSD_PART_CORNER_BOTTOM_RIGHT,
|
||||
LAB_SSD_PART_CORNER_BOTTOM_LEFT,
|
||||
LAB_SSD_PART_TOP,
|
||||
LAB_SSD_PART_RIGHT,
|
||||
LAB_SSD_PART_BOTTOM,
|
||||
LAB_SSD_PART_LEFT,
|
||||
LAB_SSD_PART_BORDER,
|
||||
|
||||
LAB_SSD_CLIENT,
|
||||
LAB_SSD_FRAME,
|
||||
LAB_SSD_ROOT,
|
||||
LAB_SSD_MENU,
|
||||
LAB_SSD_OSD,
|
||||
LAB_SSD_LAYER_SURFACE,
|
||||
LAB_SSD_LAYER_SUBSURFACE,
|
||||
LAB_SSD_UNMANAGED,
|
||||
LAB_SSD_ALL,
|
||||
LAB_SSD_END_MARKER
|
||||
};
|
||||
|
||||
/* Forward declare arguments */
|
||||
struct ssd;
|
||||
struct ssd_hover_state;
|
||||
|
|
@ -101,7 +56,7 @@ struct ssd_hover_state *ssd_hover_state_new(void);
|
|||
void ssd_update_button_hover(struct wlr_scene_node *node,
|
||||
struct ssd_hover_state *hover_state);
|
||||
|
||||
enum ssd_part_type ssd_part_get_type(const struct ssd_part *part);
|
||||
enum lab_node_type ssd_part_get_type(const struct ssd_part *part);
|
||||
struct view *ssd_part_get_view(const struct ssd_part *part);
|
||||
|
||||
/* Public SSD helpers */
|
||||
|
|
@ -110,10 +65,8 @@ struct view *ssd_part_get_view(const struct ssd_part *part);
|
|||
* Returns a part type that represents a mouse context like "Top", "Left" and
|
||||
* "TRCorner" when the cursor is on the window border or resizing handle.
|
||||
*/
|
||||
enum ssd_part_type ssd_get_resizing_type(const struct ssd *ssd,
|
||||
enum lab_node_type ssd_get_resizing_type(const struct ssd *ssd,
|
||||
struct wlr_cursor *cursor);
|
||||
enum lab_edge ssd_resize_edges(enum ssd_part_type type);
|
||||
bool ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate);
|
||||
enum lab_ssd_mode ssd_mode_parse(const char *mode);
|
||||
|
||||
/* TODO: clean up / update */
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include <cairo.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include "ssd.h"
|
||||
#include "common/node-type.h"
|
||||
|
||||
struct lab_img;
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ struct theme {
|
|||
struct theme_background title_bg;
|
||||
|
||||
/* TODO: add toggled/hover/pressed/disabled colors for buttons */
|
||||
float button_colors[LAB_SSD_BUTTON_LAST + 1][4];
|
||||
float button_colors[LAB_NODE_BUTTON_LAST + 1][4];
|
||||
|
||||
float border_color[4];
|
||||
float toggled_keybinds_color[4];
|
||||
|
|
@ -109,7 +109,7 @@ struct theme {
|
|||
* Elements in buttons[0] are all NULL since LAB_SSD_BUTTON_FIRST is 1.
|
||||
*/
|
||||
struct lab_img *button_imgs
|
||||
[LAB_SSD_BUTTON_LAST + 1][LAB_BS_ALL + 1];
|
||||
[LAB_NODE_BUTTON_LAST + 1][LAB_BS_ALL + 1];
|
||||
|
||||
/*
|
||||
* The titlebar background is specified as a cairo_pattern
|
||||
|
|
|
|||
|
|
@ -707,8 +707,8 @@ show_menu(struct server *server, struct view *view, struct cursor_context *ctx,
|
|||
x = extent.x;
|
||||
y = view->current.y;
|
||||
/* Push the client menu underneath the button */
|
||||
if (is_client_menu && ssd_part_contains(
|
||||
LAB_SSD_BUTTON, ctx->type)) {
|
||||
if (is_client_menu && node_type_contains(
|
||||
LAB_NODE_BUTTON, ctx->type)) {
|
||||
assert(ctx->node);
|
||||
int lx, ly;
|
||||
wlr_scene_node_coords(ctx->node, &lx, &ly);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ labwc_sources += files(
|
|||
'match.c',
|
||||
'mem.c',
|
||||
'nodename.c',
|
||||
'node-type.c',
|
||||
'parse-bool.c',
|
||||
'parse-double.c',
|
||||
'scene-helpers.c',
|
||||
|
|
|
|||
129
src/common/node-type.c
Normal file
129
src/common/node-type.c
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
#include "common/node-type.h"
|
||||
#include <strings.h>
|
||||
#include <wlr/util/log.h>
|
||||
|
||||
enum lab_node_type
|
||||
node_type_parse(const char *context)
|
||||
{
|
||||
if (!strcasecmp(context, "Close")) {
|
||||
return LAB_NODE_BUTTON_CLOSE;
|
||||
} else if (!strcasecmp(context, "Maximize")) {
|
||||
return LAB_NODE_BUTTON_MAXIMIZE;
|
||||
} else if (!strcasecmp(context, "Iconify")) {
|
||||
return LAB_NODE_BUTTON_ICONIFY;
|
||||
} else if (!strcasecmp(context, "WindowMenu")) {
|
||||
return LAB_NODE_BUTTON_WINDOW_MENU;
|
||||
} else if (!strcasecmp(context, "Icon")) {
|
||||
return LAB_NODE_BUTTON_WINDOW_ICON;
|
||||
} else if (!strcasecmp(context, "Shade")) {
|
||||
return LAB_NODE_BUTTON_SHADE;
|
||||
} else if (!strcasecmp(context, "AllDesktops")) {
|
||||
return LAB_NODE_BUTTON_OMNIPRESENT;
|
||||
} else if (!strcasecmp(context, "Titlebar")) {
|
||||
return LAB_NODE_TITLEBAR;
|
||||
} else if (!strcasecmp(context, "Title")) {
|
||||
return LAB_NODE_TITLE;
|
||||
} else if (!strcasecmp(context, "TLCorner")) {
|
||||
return LAB_NODE_CORNER_TOP_LEFT;
|
||||
} else if (!strcasecmp(context, "TRCorner")) {
|
||||
return LAB_NODE_CORNER_TOP_RIGHT;
|
||||
} else if (!strcasecmp(context, "BRCorner")) {
|
||||
return LAB_NODE_CORNER_BOTTOM_RIGHT;
|
||||
} else if (!strcasecmp(context, "BLCorner")) {
|
||||
return LAB_NODE_CORNER_BOTTOM_LEFT;
|
||||
} else if (!strcasecmp(context, "Border")) {
|
||||
return LAB_NODE_BORDER;
|
||||
} else if (!strcasecmp(context, "Top")) {
|
||||
return LAB_NODE_BORDER_TOP;
|
||||
} else if (!strcasecmp(context, "Right")) {
|
||||
return LAB_NODE_BORDER_RIGHT;
|
||||
} else if (!strcasecmp(context, "Bottom")) {
|
||||
return LAB_NODE_BORDER_BOTTOM;
|
||||
} else if (!strcasecmp(context, "Left")) {
|
||||
return LAB_NODE_BORDER_LEFT;
|
||||
} else if (!strcasecmp(context, "Frame")) {
|
||||
return LAB_NODE_FRAME;
|
||||
} else if (!strcasecmp(context, "Client")) {
|
||||
return LAB_NODE_CLIENT;
|
||||
} else if (!strcasecmp(context, "Desktop")) {
|
||||
return LAB_NODE_ROOT;
|
||||
} else if (!strcasecmp(context, "Root")) {
|
||||
return LAB_NODE_ROOT;
|
||||
} else if (!strcasecmp(context, "All")) {
|
||||
return LAB_NODE_ALL;
|
||||
}
|
||||
wlr_log(WLR_ERROR, "unknown mouse context (%s)", context);
|
||||
return LAB_NODE_NONE;
|
||||
}
|
||||
|
||||
bool
|
||||
node_type_contains(enum lab_node_type whole, enum lab_node_type part)
|
||||
{
|
||||
if (whole == part || whole == LAB_NODE_ALL) {
|
||||
return true;
|
||||
}
|
||||
if (whole == LAB_NODE_BUTTON) {
|
||||
return part >= LAB_NODE_BUTTON_FIRST
|
||||
&& part <= LAB_NODE_BUTTON_LAST;
|
||||
}
|
||||
if (whole == LAB_NODE_TITLEBAR) {
|
||||
return part >= LAB_NODE_BUTTON_FIRST
|
||||
&& part <= LAB_NODE_TITLE;
|
||||
}
|
||||
if (whole == LAB_NODE_TITLE) {
|
||||
/* "Title" includes blank areas of "Titlebar" as well */
|
||||
return part >= LAB_NODE_TITLEBAR
|
||||
&& part <= LAB_NODE_TITLE;
|
||||
}
|
||||
if (whole == LAB_NODE_FRAME) {
|
||||
return part >= LAB_NODE_BUTTON_FIRST
|
||||
&& part <= LAB_NODE_CLIENT;
|
||||
}
|
||||
if (whole == LAB_NODE_BORDER) {
|
||||
return part >= LAB_NODE_CORNER_TOP_LEFT
|
||||
&& part <= LAB_NODE_BORDER_LEFT;
|
||||
}
|
||||
if (whole == LAB_NODE_BORDER_TOP) {
|
||||
return part == LAB_NODE_CORNER_TOP_LEFT
|
||||
|| part == LAB_NODE_CORNER_TOP_RIGHT;
|
||||
}
|
||||
if (whole == LAB_NODE_BORDER_RIGHT) {
|
||||
return part == LAB_NODE_CORNER_TOP_RIGHT
|
||||
|| part == LAB_NODE_CORNER_BOTTOM_RIGHT;
|
||||
}
|
||||
if (whole == LAB_NODE_BORDER_BOTTOM) {
|
||||
return part == LAB_NODE_CORNER_BOTTOM_RIGHT
|
||||
|| part == LAB_NODE_CORNER_BOTTOM_LEFT;
|
||||
}
|
||||
if (whole == LAB_NODE_BORDER_LEFT) {
|
||||
return part == LAB_NODE_CORNER_TOP_LEFT
|
||||
|| part == LAB_NODE_CORNER_BOTTOM_LEFT;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
enum lab_edge
|
||||
node_type_to_edges(enum lab_node_type type)
|
||||
{
|
||||
switch (type) {
|
||||
case LAB_NODE_BORDER_TOP:
|
||||
return LAB_EDGE_TOP;
|
||||
case LAB_NODE_BORDER_RIGHT:
|
||||
return LAB_EDGE_RIGHT;
|
||||
case LAB_NODE_BORDER_BOTTOM:
|
||||
return LAB_EDGE_BOTTOM;
|
||||
case LAB_NODE_BORDER_LEFT:
|
||||
return LAB_EDGE_LEFT;
|
||||
case LAB_NODE_CORNER_TOP_LEFT:
|
||||
return LAB_EDGES_TOP_LEFT;
|
||||
case LAB_NODE_CORNER_TOP_RIGHT:
|
||||
return LAB_EDGES_TOP_RIGHT;
|
||||
case LAB_NODE_CORNER_BOTTOM_RIGHT:
|
||||
return LAB_EDGES_BOTTOM_RIGHT;
|
||||
case LAB_NODE_CORNER_BOTTOM_LEFT:
|
||||
return LAB_EDGES_BOTTOM_LEFT;
|
||||
default:
|
||||
return LAB_EDGE_NONE;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
#include <wlr/util/log.h>
|
||||
#include "common/list.h"
|
||||
#include "common/mem.h"
|
||||
#include "config/keybind.h"
|
||||
#include "config/rcxml.h"
|
||||
|
||||
uint32_t
|
||||
|
|
@ -103,60 +104,6 @@ mousebind_event_from_str(const char *str)
|
|||
return MOUSE_ACTION_NONE;
|
||||
}
|
||||
|
||||
static enum ssd_part_type
|
||||
context_from_str(const char *str)
|
||||
{
|
||||
if (!strcasecmp(str, "Close")) {
|
||||
return LAB_SSD_BUTTON_CLOSE;
|
||||
} else if (!strcasecmp(str, "Maximize")) {
|
||||
return LAB_SSD_BUTTON_MAXIMIZE;
|
||||
} else if (!strcasecmp(str, "Iconify")) {
|
||||
return LAB_SSD_BUTTON_ICONIFY;
|
||||
} else if (!strcasecmp(str, "WindowMenu")) {
|
||||
return LAB_SSD_BUTTON_WINDOW_MENU;
|
||||
} else if (!strcasecmp(str, "Icon")) {
|
||||
return LAB_SSD_BUTTON_WINDOW_ICON;
|
||||
} else if (!strcasecmp(str, "Shade")) {
|
||||
return LAB_SSD_BUTTON_SHADE;
|
||||
} else if (!strcasecmp(str, "AllDesktops")) {
|
||||
return LAB_SSD_BUTTON_OMNIPRESENT;
|
||||
} else if (!strcasecmp(str, "Titlebar")) {
|
||||
return LAB_SSD_PART_TITLEBAR;
|
||||
} else if (!strcasecmp(str, "Title")) {
|
||||
return LAB_SSD_PART_TITLE;
|
||||
} else if (!strcasecmp(str, "TLCorner")) {
|
||||
return LAB_SSD_PART_CORNER_TOP_LEFT;
|
||||
} else if (!strcasecmp(str, "TRCorner")) {
|
||||
return LAB_SSD_PART_CORNER_TOP_RIGHT;
|
||||
} else if (!strcasecmp(str, "BRCorner")) {
|
||||
return LAB_SSD_PART_CORNER_BOTTOM_RIGHT;
|
||||
} else if (!strcasecmp(str, "BLCorner")) {
|
||||
return LAB_SSD_PART_CORNER_BOTTOM_LEFT;
|
||||
} else if (!strcasecmp(str, "Border")) {
|
||||
return LAB_SSD_PART_BORDER;
|
||||
} else if (!strcasecmp(str, "Top")) {
|
||||
return LAB_SSD_PART_TOP;
|
||||
} else if (!strcasecmp(str, "Right")) {
|
||||
return LAB_SSD_PART_RIGHT;
|
||||
} else if (!strcasecmp(str, "Bottom")) {
|
||||
return LAB_SSD_PART_BOTTOM;
|
||||
} else if (!strcasecmp(str, "Left")) {
|
||||
return LAB_SSD_PART_LEFT;
|
||||
} else if (!strcasecmp(str, "Frame")) {
|
||||
return LAB_SSD_FRAME;
|
||||
} else if (!strcasecmp(str, "Client")) {
|
||||
return LAB_SSD_CLIENT;
|
||||
} else if (!strcasecmp(str, "Desktop")) {
|
||||
return LAB_SSD_ROOT;
|
||||
} else if (!strcasecmp(str, "Root")) {
|
||||
return LAB_SSD_ROOT;
|
||||
} else if (!strcasecmp(str, "All")) {
|
||||
return LAB_SSD_ALL;
|
||||
}
|
||||
wlr_log(WLR_ERROR, "unknown mouse context (%s)", str);
|
||||
return LAB_SSD_NONE;
|
||||
}
|
||||
|
||||
bool
|
||||
mousebind_the_same(struct mousebind *a, struct mousebind *b)
|
||||
{
|
||||
|
|
@ -176,8 +123,8 @@ mousebind_create(const char *context)
|
|||
return NULL;
|
||||
}
|
||||
struct mousebind *m = znew(*m);
|
||||
m->context = context_from_str(context);
|
||||
if (m->context != LAB_SSD_NONE) {
|
||||
m->context = node_type_parse(context);
|
||||
if (m->context != LAB_NODE_NONE) {
|
||||
wl_list_append(&rc.mousebinds, &m->link);
|
||||
}
|
||||
wl_list_init(&m->actions);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "labwc.h"
|
||||
#include "osd.h"
|
||||
#include "regions.h"
|
||||
#include "ssd.h"
|
||||
#include "view.h"
|
||||
#include "window-rules.h"
|
||||
#include "workspaces.h"
|
||||
|
|
@ -126,34 +127,34 @@ fill_section(const char *content, struct wl_list *list, uint32_t *found_buttons)
|
|||
if (string_null_or_empty(identifier)) {
|
||||
continue;
|
||||
}
|
||||
enum ssd_part_type type = LAB_SSD_NONE;
|
||||
enum lab_node_type type = LAB_NODE_NONE;
|
||||
if (!strcmp(identifier, "icon")) {
|
||||
#if HAVE_LIBSFDO
|
||||
type = LAB_SSD_BUTTON_WINDOW_ICON;
|
||||
type = LAB_NODE_BUTTON_WINDOW_ICON;
|
||||
#else
|
||||
wlr_log(WLR_ERROR, "libsfdo is not linked. "
|
||||
"Replacing 'icon' in titlebar layout with 'menu'.");
|
||||
type = LAB_SSD_BUTTON_WINDOW_MENU;
|
||||
type = LAB_NODE_BUTTON_WINDOW_MENU;
|
||||
#endif
|
||||
} else if (!strcmp(identifier, "menu")) {
|
||||
type = LAB_SSD_BUTTON_WINDOW_MENU;
|
||||
type = LAB_NODE_BUTTON_WINDOW_MENU;
|
||||
} else if (!strcmp(identifier, "iconify")) {
|
||||
type = LAB_SSD_BUTTON_ICONIFY;
|
||||
type = LAB_NODE_BUTTON_ICONIFY;
|
||||
} else if (!strcmp(identifier, "max")) {
|
||||
type = LAB_SSD_BUTTON_MAXIMIZE;
|
||||
type = LAB_NODE_BUTTON_MAXIMIZE;
|
||||
} else if (!strcmp(identifier, "close")) {
|
||||
type = LAB_SSD_BUTTON_CLOSE;
|
||||
type = LAB_NODE_BUTTON_CLOSE;
|
||||
} else if (!strcmp(identifier, "shade")) {
|
||||
type = LAB_SSD_BUTTON_SHADE;
|
||||
type = LAB_NODE_BUTTON_SHADE;
|
||||
} else if (!strcmp(identifier, "desk")) {
|
||||
type = LAB_SSD_BUTTON_OMNIPRESENT;
|
||||
type = LAB_NODE_BUTTON_OMNIPRESENT;
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "invalid titleLayout identifier '%s'",
|
||||
identifier);
|
||||
continue;
|
||||
}
|
||||
|
||||
assert(type != LAB_SSD_NONE);
|
||||
assert(type != LAB_NODE_NONE);
|
||||
|
||||
/* We no longer need this check, but let's keep it just in case */
|
||||
if (*found_buttons & (1 << type)) {
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ get_surface_from_layer_node(struct wlr_scene_node *node)
|
|||
struct cursor_context
|
||||
get_cursor_context(struct server *server)
|
||||
{
|
||||
struct cursor_context ret = {.type = LAB_SSD_NONE};
|
||||
struct cursor_context ret = {.type = LAB_NODE_NONE};
|
||||
struct wlr_cursor *cursor = server->seat.cursor;
|
||||
|
||||
/* Prevent drag icons to be on top of the hitbox detection */
|
||||
|
|
@ -281,7 +281,7 @@ get_cursor_context(struct server *server)
|
|||
|
||||
ret.node = node;
|
||||
if (!node) {
|
||||
ret.type = LAB_SSD_ROOT;
|
||||
ret.type = LAB_NODE_ROOT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +289,7 @@ get_cursor_context(struct server *server)
|
|||
if (node->type == WLR_SCENE_NODE_BUFFER) {
|
||||
struct wlr_surface *surface = lab_wlr_surface_from_node(node);
|
||||
if (node->parent == server->unmanaged_tree) {
|
||||
ret.type = LAB_SSD_UNMANAGED;
|
||||
ret.type = LAB_NODE_UNMANAGED;
|
||||
ret.surface = surface;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -304,7 +304,7 @@ get_cursor_context(struct server *server)
|
|||
ret.view = desc->data;
|
||||
if (ret.node->type == WLR_SCENE_NODE_BUFFER
|
||||
&& lab_wlr_surface_from_node(ret.node)) {
|
||||
ret.type = LAB_SSD_CLIENT;
|
||||
ret.type = LAB_NODE_CLIENT;
|
||||
ret.surface = lab_wlr_surface_from_node(ret.node);
|
||||
} else {
|
||||
/* should never be reached */
|
||||
|
|
@ -318,7 +318,7 @@ get_cursor_context(struct server *server)
|
|||
|
||||
/* Detect mouse contexts like Top, Left and TRCorner */
|
||||
ret.type = ssd_get_resizing_type(ret.view->ssd, cursor);
|
||||
if (ret.type == LAB_SSD_NONE) {
|
||||
if (ret.type == LAB_NODE_NONE) {
|
||||
/*
|
||||
* Otherwise, detect mouse contexts like
|
||||
* Title, Titlebar and Iconify
|
||||
|
|
@ -330,23 +330,23 @@ get_cursor_context(struct server *server)
|
|||
}
|
||||
case LAB_NODE_DESC_LAYER_SURFACE:
|
||||
ret.node = node;
|
||||
ret.type = LAB_SSD_LAYER_SURFACE;
|
||||
ret.type = LAB_NODE_LAYER_SURFACE;
|
||||
ret.surface = get_surface_from_layer_node(node);
|
||||
return ret;
|
||||
case LAB_NODE_DESC_LAYER_POPUP:
|
||||
ret.node = node;
|
||||
ret.type = LAB_SSD_CLIENT;
|
||||
ret.type = LAB_NODE_CLIENT;
|
||||
ret.surface = get_surface_from_layer_node(node);
|
||||
return ret;
|
||||
case LAB_NODE_DESC_SESSION_LOCK_SURFACE: /* fallthrough */
|
||||
case LAB_NODE_DESC_IME_POPUP:
|
||||
ret.type = LAB_SSD_CLIENT;
|
||||
ret.type = LAB_NODE_CLIENT;
|
||||
ret.surface = lab_wlr_surface_from_node(ret.node);
|
||||
return ret;
|
||||
case LAB_NODE_DESC_MENUITEM:
|
||||
/* Always return the top scene node for menu items */
|
||||
ret.node = node;
|
||||
ret.type = LAB_SSD_MENU;
|
||||
ret.type = LAB_NODE_MENU;
|
||||
return ret;
|
||||
case LAB_NODE_DESC_NODE:
|
||||
case LAB_NODE_DESC_TREE:
|
||||
|
|
@ -373,7 +373,7 @@ get_cursor_context(struct server *server)
|
|||
if (surface && wlr_subsurface_try_from_wlr_surface(surface)
|
||||
&& subsurface_parent_layer(surface)) {
|
||||
ret.surface = surface;
|
||||
ret.type = LAB_SSD_LAYER_SUBSURFACE;
|
||||
ret.type = LAB_NODE_LAYER_SUBSURFACE;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,10 @@
|
|||
#include "common/macros.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "labwc.h"
|
||||
#include "output.h"
|
||||
#include "view.h"
|
||||
#include "node.h"
|
||||
#include "output.h"
|
||||
#include "ssd.h"
|
||||
#include "view.h"
|
||||
|
||||
static void
|
||||
edges_for_target_geometry(struct border *edges, struct view *view,
|
||||
|
|
|
|||
|
|
@ -113,9 +113,9 @@ cursor_get_from_edge(enum lab_edge resize_edges)
|
|||
}
|
||||
|
||||
static enum lab_cursors
|
||||
cursor_get_from_ssd(enum ssd_part_type view_area)
|
||||
cursor_get_from_ssd(enum lab_node_type view_area)
|
||||
{
|
||||
enum lab_edge resize_edges = ssd_resize_edges(view_area);
|
||||
enum lab_edge resize_edges = node_type_to_edges(view_area);
|
||||
return cursor_get_from_edge(resize_edges);
|
||||
}
|
||||
|
||||
|
|
@ -580,7 +580,7 @@ cursor_update_common(struct server *server, struct cursor_context *ctx,
|
|||
enum lab_edge
|
||||
cursor_get_resize_edges(struct wlr_cursor *cursor, struct cursor_context *ctx)
|
||||
{
|
||||
enum lab_edge resize_edges = ssd_resize_edges(ctx->type);
|
||||
enum lab_edge resize_edges = node_type_to_edges(ctx->type);
|
||||
if (ctx->view && !resize_edges) {
|
||||
struct wlr_box box = ctx->view->current;
|
||||
resize_edges |=
|
||||
|
|
@ -609,7 +609,7 @@ cursor_process_motion(struct server *server, uint32_t time, double *sx, double *
|
|||
struct cursor_context ctx = get_cursor_context(server);
|
||||
struct seat *seat = &server->seat;
|
||||
|
||||
if (ctx.type == LAB_SSD_MENU) {
|
||||
if (ctx.type == LAB_NODE_MENU) {
|
||||
menu_process_cursor_motion(ctx.node);
|
||||
cursor_set(&server->seat, LAB_CURSOR_DEFAULT);
|
||||
return false;
|
||||
|
|
@ -621,7 +621,7 @@ cursor_process_motion(struct server *server, uint32_t time, double *sx, double *
|
|||
|
||||
struct mousebind *mousebind;
|
||||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||
if (ctx.type == LAB_SSD_CLIENT
|
||||
if (ctx.type == LAB_NODE_CLIENT
|
||||
&& view_inhibits_actions(ctx.view, &mousebind->actions)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -964,11 +964,11 @@ process_release_mousebinding(struct server *server,
|
|||
uint32_t modifiers = keyboard_get_all_modifiers(&server->seat);
|
||||
|
||||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||
if (ctx->type == LAB_SSD_CLIENT
|
||||
if (ctx->type == LAB_NODE_CLIENT
|
||||
&& view_inhibits_actions(ctx->view, &mousebind->actions)) {
|
||||
continue;
|
||||
}
|
||||
if (ssd_part_contains(mousebind->context, ctx->type)
|
||||
if (node_type_contains(mousebind->context, ctx->type)
|
||||
&& mousebind->button == button
|
||||
&& modifiers == mousebind->modifiers) {
|
||||
switch (mousebind->mouse_event) {
|
||||
|
|
@ -991,7 +991,7 @@ static bool
|
|||
is_double_click(long double_click_speed, uint32_t button,
|
||||
struct cursor_context *ctx)
|
||||
{
|
||||
static enum ssd_part_type last_type;
|
||||
static enum lab_node_type last_type;
|
||||
static uint32_t last_button;
|
||||
static struct view *last_view;
|
||||
static struct timespec last_click;
|
||||
|
|
@ -1015,7 +1015,7 @@ is_double_click(long double_click_speed, uint32_t button,
|
|||
*/
|
||||
last_button = 0;
|
||||
last_view = NULL;
|
||||
last_type = LAB_SSD_NONE;
|
||||
last_type = LAB_NODE_NONE;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -1035,11 +1035,11 @@ process_press_mousebinding(struct server *server, struct cursor_context *ctx,
|
|||
uint32_t modifiers = keyboard_get_all_modifiers(&server->seat);
|
||||
|
||||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||
if (ctx->type == LAB_SSD_CLIENT
|
||||
if (ctx->type == LAB_NODE_CLIENT
|
||||
&& view_inhibits_actions(ctx->view, &mousebind->actions)) {
|
||||
continue;
|
||||
}
|
||||
if (ssd_part_contains(mousebind->context, ctx->type)
|
||||
if (node_type_contains(mousebind->context, ctx->type)
|
||||
&& mousebind->button == button
|
||||
&& modifiers == mousebind->modifiers) {
|
||||
switch (mousebind->mouse_event) {
|
||||
|
|
@ -1053,9 +1053,9 @@ process_press_mousebinding(struct server *server, struct cursor_context *ctx,
|
|||
if (!double_click) {
|
||||
/* Swallow the press event */
|
||||
consumed_by_frame_context |=
|
||||
mousebind->context == LAB_SSD_FRAME;
|
||||
mousebind->context == LAB_NODE_FRAME;
|
||||
consumed_by_frame_context |=
|
||||
mousebind->context == LAB_SSD_ALL;
|
||||
mousebind->context == LAB_NODE_ALL;
|
||||
mousebind->pressed_in_context = true;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1069,8 +1069,8 @@ process_press_mousebinding(struct server *server, struct cursor_context *ctx,
|
|||
default:
|
||||
continue;
|
||||
}
|
||||
consumed_by_frame_context |= mousebind->context == LAB_SSD_FRAME;
|
||||
consumed_by_frame_context |= mousebind->context == LAB_SSD_ALL;
|
||||
consumed_by_frame_context |= mousebind->context == LAB_NODE_FRAME;
|
||||
consumed_by_frame_context |= mousebind->context == LAB_NODE_ALL;
|
||||
actions_run(ctx->view, server, &mousebind->actions, ctx);
|
||||
}
|
||||
}
|
||||
|
|
@ -1108,14 +1108,14 @@ cursor_process_button_press(struct seat *seat, uint32_t button, uint32_t time_ms
|
|||
* Action processing does not run for these surfaces and thus
|
||||
* the Focus action (used for normal views) does not work.
|
||||
*/
|
||||
if (ctx.type == LAB_SSD_LAYER_SURFACE) {
|
||||
if (ctx.type == LAB_NODE_LAYER_SURFACE) {
|
||||
wlr_log(WLR_DEBUG, "press on layer-surface");
|
||||
struct wlr_layer_surface_v1 *layer =
|
||||
wlr_layer_surface_v1_try_from_wlr_surface(ctx.surface);
|
||||
if (layer && layer->current.keyboard_interactive) {
|
||||
layer_try_set_focus(seat, layer);
|
||||
}
|
||||
} else if (ctx.type == LAB_SSD_LAYER_SUBSURFACE) {
|
||||
} else if (ctx.type == LAB_NODE_LAYER_SUBSURFACE) {
|
||||
wlr_log(WLR_DEBUG, "press on layer-subsurface");
|
||||
struct wlr_layer_surface_v1 *layer =
|
||||
subsurface_parent_layer(ctx.surface);
|
||||
|
|
@ -1123,13 +1123,13 @@ cursor_process_button_press(struct seat *seat, uint32_t button, uint32_t time_ms
|
|||
layer_try_set_focus(seat, layer);
|
||||
}
|
||||
#ifdef HAVE_XWAYLAND
|
||||
} else if (ctx.type == LAB_SSD_UNMANAGED) {
|
||||
} else if (ctx.type == LAB_NODE_UNMANAGED) {
|
||||
desktop_focus_view_or_surface(seat, NULL, ctx.surface,
|
||||
/*raise*/ false);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ctx.type != LAB_SSD_CLIENT && ctx.type != LAB_SSD_LAYER_SUBSURFACE
|
||||
if (ctx.type != LAB_NODE_CLIENT && ctx.type != LAB_NODE_LAYER_SUBSURFACE
|
||||
&& wlr_seat_pointer_has_grab(seat->seat)) {
|
||||
/*
|
||||
* If we have an active popup grab (an open popup) we want to
|
||||
|
|
@ -1173,7 +1173,7 @@ cursor_process_button_release(struct seat *seat, uint32_t button,
|
|||
if (server->input_mode == LAB_INPUT_STATE_MENU) {
|
||||
/* TODO: take into account overflow of time_msec */
|
||||
if (time_msec - press_msec > rc.menu_ignore_button_release_period) {
|
||||
if (ctx.type == LAB_SSD_MENU) {
|
||||
if (ctx.type == LAB_NODE_MENU) {
|
||||
menu_call_selected_actions(server);
|
||||
} else {
|
||||
menu_close_root(server);
|
||||
|
|
@ -1342,11 +1342,11 @@ process_cursor_axis(struct server *server, enum wl_pointer_axis orientation,
|
|||
if (direction != LAB_DIRECTION_INVALID) {
|
||||
struct mousebind *mousebind;
|
||||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||
if (ctx.type == LAB_SSD_CLIENT
|
||||
if (ctx.type == LAB_NODE_CLIENT
|
||||
&& view_inhibits_actions(ctx.view, &mousebind->actions)) {
|
||||
continue;
|
||||
}
|
||||
if (ssd_part_contains(mousebind->context, ctx.type)
|
||||
if (node_type_contains(mousebind->context, ctx.type)
|
||||
&& mousebind->direction == direction
|
||||
&& modifiers == mousebind->modifiers
|
||||
&& mousebind->mouse_event == MOUSE_ACTION_SCROLL) {
|
||||
|
|
|
|||
|
|
@ -666,7 +666,7 @@ handle_tablet_tool_button(struct wl_listener *listener, void *data)
|
|||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||
if (mousebind->mouse_event == MOUSE_ACTION_PRESS
|
||||
&& mousebind->button == button
|
||||
&& mousebind->context == LAB_SSD_CLIENT) {
|
||||
&& mousebind->context == LAB_NODE_CLIENT) {
|
||||
actions_run(view, tool->seat->server,
|
||||
&mousebind->actions, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ handle_touch_down(struct wl_listener *listener, void *data)
|
|||
wl_list_for_each(mousebind, &rc.mousebinds, link) {
|
||||
if (mousebind->mouse_event == MOUSE_ACTION_PRESS
|
||||
&& mousebind->button == BTN_LEFT
|
||||
&& mousebind->context == LAB_SSD_CLIENT) {
|
||||
&& mousebind->context == LAB_NODE_CLIENT) {
|
||||
actions_run(view, seat->server, &mousebind->actions, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "output.h"
|
||||
#include "scaled-buffer/scaled-font-buffer.h"
|
||||
#include "scaled-buffer/scaled-icon-buffer.h"
|
||||
#include "ssd.h"
|
||||
#include "theme.h"
|
||||
#include "view.h"
|
||||
#include "window-rules.h"
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@
|
|||
#include "resize-indicator.h"
|
||||
#include "scaled-buffer/scaled-buffer.h"
|
||||
#include "session-lock.h"
|
||||
#include "ssd.h"
|
||||
#include "theme.h"
|
||||
#include "view.h"
|
||||
#include "workspaces.h"
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
#include "snap.h"
|
||||
#include <assert.h>
|
||||
#include <wlr/util/box.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "common/border.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "edges.h"
|
||||
#include "labwc.h"
|
||||
#include "output.h"
|
||||
#include "snap-constraints.h"
|
||||
#include "ssd.h"
|
||||
#include "view.h"
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
#include <wlr/types/wlr_scene.h>
|
||||
#include <wlr/util/box.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "common/macros.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "labwc.h"
|
||||
#include "resize-indicator.h"
|
||||
#include "resize-outlines.h"
|
||||
#include "scaled-buffer/scaled-font-buffer.h"
|
||||
#include "ssd.h"
|
||||
#include "theme.h"
|
||||
#include "view.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "common/macros.h"
|
||||
#include "common/scene-helpers.h"
|
||||
#include "labwc.h"
|
||||
#include "ssd.h"
|
||||
#include "ssd-internal.h"
|
||||
#include "theme.h"
|
||||
#include "view.h"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ handle_node_destroy(struct wl_listener *listener, void *data)
|
|||
* to is destroyed.
|
||||
*/
|
||||
static void
|
||||
init_ssd_part(struct ssd_part *part, enum ssd_part_type type,
|
||||
init_ssd_part(struct ssd_part *part, enum lab_node_type type,
|
||||
struct view *view, struct wlr_scene_node *node)
|
||||
{
|
||||
part->type = type;
|
||||
|
|
@ -45,17 +45,17 @@ init_ssd_part(struct ssd_part *part, enum ssd_part_type type,
|
|||
}
|
||||
|
||||
struct ssd_part *
|
||||
attach_ssd_part(enum ssd_part_type type, struct view *view,
|
||||
attach_ssd_part(enum lab_node_type type, struct view *view,
|
||||
struct wlr_scene_node *node)
|
||||
{
|
||||
assert(!ssd_part_contains(LAB_SSD_BUTTON, type));
|
||||
assert(!node_type_contains(LAB_NODE_BUTTON, type));
|
||||
struct ssd_part *part = znew(*part);
|
||||
init_ssd_part(part, type, view, node);
|
||||
return part;
|
||||
}
|
||||
|
||||
struct ssd_part_button *
|
||||
attach_ssd_part_button(struct wl_list *button_parts, enum ssd_part_type type,
|
||||
attach_ssd_part_button(struct wl_list *button_parts, enum lab_node_type type,
|
||||
struct wlr_scene_tree *parent,
|
||||
struct lab_img *imgs[LAB_BS_ALL + 1],
|
||||
int x, int y, struct view *view)
|
||||
|
|
@ -63,7 +63,7 @@ attach_ssd_part_button(struct wl_list *button_parts, enum ssd_part_type type,
|
|||
struct wlr_scene_tree *root = wlr_scene_tree_create(parent);
|
||||
wlr_scene_node_set_position(&root->node, x, y);
|
||||
|
||||
assert(ssd_part_contains(LAB_SSD_BUTTON, type));
|
||||
assert(node_type_contains(LAB_NODE_BUTTON, type));
|
||||
struct ssd_part_button *button = znew(*button);
|
||||
init_ssd_part(&button->base, type, view, &root->node);
|
||||
wl_list_append(button_parts, &button->link);
|
||||
|
|
@ -86,7 +86,7 @@ attach_ssd_part_button(struct wl_list *button_parts, enum ssd_part_type type,
|
|||
*/
|
||||
int icon_padding = button_width / 10;
|
||||
|
||||
if (type == LAB_SSD_BUTTON_WINDOW_ICON) {
|
||||
if (type == LAB_NODE_BUTTON_WINDOW_ICON) {
|
||||
struct scaled_icon_buffer *icon_buffer =
|
||||
scaled_icon_buffer_create(root, view->server,
|
||||
button_width - 2 * icon_padding, button_height);
|
||||
|
|
@ -120,7 +120,7 @@ attach_ssd_part_button(struct wl_list *button_parts, enum ssd_part_type type,
|
|||
struct ssd_part_button *
|
||||
button_try_from_ssd_part(struct ssd_part *part)
|
||||
{
|
||||
if (ssd_part_contains(LAB_SSD_BUTTON, part->type)) {
|
||||
if (node_type_contains(LAB_NODE_BUTTON, part->type)) {
|
||||
return (struct ssd_part_button *)part;
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "buffer.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "labwc.h"
|
||||
#include "ssd.h"
|
||||
#include "ssd-internal.h"
|
||||
#include "theme.h"
|
||||
#include "view.h"
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@
|
|||
#include "scaled-buffer/scaled-font-buffer.h"
|
||||
#include "scaled-buffer/scaled-icon-buffer.h"
|
||||
#include "scaled-buffer/scaled-img-buffer.h"
|
||||
#include "ssd.h"
|
||||
#include "ssd-internal.h"
|
||||
#include "theme.h"
|
||||
#include "view.h"
|
||||
|
||||
static void set_squared_corners(struct ssd *ssd, bool enable);
|
||||
static void set_alt_button_icon(struct ssd *ssd, enum ssd_part_type type, bool enable);
|
||||
static void set_alt_button_icon(struct ssd *ssd, enum lab_node_type type, bool enable);
|
||||
static void update_visible_buttons(struct ssd *ssd);
|
||||
|
||||
void
|
||||
|
|
@ -33,7 +34,7 @@ ssd_titlebar_create(struct ssd *ssd)
|
|||
int corner_width = ssd_get_corner_width();
|
||||
|
||||
ssd->titlebar.tree = wlr_scene_tree_create(ssd->tree);
|
||||
attach_ssd_part(LAB_SSD_PART_TITLEBAR, view, &ssd->titlebar.tree->node);
|
||||
attach_ssd_part(LAB_NODE_TITLEBAR, view, &ssd->titlebar.tree->node);
|
||||
|
||||
enum ssd_active_state active;
|
||||
FOR_EACH_ACTIVE_STATE(active) {
|
||||
|
|
@ -77,7 +78,7 @@ ssd_titlebar_create(struct ssd *ssd)
|
|||
subtree->tree, theme->titlebar_height,
|
||||
theme->window[active].titlebar_pattern);
|
||||
assert(subtree->title);
|
||||
attach_ssd_part(LAB_SSD_PART_TITLE,
|
||||
attach_ssd_part(LAB_NODE_TITLE,
|
||||
view, &subtree->title->scene_buffer->node);
|
||||
|
||||
/* Buttons */
|
||||
|
|
@ -115,7 +116,7 @@ ssd_titlebar_create(struct ssd *ssd)
|
|||
bool maximized = view->maximized == VIEW_AXIS_BOTH;
|
||||
bool squared = ssd_should_be_squared(ssd);
|
||||
if (maximized) {
|
||||
set_alt_button_icon(ssd, LAB_SSD_BUTTON_MAXIMIZE, true);
|
||||
set_alt_button_icon(ssd, LAB_NODE_BUTTON_MAXIMIZE, true);
|
||||
ssd->state.was_maximized = true;
|
||||
}
|
||||
if (squared) {
|
||||
|
|
@ -124,11 +125,11 @@ ssd_titlebar_create(struct ssd *ssd)
|
|||
set_squared_corners(ssd, maximized || squared);
|
||||
|
||||
if (view->shaded) {
|
||||
set_alt_button_icon(ssd, LAB_SSD_BUTTON_SHADE, true);
|
||||
set_alt_button_icon(ssd, LAB_NODE_BUTTON_SHADE, true);
|
||||
}
|
||||
|
||||
if (view->visible_on_all_workspaces) {
|
||||
set_alt_button_icon(ssd, LAB_SSD_BUTTON_OMNIPRESENT, true);
|
||||
set_alt_button_icon(ssd, LAB_NODE_BUTTON_OMNIPRESENT, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +190,7 @@ set_squared_corners(struct ssd *ssd, bool enable)
|
|||
}
|
||||
|
||||
static void
|
||||
set_alt_button_icon(struct ssd *ssd, enum ssd_part_type type, bool enable)
|
||||
set_alt_button_icon(struct ssd *ssd, enum lab_node_type type, bool enable)
|
||||
{
|
||||
enum ssd_active_state active;
|
||||
FOR_EACH_ACTIVE_STATE(active) {
|
||||
|
|
@ -281,19 +282,19 @@ ssd_titlebar_update(struct ssd *ssd)
|
|||
|| ssd->state.was_squared != squared) {
|
||||
set_squared_corners(ssd, maximized || squared);
|
||||
if (ssd->state.was_maximized != maximized) {
|
||||
set_alt_button_icon(ssd, LAB_SSD_BUTTON_MAXIMIZE, maximized);
|
||||
set_alt_button_icon(ssd, LAB_NODE_BUTTON_MAXIMIZE, maximized);
|
||||
}
|
||||
ssd->state.was_maximized = maximized;
|
||||
ssd->state.was_squared = squared;
|
||||
}
|
||||
|
||||
if (ssd->state.was_shaded != view->shaded) {
|
||||
set_alt_button_icon(ssd, LAB_SSD_BUTTON_SHADE, view->shaded);
|
||||
set_alt_button_icon(ssd, LAB_NODE_BUTTON_SHADE, view->shaded);
|
||||
ssd->state.was_shaded = view->shaded;
|
||||
}
|
||||
|
||||
if (ssd->state.was_omnipresent != view->visible_on_all_workspaces) {
|
||||
set_alt_button_icon(ssd, LAB_SSD_BUTTON_OMNIPRESENT,
|
||||
set_alt_button_icon(ssd, LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
view->visible_on_all_workspaces);
|
||||
ssd->state.was_omnipresent = view->visible_on_all_workspaces;
|
||||
}
|
||||
|
|
|
|||
102
src/ssd/ssd.c
102
src/ssd/ssd.c
|
|
@ -6,6 +6,7 @@
|
|||
* Copyright (C) Johan Malm 2020-2021
|
||||
*/
|
||||
|
||||
#include "ssd.h"
|
||||
#include <assert.h>
|
||||
#include <strings.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
|
|
@ -85,12 +86,12 @@ ssd_max_extents(struct view *view)
|
|||
* (generally rc.resize_corner_range, but clipped to view size) of the view
|
||||
* bounds, so check the cursor against the view here.
|
||||
*/
|
||||
enum ssd_part_type
|
||||
enum lab_node_type
|
||||
ssd_get_resizing_type(const struct ssd *ssd, struct wlr_cursor *cursor)
|
||||
{
|
||||
struct view *view = ssd ? ssd->view : NULL;
|
||||
if (!view || !cursor || !view->ssd_mode || view->fullscreen) {
|
||||
return LAB_SSD_NONE;
|
||||
return LAB_NODE_NONE;
|
||||
}
|
||||
|
||||
struct wlr_box view_box = view->current;
|
||||
|
|
@ -105,7 +106,7 @@ ssd_get_resizing_type(const struct ssd *ssd, struct wlr_cursor *cursor)
|
|||
|
||||
if (wlr_box_contains_point(&view_box, cursor->x, cursor->y)) {
|
||||
/* A cursor in bounds of the view is never in an SSD context */
|
||||
return LAB_SSD_NONE;
|
||||
return LAB_NODE_NONE;
|
||||
}
|
||||
|
||||
int corner_height = MAX(0, MIN(rc.resize_corner_range, view_box.height / 2));
|
||||
|
|
@ -116,49 +117,24 @@ ssd_get_resizing_type(const struct ssd *ssd, struct wlr_cursor *cursor)
|
|||
bool bottom = cursor->y > view_box.y + view_box.height - corner_height;
|
||||
|
||||
if (top && left) {
|
||||
return LAB_SSD_PART_CORNER_TOP_LEFT;
|
||||
return LAB_NODE_CORNER_TOP_LEFT;
|
||||
} else if (top && right) {
|
||||
return LAB_SSD_PART_CORNER_TOP_RIGHT;
|
||||
return LAB_NODE_CORNER_TOP_RIGHT;
|
||||
} else if (bottom && left) {
|
||||
return LAB_SSD_PART_CORNER_BOTTOM_LEFT;
|
||||
return LAB_NODE_CORNER_BOTTOM_LEFT;
|
||||
} else if (bottom && right) {
|
||||
return LAB_SSD_PART_CORNER_BOTTOM_RIGHT;
|
||||
return LAB_NODE_CORNER_BOTTOM_RIGHT;
|
||||
} else if (top) {
|
||||
return LAB_SSD_PART_TOP;
|
||||
return LAB_NODE_BORDER_TOP;
|
||||
} else if (bottom) {
|
||||
return LAB_SSD_PART_BOTTOM;
|
||||
return LAB_NODE_BORDER_BOTTOM;
|
||||
} else if (left) {
|
||||
return LAB_SSD_PART_LEFT;
|
||||
return LAB_NODE_BORDER_LEFT;
|
||||
} else if (right) {
|
||||
return LAB_SSD_PART_RIGHT;
|
||||
return LAB_NODE_BORDER_RIGHT;
|
||||
}
|
||||
|
||||
return LAB_SSD_NONE;
|
||||
}
|
||||
|
||||
enum lab_edge
|
||||
ssd_resize_edges(enum ssd_part_type type)
|
||||
{
|
||||
switch (type) {
|
||||
case LAB_SSD_PART_TOP:
|
||||
return LAB_EDGE_TOP;
|
||||
case LAB_SSD_PART_RIGHT:
|
||||
return LAB_EDGE_RIGHT;
|
||||
case LAB_SSD_PART_BOTTOM:
|
||||
return LAB_EDGE_BOTTOM;
|
||||
case LAB_SSD_PART_LEFT:
|
||||
return LAB_EDGE_LEFT;
|
||||
case LAB_SSD_PART_CORNER_TOP_LEFT:
|
||||
return LAB_EDGES_TOP_LEFT;
|
||||
case LAB_SSD_PART_CORNER_TOP_RIGHT:
|
||||
return LAB_EDGES_TOP_RIGHT;
|
||||
case LAB_SSD_PART_CORNER_BOTTOM_RIGHT:
|
||||
return LAB_EDGES_BOTTOM_RIGHT;
|
||||
case LAB_SSD_PART_CORNER_BOTTOM_LEFT:
|
||||
return LAB_EDGES_BOTTOM_LEFT;
|
||||
default:
|
||||
return LAB_EDGE_NONE;
|
||||
}
|
||||
return LAB_NODE_NONE;
|
||||
}
|
||||
|
||||
struct ssd *
|
||||
|
|
@ -169,7 +145,7 @@ ssd_create(struct view *view, bool active)
|
|||
|
||||
ssd->view = view;
|
||||
ssd->tree = wlr_scene_tree_create(view->scene_tree);
|
||||
attach_ssd_part(LAB_SSD_NONE, view, &ssd->tree->node);
|
||||
attach_ssd_part(LAB_NODE_NONE, view, &ssd->tree->node);
|
||||
wlr_scene_node_lower_to_bottom(&ssd->tree->node);
|
||||
ssd->titlebar.height = view->server->theme->titlebar_height;
|
||||
ssd_shadow_create(ssd);
|
||||
|
|
@ -305,52 +281,6 @@ ssd_destroy(struct ssd *ssd)
|
|||
free(ssd);
|
||||
}
|
||||
|
||||
bool
|
||||
ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate)
|
||||
{
|
||||
if (whole == candidate || whole == LAB_SSD_ALL) {
|
||||
return true;
|
||||
}
|
||||
if (whole == LAB_SSD_BUTTON) {
|
||||
return candidate >= LAB_SSD_BUTTON_CLOSE
|
||||
&& candidate <= LAB_SSD_BUTTON_OMNIPRESENT;
|
||||
}
|
||||
if (whole == LAB_SSD_PART_TITLEBAR) {
|
||||
return candidate >= LAB_SSD_BUTTON_CLOSE
|
||||
&& candidate <= LAB_SSD_PART_TITLE;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (whole == LAB_SSD_FRAME) {
|
||||
return candidate >= LAB_SSD_BUTTON_CLOSE
|
||||
&& candidate <= LAB_SSD_CLIENT;
|
||||
}
|
||||
if (whole == LAB_SSD_PART_BORDER) {
|
||||
return candidate >= LAB_SSD_PART_CORNER_TOP_LEFT
|
||||
&& candidate <= LAB_SSD_PART_LEFT;
|
||||
}
|
||||
if (whole == LAB_SSD_PART_TOP) {
|
||||
return candidate == LAB_SSD_PART_CORNER_TOP_LEFT
|
||||
|| candidate == LAB_SSD_PART_CORNER_TOP_RIGHT;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
enum lab_ssd_mode
|
||||
ssd_mode_parse(const char *mode)
|
||||
{
|
||||
|
|
@ -421,10 +351,10 @@ ssd_hover_state_new(void)
|
|||
return znew(struct ssd_hover_state);
|
||||
}
|
||||
|
||||
enum ssd_part_type
|
||||
enum lab_node_type
|
||||
ssd_part_get_type(const struct ssd_part *part)
|
||||
{
|
||||
return part ? part->type : LAB_SSD_NONE;
|
||||
return part ? part->type : LAB_NODE_NONE;
|
||||
}
|
||||
|
||||
struct view *
|
||||
|
|
|
|||
82
src/theme.c
82
src/theme.c
|
|
@ -39,7 +39,7 @@ struct button {
|
|||
const char *name;
|
||||
const char *alt_name;
|
||||
const char *fallback_button; /* built-in 6x6 button */
|
||||
enum ssd_part_type type;
|
||||
enum lab_node_type type;
|
||||
uint8_t state_set;
|
||||
};
|
||||
|
||||
|
|
@ -290,94 +290,94 @@ load_buttons(struct theme *theme)
|
|||
struct button buttons[] = { {
|
||||
.name = "menu",
|
||||
.fallback_button = (const char[]){ 0x00, 0x21, 0x33, 0x1E, 0x0C, 0x00 },
|
||||
.type = LAB_SSD_BUTTON_WINDOW_MENU,
|
||||
.type = LAB_NODE_BUTTON_WINDOW_MENU,
|
||||
.state_set = 0,
|
||||
}, {
|
||||
.name = "iconify",
|
||||
.fallback_button = (const char[]){ 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f },
|
||||
.type = LAB_SSD_BUTTON_ICONIFY,
|
||||
.type = LAB_NODE_BUTTON_ICONIFY,
|
||||
.state_set = 0,
|
||||
}, {
|
||||
.name = "max",
|
||||
.fallback_button = (const char[]){ 0x3f, 0x3f, 0x21, 0x21, 0x21, 0x3f },
|
||||
.type = LAB_SSD_BUTTON_MAXIMIZE,
|
||||
.type = LAB_NODE_BUTTON_MAXIMIZE,
|
||||
.state_set = 0,
|
||||
}, {
|
||||
.name = "max_toggled",
|
||||
.fallback_button = (const char[]){ 0x3e, 0x22, 0x2f, 0x29, 0x39, 0x0f },
|
||||
.type = LAB_SSD_BUTTON_MAXIMIZE,
|
||||
.type = LAB_NODE_BUTTON_MAXIMIZE,
|
||||
.state_set = LAB_BS_TOGGLED,
|
||||
}, {
|
||||
.name = "shade",
|
||||
.fallback_button = (const char[]){ 0x3f, 0x3f, 0x00, 0x0c, 0x1e, 0x3f },
|
||||
.type = LAB_SSD_BUTTON_SHADE,
|
||||
.type = LAB_NODE_BUTTON_SHADE,
|
||||
.state_set = 0,
|
||||
}, {
|
||||
.name = "shade_toggled",
|
||||
.fallback_button = (const char[]){ 0x3f, 0x3f, 0x00, 0x3f, 0x1e, 0x0c },
|
||||
.type = LAB_SSD_BUTTON_SHADE,
|
||||
.type = LAB_NODE_BUTTON_SHADE,
|
||||
.state_set = LAB_BS_TOGGLED,
|
||||
}, {
|
||||
.name = "desk",
|
||||
.fallback_button = (const char[]){ 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 },
|
||||
.type = LAB_SSD_BUTTON_OMNIPRESENT,
|
||||
.type = LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
.state_set = 0,
|
||||
}, {
|
||||
.name = "desk_toggled",
|
||||
.fallback_button = (const char[]){ 0x00, 0x1e, 0x1a, 0x16, 0x1e, 0x00 },
|
||||
.type = LAB_SSD_BUTTON_OMNIPRESENT,
|
||||
.type = LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
.state_set = LAB_BS_TOGGLED,
|
||||
}, {
|
||||
.name = "close",
|
||||
.fallback_button = (const char[]){ 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 },
|
||||
.type = LAB_SSD_BUTTON_CLOSE,
|
||||
.type = LAB_NODE_BUTTON_CLOSE,
|
||||
.state_set = 0,
|
||||
}, {
|
||||
.name = "menu_hover",
|
||||
.type = LAB_SSD_BUTTON_WINDOW_MENU,
|
||||
.type = LAB_NODE_BUTTON_WINDOW_MENU,
|
||||
.state_set = LAB_BS_HOVERED,
|
||||
/* no fallback (non-hover variant is used instead) */
|
||||
}, {
|
||||
.name = "iconify_hover",
|
||||
.type = LAB_SSD_BUTTON_ICONIFY,
|
||||
.type = LAB_NODE_BUTTON_ICONIFY,
|
||||
.state_set = LAB_BS_HOVERED,
|
||||
/* no fallback (non-hover variant is used instead) */
|
||||
}, {
|
||||
.name = "max_hover",
|
||||
.type = LAB_SSD_BUTTON_MAXIMIZE,
|
||||
.type = LAB_NODE_BUTTON_MAXIMIZE,
|
||||
.state_set = LAB_BS_HOVERED,
|
||||
/* no fallback (non-hover variant is used instead) */
|
||||
}, {
|
||||
.name = "max_toggled_hover",
|
||||
.alt_name = "max_hover_toggled",
|
||||
.type = LAB_SSD_BUTTON_MAXIMIZE,
|
||||
.type = LAB_NODE_BUTTON_MAXIMIZE,
|
||||
.state_set = LAB_BS_TOGGLED | LAB_BS_HOVERED,
|
||||
/* no fallback (non-hover variant is used instead) */
|
||||
}, {
|
||||
.name = "shade_hover",
|
||||
.type = LAB_SSD_BUTTON_SHADE,
|
||||
.type = LAB_NODE_BUTTON_SHADE,
|
||||
.state_set = LAB_BS_HOVERED,
|
||||
/* no fallback (non-hover variant is used instead) */
|
||||
}, {
|
||||
.name = "shade_toggled_hover",
|
||||
.alt_name = "shade_hover_toggled",
|
||||
.type = LAB_SSD_BUTTON_SHADE,
|
||||
.type = LAB_NODE_BUTTON_SHADE,
|
||||
.state_set = LAB_BS_TOGGLED | LAB_BS_HOVERED,
|
||||
/* no fallback (non-hover variant is used instead) */
|
||||
}, {
|
||||
.name = "desk_hover",
|
||||
/* no fallback (non-hover variant is used instead) */
|
||||
.type = LAB_SSD_BUTTON_OMNIPRESENT,
|
||||
.type = LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
.state_set = LAB_BS_HOVERED,
|
||||
}, {
|
||||
.name = "desk_toggled_hover",
|
||||
.alt_name = "desk_hover_toggled",
|
||||
.type = LAB_SSD_BUTTON_OMNIPRESENT,
|
||||
.type = LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
.state_set = LAB_BS_TOGGLED | LAB_BS_HOVERED,
|
||||
/* no fallback (non-hover variant is used instead) */
|
||||
}, {
|
||||
.name = "close_hover",
|
||||
.type = LAB_SSD_BUTTON_CLOSE,
|
||||
.type = LAB_NODE_BUTTON_CLOSE,
|
||||
.state_set = LAB_BS_HOVERED,
|
||||
/* no fallback (non-hover variant is used instead) */
|
||||
}, };
|
||||
|
|
@ -572,8 +572,8 @@ theme_builtin(struct theme *theme, struct server *server)
|
|||
theme->window_button_spacing = 0;
|
||||
theme->window_button_hover_bg_corner_radius = 0;
|
||||
|
||||
for (enum ssd_part_type type = LAB_SSD_BUTTON_FIRST;
|
||||
type <= LAB_SSD_BUTTON_LAST; type++) {
|
||||
for (enum lab_node_type type = LAB_NODE_BUTTON_FIRST;
|
||||
type <= LAB_NODE_BUTTON_LAST; type++) {
|
||||
parse_hexstr("#000000",
|
||||
theme->window[THEME_INACTIVE].button_colors[type]);
|
||||
parse_hexstr("#000000",
|
||||
|
|
@ -802,15 +802,15 @@ entry(struct theme *theme, const char *key, const char *value)
|
|||
|
||||
/* universal button */
|
||||
if (match_glob(key, "window.active.button.unpressed.image.color")) {
|
||||
for (enum ssd_part_type type = LAB_SSD_BUTTON_FIRST;
|
||||
type <= LAB_SSD_BUTTON_LAST; type++) {
|
||||
for (enum lab_node_type type = LAB_NODE_BUTTON_FIRST;
|
||||
type <= LAB_NODE_BUTTON_LAST; type++) {
|
||||
parse_color(value,
|
||||
theme->window[THEME_ACTIVE].button_colors[type]);
|
||||
}
|
||||
}
|
||||
if (match_glob(key, "window.inactive.button.unpressed.image.color")) {
|
||||
for (enum ssd_part_type type = LAB_SSD_BUTTON_FIRST;
|
||||
type <= LAB_SSD_BUTTON_LAST; type++) {
|
||||
for (enum lab_node_type type = LAB_NODE_BUTTON_FIRST;
|
||||
type <= LAB_NODE_BUTTON_LAST; type++) {
|
||||
parse_color(value,
|
||||
theme->window[THEME_INACTIVE].button_colors[type]);
|
||||
}
|
||||
|
|
@ -819,55 +819,55 @@ entry(struct theme *theme, const char *key, const char *value)
|
|||
/* individual buttons */
|
||||
if (match_glob(key, "window.active.button.menu.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_ACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_WINDOW_MENU]);
|
||||
.button_colors[LAB_NODE_BUTTON_WINDOW_MENU]);
|
||||
parse_color(value, theme->window[THEME_ACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_WINDOW_ICON]);
|
||||
.button_colors[LAB_NODE_BUTTON_WINDOW_ICON]);
|
||||
}
|
||||
if (match_glob(key, "window.active.button.iconify.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_ACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_ICONIFY]);
|
||||
.button_colors[LAB_NODE_BUTTON_ICONIFY]);
|
||||
}
|
||||
if (match_glob(key, "window.active.button.max.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_ACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_MAXIMIZE]);
|
||||
.button_colors[LAB_NODE_BUTTON_MAXIMIZE]);
|
||||
}
|
||||
if (match_glob(key, "window.active.button.shade.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_ACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_SHADE]);
|
||||
.button_colors[LAB_NODE_BUTTON_SHADE]);
|
||||
}
|
||||
if (match_glob(key, "window.active.button.desk.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_ACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_OMNIPRESENT]);
|
||||
.button_colors[LAB_NODE_BUTTON_OMNIPRESENT]);
|
||||
}
|
||||
if (match_glob(key, "window.active.button.close.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_ACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_CLOSE]);
|
||||
.button_colors[LAB_NODE_BUTTON_CLOSE]);
|
||||
}
|
||||
if (match_glob(key, "window.inactive.button.menu.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_INACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_WINDOW_MENU]);
|
||||
.button_colors[LAB_NODE_BUTTON_WINDOW_MENU]);
|
||||
parse_color(value, theme->window[THEME_INACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_WINDOW_ICON]);
|
||||
.button_colors[LAB_NODE_BUTTON_WINDOW_ICON]);
|
||||
}
|
||||
if (match_glob(key, "window.inactive.button.iconify.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_INACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_ICONIFY]);
|
||||
.button_colors[LAB_NODE_BUTTON_ICONIFY]);
|
||||
}
|
||||
if (match_glob(key, "window.inactive.button.max.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_INACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_MAXIMIZE]);
|
||||
.button_colors[LAB_NODE_BUTTON_MAXIMIZE]);
|
||||
}
|
||||
if (match_glob(key, "window.inactive.button.shade.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_INACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_SHADE]);
|
||||
.button_colors[LAB_NODE_BUTTON_SHADE]);
|
||||
}
|
||||
if (match_glob(key, "window.inactive.button.desk.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_INACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_OMNIPRESENT]);
|
||||
.button_colors[LAB_NODE_BUTTON_OMNIPRESENT]);
|
||||
}
|
||||
if (match_glob(key, "window.inactive.button.close.unpressed.image.color")) {
|
||||
parse_color(value, theme->window[THEME_INACTIVE]
|
||||
.button_colors[LAB_SSD_BUTTON_CLOSE]);
|
||||
.button_colors[LAB_NODE_BUTTON_CLOSE]);
|
||||
}
|
||||
|
||||
/* window drop-shadows */
|
||||
|
|
@ -1811,8 +1811,8 @@ static void destroy_img(struct lab_img **img)
|
|||
void
|
||||
theme_finish(struct theme *theme)
|
||||
{
|
||||
for (enum ssd_part_type type = LAB_SSD_BUTTON_FIRST;
|
||||
type <= LAB_SSD_BUTTON_LAST; type++) {
|
||||
for (enum lab_node_type type = LAB_NODE_BUTTON_FIRST;
|
||||
type <= LAB_NODE_BUTTON_LAST; type++) {
|
||||
for (uint8_t state_set = LAB_BS_DEFAULT;
|
||||
state_set <= LAB_BS_ALL; state_set++) {
|
||||
destroy_img(&theme->window[THEME_INACTIVE]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include "labwc.h"
|
||||
#include "node.h"
|
||||
#include "output.h"
|
||||
#include "ssd.h"
|
||||
#include "view.h"
|
||||
#include "view-impl-common.h"
|
||||
#include "window-rules.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue