Need to check
xwininfo
xev -id windowid
Ubuntu 18.04
Only keypress and keyrelease events are shown
Ubuntu 18.10
FocusIn,FocusOut, keymapnotify in addition to keypress and keyrelease events are shown
gandhig wrote:Due to the XGrabKeyboard function in SDL_x11wm.c, using gdb has become difficult in finding out the reason for the double call of GFX_CaptureMouse() in Ubuntu 18.10. Looking into alternates...
DosFreak wrote:gandhig wrote:Due to the XGrabKeyboard function in SDL_x11wm.c, using gdb has become difficult in finding out the reason for the double call of GFX_CaptureMouse() in Ubuntu 18.10. Looking into alternates...
Found this yesterday, don't know if it's relevant:
https://gitlab.freedesktop.org/xorg/xse ... c79bc00f6a
Going to look into compiling DOSBox with SDL2 to see if same issue or not, think someone previously in this thread stated SDL2 worked on their system whereas SDL1 did not. I've tried with SDL post 1.2.15 release (as of a couple of months ago) and same issue.
Event 4 polled at 14141
Event 4 polled at 14148
Event 4 polled at 14157
Event 4 polled at 14165
Event 4 polled at 14174
Event 1 polled at 15678
ActiveEvent state 2 gain 0 mouse locked 1
Event 1 polled at 15678
ActiveEvent state 2 gain 1 mouse locked 1
Event 1 polled at 17179
ActiveEvent state 2 gain 0 mouse locked 1
Event 1 polled at 17179
ActiveEvent state 2 gain 1 mouse locked 1
Event 1 polled at 18680
ActiveEvent state 2 gain 0 mouse locked 1
Event 1 polled at 18680
ActiveEvent state 2 gain 1 mouse locked 1
Event 1 polled at 20185
ActiveEvent state 2 gain 0 mouse locked 1
Event 1 polled at 20185
ActiveEvent state 2 gain 1 mouse locked 1
Event 1 polled at 21686
ActiveEvent state 2 gain 0 mouse locked 1
Event 1 polled at 21686
ActiveEvent state 2 gain 1 mouse locked 1
Event 1 polled at 23188
ActiveEvent state 2 gain 0 mouse locked 1
Event 1 polled at 23188
ActiveEvent state 2 gain 1 mouse locked 1
Event 1 polled at 24690
ActiveEvent state 2 gain 0 mouse locked 1
Event 1 polled at 24690
ActiveEvent state 2 gain 1 mouse locked 1
Event 4 polled at 24867
Event 4 polled at 24877
Event 4 polled at 24885
Event 4 polled at 24894
Event 4 polled at 24904
Event 4 polled at 24912
Event 4 polled at 24920
/**
* Figure out if focus events are necessary and send them to the
* appropriate windows.
*
* @param from Window the focus moved out of.
* @param to Window the focus moved into.
*/
void
DoFocusEvents(DeviceIntPtr pDev, WindowPtr from, WindowPtr to, int mode)
{
if (!IsKeyboardDevice(pDev))
return;
if (from == to && mode != NotifyGrab && mode != NotifyUngrab)
return;
CoreFocusEvents(pDev, from, to, mode);
DeviceFocusEvents(pDev, from, to, mode);
}
c67f2eac5651 ("dix: always send focus event on grab change") made dix
always sent events when it's a NotifyGrab or NotifyUngrab, even if
from == to, because 'from' can just come from a previous XSetInputFocus
call.
However, when an application calls XGrabKeyboard several times on
the same window, we are now sending spurious FocusOut+FocusIn with
NotifyGrab, even if the grab does not actually change. This makes screen
readers for blind people spuriously emit activity events which disturb
screen reading workflow when e.g. switching between menus.
This commit avoids calling DoFocusEvents in that precise case, i.e. when
oldWin is a previous grab and the new grab is the same window.
Signed-off-by: Samuel Thibault <***@ens-lyon.org>
Index: xorg-server-1.19.2/dix/events.c
===================================================================
--- xorg-server-1.19.2.orig/dix/events.c
+++ xorg-server-1.19.2/dix/events.c
@@ -1530,7 +1530,9 @@ ActivatePointerGrab(DeviceIntPtr mouse,
mouse->spriteInfo->sprite->hotPhys.y = 0;
ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE);
}
- DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab);
+ if (! (grabinfo->grab && oldWin == grabinfo->grab->window
+ && oldWin == grab->window))
+ DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab);
mouse->valuator->motionHintWindow = NullWindow;
if (syncEvents.playingEvents)
grabinfo->grabTime = syncEvents.time;
@@ -1640,7 +1642,9 @@ ActivateKeyboardGrab(DeviceIntPtr keybd,
oldWin = keybd->focus->win;
if (keybd->valuator)
keybd->valuator->motionHintWindow = NullWindow;
- if (oldWin)
+ if (oldWin &&
+ ! (grabinfo->grab && oldWin == grabinfo->grab->window
+ && oldWin == grab->window))
DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
if (syncEvents.playingEvents)
grabinfo->grabTime = syncEvents.time;
Sam,
I it looks like this commit broke grab for DOSBox as well, see this thread:
viewtopic.php?f=31&t=62703&hilit=xorg#p702314
To recreate:
1. Have a system with Xorg 1.20 (works fine when using 1.19)
2. Download, install and execute DOSBox
3. Launch MS-DOS edit.com or any program that needs a mouse
4. Press CTRL+F10. The mouse normally should be captured but cannot with 1.20. SDL sees the mouse just fine and gets gain and loss ActiveEvents but grab events inside the DOSBox window do not work.
Basically seeing the same grab focusin, focusout events as described in the latest post below:
https://xorg-devel.x.narkive.com/mSi2zt ... rab-change
Unfortunately I don't know how to test XORG before and after that commit or test it with the fix the code in the latest post without using the releases that come with the distro.
Can you describe how to recreate a test environment with xorg and/or verify that DOSBox works with the latest fix you described?
Thanks
Hello,
Any reason not to follow this up on xorg-devel? Doing all these
discussions privately means other Xorg hackers can't help, can't know
ins and outs, etc.
Dos Freak, le jeu. 08 nov. 2018 10:31:46 +0000, a ecrit:
> I it looks like this commit broke grab for DOSBox as well, see this thread:
> viewtopic.php?f=31&t=62703&hilit=xorg#p702314
I can confirm that the change is what makes dosbox unable to grab the
pointer.
> SDL sees the mouse just fine and gets gain and loss ActiveEvents but grab
> events inside the DOSBox window do not work.
>
> Basically seeing the same grab focusin, focusout events as described in the
> latest post below:
> https://xorg-devel.x.narkive.com/mSi2ztpr/
> patch-xserver-dix-always-send-focus-event-on-grab-change
I can however also confirm that the precise event that this change was
meant to make the Xorg server to send is also exactly the one which
seems to be disturbing dosbox: I printed values in ActivateKeyboardGrab,
there is a first call with oldWin != grab->window (thus the event
gets through in both 1.19 and 1.20), and a second call with oldWin ==
grab->window == keybd->focus->win (thus the event was not emitted in
1.19 but is emitted in 1.20), but we also have grabinfo->grab == NULL,
so it's really a new grab, and thus we really do want to send the event
in that case, and SDL _has_ to cope with that.
> Unfortunately I don't know how to [...] test it with the fix the code
Hide original message
> in the latest post without using the releases that come with the
> distro.
I tried it, and the fix posted on October 30th does not fix dosbox,
precisely because grabinfo->grab == NULL and so we do want the event in
that case.
Samuel
DosFreak wrote:gandhig, are you using the SDL 1.2.15 release or the latest 1.2 code?
Users browsing this forum: No registered users and 4 guests