… | |
… | |
33 | |
33 | |
34 | #if XFT |
34 | #if XFT |
35 | # include <X11/extensions/Xrender.h> |
35 | # include <X11/extensions/Xrender.h> |
36 | #endif |
36 | #endif |
37 | |
37 | |
38 | const char *const xa_names[] = |
38 | static const char *const xa_names[] = |
39 | { |
39 | { |
40 | "TEXT", |
40 | "TEXT", |
41 | "COMPOUND_TEXT", |
41 | "COMPOUND_TEXT", |
42 | "UTF8_STRING", |
42 | "UTF8_STRING", |
43 | "MULTIPLE", |
43 | "MULTIPLE", |
… | |
… | |
227 | { |
227 | { |
228 | } |
228 | } |
229 | |
229 | |
230 | rxvt_drawable &rxvt_screen::scratch_drawable (int w, int h) |
230 | rxvt_drawable &rxvt_screen::scratch_drawable (int w, int h) |
231 | { |
231 | { |
232 | // it's actually faster to re-allocate every time. don't ask me |
|
|
233 | // why, but its likely no big deal there are no roundtrips |
|
|
234 | // (I think/hope). |
|
|
235 | if (!scratch_area || w > scratch_w || h > scratch_h || 1/*D*/) |
232 | if (!scratch_area || w > scratch_w || h > scratch_h) |
236 | { |
233 | { |
237 | if (scratch_area) |
234 | if (scratch_area) |
238 | { |
235 | { |
239 | XFreePixmap (dpy, scratch_area->drawable); |
236 | XFreePixmap (dpy, scratch_area->drawable); |
240 | delete scratch_area; |
237 | delete scratch_area; |
… | |
… | |
362 | XA_STRING, &actual_type, &actual_format, |
359 | XA_STRING, &actual_type, &actual_format, |
363 | &nitems, &nremaining, |
360 | &nitems, &nremaining, |
364 | (unsigned char **)&val) == Success |
361 | (unsigned char **)&val) == Success |
365 | && actual_type == XA_STRING |
362 | && actual_type == XA_STRING |
366 | && actual_format == 8) |
363 | && actual_format == 8) |
367 | displayResource = val; |
364 | displayResource = val; |
368 | else |
365 | else |
369 | { |
366 | { |
370 | displayResource = 0; |
367 | displayResource = 0; |
371 | |
368 | |
372 | if (val) |
369 | if (val) |
373 | XFree(val); |
370 | XFree (val); |
374 | } |
371 | } |
375 | |
372 | |
376 | #if XLIB_ILLEGAL_ACCESS |
373 | #if XLIB_ILLEGAL_ACCESS |
377 | dpy->xdefaults = displayResource; |
374 | dpy->xdefaults = displayResource; |
378 | #endif |
375 | #endif |
379 | } |
376 | } |
… | |
… | |
446 | return false; |
443 | return false; |
447 | |
444 | |
448 | screen = DefaultScreen (dpy); |
445 | screen = DefaultScreen (dpy); |
449 | root = DefaultRootWindow (dpy); |
446 | root = DefaultRootWindow (dpy); |
450 | |
447 | |
451 | assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); |
448 | assert (ARRAY_LENGTH(xa_names) == NUM_XA); |
452 | XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa); |
449 | XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa); |
453 | |
450 | |
454 | XrmSetDatabase (dpy, get_resources (false)); |
451 | XrmSetDatabase (dpy, get_resources (false)); |
455 | |
452 | |
456 | #ifdef POINTER_BLANK |
453 | #ifdef POINTER_BLANK |
… | |
… | |
507 | x_ev.stop (); |
504 | x_ev.stop (); |
508 | flush_ev.stop (); |
505 | flush_ev.stop (); |
509 | #ifdef USE_XIM |
506 | #ifdef USE_XIM |
510 | xims.clear (); |
507 | xims.clear (); |
511 | #endif |
508 | #endif |
|
|
509 | XrmDestroyDatabase (XrmGetDatabase (dpy)); |
512 | XCloseDisplay (dpy); |
510 | XCloseDisplay (dpy); |
513 | } |
511 | } |
514 | |
512 | |
515 | #ifdef USE_XIM |
513 | #ifdef USE_XIM |
516 | void rxvt_display::im_change_cb () |
514 | void rxvt_display::im_change_cb () |
… | |
… | |
528 | unsigned long nitems, bytes_after; |
526 | unsigned long nitems, bytes_after; |
529 | |
527 | |
530 | if (XGetWindowProperty (dpy, root, xa[XA_XIM_SERVERS], 0L, 1000000L, |
528 | if (XGetWindowProperty (dpy, root, xa[XA_XIM_SERVERS], 0L, 1000000L, |
531 | False, XA_ATOM, &actual_type, &actual_format, |
529 | False, XA_ATOM, &actual_type, &actual_format, |
532 | &nitems, &bytes_after, (unsigned char **)&atoms) |
530 | &nitems, &bytes_after, (unsigned char **)&atoms) |
533 | != Success ) |
531 | != Success) |
534 | return; |
532 | return; |
535 | |
533 | |
536 | if (actual_type == XA_ATOM && actual_format == 32) |
534 | if (actual_type == XA_ATOM && actual_format == 32) |
537 | for (int i = 0; i < nitems; i++) |
535 | for (int i = 0; i < nitems; i++) |
538 | if (XGetSelectionOwner (dpy, atoms[i])) |
536 | if (XGetSelectionOwner (dpy, atoms[i])) |
539 | { |
537 | { |
540 | im_change_cb (); |
538 | im_change_cb (); |
541 | break; |
539 | break; |