Xpra: Ticket #2723: seamless JetBrains apps do not "loose focus" "properly"

JetBrains products automatically save the file when the app is loosing focus (So Ctrl+S is obsoleted)

However, when I am using it via xpra, that doesn't seem to happen.

We have discussed it in some other ticket, that all applications loose focus when a non-xpra window is focused (in Windows) - but that doesn't seem to happen. That doesn't happen either at the case that I am changing focus from one seamless session's windows to another session's window.



Thu, 09 Apr 2020 11:41:43 GMT - stdedos: description changed


Thu, 09 Apr 2020 11:56:16 GMT - Antoine Martin: owner changed

Can you please post the -d focus client log output of just when this should be happening?


Thu, 09 Apr 2020 12:09:57 GMT - stdedos: owner changed

"Xpra-Python3-x86_64_4.0-r25898\xpra_cmd" attach ssh://user@ip/2 --ssh="plink -ssh -agent" --modal-windows=no --title="@title@ on @hostname@/@server-display@" -d focus --opengl=no
2020-04-09 15:08:01,492 Xpra GTK3 client version 4.0-r25898 64-bit
2020-04-09 15:08:01,493  running on Microsoft Windows 10
2020-04-09 15:08:01,571 Warning: failed to import opencv:
2020-04-09 15:08:01,571  No module named 'cv2'
2020-04-09 15:08:01,572  webcam forwarding is disabled
2020-04-09 15:08:02,625 GStreamer version 1.16.2 for Python 3.8.2 64-bit
2020-04-09 15:08:02,864 keyboard layout code 0x409
2020-04-09 15:08:02,865 identified as 'United States - English' : us
2020-04-09 15:08:03,283  keyboard settings: layout=us
2020-04-09 15:08:03,289  desktop size is 4160x1440 with 1 screen:
2020-04-09 15:08:03,290   Default (1100x381 mm - DPI: 96x96) workarea: 4160x1400
2020-04-09 15:08:03,291     Generic PnP Monitor 1600x900 at 0x534 (309x174 mm - DPI: 131x131) workarea: 1600x860
2020-04-09 15:08:03,291     C32JG5x 2560x1440 at 1600x0 (697x392 mm - DPI: 93x93) workarea: 2560x1400
2020-04-09 15:08:15,519 enabled remote logging
2020-04-09 15:08:15,521 Xpra GTK3 X11 server version 3.0.8-r25889 64-bit
2020-04-09 15:08:15,522  running on Linux Ubuntu 16.04 xenial
2020-04-09 15:08:15,531 Attached to ip:22
2020-04-09 15:08:15,532  (press Control-C to detach)
(xpra_cmd:7280): Pango-WARNING **: 15:08:16.310: couldn't load font "Bitstream Vera Sans Not-Rotated 14.662109375", falling back to "Sans Not-Rotated 14.662109375", expect ugly output.
2020-04-09 15:08:17,245 focus-in-event for wid=1
2020-04-09 15:08:17,251 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x000000001e6aad60 (void at 0x0000000008bd5460)>)
2020-04-09 15:08:17,252 ClientWindow(1) focus_change(ClientWindow(1), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=False
2020-04-09 15:08:17,259 recheck_focus() wid=1, focused=None, latest=True
2020-04-09 15:08:17,261 update_focus(1, True) focused=None, grabbed=None
2020-04-09 15:08:17,261 send_focus(1)
2020-04-09 15:08:17,270 focus-out-event for wid=1
2020-04-09 15:08:17,272 do_xpra_focus_out_event(<Gdk.EventFocus object at 0x000000001e6b28b0 (void at 0x0000000008bd5a00)>)
2020-04-09 15:08:17,274 ClientWindow(1) focus_change(ClientWindow(1), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=False, _been_mapped=True
2020-04-09 15:08:17,277 update_focus(1, False) focused=1, grabbed=None
2020-04-09 15:08:17,282 focus-in-event for wid=2
2020-04-09 15:08:17,284 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x000000001e6b4220 (void at 0x0000000008bd5960)>)
2020-04-09 15:08:17,286 ClientWindow(2) focus_change(ClientWindow(2), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=False
2020-04-09 15:08:17,289 recheck_focus() wid=1, focused=None, latest=False
2020-04-09 15:08:17,296 recheck_focus() wid=2, focused=None, latest=True
2020-04-09 15:08:17,299 update_focus(2, True) focused=None, grabbed=None
2020-04-09 15:08:17,301 send_focus(2)
2020-04-09 15:08:17,561 ClientWindow(1) focus_change('initial',) has-toplevel-focus=False, _been_mapped=True
2020-04-09 15:08:17,567 update_focus(1, False) focused=2, grabbed=None
2020-04-09 15:08:17,568 window 1 lost a focus it did not have!? (simulating focus before losing it)
2020-04-09 15:08:17,570 send_focus(1)
2020-04-09 15:08:17,572 ClientWindow(2) focus_change('initial',) has-toplevel-focus=True, _been_mapped=True
2020-04-09 15:08:17,573 update_focus(2, True) focused=None, grabbed=None
2020-04-09 15:08:17,575 send_focus(2)
2020-04-09 15:08:31,073 update_focus(0, False) focused=2, grabbed=None
2020-04-09 15:08:31,080 focus-out-event for wid=2
2020-04-09 15:08:31,083 do_xpra_focus_out_event(<Gdk.EventFocus object at 0x000000001e6bd2c0 (void at 0x0000000008bfff10)>)
2020-04-09 15:08:31,085 ClientWindow(2) focus_change(ClientWindow(2), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=False, _been_mapped=True
2020-04-09 15:08:31,089 update_focus(2, False) focused=None, grabbed=None
2020-04-09 15:08:31,091 recheck_focus() wid=2, focused=None, latest=False
2020-04-09 15:08:31,112 send_lost_focus() focused=None
2020-04-09 15:08:31,115 send_focus(0)
2020-04-09 15:08:31,954 _unfocus() wid=765, focused=None
2020-04-09 15:08:32,138 _unfocus() wid=766, focused=None
2020-04-09 15:08:32,164 _unfocus() wid=767, focused=None
2020-04-09 15:08:33,859 focus-in-event for wid=1
2020-04-09 15:08:33,869 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x000000001e6cccc0 (void at 0x000000000863b470)>)
2020-04-09 15:08:33,871 ClientWindow(1) focus_change(ClientWindow(1), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
2020-04-09 15:08:33,880 update_focus(1, True) focused=None, grabbed=None
2020-04-09 15:08:33,884 send_focus(1)
2020-04-09 15:08:33,887 recheck_focus() wid=1, focused=1, latest=True
2020-04-09 15:08:33,932 _unfocus() wid=764, focused=1
2020-04-09 15:08:52,834 update_focus(0, False) focused=1, grabbed=None
2020-04-09 15:08:52,849 focus-out-event for wid=1
2020-04-09 15:08:52,851 do_xpra_focus_out_event(<Gdk.EventFocus object at 0x000000001e6d3090 (void at 0x000000000863b470)>)
2020-04-09 15:08:52,852 ClientWindow(1) focus_change(ClientWindow(1), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=False, _been_mapped=True
2020-04-09 15:08:52,853 update_focus(1, False) focused=None, grabbed=None
2020-04-09 15:08:52,876 send_lost_focus() focused=None
2020-04-09 15:08:52,879 send_focus(0)
2020-04-09 15:08:52,882 recheck_focus() wid=1, focused=None, latest=False
2020-04-09 15:08:53,106 Python/GTK3 Client got signal SIGINT
2020-04-09 15:08:53,108 exiting
2020-04-09 15:08:53,122 _unfocus() wid=1, focused=None
2020-04-09 15:08:53,135 _unfocus() wid=2, focused=None

Thu, 09 Apr 2020 12:12:29 GMT - stdedos: summary changed

I am highlighting the fact that "properly" reflects to what these apps expect (and happens) on a normal desktop environment


Thu, 09 Apr 2020 16:20:53 GMT - Antoine Martin: owner, status changed

Looks like we do send the "focus-away" event:

send_focus(0)

But I see some other things that need to be improved:

ClientWindow(1) focus_change('initial',) has-toplevel-focus=False, _been_mapped=True
update_focus(1, False) focused=2, grabbed=None
window 1 lost a focus it did not have!? (simulating focus before losing it)

Initial focus comes very late and triggers a back and forth we don't need.

Maybe one of those fixes will help.


Fri, 10 Apr 2020 07:12:30 GMT - Antoine Martin:

I think this is a python3 / GTK3 regression:

Which means that you should be able to fix things just by switching to the python2 server.


Fri, 10 Apr 2020 08:07:27 GMT - stdedos:

Replying to Antoine Martin:

Which means that you should be able to fix things just by switching to the python2 server.

So... Is this one of closed/upstream bugs? 😕


Fri, 10 Apr 2020 08:12:27 GMT - Antoine Martin:

So... Is this one of closed/upstream bugs? 😕

No, it's something that needs to be implemented differently in v3. So far, I thought we could manage without it.


Fri, 10 Apr 2020 14:32:11 GMT - Antoine Martin: owner, status changed

This should be fixed in r26079.

There are beta xenial builds with this fix in the beta area.

Note to self, still need to fix window 1 lost a focus it did not have!? (simulating focus before losing it)


Sat, 11 Apr 2020 08:34:15 GMT - Antoine Martin:

Note to self, still need to fix window 1 lost a focus it did not have!? (simulating focus before losing it)

Done in r26082, this one is client side.


Tue, 14 Apr 2020 14:47:18 GMT - stdedos: status changed; resolution set

I cannot read the r26079 fix (It seems that you added, not fixed the world window), but it is anyway working now.

"Xpra-Python3-x86_64_4.0-r25898\xpra_cmd" attach ssh://user@ip/2 --ssh="plink -ssh -agent" --modal-windows=no --title="@title@ on @hostname@/@server-display@" --opengl=no
2020-04-14 16:46:59,877 Xpra GTK3 client version 4.0-r25898 64-bit
2020-04-14 16:46:59,879  running on Microsoft Windows 10
2020-04-14 16:46:59,953 Warning: failed to import opencv:
2020-04-14 16:46:59,953  No module named 'cv2'
2020-04-14 16:46:59,953  webcam forwarding is disabled
2020-04-14 16:47:00,626 GStreamer version 1.16.2 for Python 3.8.2 64-bit
2020-04-14 16:47:00,874 keyboard layout code 0x409
2020-04-14 16:47:00,875 identified as 'United States - English' : us
2020-04-14 16:47:01,178  keyboard settings: layout=us
2020-04-14 16:47:01,181  desktop size is 4160x1440 with 1 screen:
2020-04-14 16:47:01,181   Default (1100x381 mm - DPI: 96x96) workarea: 4160x1400
2020-04-14 16:47:01,181     Generic PnP Monitor 1600x900 at 0x534 (309x174 mm - DPI: 131x131) workarea: 1600x860
2020-04-14 16:47:01,181     C32JG5x 2560x1440 at 1600x0 (697x392 mm - DPI: 93x93) workarea: 2560x1400
2020-04-14 16:47:09,727 enabled remote logging
2020-04-14 16:47:09,731 Xpra GTK3 X11 server version 3.0.9-r26081 64-bit
2020-04-14 16:47:09,733  running on Linux Ubuntu 16.04 xenial
2020-04-14 16:47:09,745 Attached to ip:22
2020-04-14 16:47:09,746  (press Control-C to detach)

Thank you :-D


Sat, 23 Jan 2021 05:59:02 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2723