… | |
… | |
82 | delete obj; |
82 | delete obj; |
83 | } |
83 | } |
84 | } |
84 | } |
85 | |
85 | |
86 | template<class T> |
86 | template<class T> |
87 | refcache<T>::~refcache () |
87 | void refcache<T>::clear () |
88 | { |
88 | { |
89 | while (this->size ()) |
89 | while (this->size ()) |
90 | put (*this->begin ()); |
90 | put (*this->begin ()); |
91 | } |
91 | } |
92 | |
92 | |
… | |
… | |
166 | sockaddr_un sa; |
166 | sockaddr_un sa; |
167 | socklen_t sl = sizeof (sa); |
167 | socklen_t sl = sizeof (sa); |
168 | |
168 | |
169 | if (!getsockname (fd, (sockaddr *)&sa, &sl)) |
169 | if (!getsockname (fd, (sockaddr *)&sa, &sl)) |
170 | is_local = sa.sun_family == AF_LOCAL; |
170 | is_local = sa.sun_family == AF_LOCAL; |
|
|
171 | #endif |
|
|
172 | |
|
|
173 | #ifdef POINTER_BLANK |
|
|
174 | XColor blackcolour; |
|
|
175 | blackcolour.red = 0; |
|
|
176 | blackcolour.green = 0; |
|
|
177 | blackcolour.blue = 0; |
|
|
178 | Font f = XLoadFont (display, "fixed"); |
|
|
179 | blank_cursor = XCreateGlyphCursor (display, f, f, ' ', ' ', |
|
|
180 | &blackcolour, &blackcolour); |
|
|
181 | XUnloadFont (display, f); |
171 | #endif |
182 | #endif |
172 | |
183 | |
173 | #ifdef PREFER_24BIT |
184 | #ifdef PREFER_24BIT |
174 | /* |
185 | /* |
175 | * If depth is not 24, look for a 24bit visual. |
186 | * If depth is not 24, look for a 24bit visual. |
… | |
… | |
203 | } |
214 | } |
204 | |
215 | |
205 | rxvt_display::~rxvt_display () |
216 | rxvt_display::~rxvt_display () |
206 | { |
217 | { |
207 | x_ev.stop (); |
218 | x_ev.stop (); |
|
|
219 | #ifdef USE_XIM |
|
|
220 | xims.clear (); |
|
|
221 | #endif |
208 | |
222 | |
209 | if (display) |
223 | if (display) |
210 | XCloseDisplay (display); |
224 | XCloseDisplay (display); |
211 | } |
225 | } |
212 | |
226 | |
… | |
… | |
217 | (*i)->call (); |
231 | (*i)->call (); |
218 | } |
232 | } |
219 | |
233 | |
220 | void rxvt_display::im_change_check () |
234 | void rxvt_display::im_change_check () |
221 | { |
235 | { |
222 | // make sure we only call im_change_cb when a new input method |
236 | // try to only call im_change_cb when a new input method |
223 | // registers, as xlib crashes due to a race otherwise. |
237 | // registers, as xlib crashes due to a race otherwise. |
224 | Atom actual_type, *atoms; |
238 | Atom actual_type, *atoms; |
225 | int actual_format; |
239 | int actual_format; |
226 | unsigned long nitems, bytes_after; |
240 | unsigned long nitems, bytes_after; |
227 | |
241 | |
… | |
… | |
270 | } |
284 | } |
271 | #endif |
285 | #endif |
272 | } |
286 | } |
273 | while (XEventsQueued (display, QueuedAlready)); |
287 | while (XEventsQueued (display, QueuedAlready)); |
274 | |
288 | |
275 | flush (); |
289 | XFlush (display); |
276 | } |
290 | } |
277 | |
291 | |
278 | void rxvt_display::flush () |
292 | void rxvt_display::flush () |
279 | { |
293 | { |
|
|
294 | if (XEventsQueued (display, QueuedAlready)) |
|
|
295 | x_cb (x_ev, EVENT_READ); |
|
|
296 | |
280 | XFlush (display); |
297 | XFlush (display); |
281 | } |
298 | } |
282 | |
299 | |
283 | void rxvt_display::reg (xevent_watcher *w) |
300 | void rxvt_display::reg (xevent_watcher *w) |
284 | { |
301 | { |
… | |
… | |
332 | return xim; |
349 | return xim; |
333 | } |
350 | } |
334 | |
351 | |
335 | void rxvt_display::put_xim (rxvt_xim *xim) |
352 | void rxvt_display::put_xim (rxvt_xim *xim) |
336 | { |
353 | { |
|
|
354 | #if XLIB_IS_RACEFREE |
337 | xims.put (xim); |
355 | xims.put (xim); |
|
|
356 | #endif |
338 | } |
357 | } |
339 | #endif |
358 | #endif |
340 | |
359 | |
341 | Atom rxvt_display::atom (const char *name) |
360 | Atom rxvt_display::atom (const char *name) |
342 | { |
361 | { |