xwayland: Update lost focus on deactivation
Use the "activated" state from xdg-shell to call the pointer and keyboard leave events when running rootful. The regular pointer and keyboard leave notifications are now ignored when running rootful. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1604 Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1213>
This commit is contained in:
parent
122ad8a0de
commit
792758faa5
|
@ -617,7 +617,8 @@ pointer_handle_leave(void *data, struct wl_pointer *pointer,
|
||||||
focus_lost = TRUE;
|
focus_lost = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
xwl_seat_leave_ptr(xwl_seat, focus_lost);
|
if (xwl_screen->rootless)
|
||||||
|
xwl_seat_leave_ptr(xwl_seat, focus_lost);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1211,7 +1212,8 @@ keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
|
||||||
|
|
||||||
xwl_screen->serial = serial;
|
xwl_screen->serial = serial;
|
||||||
|
|
||||||
xwl_seat_leave_kbd(xwl_seat);
|
if (xwl_screen->rootless)
|
||||||
|
xwl_seat_leave_kbd(xwl_seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -54,6 +54,7 @@ struct xwl_screen {
|
||||||
int expecting_event;
|
int expecting_event;
|
||||||
enum RootClipMode root_clip_mode;
|
enum RootClipMode root_clip_mode;
|
||||||
|
|
||||||
|
Bool active;
|
||||||
int rootless;
|
int rootless;
|
||||||
xwl_glamor_mode_flags glamor;
|
xwl_glamor_mode_flags glamor;
|
||||||
int present;
|
int present;
|
||||||
|
|
|
@ -795,6 +795,8 @@ xdg_toplevel_handle_configure(void *data,
|
||||||
{
|
{
|
||||||
struct xwl_window *xwl_window = data;
|
struct xwl_window *xwl_window = data;
|
||||||
struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
|
struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
|
||||||
|
uint32_t *p;
|
||||||
|
Bool old_active = xwl_screen->active;
|
||||||
|
|
||||||
/* Maintain our current size if no dimensions are requested */
|
/* Maintain our current size if no dimensions are requested */
|
||||||
if (width == 0 && height == 0)
|
if (width == 0 && height == 0)
|
||||||
|
@ -804,6 +806,20 @@ xdg_toplevel_handle_configure(void *data,
|
||||||
/* This will be committed by the xdg_surface.configure handler */
|
/* This will be committed by the xdg_surface.configure handler */
|
||||||
xwl_window_maybe_resize(xwl_window, width, height);
|
xwl_window_maybe_resize(xwl_window, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xwl_screen->active = FALSE;
|
||||||
|
wl_array_for_each (p, states) {
|
||||||
|
uint32_t state = *p;
|
||||||
|
if (state == XDG_TOPLEVEL_STATE_ACTIVATED) {
|
||||||
|
xwl_screen->active = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (old_active != xwl_screen->active) {
|
||||||
|
if (!xwl_screen->active)
|
||||||
|
xwl_screen_lost_focus(xwl_screen);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue