/[gentoo-x86]/x11-terms/root-tail/files/root-tail-1.2-kde.patch
Gentoo

Contents of /x11-terms/root-tail/files/root-tail-1.2-kde.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Thu Feb 24 10:59:21 2005 UTC (10 years, 4 months ago) by ka0ttic
Branch: MAIN
CVS Tags: HEAD
Revision bump; added patch for kde support thanks to Evgeniy <dushistov@mail.ru> in bug 83091.
(Portage version: 2.0.51.16)

1 diff -bBurN root-tail-1.2/config.h root-tail-my/config.h
2 --- root-tail-1.2/config.h 2004-07-30 23:32:39.000000000 +0400
3 +++ root-tail-my/config.h 2005-02-23 13:02:48.878912688 +0300
4 @@ -15,3 +15,4 @@
5
6 #define VERSION "1.2"
7
8 +#define KDE
9 diff -bBurN root-tail-1.2/root-tail.c root-tail-my/root-tail.c
10 --- root-tail-1.2/root-tail.c 2004-07-30 23:33:20.000000000 +0400
11 +++ root-tail-my/root-tail.c 2005-02-23 13:02:37.599627400 +0300
12 @@ -148,6 +148,11 @@
13 regex_t *transformre;
14 #endif
15
16 +#ifdef KDE
17 +#define ATOM(a) XInternAtom(disp, #a, False)
18 +
19 +int screen, ScreenWidth, ScreenHeight;
20 +#endif
21
22 /* prototypes */
23 void list_files (int);
24 @@ -227,7 +232,7 @@
25 return Color.pixel;
26 }
27
28 -#ifndef USE_TOON_GET_ROOT_WINDOW
29 +#if !defined(USE_TOON_GET_ROOT_WINDOW) && !defined(KDE)
30 static void
31 find_root_window (Display *display, int screen_number)
32 {
33 @@ -280,14 +285,91 @@
34 fprintf (stderr, "Can't query tree on root window 0x%lx", root);
35 }
36 }
37 -#endif /* USE_TOON_GET_ROOT_WINDOW */
38 +#elif defined(KDE)
39 +static Window find_subwindow(Window win, int w, int h) {
40 + unsigned int i, j;
41 + Window troot, parent, *children;
42 + unsigned int n;
43 +
44 + /* search subwindows with same size as display or work area */
45 +
46 + for (i=0; i<10; i++) {
47 + XQueryTree(disp, win, &troot, &parent, &children, &n);
48 +
49 + for (j=0; j<n; j++) {
50 + XWindowAttributes attrs;
51 +
52 + if (XGetWindowAttributes(disp, children[j], &attrs)) {
53 + /* Window must be mapped and same size as display or work space */
54 + if (attrs.map_state != 0 &&
55 + ((attrs.width == ScreenWidth && attrs.height == ScreenHeight) ||
56 + (attrs.width == w && attrs.height == h))) {
57 + win = children[j];
58 + break;
59 + }
60 + }
61 + }
62 +
63 + XFree(children);
64 + if (j == n) break;
65 + }
66 +
67 + return win;
68 +}
69 +
70 +static void
71 +find_root_window (Display *display, int screen_number)
72 +{
73 + Atom type;
74 + int format, i;
75 + unsigned long nitems, bytes;
76 + unsigned int n;
77 + root = RootWindow(display, screen_number);
78 + Window win = root;
79 + Window troot, parent, *children;
80 + unsigned char *buf = NULL;
81 +
82 + /* some window managers set __SWM_VROOT to some child of root window */
83 +
84 + XQueryTree(display, root, &troot, &parent, &children, &n);
85 + for (i=0; i<(int)n; i++) {
86 + if (XGetWindowProperty(display, children[i], ATOM(__SWM_VROOT),
87 + 0, 1, False, XA_WINDOW, &type, &format, &nitems, &bytes,
88 + &buf) == Success && type == XA_WINDOW) {
89 + win = * (Window *) buf;
90 + XFree(buf);
91 + XFree(children);
92 + fprintf(stderr, "torsmo: drawing to window from __SWM_VROOT property\n");
93 + root=win;
94 + return;
95 + }
96 +
97 + if (buf) {
98 + XFree(buf);
99 + buf = 0;
100 + }
101 + }
102 + XFree(children);
103 +
104 + /* get subwindows from root */
105 + win = find_subwindow(root, -1, -1);
106 +
107 + win = find_subwindow(win, width, height);
108 +
109 + if (buf) { XFree(buf); buf = 0; }
110 +
111 + root=win;
112 +}
113 +#endif /* USE_TOON_GET_ROOT_WINDOW && KDE*/
114
115 void
116 InitWindow (void)
117 {
118 XGCValues gcv;
119 unsigned long gcm;
120 +#ifndef KDE
121 int screen, ScreenWidth, ScreenHeight;
122 +#endif
123 struct logfile_entry *e;
124
125 if (!(disp = XOpenDisplay (dispname)))

  ViewVC Help
Powered by ViewVC 1.1.20