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.140 by sf-exg, Sat Dec 29 14:23:35 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 BG_IMAGE_FROM_ROOT || ENABLE_PERL
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
470 490
471 flags = 0; 491 flags = 0;
472#if XRENDER 492#if XRENDER
473 int major, minor; 493 int major, minor;
474 if (XRenderQueryVersion (dpy, &major, &minor)) 494 if (XRenderQueryVersion (dpy, &major, &minor))
495 if (major > 0 || (major == 0 && minor >= 10))
475 { 496 {
476 flags |= DISPLAY_HAS_RENDER; 497 flags |= DISPLAY_HAS_RENDER;
477 498
499#if 0
478 if (major > 0 || (major == 0 && minor >= 11)) 500 if (major > 0 || (major == 0 && minor >= 11))
479 flags |= DISPLAY_HAS_RENDER_MUL; 501 flags |= DISPLAY_HAS_RENDER_MUL;
502#endif
480 503
481 XFilters *filters = XRenderQueryFilters (dpy, root); 504 if (XFilters *filters = XRenderQueryFilters (dpy, root))
482 if (filters)
483 { 505 {
484 for (int i = 0; i < filters->nfilter; i++) 506 for (int i = 0; i < filters->nfilter; i++)
485 if (!strcmp (filters->filter[i], FilterConvolution)) 507 if (!strcmp (filters->filter [i], FilterConvolution))
486 flags |= DISPLAY_HAS_RENDER_CONV; 508 flags |= DISPLAY_HAS_RENDER_CONV;
487 509
488 XFree (filters); 510 XFree (filters);
489 } 511 }
490 } 512 }
491#endif 513#endif
492 514
493 int fd = XConnectionNumber (dpy); 515 int fd = XConnectionNumber (dpy);
494 516
495 // try to detect whether we have a local connection. 517 // try to detect whether we have a local connection.
534#ifdef POINTER_BLANK 556#ifdef POINTER_BLANK
535 XFreeCursor (dpy, blank_cursor); 557 XFreeCursor (dpy, blank_cursor);
536#endif 558#endif
537 x_ev.stop (); 559 x_ev.stop ();
538 flush_ev.stop (); 560 flush_ev.stop ();
539#ifdef USE_XIM 561#if USE_XIM
540 xims.clear (); 562 xims.clear ();
541#endif 563#endif
542 XrmDestroyDatabase (XrmGetDatabase (dpy)); 564 XrmDestroyDatabase (XrmGetDatabase (dpy));
543 XCloseDisplay (dpy); 565 XCloseDisplay (dpy);
544} 566}
545 567
546#ifdef USE_XIM 568#if USE_XIM
547void rxvt_display::im_change_cb () 569void rxvt_display::im_change_cb ()
548{ 570{
549 for (im_watcher **i = imw.begin (); i != imw.end (); ++i) 571 for (im_watcher **i = imw.begin (); i != imw.end (); ++i)
550 (*i)->call (); 572 (*i)->call ();
551} 573}
587 do 609 do
588 { 610 {
589 XEvent xev; 611 XEvent xev;
590 XNextEvent (dpy, &xev); 612 XNextEvent (dpy, &xev);
591 613
592#ifdef USE_XIM 614#if USE_XIM
593 if (!XFilterEvent (&xev, None)) 615 if (!XFilterEvent (&xev, None))
594 { 616 {
595 if (xev.type == PropertyNotify 617 if (xev.type == PropertyNotify
596 && xev.xany.window == root 618 && xev.xany.window == root
597 && xev.xproperty.atom == xa[XA_XIM_SERVERS]) 619 && xev.xproperty.atom == xa[XA_XIM_SERVERS])
605 if (!xw[i]) 627 if (!xw[i])
606 xw.erase_unordered (i); 628 xw.erase_unordered (i);
607 else if (xw[i]->window == xev.xany.window) 629 else if (xw[i]->window == xev.xany.window)
608 xw[i]->call (xev); 630 xw[i]->call (xev);
609 } 631 }
610#ifdef USE_XIM 632#if USE_XIM
611 } 633 }
612#endif 634#endif
613 } 635 }
614 while (XEventsQueued (dpy, QueuedAlready)); 636 while (XEventsQueued (dpy, QueuedAlready));
615 637
646 } 668 }
647 669
648 cur_owner = owner; 670 cur_owner = owner;
649} 671}
650 672
651#ifdef USE_XIM 673#if USE_XIM
652 674
653void rxvt_display::reg (im_watcher *w) 675void rxvt_display::reg (im_watcher *w)
654{ 676{
655 imw.push_back (w); 677 imw.push_back (w);
656} 678}
689#endif 711#endif
690 712
691Atom rxvt_display::atom (const char *name) 713Atom rxvt_display::atom (const char *name)
692{ 714{
693 return XInternAtom (dpy, name, False); 715 return XInternAtom (dpy, name, False);
716}
717
718Pixmap
719rxvt_display::get_pixmap_property (Atom property)
720{
721 Pixmap pixmap = None;
722
723 int aformat;
724 unsigned long nitems, bytes_after;
725 Atom atype;
726 unsigned char *prop;
727 int result = XGetWindowProperty (dpy, root, property,
728 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
729 &nitems, &bytes_after, &prop);
730 if (result == Success)
731 {
732 if (atype == XA_PIXMAP)
733 pixmap = *(Pixmap *)prop;
734 XFree (prop);
735 }
736
737 return pixmap;
694} 738}
695 739
696///////////////////////////////////////////////////////////////////////////// 740/////////////////////////////////////////////////////////////////////////////
697 741
698template class refcache<rxvt_display>; 742template class refcache<rxvt_display>;
865 909
866 return got; 910 return got;
867} 911}
868 912
869void 913void
870rxvt_color::get (rgba &color) 914rxvt_color::get (rgba &color) const
871{ 915{
872#if XFT 916#if XFT
873 color.r = c.color.red; 917 color.r = c.color.red;
874 color.g = c.color.green; 918 color.g = c.color.green;
875 color.b = c.color.blue; 919 color.b = c.color.blue;
881 color.a = rgba::MAX_CC; 925 color.a = rgba::MAX_CC;
882#endif 926#endif
883} 927}
884 928
885void 929void
886rxvt_color::get (XColor &color) 930rxvt_color::get (XColor &color) const
887{ 931{
888 rgba c; 932 rgba c;
889 get (c); 933 get (c);
890 934
891 color.red = c.r; 935 color.red = c.r;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines