… | |
… | |
32 | #ifndef NO_SLOW_LINK_SUPPORT |
32 | #ifndef NO_SLOW_LINK_SUPPORT |
33 | # include <sys/socket.h> |
33 | # include <sys/socket.h> |
34 | # include <sys/un.h> |
34 | # include <sys/un.h> |
35 | #endif |
35 | #endif |
36 | |
36 | |
|
|
37 | const char *const xa_names[] = |
|
|
38 | { |
|
|
39 | "TEXT", |
|
|
40 | "COMPOUND_TEXT", |
|
|
41 | "UTF8_STRING", |
|
|
42 | "MULTIPLE", |
|
|
43 | "TARGETS", |
|
|
44 | "TIMESTAMP", |
|
|
45 | "VT_SELECTION", |
|
|
46 | "INCR", |
|
|
47 | "WM_PROTOCOLS", |
|
|
48 | "WM_DELETE_WINDOW", |
|
|
49 | "CLIPBOARD", |
|
|
50 | #if ENABLE_FRILLS |
|
|
51 | "_MOTIF_WM_HINTS", |
|
|
52 | #endif |
|
|
53 | #if ENABLE_EWMH |
|
|
54 | "_NET_WM_PID", |
|
|
55 | "_NET_WM_NAME", |
|
|
56 | "_NET_WM_ICON_NAME", |
|
|
57 | "_NET_WM_PING", |
|
|
58 | #endif |
|
|
59 | #if USE_XIM |
|
|
60 | "WM_LOCALE_NAME", |
|
|
61 | "XIM_SERVERS", |
|
|
62 | #endif |
|
|
63 | #ifdef TRANSPARENT |
|
|
64 | "_XROOTPMAP_ID", |
|
|
65 | "ESETROOT_PMAP_ID", |
|
|
66 | #endif |
|
|
67 | #if ENABLE_XEMBED |
|
|
68 | "_XEMBED", |
|
|
69 | "_XEMBED_INFO", |
|
|
70 | #endif |
|
|
71 | }; |
|
|
72 | |
|
|
73 | ///////////////////////////////////////////////////////////////////////////// |
|
|
74 | |
37 | refcounted::refcounted (const char *id) |
75 | refcounted::refcounted (const char *id) |
38 | { |
76 | { |
39 | this->id = strdup (id); |
77 | this->id = strdup (id); |
40 | } |
78 | } |
41 | |
79 | |
… | |
… | |
252 | screen = DefaultScreen (display); |
290 | screen = DefaultScreen (display); |
253 | root = DefaultRootWindow (display); |
291 | root = DefaultRootWindow (display); |
254 | visual = DefaultVisual (display, screen); |
292 | visual = DefaultVisual (display, screen); |
255 | cmap = DefaultColormap (display, screen); |
293 | cmap = DefaultColormap (display, screen); |
256 | depth = DefaultDepth (display, screen); |
294 | depth = DefaultDepth (display, screen); |
|
|
295 | |
|
|
296 | assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); |
|
|
297 | XInternAtoms (display, (char **)xa_names, NUM_XA, False, xa); |
257 | |
298 | |
258 | XrmSetDatabase (display, get_resources ()); |
299 | XrmSetDatabase (display, get_resources ()); |
259 | |
300 | |
260 | #ifdef POINTER_BLANK |
301 | #ifdef POINTER_BLANK |
261 | XColor blackcolour; |
302 | XColor blackcolour; |
… | |
… | |
303 | |
344 | |
304 | x_ev.start (fd, EVENT_READ); |
345 | x_ev.start (fd, EVENT_READ); |
305 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
346 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
306 | |
347 | |
307 | XSelectInput (display, root, PropertyChangeMask); |
348 | XSelectInput (display, root, PropertyChangeMask); |
308 | #ifdef USE_XIM |
|
|
309 | xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0); |
|
|
310 | #endif |
|
|
311 | |
349 | |
312 | flush (); |
350 | flush (); |
313 | |
351 | |
314 | return true; |
352 | return true; |
315 | } |
353 | } |
… | |
… | |
351 | // registers, as xlib crashes due to a race otherwise. |
389 | // registers, as xlib crashes due to a race otherwise. |
352 | Atom actual_type, *atoms; |
390 | Atom actual_type, *atoms; |
353 | int actual_format; |
391 | int actual_format; |
354 | unsigned long nitems, bytes_after; |
392 | unsigned long nitems, bytes_after; |
355 | |
393 | |
356 | if (XGetWindowProperty (display, root, xa_xim_servers, 0L, 1000000L, |
394 | if (XGetWindowProperty (display, root, xa[XA_XIM_SERVERS], 0L, 1000000L, |
357 | False, XA_ATOM, &actual_type, &actual_format, |
395 | False, XA_ATOM, &actual_type, &actual_format, |
358 | &nitems, &bytes_after, (unsigned char **)&atoms) |
396 | &nitems, &bytes_after, (unsigned char **)&atoms) |
359 | != Success ) |
397 | != Success ) |
360 | return; |
398 | return; |
361 | |
399 | |
… | |
… | |
381 | #ifdef USE_XIM |
419 | #ifdef USE_XIM |
382 | if (!XFilterEvent (&xev, None)) |
420 | if (!XFilterEvent (&xev, None)) |
383 | { |
421 | { |
384 | if (xev.type == PropertyNotify |
422 | if (xev.type == PropertyNotify |
385 | && xev.xany.window == root |
423 | && xev.xany.window == root |
386 | && xev.xproperty.atom == xa_xim_servers) |
424 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
387 | im_change_check (); |
425 | im_change_check (); |
388 | #endif |
426 | #endif |
389 | for (int i = xw.size (); i--; ) |
427 | for (int i = xw.size (); i--; ) |
390 | { |
428 | { |
391 | if (!xw[i]) |
429 | if (!xw[i]) |