[RFC PATCH] xwm: Don't change focus on focus events from grabs

Pekka Paalanen ppaalanen at gmail.com
Mon May 15 11:58:55 UTC 2017


On Mon, 15 May 2017 13:32:01 +0200
Olivier Fourdan <ofourdan at redhat.com> wrote:

> xwm would not let X clients change the focus behind the compositor's
> back, reverting focus where it's supposed to be when this occurs.
> 
> However, X11 grab also issue focus in events, on which some clients
> rely and reverting focus in this case braks the client logic (e.g.
> combobox menu in gtk+ using the X11 backend).
> 
> Check if the focus event is actually coming from a grab or ungrab and
> do not revert focus in this case, to avoid breaking clients logic.
> 
> Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
> ---
>  xwayland/window-manager.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> index 2608075..2500853 100644
> --- a/xwayland/window-manager.c
> +++ b/xwayland/window-manager.c
> @@ -2055,6 +2055,12 @@ static void
>  weston_wm_handle_focus_in(struct weston_wm *wm, xcb_generic_event_t *event)
>  {
>  	xcb_focus_in_event_t *focus = (xcb_focus_in_event_t *) event;
> +
> +	/* Do not interfere with grabs */
> +	if (focus->mode == XCB_NOTIFY_MODE_GRAB ||
> +	    focus->mode == XCB_NOTIFY_MODE_UNGRAB)
> +		return;
> +
>  	/* Do not let X clients change the focus behind the compositor's
>  	 * back. Reset the focus to the old one if it changed. */
>  	if (!wm->focus_window || focus->event != wm->focus_window->id)

Hi,

unfortunately I don't understand enough X11 window management to give
an R-b, but I can give these:
Acked-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
Tested-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

This patch does fix gtk3-demo on Xwayland: the comboboxes demo and
context menus now work, where as before they would never get pointer
events.

Other things I tested that seem to at least not regress:
- xterm and menus
- dmenu
- geany: menus, context menus, tooltips
- gimp: toolboxes, menus
- kcachegrind (Qt4): tooltips, menus, context menus

I'd like to merge this patch very soon now.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170515/2941d6f2/attachment.sig>


More information about the wayland-devel mailing list