src/workspaces.c: prevent re-focus for always-on-top views

Before this patch a focused always-on-top view lost its keyboard
focus when switching workspaces. Now the view keeps its focus.
This commit is contained in:
Consolatis 2022-12-29 04:50:21 +01:00
parent f7c8663f67
commit e39fd341ec
3 changed files with 12 additions and 8 deletions

View file

@ -13,6 +13,7 @@
#include "common/list.h"
#include "common/mem.h"
#include "labwc.h"
#include "view.h"
#include "workspaces.h"
/* Internal helpers */
@ -259,13 +260,14 @@ workspaces_switch_to(struct workspace *target)
/* Make sure new views will spawn on the new workspace */
server->workspace_current = target;
/**
/*
* Make sure we are focusing what the user sees.
*
* TODO: This is an issue for always-on-top views as they will
* loose keyboard focus once switching to another workspace.
* Only refocus if the focus is not already on an always-on-top view.
*/
desktop_focus_topmost_mapped_view(target->server);
struct view *view = desktop_focused_view(server);
if (!view || !view_is_always_on_top(view)) {
desktop_focus_topmost_mapped_view(server);
}
/* And finally show the OSD */
_osd_show(server);