Ivan Krylov
2021-Mar-22 21:01 UTC
[Rd] Possible x11 window manager window aggregation under one icon?
On Mon, 22 Mar 2021 15:42:04 -0400 Duncan Murdoch <murdoch.duncan at gmail.com> wrote:> I'd be happy to add something to rgl if you could point me to > an exampleOn Mon, 22 Mar 2021 14:54:43 -0500 Dirk Eddelbuettel <edd at debian.org> wrote:> Just like Duncan I see now WM_HINTS yet, so maybe by > just giving them we can improve?The surrounding code and <https://tronche.com/gui/x/xlib/ICC/client-to-window-manager/wm-hints.html> proved to be enough of an example. The following patch makes it possible to group x11() windows on my PC with Xfce running: -----------------------------------8<----------------------------------- Index: src/modules/X11/devX11.c ==================================================================--- src/modules/X11/devX11.c (revision 80104) +++ src/modules/X11/devX11.c (working copy) @@ -105,7 +105,7 @@ static Display *display; /* Display */ static char dspname[101]=""; static int screen; /* Screen */ -static Window rootwin; /* Root Window */ +static Window rootwin, group_leader; /* Root Window, Group leader */ static Visual *visual; /* Visual */ static int depth; /* Pixmap depth */ static int Vclass; /* Visual class */ @@ -1617,6 +1617,16 @@ PropModeReplace, (const unsigned char*) rlogo_icon, 2 + 99*77); + /* set the window group leader */ + XWMHints * hints; + hints = XAllocWMHints(); + if (hints) { + hints->window_group = group_leader; + hints->flags |= WindowGroupHint; + XSetWMHints(display, xd->window, hints); + XFree(hints); + } + /* set up protocols so that window manager sends */ /* me an event when user "destroys" window */ _XA_WM_PROTOCOLS = XInternAtom(display, "WM_PROTOCOLS", 0); @@ -2109,6 +2119,7 @@ if (numX11Devices == 0) { int fd = ConnectionNumber(display); /* Free Resources Here */ + XDestroyWindow(display, group_leader); while (nfonts--) R_XFreeFont(display, fontcache[nfonts].font); nfonts = 0; @@ -3133,6 +3144,9 @@ #endif screen = DefaultScreen(display); rootwin = DefaultRootWindow(display); + group_leader = XCreateSimpleWindow( /* never mapped or visible */ + display, rootwin, 0, 0, 1, 1, 0, 0, 0 + ); depth = DefaultDepth(display, screen); visual = DefaultVisual(display, screen); colormap = DefaultColormap(display, screen); -----------------------------------8<----------------------------------- Some very limited testing didn't seem to uncover any problems. -- Best regards, Ivan -------------- next part -------------- A non-text attachment was scrubbed... Name: groups.png Type: image/png Size: 4393 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20210323/b2552350/attachment.png>
Dirk Eddelbuettel
2021-Mar-22 21:57 UTC
[Rd] Possible x11 window manager window aggregation under one icon?
On 23 March 2021 at 00:01, Ivan Krylov wrote: | The surrounding code and | <https://tronche.com/gui/x/xlib/ICC/client-to-window-manager/wm-hints.html> | proved to be enough of an example. The following patch makes it | possible to group x11() windows on my PC with Xfce running: [...] | Some very limited testing didn't seem to uncover any problems. Woot woot -- works here too under Ubuntu 20.10 / Gnome / Unity. I applied the adorably small patch to the usual checkout I keep of r-devel (as an incremental build is faster than a full package build of r-release). You are my hero. Next round of hot or cold beverages is on me. Already looks so much better. I may put this into the next 4.0.5 (or 4.1.0 at the latest) for Debian and Ubuntu (but will instrument a proper new r-base package and hit it for a few days first). Do you want to send a proper patch to bugzilla? Dirk -- https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org