mirror of
https://github.com/labwc/labwc.git
synced 2026-02-28 01:40:29 -05:00
xwayland: use wlr_xwayland_surface_offer_focus()
Offer focus by sending WM_TAKE_FOCUS to a client window supporting it. The client may accept or ignore the offer. If it accepts, the surface will emit a focus_in signal notifying the compositor that it has received focus. The compositor should then call wlr_xwayland_surface_activate(surface, true). This is a more compatible method of giving focus to windows using the Globally Active input model (see wlr_xwayland_icccm_input_model()) than calling wlr_xwayland_surface_activate() unconditionally, since there is no reliable way to know in advance whether these windows want to be focused. v2: add caution not to use view_offer_focus() directly v3: remove obsolete comment
This commit is contained in:
parent
95552c261d
commit
c00baa1651
5 changed files with 51 additions and 15 deletions
|
|
@ -77,16 +77,19 @@ desktop_focus_view(struct view *view, bool raise)
|
|||
workspaces_switch_to(view->workspace, /*update_focus*/ false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Give input focus, even if the view claims not to want it (see
|
||||
* view->impl->wants_focus). This is a workaround for so-called
|
||||
* "globally active" X11 views (MATLAB known to be one such)
|
||||
* that expect to be able to control focus themselves, but can't
|
||||
* under labwc since it's disallowed at the wlroots level.
|
||||
*/
|
||||
struct seat *seat = &view->server->seat;
|
||||
if (view->surface != seat->seat->keyboard_state.focused_surface) {
|
||||
seat_focus_surface(seat, view->surface);
|
||||
switch (view_wants_focus(view)) {
|
||||
case VIEW_WANTS_FOCUS_ALWAYS:
|
||||
; /* works around "a label can only be part of a statement" */
|
||||
struct seat *seat = &view->server->seat;
|
||||
if (view->surface != seat->seat->keyboard_state.focused_surface) {
|
||||
seat_focus_surface(seat, view->surface);
|
||||
}
|
||||
break;
|
||||
case VIEW_WANTS_FOCUS_OFFER:
|
||||
view_offer_focus(view);
|
||||
break;
|
||||
case VIEW_WANTS_FOCUS_NEVER:
|
||||
break;
|
||||
}
|
||||
|
||||
if (raise) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue