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.19 by root, Mon Nov 28 19:04:39 2005 UTC vs.
Revision 1.36 by root, Mon Jan 30 17:43:20 2006 UTC

25#include <rxvttoolkit.h> 25#include <rxvttoolkit.h>
26 26
27#include <unistd.h> 27#include <unistd.h>
28#include <fcntl.h> 28#include <fcntl.h>
29 29
30#include <sys/utsname.h>
31
30#ifndef NO_SLOW_LINK_SUPPORT 32#ifndef NO_SLOW_LINK_SUPPORT
31# include <sys/socket.h> 33# include <sys/socket.h>
32# include <sys/un.h> 34# include <sys/un.h>
33#endif 35#endif
34 36
37#if XFT
38# include <X11/extensions/Xrender.h>
39#endif
40
41const char *const xa_names[] =
42{
43 "TEXT",
44 "COMPOUND_TEXT",
45 "UTF8_STRING",
46 "MULTIPLE",
47 "TARGETS",
48 "TIMESTAMP",
49 "VT_SELECTION",
50 "INCR",
51 "WM_PROTOCOLS",
52 "WM_DELETE_WINDOW",
53 "CLIPBOARD",
54 "AVERAGE_WIDTH",
55 "WEIGHT_NAME",
56 "SLANT",
57 "CHARSET_REGISTRY",
58 "CHARSET_ENCODING",
59#if ENABLE_FRILLS
60 "_MOTIF_WM_HINTS",
61#endif
62#if ENABLE_EWMH
63 "_NET_WM_PID",
64 "_NET_WM_NAME",
65 "_NET_WM_ICON_NAME",
66 "_NET_WM_PING",
67#endif
68#if USE_XIM
69 "WM_LOCALE_NAME",
70 "XIM_SERVERS",
71#endif
72#ifdef TRANSPARENT
73 "_XROOTPMAP_ID",
74 "ESETROOT_PMAP_ID",
75#endif
76#if ENABLE_XEMBED
77 "_XEMBED",
78 "_XEMBED_INFO",
79#endif
80#if !ENABLE_MINIMAL
81 "SCREEN_RESOURCES",
82 "XDCCC_LINEAR_RGB_CORRECTION",
83 "XDCCC_LINEAR_RGB_MATRICES",
84 "WM_COLORMAP_WINDOWS",
85 "WM_STATE",
86#endif
87};
88
89/////////////////////////////////////////////////////////////////////////////
90
35refcounted::refcounted (const char *id) 91refcounted::refcounted (const char *id)
36{ 92{
37 this->id = strdup (id); 93 this->id = strdup (id);
38} 94}
39 95
47{ 103{
48 for (T **i = this->begin (); i < this->end (); ++i) 104 for (T **i = this->begin (); i < this->end (); ++i)
49 { 105 {
50 if (!strcmp (id, (*i)->id)) 106 if (!strcmp (id, (*i)->id))
51 { 107 {
52 (*i)->referenced++; 108 ++(*i)->referenced;
109 (*i)->ref_next ();
53 return *i; 110 return *i;
54 } 111 }
55 } 112 }
56 113
57 T *obj = new T (id); 114 T *obj = new T (id);
58 115
59 obj->referenced = 1;
60
61 if (obj && obj->init ()) 116 if (obj && obj->ref_init ())
62 { 117 {
118 obj->referenced = 1;
63 this->push_back (obj); 119 this->push_back (obj);
64 return obj; 120 return obj;
65 } 121 }
66 else 122 else
67 { 123 {
91} 147}
92 148
93///////////////////////////////////////////////////////////////////////////// 149/////////////////////////////////////////////////////////////////////////////
94 150
95#ifdef USE_XIM 151#ifdef USE_XIM
152
96static void 153static void
97#if XIMCB_PROTO_BROKEN 154#if XIMCB_PROTO_BROKEN
98im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3) 155im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3)
99#else 156#else
100im_destroy_cb (XIM unused1, XPointer client_data, XPointer unused3) 157im_destroy_cb (XIM unused1, XPointer client_data, XPointer unused3)
107 164
108 display->xims.erase (find (display->xims.begin (), display->xims.end (), xim)); 165 display->xims.erase (find (display->xims.begin (), display->xims.end (), xim));
109 display->im_change_cb (); 166 display->im_change_cb ();
110} 167}
111 168
169bool
112bool rxvt_xim::init () 170rxvt_xim::ref_init ()
113{ 171{
114 display = GET_R->display; //HACK: TODO 172 display = GET_R->display; //HACK: TODO
115 173
116 xim = XOpenIM (display->display, NULL, NULL, NULL); 174 xim = XOpenIM (display->display, NULL, NULL, NULL);
117 175
130rxvt_xim::~rxvt_xim () 188rxvt_xim::~rxvt_xim ()
131{ 189{
132 if (xim) 190 if (xim)
133 XCloseIM (xim); 191 XCloseIM (xim);
134} 192}
193
135#endif 194#endif
195
196/////////////////////////////////////////////////////////////////////////////
197
198void
199rxvt_screen::set (rxvt_display *disp)
200{
201 display = disp;
202 xdisp = disp->display;
203
204 Screen *screen = ScreenOfDisplay (xdisp, disp->screen);
205
206 depth = DefaultDepthOfScreen (screen);
207 visual = DefaultVisualOfScreen (screen);
208 cmap = DefaultColormapOfScreen (screen);
209}
210
211void
212rxvt_screen::set (rxvt_display *disp, int bitdepth)
213{
214 set (disp);
215
216#if XFT
217 XVisualInfo vinfo;
218
219 if (XMatchVisualInfo (xdisp, display->screen, bitdepth, TrueColor, &vinfo))
220 {
221 depth = bitdepth;
222 visual = vinfo.visual;
223 cmap = XCreateColormap (xdisp, disp->root, visual, AllocNone);
224 }
225#endif
226}
227
228void
229rxvt_screen::clear ()
230{
231 if (cmap != DefaultColormapOfScreen (ScreenOfDisplay (xdisp, display->screen)))
232 XFreeColormap (xdisp, cmap);
233}
136 234
137///////////////////////////////////////////////////////////////////////////// 235/////////////////////////////////////////////////////////////////////////////
138 236
139rxvt_display::rxvt_display (const char *id) 237rxvt_display::rxvt_display (const char *id)
140: refcounted (id) 238: refcounted (id)
141, x_ev (this, &rxvt_display::x_cb) 239, x_ev (this, &rxvt_display::x_cb)
142, selection_owner (0) 240, selection_owner (0)
143{ 241{
144} 242}
145 243
244XrmDatabase
245rxvt_display::get_resources ()
246{
247 char *homedir = (char *)getenv ("HOME");
248 char fname[1024];
249
250 /*
251 * get resources using the X library function
252 */
253 char *displayResource, *xe;
254 XrmDatabase database, rdb1;
255
256 database = NULL;
257
258 // for ordering, see for example http://www.faqs.org/faqs/Xt-FAQ/ Subject: 20
259
260 // 6. System wide per application default file.
261
262 /* Add in $XAPPLRESDIR/Rxvt only; not bothering with XUSERFILESEARCHPATH */
263 if ((xe = (char *)getenv ("XAPPLRESDIR")))
264 {
265 snprintf (fname, sizeof (fname), "%s/%s", xe, RESCLASS);
266
267 if ((rdb1 = XrmGetFileDatabase (fname)))
268 XrmMergeDatabases (rdb1, &database);
269 }
270
271 // 5. User's per application default file.
272 // none
273
274 // 4. User's defaults file.
275 /* Get any Xserver defaults */
276 displayResource = XResourceManagerString (display);
277
278 if (displayResource != NULL)
279 {
280 if ((rdb1 = XrmGetStringDatabase (displayResource)))
281 XrmMergeDatabases (rdb1, &database);
282 }
283 else if (homedir)
284 {
285 snprintf (fname, sizeof (fname), "%s/.Xdefaults", homedir);
286
287 if ((rdb1 = XrmGetFileDatabase (fname)))
288 XrmMergeDatabases (rdb1, &database);
289 }
290
291 /* Get screen specific resources */
292 displayResource = XScreenResourceString (ScreenOfDisplay (display, screen));
293
294 if (displayResource != NULL)
295 {
296 if ((rdb1 = XrmGetStringDatabase (displayResource)))
297 /* Merge with screen-independent resources */
298 XrmMergeDatabases (rdb1, &database);
299
300 XFree (displayResource);
301 }
302
303 // 3. User's per host defaults file
304 /* Add in XENVIRONMENT file */
305 if ((xe = (char *)getenv ("XENVIRONMENT"))
306 && (rdb1 = XrmGetFileDatabase (xe)))
307 XrmMergeDatabases (rdb1, &database);
308 else if (homedir)
309 {
310 struct utsname un;
311
312 if (!uname (&un))
313 {
314 snprintf (fname, sizeof (fname), "%s/.Xdefaults-%s", homedir, un.nodename);
315
316 if ((rdb1 = XrmGetFileDatabase (fname)))
317 XrmMergeDatabases (rdb1, &database);
318 }
319 }
320
321 return database;
322}
323
146bool rxvt_display::init () 324bool rxvt_display::ref_init ()
147{ 325{
148#ifdef LOCAL_X_IS_UNIX 326#ifdef LOCAL_X_IS_UNIX
149 if (id[0] == ':') 327 if (id[0] == ':')
150 { 328 {
151 val = rxvt_malloc (5 + strlen (id) + 1); 329 val = rxvt_malloc (5 + strlen (id) + 1);
164 if (!display) 342 if (!display)
165 return false; 343 return false;
166 344
167 screen = DefaultScreen (display); 345 screen = DefaultScreen (display);
168 root = DefaultRootWindow (display); 346 root = DefaultRootWindow (display);
169 visual = DefaultVisual (display, screen);
170 cmap = DefaultColormap (display, screen);
171 depth = DefaultDepth (display, screen);
172 347
173 int fd = XConnectionNumber (display); 348 assert (sizeof (xa_names) / sizeof (char *) == NUM_XA);
349 XInternAtoms (display, (char **)xa_names, NUM_XA, False, xa);
174 350
175#ifndef NO_SLOW_LINK_SUPPORT 351 XrmSetDatabase (display, get_resources ());
176 // try to detect wether we have a local connection.
177 // assume unix domains socket == local, everything else not
178 // TODO: might want to check for inet/127.0.0.1
179 is_local = 0;
180 sockaddr_un sa;
181 socklen_t sl = sizeof (sa);
182
183 if (!getsockname (fd, (sockaddr *)&sa, &sl))
184 is_local = sa.sun_family == AF_LOCAL;
185#endif
186 352
187#ifdef POINTER_BLANK 353#ifdef POINTER_BLANK
188 XColor blackcolour; 354 XColor blackcolour;
189 blackcolour.red = 0; 355 blackcolour.red = 0;
190 blackcolour.green = 0; 356 blackcolour.green = 0;
193 blank_cursor = XCreateGlyphCursor (display, f, f, ' ', ' ', 359 blank_cursor = XCreateGlyphCursor (display, f, f, ' ', ' ',
194 &blackcolour, &blackcolour); 360 &blackcolour, &blackcolour);
195 XUnloadFont (display, f); 361 XUnloadFont (display, f);
196#endif 362#endif
197 363
198#ifdef PREFER_24BIT 364 int fd = XConnectionNumber (display);
199 /*
200 * If depth is not 24, look for a 24bit visual.
201 */
202 if (depth != 24)
203 {
204 XVisualInfo vinfo;
205 365
206 if (XMatchVisualInfo (display, screen, 24, TrueColor, &vinfo)) 366#ifndef NO_SLOW_LINK_SUPPORT
207 { 367 // try to detect wether we have a local connection.
208 depth = 24; 368 // assume unix domains socket == local, everything else not
209 visual = vinfo.visual; 369 // TODO: might want to check for inet/127.0.0.1
210 cmap = XCreateColormap (display, 370 is_local = 0;
211 RootWindow (display, screen), 371 sockaddr_un sa;
212 visual, AllocNone); 372 socklen_t sl = sizeof (sa);
213 } 373
214 } 374 if (!getsockname (fd, (sockaddr *)&sa, &sl))
375 is_local = sa.sun_family == AF_LOCAL;
215#endif 376#endif
216 377
217 x_ev.start (fd, EVENT_READ); 378 x_ev.start (fd, EVENT_READ);
218 fcntl (fd, F_SETFD, FD_CLOEXEC); 379 fcntl (fd, F_SETFD, FD_CLOEXEC);
219 380
220 XSelectInput (display, root, PropertyChangeMask); 381 XSelectInput (display, root, PropertyChangeMask);
221#ifdef USE_XIM
222 xa_xim_servers = XInternAtom (display, "XIM_SERVERS", 0);
223#endif
224 382
225 flush (); 383 flush ();
226 384
227 return true; 385 return true;
228} 386}
229 387
388void
389rxvt_display::ref_next ()
390{
391 // TODO: somehow check wether the database files/resources changed
392 // before re-loading/parsing
393 XrmDestroyDatabase (XrmGetDatabase (display));
394 XrmSetDatabase (display, get_resources ());
395}
396
230rxvt_display::~rxvt_display () 397rxvt_display::~rxvt_display ()
231{ 398{
399 if (!display)
400 return;
401
402#ifdef POINTER_BLANK
403 XFreeCursor (display, blank_cursor);
404#endif
232 x_ev.stop (); 405 x_ev.stop ();
233#ifdef USE_XIM 406#ifdef USE_XIM
234 xims.clear (); 407 xims.clear ();
235#endif 408#endif
236
237 if (display)
238 XCloseDisplay (display); 409 XCloseDisplay (display);
239} 410}
240 411
241#ifdef USE_XIM 412#ifdef USE_XIM
242void rxvt_display::im_change_cb () 413void rxvt_display::im_change_cb ()
243{ 414{
251 // registers, as xlib crashes due to a race otherwise. 422 // registers, as xlib crashes due to a race otherwise.
252 Atom actual_type, *atoms; 423 Atom actual_type, *atoms;
253 int actual_format; 424 int actual_format;
254 unsigned long nitems, bytes_after; 425 unsigned long nitems, bytes_after;
255 426
256 if (XGetWindowProperty (display, root, xa_xim_servers, 0L, 1000000L, 427 if (XGetWindowProperty (display, root, xa[XA_XIM_SERVERS], 0L, 1000000L,
257 False, XA_ATOM, &actual_type, &actual_format, 428 False, XA_ATOM, &actual_type, &actual_format,
258 &nitems, &bytes_after, (unsigned char **)&atoms) 429 &nitems, &bytes_after, (unsigned char **)&atoms)
259 != Success ) 430 != Success )
260 return; 431 return;
261 432
279 XNextEvent (display, &xev); 450 XNextEvent (display, &xev);
280 451
281#ifdef USE_XIM 452#ifdef USE_XIM
282 if (!XFilterEvent (&xev, None)) 453 if (!XFilterEvent (&xev, None))
283 { 454 {
284
285 if (xev.type == PropertyNotify 455 if (xev.type == PropertyNotify
286 && xev.xany.window == root 456 && xev.xany.window == root
287 && xev.xproperty.atom == xa_xim_servers) 457 && xev.xproperty.atom == xa[XA_XIM_SERVERS])
288 im_change_check (); 458 im_change_check ();
289#endif 459#endif
290 for (int i = xw.size (); i--; ) 460 for (int i = xw.size (); i--; )
291 { 461 {
292 if (!xw[i]) 462 if (!xw[i])
382refcache<rxvt_display> displays; 552refcache<rxvt_display> displays;
383 553
384///////////////////////////////////////////////////////////////////////////// 554/////////////////////////////////////////////////////////////////////////////
385 555
386bool 556bool
387rxvt_color::set (rxvt_display *display, Pixel p) 557rxvt_color::set (rxvt_screen *screen, const char *name)
388{ 558{
389#if XFT 559#if XFT
390 XColor xc; 560 int l = strlen (name);
561 rxvt_rgba r;
562 char eos;
563 int mult;
391 564
392 xc.pixel = p; 565 // shortcutting this saves countless server RTTs for the built-in colours
393 if (!XQueryColor (display->display, display->cmap, &xc)) 566 if (l == 3+3*3 && 3 == sscanf (name, "rgb:%hx/%hx/%hx/%hx%c", &r.r, &r.g, &r.b, &r.a, &eos))
394 return false; 567 {
568 r.a = rxvt_rgba::MAX_CC;
569 mult = rxvt_rgba::MAX_CC / 0x00ff;
570 }
395 571
396 XRenderColor d; 572 // parse a number of non-standard ARGB colour specifications
573 else if ( l == 1+4*1 && 4 == sscanf (name, "#%1hx%1hx%1hx%1hx%c", &r.a, &r.r, &r.g, &r.b, &eos))
574 mult = rxvt_rgba::MAX_CC / 0x000f;
575 else if (l == 1+4*2 && 4 == sscanf (name, "#%2hx%2hx%2hx%2hx%c", &r.a, &r.r, &r.g, &r.b, &eos))
576 mult = rxvt_rgba::MAX_CC / 0x00ff;
577 else if (l == 1+4*4 && 4 == sscanf (name, "#%4hx%4hx%4hx%4hx%c", &r.a, &r.r, &r.g, &r.b, &eos))
578 mult = rxvt_rgba::MAX_CC / 0xffff;
579 else if (l == 4+5*4 && 4 == sscanf (name, "rgba:%hx/%hx/%hx/%hx%c", &r.r, &r.g, &r.b, &r.a, &eos))
580 mult = rxvt_rgba::MAX_CC / 0xffff;
397 581
398 d.red = xc.red; 582 // slow case: server round trip
399 d.green = xc.green; 583 else
400 d.blue = xc.blue; 584 return XftColorAllocName (screen->xdisp, screen->visual, screen->cmap, name, &c);
401 d.alpha = 0xffff;
402 585
403 return 586 r.r *= mult; r.g *= mult; r.b *= mult; r.a *= mult;
404 XftColorAllocValue (display->display,
405 display->visual,
406 display->cmap,
407 &d, &c);
408#else
409 this->p = p;
410#endif
411 587
412 return true; 588 return set (screen, r);
413}
414
415bool
416rxvt_color::set (rxvt_display *display, const char *name)
417{
418#if XFT
419 return XftColorAllocName (display->display, display->visual, display->cmap,
420 name, &c);
421#else 589#else
422 XColor xc; 590 XColor xc;
423 591
424 if (XParseColor (display->display, display->cmap, name, &xc)) 592 if (XParseColor (screen->xdisp, screen->cmap, name, &xc))
425 return set (display, xc.red, xc.green, xc.blue); 593 return set (screen, rxvt_rgba (xc.red, xc.green, xc.blue));
426 594
427 return false; 595 return false;
428#endif 596#endif
429} 597}
430 598
431bool 599bool
432rxvt_color::set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb) 600rxvt_color::set (rxvt_screen *screen, rxvt_rgba rgba)
433{ 601{
434 XColor xc; 602#if XFT
603 XRenderPictFormat *format;
435 604
436 xc.red = cr; 605 // FUCKING Xft gets it wrong, of course, so work around it
437 xc.green = cg; 606 // transparency users should eat shit and die, and then
438 xc.blue = cb; 607 // XRenderQueryPictIndexValues themselves plenty.
439 xc.flags = DoRed | DoGreen | DoBlue; 608 if (screen->visual->c_class == TrueColor
609 && (format = XRenderFindVisualFormat (screen->xdisp, screen->visual)))
610 {
611 // the fun lies in doing everything manually...
612 c.color.red = rgba.r;
613 c.color.green = rgba.g;
614 c.color.blue = rgba.b;
615 c.color.alpha = rgba.a;
440 616
441 if (XAllocColor (display->display, display->cmap, &xc)) 617 c.pixel = ((rgba.r * format->direct.redMask / rxvt_rgba::MAX_CC) << format->direct.red )
442 return set (display, xc.pixel); 618 | ((rgba.g * format->direct.greenMask / rxvt_rgba::MAX_CC) << format->direct.green)
619 | ((rgba.b * format->direct.blueMask / rxvt_rgba::MAX_CC) << format->direct.blue )
620 | ((rgba.a * format->direct.alphaMask / rxvt_rgba::MAX_CC) << format->direct.alpha);
621
622 return true;
623 }
624 else
625 {
626 XRenderColor d;
627
628 d.red = rgba.r;
629 d.green = rgba.g;
630 d.blue = rgba.b;
631 d.alpha = rgba.a;
632
633 return XftColorAllocValue (screen->xdisp, screen->visual, screen->cmap, &d, &c);
634 }
443 635
444 return false; 636 return false;
637#else
638 if (screen->visual->c_class == TrueColor)
639 {
640 p = ((rgba.r * ((1 << screen->visual->bits_per_rgb) - 1)
641 / rxvt_rgba::MAX_CC) << ctz (screen->visual->red_mask ))
642 | ((rgba.g * ((1 << screen->visual->bits_per_rgb) - 1)
643 / rxvt_rgba::MAX_CC) << ctz (screen->visual->green_mask))
644 | ((rgba.b * ((1 << screen->visual->bits_per_rgb) - 1)
645 / rxvt_rgba::MAX_CC) << ctz (screen->visual->blue_mask ));
646
647 return true;
648 }
649 else
650 {
651 XColor xc;
652
653 xc.red = rgba.r;
654 xc.green = rgba.g;
655 xc.blue = rgba.b;
656 xc.flags = DoRed | DoGreen | DoBlue;
657
658 if (XAllocColor (screen->xdisp, screen->cmap, &xc))
659 {
660 p = xc.pixel;
661 return true;
662 }
663 }
664
665 return false;
666#endif
445} 667}
446 668
447void 669void
448rxvt_color::get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb) 670rxvt_color::get (rxvt_screen *screen, rxvt_rgba &rgba)
449{ 671{
450#if XFT 672#if XFT
451 cr = c.color.red; 673 rgba.r = c.color.red;
452 cg = c.color.green; 674 rgba.g = c.color.green;
453 cb = c.color.blue; 675 rgba.b = c.color.blue;
676 rgba.a = c.color.alpha;
454#else 677#else
455 XColor c; 678 XColor c;
456 679
457 c.pixel = p; 680 c.pixel = p;
458 XQueryColor (display->display, display->cmap, &c); 681 XQueryColor (screen->xdisp, screen->cmap, &c);
459 682
460 cr = c.red; 683 rgba.r = c.red;
461 cg = c.green; 684 rgba.g = c.green;
462 cb = c.blue; 685 rgba.b = c.blue;
686 rgba.a = rxvt_rgba::MAX_CC;
463#endif 687#endif
464} 688}
465 689
466void 690void
467rxvt_color::free (rxvt_display *display) 691rxvt_color::free (rxvt_screen *screen)
468{ 692{
469#if XFT 693#if XFT
470 XftColorFree (display->display, display->visual, display->cmap, &c); 694 XftColorFree (screen->xdisp, screen->visual, screen->cmap, &c);
471#else 695#else
472 XFreeColors (display->display, display->cmap, &p, 1, AllPlanes); 696 XFreeColors (screen->xdisp, screen->cmap, &p, 1, AllPlanes);
473#endif 697#endif
474} 698}
475 699
476rxvt_color 700rxvt_color
477rxvt_color::fade (rxvt_display *display, int percent) 701rxvt_color::fade (rxvt_screen *screen, int percent)
478{ 702{
479 percent = 100 - percent;
480
481 unsigned short cr, cg, cb;
482 rxvt_color faded; 703 rxvt_color faded;
483 704
484 get (display, cr, cg, cb); 705 rxvt_rgba c;
706 get (screen, c);
485 707
486 faded.set ( 708 c.r = lerp (0, c.r, percent);
487 display, 709 c.g = lerp (0, c.g, percent);
488 cr * percent / 100, 710 c.b = lerp (0, c.b, percent);
489 cg * percent / 100, 711
490 cb * percent / 100 712 faded.set (screen, c);
491 );
492 713
493 return faded; 714 return faded;
494} 715}
495 716
496#define LERP(a,b,p) (a * p + b * (100 - p)) / 100
497
498rxvt_color 717rxvt_color
499rxvt_color::fade (rxvt_display *display, int percent, rxvt_color &fadeto) 718rxvt_color::fade (rxvt_screen *screen, int percent, rxvt_color &fadeto)
500{ 719{
501 percent = 100 - percent; 720 rxvt_rgba c, fc;
502
503 unsigned short cr, cg, cb;
504 unsigned short fcr, fcg, fcb;
505 rxvt_color faded; 721 rxvt_color faded;
506 722
507 get (display, cr, cg, cb); 723 get (screen, c);
508 fadeto.get(display, fcr, fcg, fcb); 724 fadeto.get (screen, fc);
509 725
510 faded.set ( 726 faded.set (
511 display, 727 screen,
728 rxvt_rgba (
512 LERP (cr, fcr, percent), 729 lerp (fc.r, c.r, percent),
513 LERP (cg, fcg, percent), 730 lerp (fc.g, c.g, percent),
514 LERP (cb, fcb, percent) 731 lerp (fc.b, c.b, percent),
732 lerp (fc.a, c.a, percent)
733 )
515 ); 734 );
516 735
517 return faded; 736 return faded;
518} 737}
519 738

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines