mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
[wip] Add ToggleShade
Just an initial implementation, I am not sure when I'll work on this again.
The alternative would have been to have it bitrot in a local dev branch so
I thought I may just as well post it as [wip] PR on here.
For anybody interested, feel free to use
this as a base or post an alternative PR.
Multiple issues that have to be fixed or verified:
- [ ] Interaction with various actions that resize the window or return
it into its natural geometry (e.g. unmaximize / untile)
- [ ] Maximize
- [ ] SnapToEdge
- [ ] SnapToRegion
- [ ] ResizeRelative
- [ ] GrowToEdge (once merged)
- [ ] Interaction with ToggleDecorations (and Reconfigure) is missing,
we should check `view->shaded` on ssd creation
- [ ] Not verified with xwayland windows at all
- [ ] The titlebar misses its top border as we disable the whole border tree
And the usual stuff missing:
- [ ] docs
- [ ] default mouse bindings?
Interactive resizing is completely disabled while in the shaded state.
Reason being that the actual client doesn't commit anything if it's
scene node is disabled. Moving the title bar around is fine though as
we don't need any confirmation from the client for that.
This commit is contained in:
parent
9d63c803d3
commit
84e8947900
8 changed files with 44 additions and 4 deletions
|
|
@ -68,6 +68,7 @@ void ssd_destroy(struct ssd *ssd);
|
|||
void ssd_titlebar_hide(struct ssd *ssd);
|
||||
|
||||
void ssd_enable_keybind_inhibit_indicator(struct ssd *ssd, bool enable);
|
||||
void ssd_enable_shade(struct ssd *ssd, bool enable);
|
||||
|
||||
struct ssd_hover_state *ssd_hover_state_new(void);
|
||||
void ssd_update_button_hover(struct wlr_scene_node *node,
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ struct view {
|
|||
bool ssd_enabled;
|
||||
bool ssd_titlebar_hidden;
|
||||
enum ssd_preference ssd_preference;
|
||||
bool shaded;
|
||||
bool minimized;
|
||||
enum view_axis maximized;
|
||||
bool fullscreen;
|
||||
|
|
@ -462,6 +463,7 @@ const char *view_get_string_prop(struct view *view, const char *prop);
|
|||
void view_update_title(struct view *view);
|
||||
void view_update_app_id(struct view *view);
|
||||
void view_reload_ssd(struct view *view);
|
||||
void view_toggle_shade(struct view *view);
|
||||
|
||||
struct view_size_hints view_get_size_hints(struct view *view);
|
||||
void view_adjust_size(struct view *view, int *w, int *h);
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ enum action_type {
|
|||
ACTION_TYPE_VIRTUAL_OUTPUT_REMOVE,
|
||||
ACTION_TYPE_AUTO_PLACE,
|
||||
ACTION_TYPE_TOGGLE_TEARING,
|
||||
ACTION_TYPE_TOGGLE_SHADE,
|
||||
};
|
||||
|
||||
const char *action_names[] = {
|
||||
|
|
@ -151,6 +152,7 @@ const char *action_names[] = {
|
|||
"VirtualOutputRemove",
|
||||
"AutoPlace",
|
||||
"ToggleTearing",
|
||||
"ToggleShade",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -960,6 +962,11 @@ actions_run(struct view *activator, struct server *server,
|
|||
view->tearing_hint ? "en" : "dis");
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_TOGGLE_SHADE:
|
||||
if (view) {
|
||||
view_toggle_shade(view);
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_INVALID:
|
||||
wlr_log(WLR_ERROR, "Not executing unknown action");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -471,7 +471,12 @@ cursor_update_common(struct server *server, struct cursor_context *ctx,
|
|||
*/
|
||||
wlr_seat_pointer_notify_clear_focus(wlr_seat);
|
||||
if (!seat->drag.active) {
|
||||
cursor_set(seat, cursor_get_from_ssd(ctx->type));
|
||||
enum lab_cursors cursor = cursor_get_from_ssd(ctx->type);
|
||||
if (ctx->view && ctx->view->shaded && cursor > LAB_CURSOR_GRAB) {
|
||||
/* Prevent resize cursor on borders for shaded SSD */
|
||||
cursor = LAB_CURSOR_DEFAULT;
|
||||
}
|
||||
cursor_set(seat, cursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,11 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges)
|
|||
cursor_set(seat, LAB_CURSOR_GRAB);
|
||||
break;
|
||||
case LAB_INPUT_STATE_RESIZE:
|
||||
if (view->fullscreen || view->maximized == VIEW_AXIS_BOTH) {
|
||||
if (view->shaded || view->fullscreen ||
|
||||
view->maximized == VIEW_AXIS_BOTH) {
|
||||
/*
|
||||
* We don't allow resizing while fullscreen or
|
||||
* maximized in both directions.
|
||||
* We don't allow resizing while shaded,
|
||||
* fullscreen or maximized in both directions.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -718,6 +718,8 @@ init_windowmenu(struct server *server)
|
|||
fill_item("name.action", "ToggleMaximize");
|
||||
current_item = item_create(menu, _("Fullscreen"), false);
|
||||
fill_item("name.action", "ToggleFullscreen");
|
||||
current_item = item_create(menu, _("Shade"), false);
|
||||
fill_item("name.action", "ToggleShade");
|
||||
current_item = item_create(menu, _("Decorations"), false);
|
||||
fill_item("name.action", "ToggleDecorations");
|
||||
current_item = item_create(menu, _("Always on Top"), false);
|
||||
|
|
|
|||
|
|
@ -333,6 +333,16 @@ ssd_set_active(struct ssd *ssd, bool active)
|
|||
wlr_scene_node_set_enabled(&ssd->titlebar.inactive.tree->node, !active);
|
||||
}
|
||||
|
||||
void
|
||||
ssd_enable_shade(struct ssd *ssd, bool enable)
|
||||
{
|
||||
if (!ssd) {
|
||||
return;
|
||||
}
|
||||
wlr_scene_node_set_enabled(&ssd->border.tree->node, !enable);
|
||||
wlr_scene_node_set_enabled(&ssd->extents.tree->node, !enable);
|
||||
}
|
||||
|
||||
void
|
||||
ssd_enable_keybind_inhibit_indicator(struct ssd *ssd, bool enable)
|
||||
{
|
||||
|
|
|
|||
12
src/view.c
12
src/view.c
|
|
@ -1974,6 +1974,18 @@ view_connect_map(struct view *view, struct wlr_surface *surface)
|
|||
mappable_connect(&view->mappable, surface, handle_map, handle_unmap);
|
||||
}
|
||||
|
||||
void
|
||||
view_toggle_shade(struct view *view)
|
||||
{
|
||||
assert(view);
|
||||
if (!view->ssd) {
|
||||
return;
|
||||
}
|
||||
view->shaded = !view->shaded;
|
||||
ssd_enable_shade(view->ssd, view->shaded);
|
||||
wlr_scene_node_set_enabled(view->scene_node, !view->shaded);
|
||||
}
|
||||
|
||||
void
|
||||
view_destroy(struct view *view)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue