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

kaptain: wrong pointer and keyboard focus for concurrent windows #2255

Closed
totaam opened this issue Apr 4, 2019 · 10 comments
Closed

kaptain: wrong pointer and keyboard focus for concurrent windows #2255

totaam opened this issue Apr 4, 2019 · 10 comments
Labels

Comments

@totaam
Copy link
Collaborator

totaam commented Apr 4, 2019

Issue migrated from trac ticket # 2255

component: client | priority: minor | resolution: invalid

2019-04-04 17:17:50: mviereck created the issue


I have encountered an odd issue with kaptain.

kaptain is a quite old GUI frontend für CLI commands.
A repository is here: https://github.com/mviereck/kaptain

Code to reproduce:

xpra start :22
xpra attach :22
DISPLAY=:22 kaptain /dev/stdin <<< 'start -> @close="exit" @fork("xterm")="xterm";'

This creates a small dialog that allows to run xterm. The xterm window does not get keyboard or mouse input and cannot be closed. It can be moved and maximized.

Other applications started with DISPLAY=:22 command are affected, too.

I've tested with and without OpenGL, with xpra-py2 and xpra-py3 and with xpra versions 2.5 and 3.0 on debian buster.

The issue seems to be special for the combination of kaptain and xpra. It works well with other X servers like Xephyr or nxagent.

This might or might not be related to https://www.xpra.org/trac/ticket/1941#comment:8

Do you have an idea?

@totaam
Copy link
Collaborator Author

totaam commented Apr 4, 2019

2019-04-04 17:21:55: mviereck changed title from kaptain: wrong pointer and keyboard focus for oncurrent windows to kaptain: wrong pointer and keyboard focus for concurrent windows

@totaam
Copy link
Collaborator Author

totaam commented Apr 5, 2019

2019-04-05 06:20:20: antoine changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Apr 5, 2019

2019-04-05 06:20:20: antoine set resolution to invalid

@totaam
Copy link
Collaborator Author

totaam commented Apr 5, 2019

2019-04-05 06:20:20: antoine commented


First, as I keep having to repeat this, I really hope that you already know that you should not be using the form:

DISPLAY=:NN someapp

To start applications on the xpra display, always use xpra start --start=someapp instead.
If the command is a shell command, you can wrap it: --start="sh -c 'whatever shell command goes here'"


As for the bug. Running the client with -d metadata, we can see the kaptain window coming up:

process_new_common: [4, 0, 0, 104, 97, {b'xid': b'0xc00003', b'client-machine': b'desktop', b'pid': 25991, b'title': b'kaptain', \
    b'class-instance': (b'kaptain', b'Kaptain'), b'group-leader-xid': 12582917, b'window-type': (b'DIALOG', b'NORMAL'), \
    b'size-constraints': {b'gravity': 1, b'minimum-size': (104, 97)}, b'icon-title': b'', b'decorations': 30, b'modal': True, \
    b'iconic': False}], ..., OR=False

It is a DIALOG modal window, and so it will capture all input until dismissed. For details see #1895.

When forwarding multiple applications through the same xpra connection and one of the windows is modal, you need to tell xpra not to honour the modal flag for that session:

xpra attach --modal-windows=no

FYI: the latest GTK API (Gtk.Window.set_modal) still does not allow more fine grained settings than just on and off. (qt does: WindowModality but even then we wouldn't be able to specify which windows this needs to apply to).

@totaam totaam closed this as completed Apr 5, 2019
@totaam
Copy link
Collaborator Author

totaam commented Apr 5, 2019

2019-04-05 09:20:31: mviereck commented


Great, thank you! --modal-windows=no fixed it for me.

First, as I keep having to repeat this, I really hope that you already know that you should not be using the form: DISPLAY=:NN someapp

I am aware of that. However, in the context of x11docker that is not possible because the applications run in an isolated container that xpra cannot access. At least x11docker sets the environment variables that xpra sets for its clients.

Thank you for giving some insight, too! It helps me to understand what is going on.

Though, I am wondering why the issue does not appear if I run kaptain on other X servers or on display :0. I've also tried a few different window managers (kwin, xfwm4, openbox). Maybe it is common to ignore the modal flag, and only xpra honours it by default.

Just an idea: You could allow XPRA_MODAL_WINDOWS=0 to set --modal-windows=no.

@totaam
Copy link
Collaborator Author

totaam commented Apr 5, 2019

2019-04-05 12:46:16: antoine commented


Maybe it is common to ignore the modal flag, and only xpra honours it by default.
They do honour it, but this modal flag is per application - it just so happens that xpra ends up being multiple applications that the window manager sees as just one.

Just an idea: You could allow XPRA_MODAL_WINDOWS=0 to set --modal-windows=no.
XPRA_MODAL_WINDOWS has been removed earlier today.

@totaam
Copy link
Collaborator Author

totaam commented Apr 5, 2019

2019-04-05 15:25:55: antoine commented


They do honour it..
Looking at the GTK source code, they're not actually given the choice: the "modal" behaviour is enforced by GTK, it uses X11 grabs to do so.
gtk_grab_add : Makes @widget the current grabbed widget. This means that interaction with other widgets in the same application is blocked and mouse as well as keyboard events are delivered to this widget. If @widget is not sensitive, it is not set as the current grabbed widget and this function does nothing.

@totaam
Copy link
Collaborator Author

totaam commented Apr 6, 2019

2019-04-06 21:09:17: mviereck commented


Thanks for the additional information.

They do honour it, but this modal flag is per application - it just so happens that xpra ends up being multiple applications that the window manager sees as just one.

That makes sense, good to know.

@totaam
Copy link
Collaborator Author

totaam commented Jun 23, 2019

2019-06-23 08:15:54: mviereck commented


Just a note: man xpra does not show option --modal-windows.

xpra --help shows:

    --modal-windows=MODAL_WINDOWS
                        Honour modal windows. Default: 'True'.

@totaam
Copy link
Collaborator Author

totaam commented Jun 23, 2019

2019-06-23 14:05:29: antoine commented


Just a note: man xpra does not show option --modal-windows.
Oops, thanks for pointing that out: fixed in r23020.

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