… | |
… | |
548 | while (XEventsQueued (dpy, QueuedAfterReading)) |
548 | while (XEventsQueued (dpy, QueuedAfterReading)) |
549 | { |
549 | { |
550 | XEvent xev; |
550 | XEvent xev; |
551 | XNextEvent (dpy, &xev); |
551 | XNextEvent (dpy, &xev); |
552 | |
552 | |
|
|
553 | flush_ev.start (); |
|
|
554 | |
553 | #ifdef USE_XIM |
555 | #ifdef USE_XIM |
554 | if (!XFilterEvent (&xev, None)) |
556 | if (!XFilterEvent (&xev, None)) |
|
|
557 | #endif |
555 | { |
558 | { |
556 | if (xev.type == PropertyNotify |
559 | if (xev.type == PropertyNotify |
557 | && xev.xany.window == root |
560 | && xev.xany.window == root |
558 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
561 | && xev.xproperty.atom == xa[XA_XIM_SERVERS]) |
559 | im_change_check (); |
562 | im_change_check (); |
560 | #endif |
|
|
561 | if (xev.type == MappingNotify) |
563 | if (xev.type == MappingNotify) |
562 | XRefreshKeyboardMapping (&xev.xmapping); |
564 | XRefreshKeyboardMapping (&xev.xmapping); |
563 | |
565 | |
564 | for (int i = xw.size (); i--; ) |
566 | for (int i = xw.size (); i--; ) |
565 | { |
567 | { |
566 | if (!xw[i]) |
568 | if (!xw[i]) |
567 | xw.erase_unordered (i); |
569 | xw.erase_unordered (i); |
568 | else if (xw[i]->window == xev.xany.window) |
570 | else if (xw[i]->window == xev.xany.window) |
569 | xw[i]->call (xev); |
571 | xw[i]->call (xev); |
570 | } |
572 | } |
571 | #ifdef USE_XIM |
|
|
572 | } |
573 | } |
573 | #endif |
|
|
574 | } |
574 | } |
575 | } |
|
|
576 | |
575 | |
|
|
576 | XFlush (dpy); |
|
|
577 | } |
|
|
578 | |
577 | void rxvt_display::flush_cb (ev::prepare &w, int revents) |
579 | void rxvt_display::flush_cb (ev::idle &w, int revents) |
578 | { |
580 | { |
579 | w.stop (); |
|
|
580 | XFlush (dpy); |
581 | XFlush (dpy); |
581 | } |
582 | } |
582 | |
583 | |
583 | void rxvt_display::reg (xevent_watcher *w) |
584 | void rxvt_display::reg (xevent_watcher *w) |
584 | { |
585 | { |
… | |
… | |
673 | } |
674 | } |
674 | |
675 | |
675 | bool |
676 | bool |
676 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
677 | rxvt_color::alloc (rxvt_screen *screen, const rgba &color) |
677 | { |
678 | { |
678 | //TODO: only supports 24 bit truecolour |
679 | //TODO: only supports 24 bit |
679 | int alpha = color.a >= 0xff00 ? 0xffff : color.a; |
680 | int alpha = color.a >= 0xff00 ? 0xffff : color.a; |
680 | |
681 | |
681 | #if XFT |
682 | #if XFT |
682 | XRenderPictFormat *format; |
683 | XRenderPictFormat *format; |
683 | |
684 | |
… | |
… | |
740 | { |
741 | { |
741 | rgba c; |
742 | rgba c; |
742 | char eos; |
743 | char eos; |
743 | int skip; |
744 | int skip; |
744 | |
745 | |
|
|
746 | c.a = rgba::MAX_CC; |
|
|
747 | |
745 | // parse the nonstandard "[alphapercent]" prefix |
748 | // parse the nonstandard "[alphapercent]" prefix |
746 | if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) |
749 | if (1 <= sscanf (name, "[%hd]%n", &c.a, &skip)) |
747 | { |
750 | { |
748 | c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); |
751 | c.a = lerp<int, int, int> (0, rgba::MAX_CC, c.a); |
749 | name += skip; |
752 | name += skip; |
750 | } |
753 | } |
751 | else |
|
|
752 | c.a = rgba::MAX_CC; |
|
|
753 | |
754 | |
754 | // parse the non-standard "#aarrggbb" format |
|
|
755 | 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)) |
|
|
756 | { |
|
|
757 | c.r <<= 8; |
|
|
758 | c.g <<= 8; |
|
|
759 | c.b <<= 8; |
|
|
760 | c.a <<= 8; |
|
|
761 | } |
|
|
762 | // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format |
755 | // parse the non-standard "rgba:rrrr/gggg/bbbb/aaaa" format |
763 | 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)) |
756 | if (strlen (name) != 4+5*4 || 4 != sscanf (name, "rgba:%4hx/%4hx/%4hx/%4hx%c", &c.r, &c.g, &c.b, &c.a, &eos)) |
764 | { |
757 | { |
765 | XColor xc; |
758 | XColor xc; |
766 | |
759 | |
767 | if (XParseColor (screen->dpy, screen->cmap, name, &xc)) |
760 | if (XParseColor (screen->dpy, screen->cmap, name, &xc)) |
768 | { |
761 | { |