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

docker-for-win: containerized xpra server with xwin (cygwin) #122

Closed
eine opened this issue Feb 3, 2019 · 7 comments
Closed

docker-for-win: containerized xpra server with xwin (cygwin) #122

eine opened this issue Feb 3, 2019 · 7 comments

Comments

@eine
Copy link
Contributor

eine commented Feb 3, 2019

Now that #120 is fixed, I can execute ./x11docker --gpu --user=root --cap-default -- -p "8080:8080" -- x11docker/xpra sh -c "apk add xterm && xterm" in Cygwin, which will default to --xwin. The X server is properly started, and xterm is shown on the host. Then, from an MSYS terminal, I can:

# winpty docker exec -it x11docker_X100_f3a77004f3d1e690a1d0c13362c4088c_x11docker-xpra sh
/tmp # xpra start $DISPLAY --use-display --bind-tcp=0.0.0.0:8080 --webcam=no --mdns=no --notifications=no --dbus-proxy=no --dbus-launch=no --pulseaudio=no

Warning: running as root
/tmp # Entering daemon mode; any further errors will be reported to:
  /tmp/10.0.75.1:100.log
cat /tmp/10.0.75.1:100.log
2019-02-03 00:58:38,230 Error: cannot enable SSH socket upgrades:
2019-02-03 00:58:38,231  No module named paramiko
error running (['xprop', '-display', '10.0.75.1:100', '-root', '_XPRA_UINPUT_ID'],),{'stderr': -1, 'stdout': -1}: [Errno 2] No such fi
le or directory
2019-02-03 00:58:38,306 Warning: failed to create socket directory '/run/user/0/xpra'
2019-02-03 00:58:38,306  [Errno 2] No such file or directory: '/run/user/0/xpra'
2019-02-03 00:58:38,306 Warning: cannot create socket '/run/user/0/xpra/b59bbb2a99c7-10.0.75.1:100':
2019-02-03 00:58:38,306  [Errno 2] No such file or directory
2019-02-03 00:58:38,306  /run/user does not exist
2019-02-03 00:58:38,306 created unix domain socket: /run/xpra/b59bbb2a99c7-10.0.75.1:100
2019-02-03 00:58:38,313 Warning: no XShm support on display 10.0.75.1:100
2019-02-03 00:58:38,349 pointer device emulation using XTest
2019-02-03 00:58:38,350 Warning: XTest extension is missing
2019-02-03 00:58:38,350 Error: keyboard and mouse disabled
2019-02-03 00:58:38,838  OpenGL is supported on this display
2019-02-03 00:58:38,971 html server unavailable, cannot find websockify module

Warning: running as root
Warning: failed to import GStreamer 1.x:
 No module named gi
2019-02-03 00:58:39,292 Error: failed to query sound subsystem:
2019-02-03 00:58:39,292  query did not return any data
2019-02-03 00:58:39,561 xpra X11 version 2.4.2-r21077 64-bit
2019-02-03 00:58:39,562  uid=0, gid=0
2019-02-03 00:58:39,562  running with pid 103 on Linux
2019-02-03 00:58:39,660 xpra is ready.
2019-02-03 00:58:39,674 7.8GB of system memory

The xterm windows disappears, and a huge window is opened on the host with title Xpra-WorldWindow@b59bbb2a99c7. With huge I mean that it takes all my desktop (two monitors).

When I connect with a xpra client (from the host), I see the xterm window again. So, at first sight it seems to work somehow. But there is an annoying issue and it is not really usable:

  • Two xterm windows are shown, one below the other:
  • One is created by the xpra client (the xpra logo is shown) with title xterm on 977b1caccd88. The content (video/render) of xterm is shown here.
  • The other one is created by Xwin (the xwin logo is shown), with title Xpra-CorralWindows-0x80000d. It is just a black window with a title.

The annoyance is that keyboard input only works in the Xwin (black) window, which is behind. So, I need to select the black window from the taskbar and move it to a side. Then, I click inside and whatever I write there is shown in the other window. However, if I move the Xpra window, the Xwin one is positioned behind. See screencast below:

xpra_xwin

NOTE: is the background is rendering strange (white/gray), ignore it. That's either some optimization that the recorder tried to do when generating the gif, or the browser when rendering it.


For the record, I tried the same exercise with --vcxsrv. The result is the same as with MSYS2 (reported in #117): xpra cannot start and vcxsrv takes 30% of the CPU and ceases to respond. I did add +extension COMPOSITE manually.


@totaam, can this be related to you comment. always try to avoid doing things this way in #117?

EDIT

When I disconnect the xpra client, the xterm window is closed, but Xpra-CorralWindow remains. When I close it, xpra terminates with Xpra: Fatal IO error 11 (Resource temporarily unavailable) on X server 10.0.75.1:100., the huge window is closed and the xterm is shown again (because control is returned to xwin).

It seems that both the huge window and Xpra-CorralWindow should not be shown in the windows taskbar, and they should be permanently minimized.

@mviereck
Copy link
Owner

mviereck commented Feb 3, 2019

Quite interesting that Xwin works with xpra so far. x11docker command line setup for Xwin and VcXsrv is the same (including X over IP with IP:DISPLAY).

The annoyance is that keyboard input only works in the Xwin (black) window, which is behind.
2019-02-03 00:58:38,350 Warning: XTest extension is missing

xpra needs extension XTEST for mouse and keyboard control, but x11docker disables it.
Look at lines https://github.com/mviereck/x11docker/blob/master/x11docker#L2576-L2593 # X extension XTEST. Just insert Xtest=yes before this and it will work.
(Once x11docker had an option --xtest to manually enable/disable it. I dropped it because I thought no one would ever need it.)
Edit: enabling XTEST might help to use xpra with VcXsrv, too. It would need it anyway.

The xterm windows disappears, and a huge window is opened on the host with title Xpra-WorldWindow@b59bbb2a99c7. With huge I mean that it takes all my desktop (two monitors).

This is probably the root/background window xpra works with. Normally it is invisible (Xvfb/Xdummy), as well as the black application window.

It seems that both the huge window and Xpra-CorralWindow should not be shown in the windows taskbar, and they should be permanently minimized.

I don't know how windows can be minimized/hidden on MS Windows. Linux provides e.g. xdotool, maybe Windows provides something similar.

@mviereck mviereck mentioned this issue Feb 3, 2019
9 tasks
@totaam
Copy link

totaam commented Feb 3, 2019

xpra needs extension XTEST

Yes.

... a huge window is opened on the host with title Xpra-WorldWindow@b59bbb2a99c7

The world window is meant to cover the whole desktop and is used for managing focus events.
You may be able to get by without it, we already do that for the python3 version of the server.
(comment it out in wm.py)

Each regular (non-OR) window will have a corral window reparenting it. Which means that the application window should always be shown inside the corral window.

I don't know how windows can be minimized/hidden on MS Windows. Linux provides e.g. xdotool, maybe Windows provides something similar.

Normal window managers place decorations on their equivalent to the corral window: that's where the top bar and the minimize / maximize / close buttons live.
Xpra has no need for such things since users aren't meant to see the corral window..

@eine
Copy link
Contributor Author

eine commented Feb 4, 2019

Quite interesting that Xwin works with xpra so far. x11docker command line setup for Xwin and VcXsrv is the same (including X over IP with IP:DISPLAY).

Regarding Xcomposite, it is disabled for --nxagent|--vcxsrv|--xwin. Would it be possible to remove xwin from there. It is ok not to enable it by default, but ATM x11docker needs to be patched for it to work.

xpra needs extension XTEST for mouse and keyboard control, but x11docker disables it.
Look at lines /x11docker@master#L2576-L2593 # X extension XTEST. Just insert Xtest=yes before this and it will work.

I tried with Xcomposite="yes" and Xtest="yes":

xpra_xwin_xtest

So, it works. Keyboard and mouse work in the app (be xterm or terminator in the screencast), no matter the position of the corral window. However, as shown in the screencast, sometimes the corral window has some lag when the main windows is moved. Note that this effect is worse with terminator. Overall, the solution is quite usable.

Regarding the the world window and the corral windows, Xwin does hide what it calls the Root Window (i.e. it is not shown as a separate icon in the task bar, and it is minimized by default). This is similar to the world window of xpra, but the one from xpra is windowed fullscreen, while the one from Xwin is completely fullscreen (even on top of the taskbar). Nevertheless, if Xwin can hide it's own world window, there might be some mechanism to tell it to hide xpra's world and corral windows too.

(Once x11docker had an option --xtest to manually enable/disable it. I dropped it because I thought no one would ever need it.)

It'd be great to either enable it by default in --xwin, or allow to set it with a CLI option.

Edit: enabling XTEST might help to use xpra with VcXsrv, too. It would need it anyway.

I tried it. It does not work.

I don't know how windows can be minimized/hidden on MS Windows. Linux provides e.g. xdotool, maybe Windows provides something similar.

I believe that the X server (Xwin here) needs to tell Windows to create the icons in the task bar. So, we should not need an external tool to interact with windows. Shouldn't we interact with Xwin?

I installed xdotool in the container, just in case xpra used it internally if available. But there is no difference.


The world window is meant to cover the whole desktop and is used for managing focus events.
You may be able to get by without it, we already do that for the python3 version of the server.
(comment it out in wm.py)

I don't really want to remove it, if it provides some feature. It doesn't produce any problem when minimized. So, I'd just want to tell the X server not to create an icon for that window in the windows taskbar.

According to https://xpra.org/trac/ticket/853 and the notes in 2.4 Important Features, I thought that the python3 version of the server was not ready. Is it?

Each regular (non-OR) window will have a corral window reparenting it. Which means that the application window should always be shown inside the corral window.

As shown in the screencast above, this is not the case. Each regular window has a corral window, that's ok. But it seems not to be a parent. Both windows have the same size, and the regular window is shown on top of the corral. Furthermore, if the corral window is minimized, it is not updated anymore (it keeps it's position and size, independently of moving/resizing the regular window).

  • Do corral windows (and the world window) work when they are minimized? Or is it required that they are maximized?
  • Do corral windows need to be the same size or larger than their corresponding regular windows? Or being the parent is just a hierarchical reference?

Xpra has no need for such things since users aren't meant to see the corral window.

How does xpra set the corral window not to be visible?

EDIT

After checking the Xwin manpage and the feature list, I think that it is not possible to hide the icons in the taskbar.

Multi-Window Mode - Multi-Window mode allows each X Client to be opened in, and managed by, its own Windows window. This makes each X Client show up independently in the task bar. Additionally, the icon hint provided by the X Client is used for the Windows window icon.

The tray icon/menu can be hidden and/or modified:

-[no]trayicon
Do not create a tray icon. Default is to create one icon per screen. You can globally disable tray icons with -notrayicon, then enable it for specific screens with -trayicon for those screens.

To include items into the menu associated with the XWin icon which is in the Windows system tray. This functions in all modes that have a tray icon.

But there is no equivalent feature for taskbar icons.

@totaam
Copy link

totaam commented Feb 4, 2019

However, as shown in the screencast, sometimes the corral window has some lag when the main windows is moved

That's "normal". In order to avoid window resizing loops, we delay configure events with a timer.
You're interacting with a window which is not normally seen directly..

Regarding the the world window and the corral windows, Xwin does hide what it calls the Root Window (i.e. it is not shown as a separate icon in the task bar, and it is minimized by default).
This is similar to the world window of xpra, but the one from xpra is windowed fullscreen, while the one from Xwin is completely fullscreen (even on top of the taskbar).

The "root" window has a very specific purpose in X11, it is the parent of all windows.

Nevertheless, if Xwin can hide it's own world window, there might be some mechanism to tell it to hide xpra's world and corral windows too.
I don't really want to remove it, if it provides some feature. It doesn't produce any problem when minimized. So, I'd just want to tell the X server not to create an icon for that window in the windows taskbar.

Maybe this will help:
http://xpra.org/trac/changeset/21528
http://xpra.org/trac/changeset/21529

I installed xdotool in the container, just in case xpra used it internally if available. But there is no difference.

No, xpra uses native API calls.

I thought that the python3 version of the server was not ready. Is it?

In 2.5 it is almost ready.

Do corral windows (and the world window) work when they are minimized? Or is it required that they are maximized?

They are not meant to be manipulated externally. They are not meant to be seen either.

Do corral windows need to be the same size or larger than their corresponding regular windows? Or being the parent is just a hierarchical reference?

Exactly the same size.

How does xpra set the corral window not to be visible?

It doesn't!

@eine
Copy link
Contributor Author

eine commented Feb 4, 2019

Maybe this will help:
http://xpra.org/trac/changeset/21528
http://xpra.org/trac/changeset/21529

Is there any info about the CI flow you use? Is it public?

I can build the latest from sources in a Debian container. However, I'll need some time to have it done on Windows. Anyway, those changes should only affect the server, so I'll try.

In 2.5 it is almost ready.

Does it mean that I can install xpra 2.5 in a container without python2 at all, although with some bugs/missing features?

They are not meant to be manipulated externally. They are not meant to be seen either.

I was wondering if I could issue a minimize command with xdotool, which would hide them. The only remaining thing would be to remove the icons from the task bar. However, I don't know if being minimized disables their functionaly, or if they keep working anyway.

How does xpra set the corral window not to be visible?

It doesn't!

Then, I'm missing something. How is it that two windows are created, one of them is not supposed to be visible, but xpra does not tell it explicitly? Is it because xpra ensures that the corral window is always behind the real window?

I'm trying to guess that, on GNU/Linux, the X server does not provide to the window manager the list of windows to be shown in Alt+Tab. It just displays them and some other mechanism is used to identify the real ones.

@mviereck
Copy link
Owner

mviereck commented Feb 4, 2019

Does it mean that I can install xpra 2.5 in a container without python2 at all, although with some bugs/missing features?

Yesterday I've installed xpra with python3 on debian buster. It seems to work well so far.
I am using the xpra/winswitch repository for debian. Install package python3-xpra instead of package xpra.

$ xpra --version
xpra for python 2.7 is not installed
 retrying with python3
xpra v2.5-r21480

I was wondering if I could issue a minimize command with xdotool, which would hide them. The only remaining thing would be to remove the icons from the task bar.

We can try to hide the windows with xdotool. However, I would prefer a -hide option in the X server that also disables task bar icons.

However, I don't know if being minimized disables their functionaly, or if they keep working anyway.

A similar setup by x11docker is used with --xpra-xwayland. The weston window with Xwayland is hidden with xdotool but keeps working. xpra shows its content.

How is it that two windows are created, one of them is not supposed to be visible, but xpra does not tell it explicitly?

Normally xpra uses Xvfb or Xdummy. They are always invisible (Xvfb = X virtual frame buffer), so xpra does not need to hide anything.

@mviereck
Copy link
Owner

mviereck commented Mar 3, 2019

Feel free to re-open if this is of interest again.

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

No branches or pull requests

3 participants