mirror of
https://github.com/labwc/labwc.git
synced 2026-06-13 14:33:18 -04:00
ssd: add basic always-on-top button
This commit is contained in:
parent
5f668a82ee
commit
838113cc44
9 changed files with 36 additions and 2 deletions
|
|
@ -26,8 +26,9 @@ enum lab_node_type {
|
|||
LAB_NODE_BUTTON_WINDOW_MENU,
|
||||
LAB_NODE_BUTTON_SHADE,
|
||||
LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
LAB_NODE_BUTTON_ONTOP,
|
||||
LAB_NODE_BUTTON_FIRST = LAB_NODE_BUTTON_CLOSE,
|
||||
LAB_NODE_BUTTON_LAST = LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
LAB_NODE_BUTTON_LAST = LAB_NODE_BUTTON_ONTOP,
|
||||
LAB_NODE_BUTTON,
|
||||
|
||||
LAB_NODE_TITLEBAR,
|
||||
|
|
|
|||
|
|
@ -291,6 +291,11 @@ static struct mouse_combos {
|
|||
.button = "Left",
|
||||
.event = "Click",
|
||||
.action = "ToggleOmnipresent",
|
||||
}, {
|
||||
.context = "OnTop",
|
||||
.button = "Left",
|
||||
.event = "Click",
|
||||
.action = "ToggleAlwaysOnTop",
|
||||
}, {
|
||||
.context = "Maximize",
|
||||
.button = "Right",
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ struct ssd {
|
|||
* such a small titlebar.
|
||||
*/
|
||||
bool was_squared;
|
||||
bool was_ontop;
|
||||
|
||||
struct wlr_box geometry;
|
||||
struct ssd_state_title {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ node_type_parse(const char *context)
|
|||
return LAB_NODE_BUTTON_SHADE;
|
||||
} else if (!strcasecmp(context, "AllDesktops")) {
|
||||
return LAB_NODE_BUTTON_OMNIPRESENT;
|
||||
} else if (!strcasecmp(context, "OnTop")) {
|
||||
return LAB_NODE_BUTTON_ONTOP;
|
||||
} else if (!strcasecmp(context, "Titlebar")) {
|
||||
return LAB_NODE_TITLEBAR;
|
||||
} else if (!strcasecmp(context, "Title")) {
|
||||
|
|
|
|||
|
|
@ -184,6 +184,8 @@ fill_section(const char *content, enum lab_node_type *buttons, int *count,
|
|||
type = LAB_NODE_BUTTON_SHADE;
|
||||
} else if (!strcmp(identifier, "desk")) {
|
||||
type = LAB_NODE_BUTTON_OMNIPRESENT;
|
||||
} else if (!strcmp(identifier, "ontop")) {
|
||||
type = LAB_NODE_BUTTON_ONTOP;
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "invalid titleLayout identifier '%s'",
|
||||
identifier);
|
||||
|
|
|
|||
|
|
@ -299,6 +299,14 @@ ssd_titlebar_update(struct ssd *ssd)
|
|||
ssd->state.was_omnipresent = view->visible_on_all_workspaces;
|
||||
}
|
||||
|
||||
printf("%d\n\n",ssd->state.was_ontop);
|
||||
|
||||
if (ssd->state.was_ontop != (view->layer == VIEW_LAYER_ALWAYS_ON_TOP)) {
|
||||
set_alt_button_icon(ssd, LAB_NODE_BUTTON_ONTOP,
|
||||
view->layer);
|
||||
ssd->state.was_ontop = view->layer;
|
||||
}
|
||||
|
||||
if (width == ssd->state.geometry.width) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,7 +227,8 @@ ssd_update_geometry(struct ssd *ssd)
|
|||
bool state_changed = ssd->state.was_maximized != maximized
|
||||
|| ssd->state.was_shaded != view->shaded
|
||||
|| ssd->state.was_squared != squared
|
||||
|| ssd->state.was_omnipresent != view->visible_on_all_workspaces;
|
||||
|| ssd->state.was_omnipresent != view->visible_on_all_workspaces
|
||||
|| ssd->state.was_ontop != (view->layer == VIEW_LAYER_ALWAYS_ON_TOP);
|
||||
|
||||
/*
|
||||
* (Un)maximization updates titlebar visibility with
|
||||
|
|
|
|||
12
src/theme.c
12
src/theme.c
|
|
@ -316,6 +316,18 @@ load_buttons(struct theme *theme)
|
|||
.type = LAB_NODE_BUTTON_OMNIPRESENT,
|
||||
.state_set = LAB_BS_TOGGLED,
|
||||
}, {
|
||||
|
||||
// TODO Add proper bitmaps
|
||||
.name = "ontop",
|
||||
.fallback_button = (const char[]){ 0x33, 0x33, 0x00, 0x00, 0x33, 0x33 },
|
||||
.type = LAB_NODE_BUTTON_ONTOP,
|
||||
.state_set = 0,
|
||||
}, {
|
||||
.name = "ontop_toggled",
|
||||
.fallback_button = (const char[]){ 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 },
|
||||
.type = LAB_NODE_BUTTON_ONTOP,
|
||||
.state_set = LAB_BS_TOGGLED,
|
||||
}, {
|
||||
.name = "close",
|
||||
.fallback_button = (const char[]){ 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 },
|
||||
.type = LAB_NODE_BUTTON_CLOSE,
|
||||
|
|
|
|||
2
subprojects/wayland-protocols.wrap
Normal file
2
subprojects/wayland-protocols.wrap
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[wrap-redirect]
|
||||
filename = wlroots/subprojects/wayland-protocols.wrap
|
||||
Loading…
Add table
Add a link
Reference in a new issue