… | |
… | |
66 | #endif |
66 | #endif |
67 | #if USE_XIM |
67 | #if USE_XIM |
68 | "WM_LOCALE_NAME", |
68 | "WM_LOCALE_NAME", |
69 | "XIM_SERVERS", |
69 | "XIM_SERVERS", |
70 | #endif |
70 | #endif |
71 | #ifdef ENABLE_TRANSPARENCY |
71 | #if ENABLE_TRANSPARENCY |
72 | "_XROOTPMAP_ID", |
72 | "_XROOTPMAP_ID", |
73 | "ESETROOT_PMAP_ID", |
73 | "ESETROOT_PMAP_ID", |
74 | #endif |
74 | #endif |
75 | #if ENABLE_XEMBED |
75 | #if ENABLE_XEMBED |
76 | "_XEMBED", |
76 | "_XEMBED", |
… | |
… | |
153 | put (*this->begin ()); |
153 | put (*this->begin ()); |
154 | } |
154 | } |
155 | |
155 | |
156 | ///////////////////////////////////////////////////////////////////////////// |
156 | ///////////////////////////////////////////////////////////////////////////// |
157 | |
157 | |
158 | #ifdef USE_XIM |
158 | #if USE_XIM |
159 | |
159 | |
160 | static void |
160 | static void |
161 | #if XIMCB_PROTO_BROKEN |
161 | #if XIMCB_PROTO_BROKEN |
162 | im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3) |
162 | im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3) |
163 | #else |
163 | #else |
… | |
… | |
466 | blank_cursor = XCreateGlyphCursor (dpy, f, f, ' ', ' ', |
466 | blank_cursor = XCreateGlyphCursor (dpy, f, f, ' ', ' ', |
467 | &blackcolour, &blackcolour); |
467 | &blackcolour, &blackcolour); |
468 | XUnloadFont (dpy, f); |
468 | XUnloadFont (dpy, f); |
469 | #endif |
469 | #endif |
470 | |
470 | |
|
|
471 | flags = 0; |
|
|
472 | #if XRENDER |
|
|
473 | int major, minor; |
|
|
474 | if (XRenderQueryVersion (dpy, &major, &minor)) |
|
|
475 | { |
|
|
476 | flags |= DISPLAY_HAS_RENDER; |
|
|
477 | |
|
|
478 | if (major > 0 || (major == 0 && minor >= 10)) |
|
|
479 | flags |= DISPLAY_HAS_RENDER_10; |
|
|
480 | |
|
|
481 | if (major > 0 || (major == 0 && minor >= 11)) |
|
|
482 | flags |= DISPLAY_HAS_RENDER_MUL; |
|
|
483 | |
|
|
484 | XFilters *filters = XRenderQueryFilters (dpy, root); |
|
|
485 | if (filters) |
|
|
486 | { |
|
|
487 | for (int i = 0; i < filters->nfilter; i++) |
|
|
488 | if (!strcmp (filters->filter[i], FilterConvolution)) |
|
|
489 | flags |= DISPLAY_HAS_RENDER_CONV; |
|
|
490 | |
|
|
491 | XFree (filters); |
|
|
492 | } |
|
|
493 | } |
|
|
494 | #endif |
|
|
495 | |
471 | int fd = XConnectionNumber (dpy); |
496 | int fd = XConnectionNumber (dpy); |
472 | |
497 | |
473 | // try to detect whether we have a local connection. |
498 | // try to detect whether we have a local connection. |
474 | // assume unix domain socket == local, everything else not |
499 | // assume unix domain socket == local, everything else not |
475 | // TODO: might want to check for inet/127.0.0.1 |
500 | // TODO: might want to check for inet/127.0.0.1 |
… | |
… | |
512 | #ifdef POINTER_BLANK |
537 | #ifdef POINTER_BLANK |
513 | XFreeCursor (dpy, blank_cursor); |
538 | XFreeCursor (dpy, blank_cursor); |
514 | #endif |
539 | #endif |
515 | x_ev.stop (); |
540 | x_ev.stop (); |
516 | flush_ev.stop (); |
541 | flush_ev.stop (); |
517 | #ifdef USE_XIM |
542 | #if USE_XIM |
518 | xims.clear (); |
543 | xims.clear (); |
519 | #endif |
544 | #endif |
520 | XrmDestroyDatabase (XrmGetDatabase (dpy)); |
545 | XrmDestroyDatabase (XrmGetDatabase (dpy)); |
521 | XCloseDisplay (dpy); |
546 | XCloseDisplay (dpy); |
522 | } |
547 | } |
523 | |
548 | |
524 | #ifdef USE_XIM |
549 | #if USE_XIM |
525 | void rxvt_display::im_change_cb () |
550 | void rxvt_display::im_change_cb () |
526 | { |
551 | { |
527 | for (im_watcher **i = imw.begin (); i != imw.end (); ++i) |
552 | for (im_watcher **i = imw.begin (); i != imw.end (); ++i) |
528 | (*i)->call (); |
553 | (*i)->call (); |
529 | } |
554 | } |
… | |
… | |
565 | do |
590 | do |
566 | { |
591 | { |
567 | XEvent xev; |
592 | XEvent xev; |
568 | XNextEvent (dpy, &xev); |
593 | XNextEvent (dpy, &xev); |
569 | |
594 | |
570 | #ifdef USE_XIM |
595 | #if USE_XIM |
571 | if (!XFilterEvent (&xev, None)) |
596 | if (!XFilterEvent (&xev, None)) |
572 | { |
597 | { |
573 | if (xev.type == PropertyNotify |
598 | if (xev.type == PropertyNotify |
574 | && xev.xany.window == root |
599 | && xev.xany.window == root |
575 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
600 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
… | |
… | |
583 | if (!xw[i]) |
608 | if (!xw[i]) |
584 | xw.erase_unordered (i); |
609 | xw.erase_unordered (i); |
585 | else if (xw[i]->window == xev.xany.window) |
610 | else if (xw[i]->window == xev.xany.window) |
586 | xw[i]->call (xev); |
611 | xw[i]->call (xev); |
587 | } |
612 | } |
588 | #ifdef USE_XIM |
613 | #if USE_XIM |
589 | } |
614 | } |
590 | #endif |
615 | #endif |
591 | } |
616 | } |
592 | while (XEventsQueued (dpy, QueuedAlready)); |
617 | while (XEventsQueued (dpy, QueuedAlready)); |
593 | |
618 | |
… | |
… | |
624 | } |
649 | } |
625 | |
650 | |
626 | cur_owner = owner; |
651 | cur_owner = owner; |
627 | } |
652 | } |
628 | |
653 | |
629 | #ifdef USE_XIM |
654 | #if USE_XIM |
630 | |
655 | |
631 | void rxvt_display::reg (im_watcher *w) |
656 | void rxvt_display::reg (im_watcher *w) |
632 | { |
657 | { |
633 | imw.push_back (w); |
658 | imw.push_back (w); |
634 | } |
659 | } |
… | |
… | |
667 | #endif |
692 | #endif |
668 | |
693 | |
669 | Atom rxvt_display::atom (const char *name) |
694 | Atom rxvt_display::atom (const char *name) |
670 | { |
695 | { |
671 | return XInternAtom (dpy, name, False); |
696 | return XInternAtom (dpy, name, False); |
|
|
697 | } |
|
|
698 | |
|
|
699 | Pixmap |
|
|
700 | rxvt_display::get_pixmap_property (Atom property) |
|
|
701 | { |
|
|
702 | Pixmap pixmap = None; |
|
|
703 | |
|
|
704 | int aformat; |
|
|
705 | unsigned long nitems, bytes_after; |
|
|
706 | Atom atype; |
|
|
707 | unsigned char *prop; |
|
|
708 | int result = XGetWindowProperty (dpy, root, property, |
|
|
709 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
710 | &nitems, &bytes_after, &prop); |
|
|
711 | if (result == Success) |
|
|
712 | { |
|
|
713 | if (atype == XA_PIXMAP) |
|
|
714 | pixmap = *(Pixmap *)prop; |
|
|
715 | XFree (prop); |
|
|
716 | } |
|
|
717 | |
|
|
718 | return pixmap; |
672 | } |
719 | } |
673 | |
720 | |
674 | ///////////////////////////////////////////////////////////////////////////// |
721 | ///////////////////////////////////////////////////////////////////////////// |
675 | |
722 | |
676 | template class refcache<rxvt_display>; |
723 | template class refcache<rxvt_display>; |