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_WINDOW_MENU,
|
||||||
LAB_NODE_BUTTON_SHADE,
|
LAB_NODE_BUTTON_SHADE,
|
||||||
LAB_NODE_BUTTON_OMNIPRESENT,
|
LAB_NODE_BUTTON_OMNIPRESENT,
|
||||||
|
LAB_NODE_BUTTON_ONTOP,
|
||||||
LAB_NODE_BUTTON_FIRST = LAB_NODE_BUTTON_CLOSE,
|
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_BUTTON,
|
||||||
|
|
||||||
LAB_NODE_TITLEBAR,
|
LAB_NODE_TITLEBAR,
|
||||||
|
|
|
||||||
|
|
@ -291,6 +291,11 @@ static struct mouse_combos {
|
||||||
.button = "Left",
|
.button = "Left",
|
||||||
.event = "Click",
|
.event = "Click",
|
||||||
.action = "ToggleOmnipresent",
|
.action = "ToggleOmnipresent",
|
||||||
|
}, {
|
||||||
|
.context = "OnTop",
|
||||||
|
.button = "Left",
|
||||||
|
.event = "Click",
|
||||||
|
.action = "ToggleAlwaysOnTop",
|
||||||
}, {
|
}, {
|
||||||
.context = "Maximize",
|
.context = "Maximize",
|
||||||
.button = "Right",
|
.button = "Right",
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ struct ssd {
|
||||||
* such a small titlebar.
|
* such a small titlebar.
|
||||||
*/
|
*/
|
||||||
bool was_squared;
|
bool was_squared;
|
||||||
|
bool was_ontop;
|
||||||
|
|
||||||
struct wlr_box geometry;
|
struct wlr_box geometry;
|
||||||
struct ssd_state_title {
|
struct ssd_state_title {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ node_type_parse(const char *context)
|
||||||
return LAB_NODE_BUTTON_SHADE;
|
return LAB_NODE_BUTTON_SHADE;
|
||||||
} else if (!strcasecmp(context, "AllDesktops")) {
|
} else if (!strcasecmp(context, "AllDesktops")) {
|
||||||
return LAB_NODE_BUTTON_OMNIPRESENT;
|
return LAB_NODE_BUTTON_OMNIPRESENT;
|
||||||
|
} else if (!strcasecmp(context, "OnTop")) {
|
||||||
|
return LAB_NODE_BUTTON_ONTOP;
|
||||||
} else if (!strcasecmp(context, "Titlebar")) {
|
} else if (!strcasecmp(context, "Titlebar")) {
|
||||||
return LAB_NODE_TITLEBAR;
|
return LAB_NODE_TITLEBAR;
|
||||||
} else if (!strcasecmp(context, "Title")) {
|
} 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;
|
type = LAB_NODE_BUTTON_SHADE;
|
||||||
} else if (!strcmp(identifier, "desk")) {
|
} else if (!strcmp(identifier, "desk")) {
|
||||||
type = LAB_NODE_BUTTON_OMNIPRESENT;
|
type = LAB_NODE_BUTTON_OMNIPRESENT;
|
||||||
|
} else if (!strcmp(identifier, "ontop")) {
|
||||||
|
type = LAB_NODE_BUTTON_ONTOP;
|
||||||
} else {
|
} else {
|
||||||
wlr_log(WLR_ERROR, "invalid titleLayout identifier '%s'",
|
wlr_log(WLR_ERROR, "invalid titleLayout identifier '%s'",
|
||||||
identifier);
|
identifier);
|
||||||
|
|
|
||||||
|
|
@ -299,6 +299,14 @@ ssd_titlebar_update(struct ssd *ssd)
|
||||||
ssd->state.was_omnipresent = view->visible_on_all_workspaces;
|
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) {
|
if (width == ssd->state.geometry.width) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,8 @@ ssd_update_geometry(struct ssd *ssd)
|
||||||
bool state_changed = ssd->state.was_maximized != maximized
|
bool state_changed = ssd->state.was_maximized != maximized
|
||||||
|| ssd->state.was_shaded != view->shaded
|
|| ssd->state.was_shaded != view->shaded
|
||||||
|| ssd->state.was_squared != squared
|
|| 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
|
* (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,
|
.type = LAB_NODE_BUTTON_OMNIPRESENT,
|
||||||
.state_set = LAB_BS_TOGGLED,
|
.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",
|
.name = "close",
|
||||||
.fallback_button = (const char[]){ 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 },
|
.fallback_button = (const char[]){ 0x33, 0x3f, 0x1e, 0x1e, 0x3f, 0x33 },
|
||||||
.type = LAB_NODE_BUTTON_CLOSE,
|
.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