… | |
… | |
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 | |
… | |
… | |
93 | } |
131 | } |
94 | |
132 | |
95 | ///////////////////////////////////////////////////////////////////////////// |
133 | ///////////////////////////////////////////////////////////////////////////// |
96 | |
134 | |
97 | #ifdef USE_XIM |
135 | #ifdef USE_XIM |
|
|
136 | |
98 | static void |
137 | static void |
99 | #if XIMCB_PROTO_BROKEN |
138 | #if XIMCB_PROTO_BROKEN |
100 | im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3) |
139 | im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3) |
101 | #else |
140 | #else |
102 | im_destroy_cb (XIM unused1, XPointer client_data, XPointer unused3) |
141 | im_destroy_cb (XIM unused1, XPointer client_data, XPointer unused3) |
… | |
… | |
133 | rxvt_xim::~rxvt_xim () |
172 | rxvt_xim::~rxvt_xim () |
134 | { |
173 | { |
135 | if (xim) |
174 | if (xim) |
136 | XCloseIM (xim); |
175 | XCloseIM (xim); |
137 | } |
176 | } |
|
|
177 | |
138 | #endif |
178 | #endif |
139 | |
179 | |
140 | ///////////////////////////////////////////////////////////////////////////// |
180 | ///////////////////////////////////////////////////////////////////////////// |
141 | |
181 | |
142 | rxvt_display::rxvt_display (const char *id) |
182 | rxvt_display::rxvt_display (const char *id) |
… | |
… | |
250 | screen = DefaultScreen (display); |
290 | screen = DefaultScreen (display); |
251 | root = DefaultRootWindow (display); |
291 | root = DefaultRootWindow (display); |
252 | visual = DefaultVisual (display, screen); |
292 | visual = DefaultVisual (display, screen); |
253 | cmap = DefaultColormap (display, screen); |
293 | cmap = DefaultColormap (display, screen); |
254 | 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); |
255 | |
298 | |
256 | XrmSetDatabase (display, get_resources ()); |
299 | XrmSetDatabase (display, get_resources ()); |
257 | |
300 | |
258 | #ifdef POINTER_BLANK |
301 | #ifdef POINTER_BLANK |
259 | XColor blackcolour; |
302 | XColor blackcolour; |
… | |
… | |
301 | |
344 | |
302 | x_ev.start (fd, EVENT_READ); |
345 | x_ev.start (fd, EVENT_READ); |
303 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
346 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
304 | |
347 | |
305 | XSelectInput (display, root, PropertyChangeMask); |
348 | XSelectInput (display, root, PropertyChangeMask); |
306 | #ifdef USE_XIM |
|
|
307 | xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0); |
|
|
308 | #endif |
|
|
309 | |
349 | |
310 | flush (); |
350 | flush (); |
311 | |
351 | |
312 | return true; |
352 | return true; |
313 | } |
353 | } |
… | |
… | |
349 | // registers, as xlib crashes due to a race otherwise. |
389 | // registers, as xlib crashes due to a race otherwise. |
350 | Atom actual_type, *atoms; |
390 | Atom actual_type, *atoms; |
351 | int actual_format; |
391 | int actual_format; |
352 | unsigned long nitems, bytes_after; |
392 | unsigned long nitems, bytes_after; |
353 | |
393 | |
354 | if (XGetWindowProperty (display, root, xa_xim_servers, 0L, 1000000L, |
394 | if (XGetWindowProperty (display, root, xa[XA_XIM_SERVERS], 0L, 1000000L, |
355 | False, XA_ATOM, &actual_type, &actual_format, |
395 | False, XA_ATOM, &actual_type, &actual_format, |
356 | &nitems, &bytes_after, (unsigned char **)&atoms) |
396 | &nitems, &bytes_after, (unsigned char **)&atoms) |
357 | != Success ) |
397 | != Success ) |
358 | return; |
398 | return; |
359 | |
399 | |
… | |
… | |
379 | #ifdef USE_XIM |
419 | #ifdef USE_XIM |
380 | if (!XFilterEvent (&xev, None)) |
420 | if (!XFilterEvent (&xev, None)) |
381 | { |
421 | { |
382 | if (xev.type == PropertyNotify |
422 | if (xev.type == PropertyNotify |
383 | && xev.xany.window == root |
423 | && xev.xany.window == root |
384 | && xev.xproperty.atom == xa_xim_servers) |
424 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
385 | im_change_check (); |
425 | im_change_check (); |
386 | #endif |
426 | #endif |
387 | for (int i = xw.size (); i--; ) |
427 | for (int i = xw.size (); i--; ) |
388 | { |
428 | { |
389 | if (!xw[i]) |
429 | if (!xw[i]) |