[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64658: 30.0.50; NotifyGrab and NotifyUngrab should be filtered with
From: |
Po Lu |
Subject: |
bug#64658: 30.0.50; NotifyGrab and NotifyUngrab should be filtered with XInput2 |
Date: |
Sun, 16 Jul 2023 17:09:13 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
左 智杰 <hardirq@outlook.com> writes:
> In i3wm + xfce4 setup, when multiple frames opened, switch between frames
> using only keyboard, and leave the mouse as:
>
> +-----------------+ +-----------------+
> | | | |
> | | | |
> | | | |
> | | | |
> | | | |
> | | | |
> | FRAME 1 | | FRAME 2 |
> | *FOCUSED* | | *UNFOCUSED* |
> | | | ^ |
> | | | | |
> | | | MOUSE |
> | | | HERE |
> | | | |
> +-----------------+ +-----------------+
>
> This will make the ~emacsclient -e '(selected-frame)'~ returns wrong frame,
> due to
> XInput2 sends a ~NotifyGrab~ with the unfocused frame, making Emacs selects
> it.
>
> We've make a small but ugly changes to fix this issue:
>
> #+begin_src
> diff --git a/src/xterm.c b/src/xterm.c
> index 9ecead03b0..d4836afeeb 100644
> --- a/src/xterm.c
> +++ b/src/xterm.c
> @@ -13193,6 +13193,11 @@ xi_focus_handle_for_device (struct x_display_info
> *dpyinfo,
> if (!device)
> return;
>
> + /* Same as x_detect_focus_change, issue persists in XInput2. */
> + if (event->evtype == XI_FocusIn || event->evtype == XI_FocusOut)
> + if (event->mode == XINotifyGrab || event->mode == XINotifyUngrab)
> + return;
> +
> switch (event->evtype)
> {
> case XI_FocusIn:
> #+end_src
>
> Wonder if we're correct?
I don't want this hack in the input extension code, because it is much
more sensitive to inconsistencies in the keyboard focus state.
What is the value of event->send_event for these unwanted focus events?