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.70 by sasha, Thu Jul 12 22:33:16 2007 UTC vs.
Revision 1.75 by root, Sun Nov 11 04:08:00 2007 UTC

183 183
184 XIMCallback ximcallback; 184 XIMCallback ximcallback;
185 ximcallback.client_data = (XPointer)this; 185 ximcallback.client_data = (XPointer)this;
186 ximcallback.callback = im_destroy_cb; 186 ximcallback.callback = im_destroy_cb;
187 187
188 XSetIMValues (xim, XNDestroyCallback, &ximcallback, 0); 188 XSetIMValues (xim, XNDestroyCallback, &ximcallback, (char *)0);
189 189
190 return true; 190 return true;
191} 191}
192 192
193rxvt_xim::~rxvt_xim () 193rxvt_xim::~rxvt_xim ()
471 socklen_t sl = sizeof (sa); 471 socklen_t sl = sizeof (sa);
472 472
473 if (!getsockname (fd, (sockaddr *)&sa, &sl)) 473 if (!getsockname (fd, (sockaddr *)&sa, &sl))
474 is_local = sa.sun_family == AF_UNIX; 474 is_local = sa.sun_family == AF_UNIX;
475 475
476 x_ev.start (fd, EVENT_READ); 476 x_ev.start (fd, ev::READ);
477 fcntl (fd, F_SETFD, FD_CLOEXEC); 477 fcntl (fd, F_SETFD, FD_CLOEXEC);
478 478
479 XSelectInput (dpy, root, PropertyChangeMask); 479 XSelectInput (dpy, root, PropertyChangeMask);
480 480
481 flush (); 481 flush ();
538 538
539 XFree (atoms); 539 XFree (atoms);
540} 540}
541#endif 541#endif
542 542
543void rxvt_display::x_cb (io_watcher &w, short revents) 543void rxvt_display::x_cb (ev::io &w, int revents)
544{ 544{
545 do 545 do
546 { 546 {
547 XEvent xev; 547 XEvent xev;
548 XNextEvent (dpy, &xev); 548 XNextEvent (dpy, &xev);
575} 575}
576 576
577void rxvt_display::flush () 577void rxvt_display::flush ()
578{ 578{
579 if (XEventsQueued (dpy, QueuedAlready)) 579 if (XEventsQueued (dpy, QueuedAlready))
580 x_cb (x_ev, EVENT_READ); 580 x_cb (x_ev, ev::READ);
581 581
582 XFlush (dpy); 582 XFlush (dpy);
583} 583}
584 584
585void rxvt_display::reg (xevent_watcher *w) 585void rxvt_display::reg (xevent_watcher *w)
666static unsigned int 666static unsigned int
667insert_component (unsigned int value, unsigned int mask, unsigned int shift) 667insert_component (unsigned int value, unsigned int mask, unsigned int shift)
668{ 668{
669 return (value * (mask + 1) >> 16) << shift; 669 return (value * (mask + 1) >> 16) << shift;
670} 670}
671 671
672bool 672bool
673rxvt_color::alloc (rxvt_screen *screen, const rgba &color) 673rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
674{ 674{
675#if XFT 675#if XFT
676 XRenderPictFormat *format; 676 XRenderPictFormat *format;
743 name += skip; 743 name += skip;
744 } 744 }
745 else 745 else
746 c.a = rgba::MAX_CC; 746 c.a = rgba::MAX_CC;
747 747
748 // parse the non-standard "#aarrggbb" format
749 if (name[0] == '#' && strlen (name) == 1+2+2+2+2 && 4 == sscanf (name+1, "%2hx%2hx%2hx%2hx%c", &c.a, &c.r, &c.g, &c.b, &eos))
750 {
751 if (c.r)
752 c.r = (c.r << 8) | 0x0ff;
753 if (c.g)
754 c.g = (c.g << 8) | 0x0ff;
755 if (c.b)
756 c.b = (c.b << 8) | 0x0ff;
757 if (c.a)
758 c.a = (c.a << 8) | 0x0ff;
759 }
748 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format 760 // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format
749 if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) 761 else if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos))
750 { 762 {
751 XColor xc, xc_exact; 763 XColor xc;
752 764
753 if (XParseColor (screen->dpy, screen->cmap, name, &xc)) 765 if (XParseColor (screen->dpy, screen->cmap, name, &xc))
754 { 766 {
755 c.r = xc.red; 767 c.r = xc.red;
756 c.g = xc.green; 768 c.g = xc.green;
783 { 795 {
784 XColor *colors = new XColor [screen->visual->map_entries]; 796 XColor *colors = new XColor [screen->visual->map_entries];
785 797
786 for (int i = 0; i < cmap_size; i++) 798 for (int i = 0; i < cmap_size; i++)
787 colors [i].pixel = i; 799 colors [i].pixel = i;
788 800
789 // many kilobytes transfer per colour, but pseudocolor isn't worth 801 // many kilobytes transfer per colour, but pseudocolor isn't worth
790 // many extra optimisations. 802 // many extra optimisations.
791 XQueryColors (screen->dpy, screen->cmap, colors, cmap_size); 803 XQueryColors (screen->dpy, screen->cmap, colors, cmap_size);
792 804
793 int diff = 0x7fffffffUL; 805 int diff = 0x7fffffffUL;
806 } 818 }
807 } 819 }
808 820
809 //rxvt_warn ("could not allocate %04x %04x %04x, getting %04x %04x %04x instead (%d)\n", 821 //rxvt_warn ("could not allocate %04x %04x %04x, getting %04x %04x %04x instead (%d)\n",
810 // color.r, color.g, color.b, best->red, best->green, best->blue, diff); 822 // color.r, color.g, color.b, best->red, best->green, best->blue, diff);
811 823
812 got = alloc (screen, rgba (best->red, best->green, best->blue)); 824 got = alloc (screen, rgba (best->red, best->green, best->blue));
813 825
814 delete [] colors; 826 delete [] colors;
815 } 827 }
816#endif 828#endif
844 color.green = c.g; 856 color.green = c.g;
845 color.blue = c.b; 857 color.blue = c.b;
846 color.pixel = (Pixel)*this; 858 color.pixel = (Pixel)*this;
847} 859}
848 860
849void 861void
850rxvt_color::free (rxvt_screen *screen) 862rxvt_color::free (rxvt_screen *screen)
851{ 863{
852 if (screen->visual->c_class == TrueColor) 864 if (screen->visual->c_class == TrueColor)
853 return; // nothing to do 865 return; // nothing to do
854 866

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines