[winswitch] forwarding a X11 window with child windows

Bodo Martin bodo.martin at aci.uni-heidelberg.de
Tue Mar 7 20:59:32 GMT 2017

>Am 07.03.2017 um 16:00 schrieb Antoine Martin via shifter-users:
> On 07/03/17 01:30, Bodo Martin via shifter-users wrote:
>> Hi
>> is it possible to forward a X11 window with children to the client? - or
>> rather, reparent with XReparentWindow two remote windows (already
>> forwarded via xpra ?
> I don't see why it wouldn't work: the xpra client is just another X11
> client application.
>> This works for e.g. a ssh session (for non-GL
>> windows) but crashes with xpra. (setup: xpra 1.0.2, linux to linux , via
>> ssh )
> What crashes exactly? xpra or something else?
> I'm not sure why GL would make much of a difference here, but you can
> try turning it off with "--opengl=no"
> Do you have a reproducible test case I can try?

ok, here is a minimal test program:

--- snip ---

// modfied from:
// Ch. Tronche (http://tronche.lri.fr:8000/)

#include <X11/Xlib.h>
#include <assert.h>
#include <unistd.h>

#define NIL (0)

int main()
      Display *dpy = XOpenDisplay(NIL);

      int blackColor = BlackPixel(dpy, DefaultScreen(dpy));
      int whiteColor = WhitePixel(dpy, DefaultScreen(dpy));

      // Create the window

      Window w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
                                     250, 150, 0, blackColor, blackColor);

      XSelectInput(dpy, w, StructureNotifyMask);
      XMapWindow(dpy, w);


      // Wait for the MapNotify event
      for(;;) {
            XEvent e;
            XNextEvent(dpy, &e);
            if (e.type == MapNotify)

      Window child = XCreateSimpleWindow(dpy, /*w*/
DefaultRootWindow(dpy) , 0, 0, 200, 100, 0, whiteColor, whiteColor);

      XSelectInput(dpy, child, StructureNotifyMask);
      XMapWindow(dpy, child);

      // Wait for the MapNotify event
      for(;;) {
            XEvent e;
            XNextEvent(dpy, &e);
            if (e.type == MapNotify)


      // reparent (to x,y does not work, not processing events)
      XReparentWindow(dpy, child, w, 0, 0 );




--- snip ---

reparenting a white window into a black one. This works both locally and
over an ssh connection, but not with xpra (no white window in the black
one shown).

(The crash I was referring to happens when I try to reparent the winIDs
from the parentID of the session, giving me different winIDs , which may
not be a good idea)



Dr. Bodo Martin
University Heidelberg
Anorganisch-Chemisches Institut
Im Neuenheimer Feld 270  69120 Heidelberg  Germany
Phone: +49-6221-546610  Fax: +49-6221-546617
Web: http://bodomartin.uni-hd.de

More information about the shifter-users mailing list