xpra icon
Bug tracker and wiki

Opened 3 months ago

Last modified 3 weeks ago

#2852 new defect

Seamless JetBrains apps do not gain focus

Reported by: stdedos Owned by: stdedos
Priority: major Milestone: 4.1
Component: client Version: 3.0.x
Keywords: Cc:

Description (last modified by stdedos)

Opposite of #2723

"Xpra-Python3-x86_64_4.1-r27002\xpra_cmd" attach ssh://user@ip/2 --ssh="plink -ssh -agent" --modal-windows=no --title="@title@ on @@/@server-display@" --headerbar=off --opengl=no --bandwidth-limit=6Mbps

2020-07-23 12:56:36,692 Xpra GTK3 client version 4.1-r27002 64-bit
2020-07-23 12:56:36,696  running on Microsoft Windows 10
2020-07-23 12:56:37,914 GStreamer version 1.16.2 for Python 3.8.4 64-bit
2020-07-23 12:56:38,670 keyboard layout code 0x409
2020-07-23 12:56:38,671 identified as 'United States - English' : us
2020-07-23 12:56:38,938  keyboard settings: layout=us
2020-07-23 12:56:38,941  desktop size is 4160x1440 with 1 screen:
2020-07-23 12:56:38,941   Default (1100x381 mm - DPI: 96x96) workarea: 4160x1400
2020-07-23 12:56:38,941     Generic PnP Monitor 1600x900 at 0x534 (309x174 mm - DPI: 131x131) workarea: 1600x860 at 0x534
2020-07-23 12:56:38,942     C32JG5x 2560x1440 at 1600x0 (697x392 mm - DPI: 93x93) workarea: 2560x1400 at 1600x0
2020-07-23 12:56:45,718 enabled remote logging
2020-07-23 12:56:45,721 Xpra GTK3 X11 server version 3.0.10-r26630 64-bit
2020-07-23 12:56:45,723  running on Linux Ubuntu 16.04 xenial
2020-07-23 12:56:45,741 Attached to ip:22
2020-07-23 12:56:45,746  (press Control-C to detach)


(xpra_cmd:12568): Pango-WARNING **: 12:56:46.481: couldn't load font "Bitstream Vera Sans Not-Rotated 14.662109375", falling back to "Sans Not-Rotated 14.662109375", expect ugly output.
2020-07-23 12:56:47,504 UI thread is now blocked
2020-07-23 12:56:47,921 UI thread is running again, resuming
2020-07-23 14:07:38,138 server is not responding, drawing spinners over the windows
2020-07-23 14:07:39,903 server is OK again
2020-07-23 14:48:19,589 enabled debugging for:
2020-07-23 14:48:19,596  - Logger(xpra.client.client_window_base, focus)
2020-07-23 14:48:19,599  - Logger(xpra.client.mixins.window_manager, focus)
2020-07-23 14:48:19,603  - Logger(xpra.client.gtk_base.gtk_client_window_base, focus, grab)
2020-07-23 14:48:23,620 focus-out-event for wid=8
2020-07-23 14:48:23,623 do_xpra_focus_out_event(<Gdk.EventFocus object at 0x00000000053c6d60 (void at 0x000000001b7a6830)>)
2020-07-23 14:48:23,625 ClientWindow(8) focus_change(ClientWindow(8), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=False, _been_mapped=True
2020-07-23 14:48:23,625 update_focus(8, False) focused=8, grabbed=None
2020-07-23 14:48:23,627 focus-in-event for wid=5063
2020-07-23 14:48:23,629 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x00000000053c6d60 (void at 0x000000001b7c4500)>) been_mapped=True
2020-07-23 14:48:23,630 ClientWindow(5063) focus_change(ClientWindow(5063), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
2020-07-23 14:48:23,632 update_focus(5063, True) focused=None, grabbed=None
2020-07-23 14:48:23,637 send_focus(5063)
2020-07-23 14:48:23,639 recheck_focus() wid=8, focused=5063, latest=False
2020-07-23 14:48:23,641 recheck_focus() wid=5063, focused=5063, latest=True
2020-07-23 14:48:28,367 focus-out-event for wid=5063
2020-07-23 14:48:28,385 do_xpra_focus_out_event(<Gdk.EventFocus object at 0x00000000053d3130 (void at 0x000000001b7c45a0)>)
2020-07-23 14:48:28,390 ClientWindow(5063) focus_change(ClientWindow(5063), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=False, _been_mapped=True
2020-07-23 14:48:28,393 update_focus(5063, False) focused=5063, grabbed=None
2020-07-23 14:48:28,397 focus-in-event for wid=8
2020-07-23 14:48:28,399 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x00000000053d3130 (void at 0x000000001b7a6830)>) been_mapped=True
2020-07-23 14:48:28,401 ClientWindow(8) focus_change(ClientWindow(8), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
2020-07-23 14:48:28,403 update_focus(8, True) focused=None, grabbed=None
2020-07-23 14:48:28,405 send_focus(8)
2020-07-23 14:48:28,412 recheck_focus() wid=5063, focused=8, latest=False
2020-07-23 14:48:28,415 recheck_focus() wid=8, focused=8, latest=True
2020-07-23 14:48:29,255 focus-out-event for wid=8
2020-07-23 14:48:29,266 do_xpra_focus_out_event(<Gdk.EventFocus object at 0x0000000000787810 (void at 0x000000001b7a6e70)>)
2020-07-23 14:48:29,268 ClientWindow(8) focus_change(ClientWindow(8), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=False, _been_mapped=True
2020-07-23 14:48:29,271 update_focus(8, False) focused=8, grabbed=None
2020-07-23 14:48:29,274 focus-in-event for wid=5063
2020-07-23 14:48:29,276 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x00000000007a53b0 (void at 0x000000001b7eeaa0)>) been_mapped=True
2020-07-23 14:48:29,278 ClientWindow(5063) focus_change(ClientWindow(5063), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
2020-07-23 14:48:29,280 update_focus(5063, True) focused=None, grabbed=None
2020-07-23 14:48:29,282 send_focus(5063)
2020-07-23 14:48:29,287 recheck_focus() wid=8, focused=5063, latest=False
2020-07-23 14:48:29,291 recheck_focus() wid=5063, focused=5063, latest=True
2020-07-23 14:48:30,264 update_focus(0, False) focused=5063, grabbed=None
2020-07-23 14:48:30,268 focus-out-event for wid=5063
2020-07-23 14:48:30,269 do_xpra_focus_out_event(<Gdk.EventFocus object at 0x00000000007ab400 (void at 0x000000001b7c4500)>)
2020-07-23 14:48:30,271 ClientWindow(5063) focus_change(ClientWindow(5063), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=False, _been_mapped=True
2020-07-23 14:48:30,272 update_focus(5063, False) focused=None, grabbed=None
2020-07-23 14:48:30,273 recheck_focus() wid=5063, focused=None, latest=False
2020-07-23 14:48:30,288 send_lost_focus() focused=None
2020-07-23 14:48:30,290 send_focus(0)
2020-07-23 14:48:30,351 focus-in-event for wid=5595
2020-07-23 14:48:30,362 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x00000000007ab130 (void at 0x000000001b7eeaa0)>) been_mapped=True
2020-07-23 14:48:30,364 ClientWindow(5595) focus_change(ClientWindow(5595), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
2020-07-23 14:48:30,366 update_focus(5595, True) focused=None, grabbed=None
2020-07-23 14:48:30,367 send_focus(5595)
2020-07-23 14:48:30,370 recheck_focus() wid=5595, focused=5595, latest=True
2020-07-23 14:48:30,850 update_focus(0, False) focused=5595, grabbed=None
2020-07-23 14:48:30,864 focus-out-event for wid=5595
2020-07-23 14:48:30,868 do_xpra_focus_out_event(<Gdk.EventFocus object at 0x0000000021978c20 (void at 0x000000001b7a6dd0)>)
2020-07-23 14:48:30,874 ClientWindow(5595) focus_change(ClientWindow(5595), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=False, _been_mapped=True
2020-07-23 14:48:30,877 update_focus(5595, False) focused=None, grabbed=None
2020-07-23 14:48:30,881 send_lost_focus() focused=None
2020-07-23 14:48:30,886 send_focus(0)
2020-07-23 14:48:30,889 recheck_focus() wid=5595, focused=None, latest=False
2020-07-23 14:48:30,944 _unfocus() wid=5595, focused=None
2020-07-23 14:48:30,949 focus-in-event for wid=5063
2020-07-23 14:48:30,952 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x0000000021978c20 (void at 0x000000001b7c4500)>) been_mapped=True
2020-07-23 14:48:30,957 ClientWindow(5063) focus_change(ClientWindow(5063), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
2020-07-23 14:48:30,960 update_focus(5063, True) focused=None, grabbed=None
2020-07-23 14:48:30,963 send_focus(5063)
2020-07-23 14:48:30,966 recheck_focus() wid=5063, focused=5063, latest=True
2020-07-23 14:48:34,371 focus-out-event for wid=5063
2020-07-23 14:48:34,382 do_xpra_focus_out_event(<Gdk.EventFocus object at 0x0000000000787ae0 (void at 0x000000001b7eeaa0)>)
2020-07-23 14:48:34,386 ClientWindow(5063) focus_change(ClientWindow(5063), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=False, _been_mapped=True
2020-07-23 14:48:34,389 update_focus(5063, False) focused=5063, grabbed=None
2020-07-23 14:48:34,396 focus-in-event for wid=8
2020-07-23 14:48:34,399 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x0000000000787ae0 (void at 0x000000001b7a6f10)>) been_mapped=True
2020-07-23 14:48:34,401 ClientWindow(8) focus_change(ClientWindow(8), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
2020-07-23 14:48:34,403 update_focus(8, True) focused=None, grabbed=None
2020-07-23 14:48:34,408 send_focus(8)
2020-07-23 14:48:34,411 recheck_focus() wid=5063, focused=8, latest=False
2020-07-23 14:48:34,415 recheck_focus() wid=8, focused=8, latest=True
2020-07-23 14:48:34,661 _unfocus() wid=5643, focused=8
2020-07-23 14:48:38,554 disabled debugging for:
2020-07-23 14:48:38,556  - Logger(xpra.client.client_window_base, focus)
2020-07-23 14:48:38,558  - Logger(xpra.client.mixins.window_manager, focus)
2020-07-23 14:48:38,559  - Logger(xpra.client.gtk_base.gtk_client_window_base, focus, grab)

However, I don't know how to trigger that sequence of events.

I know that I had time to:

  • observe it (LibreOffice to PyCharm, Ctrl+P triggered "Print" instead of ala-Sublime "Go to file ..."),
  • switch to terminal, enable client diagnostics
  • re-trigger it (Triggered "Complete last command" on terminal), and
  • work around it (raise and re-minimize an app).

Attachments (3)

redact-xpra-server-p2723.log (491.2 KB) - added by stdedos 3 months ago.
redact-xpra-2852-d-window-XPRA_ALWAYS_RAISE_WINDOW.log (20.6 KB) - added by stdedos 3 weeks ago.
redact-xpra-2852-d-window.log (11.5 KB) - added by stdedos 3 weeks ago.
And before the "mandatory" xpra-upgrade

Download all attachments as: .zip

Change History (13)

Changed 3 months ago by stdedos

comment:1 Changed 3 months ago by stdedos

Description: modified (diff)

comment:2 Changed 7 weeks ago by Antoine Martin

Owner: changed from Antoine Martin to stdedos

Does this bug only occur when there are "Seamless JetBrains apps"?

If this is reproducible, can you please also enable -d focus on the server and post that log. (maybe the server is getting spurious focus events?)

Last edited 7 weeks ago by Antoine Martin (previous) (diff)

comment:3 Changed 6 weeks ago by Antoine Martin

Are your logs full of _NET_ACTIVE_WINDOW messages like in this other log sample you provided: attachment/ticket/2671/redact-xpra-file-2671.log?

do_xpra_client_message_event(<X11:ClientMessage {'format': '32', 'window': '0x80000a', 'send_event': '1', 'data': '(2, 0, 0, 0, 0)', 'message_type': '_NET_ACTIVE_WINDOW', 'serial': '0xd5b825', 'delivered_to': '0x80000a'}>) not handled

Because this may explain why the active window is not the one xpra / the application expects.
As per the wm spec : _NET_ACTIVE_WINDOW:
Source indication should be 1 when the request comes from an application, and 2 when it comes from a pager. Clients using older version of this spec use 0 as source indication
We ignore pagers because they aren't meant to be running in seamless mode as they would likely interfere with the window management that xpra is doing.

If so, try applying r27472, does that help?

comment:4 in reply to:  3 Changed 6 weeks ago by stdedos

Replying to Antoine Martin:

Are your logs full of _NET_ACTIVE_WINDOW messages like in this other log sample you provided: attachment/ticket/2671/redact-xpra-file-2671.log?

do_xpra_client_message_event(<X11:ClientMessage {'format': '32', 'window': '0x80000a', 'send_event': '1', 'data': '(2, 0, 0, 0, 0)', 'message_type': '_NET_ACTIVE_WINDOW', 'serial': '0xd5b825', 'delivered_to': '0x80000a'}>) not handled

I am using a single xpra-seamless instance for all my applications, so "all of my logs are full of _NET_ACTIVE_WINDOW" - but I don't know from where are they coming from (which window).

Because this may explain why the active window is not the one xpra / the application expects.
As per the wm spec : _NET_ACTIVE_WINDOW:
Source indication should be 1 when the request comes from an application, and 2 when it comes from a pager. Clients using older version of this spec use 0 as source indication
We ignore pagers because they aren't meant to be running in seamless mode as they would likely interfere with the window management that xpra is doing.

If so, try applying r27472, does that help?

At this time, I have "more serious issues" aka kb shortcuts not working - so I avoid using Jetbrains totally (it's already impaired compared to my Sublime). I am thinking if this is r27456 though (what's your 3.0.x release plan look like?).

As a cherry on the top, I saw today that I am getting lack-of-drawing on the Shift+Shift window (Search Everywhere) - in addition to it displaying about-on-the-middle of the 4160x1440 (instead of the middle of the active monitor AKA 1600x900)

I can try applying that sometime down the road - but I am guessing that would be next month (very close to my plan for updating the server to 20.04) - especially given the "how many balls I am juggling" for this month.

comment:5 Changed 6 weeks ago by Antoine Martin

I am using a single xpra-seamless instance for all my applications,
so "all of my logs are full of _NET_ACTIVE_WINDOW" - but I don't know from where are they coming from (which window).

Try:

xwininfo -id 0x80000a

I can try applying that sometime down the road

FYI: excluding code comments, it's a single line of code.

At this time, I have "more serious issues" aka kb shortcuts not working
I am thinking if this is r27456 though (what's your 3.0.x release plan look like?).

Not sure when. You could also apply this by hand safely: 2 lines changed.

comment:6 in reply to:  5 Changed 6 weeks ago by stdedos

Replying to Antoine Martin:

I am using a single xpra-seamless instance for all my applications,
so "all of my logs are full of _NET_ACTIVE_WINDOW" - but I don't know from where are they coming from (which window).

Try:

xwininfo -id 0x80000a

Uh-oh:

xwininfo: Window id: 0x80000a "Terminal"

  Absolute upper-left X:  1600
  Absolute upper-left Y:  23
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 2559
  Height: 1376
  Depth: 32
  Visual: 0x41
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x800009 (not installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +1600+23  -1+23  -1-41  +1600-41
  -geometry 283x78-1+23

tl;dr my Terminal

Idk, I don't feel / remember feeling that the Terminal "is/was not listening to me"

I can try applying that sometime down the road

FYI: excluding code comments, it's a single line of code.

At this time, I have "more serious issues" aka kb shortcuts not working
I am thinking if this is r27456 though (what's your 3.0.x release plan look like?).

Not sure when. You could also apply this by hand safely: 2 lines changed.

I have checked the changesets. It's not that they are big, unsafe or the sorts - it is just a conscious effort to stop context switching (given that they "may not be okay", which means diagnostics-collection, report, revert etc)

comment:7 Changed 3 weeks ago by stdedos

I just upgraded my server to v3.0.12-r27620.

This (and some discussion split to #2882) is still happening.

I made a small discovery: It seems that, if I click the window title bar, the focus is not really moved. I need to instead click directly at the UI (decorations, text editor) in order for the keyboard focus to shift as well.

  • I can do this within "the same focus event" (2020-10-07 13:55:40,408 focus wid=6048 has_focus=6048 i.e. I don't need to click back-and-forth, just click at the correct place anytime).
  • This also affects Alt+Tab focus (as if I had just clicked the window title bar).
  • Does not work likewise (or rather does not fail) with e.g. Terminal windows
"Xpra-Python3-x86_64_4.1-r27631\xpra_cmd" attach ssh://user@ip/3 --ssh="plink -ssh -agent" --modal-windows=no --title="@title@ on @@/@server-display@" --headerbar=off --opengl=no --bandwidth-limit=6Mbps

XPRA_CUSTOM_TITLE_BAR=0
XPRA_EXECUTABLE=Xpra-Python3-x86_64_4.1-r27631
XPRA_REPAINT_ALL=0
XPRA_SCROLL_ENCODING=0

2020-10-08 10:26:11,402 Xpra GTK3 client version 4.1-r27631 64-bit
2020-10-08 10:26:11,404  running on Microsoft Windows 10
2020-10-08 10:26:12,353 GStreamer version 1.18.0 for Python 3.8.6 64-bit
2020-10-08 10:26:12,640 created named pipe 'Xpra\16840'
2020-10-08 10:26:12,859 keyboard layout code 0x409
2020-10-08 10:26:12,859 identified as 'United States - English' : us
2020-10-08 10:26:13,081  keyboard settings: layout=us
2020-10-08 10:26:13,083  desktop size is 4160x1440 with 1 screen:
2020-10-08 10:26:13,084   Default (1100x381 mm - DPI: 96x96) workarea: 4160x1400
2020-10-08 10:26:13,084     Generic PnP Monitor 1600x900 at 0x534 (309x174 mm - DPI: 131x131) workarea: 1600x860 at 0x534
2020-10-08 10:26:13,084     C32JG5x 2560x1440 at 1600x0 (697x392 mm - DPI: 93x93) workarea: 2560x1400 at 1600x0
2020-10-08 10:26:16,239 enabled remote logging
2020-10-08 10:26:16,242 Xpra GTK3 X11 server version 3.0.12-r27620 64-bit
2020-10-08 10:26:16,243  running on Linux Ubuntu 16.04 xenial
Last edited 3 weeks ago by stdedos (previous) (diff)

comment:8 Changed 3 weeks ago by Antoine Martin

I made a small discovery: It seems that, if I click the window title bar, the focus is not really moved. I need to instead click directly at the UI (decorations, text editor) in order for the keyboard focus to shift as well.

Does this mean that we don't get a focus event when you click the title bar? (-d focus) If that's the case, then it's difficult for xpra to synchronize the focus.
Maybe there's some other event we can latch on to? (-d window?)

Does not work likewise (or rather does not fail) with e.g. Terminal windows

There must be something different about those windows then.

You may want to try to run your server with:

XPRA_ALWAYS_RAISE_WINDOW=1

This will always raise the window under the pointer.

comment:9 in reply to:  8 ; Changed 3 weeks ago by stdedos

Replying to Antoine Martin:

I made a small discovery: It seems that, if I click the window title bar, the focus is not really moved. I need to instead click directly at the UI (decorations, text editor) in order for the keyboard focus to shift as well.

Does this mean that we don't get a focus event when you click the title bar? (-d focus) If that's the case, then it's difficult for xpra to synchronize the focus.

Yes, see logs at #2882

Maybe there's some other event we can latch on to? (-d window?)

👍 I'll check later

Does not work likewise (or rather does not fail) with e.g. Terminal windows

There must be something different about those windows then.

You may want to try to run your server with:

XPRA_ALWAYS_RAISE_WINDOW=1

This will always raise the window under the pointer.

👍 I'll check after -d window

comment:10 in reply to:  9 Changed 3 weeks ago by stdedos

Replying to stdedos:

Replying to Antoine Martin:

I made a small discovery: It seems that, if I click the window title bar, the focus is not really moved. I need to instead click directly at the UI (decorations, text editor) in order for the keyboard focus to shift as well.

Does this mean that we don't get a focus event when you click the title bar? (-d focus) If that's the case, then it's difficult for xpra to synchronize the focus.

Yes, see logs at #2882

Maybe there's some other event we can latch on to? (-d window?)

👍 I'll check later

Does not work likewise (or rather does not fail) with e.g. Terminal windows

There must be something different about those windows then.

You may want to try to run your server with:

XPRA_ALWAYS_RAISE_WINDOW=1

This will always raise the window under the pointer.

👍 I'll check after -d window

Nope, does not work
redact-xpra-2852-d-window-XPRA_ALWAYS_RAISE_WINDOW.log

(removed all cairo_paint_border calls, too much spam)
Also, cannot read the log; it's not what I was accustomed to.

Changed 3 weeks ago by stdedos

And before the "mandatory" xpra-upgrade

Note: See TracTickets for help on using tickets.