… | |
… | |
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 >= 11)) |
|
|
479 | flags |= DISPLAY_HAS_RENDER_MUL; |
|
|
480 | |
|
|
481 | XFilters *filters = XRenderQueryFilters (dpy, root); |
|
|
482 | if (filters) |
|
|
483 | { |
|
|
484 | for (int i = 0; i < filters->nfilter; i++) |
|
|
485 | if (!strcmp (filters->filter[i], FilterConvolution)) |
|
|
486 | flags |= DISPLAY_HAS_RENDER_CONV; |
|
|
487 | |
|
|
488 | XFree (filters); |
|
|
489 | } |
|
|
490 | } |
|
|
491 | #endif |
|
|
492 | |
471 | int fd = XConnectionNumber (dpy); |
493 | int fd = XConnectionNumber (dpy); |
472 | |
494 | |
473 | // try to detect whether we have a local connection. |
495 | // try to detect whether we have a local connection. |
474 | // assume unix domain socket == local, everything else not |
496 | // assume unix domain socket == local, everything else not |
475 | // TODO: might want to check for inet/127.0.0.1 |
497 | // TODO: might want to check for inet/127.0.0.1 |
… | |
… | |
512 | #ifdef POINTER_BLANK |
534 | #ifdef POINTER_BLANK |
513 | XFreeCursor (dpy, blank_cursor); |
535 | XFreeCursor (dpy, blank_cursor); |
514 | #endif |
536 | #endif |
515 | x_ev.stop (); |
537 | x_ev.stop (); |
516 | flush_ev.stop (); |
538 | flush_ev.stop (); |
517 | #ifdef USE_XIM |
539 | #if USE_XIM |
518 | xims.clear (); |
540 | xims.clear (); |
519 | #endif |
541 | #endif |
520 | XrmDestroyDatabase (XrmGetDatabase (dpy)); |
542 | XrmDestroyDatabase (XrmGetDatabase (dpy)); |
521 | XCloseDisplay (dpy); |
543 | XCloseDisplay (dpy); |
522 | } |
544 | } |
523 | |
545 | |
524 | #ifdef USE_XIM |
546 | #if USE_XIM |
525 | void rxvt_display::im_change_cb () |
547 | void rxvt_display::im_change_cb () |
526 | { |
548 | { |
527 | for (im_watcher **i = imw.begin (); i != imw.end (); ++i) |
549 | for (im_watcher **i = imw.begin (); i != imw.end (); ++i) |
528 | (*i)->call (); |
550 | (*i)->call (); |
529 | } |
551 | } |
… | |
… | |
565 | do |
587 | do |
566 | { |
588 | { |
567 | XEvent xev; |
589 | XEvent xev; |
568 | XNextEvent (dpy, &xev); |
590 | XNextEvent (dpy, &xev); |
569 | |
591 | |
570 | #ifdef USE_XIM |
592 | #if USE_XIM |
571 | if (!XFilterEvent (&xev, None)) |
593 | if (!XFilterEvent (&xev, None)) |
572 | { |
594 | { |
573 | if (xev.type == PropertyNotify |
595 | if (xev.type == PropertyNotify |
574 | && xev.xany.window == root |
596 | && xev.xany.window == root |
575 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
597 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
… | |
… | |
583 | if (!xw[i]) |
605 | if (!xw[i]) |
584 | xw.erase_unordered (i); |
606 | xw.erase_unordered (i); |
585 | else if (xw[i]->window == xev.xany.window) |
607 | else if (xw[i]->window == xev.xany.window) |
586 | xw[i]->call (xev); |
608 | xw[i]->call (xev); |
587 | } |
609 | } |
588 | #ifdef USE_XIM |
610 | #if USE_XIM |
589 | } |
611 | } |
590 | #endif |
612 | #endif |
591 | } |
613 | } |
592 | while (XEventsQueued (dpy, QueuedAlready)); |
614 | while (XEventsQueued (dpy, QueuedAlready)); |
593 | |
615 | |
… | |
… | |
624 | } |
646 | } |
625 | |
647 | |
626 | cur_owner = owner; |
648 | cur_owner = owner; |
627 | } |
649 | } |
628 | |
650 | |
629 | #ifdef USE_XIM |
651 | #if USE_XIM |
630 | |
652 | |
631 | void rxvt_display::reg (im_watcher *w) |
653 | void rxvt_display::reg (im_watcher *w) |
632 | { |
654 | { |
633 | imw.push_back (w); |
655 | imw.push_back (w); |
634 | } |
656 | } |
… | |
… | |
667 | #endif |
689 | #endif |
668 | |
690 | |
669 | Atom rxvt_display::atom (const char *name) |
691 | Atom rxvt_display::atom (const char *name) |
670 | { |
692 | { |
671 | return XInternAtom (dpy, name, False); |
693 | return XInternAtom (dpy, name, False); |
|
|
694 | } |
|
|
695 | |
|
|
696 | Pixmap |
|
|
697 | rxvt_display::get_pixmap_property (Atom property) |
|
|
698 | { |
|
|
699 | Pixmap pixmap = None; |
|
|
700 | |
|
|
701 | int aformat; |
|
|
702 | unsigned long nitems, bytes_after; |
|
|
703 | Atom atype; |
|
|
704 | unsigned char *prop; |
|
|
705 | int result = XGetWindowProperty (dpy, root, property, |
|
|
706 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
707 | &nitems, &bytes_after, &prop); |
|
|
708 | if (result == Success) |
|
|
709 | { |
|
|
710 | if (atype == XA_PIXMAP) |
|
|
711 | pixmap = *(Pixmap *)prop; |
|
|
712 | XFree (prop); |
|
|
713 | } |
|
|
714 | |
|
|
715 | return pixmap; |
672 | } |
716 | } |
673 | |
717 | |
674 | ///////////////////////////////////////////////////////////////////////////// |
718 | ///////////////////////////////////////////////////////////////////////////// |
675 | |
719 | |
676 | template class refcache<rxvt_display>; |
720 | template class refcache<rxvt_display>; |