Reported on the mailing list here: Xterm menus no mouse tracking.
Only occurs on parts of the popup window that overlap with the xterm window.
Easy-ish to bisect:
--without-nvenc4 --without-nvenc5 --without-nvenc6 --without-vpx --without-dec_avcodec2 --without-printing --without-html5
(avoids build errors)
--without-nvenc7 --without-vpx --without-dec_avcodec2 --without-printing --without-html5 --without-enc_ffmpeg --without-enc_x265
to avoid x265 crashes, etc
The problem comes from r13690, which is a relatively small changeset, but one with big implications. The commit message links to #770, #1293, #911 and #469!
And indeed, using this env var "fixes" things:
XPRA_REPARENT_ROOT=0 xpra start ...
Let's try to find a workaround that doesn't require reverting this switch.
Recording the window tree using sleep 5;DISPLAY=:15 xwininfo -root -tree;DISPLAY=:15 xdotool getactivewindow
:
xwininfo: Window id: 0x299 (the root window) (has no name) Root window id: 0x299 (the root window) (has no name) Parent window id: 0x0 (none) 9 children: 0xc0004e (has no name): () 218x428+186+136 +186+136 0xe00001 "Xpra Audio record": ("Xpra-Audio-record" "Xpra-Audio-record") 10x10+10+10 +10+10 0xc00022 "antoine@desktop:~/projects/Xpra/trunk/src": ("xterm" "XTerm") 499x316+0+0 +0+0 1 child: 0xc0002d (has no name): () 499x316+0+0 +1+1 1 child: 0xc00033 (has no name): () 14x316+-1+-1 +0+0 0x40001c "Xpra": () 10x10+-100+-100 +-100+-100 0x40001b "Xpra": () 10x10+-100+-100 +-100+-100 0x40001a "Xpra": () 10x10+-100+-100 +-100+-100 0x400003 "Xpra-ManagerSelection": () 10x10+-100+-100 +-100+-100 0x400001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x400002 (has no name): () 1x1+-1+-1 +9+9 0x200001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x200002 (has no name): () 1x1+-1+-1 +9+9 Your windowmanager claims not to support _NET_ACTIVE_WINDOW, so the attempt to query the active window aborted. xdo_get_active_window reported an error
xwininfo: Window id: 0x299 (the root window) (has no name) Root window id: 0x299 (the root window) (has no name) Parent window id: 0x0 (none) 18 children: 0xc0004e (has no name): () 218x428+262+267 +262+267 0x100019a "metacity": ("metacity" "Metacity") 200x200+0+0 +0+0 1 child: 0x100019b (has no name): () 1x1+-1+-1 +-1+-1 0x100000e "metacity": ("metacity" "Metacity") 1x1+-200+-200 +-200+-200 1 child: 0x100000f (has no name): () 1x1+-1+-1 +-201+-201 0x1000021 (has no name): () 551x405+32+50 +32+50 1 child: 0xc00022 "antoine@desktop:~/projects/Xpra/trunk/src": ("xterm" "XTerm") 499x316+26+60 +58+110 1 child: 0xc0002d (has no name): () 499x316+0+0 +58+110 1 child: 0xc00033 (has no name): () 14x316+-1+-1 +57+109 0x1000019 (has no name): () 1x1+-1+-1 +-1+-1 0x1000012 (has no name): () 1x1+-100+-100 +-100+-100 0x100000c (has no name): () 1x1+-100+-100 +-100+-100 0x1000004 (has no name): () 1x1+-100+-100 +-100+-100 0x1000003 (has no name): () 1x1+-100+-100 +-100+-100 0x1000002 "Metacity": () 1x1+-100+-100 +-100+-100 0x1000001 "metacity": ("metacity" "Metacity") 10x10+10+10 +10+10 0xe00001 "Xpra Audio record": ("Xpra-Audio-record" "Xpra-Audio-record") 10x10+10+10 +10+10 0x40001c "Xpra": () 10x10+-100+-100 +-100+-100 0x40001b "Xpra": () 10x10+-100+-100 +-100+-100 0x40001a "Xpra": () 10x10+-100+-100 +-100+-100 0x400003 "Xpra-ManagerSelection": () 10x10+-100+-100 +-100+-100 0x400001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x400002 (has no name): () 1x1+-1+-1 +9+9 0x200001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x200002 (has no name): () 1x1+-1+-1 +9+9 12582946 $ python -c 'print(hex(12582946))' 0xc00022
xwininfo: Window id: 0x299 (the root window) (has no name) Root window id: 0x299 (the root window) (has no name) Parent window id: 0x0 (none) 11 children: 0xc0004e (has no name): () 218x428+272+221 +272+221 0x1000025 (has no name): () 507x344+58+73 +58+73 20 children: 0x10000a6 (has no name): () 32x20+470+2 +528+75 0x10000a3 (has no name): () 32x20+438+2 +496+75 0x10000a0 (has no name): () 32x20+406+2 +464+75 0x100009d (has no name): () 4x316+503+24 +561+97 0x100009a (has no name): () 4x4+503+340 +561+413 0x1000097 (has no name): () 499x4+4+340 +62+413 0x1000094 (has no name): () 4x4+0+340 +58+413 0x1000091 (has no name): () 4x316+0+24 +58+97 0x100008e (has no name): () 32x20+4+2 +62+75 0x100008b (has no name): () 32x20+36+2 +94+75 0x1000088 (has no name): () 32x20+68+2 +126+75 0x1000085 (has no name): () 1x20+502+2 +560+75 0x1000082 (has no name): () 4x24+503+0 +561+73 0x100007f (has no name): () 4x24+0+0 +58+73 0x100007c (has no name): () 499x2+4+22 +62+95 0x1000079 (has no name): () 3x20+403+2 +461+75 0x1000076 (has no name): () 22x20+100+2 +158+75 0x1000073 (has no name): () 292x20+111+2 +169+75 0x1000070 (has no name): () 499x2+4+0 +62+73 0xc00022 "antoine@desktop:~/projects/Xpra/trunk/src": ("xterm" "XTerm") 499x316+4+24 +62+97 1 child: 0xc0002d (has no name): () 499x316+0+0 +62+97 1 child: 0xc00033 (has no name): () 14x316+-1+-1 +61+96 0x1000008 "Sawfish": () 5x5+-200+-200 +-200+-200 0x1000001 (has no name): () 10x10+-10+-10 +-10+-10 0xe00001 "Xpra Audio record": ("Xpra-Audio-record" "Xpra-Audio-record") 10x10+10+10 +10+10 0x40001c "Xpra": () 10x10+-100+-100 +-100+-100 0x40001b "Xpra": () 10x10+-100+-100 +-100+-100 0x40001a "Xpra": () 10x10+-100+-100 +-100+-100 0x400003 "Xpra-ManagerSelection": () 10x10+-100+-100 +-100+-100 0x400001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x400002 (has no name): () 1x1+-1+-1 +9+9 0x200001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x200002 (has no name): () 1x1+-1+-1 +9+9 12582946 $ python -c 'print(hex(12582946))' 0xc00022
xwininfo: Window id: 0x299 (the root window) (has no name) Root window id: 0x299 (the root window) (has no name) Parent window id: 0x0 (none) 14 children: 0xc0004e (has no name): () 218x428+271+189 +271+189 0x100007c (has no name): () 101x39+0+0 +0+0 0x100007a (has no name): () 5x5+0+0 +0+0 0x100006b (has no name): () 499x357+58+73 +58+73 2 children: 0xc00022 "antoine@desktop:~/projects/Xpra/trunk/src": ("xterm" "XTerm") 499x316+0+41 +60+116 1 child: 0xc0002d (has no name): () 499x316+0+0 +60+116 1 child: 0xc00033 (has no name): () 14x316+-1+-1 +59+115 0x100006c (has no name): () 499x39+-2+-2 +58+73 3 children: 0x1000073 (has no name): () 63x35+392+2 +452+77 0x1000070 (has no name): () 31x31+463+3 +523+78 0x100006f (has no name): () 31x31+3+3 +63+78 0x1000060 (has no name): () 150x86+0+0 +0+0 2 children: 0x100005e "TWM Icon Manager": () 150x45+0+41 +2+43 1 child: 0x1000074 (has no name): () 150x45+0+0 +2+43 1 child: 0x1000075 (has no name): () 11x11+5+17 +7+60 0x1000061 (has no name): () 150x39+-2+-2 +0+0 3 children: 0x100006a (has no name): () 1x35+1280+2 +1282+4 0x1000065 (has no name): () 31x31+114+3 +116+5 0x1000064 (has no name): () 31x31+3+3 +5+5 0x1000057 (has no name): () 122x741+0+0 +0+0 0x1000056 (has no name): () 122x741+0+0 +0+0 0xe00001 "Xpra Audio record": ("Xpra-Audio-record" "Xpra-Audio-record") 10x10+10+10 +10+10 0x40001c "Xpra": () 10x10+-100+-100 +-100+-100 0x40001b "Xpra": () 10x10+-100+-100 +-100+-100 0x40001a "Xpra": () 10x10+-100+-100 +-100+-100 0x400003 "Xpra-ManagerSelection": () 10x10+-100+-100 +-100+-100 0x400001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x400002 (has no name): () 1x1+-1+-1 +9+9 0x200001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x200002 (has no name): () 1x1+-1+-1 +9+9
xwininfo: Window id: 0x299 (the root window) "Xpra" Root window id: 0x299 (the root window) "Xpra" Parent window id: 0x0 (none) 13 children: 0x40002b "Xpra-CorralWindow-0xc00022": () 499x316+0+71 +0+71 1 child: 0xc00022 "antoine@desktop:~/projects/Xpra/trunk/src": ("xterm" "XTerm") 499x316+0+0 +0+71 1 child: 0xc0002d (has no name): () 499x316+0+0 +0+71 1 child: 0xc00033 (has no name): () 14x316+-1+-1 +-1+70 0xc0004e (has no name): () 218x428+232+210 +232+210 0xe00001 "Xpra Audio record": ("Xpra-Audio-record" "Xpra-Audio-record") 10x10+10+10 +10+10 0x400026 (has no name): () 1x1+-1+-1 +-1+-1 0x400022 "Xpra-SystemTray": () 1x1+0+0 +0+0 1 child: 0x400023 (has no name): () 1x1+-1+-1 +-1+-1 0x400020 "Xpra": () 10x10+-100+-100 +-100+-100 0x40001f "Xpra": () 10x10+-100+-100 +-100+-100 0x40001e "Xpra": () 10x10+-100+-100 +-100+-100 0x40001b "Xpra-WorldWindow": ("xpra" "Xpra") 3840x2160+0+0 +0+0 1 child: 0x40001c (has no name): () 1x1+-1+-1 +-1+-1 0x40001a "Xpra": () 1x1+0+0 +0+0 0x400003 "Xpra-ManagerSelection": () 10x10+-100+-100 +-100+-100 0x400001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x400002 (has no name): () 1x1+-1+-1 +9+9 0x200001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x200002 (has no name): () 1x1+-1+-1 +9+9 12582990 $ python -c 'print(hex(12582990))' 0xc0004e
XPRA_REPARENT_ROOT=1
(broken):
xwininfo: Window id: 0x299 (the root window) "Xpra" Root window id: 0x299 (the root window) "Xpra" Parent window id: 0x0 (none) 13 children: 0x40002b "Xpra-CorralWindow-0xc00022": () 499x316+0+71 +0+71 1 child: 0xc00022 "antoine@desktop:~/projects/Xpra/trunk/src": ("xterm" "XTerm") 499x316+0+0 +0+71 1 child: 0xc0002d (has no name): () 499x316+0+0 +0+71 1 child: 0xc00033 (has no name): () 14x316+-1+-1 +-1+70 0xc0004e (has no name): () 218x428+214+133 +214+133 0xe00001 "Xpra Audio record": ("Xpra-Audio-record" "Xpra-Audio-record") 10x10+10+10 +10+10 0x400026 (has no name): () 1x1+-1+-1 +-1+-1 0x400022 "Xpra-SystemTray": () 1x1+0+0 +0+0 1 child: 0x400023 (has no name): () 1x1+-1+-1 +-1+-1 0x400020 "Xpra": () 10x10+-100+-100 +-100+-100 0x40001f "Xpra": () 10x10+-100+-100 +-100+-100 0x40001e "Xpra": () 10x10+-100+-100 +-100+-100 0x40001b "Xpra-WorldWindow": ("xpra" "Xpra") 3840x2160+0+0 +0+0 1 child: 0x40001c (has no name): () 1x1+-1+-1 +-1+-1 0x40001a "Xpra": () 1x1+0+0 +0+0 0x400003 "Xpra-ManagerSelection": () 10x10+-100+-100 +-100+-100 0x400001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x400002 (has no name): () 1x1+-1+-1 +9+9 0x200001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x200002 (has no name): () 1x1+-1+-1 +9+9 12582990 $ python -c 'print(hex(12582990))' 0xc0004e
XPRA_REPARENT_ROOT=0
(OK):
xwininfo: Window id: 0x299 (the root window) "Xpra" Root window id: 0x299 (the root window) "Xpra" Parent window id: 0x0 (none) 12 children: 0xc0004e (has no name): () 218x428+254+227 +254+227 0x1000001 "Xpra Audio record": ("Xpra-Audio-record" "Xpra-Audio-record") 10x10+10+10 +10+10 0x400028 (has no name): () 1x1+-1+-1 +-1+-1 0x400024 "Xpra-SystemTray": () 1x1+0+0 +0+0 1 child: 0x400025 (has no name): () 1x1+-1+-1 +-1+-1 0x400022 "Xpra": () 10x10+-100+-100 +-100+-100 0x400021 "Xpra": () 10x10+-100+-100 +-100+-100 0x400020 "Xpra": () 10x10+-100+-100 +-100+-100 0x40001b "Xpra-WorldWindow": ("xpra" "Xpra") 3840x2160+0+0 +0+0 2 children: 0x40001f "Xpra-CorralWindow-0xc00022": () 499x316+108+173 +108+173 1 child: 0xc00022 "antoine@desktop:~/projects/Xpra/trunk/src": ("xterm" "XTerm") 499x316+0+0 +108+173 1 child: 0xc0002d (has no name): () 499x316+0+0 +108+173 1 child: 0xc00033 (has no name): () 14x316+-1+-1 +107+172 0x40001c (has no name): () 1x1+-1+-1 +-1+-1 0x40001a "Xpra": () 1x1+0+0 +0+0 0x400003 "Xpra-ManagerSelection": () 10x10+-100+-100 +-100+-100 0x400001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x400002 (has no name): () 1x1+-1+-1 +9+9 0x200001 "xpra": ("xpra" "Xpra") 10x10+10+10 +10+10 1 child: 0x200002 (has no name): () 1x1+-1+-1 +9+9 12582990 $ python -c 'print(hex(12582990))' 0xc0004e
We only reparent the non-OR windows, but it's an OR window that's having this problem! No amount of trying to force the OR popup window on top of the xterm's main window makes any difference. Yet, it really does look like the motion events are delivered to the main window instead of the popup menu..
Got it, I think.
Pointer events get reported against the parent (non-OR) window, which means that we raise it in _move_pointer
.
For some reason, that causes problems when the parent is not root - no idea why that is.
Changing this code is tricky: this could cause all sorts of stacking / focus regressions.
So maybe the easiest short term fix for 2.4 would be to selectively reparent to root (ie: not for Java windows so drag-n-drop will continue to work)
_move_pointer
calls window-model.raise_window
which calls raise_ on the corral window.
This pygtk call delegates to gdk_window_raise
, the docstring reads: Raises @window to the top of the Z-order (stacking order), so that other windows with the same parent window appear below @window. This is true whether or not the windows are visible.
Deep breath.
Managing stacking is not easy, see Braindump: How to get window stacking right - a great read.
So, simply taking out the calls to raise_window
"fixes" the problem, but we can't use this solution: we have no way of knowing what the window stacking is really like on the client side, and the client's window manager is free to re-arrange the window stacking at any point without telling us (we only get notified for big events like iconification, focus lost or gained - but not window stacking changes, especially on other platforms like win32 or macos).
The call to raise_window
ensures that the window which is meant to receive the pointer motion event really is the one on top, as there could be multiple overlapping windows at those exact coordinates.
The reason why "reparent to root" makes a difference is to do with how the window stack is searched for siblings during XRaiseWindow
. When we don't "reparent to root", the search stops at the world window.
The solution adopted in r20890 is to keep track of the window we last raised and not raise it again. This works with override-redirect windows since the pointer events are still reported against the non-OR window. This may not work if pagers or the application themselves somehow re-arrange the stacking from underneath us.
r20892 tries to ensure that we do re-raise it again after events that may have pushed the window down the stack: new non-OR windows, focus events, raised_window requests.
Still TODO:
XPRA_OSX_FOCUS_WORKAROUND=1
- even with GTK3?
The backport to v2.4 was in r20893 and this was included in version 2.4.1
@maxmylyn: I've never managed to reproduce the macos focus bug reliably, can you reproduce it with / without the workaround? If not then let's just close this ticket and leave it as-is.
I tried this yesterday for a significant period of time and I cannot reproduce it at all. I suspect the fact that I'm using a Mac Mini that has a sub 2Ghz Intel CPU may be contributing negatively to my ability to reproduce this bug as even the Apple UI hangs periodically. I'm going to ahead and close this as "worksforme", but I suspect it may sneak back up on us in the future. I hope it doesn't, but you never know.
@maxmylyn: is that with XPRA_OSX_FOCUS_WORKAROUND=0
or 1?
With gtk2 or gtk3 builds?
GTK2 build - with and without the debug flag enabled.
r21007 changes the default to disabled. Hopefully GTK3 isn't affected by this bug.
Regression spotted with trunk (4.0).
Bisecting:
Weirdest bug of the year nomination for this one. Applying this simple change on top of r23803 triggers the bug: changeset/23804/xpra/trunk/src/xpra/x11/models/model_stub.py.
Tested with:
python3 setup.py install --minimal --with-cython --with-x11 --with-server --with-gtk_x11 --with-gtk3 --with-modules --with-pillow
Trimming it further, here's the minimal change that triggers it:
--- xpra/x11/models/model_stub.py (revision 23803) +++ xpra/x11/models/model_stub.py (working copy) @@ -8,6 +8,7 @@ from xpra.gtk_common.gobject_util import AutoPropGObjectMixin from xpra.gtk_common.gobject_compat import import_gobject +from gi.repository import GObject as gobject from xpra.log import Logger gobject = import_gobject()
And the bisection was wrong... That's because the bug doesn't always show up with the first popup click. Damn.
Re-bisecting, more carefully:
Problem is, this is a client side bug. So there may be another server side bug too.
Client side bug fixed in r24842: the server does something undesirable if we send it focus-in events for OR windows.
Glad I spent some time debugging the server end: r24845 is a better fix for both ends.
There used to be a workaround that returned the currently focused window instead (but only on macos): added in r8239, removed in r24845. This was related to #469. See also #770 / #1293 / #911.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1999