ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvttoolkit.C
(Generate patch)

Comparing rxvt-unicode/src/rxvttoolkit.C (file contents):
Revision 1.132 by sf-exg, Sun Jun 3 15:50:22 2012 UTC vs.
Revision 1.137 by root, Thu Jun 7 16:04:31 2012 UTC

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
160static void 160static void
161#if XIMCB_PROTO_BROKEN 161#if XIMCB_PROTO_BROKEN
162im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3) 162im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3)
163#else 163#else
260 depth = DefaultDepthOfScreen (screen); 260 depth = DefaultDepthOfScreen (screen);
261 visual = DefaultVisualOfScreen (screen); 261 visual = DefaultVisualOfScreen (screen);
262 cmap = DefaultColormapOfScreen (screen); 262 cmap = DefaultColormapOfScreen (screen);
263} 263}
264 264
265#if ENABLE_FRILLS
266
265void 267void
266rxvt_screen::select_visual (int bitdepth) 268rxvt_screen::select_visual (int id)
267{ 269{
268#if XFT
269 XVisualInfo vinfo; 270 XVisualInfo vinfo;
271 vinfo.visualid = id;
272 int n;
273
274 if (XVisualInfo *vi = XGetVisualInfo (dpy, VisualIDMask, &vinfo, &n))
275 {
276 depth = vi->depth;
277 visual = vi->visual;
278
279 XFree (vi);
280
281 cmap = XCreateColormap (dpy, display->root, visual, AllocNone);
282 }
283 else
284 rxvt_warn ("cannot requested visual id 0x%02x, using default visual.\n", id);
285}
286
287void
288rxvt_screen::select_depth (int bitdepth)
289{
290 XVisualInfo vinfo;
270 291
271 if (XMatchVisualInfo (dpy, display->screen, bitdepth, TrueColor, &vinfo)) 292 if (XMatchVisualInfo (dpy, display->screen, bitdepth, TrueColor, &vinfo))
272 {
273 depth = bitdepth;
274 visual = vinfo.visual; 293 select_visual (vinfo.visualid);
275 cmap = XCreateColormap (dpy, display->root, visual, AllocNone); 294 else
276 } 295 rxvt_warn ("no visual found for requested depth %d, using default visual.\n", bitdepth);
277#endif
278} 296}
297
298#endif
279 299
280void 300void
281rxvt_screen::clear () 301rxvt_screen::clear ()
282{ 302{
283#if XFT 303#if XFT
473 int major, minor; 493 int major, minor;
474 if (XRenderQueryVersion (dpy, &major, &minor)) 494 if (XRenderQueryVersion (dpy, &major, &minor))
475 { 495 {
476 flags |= DISPLAY_HAS_RENDER; 496 flags |= DISPLAY_HAS_RENDER;
477 497
498 if (major > 0 || (major == 0 && minor >= 10))
499 flags |= DISPLAY_HAS_RENDER_10;
500
478 if (major > 0 || (major == 0 && minor >= 11)) 501 if (major > 0 || (major == 0 && minor >= 11))
479 flags |= DISPLAY_HAS_RENDER_MUL; 502 flags |= DISPLAY_HAS_RENDER_MUL;
480 503
481 XFilters *filters = XRenderQueryFilters (dpy, root); 504 XFilters *filters = XRenderQueryFilters (dpy, root);
482 if (filters) 505 if (filters)
534#ifdef POINTER_BLANK 557#ifdef POINTER_BLANK
535 XFreeCursor (dpy, blank_cursor); 558 XFreeCursor (dpy, blank_cursor);
536#endif 559#endif
537 x_ev.stop (); 560 x_ev.stop ();
538 flush_ev.stop (); 561 flush_ev.stop ();
539#ifdef USE_XIM 562#if USE_XIM
540 xims.clear (); 563 xims.clear ();
541#endif 564#endif
542 XrmDestroyDatabase (XrmGetDatabase (dpy)); 565 XrmDestroyDatabase (XrmGetDatabase (dpy));
543 XCloseDisplay (dpy); 566 XCloseDisplay (dpy);
544} 567}
545 568
546#ifdef USE_XIM 569#if USE_XIM
547void rxvt_display::im_change_cb () 570void rxvt_display::im_change_cb ()
548{ 571{
549 for (im_watcher **i = imw.begin (); i != imw.end (); ++i) 572 for (im_watcher **i = imw.begin (); i != imw.end (); ++i)
550 (*i)->call (); 573 (*i)->call ();
551} 574}
587 do 610 do
588 { 611 {
589 XEvent xev; 612 XEvent xev;
590 XNextEvent (dpy, &xev); 613 XNextEvent (dpy, &xev);
591 614
592#ifdef USE_XIM 615#if USE_XIM
593 if (!XFilterEvent (&xev, None)) 616 if (!XFilterEvent (&xev, None))
594 { 617 {
595 if (xev.type == PropertyNotify 618 if (xev.type == PropertyNotify
596 && xev.xany.window == root 619 && xev.xany.window == root
597 && xev.xproperty.atom == xa[XA_XIM_SERVERS]) 620 && xev.xproperty.atom == xa[XA_XIM_SERVERS])
605 if (!xw[i]) 628 if (!xw[i])
606 xw.erase_unordered (i); 629 xw.erase_unordered (i);
607 else if (xw[i]->window == xev.xany.window) 630 else if (xw[i]->window == xev.xany.window)
608 xw[i]->call (xev); 631 xw[i]->call (xev);
609 } 632 }
610#ifdef USE_XIM 633#if USE_XIM
611 } 634 }
612#endif 635#endif
613 } 636 }
614 while (XEventsQueued (dpy, QueuedAlready)); 637 while (XEventsQueued (dpy, QueuedAlready));
615 638
646 } 669 }
647 670
648 cur_owner = owner; 671 cur_owner = owner;
649} 672}
650 673
651#ifdef USE_XIM 674#if USE_XIM
652 675
653void rxvt_display::reg (im_watcher *w) 676void rxvt_display::reg (im_watcher *w)
654{ 677{
655 imw.push_back (w); 678 imw.push_back (w);
656} 679}
689#endif 712#endif
690 713
691Atom rxvt_display::atom (const char *name) 714Atom rxvt_display::atom (const char *name)
692{ 715{
693 return XInternAtom (dpy, name, False); 716 return XInternAtom (dpy, name, False);
717}
718
719Pixmap
720rxvt_display::get_pixmap_property (Atom property)
721{
722 Pixmap pixmap = None;
723
724 int aformat;
725 unsigned long nitems, bytes_after;
726 Atom atype;
727 unsigned char *prop;
728 int result = XGetWindowProperty (dpy, root, property,
729 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
730 &nitems, &bytes_after, &prop);
731 if (result == Success)
732 {
733 if (atype == XA_PIXMAP)
734 pixmap = *(Pixmap *)prop;
735 XFree (prop);
736 }
737
738 return pixmap;
694} 739}
695 740
696///////////////////////////////////////////////////////////////////////////// 741/////////////////////////////////////////////////////////////////////////////
697 742
698template class refcache<rxvt_display>; 743template class refcache<rxvt_display>;
865 910
866 return got; 911 return got;
867} 912}
868 913
869void 914void
870rxvt_color::get (rgba &color) 915rxvt_color::get (rgba &color) const
871{ 916{
872#if XFT 917#if XFT
873 color.r = c.color.red; 918 color.r = c.color.red;
874 color.g = c.color.green; 919 color.g = c.color.green;
875 color.b = c.color.blue; 920 color.b = c.color.blue;
881 color.a = rgba::MAX_CC; 926 color.a = rgba::MAX_CC;
882#endif 927#endif
883} 928}
884 929
885void 930void
886rxvt_color::get (XColor &color) 931rxvt_color::get (XColor &color) const
887{ 932{
888 rgba c; 933 rgba c;
889 get (c); 934 get (c);
890 935
891 color.red = c.r; 936 color.red = c.r;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines