summaryrefslogtreecommitdiff
path: root/patch/xsnow-gtftng.patch
blob: bfd70bbb74aed6454dc269fc9214cb992fb0d7e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--- ../../xsnow.org/xsnow-1.42/toon_root.c	2001-12-16 00:09:39.000000000 +0100
+++ ./toon_root.c	2013-11-08 16:37:09.075742684 +0100
@@ -224,6 +224,45 @@
   return winreturn;
 }
 
+static Window __ToonGetWindowByName(Display *display, int screen, Window window, int depth, const char* useName)
+{
+   Window rootReturn, parentReturn, *children;
+   Window winreturn = (Window)0;
+   unsigned int nChildren;
+   char* name = NULL;
+
+   if (depth > 5)
+       return (Window)0;
+
+   if (XQueryTree(display, window, &rootReturn, &parentReturn, &children, &nChildren)) 
+   {
+      int i;
+
+      for (i = 0; i < nChildren; ++i) 
+      {
+         XWindowAttributes attributes;
+         
+         if (XFetchName(display, children[i], &name))
+         {
+            if (strcasecmp(name, useName) == 0)
+            {
+               winreturn = children[i];
+               break;
+            }
+         }
+
+         winreturn = __ToonGetWindowByName(display, screen, children[i], depth+1, useName);
+
+         if (winreturn)
+            break;
+      }
+
+      XFree((char *) children);
+   }
+
+  return winreturn;
+}
+
 
 /* 
  * Returns the window ID of the `background' window on to which the
@@ -253,7 +292,16 @@
 
   *clientparent = root;
 
-  if (XGetWindowProperty(display, root,
+  if (background = __ToonGetWindowByName(display, screen, root, 0, "graphtft-fe"))
+  {
+     *clientparent = background;
+     snprintf(toon_message, TOON_MESSAGE_LENGTH,
+              _("Drawing to graphtft-fe"));
+     toon_message[TOON_MESSAGE_LENGTH-1] = '\0';
+  }
+
+  if (!background
+      && XGetWindowProperty(display, root,
 			 NAUTILUS_DESKTOP_WINDOW_ID,
 			 0, 1, False, XA_WINDOW,
 			 &actual_type, &actual_format,