mirror of
https://github.com/labwc/labwc.git
synced 2025-11-01 22:58:47 -04:00
view: add view_wants_focus enum (NEVER/ALWAYS/OFFER) and function
This allows identifying XWayland views using the ICCCM "Globally Active" input model. Later commits will improve handling of these views. No functional change in this commit.
This commit is contained in:
parent
8bb2e2123f
commit
dd7f563a50
3 changed files with 79 additions and 20 deletions
12
src/view.c
12
src/view.c
|
|
@ -143,6 +143,16 @@ view_array_append(struct server *server, struct wl_array *views,
|
|||
}
|
||||
}
|
||||
|
||||
enum view_wants_focus
|
||||
view_wants_focus(struct view *view)
|
||||
{
|
||||
assert(view);
|
||||
if (view->impl->wants_focus) {
|
||||
return view->impl->wants_focus(view);
|
||||
}
|
||||
return VIEW_WANTS_FOCUS_ALWAYS;
|
||||
}
|
||||
|
||||
bool
|
||||
view_is_focusable(struct view *view)
|
||||
{
|
||||
|
|
@ -150,7 +160,7 @@ view_is_focusable(struct view *view)
|
|||
if (!view->surface) {
|
||||
return false;
|
||||
}
|
||||
if (view->impl->wants_focus && !view->impl->wants_focus(view)) {
|
||||
if (view_wants_focus(view) != VIEW_WANTS_FOCUS_ALWAYS) {
|
||||
return false;
|
||||
}
|
||||
return (view->mapped || view->minimized);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue