2021-11-13 21:56:53 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2021-03-21 20:54:55 +00:00
|
|
|
#ifndef __LABWC_SSD_H
|
|
|
|
|
#define __LABWC_SSD_H
|
|
|
|
|
|
2021-07-26 20:37:36 +01:00
|
|
|
/*
|
2021-12-01 22:17:04 +00:00
|
|
|
* Sequence these according to the order they should be processed for
|
2021-07-26 20:37:36 +01:00
|
|
|
* press and hover events. Bear in mind that some of their respective
|
|
|
|
|
* interactive areas overlap, so for example buttons need to come before title.
|
|
|
|
|
*/
|
2021-03-21 21:46:16 +00:00
|
|
|
enum ssd_part_type {
|
2021-03-21 20:54:55 +00:00
|
|
|
LAB_SSD_NONE = 0,
|
|
|
|
|
LAB_SSD_BUTTON_CLOSE,
|
|
|
|
|
LAB_SSD_BUTTON_MAXIMIZE,
|
|
|
|
|
LAB_SSD_BUTTON_ICONIFY,
|
2022-01-26 02:54:03 +01:00
|
|
|
LAB_SSD_BUTTON_WINDOW_MENU,
|
2021-08-07 09:35:53 +01:00
|
|
|
LAB_SSD_PART_TITLEBAR,
|
2021-03-21 20:54:55 +00:00
|
|
|
LAB_SSD_PART_TITLE,
|
2021-07-26 20:37:36 +01:00
|
|
|
LAB_SSD_PART_CORNER_TOP_LEFT,
|
|
|
|
|
LAB_SSD_PART_CORNER_TOP_RIGHT,
|
|
|
|
|
LAB_SSD_PART_CORNER_BOTTOM_RIGHT,
|
|
|
|
|
LAB_SSD_PART_CORNER_BOTTOM_LEFT,
|
2021-03-21 20:54:55 +00:00
|
|
|
LAB_SSD_PART_TOP,
|
|
|
|
|
LAB_SSD_PART_RIGHT,
|
|
|
|
|
LAB_SSD_PART_BOTTOM,
|
|
|
|
|
LAB_SSD_PART_LEFT,
|
2021-12-01 22:17:04 +00:00
|
|
|
LAB_SSD_CLIENT,
|
|
|
|
|
LAB_SSD_FRAME,
|
|
|
|
|
LAB_SSD_ROOT,
|
2022-02-18 00:07:37 +01:00
|
|
|
LAB_SSD_MENU,
|
|
|
|
|
LAB_SSD_OSD,
|
|
|
|
|
LAB_SSD_LAYER_SURFACE,
|
2021-03-21 20:54:55 +00:00
|
|
|
LAB_SSD_END_MARKER
|
|
|
|
|
};
|
|
|
|
|
|
2022-01-29 17:52:16 +01:00
|
|
|
/*
|
|
|
|
|
* Defer including labwc.h because it is using enum ssd_part_type.
|
|
|
|
|
* This is an issue for headers like mousebind.h which only includes
|
|
|
|
|
* ssd.h but does not include labwc.h.
|
|
|
|
|
*/
|
|
|
|
|
#include "labwc.h"
|
|
|
|
|
|
2021-03-21 21:46:16 +00:00
|
|
|
struct ssd_part {
|
|
|
|
|
struct wlr_box box;
|
|
|
|
|
enum ssd_part_type type;
|
2021-07-16 17:07:00 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The texture pointers are often held in other places such as the
|
|
|
|
|
* theme struct, so here we use ** in order to keep the code
|
|
|
|
|
* simple and avoid updating pointers as textures change.
|
|
|
|
|
*/
|
2021-03-27 21:04:12 +00:00
|
|
|
struct {
|
2021-07-16 17:07:00 +01:00
|
|
|
struct wlr_texture **active;
|
|
|
|
|
struct wlr_texture **inactive;
|
2021-03-27 21:04:12 +00:00
|
|
|
} texture;
|
2021-07-16 17:07:00 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* If a part does not contain textures, it'll just be rendered as a
|
|
|
|
|
* rectangle with the following colors.
|
|
|
|
|
*/
|
2021-03-27 21:04:12 +00:00
|
|
|
struct {
|
|
|
|
|
float *active;
|
|
|
|
|
float *inactive;
|
|
|
|
|
} color;
|
2021-07-16 17:07:00 +01:00
|
|
|
|
2021-03-21 21:46:16 +00:00
|
|
|
struct wl_list link;
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-21 20:54:55 +00:00
|
|
|
struct view;
|
|
|
|
|
|
|
|
|
|
struct border ssd_thickness(struct view *view);
|
|
|
|
|
struct wlr_box ssd_max_extents(struct view *view);
|
2021-08-22 14:06:11 +01:00
|
|
|
struct wlr_box ssd_visible_box(struct view *view, enum ssd_part_type type);
|
2021-03-21 21:46:16 +00:00
|
|
|
enum ssd_part_type ssd_at(struct view *view, double lx, double ly);
|
2021-07-26 20:06:52 +01:00
|
|
|
uint32_t ssd_resize_edges(enum ssd_part_type type);
|
2021-08-07 09:35:53 +01:00
|
|
|
void ssd_update_title(struct view *view);
|
2021-03-21 21:46:16 +00:00
|
|
|
void ssd_create(struct view *view);
|
|
|
|
|
void ssd_destroy(struct view *view);
|
2021-08-22 14:12:05 +01:00
|
|
|
void ssd_update_geometry(struct view *view, bool force);
|
2021-12-01 22:10:33 +00:00
|
|
|
bool ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate);
|
2022-01-29 17:46:17 +01:00
|
|
|
bool ssd_is_button(enum ssd_part_type type);
|
2021-03-21 20:54:55 +00:00
|
|
|
|
|
|
|
|
#endif /* __LABWC_SSD_H */
|