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.60 by root, Wed Jul 5 20:37:31 2006 UTC vs.
Revision 1.69 by root, Sat Jun 30 18:10:41 2007 UTC

64#endif 64#endif
65#if USE_XIM 65#if USE_XIM
66 "WM_LOCALE_NAME", 66 "WM_LOCALE_NAME",
67 "XIM_SERVERS", 67 "XIM_SERVERS",
68#endif 68#endif
69#ifdef TRANSPARENT 69#ifdef ENABLE_TRANSPARENCY
70 "_XROOTPMAP_ID", 70 "_XROOTPMAP_ID",
71 "ESETROOT_PMAP_ID", 71 "ESETROOT_PMAP_ID",
72#endif 72#endif
73#if ENABLE_XEMBED 73#if ENABLE_XEMBED
74 "_XEMBED", 74 "_XEMBED",
443 return false; 443 return false;
444 444
445 screen = DefaultScreen (dpy); 445 screen = DefaultScreen (dpy);
446 root = DefaultRootWindow (dpy); 446 root = DefaultRootWindow (dpy);
447 447
448#ifdef HAVE_AFTERIMAGE
449 ::dpy = dpy; /* init global var from libAfter... */
450 asv = create_asvisual_for_id (dpy, screen, DefaultDepth (dpy,screen),
451 XVisualIDFromVisual (DefaultVisual (dpy, screen)), None, NULL);
452#endif
453
448 assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); 454 assert (sizeof (xa_names) / sizeof (char *) == NUM_XA);
449 XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa); 455 XInternAtoms (dpy, (char **)xa_names, NUM_XA, False, xa);
450 456
451 XrmSetDatabase (dpy, get_resources (false)); 457 XrmSetDatabase (dpy, get_resources (false));
452 458
469 is_local = 0; 475 is_local = 0;
470 sockaddr_un sa; 476 sockaddr_un sa;
471 socklen_t sl = sizeof (sa); 477 socklen_t sl = sizeof (sa);
472 478
473 if (!getsockname (fd, (sockaddr *)&sa, &sl)) 479 if (!getsockname (fd, (sockaddr *)&sa, &sl))
474 is_local = sa.sun_family == AF_LOCAL; 480 is_local = sa.sun_family == AF_UNIX;
475 481
476 x_ev.start (fd, EVENT_READ); 482 x_ev.start (fd, EVENT_READ);
477 fcntl (fd, F_SETFD, FD_CLOEXEC); 483 fcntl (fd, F_SETFD, FD_CLOEXEC);
478 484
479 XSelectInput (dpy, root, PropertyChangeMask); 485 XSelectInput (dpy, root, PropertyChangeMask);
553 if (xev.type == PropertyNotify 559 if (xev.type == PropertyNotify
554 && xev.xany.window == root 560 && xev.xany.window == root
555 && xev.xproperty.atom == xa[XA_XIM_SERVERS]) 561 && xev.xproperty.atom == xa[XA_XIM_SERVERS])
556 im_change_check (); 562 im_change_check ();
557#endif 563#endif
564 if (xev.type == MappingNotify)
565 XRefreshKeyboardMapping (&xev.xmapping);
566
558 for (int i = xw.size (); i--; ) 567 for (int i = xw.size (); i--; )
559 { 568 {
560 if (!xw[i]) 569 if (!xw[i])
561 xw.erase_unordered (i); 570 xw.erase_unordered (i);
562 else if (xw[i]->window == xev.xany.window) 571 else if (xw[i]->window == xev.xany.window)
579 XFlush (dpy); 588 XFlush (dpy);
580} 589}
581 590
582void rxvt_display::reg (xevent_watcher *w) 591void rxvt_display::reg (xevent_watcher *w)
583{ 592{
593 if (!w->active)
594 {
584 xw.push_back (w); 595 xw.push_back (w);
585 w->active = xw.size (); 596 w->active = xw.size ();
597 }
586} 598}
587 599
588void rxvt_display::unreg (xevent_watcher *w) 600void rxvt_display::unreg (xevent_watcher *w)
589{ 601{
590 if (w->active) 602 if (w->active)
603 {
591 xw[w->active - 1] = 0; 604 xw[w->active - 1] = 0;
605 w->active = 0;
606 }
592} 607}
593 608
594void rxvt_display::set_selection_owner (rxvt_term *owner) 609void rxvt_display::set_selection_owner (rxvt_term *owner)
595{ 610{
596 if (selection_owner && selection_owner != owner) 611 if (selection_owner && selection_owner != owner)
701 c.green = color.g; 716 c.green = color.g;
702 c.blue = color.b; 717 c.blue = color.b;
703 718
704 if (screen->visual->c_class == TrueColor) 719 if (screen->visual->c_class == TrueColor)
705 { 720 {
706 c.pixel = (color.r * (screen->visual->red_mask >> ctz (screen->visual->red_mask )) 721 c.pixel = (color.r >> (16 - popcount (screen->visual->red_mask )) << ctz (screen->visual->red_mask ))
707 / rgba::MAX_CC) << ctz (screen->visual->red_mask ) 722 | (color.g >> (16 - popcount (screen->visual->green_mask)) << ctz (screen->visual->green_mask))
708 | (color.g * (screen->visual->green_mask >> ctz (screen->visual->green_mask))
709 / rgba::MAX_CC) << ctz (screen->visual->green_mask)
710 | (color.b * (screen->visual->blue_mask >> ctz (screen->visual->blue_mask )) 723 | (color.b >> (16 - popcount (screen->visual->blue_mask )) << ctz (screen->visual->blue_mask ));
711 / rgba::MAX_CC) << ctz (screen->visual->blue_mask );
712 724
713 return true; 725 return true;
714 } 726 }
715 else if (XAllocColor (screen->dpy, screen->cmap, &c)) 727 else if (XAllocColor (screen->dpy, screen->cmap, &c))
716 return true; 728 return true;
803 //rxvt_warn ("could not allocate %04x %04x %04x, getting %04x %04x %04x instead (%d)\n", 815 //rxvt_warn ("could not allocate %04x %04x %04x, getting %04x %04x %04x instead (%d)\n",
804 // color.r, color.g, color.b, best->red, best->green, best->blue, diff); 816 // color.r, color.g, color.b, best->red, best->green, best->blue, diff);
805 817
806 got = alloc (screen, rgba (best->red, best->green, best->blue)); 818 got = alloc (screen, rgba (best->red, best->green, best->blue));
807 819
808 delete colors; 820 delete [] colors;
809 } 821 }
810#endif 822#endif
811 823
812 return got; 824 return got;
813} 825}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines