… | |
… | |
131 | |
131 | |
132 | struct logfile_entry *loglist = NULL, *loglist_tail = NULL; |
132 | struct logfile_entry *loglist = NULL, *loglist_tail = NULL; |
133 | |
133 | |
134 | Display *disp; |
134 | Display *disp; |
135 | Window root; |
135 | Window root; |
|
|
136 | #ifdef USE_TOON_GET_ROOT_WINDOW |
|
|
137 | Window real_root; |
|
|
138 | #endif /* USE_TOON_GET_ROOT_WINDOW */ |
136 | GC WinGC; |
139 | GC WinGC; |
137 | |
140 | |
138 | #if HAS_REGEX |
141 | #if HAS_REGEX |
139 | struct re_list |
142 | struct re_list |
140 | { |
143 | { |
… | |
… | |
151 | /* prototypes */ |
154 | /* prototypes */ |
152 | void list_files (int); |
155 | void list_files (int); |
153 | void force_reopen (int); |
156 | void force_reopen (int); |
154 | void force_refresh (int); |
157 | void force_refresh (int); |
155 | void blank_window (int); |
158 | void blank_window (int); |
|
|
159 | #ifdef USE_TOON_GET_ROOT_WINDOW |
|
|
160 | Window ToonGetRootWindow(Display *, int, Window *); |
|
|
161 | #endif /* USE_TOON_GET_ROOT_WINDOW */ |
156 | |
162 | |
157 | void InitWindow (void); |
163 | void InitWindow (void); |
158 | unsigned long GetColor (const char *); |
164 | unsigned long GetColor (const char *); |
159 | void redraw (int); |
165 | void redraw (int); |
160 | void refresh (int, int, int, int); |
166 | void refresh (int, int, int, int); |
… | |
… | |
210 | GetColor (const char *ColorName) |
216 | GetColor (const char *ColorName) |
211 | { |
217 | { |
212 | XColor Color; |
218 | XColor Color; |
213 | XWindowAttributes Attributes; |
219 | XWindowAttributes Attributes; |
214 | |
220 | |
|
|
221 | #ifdef USE_TOON_GET_ROOT_WINDOW |
|
|
222 | XGetWindowAttributes (disp, real_root, &Attributes); |
|
|
223 | #else /* USE_TOON_GET_ROOT_WINDOW */ |
215 | XGetWindowAttributes (disp, root, &Attributes); |
224 | XGetWindowAttributes (disp, root, &Attributes); |
|
|
225 | #endif /* USE_TOON_GET_ROOT_WINDOW */ |
216 | Color.pixel = 0; |
226 | Color.pixel = 0; |
217 | |
227 | |
218 | if (!XParseColor (disp, Attributes.colormap, ColorName, &Color)) |
228 | if (!XParseColor (disp, Attributes.colormap, ColorName, &Color)) |
219 | fprintf (stderr, "can't parse %s\n", ColorName); |
229 | fprintf (stderr, "can't parse %s\n", ColorName); |
220 | else if (!XAllocColor (disp, Attributes.colormap, &Color)) |
230 | else if (!XAllocColor (disp, Attributes.colormap, &Color)) |
221 | fprintf (stderr, "can't allocate %s\n", ColorName); |
231 | fprintf (stderr, "can't allocate %s\n", ColorName); |
222 | |
232 | |
223 | return Color.pixel; |
233 | return Color.pixel; |
224 | } |
234 | } |
225 | |
235 | |
|
|
236 | #ifndef USE_TOON_GET_ROOT_WINDOW |
226 | static Window |
237 | static Window |
227 | root_window (Display * display, int screen_number) |
238 | root_window (Display * display, int screen_number) |
228 | { |
239 | { |
229 | Atom SWM_VROOT = XInternAtom (display, "__SWM_VROOT", False); |
240 | Atom SWM_VROOT = XInternAtom (display, "__SWM_VROOT", False); |
230 | Window real_root_window = RootWindow (display, screen_number); |
241 | Window real_root_window = RootWindow (display, screen_number); |
… | |
… | |
283 | /* This shouldn't happen. The Xlib documentation is wrong BTW. */ |
294 | /* This shouldn't happen. The Xlib documentation is wrong BTW. */ |
284 | fprintf (stderr, "Can't intern atom __SWM_VROOT"); |
295 | fprintf (stderr, "Can't intern atom __SWM_VROOT"); |
285 | |
296 | |
286 | return real_root_window; |
297 | return real_root_window; |
287 | } |
298 | } |
|
|
299 | #endif /* USE_TOON_GET_ROOT_WINDOW */ |
288 | |
300 | |
289 | void |
301 | void |
290 | InitWindow (void) |
302 | InitWindow (void) |
291 | { |
303 | { |
292 | XGCValues gcv; |
304 | XGCValues gcv; |
… | |
… | |
302 | |
314 | |
303 | screen = DefaultScreen (disp); |
315 | screen = DefaultScreen (disp); |
304 | ScreenHeight = DisplayHeight (disp, screen); |
316 | ScreenHeight = DisplayHeight (disp, screen); |
305 | ScreenWidth = DisplayWidth (disp, screen); |
317 | ScreenWidth = DisplayWidth (disp, screen); |
306 | |
318 | |
|
|
319 | #ifdef USE_TOON_GET_ROOT_WINDOW |
|
|
320 | real_root = RootWindow(disp, screen); |
|
|
321 | root = ToonGetRootWindow( disp, screen, &real_root ); |
|
|
322 | #else /* USE_TOON_GET_ROOT_WINDOW */ |
307 | root = root_window (disp, screen); |
323 | root = root_window (disp, screen); |
|
|
324 | #endif /* USE_TOON_GET_ROOT_WINDOW */ |
308 | |
325 | |
309 | gcm = GCBackground; |
326 | gcm = GCBackground; |
310 | gcv.graphics_exposures = True; |
327 | gcv.graphics_exposures = True; |
311 | WinGC = XCreateGC (disp, root, gcm, &gcv); |
328 | WinGC = XCreateGC (disp, root, gcm, &gcv); |
312 | XMapWindow (disp, root); |
329 | XMapWindow (disp, root); |