Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seamless JetBrains apps do not "loose focus" "properly" #2723

Closed
totaam opened this issue Apr 9, 2020 · 10 comments
Closed

seamless JetBrains apps do not "loose focus" "properly" #2723

totaam opened this issue Apr 9, 2020 · 10 comments
Labels

Comments

@totaam
Copy link
Collaborator

totaam commented Apr 9, 2020

Issue migrated from trac ticket # 2723

component: server | priority: minor | resolution: fixed

2020-04-09 12:41:35: stdedos created the issue


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.

@totaam
Copy link
Collaborator Author

totaam commented Apr 9, 2020

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

@totaam
Copy link
Collaborator Author

totaam commented Apr 9, 2020

2020-04-09 13:09:58: stdedos commented


"Xpra-Python3-x86_64_4.0-[r25898](../commit/90a2db9fa57c01c3c1513075421ba1adf8af998f)\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](../commit/90a2db9fa57c01c3c1513075421ba1adf8af998f) 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-25889 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

@totaam
Copy link
Collaborator Author

totaam commented Apr 9, 2020

2020-04-09 13:12:30: stdedos commented


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

@totaam
Copy link
Collaborator Author

totaam commented Apr 9, 2020

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.

@totaam
Copy link
Collaborator Author

totaam commented Apr 10, 2020

I think this is a python3 / GTK3 regression:

  • with python2 / GTK2
process_focus: wid=0
focus wid=0 has_focus=1
reset_focus() 1 / WindowModel(0x800022) had focus (toplevel=WorldWindow(0x400023))
reset_x_focus: widget with focus: None
Take Focus -> world window
sending WM_TAKE_FOCUS: 0x400023, X11 timestamp=90448465L
world window got focus: <gtk.gdk.Event at 0x7f9e92671f00: GDK_FOCUS_CHANGE>, has-toplevel-focus=True
client   1 @20.185 recheck_focus() wid=1, focused=None, latest=False
  • with python3 / GTK3:
process_focus: wid=0
focus wid=0 has_focus=1
reset_focus() 1 / WindowModel(0x600022) had focus (toplevel=None)

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

@totaam
Copy link
Collaborator Author

totaam commented Apr 10, 2020

2020-04-10 09:07:27: stdedos commented


Replying to [comment:6 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? 😕

@totaam
Copy link
Collaborator Author

totaam commented Apr 10, 2020

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.

@totaam
Copy link
Collaborator Author

totaam commented Apr 10, 2020

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)

@totaam
Copy link
Collaborator Author

totaam commented Apr 11, 2020

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.

@totaam
Copy link
Collaborator Author

totaam commented Apr 14, 2020

2020-04-14 15:47:19: stdedos commented


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](../commit/90a2db9fa57c01c3c1513075421ba1adf8af998f)\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](../commit/90a2db9fa57c01c3c1513075421ba1adf8af998f) 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-26081 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant