Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 68256 | Differences between
and this patch

Collapse All | Expand All

(-)MPlayer-1.0pre5/libvo/vroot.h (+151 lines)
Line 0 Link Here
1
/* -*- Mode: C; tab-width: 2 -*-                                             */
2
/*****************************************************************************/
3
/**                   Copyright 1991 by Andreas Stolcke                     **/
4
/**               Copyright 1990 by Solbourne Computer Inc.                 **/
5
/**                          Longmont, Colorado                             **/
6
/**                                                                         **/
7
/**                           All Rights Reserved                           **/
8
/**                                                                         **/
9
/**    Permission to use, copy, modify, and distribute this software and    **/
10
/**    its documentation  for  any  purpose  and  without  fee is hereby    **/
11
/**    granted, provided that the above copyright notice appear  in  all    **/
12
/**    copies and that both  that  copyright  notice  and  this  permis-    **/
13
/**    sion  notice appear in supporting  documentation,  and  that  the    **/
14
/**    name of Solbourne not be used in advertising                         **/
15
/**    in publicity pertaining to distribution of the  software  without    **/
16
/**    specific, written prior permission.                                  **/
17
/**                                                                         **/
18
/**    ANDREAS STOLCKE AND SOLBOURNE COMPUTER INC. DISCLAIMS ALL WARRANTIES **/
19
/**    WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF    **/
20
/**    MERCHANTABILITY  AND  FITNESS,  IN  NO  EVENT SHALL ANDREAS STOLCKE  **/
21
/**    OR SOLBOURNE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL    **/
22
/**    DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA   **/
23
/**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
24
/**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
25
/**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
26
/*****************************************************************************/
27
/*
28
 * vroot.h -- Virtual Root Window handling header file
29
 *
30
 * This header file redefines the X11 macros RootWindow and DefaultRootWindow,
31
 * making them look for a virtual root window as provided by certain `virtual'
32
 * window managers like swm and tvtwm. If none is found, the ordinary root
33
 * window is returned, thus retaining backward compatibility with standard
34
 * window managers.
35
 * The function implementing the virtual root lookup remembers the result of
36
 * its last invocation to avoid overhead in the case of repeated calls
37
 * on the same display and screen arguments. 
38
 * The lookup code itself is taken from Tom LaStrange's ssetroot program.
39
 *
40
 * Most simple root window changing X programs can be converted to using
41
 * virtual roots by just including
42
 *
43
 * #include <X11/vroot.h>
44
 *
45
 * after all the X11 header files.  It has been tested on such popular
46
 * X clients as xphoon, xfroot, xloadimage, and xaqua.
47
 * It also works with the core clients xprop, xwininfo, xwd, and editres
48
 * (and is necessary to get those clients working under tvtwm).
49
 * It does NOT work with xsetroot; get the xsetroot replacement included in
50
 * the tvtwm distribution instead.
51
 *
52
 * Andreas Stolcke <stolcke@ICSI.Berkeley.EDU>, 9/7/90
53
 * - replaced all NULL's with properly cast 0's, 5/6/91
54
 * - free children list (suggested by Mark Martin <mmm@cetia.fr>), 5/16/91
55
 * - include X11/Xlib.h and support RootWindowOfScreen, too 9/17/91
56
 *
57
 * Jamie Zawinski <jwz@jwz.org>, 28-Apr-1997
58
 * - use ANSI C
59
 *
60
 * Jamie Zawinski <jwz@jwz.org>, 3-Sep-2003
61
 * - if the environment variable "XSCREENSAVER_WINDOW" is set, use that
62
 *   as the root window instead of searching for __SWM_VROOT.
63
 */
64
65
#ifndef _VROOT_H_
66
#define _VROOT_H_
67
#define _XSCREENSAVER_VROOT_H_
68
69
#if !defined(lint) && !defined(SABER)
70
static const char vroot_rcsid[] =
71
 "#Id: vroot.h,v 1.5 2003/09/04 01:04:38 jwz Exp #" "\n"
72
 "#Id: vroot.h,v 1.4 1991/09/30 19:23:16 stolcke Exp stolcke #";
73
#endif
74
75
#include <stdlib.h>
76
#include <X11/X.h>
77
#include <X11/Xatom.h>
78
#include <X11/Xlib.h>
79
80
static Window
81
#ifdef __STDC__ /* ANSIfication added by jwz, to avoid superfluous warnings. */
82
VirtualRootWindowOfScreen(Screen *screen)
83
#else /* !__STDC__ */
84
VirtualRootWindowOfScreen(screen) Screen *screen;
85
#endif /* !__STDC__ */
86
{
87
	static Screen *save_screen = (Screen *)0;
88
	static Window root = (Window)0;
89
90
	if (screen != save_screen) {
91
		Display *dpy = DisplayOfScreen(screen);
92
		Atom __SWM_VROOT = None;
93
		int i;
94
		Window rootReturn, parentReturn, *children;
95
		unsigned int numChildren;
96
97
    /* first check for a hex or decimal window ID in the environment */
98
    const char *xss_id = getenv("XSCREENSAVER_WINDOW");
99
    if (xss_id && *xss_id) {
100
      unsigned long id = 0;
101
      char c;
102
      if (1 == sscanf (xss_id, " 0x%lx %c", &id, &c) ||
103
          1 == sscanf (xss_id, " %lu %c",   &id, &c)) {
104
        root = (Window) id;
105
        save_screen = screen;
106
        return root;
107
      }
108
    }
109
110
		root = RootWindowOfScreen(screen);
111
112
		/* go look for a virtual root */
113
		__SWM_VROOT = XInternAtom(dpy, "__SWM_VROOT", False);
114
		if (XQueryTree(dpy, root, &rootReturn, &parentReturn,
115
				 &children, &numChildren)) {
116
			for (i = 0; i < numChildren; i++) {
117
				Atom actual_type;
118
				int actual_format;
119
				unsigned long nitems, bytesafter;
120
				Window *newRoot = (Window *)0;
121
122
				if (XGetWindowProperty(dpy, children[i],
123
					__SWM_VROOT, 0, 1, False, XA_WINDOW,
124
					&actual_type, &actual_format,
125
					&nitems, &bytesafter,
126
					(unsigned char **) &newRoot) == Success
127
				    && newRoot) {
128
				    root = *newRoot;
129
				    break;
130
				}
131
			}
132
			if (children)
133
				XFree((char *)children);
134
		}
135
136
		save_screen = screen;
137
	}
138
139
	return root;
140
}
141
142
#undef RootWindowOfScreen
143
#define RootWindowOfScreen(s) VirtualRootWindowOfScreen(s)
144
145
#undef RootWindow
146
#define RootWindow(dpy,screen) VirtualRootWindowOfScreen(ScreenOfDisplay(dpy,screen))
147
148
#undef DefaultRootWindow
149
#define DefaultRootWindow(dpy) VirtualRootWindowOfScreen(DefaultScreenOfDisplay(dpy))
150
151
#endif /* _VROOT_H_ */
(-)MPlayer-1.0pre5/libvo/x11_common.h (+2 lines)
Lines 7-12 Link Here
7
#include <X11/Xlib.h>
7
#include <X11/Xlib.h>
8
#include <X11/Xutil.h>
8
#include <X11/Xutil.h>
9
9
10
#include "vroot.h"
11
10
#define vo_wm_LAYER 1
12
#define vo_wm_LAYER 1
11
#define vo_wm_FULLSCREEN 2
13
#define vo_wm_FULLSCREEN 2
12
#define vo_wm_STAYS_ON_TOP 4
14
#define vo_wm_STAYS_ON_TOP 4

Return to bug 68256