xpra icon
Bug tracker and wiki

Opened 8 months ago

Closed 8 months ago

Last modified 5 months ago

#2255 closed defect (invalid)

kaptain: wrong pointer and keyboard focus for concurrent windows

Reported by: mviereck Owned by: Antoine Martin
Priority: minor Milestone: 3.0
Component: client Version: 2.5.x
Keywords: Cc:

Description

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?

Change History (8)

comment:1 Changed 8 months ago by mviereck

Summary: kaptain: wrong pointer and keyboard focus for oncurrent windowskaptain: wrong pointer and keyboard focus for concurrent windows

comment:2 Changed 8 months ago by Antoine Martin

Resolution: invalid
Status: newclosed

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).

comment:3 Changed 8 months ago by mviereck

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.

Last edited 8 months ago by Antoine Martin (previous) (diff)

comment:4 Changed 8 months ago by Antoine Martin

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.

comment:5 Changed 8 months ago by Antoine Martin

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.

comment:6 Changed 8 months ago by mviereck

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.

comment:7 Changed 5 months ago by mviereck

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

xpra --help shows:

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

comment:8 Changed 5 months ago by Antoine Martin

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

Oops, thanks for pointing that out: fixed in r23020.

Note: See TracTickets for help on using tickets.