2021-11-13 21:56:53 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2023-05-13 16:10:33 +03:00
|
|
|
#ifndef LABWC_SSD_H
|
|
|
|
|
#define LABWC_SSD_H
|
2021-03-21 20:54:55 +00:00
|
|
|
|
2025-09-03 05:08:52 -04:00
|
|
|
#include "common/node-type.h"
|
2025-08-26 20:27:34 -04:00
|
|
|
#include "config/types.h"
|
2022-02-21 03:18:38 +01:00
|
|
|
|
2025-08-13 21:00:11 +09:00
|
|
|
enum ssd_active_state {
|
|
|
|
|
SSD_INACTIVE = 0,
|
|
|
|
|
SSD_ACTIVE = 1,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define FOR_EACH_ACTIVE_STATE(active) for (active = SSD_INACTIVE; active <= SSD_ACTIVE; active++)
|
|
|
|
|
|
2025-02-01 14:51:47 +09:00
|
|
|
struct wlr_cursor;
|
|
|
|
|
|
2024-04-22 19:27:53 +01:00
|
|
|
/*
|
|
|
|
|
* Shadows should start at a point inset from the actual window border, see
|
|
|
|
|
* discussion on https://github.com/labwc/labwc/pull/1648. This constant
|
|
|
|
|
* specifies inset as a multiple of visible shadow size.
|
|
|
|
|
*/
|
|
|
|
|
#define SSD_SHADOW_INSET 0.3
|
|
|
|
|
|
2022-02-21 03:18:38 +01:00
|
|
|
/* Forward declare arguments */
|
2025-09-03 01:20:53 -04:00
|
|
|
struct server;
|
2022-11-26 16:53:35 -05:00
|
|
|
struct ssd;
|
2025-09-03 05:32:44 -04:00
|
|
|
struct ssd_button;
|
2022-02-21 03:18:38 +01:00
|
|
|
struct view;
|
2022-11-26 16:06:22 -05:00
|
|
|
struct wlr_scene;
|
|
|
|
|
struct wlr_scene_node;
|
2022-01-29 17:52:16 +01:00
|
|
|
|
2022-11-26 16:46:28 -05:00
|
|
|
/*
|
|
|
|
|
* Public SSD API
|
|
|
|
|
*
|
|
|
|
|
* For convenience in dealing with non-SSD views, this API allows NULL
|
|
|
|
|
* ssd/button/node arguments and attempts to do something sensible in
|
|
|
|
|
* that case (e.g. no-op/return default values).
|
|
|
|
|
*
|
|
|
|
|
* NULL scene/view arguments are not allowed.
|
|
|
|
|
*/
|
|
|
|
|
struct ssd *ssd_create(struct view *view, bool active);
|
|
|
|
|
struct border ssd_get_margin(const struct ssd *ssd);
|
2024-09-09 17:43:38 +02:00
|
|
|
int ssd_get_corner_width(void);
|
2023-08-25 13:22:23 +02:00
|
|
|
void ssd_update_margin(struct ssd *ssd);
|
2022-11-26 16:46:28 -05:00
|
|
|
void ssd_set_active(struct ssd *ssd, bool active);
|
|
|
|
|
void ssd_update_title(struct ssd *ssd);
|
|
|
|
|
void ssd_update_geometry(struct ssd *ssd);
|
|
|
|
|
void ssd_destroy(struct ssd *ssd);
|
2024-04-18 09:46:36 +02:00
|
|
|
void ssd_set_titlebar(struct ssd *ssd, bool enabled);
|
2022-11-26 16:46:28 -05:00
|
|
|
|
2023-03-05 10:35:56 +01:00
|
|
|
void ssd_enable_keybind_inhibit_indicator(struct ssd *ssd, bool enable);
|
2023-08-08 03:39:35 +02:00
|
|
|
void ssd_enable_shade(struct ssd *ssd, bool enable);
|
2023-03-05 10:35:56 +01:00
|
|
|
|
tree-wide: auto-replace of (struct server *)
#!/bin/bash
read -r -d '' EXPRS << EOF
s/xwayland->server/xwayland->svr/g;
s/\t*struct server \*server;\n//g;
s/\t*struct server \*server =.*?;\n//gs;
s/\t*.* = ([a-z_]*->)*server[;,]\n//g;
s/\{\n\n/\{\n/g;
s/\n\n+/\n\n/g;
s/\(\s*struct server \*server\)/(void)/g;
s/\(\s*struct server \*server,\s*/(/g;
s/,\s*struct server \*server\)/)/g;
s/,\s*struct server \*server,\s*/, /g;
s/\(\s*([a-z_]*->)*server\)/()/g;
s/\(\s*([a-z_]*->)*server,\s*/(/g;
s/,\s*([a-z_]*->)*server\)/)/g;
s/,\s*([a-z_]*->)*server,\s*/, /g;
s/([a-z_]*->)*server->/g_server./g;
s/xwayland->svr/xwayland->server/g;
EOF
find src include \( -name \*.c -o -name \*.h \) -exec \
perl -0777 -i -pe "$EXPRS" \{\} \;
2026-02-23 11:56:39 -05:00
|
|
|
void ssd_update_hovered_button(struct wlr_scene_node *node);
|
2022-02-21 03:18:38 +01:00
|
|
|
|
2025-09-03 05:32:44 -04:00
|
|
|
void ssd_button_free(struct ssd_button *button);
|
2022-11-26 16:53:35 -05:00
|
|
|
|
2022-02-21 03:18:38 +01:00
|
|
|
/* Public SSD helpers */
|
2025-08-13 21:00:11 +09:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2025-09-03 05:08:52 -04:00
|
|
|
enum lab_node_type ssd_get_resizing_type(const struct ssd *ssd,
|
2025-08-13 21:00:11 +09:00
|
|
|
struct wlr_cursor *cursor);
|
2025-08-17 16:01:50 -04:00
|
|
|
enum lab_ssd_mode ssd_mode_parse(const char *mode);
|
2022-02-21 03:18:38 +01:00
|
|
|
|
|
|
|
|
/* TODO: clean up / update */
|
|
|
|
|
struct border ssd_thickness(struct view *view);
|
|
|
|
|
struct wlr_box ssd_max_extents(struct view *view);
|
2021-03-21 20:54:55 +00:00
|
|
|
|
2022-11-26 16:13:09 -05:00
|
|
|
/* SSD debug helpers */
|
|
|
|
|
bool ssd_debug_is_root_node(const struct ssd *ssd, struct wlr_scene_node *node);
|
|
|
|
|
const char *ssd_debug_get_node_name(const struct ssd *ssd,
|
|
|
|
|
struct wlr_scene_node *node);
|
|
|
|
|
|
2023-05-13 16:10:33 +03:00
|
|
|
#endif /* LABWC_SSD_H */
|