[Rd] Possible x11 window manager window aggregation under one icon?

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Mon Mar 22 22:01:21 CET 2021


On Mon, 22 Mar 2021 15:42:04 -0400
Duncan Murdoch <murdoch.duncan using gmail.com> wrote:

> I'd be happy to add something to rgl if you could point me to 
> an example

On Mon, 22 Mar 2021 14:54:43 -0500
Dirk Eddelbuettel <edd using 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>


More information about the R-devel mailing list