mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
decorations: add keepBorder attribute to actions
This commit is contained in:
parent
06c4e65ac1
commit
78c54ca9ad
4 changed files with 28 additions and 10 deletions
|
|
@ -117,7 +117,7 @@ Actions are used in menus and keyboard/mouse bindings.
|
||||||
upper-left corner of the window associated with the action. Default is
|
upper-left corner of the window associated with the action. Default is
|
||||||
yes.
|
yes.
|
||||||
|
|
||||||
*<action name="ToggleDecorations" />*
|
*<action name="ToggleDecorations" keepBorder="value" />*
|
||||||
Toggle decorations of focused window.
|
Toggle decorations of focused window.
|
||||||
|
|
||||||
This is a 3-state action which can be executed multiple times:
|
This is a 3-state action which can be executed multiple times:
|
||||||
|
|
@ -125,15 +125,19 @@ Actions are used in menus and keyboard/mouse bindings.
|
||||||
- Remaining decorations will be disabled
|
- Remaining decorations will be disabled
|
||||||
- Decorations will be shown normally
|
- Decorations will be shown normally
|
||||||
|
|
||||||
By disabling the theme configuration 'keepBorder' the first step
|
*keepBorder* [yes|no] If set to no, the first step will be removed and
|
||||||
will be removed and the action only toggles between on and off.
|
the action only toggles between on and off. Default is the theme
|
||||||
|
configuration of the same name.
|
||||||
|
|
||||||
*<action name="Decorate" />*
|
*<action name="Decorate" />*
|
||||||
Enable decorations of focused window.
|
Enable decorations of focused window.
|
||||||
|
|
||||||
*<action name="Undecorate" />*
|
*<action name="Undecorate" keepBorder="value" />*
|
||||||
Disable decorations of focused window.
|
Disable decorations of focused window.
|
||||||
|
|
||||||
|
*keepBorder* [yes|no] Keep a small border (and resize area) around the
|
||||||
|
window. Default is the theme configuration of the same name.
|
||||||
|
|
||||||
*<action name="ToggleFullscreen" />*
|
*<action name="ToggleFullscreen" />*
|
||||||
Toggle fullscreen state of focused window.
|
Toggle fullscreen state of focused window.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -446,7 +446,7 @@ void view_maximize(struct view *view, enum view_axis axis,
|
||||||
bool store_natural_geometry);
|
bool store_natural_geometry);
|
||||||
void view_set_fullscreen(struct view *view, bool fullscreen);
|
void view_set_fullscreen(struct view *view, bool fullscreen);
|
||||||
void view_toggle_maximize(struct view *view, enum view_axis axis);
|
void view_toggle_maximize(struct view *view, enum view_axis axis);
|
||||||
void view_toggle_decorations(struct view *view);
|
void view_toggle_decorations(struct view *view, bool keep_border);
|
||||||
|
|
||||||
bool view_is_always_on_top(struct view *view);
|
bool view_is_always_on_top(struct view *view);
|
||||||
bool view_is_always_on_bottom(struct view *view);
|
bool view_is_always_on_bottom(struct view *view);
|
||||||
|
|
|
||||||
19
src/action.c
19
src/action.c
|
|
@ -344,6 +344,13 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ACTION_TYPE_TOGGLE_DECORATIONS:
|
||||||
|
case ACTION_TYPE_UNDECORATE:
|
||||||
|
if (!strcasecmp(argument, "keepBorder")) {
|
||||||
|
action_arg_add_bool(action, argument, parse_bool(content, true));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ACTION_TYPE_RESIZE_RELATIVE:
|
case ACTION_TYPE_RESIZE_RELATIVE:
|
||||||
if (!strcmp(argument, "left") || !strcmp(argument, "right") ||
|
if (!strcmp(argument, "left") || !strcmp(argument, "right") ||
|
||||||
!strcmp(argument, "top") || !strcmp(argument, "bottom")) {
|
!strcmp(argument, "top") || !strcmp(argument, "bottom")) {
|
||||||
|
|
@ -791,7 +798,9 @@ actions_run(struct view *activator, struct server *server,
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_TOGGLE_DECORATIONS:
|
case ACTION_TYPE_TOGGLE_DECORATIONS:
|
||||||
if (view) {
|
if (view) {
|
||||||
view_toggle_decorations(view);
|
bool keep_border = action_get_bool(
|
||||||
|
action, "keepBorder", rc.ssd_keep_border);
|
||||||
|
view_toggle_decorations(view, keep_border);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_DECORATE:
|
case ACTION_TYPE_DECORATE:
|
||||||
|
|
@ -801,7 +810,13 @@ actions_run(struct view *activator, struct server *server,
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_UNDECORATE:
|
case ACTION_TYPE_UNDECORATE:
|
||||||
if (view) {
|
if (view) {
|
||||||
view_set_decorations(view, LAB_SSD_MODE_NONE);
|
bool keep_border = action_get_bool(
|
||||||
|
action, "keepBorder", rc.ssd_keep_border);
|
||||||
|
if (keep_border) {
|
||||||
|
view_set_decorations(view, LAB_SSD_MODE_BORDER);
|
||||||
|
} else {
|
||||||
|
view_set_decorations(view, LAB_SSD_MODE_NONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP:
|
case ACTION_TYPE_TOGGLE_ALWAYS_ON_TOP:
|
||||||
|
|
|
||||||
|
|
@ -1194,12 +1194,11 @@ view_toggle_maximize(struct view *view, enum view_axis axis)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_toggle_decorations(struct view *view)
|
view_toggle_decorations(struct view *view, bool keep_border)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
if (rc.ssd_keep_border && view->ssd_enabled
|
if (keep_border && view->ssd_enabled && !view->ssd_titlebar_hidden) {
|
||||||
&& !view->ssd_titlebar_hidden) {
|
|
||||||
view_set_decorations(view, LAB_SSD_MODE_BORDER);
|
view_set_decorations(view, LAB_SSD_MODE_BORDER);
|
||||||
} else if (view->ssd_enabled) {
|
} else if (view->ssd_enabled) {
|
||||||
view_set_decorations(view, LAB_SSD_MODE_NONE);
|
view_set_decorations(view, LAB_SSD_MODE_NONE);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue