add `public` flag
Public views are used to populate the lock screen to display additional information, they should never display sensitive information. Even hidden are displayed. This uses a `force` flag that overrides visibility that is set in mode enter and reset on mode exit.
This commit is contained in:
parent
515499e8da
commit
847640dc31
|
@ -151,6 +151,7 @@ bindings {
|
||||||
"L+f" = view-toggle-maximize-full
|
"L+f" = view-toggle-maximize-full
|
||||||
"L5+plus" = view-toggle-floating
|
"L5+plus" = view-toggle-floating
|
||||||
"L+i" = view-toggle-invisible
|
"L+i" = view-toggle-invisible
|
||||||
|
"L5+p" = view-toggle-public
|
||||||
|
|
||||||
"LS+o" = group-only
|
"LS+o" = group-only
|
||||||
"LS+h" = group-hide
|
"LS+h" = group-hide
|
||||||
|
|
|
@ -78,7 +78,7 @@ hikari_output_render_background(struct hikari_output *output,
|
||||||
float alpha);
|
float alpha);
|
||||||
|
|
||||||
void
|
void
|
||||||
hikari_output_render_sticky(
|
hikari_output_render_visible_views(
|
||||||
struct hikari_output *output, struct hikari_render_data *render_data);
|
struct hikari_output *output, struct hikari_render_data *render_data);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -310,6 +310,7 @@ WORKSPACE_ACTION(toggle_view_horizontal_maximize)
|
||||||
WORKSPACE_ACTION(toggle_view_full_maximize)
|
WORKSPACE_ACTION(toggle_view_full_maximize)
|
||||||
WORKSPACE_ACTION(toggle_view_floating)
|
WORKSPACE_ACTION(toggle_view_floating)
|
||||||
WORKSPACE_ACTION(toggle_view_invisible)
|
WORKSPACE_ACTION(toggle_view_invisible)
|
||||||
|
WORKSPACE_ACTION(toggle_view_public)
|
||||||
WORKSPACE_ACTION(only_view)
|
WORKSPACE_ACTION(only_view)
|
||||||
WORKSPACE_ACTION(only_group)
|
WORKSPACE_ACTION(only_group)
|
||||||
WORKSPACE_ACTION(hide_view)
|
WORKSPACE_ACTION(hide_view)
|
||||||
|
|
|
@ -132,6 +132,8 @@ hikari_view_subsurface_fini(struct hikari_view_subsurface *view_subsurface);
|
||||||
FLAG(hidden, 0UL)
|
FLAG(hidden, 0UL)
|
||||||
FLAG(invisible, 1UL)
|
FLAG(invisible, 1UL)
|
||||||
FLAG(floating, 2UL)
|
FLAG(floating, 2UL)
|
||||||
|
FLAG(public, 3UL)
|
||||||
|
FLAG(forced, 4UL)
|
||||||
#undef FLAG
|
#undef FLAG
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -160,6 +162,7 @@ VIEW_ACTION(top_left_cursor)
|
||||||
VIEW_ACTION(bottom_right_cursor)
|
VIEW_ACTION(bottom_right_cursor)
|
||||||
VIEW_ACTION(center_cursor)
|
VIEW_ACTION(center_cursor)
|
||||||
VIEW_ACTION(toggle_invisible)
|
VIEW_ACTION(toggle_invisible)
|
||||||
|
VIEW_ACTION(toggle_public)
|
||||||
VIEW_ACTION(reset_geometry)
|
VIEW_ACTION(reset_geometry)
|
||||||
#undef VIEW_ACTION
|
#undef VIEW_ACTION
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct hikari_view_autoconf {
|
||||||
bool focus;
|
bool focus;
|
||||||
bool invisible;
|
bool invisible;
|
||||||
bool floating;
|
bool floating;
|
||||||
|
bool publicview;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -70,6 +71,13 @@ hikari_view_autoconf_resolve_floating(
|
||||||
return view_autoconf->floating;
|
return view_autoconf->floating;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
hikari_view_autoconf_resolve_public(struct hikari_view_autoconf *view_autoconf)
|
||||||
|
{
|
||||||
|
assert(view_autoconf != NULL);
|
||||||
|
return view_autoconf->publicview;
|
||||||
|
}
|
||||||
|
|
||||||
static inline struct hikari_mark *
|
static inline struct hikari_mark *
|
||||||
hikari_view_autoconf_resolve_mark(struct hikari_view_autoconf *view_autoconf)
|
hikari_view_autoconf_resolve_mark(struct hikari_view_autoconf *view_autoconf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -139,6 +139,7 @@ WORKSPACE_ACTION(pin_view_to_sheet_next)
|
||||||
WORKSPACE_ACTION(pin_view_to_sheet_prev)
|
WORKSPACE_ACTION(pin_view_to_sheet_prev)
|
||||||
WORKSPACE_ACTION(toggle_view_invisible)
|
WORKSPACE_ACTION(toggle_view_invisible)
|
||||||
WORKSPACE_ACTION(toggle_view_floating)
|
WORKSPACE_ACTION(toggle_view_floating)
|
||||||
|
WORKSPACE_ACTION(toggle_view_public)
|
||||||
WORKSPACE_ACTION(toggle_view_full_maximize)
|
WORKSPACE_ACTION(toggle_view_full_maximize)
|
||||||
WORKSPACE_ACTION(toggle_view_vertical_maximize)
|
WORKSPACE_ACTION(toggle_view_vertical_maximize)
|
||||||
WORKSPACE_ACTION(toggle_view_horizontal_maximize)
|
WORKSPACE_ACTION(toggle_view_horizontal_maximize)
|
||||||
|
|
|
@ -66,6 +66,12 @@ several states.
|
||||||
**x** is the sheet the _view_ is a member of and **y** is the sheet that is
|
**x** is the sheet the _view_ is a member of and **y** is the sheet that is
|
||||||
currently borrowing the _view_.
|
currently borrowing the _view_.
|
||||||
|
|
||||||
|
* **public**
|
||||||
|
|
||||||
|
*Public* views are also displayed on the lock screen, in this case they will
|
||||||
|
never accept input. Views that display sensible information should never be
|
||||||
|
marked as *public*.
|
||||||
|
|
||||||
Workspace
|
Workspace
|
||||||
---------
|
---------
|
||||||
A _workspace_ is the set of views that are currently visible. Unlike in most
|
A _workspace_ is the set of views that are currently visible. Unlike in most
|
||||||
|
@ -164,7 +170,9 @@ General actions
|
||||||
needs pam.conf(5) to be aware of its existence, therefore there must be a
|
needs pam.conf(5) to be aware of its existence, therefore there must be a
|
||||||
_hikari-unlocker_ service file in _pam.d_.
|
_hikari-unlocker_ service file in _pam.d_.
|
||||||
|
|
||||||
The lock screen displays all visible sheets that are a member of sheet 0.
|
The lock screen displays all views that are marked as **public** which allows
|
||||||
|
applications to provide information to the user when the computer is locked
|
||||||
|
(e.g. a clock).
|
||||||
|
|
||||||
* **quit**
|
* **quit**
|
||||||
|
|
||||||
|
|
|
@ -867,6 +867,17 @@ parse_autoconf(struct hikari_configuration *configuration,
|
||||||
}
|
}
|
||||||
|
|
||||||
(*autoconf)->floating = floating;
|
(*autoconf)->floating = floating;
|
||||||
|
} else if (!strcmp(key, "public")) {
|
||||||
|
bool publicview;
|
||||||
|
|
||||||
|
if (!ucl_object_toboolean_safe(cur, &publicview)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"configuration error: expected boolean for \"views\" "
|
||||||
|
"\"public\"\n");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*autoconf)->publicview = publicview;
|
||||||
} else {
|
} else {
|
||||||
fprintf(
|
fprintf(
|
||||||
stderr, "configuration error: unkown \"views\" key \"%s\"\n", key);
|
stderr, "configuration error: unkown \"views\" key \"%s\"\n", key);
|
||||||
|
@ -1240,6 +1251,9 @@ parse_binding(struct hikari_configuration *configuration,
|
||||||
} else if (!strcmp(str, "view-toggle-invisible")) {
|
} else if (!strcmp(str, "view-toggle-invisible")) {
|
||||||
*action = hikari_server_toggle_view_invisible;
|
*action = hikari_server_toggle_view_invisible;
|
||||||
*arg = NULL;
|
*arg = NULL;
|
||||||
|
} else if (!strcmp(str, "view-toggle-public")) {
|
||||||
|
*action = hikari_server_toggle_view_public;
|
||||||
|
*arg = NULL;
|
||||||
|
|
||||||
} else if (!strcmp(str, "view-raise")) {
|
} else if (!strcmp(str, "view-raise")) {
|
||||||
*action = hikari_server_raise_view;
|
*action = hikari_server_raise_view;
|
||||||
|
|
|
@ -105,10 +105,15 @@ hikari_indicator_update_sheet(struct hikari_indicator *indicator,
|
||||||
{
|
{
|
||||||
bool invisible = flags & hikari_view_invisible_flag;
|
bool invisible = flags & hikari_view_invisible_flag;
|
||||||
bool floating = flags & hikari_view_floating_flag;
|
bool floating = flags & hikari_view_floating_flag;
|
||||||
|
bool publicview = flags & hikari_view_public_flag;
|
||||||
char *output_name = sheet->workspace->output->wlr_output->name;
|
char *output_name = sheet->workspace->output->wlr_output->name;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
char *text = hikari_malloc(strlen(output_name) + 12);
|
char *text = hikari_malloc(strlen(output_name) + 13);
|
||||||
|
|
||||||
|
if (publicview) {
|
||||||
|
text[i++] = '!';
|
||||||
|
}
|
||||||
|
|
||||||
if (floating) {
|
if (floating) {
|
||||||
text[i++] = '~';
|
text[i++] = '~';
|
||||||
|
|
|
@ -256,10 +256,30 @@ render(struct hikari_output *output, struct hikari_render_data *render_data)
|
||||||
struct hikari_lock_mode *mode = get_mode();
|
struct hikari_lock_mode *mode = get_mode();
|
||||||
|
|
||||||
hikari_output_render_background(output, render_data, 0.1);
|
hikari_output_render_background(output, render_data, 0.1);
|
||||||
hikari_output_render_sticky(output, render_data);
|
hikari_output_render_visible_views(output, render_data);
|
||||||
hikari_lock_indicator_render(mode->lock_indicator, render_data);
|
hikari_lock_indicator_render(mode->lock_indicator, render_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
reset_visibility(void)
|
||||||
|
{
|
||||||
|
struct hikari_output *output;
|
||||||
|
wl_list_for_each (output, &hikari_server.outputs, server_outputs) {
|
||||||
|
struct hikari_view *view;
|
||||||
|
wl_list_for_each (view, &output->views, output_views) {
|
||||||
|
if (hikari_view_is_forced(view)) {
|
||||||
|
hikari_view_unset_forced(view);
|
||||||
|
|
||||||
|
if (hikari_view_is_hidden(view)) {
|
||||||
|
hikari_view_unset_hidden(view);
|
||||||
|
} else {
|
||||||
|
hikari_view_set_hidden(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cancel(void)
|
cancel(void)
|
||||||
{
|
{
|
||||||
|
@ -280,6 +300,8 @@ cancel(void)
|
||||||
hikari_free(mode->lock_indicator);
|
hikari_free(mode->lock_indicator);
|
||||||
mode->lock_indicator = NULL;
|
mode->lock_indicator = NULL;
|
||||||
|
|
||||||
|
reset_visibility();
|
||||||
|
|
||||||
hikari_cursor_activate(&hikari_server.cursor);
|
hikari_cursor_activate(&hikari_server.cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,6 +341,28 @@ hikari_lock_mode_fini(struct hikari_lock_mode *lock_mode)
|
||||||
munlock(input_buffer, BUFFER_SIZE);
|
munlock(input_buffer, BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
override_visibility(void)
|
||||||
|
{
|
||||||
|
struct hikari_output *output;
|
||||||
|
wl_list_for_each (output, &hikari_server.outputs, server_outputs) {
|
||||||
|
struct hikari_view *view;
|
||||||
|
wl_list_for_each (view, &output->views, output_views) {
|
||||||
|
if (hikari_view_is_public(view)) {
|
||||||
|
if (hikari_view_is_hidden(view)) {
|
||||||
|
hikari_view_set_forced(view);
|
||||||
|
hikari_view_unset_hidden(view);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!hikari_view_is_hidden(view)) {
|
||||||
|
hikari_view_set_forced(view);
|
||||||
|
hikari_view_set_hidden(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hikari_lock_mode_enter(void)
|
hikari_lock_mode_enter(void)
|
||||||
{
|
{
|
||||||
|
@ -361,6 +405,7 @@ hikari_lock_mode_enter(void)
|
||||||
|
|
||||||
clear_buffer();
|
clear_buffer();
|
||||||
start_unlocker();
|
start_unlocker();
|
||||||
|
override_visibility();
|
||||||
|
|
||||||
mode->disable_outputs = wl_event_loop_add_timer(
|
mode->disable_outputs = wl_event_loop_add_timer(
|
||||||
hikari_server.event_loop, disable_outputs_handler, NULL);
|
hikari_server.event_loop, disable_outputs_handler, NULL);
|
||||||
|
|
|
@ -246,12 +246,11 @@ render_layer(struct wl_list *layers, struct hikari_render_data *render_data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
hikari_output_render_sticky(
|
hikari_output_render_visible_views(
|
||||||
struct hikari_output *output, struct hikari_render_data *render_data)
|
struct hikari_output *output, struct hikari_render_data *render_data)
|
||||||
{
|
{
|
||||||
struct hikari_view *view;
|
struct hikari_view *view;
|
||||||
wl_list_for_each_reverse (
|
wl_list_for_each_reverse (view, &output->views, output_views) {
|
||||||
view, &output->workspace->sheets[0].views, sheet_views) {
|
|
||||||
if (!hikari_view_is_hidden(view)) {
|
if (!hikari_view_is_hidden(view)) {
|
||||||
render_data->geometry = hikari_view_border_geometry(view);
|
render_data->geometry = hikari_view_border_geometry(view);
|
||||||
|
|
||||||
|
|
18
src/view.c
18
src/view.c
|
@ -886,6 +886,16 @@ hikari_view_toggle_full_maximize(struct hikari_view *view)
|
||||||
hikari_view_set_dirty(view);
|
hikari_view_set_dirty(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hikari_view_toggle_public(struct hikari_view *view)
|
||||||
|
{
|
||||||
|
if (hikari_view_is_public(view)) {
|
||||||
|
hikari_view_unset_public(view);
|
||||||
|
} else {
|
||||||
|
hikari_view_set_public(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
queue_horizontal_maximize(struct hikari_view *view)
|
queue_horizontal_maximize(struct hikari_view *view)
|
||||||
{
|
{
|
||||||
|
@ -1666,7 +1676,7 @@ hikari_view_configure(struct hikari_view *view,
|
||||||
struct hikari_output *output;
|
struct hikari_output *output;
|
||||||
struct wlr_box *geometry = &view->geometry;
|
struct wlr_box *geometry = &view->geometry;
|
||||||
int x, y;
|
int x, y;
|
||||||
bool invisible, floating;
|
bool invisible, floating, publicview;
|
||||||
|
|
||||||
set_app_id(view, app_id);
|
set_app_id(view, app_id);
|
||||||
|
|
||||||
|
@ -1676,6 +1686,7 @@ hikari_view_configure(struct hikari_view *view,
|
||||||
|
|
||||||
invisible = hikari_view_autoconf_resolve_invisible(view_autoconf);
|
invisible = hikari_view_autoconf_resolve_invisible(view_autoconf);
|
||||||
floating = hikari_view_autoconf_resolve_floating(view_autoconf);
|
floating = hikari_view_autoconf_resolve_floating(view_autoconf);
|
||||||
|
publicview = hikari_view_autoconf_resolve_public(view_autoconf);
|
||||||
|
|
||||||
hikari_view_autoconf_resolve_position(view_autoconf, view, &x, &y);
|
hikari_view_autoconf_resolve_position(view_autoconf, view, &x, &y);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1684,6 +1695,7 @@ hikari_view_configure(struct hikari_view *view,
|
||||||
|
|
||||||
invisible = false;
|
invisible = false;
|
||||||
floating = false;
|
floating = false;
|
||||||
|
publicview = false;
|
||||||
|
|
||||||
x = hikari_server.cursor.wlr_cursor->x - output->geometry.x;
|
x = hikari_server.cursor.wlr_cursor->x - output->geometry.x;
|
||||||
y = hikari_server.cursor.wlr_cursor->y - output->geometry.y;
|
y = hikari_server.cursor.wlr_cursor->y - output->geometry.y;
|
||||||
|
@ -1703,6 +1715,10 @@ hikari_view_configure(struct hikari_view *view,
|
||||||
hikari_view_set_floating(view);
|
hikari_view_set_floating(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (publicview) {
|
||||||
|
hikari_view_set_public(view);
|
||||||
|
}
|
||||||
|
|
||||||
hikari_geometry_constrain_absolute(geometry, &output->usable_area, x, y);
|
hikari_geometry_constrain_absolute(geometry, &output->usable_area, x, y);
|
||||||
hikari_view_refresh_geometry(view, geometry);
|
hikari_view_refresh_geometry(view, geometry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ hikari_view_autoconf_init(struct hikari_view_autoconf *view_autoconf)
|
||||||
view_autoconf->focus = false;
|
view_autoconf->focus = false;
|
||||||
view_autoconf->invisible = false;
|
view_autoconf->invisible = false;
|
||||||
view_autoconf->floating = false;
|
view_autoconf->floating = false;
|
||||||
|
view_autoconf->publicview = false;
|
||||||
|
|
||||||
hikari_position_config_init(&view_autoconf->position);
|
hikari_position_config_init(&view_autoconf->position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -776,6 +776,32 @@ hikari_workspace_toggle_view_invisible(struct hikari_workspace *workspace)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hikari_workspace_toggle_view_public(struct hikari_workspace *workspace)
|
||||||
|
{
|
||||||
|
FOCUS_GUARD(workspace, focus_view);
|
||||||
|
|
||||||
|
hikari_view_toggle_public(focus_view);
|
||||||
|
|
||||||
|
struct hikari_output *output = workspace->output;
|
||||||
|
struct hikari_indicator *indicator = &hikari_server.indicator;
|
||||||
|
struct wlr_box *geometry = hikari_view_border_geometry(focus_view);
|
||||||
|
|
||||||
|
if (hikari_server_is_indicating()) {
|
||||||
|
hikari_indicator_damage_sheet(indicator, output, geometry);
|
||||||
|
}
|
||||||
|
|
||||||
|
hikari_indicator_update_sheet(indicator,
|
||||||
|
output,
|
||||||
|
focus_view->sheet,
|
||||||
|
focus_view->flags,
|
||||||
|
hikari_configuration->indicator_selected);
|
||||||
|
|
||||||
|
if (hikari_server_is_indicating()) {
|
||||||
|
hikari_indicator_damage_sheet(indicator, output, geometry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
hikari_workspace_toggle_view_floating(struct hikari_workspace *workspace)
|
hikari_workspace_toggle_view_floating(struct hikari_workspace *workspace)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue