desktop: switch workspaces and optionally raise in desktop_focus_view()

Make desktop_focus_view() always switch to the workspace containing the
view being focused. It doesn't make much sense for an invisible view to
have the keyboard focus.

Also add an optional "raise" parameter to desktop_focus_view(). This
allows the common pattern of desktop_focus_view() + view_move_to_front()
to be reduced to a single function call.
This commit is contained in:
John Lindgren 2023-09-27 18:37:28 -04:00 committed by Consolatis
parent e77330bc3f
commit e5aef03319
11 changed files with 44 additions and 43 deletions

View file

@ -2,10 +2,12 @@
#ifndef LABWC_WORKSPACES_H
#define LABWC_WORKSPACES_H
#include <stdbool.h>
#include <wayland-util.h>
struct seat;
struct view;
struct server;
struct wl_list;
struct wlr_scene_tree;
/* Double use: as config in config/rcxml.c and as instance in workspaces.c */
struct workspace {
@ -20,7 +22,7 @@ struct workspace {
};
void workspaces_init(struct server *server);
void workspaces_switch_to(struct workspace *target);
void workspaces_switch_to(struct workspace *target, bool update_focus);
void workspaces_destroy(struct server *server);
void workspaces_osd_hide(struct seat *seat);
struct workspace *workspaces_find(struct workspace *anchor, const char *name,