Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 156981
Collapse All | Expand All

(-)root-tail.c.old (+85 lines)
Lines 52-57 Link Here
52
/* some italic fonts still go over the margin - this margin of error cleans up the mess */
52
/* some italic fonts still go over the margin - this margin of error cleans up the mess */
53
#define MARGIN_OF_ERROR 2
53
#define MARGIN_OF_ERROR 2
54
54
55
#define ATOM(a) XInternAtom(disp, #a, False) 
56
55
/* data structures */
57
/* data structures */
56
struct logfile_entry
58
struct logfile_entry
57
{
59
{
Lines 136-141 Display *disp; Link Here
136
Window root;
138
Window root;
137
GC WinGC;
139
GC WinGC;
138
140
141
int workarea[4];
142
139
#if HAS_REGEX
143
#if HAS_REGEX
140
struct re_list
144
struct re_list
141
{
145
{
Lines 282-293 find_root_window (Display *display, int Link Here
282
}
286
}
283
#endif /* USE_TOON_GET_ROOT_WINDOW */
287
#endif /* USE_TOON_GET_ROOT_WINDOW */
284
288
289
290
static void update_workarea()
291
{
292
        int screen = DefaultScreen(disp);
293
        Window root = RootWindow(disp, screen);
294
        unsigned long nitems, bytes;
295
        unsigned char *buf = NULL;
296
        Atom type;                
297
        int format;               
298
	/* default work area is display */
299
300
        workarea[0] = 0;
301
        workarea[1] = 0;
302
        workarea[2] = DisplayWidth(disp, screen);
303
        workarea[3] = DisplayHeight(disp, screen);
304
                                     
305
        /* get current desktop */    
306
        if (XGetWindowProperty(disp, root, ATOM(_NET_CURRENT_DESKTOP),
307
                               0, 1, False, XA_CARDINAL, &type, &format,
308
                               &nitems, &bytes, &buf) == Success
309
            && type == XA_CARDINAL && nitems > 0) {
310
311
                //Currently unused
312
                /*  long desktop = * (long *) buf; */
313
314
                XFree(buf);
315
                buf = 0;
316
317
        }
318
         
319
        if (buf) {
320
                XFree(buf);
321
                buf = 0;
322
        }
323
}
324
325
static Window find_subwindow(Window win, int w, int h)
326
{
327
        unsigned int i, j;
328
        Window troot, parent, *children;
329
        unsigned int n;
330
331
        /* search subwindows with same size as display or work area */
332
333
        for (i = 0; i < 10; i++) {
334
                XQueryTree(disp, win, &troot, &parent, &children, &n);
335
336
                for (j = 0; j < n; j++) {           
337
                        XWindowAttributes attrs;
338
339
                        if (XGetWindowAttributes
340
                            (disp, children[j], &attrs)) {
341
                                /* Window must be mapped and same size as display or work space */
342
                                if (attrs.map_state != 0 &&
343
                                    ((attrs.width == DisplayWidth(disp, DefaultScreen(disp))
344
                                      && attrs.height == DisplayHeight(disp, DefaultScreen(disp)))
345
                                     || (attrs.width == w
346
                                         && attrs.height == h))) {
347
                                        win = children[j];
348
                                        break;
349
                                }
350
                        }
351
                }
352
                 
353
                XFree(children);
354
                if (j == n)
355
                        break;
356
        }
357
358
        return win;
359
}
360
285
void
361
void
286
InitWindow (void)
362
InitWindow (void)
287
{
363
{
288
  XGCValues gcv;
364
  XGCValues gcv;
289
  unsigned long gcm;
365
  unsigned long gcm;
290
  int screen, ScreenWidth, ScreenHeight;
366
  int screen, ScreenWidth, ScreenHeight;
367
  Window win;
291
  struct logfile_entry *e;
368
  struct logfile_entry *e;
292
369
293
  if (!(disp = XOpenDisplay (dispname)))
370
  if (!(disp = XOpenDisplay (dispname)))
Lines 302-307 InitWindow (void) Link Here
302
379
303
  find_root_window (disp, screen);
380
  find_root_window (disp, screen);
304
381
382
  /* get subwindows from root */
383
  win = find_subwindow(root, -1, -1);
384
385
  update_workarea();
386
387
  win = find_subwindow(win, workarea[2], workarea[3]);
388
389
  root=win;
305
  gcm = GCBackground;
390
  gcm = GCBackground;
306
  gcv.graphics_exposures = True;
391
  gcv.graphics_exposures = True;
307
  WinGC = XCreateGC (disp, root, gcm, &gcv);
392
  WinGC = XCreateGC (disp, root, gcm, &gcv);

Return to bug 156981