Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.94k stars 165 forks source link

GTK2: pcmanfm: some mouse events missing #2390

Closed totaam closed 5 years ago

totaam commented 5 years ago

Issue migrated from trac ticket # 2390

component: client | priority: critical | resolution: fixed

2019-08-18 14:26:58: mviereck created the issue


Debian bullseye with xpra v3.0-r23522

pcmanfm (GTK2) does not react on some mouse events. This affects e.g. OK/Close buttons and checkboxes in "Settings". However, opening folders and choosing menu entries works.

This does not affect pcmanfm-qt (QT5).

Example to reproduce:

xpra start :30 --xvfb="/usr/bin/Xvfb :30" --start "pcmanfm" --daemon=no
xpra attach :30
totaam commented 5 years ago

2019-08-18 14:27:55: mviereck changed component from android to client

totaam commented 5 years ago

2019-08-18 17:15:51: antoine changed status from new to assigned

totaam commented 5 years ago

2019-08-18 17:15:51: antoine commented


I don't see any "Settings" when I run pcmanfm, but I do have a "Preferences" dialog - I assume this is the one you meant. When running on Fedora 30, I don't have any problems with mouse events, but I do see a difference: all the windows are slightly greyed out, like it does when running natively and you take the focus away. Maybe we're not sending all the focus events that the application expects.

totaam commented 5 years ago

2019-08-18 17:24:17: mviereck commented


I don't see any "Settings" when I run pcmanfm, but I do have a "Preferences" dialog - I assume this is the one you meant.

Yes.

I do see a difference: all the windows are slightly greyed out, like it does when running natively and you take the focus away.

I've seen this sometimes, too, but not in my current tests.

When running on Fedora 30, I don't have any problems with mouse events

I just checked again. If I click multiple times on a button, randomly one click works.

totaam commented 5 years ago

2019-08-18 17:42:27: mviereck commented


Maybe related: I have an odd issue if I use xpra to show firefox in a Docker container.

  • The mouse cursor does not change to a "finger hand" if I move it on a link.
  • If I click the link, the mouse cursor becomes a "finger hand", but does not become an arrow on the new website, but continous to be a "finger hand" until I click onto something.
  • Same goes for e.g. the URL field where the cursor should become an "Edit cursor". It needs a click, and than stays to be an "edit cursor" everywhere.
  • Popup windows that should show up under the cursor without a click don't show up.
  • Links are not shown at the bottom of the browser if the cursor points on them.

This only applies to firefox in container shown with xpra. It does not apply to firefox on host shown with xpra. It does not apply to firefox in container shown with nxagent or Xephyr. Changing many xpra or X options does not make a difference.

This issue is odd and quite special. I cannot track it down properly, so I hesitated to open a ticket so far. However, it might be a focus event issue, too.

To reproduce you need Docker and x11docker:

x11docker --xpra -- --shm-size=4G -- jess/firefox
totaam commented 5 years ago

2019-08-19 03:50:14: antoine commented


The cursor thing is probably unrelated, maybe GTK fails to load the default cursors - for whatever reason. The server's log with -d cursor should show us what is going on.

totaam commented 5 years ago

2019-08-19 08:40:40: mviereck commented


I've check with xpra v2.5-r23270 (Latest v2.5 available): Both pcmanfm and firefox behave as expected. Issue occures with v3.0-r22234 and v3.0-r23522 (oldest and latest v3.0 I have available)

The cursor thing is probably unrelated, maybe GTK fails to load the default cursors - for whatever reason.

The actions are missing, too. E.g. showing the UrL at the bottom of the browser window if the cursor is above a link. It seems the mouse position is not submitted until I click a mouse button.

The server's log with -d cursor should show us what is going on.

Actions:

  • Moving cursor on a text input field. (Cursor stays to be an arrow)
  • Clicking text field. (Cursor becomes an "edit cursor")
  • Moving cursor on a link. (Cursor is still an "edit cursor")
  • Clicking link. (Cursor becomes "finger hand", changes to arrow on new website. Link URL appeared at window bottom while clicking the link.)
    
    x11docker [09:46:41,306]: Starting Xpra server
    xpra for python 2.7 is not installed
    retrying with python3
    2019-08-19 09:46:43,166 created unix domain socket: /home/lauscher/.cache/x11docker/test-0079527/buster-102
    2019-08-19 09:46:43,295 pointer device emulation using XTest
    2019-08-19 09:46:43,577 Warning: no XShm support on display b':102'
    2019-08-19 09:46:43,618 get_default_cursor=[960, 540, 16, 16, 7, 7, 1, b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff', b'']
    2019-08-19 09:46:46,510  OpenGL is supported on display ':102'
    2019-08-19 09:46:46,510  using 'llvmpipe (LLVM 8.0, 128 bits)' renderer

(Xpra:17036): Gtk-CRITICAL **: 09:46:46.755: gtk_widget_realize: assertion 'widget->priv->anchored || GTK_IS_INVISIBLE (widget)' failed 2019-08-19 09:46:46,771 xpra GTK3 X11 version 3.0-r22234 64-bit 2019-08-19 09:46:46,771 uid=1000 (lauscher), gid=1000 (lauscher) 2019-08-19 09:46:46,772 running with pid 17036 on Linux Debian testing bullseye 2019-08-19 09:46:46,773 connected to X11 display :102 with 24 bit colors 2019-08-19 09:46:46,881 xpra is ready. 2019-08-19 09:46:51,378 New unix-domain connection received on /home/lauscher/.cache/x11docker/test-0079527/buster-102 2019-08-19 09:46:51,385 Handshake complete; enabling connection 2019-08-19 09:46:51,411 client clipboard does not include contents slice fix 2019-08-19 09:46:51,416 mmap is enabled using 256MB area in /run/user/1000/xpra/xpra.37zytoen.mmap 2019-08-19 09:46:51,421 Python/GTK3 Linux Debian testing bullseye x11 client version 3.0-r22234 64-bit 2019-08-19 09:46:51,422 connected from 'buster' as 'lauscher' - 'Lauscher' 2019-08-19 09:46:51,430 setting key repeat rate from client: 500ms delay / 37ms interval 2019-08-19 09:46:51,433 setting keymap: 2019-08-19 09:46:51,478 setting keyboard layout to 'de' 2019-08-19 09:46:51,730 waiting for video encoders initialization 2019-08-19 09:46:51,865 6.8GB of system memory 2019-08-19 09:46:51,865 client root window size is 1920x1080 with 1 display: 2019-08-19 09:46:51,866 :0.0 (508x285 mm - DPI: 96x96) workarea: 1871x1045 at 49x35 2019-08-19 09:46:51,867 eDP (344x193 mm - DPI: 141x142) 2019-08-19 09:46:51,884 send_initial_cursors() cursor_sizes=(22, (width=128, height=128)) 2019-08-19 09:46:51,889 client @02.415 Xpra GTK3 X11 server version 3.0-r22234 64-bit 2019-08-19 09:46:51,890 client @02.416 running on Linux Debian testing bullseye 2019-08-19 09:46:51,893 client @02.420 Attached to :102 2019-08-19 09:46:51,893 client @02.421 (press Control-C to detach) 2019-08-19 09:46:51,897 get_cursor_image() cursor=[960, 540, 16, 16, 7, 7, 1, '1024 bytes', b''] 2019-08-19 09:46:51,898 get_cursor_data(): default cursor - clearing it 2019-08-19 09:46:51,898 send_empty_cursor(..) 2019-08-19 09:46:51,996 client @02.522 server does not support xi input devices 2019-08-19 09:46:51,996 client @02.523 server uses: xtest 2019-08-19 09:46:52,094 New unix-domain connection received on /home/lauscher/.cache/x11docker/test-0079527/buster-102 2019-08-19 09:46:55,333 Weird corruption in _NET_WM_ICON: unpack requires a buffer of 16 bytes 2019-08-19 09:46:57,293 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0x58e', 'delivered_to': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'window': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'cursor_serial': '2', 'cursor_name': 'left_ptr'}> 2019-08-19 09:46:57,306 get_cursor_image() cursor=[840, 320, 24, 24, 4, 4, 2, '2304 bytes', b'left_ptr'] 2019-08-19 09:46:57,307 do_send_cursor(..) pixels=LevelCompressed(cursor: 763 bytes as lz4/21) 2019-08-19 09:46:57,308 do_send_cursor(..) 24x24 raw cursor name='left_ptr', serial=0x2 with delay=10 (cursor_encodings=['raw']) 2019-08-19 09:47:01,072 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0x9eb', 'delivered_to': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'window': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'cursor_serial': '3', 'cursor_name': 'xterm'}> 2019-08-19 09:47:01,084 get_cursor_image() cursor=[771, 185, 24, 24, 11, 12, 3, '2304 bytes', b'xterm'] 2019-08-19 09:47:01,085 do_send_cursor(..) pixels=LevelCompressed(cursor: 281 bytes as lz4/21) 2019-08-19 09:47:01,085 do_send_cursor(..) 24x24 raw cursor name='xterm', serial=0x3 with delay=10 (cursor_encodings=['raw']) 2019-08-19 09:47:06,915 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0x1052', 'delivered_to': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'window': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'cursor_serial': '4', 'cursor_name': 'hand2'}> 2019-08-19 09:47:06,927 get_cursor_image() cursor=[747, 533, 24, 24, 8, 5, 4, '2304 bytes', b'hand2'] 2019-08-19 09:47:06,928 do_send_cursor(..) pixels=LevelCompressed(cursor: 826 bytes as lz4/21) 2019-08-19 09:47:06,928 do_send_cursor(..) 24x24 raw cursor name='hand2', serial=0x4 with delay=10 (cursor_encodings=['raw']) 2019-08-19 09:47:08,125 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0x1329', 'delivered_to': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'window': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'cursor_serial': '2', 'cursor_name': 'left_ptr'}> 2019-08-19 09:47:08,136 get_cursor_image() cursor=[296, 580, 24, 24, 4, 4, 2, '2304 bytes', b'left_ptr'] 2019-08-19 09:47:08,137 do_send_cursor(..) pixels=LevelCompressed(cursor: 763 bytes as lz4/21) 2019-08-19 09:47:08,137 do_send_cursor(..) 24x24 raw cursor name='left_ptr', serial=0x2 with delay=10 (cursor_encodings=['raw']) 2019-08-19 09:47:15,775 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0x1558', 'delivered_to': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'window': '<GdkX11.X11Window object at 0x7fa4db3f4280 (GdkX11Window at 0x1e8c320)>', 'cursor_serial': '1', 'cursor_name': ''}> 2019-08-19 09:47:15,786 get_cursor_image() cursor=[688, 144, 16, 16, 7, 7, 1, '1024 bytes', b''] 2019-08-19 09:47:15,787 get_cursor_data(): default cursor - clearing it 2019-08-19 09:47:15,787 send_empty_cursor(..)

totaam commented 5 years ago

2019-08-19 09:08:04: mviereck commented


Additional check show that it is not a version difference but a python2/3 backend difference.

The issues occur with v2.5 and v3.0 as well if using the python3 backend. The issues do not occur with v2.5 and v3.0 if using the python2 backend.

Both checked with firefox and pcmanfm.

totaam commented 5 years ago

2019-08-20 09:35:23: antoine commented


xpra GTK3 X11 version 3.0-[r22234](../commit/2f1125c85251102408e4ec0290eda7225dc8d751) 64-bit (..) Weird corruption in _NET_WM_ICON: unpack requires a buffer of 16 bytes Can you try something more recent? I'm pretty sure the _NET_WM_ICON bug got squashed, and maybe others too.

totaam commented 5 years ago

2019-08-20 10:32:30: mviereck commented


Can you try something more recent?

Now with xpra v3.0-r23522. Same actions as above; this time the cursor becomes an "edit cursor" on the new website.

x11docker [11:26:21,342]: Starting Xpra server
2019-08-20 11:26:22,823 created unix domain socket: /home/lauscher/.cache/x11docker/test-9317742/buster-102
2019-08-20 11:26:23,036 pointer device emulation using XTest
2019-08-20 11:26:24,439 4x AMD A6-7310 APU with AMD Radeon R4 Graphics
2019-08-20 11:26:24,465 Warning: no XShm support on display :102
2019-08-20 11:26:24,494 xvfb pid not found
2019-08-20 11:26:24,498 get_default_cursor=[960, 540, 16, 16, 7, 7, 1, b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff', b'']

(Xpra:29320): Gtk-CRITICAL **: 11:26:24.679: gtk_widget_realize: assertion 'widget->priv->anchored || GTK_IS_INVISIBLE (widget)' failed
2019-08-20 11:26:24,798 xpra is ready.
2019-08-20 11:26:24,807 xpra GTK3 X11 version 3.0-[r23522](../commit/fb99f3f3d9a3899f257b49ee923ac8b267a78e98) 64-bit
2019-08-20 11:26:24,920 6.8GB of system memory
2019-08-20 11:26:25,000 New unix-domain connection received on /home/lauscher/.cache/x11docker/test-9317742/buster-102
2019-08-20 11:26:25,064 Handshake complete; enabling connection
2019-08-20 11:26:25,097  mmap is enabled using 256MB area in /run/user/1000/xpra/xpra.hs_o2zw2.mmap
2019-08-20 11:26:25,105 Python/GTK3 Linux Debian testing bullseye x11 client version 3.0-[r23522](../commit/fb99f3f3d9a3899f257b49ee923ac8b267a78e98) 64-bit
2019-08-20 11:26:25,105  connected from 'buster' as 'lauscher' - 'Lauscher'
2019-08-20 11:26:25,125 setting key repeat rate from client: 500ms delay / 37ms interval
2019-08-20 11:26:25,128 setting keymap: 
2019-08-20 11:26:25,251 setting keyboard layout to 'de'
2019-08-20 11:26:25,544  uid=1000 (lauscher), gid=1000 (lauscher)
2019-08-20 11:26:25,556  running with pid 29320 on Linux Debian testing bullseye
2019-08-20 11:26:25,695  client root window size is 1920x1080 with 1 display:
2019-08-20 11:26:25,696   :0.0 (508x285 mm - DPI: 96x96) workarea: 1871x1045 at 49x35
2019-08-20 11:26:25,696     eDP (344x193 mm - DPI: 141x142)
2019-08-20 11:26:25,712 cannot find a temporary resolution for Xinerama workaround!
2019-08-20 11:26:25,717 server virtual display now set to 1920x1080
2019-08-20 11:26:25,730 send_initial_cursors() cursor_sizes=(22, (width=128, height=128))
2019-08-20 11:26:25,734  connected to X11 display :102 with 24 bit colors
2019-08-20 11:26:25,738 DPI set to 96 x 96
2019-08-20 11:26:25,747 get_cursor_image() cursor=[960, 540, 16, 16, 7, 7, 1, '1024 bytes', b'']
2019-08-20 11:26:25,747 get_cursor_data(): default cursor - clearing it
2019-08-20 11:26:25,749 client   1 @03.298 Xpra GTK3 X11 server version 3.0-[r23522](../commit/fb99f3f3d9a3899f257b49ee923ac8b267a78e98) 64-bit
2019-08-20 11:26:25,749 send_empty_cursor(..)
2019-08-20 11:26:25,751 client   1 @03.301  running on Linux Debian testing bullseye
2019-08-20 11:26:25,766 client   1 @03.305 Attached to socket:///home/lauscher/.cache/x11docker/test-9317742/buster-102
2019-08-20 11:26:25,767 client   1 @03.306  (press Control-C to detach)
2019-08-20 11:26:25,855 client   1 @03.407 server does not support xi input devices
2019-08-20 11:26:25,856 client   1 @03.408  server uses: xtest
2019-08-20 11:26:26,036 New unix-domain connection received on /home/lauscher/.cache/x11docker/test-9317742/buster-102
2019-08-20 11:26:26,039 New unix-domain connection received on /home/lauscher/.cache/x11docker/test-9317742/buster-102
2019-08-20 11:26:33,782 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0x517', 'delivered_to': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'window': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'cursor_serial': '2', 'cursor_name': 'left_ptr'}>
2019-08-20 11:26:33,793 get_cursor_image() cursor=[960, 540, 24, 24, 4, 4, 2, '2304 bytes', b'left_ptr']
2019-08-20 11:26:33,794 do_send_cursor(..) pixels=LevelCompressed(cursor: 763 bytes as lz4/21) 
2019-08-20 11:26:33,794 do_send_cursor(..) 24x24 raw cursor name='left_ptr', serial=0x2 with delay=10 (cursor_encodings=['raw'])
2019-08-20 11:26:39,681 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0xa83', 'delivered_to': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'window': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'cursor_serial': '3', 'cursor_name': 'xterm'}>
2019-08-20 11:26:39,693 get_cursor_image() cursor=[1316, 119, 24, 24, 11, 12, 3, '2304 bytes', b'xterm']
2019-08-20 11:26:39,694 do_send_cursor(..) pixels=LevelCompressed(cursor: 281 bytes as lz4/21) 
2019-08-20 11:26:39,694 do_send_cursor(..) 24x24 raw cursor name='xterm', serial=0x3 with delay=10 (cursor_encodings=['raw'])
2019-08-20 11:26:46,208 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0x10a4', 'delivered_to': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'window': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'cursor_serial': '4', 'cursor_name': 'hand2'}>
2019-08-20 11:26:46,226 get_cursor_image() cursor=[1300, 803, 24, 24, 8, 5, 4, '2304 bytes', b'hand2']
2019-08-20 11:26:46,227 do_send_cursor(..) pixels=LevelCompressed(cursor: 826 bytes as lz4/21) 
2019-08-20 11:26:46,227 do_send_cursor(..) 24x24 raw cursor name='hand2', serial=0x4 with delay=10 (cursor_encodings=['raw'])
2019-08-20 11:26:47,806 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0x12d2', 'delivered_to': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'window': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'cursor_serial': '2', 'cursor_name': 'left_ptr'}>
2019-08-20 11:26:47,825 get_cursor_image() cursor=[907, 775, 24, 24, 4, 4, 2, '2304 bytes', b'left_ptr']
2019-08-20 11:26:47,827 do_send_cursor(..) pixels=LevelCompressed(cursor: 763 bytes as lz4/21) 
2019-08-20 11:26:47,828 do_send_cursor(..) 24x24 raw cursor name='left_ptr', serial=0x2 with delay=10 (cursor_encodings=['raw'])
2019-08-20 11:26:47,843 cursor_event: <X11:CursorNotify {'send_event': '0', 'serial': '0x12ea', 'delivered_to': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'window': '<GdkX11.X11Window object at 0x7f37c99713c0 (GdkX11Window at 0x14fc320)>', 'cursor_serial': '3', 'cursor_name': 'xterm'}>
2019-08-20 11:26:47,883 get_cursor_image() cursor=[905, 775, 24, 24, 11, 12, 3, '2304 bytes', b'xterm']
2019-08-20 11:26:47,884 do_send_cursor(..) pixels=LevelCompressed(cursor: 281 bytes as lz4/21) 
2019-08-20 11:26:47,885 do_send_cursor(..) 24x24 raw cursor name='xterm', serial=0x3 with delay=10 (cursor_encodings=['raw'])
totaam commented 5 years ago

2019-08-20 13:54:50: antoine commented


Well, that's interesting. The focus issue I'm seeing (pcmanfm showing slightly greyed out) occurs with all client + server combinations except with a python2 client + server. Could there be 2 bugs? Or maybe in the X11 bindings used by both the client and the server.

Here's the -d focus log output when clicking inside the file manager window:

client   1 @23.895 do_xpra_focus_in_event(<X11:FocusIn {'delivered_to': '0x3800075L', 'send_event': '0', 'detail': '3', 'window': '0x3800075L', 'mode': '0', 'serial': '0x2261'}>)
client   1 @23.896 focus-in-event for wid=2
client   1 @23.897 do_xpra_focus_in_event(<gtk.gdk.Event at 0x7f0551c7ed28: GDK_FOCUS_CHANGE>)
client   1 @23.898 GLClientWindow(2 : gtk2.GLDrawingArea(2, (1005, 762), None)) focus_change(GLClientWindow(2 : gtk2.GLDrawingArea(2, (1005, 762), None)), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
client   1 @23.900 update_focus(2, True) focused=None, grabbed=None
client   1 @23.900 send_focus(2)
client   1 @23.901 recheck_focus() wid=2, focused=2, latest=True
process_focus: wid=2
focus wid=2 has_focus=0
focus: giving focus to WindowModel(0xc00007)
Giving focus to 0xc00007
... using XSetInputFocus
... using WM_TAKE_FOCUS
sending WM_TAKE_FOCUS: 0xc00007, X11 timestamp=15832800L
focus: will set modified mask to ('mod2',) using <bound method ClientConnection.make_keymask_match of ClientConnection(1 : Protocol(unix-domain socket:/run/user/1000/xpra/localhost.localdomain-2))>
world window lost focus: <gtk.gdk.Event at 0x7f32146f3d00: GDK_FOCUS_CHANGE>
focus_in_event(<X11:FocusIn {'delivered_to': '0xc00007L', 'send_event': '0', 'detail': '3', 'window': '0xc00007L', 'mode': '0', 'serial': '0x15e6'}>) mode=NotifyNormal, detail=NotifyNonlinear
focus_out_event(<X11:FocusOut {'delivered_to': '0xc00007L', 'send_event': '0', 'detail': '2', 'window': '0xc00007L', 'mode': '0', 'serial': '0x15eb'}>) mode=NotifyNormal, detail=NotifyInferior
client   1 @23.916 do_xpra_focus_out_event(<X11:FocusOut {'delivered_to': '0x3800075L', 'send_event': '0', 'detail': '2', 'window': '0x3800075L', 'mode': '0', 'serial': '0x2274'}>)
client   1 @23.918 do_xpra_focus_in_event(<X11:FocusIn {'delivered_to': '0x3800075L', 'send_event': '0', 'detail': '0', 'window': '0x3800075L', 'mode': '0', 'serial': '0x2274'}>)
client   1 @23.919 recheck_focus() wid=2, focused=2, latest=True

With a python3 client:

client   2 @14.567 focus-in-event for wid=2
client   2 @14.568 do_xpra_focus_in_event(<Gdk.EventFocus object at 0x7fba70752fb0 (void at 0x561e704eb5d0)>)
client   2 @14.569 GLClientWindow(2 : gtk3.GLDrawingArea(2, (1005, 762), None)) focus_change(GLClientWindow(2 : gtk3.GLDrawingArea(2, (1005, 762), None)), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
client   2 @14.569 update_focus(2, True) focused=None, grabbed=None
client   2 @14.570 send_focus(2)
process_focus: wid=2
focus wid=2 has_focus=0
focus: giving focus to WindowModel(0xc00007)
Giving focus to 0xc00007
client   2 @14.573 recheck_focus() wid=2, focused=2, latest=True
... using XSetInputFocus
... using WM_TAKE_FOCUS
sending WM_TAKE_FOCUS: 0xc00007, X11 timestamp=16098494L
focus: will set modified mask to ('mod2',) using <bound method ClientConnection.make_keymask_match of ClientConnection(2 : Protocol(unix-domain socket:/run/user/1000/xpra/localhost.localdomain-2))>
world window lost focus: <gtk.gdk.Event at 0x7f32159ecb48: GDK_FOCUS_CHANGE>
focus_in_event(<X11:FocusIn {'delivered_to': '0xc00007L', 'send_event': '0', 'detail': '3', 'window': '0xc00007L', 'mode': '0', 'serial': '0x29c6'}>) mode=NotifyNormal, detail=NotifyNonlinear
focus_out_event(<X11:FocusOut {'delivered_to': '0xc00007L', 'send_event': '0', 'detail': '2', 'window': '0xc00007L', 'mode': '0', 'serial': '0x29cc'}>) mode=NotifyNormal, detail=NotifyInferior

So the only difference is that the python2 client ends up calling do_xpra_focus_out_event + do_xpra_focus_in_event + recheck_focus.

Starting with XPRA_X11_DEBUG_EVENTS=FocusIn,FocusOut python2 /usr/bin/xpra ..., the X11 focus events look like this:

client   1 @31.304 FocusOut event 0x1c70 : <X11:FocusOut {'delivered_to': '0x380007eL', 'send_event': '0', 'detail': '2', 'window': '0x380007eL', 'mode': '0', 'serial': '0x1c70'}>
client   1 @31.305   delivering event to window itself: 0x380007e  (signal=xpra-focus-out-event)
client   1 @31.305   forwarding event to a GLClientWindow window 0x380007e handler's xpra-focus-out-event signal
client   1 @31.306 do_xpra_focus_out_event(<X11:FocusOut {'delivered_to': '0x380007eL', 'send_event': '0', 'detail': '2', 'window': '0x380007eL', 'mode': '0', 'serial': '0x1c70'}>)
client   1 @31.307   forwarded
client   1 @31.307   no handler registered for catchall-signal (None), ignoring event
client   1 @31.308 FocusIn event 0x1c70 : <X11:FocusIn {'delivered_to': '0x380007eL', 'send_event': '0', 'detail': '0', 'window': '0x380007eL', 'mode': '0', 'serial': '0x1c70'}>
client   1 @31.309   delivering event to window itself: 0x380007e  (signal=xpra-focus-in-event)
client   1 @31.309   forwarding event to a GLClientWindow window 0x380007e handler's xpra-focus-in-event signal
client   1 @31.310 do_xpra_focus_in_event(<X11:FocusIn {'delivered_to': '0x380007eL', 'send_event': '0', 'detail': '0', 'window': '0x380007eL', 'mode': '0', 'serial': '0x1c70'}>)
client   1 @31.310   forwarded
client   1 @31.310   no handler registered for catchall-signal (None), ignoring event
client   1 @31.311 recheck_focus() wid=2, focused=2, latest=True

Looks like the X11 filter is not running with python3 / gtk3? Could be related to r23369, #812, #2342.

totaam commented 5 years ago

2019-08-20 15:10:22: antoine commented


With full x11 debug logging, the python2 client sees (amongst dozens of other X11 events):

parse_event(..)=<X11:FocusOut {'delivered_to': '0x3800063L', 'send_event': '0', 'detail': '3', 'window': '0x3800063L', 'mode': '0', 'serial': '0x93a'}>
FocusOut event 0x93a : <X11:FocusOut {'delivered_to': '0x3800063L', 'send_event': '0', 'detail': '3', 'window': '0x3800063L', 'mode': '0', 'serial': '0x93a'}>
  delivering event to window itself: 0x3800063  (signal=xpra-focus-out-event)
  forwarding event to a GLClientWindow window 0x3800063 handler's xpra-focus-out-event signal

Whereas the python3 / gtk3 client does not see any focus events...

We need to call X11Window.selectFocusChange with GTK3, this was not needed with GTK2. To do that and correctly register the gobject signals for focus events, we have to re-arrange the window class hierarchy a bit. And even then, I'm still getting the greyed out window..

totaam commented 5 years ago

2019-08-20 15:10:59: antoine uploaded file gtk3-focus.patch (14.8 KiB)

work in progress patch

totaam commented 5 years ago

2019-08-21 09:49:05: antoine commented


With the patch, the client debug shows:

  • python2:
    FocusIn event 0x3670 : <X11:FocusIn {'delivered_to': '0x3800063L', 'send_event': '0', 'detail': '3', 'window': '0x3800063L', 'mode': '0', 'serial': '0x3670'}>
    delivering event to window itself: 0x3800063  (signal=xpra-focus-in-event)
    forwarding event to a GLClientWindow window 0x3800063 handler's xpra-focus-in-event signal
    do_xpra_focus_in_event(<X11:FocusIn {'delivered_to': '0x3800063L', 'send_event': '0', 'detail': '3', 'window': '0x3800063L', 'mode': '0', 'serial': '0x3670'}>)
    forwarded
    no handler registered for catchall-signal (None), ignoring event
    focus-in-event for wid=4
    do_xpra_focus_in_event(<gtk.gdk.Event at 0x7f7091f877b0: GDK_FOCUS_CHANGE>)
    GLClientWindow(4 : gtk2.GLDrawingArea(4, (1005, 762), None)) focus_change(GLClientWindow(4 : gtk2.GLDrawingArea(4, (1005, 762), None)), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
    update_focus(4, True) focused=None, grabbed=None
    send_focus(4)
    recheck_focus() wid=4, focused=4, latest=True
    FocusOut event 0x3683 : <X11:FocusOut {'delivered_to': '0x3800063L', 'send_event': '0', 'detail': '2', 'window': '0x3800063L', 'mode': '0', 'serial': '0x3683'}>
    delivering event to window itself: 0x3800063  (signal=xpra-focus-out-event)
    forwarding event to a GLClientWindow window 0x3800063 handler's xpra-focus-out-event signal
    do_xpra_focus_out_event(<X11:FocusOut {'delivered_to': '0x3800063L', 'send_event': '0', 'detail': '2', 'window': '0x3800063L', 'mode': '0', 'serial': '0x3683'}>)
    forwarded
    no handler registered for catchall-signal (None), ignoring event
    FocusIn event 0x3683 : <X11:FocusIn {'delivered_to': '0x3800063L', 'send_event': '0', 'detail': '0', 'window': '0x3800063L', 'mode': '0', 'serial': '0x3683'}>
    delivering event to window itself: 0x3800063  (signal=xpra-focus-in-event)
    forwarding event to a GLClientWindow window 0x3800063 handler's xpra-focus-in-event signal
    do_xpra_focus_in_event(<X11:FocusIn {'delivered_to': '0x3800063L', 'send_event': '0', 'detail': '0', 'window': '0x3800063L', 'mode': '0', 'serial': '0x3683'}>)
    forwarded
    no handler registered for catchall-signal (None), ignoring event
    recheck_focus() wid=4, focused=4, latest=True
  • python3:
    FocusIn event 0x9d1 : <X11:FocusIn {'send_event': '0', 'serial': '0x9d1', 'delivered_to': '0x3800024', 'window': '0x3800024', 'mode': '0', 'detail': '3'}>
    delivering event to window itself: 0x3800024  (signal=xpra-focus-in-event)
    forwarding event to a GLClientWindow window 0x3800024 handler's xpra-focus-in-event signal
    do_xpra_focus_in_event(<X11:FocusIn {'send_event': '0', 'serial': '0x9d1', 'delivered_to': '0x3800024', 'window': '0x3800024', 'mode': '0', 'detail': '3'}>)
    forwarded
    no handler registered for catchall-signal (None), ignoring event
    focus-in-event for wid=4
    do_xpra_focus_in_event(<Gdk.EventFocus object at 0x7f6c582d0f50 (void at 0x55bdfc63b000)>)
    GLClientWindow(4 : gtk3.GLDrawingArea(4, (1005, 762), None)) focus_change(GLClientWindow(4 : gtk3.GLDrawingArea(4, (1005, 762), None)), <GParamBoolean 'has-toplevel-focus'>) has-toplevel-focus=True, _been_mapped=True
    update_focus(4, True) focused=None, grabbed=None
    send_focus(4)
    recheck_focus() wid=4, focused=4, latest=True
    FocusOut event 0x9d9 : <X11:FocusOut {'send_event': '0', 'serial': '0x9d9', 'delivered_to': '0x3800024', 'window': '0x3800024', 'mode': '0', 'detail': '2'}>
    delivering event to window itself: 0x3800024  (signal=xpra-focus-out-event)
    forwarding event to a GLClientWindow window 0x3800024 handler's xpra-focus-out-event signal
    do_xpra_focus_out_event(<X11:FocusOut {'send_event': '0', 'serial': '0x9d9', 'delivered_to': '0x3800024', 'window': '0x3800024', 'mode': '0', 'detail': '2'}>)
    forwarded
    no handler registered for catchall-signal (None), ignoring event
    recheck_focus() wid=4, focused=4, latest=False
    window_ungrab()
    update_focus(4, False) focused=4, grabbed=None
    send_focus(0)

    So the key difference is that GTK2 gets a FocusIn event immediately after the FocusOut (that's why we have the recheck_focus() code), but GTK3 does not. This may be caused by the extra widget? Maybe we need to receive events on that?

totaam commented 5 years ago

2019-08-21 13:09:17: antoine commented


Adding extra debug, the missing FocusIn event is a detail=NotifyAncestor. According to 10.7.1 Normal Focus Events and Focus Events While Grabbed the only NotifyAncestor FocusIn event happens when When the focus moves from window A to window B, B is an inferior of A, and the pointer is in window P, the X server does the following: (...) It generates a FocusIn event on window B, with the detail member of the XFocusInEvent structure set to NotifyAncestor

totaam commented 5 years ago

2019-08-22 02:30:01: antoine changed priority from major to critical

totaam commented 5 years ago

2019-08-22 02:30:01: antoine commented


Looking at the window hierarchy:

  • python2 opengl off:
     0x40b285 (has no name): ()  1025x817+482+109  +482+109
        1 child:
        0x3a000b9 "pcmanfm on localhost.localdomain": ("pcmanfm" "Pcmanfm")  1005x762+10+45  +492+154
           1 child:
           0x3a000ba (has no name): ()  1x1+-1+-1  +491+153
  • python2 opengl on:
     0x40b598 (has no name): ()  1025x817+482+109  +482+109
        1 child:
        0x3a0007d "pcmanfm on localhost.localdomain": ("pcmanfm" "Pcmanfm")  1005x762+10+45  +492+154
           2 children:
           0x3a00081 (has no name): ()  1005x762+0+0  +492+154
           0x3a0007e (has no name): ()  1x1+-1+-1  +491+153
  • python3 (with and without opengl - same structure):
     0x40b2e6 (has no name): ()  1025x817+482+109  +482+109
        1 child:
        0x3a0001e "pcmanfm on localhost.localdomain": ("pcmanfm" "Pcmanfm")  1005x762+10+45  +492+154
           2 children:
           0x3a00022 (has no name): ()  1005x762+0+0  +492+154
           0x3a0001f (has no name): ()  1x1+-1+-1  +491+153

    So that's not it since python2 with opengl has the same structure: the window manager frame, the window, the widget (+ a 1x1 event window)

Raising priority has this has to be fixed before the release.

totaam commented 5 years ago

2019-08-22 02:56:13: antoine commented


r23556 adds a simple test case showing the differences in events received by the window when running under python2 + gtk2 vs python3 + gtk3.

totaam commented 5 years ago

2019-08-22 07:47:35: antoine commented


Summary of focus events received:

  • python2:
    • FocusIn: NotifyNonlinear
    • FocusOut: NotifyInferior + FocusIn: NotifyAncestor (both from same event no)
  • python3: same but without NotifyAncestor

I believe we can drop the FocusOut: NotifyInferior since this is only sent when the focus goes to a sub-window (ie: the drawing area widget) - this is actually a better way of doing things than the current recheck_focus method. But that's not all... The "focus" is still incorrect with python3, the reason why the window shows up as greyed out is because the python2 client correctly sends a:

configure-window : ['configure-window', 1, 0, 71, 499, 316, {}, 0, {'focused': True}, True, 1, (347, 245), ('mod2',)]

There are many different types of focus... this one is part of the metadata and affects the _NET_WM_STATE, not the X11 focus!

And with python3, the property_changed code doesn't fire because the atom value is no longer a string with GTK3 (though it looks like one in the debug output..)

Client side fix on its way. Next... the server side, which has another bug!?

totaam commented 5 years ago

2019-08-22 10:54:15: antoine changed status from assigned to new

totaam commented 5 years ago

2019-08-22 10:54:15: antoine changed owner from antoine to mviereck

totaam commented 5 years ago

2019-08-22 10:54:15: antoine commented


Fixes in:

  • r23558: atoms bug (also found in other places: r23563)
  • r23559: skip NotifyInferior (not yet safe to remove "recheck_focus"?)
  • r23560: ensure all client window implementations inherit the focus signals
  • r23562: server fix (usual python3 byte strings nonsense)

Backports in 23564 + 23565.

@mviereck: does that fix things for you? (updated beta buster packages are available)

totaam commented 5 years ago

2019-08-22 11:58:02: mviereck commented


@mviereck: does that fix things for you?

Unfortunately no. Tested with xpra v3.0-r23563. Same issues as before with pcmanfm on host and in container, and with firefox in container.

Meanwhile I found that I could reproduce the greyed-out effect with mousepad (GTK3, text editor of xfce). Its menu is still greyed out, too. But it behaves correctly after clicking into the menu the first time. Than the grey-out follows the window focus. With previous xpra versions it stayed to be grey. However, the full functionality of mousepad was and is given.

If I can provide debug logs or do any tests, please tell me.

totaam commented 5 years ago

2019-08-23 06:16:42: antoine changed status from new to assigned

totaam commented 5 years ago

2019-08-23 06:16:42: antoine changed owner from mviereck to antoine

totaam commented 5 years ago

2019-08-23 06:16:42: antoine commented


I have just found two more bugs related to focus (amazing how many bugs are lurking in this one seemingly small and simple area!):

  • r23569: a bug in the multi-user code may have prevented focus attributes from being applied - leaving the window greyed out
  • r23570: also get "focus" window state from GTK, not sure why this wasn't done before.. I'll make some new builds shortly.

Are you running under wayland? Does it happen under Xorg? I did see some weirdness under weston. But then again, it doesn't seem ready for production use as I can crash the whole thing at will 100% reliably:

(gdb) bt
#0  0x00007fc1ab8d3609 in weston_surface_destroy () at /lib64/libweston-6.so.0
#1  0x00007fc1a7bf4d74 in  () at /usr/lib64/weston/desktop-shell.so
#2  0x00007fc1ab8b02d3 in wl_event_loop_dispatch_idle () at /lib64/libwayland-server.so.0
#3  0x00007fc1ab8b038a in wl_event_loop_dispatch () at /lib64/libwayland-server.so.0
#4  0x00007fc1ab8aef25 in wl_display_run () at /lib64/libwayland-server.so.0
#5  0x000055bf52f69e9f in  ()
#6  0x00007fc1ab66ef33 in __libc_start_main () at /lib64/libc.so.6
#7  0x000055bf52f6b02e in _start ()

Compare that to Xorg which is nearly impossible to crash from a userspace application... I'm not anti-wayland, but there is some way to go. And mixing the window manager with the display manager, as is done in all implementations, it just asking for trouble.

totaam commented 5 years ago

2019-08-23 07:40:22: mviereck commented


amazing how many bugs are lurking in this one seemingly small and simple area!

Good that you take it with some humor. :-)

Are you running under wayland? Does it happen under Xorg?

Xfce under Xorg. For Wayland tests I use a nested Weston or KWin running in an Xfce window.

Compare that to Xorg which is nearly impossible to crash from a userspace application...

Sometimes I manage to crash Weston, too. That's a no-go. And Gnome 3 has its own serious issues, under Xorg and Wayland as well.

I'm not anti-wayland, but there is some way to go. And mixing the window manager with the display manager, as is done in all implementations, it just asking for trouble.

I totally agree.

totaam commented 5 years ago

2019-08-23 08:22:28: antoine commented


New beta builds uploaded... For DEB only as a unit test is failing, and now I have to figure out what broke.

totaam commented 5 years ago

2019-08-23 08:41:46: mviereck commented


Now with xpra v3.0-r23570:

  • mousepad gets the focus correctly since startup, grey menu always follows focus. -> fixed.
  • Same issues with pcmanfm on host and in container (some mouse clicks only work randomly, especially on buttons. Opening folders always works.)
  • Same issues with firefox in container (cursor does not change accordingly, URLs not shown on mouse-over-link)
totaam commented 5 years ago

2019-08-23 16:33:26: antoine commented


now I have to figure out what broke. r23571 fixes that: there is no "focused" state with GTK2, which is why we didn't have it until now.

I can reproduce the pointer issue with both firefox and pcmanfm, but only with a debian server, which makes it harder to work on. I thought it might be related to how we skip calling raise_window(), but forcing it does not help (see r23574). Using Firefox, if I click and drag over a link, the URL is shown. So something is behaving differently when the mouse buttons are pressed.

totaam commented 5 years ago

2019-08-23 18:11:06: antoine changed status from assigned to new

totaam commented 5 years ago

2019-08-23 18:11:06: antoine changed owner from antoine to mviereck

totaam commented 5 years ago

2019-08-23 18:11:06: antoine commented


One noticeable difference with the GTK3 server is how we are now missing the "motion-signal". So on a hunch, I switched from GTK to native calls for setting the client window's event mask: r23575. This seems to have fixed the problem on Debian bullseye. My guess is that the GTK version shipped in Debian removes some of the events in the mask.

New beta packages posted, including beta for "bullseye". @mviereck: can you still find something wrong with those builds?

totaam commented 5 years ago

2019-08-23 18:32:04: mviereck commented


@mviereck: can you still find something wrong with those builds?

Great! All issues are gone in xpra v3.0-r23575. firefox, mousepad and pcmanfm behave correctly in all setups.

My guess is that the GTK version shipped in Debian removes some of the events in the mask.

That's odd.

It should be possible to use GTK only instead of calling X11 directly. It is often recommended to use pure GTK3 or QT5 to be compatible with Wayland and X as well. I hope you'll find a solution. However, for now I am happy. Thank you! This was a hard one.

totaam commented 5 years ago

2019-08-24 04:53:50: antoine changed status from new to closed

totaam commented 5 years ago

2019-08-24 04:53:50: antoine set resolution to fixed

totaam commented 5 years ago

2019-08-24 04:53:50: antoine commented


Great! All issues are gone in xpra v3.0-r23575. Closing at last! Thanks for your patience.

It should be possible to use GTK only instead of calling X11 directly. For xpra, it tends to be the opposite: GTK made it easier to get things implemented originally but now is just getting in the way by adding an extra abstraction layer. It is often recommended to use pure GTK3 or QT5 to be compatible with Wayland and X as well. Wayland servers will require a complete rewrite of that low-level window layer anyway, likely in Cython since there aren't any viable or complete python bindings.

totaam commented 4 years ago

2019-10-15 13:16:45: antoine commented


Caused a regression: #2423

totaam commented 4 years ago

2019-12-03 06:38:28: antoine commented


And another regression on macos with opengl: #2491