[PATCH] against XRootConsole (was: KDE and XRootConsole)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ For Bob Galloway: we were discussing the fact that xrootconsole output
  disappears when enabling icons on KDE desktops. ]


Waldo Bastian <bastian@xxxxxxx> wrote:

> On Tue November 25 2003 19:23, Didier Verna wrote:

>>         I don't quite understand what that means... but I see that enabling
>> icons on the desktop actually creates a "fake" root window named "KDE
>> Desktop", which explains the problem: xrootconsole creates a child of the
>> root window, and is in override_redirect mode, and calls XLowerWindow,
>> which makes it obscured by the KDE Desktop one[1].

>> > You can try if enabling the option "Allow programs in desktop window"
>> > helps.
>>
>>         Nope. What does it do in actuality ?
>
> It designates the desktop window as a virtual root window I believe.

        Yes ! That's it. I've patched xrootconsole in order to make it honor
the presence of a virtual root window, if any, and I'm now able to see the
output of xrootconsole with KDE icons enabled on the desktop AND the "allow
programs on root window" option turned on.

        I've attached the corresponding patch, I hope Bob will agree to
incorporate it. BTW, Bob, if you're interested, I could also make xrootconsole
follow the changes of the background pixmap.


--- main.c	2002-07-01 08:24:02.000000000 +0200
+++ main.c.new	2003-11-26 17:52:59.000000000 +0100
@@ -40,6 +40,7 @@
 #include "util.h"
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
+#include <X11/Xatom.h>
 #include <assert.h>
 #include <errno.h>
 #include <stdio.h>
@@ -294,6 +295,65 @@
 }
   
 
+/* Return the root window, or a virtual root window if any. */
+static Window root_window (Display *display)
+{
+  Atom __SWM_VROOT = XInternAtom (display, "__SWM_VROOT", False);
+
+  if (__SWM_VROOT != None)
+    {
+      Window unused, *windows;
+      unsigned int count;
+
+      if (XQueryTree (display, DefaultRootWindow (display), &unused, &unused,
+		      &windows, &count))
+	{
+	  int i;
+
+	  for (i = 0; i < count; i++)
+	    {
+	      Atom type;
+	      int format;
+	      unsigned long nitems, bytes_after_return;
+	      Window *virtual_root_window;
+
+	      if (XGetWindowProperty (display, windows[i], __SWM_VROOT,
+				      0, 1, False, XA_WINDOW, &type, &format,
+				      &nitems, &bytes_after_return,
+				      (unsigned char **) &virtual_root_window)
+		  == Success)
+		{
+		  if (type != None)
+		    {
+		      if (type == XA_WINDOW)
+			{
+			  XFree (windows);
+			  return *virtual_root_window;
+			}
+		      else
+			fprintf (stderr, "__SWM_VROOT property type mismatch");
+		    }
+		}
+	      else
+		fprintf (stderr,
+			 "failed to get __SWM_VROOT property on window 0x%lx",
+			 windows[i]);
+	    }
+
+	  if (count)
+	    XFree (windows);
+	}
+      else
+	fprintf (stderr, "Can't query tree on root window 0x%lx",
+		 DefaultRootWindow (display));
+    }
+  else
+    /* This shouldn't happen. The Xlib documentation is wrong BTW. */
+    fprintf (stderr, "Can't intern atom __SWM_VROOT");
+
+  return DefaultRootWindow (display);
+}
+
 void init_window(InitOptions *io, WindowSettings *ws) {
     XGCValues values;
 
@@ -346,7 +406,7 @@
     ws->swa.event_mask = ExposureMask;
     ws->swa.override_redirect = True;
      
-    ws->win = XCreateWindow(ws->dpy, DefaultRootWindow(ws->dpy), 
+    ws->win = XCreateWindow(ws->dpy, root_window (ws->dpy), 
                 ws->x_root, ws->y_root,
                 ws->width, ws->height, io->bw, CopyFromParent, CopyFromParent,
                 DefaultVisual(ws->dpy, DefaultScreen(ws->dpy)),

Thanks !


-- 
Didier Verna, didier@xxxxxxxxxxxxx, http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire   Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bicêtre, France   Fax.+33 (1) 53 14 59 22   didier@xxxxxxxxxx
___________________________________________________
.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

[Index of Archives]     [Trinity (TDE) Desktop Users]     [Fedora KDE]     [Fedora Desktop]     [Linux Kernel]     [Gimp]     [GIMP for Windows]     [Gnome]     [Yosemite Hiking]
  Powered by Linux