feat: add Shade/Unshade/ToggleShade actions

This builds on the work of @Consolatis in #1018.

Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
This commit is contained in:
Consolatis 2023-08-08 03:39:35 +02:00 committed by Johan Malm
parent 722a802de0
commit e05bedb140
19 changed files with 218 additions and 47 deletions

View file

@ -103,6 +103,9 @@ enum action_type {
ACTION_TYPE_VIRTUAL_OUTPUT_REMOVE,
ACTION_TYPE_AUTO_PLACE,
ACTION_TYPE_TOGGLE_TEARING,
ACTION_TYPE_SHADE,
ACTION_TYPE_UNSHADE,
ACTION_TYPE_TOGGLE_SHADE,
};
const char *action_names[] = {
@ -151,6 +154,9 @@ const char *action_names[] = {
"VirtualOutputRemove",
"AutoPlace",
"ToggleTearing",
"Shade",
"Unshade",
"ToggleShade",
NULL
};
@ -841,6 +847,7 @@ actions_run(struct view *activator, struct server *server,
.width = width ? : view->pending.width,
.height = height ? : view->pending.height,
};
view_set_shade(view, false);
view_move_resize(view, box);
}
break;
@ -960,6 +967,21 @@ actions_run(struct view *activator, struct server *server,
view->tearing_hint ? "en" : "dis");
}
break;
case ACTION_TYPE_TOGGLE_SHADE:
if (view) {
view_set_shade(view, !view->shaded);
}
break;
case ACTION_TYPE_SHADE:
if (view) {
view_set_shade(view, true);
}
break;
case ACTION_TYPE_UNSHADE:
if (view) {
view_set_shade(view, false);
}
break;
case ACTION_TYPE_INVALID:
wlr_log(WLR_ERROR, "Not executing unknown action");
break;