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.21 by root, Sun Jan 8 07:55:36 2006 UTC vs.
Revision 1.35 by root, Mon Jan 30 16:12:58 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
232#ifdef POINTER_BLANK 402#ifdef POINTER_BLANK
233 XFreeCursor (display, blank_cursor); 403 XFreeCursor (display, blank_cursor);
234#endif 404#endif
235 x_ev.stop (); 405 x_ev.stop ();
236#ifdef USE_XIM 406#ifdef USE_XIM
237 xims.clear (); 407 xims.clear ();
238#endif 408#endif
239
240 if (display)
241 XCloseDisplay (display); 409 XCloseDisplay (display);
242} 410}
243 411
244#ifdef USE_XIM 412#ifdef USE_XIM
245void rxvt_display::im_change_cb () 413void rxvt_display::im_change_cb ()
246{ 414{
254 // registers, as xlib crashes due to a race otherwise. 422 // registers, as xlib crashes due to a race otherwise.
255 Atom actual_type, *atoms; 423 Atom actual_type, *atoms;
256 int actual_format; 424 int actual_format;
257 unsigned long nitems, bytes_after; 425 unsigned long nitems, bytes_after;
258 426
259 if (XGetWindowProperty (display, root, xa_xim_servers, 0L, 1000000L, 427 if (XGetWindowProperty (display, root, xa[XA_XIM_SERVERS], 0L, 1000000L,
260 False, XA_ATOM, &actual_type, &actual_format, 428 False, XA_ATOM, &actual_type, &actual_format,
261 &nitems, &bytes_after, (unsigned char **)&atoms) 429 &nitems, &bytes_after, (unsigned char **)&atoms)
262 != Success ) 430 != Success )
263 return; 431 return;
264 432
284#ifdef USE_XIM 452#ifdef USE_XIM
285 if (!XFilterEvent (&xev, None)) 453 if (!XFilterEvent (&xev, None))
286 { 454 {
287 if (xev.type == PropertyNotify 455 if (xev.type == PropertyNotify
288 && xev.xany.window == root 456 && xev.xany.window == root
289 && xev.xproperty.atom == xa_xim_servers) 457 && xev.xproperty.atom == xa[XA_XIM_SERVERS])
290 im_change_check (); 458 im_change_check ();
291#endif 459#endif
292 for (int i = xw.size (); i--; ) 460 for (int i = xw.size (); i--; )
293 { 461 {
294 if (!xw[i]) 462 if (!xw[i])
384refcache<rxvt_display> displays; 552refcache<rxvt_display> displays;
385 553
386///////////////////////////////////////////////////////////////////////////// 554/////////////////////////////////////////////////////////////////////////////
387 555
388bool 556bool
389rxvt_color::set (rxvt_display *display, Pixel p) 557rxvt_color::set (rxvt_screen *screen, const char *name)
390{ 558{
391#if XFT 559#if XFT
392 XColor xc; 560 int l = strlen (name);
561 rxvt_rgba r;
562 char eos;
563 int mult;
393 564
394 xc.pixel = p; 565 // shortcutting this saves countless server RTTs for the built-in colours
395 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))
396 return false; 567 {
568 r.a = rxvt_rgba::MAX_CC;
569 mult = rxvt_rgba::MAX_CC / 0x00ff;
570 }
397 571
398 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;
399 581
400 d.red = xc.red; 582 // slow case: server round trip
401 d.green = xc.green; 583 else
402 d.blue = xc.blue; 584 return XftColorAllocName (screen->xdisp, screen->visual, screen->cmap, name, &c);
403 d.alpha = 0xffff;
404 585
405 return 586 r.r *= mult; r.g *= mult; r.b *= mult; r.a *= mult;
406 XftColorAllocValue (display->display,
407 display->visual,
408 display->cmap,
409 &d, &c);
410#else
411 this->p = p;
412#endif
413 587
414 return true; 588 return set (screen, r);
415}
416
417bool
418rxvt_color::set (rxvt_display *display, const char *name)
419{
420#if XFT
421 return XftColorAllocName (display->display, display->visual, display->cmap,
422 name, &c);
423#else 589#else
424 XColor xc; 590 XColor xc;
425 591
426 if (XParseColor (display->display, display->cmap, name, &xc)) 592 if (XParseColor (screen->xdisp, screen->cmap, name, &xc))
427 return set (display, xc.red, xc.green, xc.blue); 593 return set (screen, rxvt_rgba (xc.red, xc.green, xc.blue));
428 594
429 return false; 595 return false;
430#endif 596#endif
431} 597}
432 598
433bool 599bool
434rxvt_color::set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb) 600rxvt_color::set (rxvt_screen *screen, rxvt_rgba rgba)
435{ 601{
436 XColor xc; 602#if XFT
603 XRenderPictFormat *format;
437 604
438 xc.red = cr; 605 // FUCKING Xft gets it wrong, of course, so work around it
439 xc.green = cg; 606 // transparency users should eat shit and die, and then
440 xc.blue = cb; 607 // XRenderQueryPictIndexValues themselves plenty.
441 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;
442 616
443 if (XAllocColor (display->display, display->cmap, &xc)) 617 c.pixel = ((rgba.r * format->direct.redMask / rxvt_rgba::MAX_CC) << format->direct.red )
444 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 }
445 635
446 return false; 636 return false;
637#else
638 if (screen->visual->c_class == TrueColor)
639 {
640 p = (rgba.r * (screen->visual->red_mask >> ctz (screen->visual->red_mask ))
641 / rxvt_rgba::MAX_CC) << ctz (screen->visual->red_mask )
642 | (rgba.g * (screen->visual->green_mask >> ctz (screen->visual->green_mask))
643 / rxvt_rgba::MAX_CC) << ctz (screen->visual->green_mask)
644 | (rgba.b * (screen->visual->blue_mask >> ctz (screen->visual->blue_mask ))
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
447} 667}
448 668
449void 669void
450rxvt_color::get (rxvt_display *display, unsigned short &cr, unsigned short &cg, unsigned short &cb) 670rxvt_color::get (rxvt_screen *screen, rxvt_rgba &rgba)
451{ 671{
452#if XFT 672#if XFT
453 cr = c.color.red; 673 rgba.r = c.color.red;
454 cg = c.color.green; 674 rgba.g = c.color.green;
455 cb = c.color.blue; 675 rgba.b = c.color.blue;
676 rgba.a = c.color.alpha;
456#else 677#else
457 XColor c; 678 XColor c;
458 679
459 c.pixel = p; 680 c.pixel = p;
460 XQueryColor (display->display, display->cmap, &c); 681 XQueryColor (screen->xdisp, screen->cmap, &c);
461 682
462 cr = c.red; 683 rgba.r = c.red;
463 cg = c.green; 684 rgba.g = c.green;
464 cb = c.blue; 685 rgba.b = c.blue;
686 rgba.a = rxvt_rgba::MAX_CC;
465#endif 687#endif
466} 688}
467 689
468void 690void
469rxvt_color::free (rxvt_display *display) 691rxvt_color::free (rxvt_screen *screen)
470{ 692{
471#if XFT 693#if XFT
472 XftColorFree (display->display, display->visual, display->cmap, &c); 694 XftColorFree (screen->xdisp, screen->visual, screen->cmap, &c);
473#else 695#else
474 XFreeColors (display->display, display->cmap, &p, 1, AllPlanes); 696 XFreeColors (screen->xdisp, screen->cmap, &p, 1, AllPlanes);
475#endif 697#endif
476} 698}
477 699
478rxvt_color 700rxvt_color
479rxvt_color::fade (rxvt_display *display, int percent) 701rxvt_color::fade (rxvt_screen *screen, int percent)
480{ 702{
481 percent = 100 - percent;
482
483 unsigned short cr, cg, cb;
484 rxvt_color faded; 703 rxvt_color faded;
485 704
486 get (display, cr, cg, cb); 705 rxvt_rgba c;
706 get (screen, c);
487 707
488 faded.set ( 708 c.r = lerp (0, c.r, percent);
489 display, 709 c.g = lerp (0, c.g, percent);
490 cr * percent / 100, 710 c.b = lerp (0, c.b, percent);
491 cg * percent / 100, 711
492 cb * percent / 100 712 faded.set (screen, c);
493 );
494 713
495 return faded; 714 return faded;
496} 715}
497 716
498#define LERP(a,b,p) (a * p + b * (100 - p)) / 100
499
500rxvt_color 717rxvt_color
501rxvt_color::fade (rxvt_display *display, int percent, rxvt_color &fadeto) 718rxvt_color::fade (rxvt_screen *screen, int percent, rxvt_color &fadeto)
502{ 719{
503 percent = 100 - percent; 720 rxvt_rgba c, fc;
504
505 unsigned short cr, cg, cb;
506 unsigned short fcr, fcg, fcb;
507 rxvt_color faded; 721 rxvt_color faded;
508 722
509 get (display, cr, cg, cb); 723 get (screen, c);
510 fadeto.get(display, fcr, fcg, fcb); 724 fadeto.get (screen, fc);
511 725
512 faded.set ( 726 faded.set (
513 display, 727 screen,
728 rxvt_rgba (
514 LERP (cr, fcr, percent), 729 lerp (fc.r, c.r, percent),
515 LERP (cg, fcg, percent), 730 lerp (fc.g, c.g, percent),
516 LERP (cb, fcb, percent) 731 lerp (fc.b, c.b, percent),
732 lerp (fc.a, c.a, percent)
733 )
517 ); 734 );
518 735
519 return faded; 736 return faded;
520} 737}
521 738

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines