ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.566 by sf-exg, Sat Sep 12 14:03:35 2015 UTC vs.
Revision 1.570 by sf-exg, Tue Jun 21 12:03:56 2016 UTC

26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> 26 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org>
27 * Copyright (c) 2001 Marius Gedminas 27 * Copyright (c) 2001 Marius Gedminas
28 * - Ctrl/Mod4+Tab works like Meta+Tab (options) 28 * - Ctrl/Mod4+Tab works like Meta+Tab (options)
29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> 29 * Copyright (c) 2003 Rob McMullen <robm@flipturn.org>
30 * Copyright (c) 2003-2014 Marc Lehmann <schmorp@schmorp.de> 30 * Copyright (c) 2003-2014 Marc Lehmann <schmorp@schmorp.de>
31 * Copyright (c) 2007 Emanuele Giaquinta <e.giaquinta@glauco.it> 31 * Copyright (c) 2007,2015 Emanuele Giaquinta <e.giaquinta@glauco.it>
32 * 32 *
33 * This program is free software; you can redistribute it and/or modify 33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU General Public License as published by 34 * it under the terms of the GNU General Public License as published by
35 * the Free Software Foundation; either version 3 of the License, or 35 * the Free Software Foundation; either version 3 of the License, or
36 * (at your option) any later version. 36 * (at your option) any later version.
1787 } 1787 }
1788#endif 1788#endif
1789#if ENABLE_FRILLS 1789#if ENABLE_FRILLS
1790 if (option (Opt_urgentOnBell)) 1790 if (option (Opt_urgentOnBell))
1791 set_urgency (0); 1791 set_urgency (0);
1792
1793 if (priv_modes & PrivMode_FocusEvent)
1794 tt_printf ("\x1b[I");
1792#endif 1795#endif
1793 1796
1794 HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END)); 1797 HOOK_INVOKE ((this, HOOK_FOCUS_IN, DT_END));
1795 } 1798 }
1796} 1799}
1804 want_refresh = 1; 1807 want_refresh = 1;
1805 1808
1806#if ENABLE_FRILLS 1809#if ENABLE_FRILLS
1807 if (option (Opt_urgentOnBell)) 1810 if (option (Opt_urgentOnBell))
1808 set_urgency (0); 1811 set_urgency (0);
1812
1813 if (priv_modes & PrivMode_FocusEvent)
1814 tt_printf ("\x1b[O");
1809#endif 1815#endif
1810#if ENABLE_FRILLS || ISO_14755 1816#if ENABLE_FRILLS || ISO_14755
1811 if (iso14755buf) 1817 if (iso14755buf)
1812 { 1818 {
1813 iso14755buf = 0; 1819 iso14755buf = 0;
3328 free (s); 3334 free (s);
3329 } 3335 }
3330 } 3336 }
3331} 3337}
3332 3338
3339/*
3340 * Find the nearest color slot in the hidden color cube,
3341 * adapt its value to the 24bit RGB color.
3342 */
3343unsigned int
3344rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b)
3345{
3346 unsigned int idx_r = (r & 0xff) / (0xff / (Red_levels - 1));
3347 unsigned int idx_g = (g & 0xff) / (0xff / (Green_levels - 1));
3348 unsigned int idx_b = (b & 0xff) / (0xff / (Blue_levels - 1));
3349 unsigned int idx;
3350
3351 idx = minTermCOLOR24 + idx_r * Blue_levels * Green_levels +
3352 idx_g * Blue_levels +
3353 idx_b;
3354
3355 pix_colors_focused [idx].free (this);
3356 pix_colors_focused [idx].set (this, rgba (r * 0x0101,
3357 g * 0x0101,
3358 b * 0x0101));
3359 update_fade_color (idx, false);
3360
3361 return idx;
3362}
3363
3333void 3364void
3334rxvt_term::process_color_seq (int report, int color, const char *str, char resp) 3365rxvt_term::process_color_seq (int report, int color, const char *str, char resp)
3335{ 3366{
3336 if (str[0] == '?' && !str[1]) 3367 if (str[0] == '?' && !str[1])
3337 { 3368 {
3338 rgba c; 3369 rgba c;
3339 pix_colors_focused[color].get (c); 3370 pix_colors_focused[color].get (c);
3340 3371
3341#if XFT 3372#if XFT
3342 if (c.a != rgba::MAX_CC) 3373 if (c.a != rgba::MAX_CC)
3343 tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.a, c.r, c.g, c.b, resp); 3374 tt_printf ("\033]%d;rgba:%04x/%04x/%04x/%04x%c", report, c.r, c.g, c.b, c.a, resp);
3344 else 3375 else
3345#endif 3376#endif
3346 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp); 3377 tt_printf ("\033]%d;rgb:%04x/%04x/%04x%c", report, c.r, c.g, c.b, resp);
3347 } 3378 }
3348 else 3379 else
3707#endif 3738#endif
3708 { 1000, PrivMode_MouseX11 }, 3739 { 1000, PrivMode_MouseX11 },
3709 { 1002, PrivMode_MouseBtnEvent }, 3740 { 1002, PrivMode_MouseBtnEvent },
3710 { 1003, PrivMode_MouseAnyEvent }, 3741 { 1003, PrivMode_MouseAnyEvent },
3711#if ENABLE_FRILLS 3742#if ENABLE_FRILLS
3743 { 1004, PrivMode_FocusEvent },
3712 { 1005, PrivMode_ExtModeMouse }, 3744 { 1005, PrivMode_ExtModeMouse },
3713#endif 3745#endif
3714 { 1010, PrivMode_TtyOutputInh }, // rxvt extension 3746 { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3715 { 1011, PrivMode_Keypress }, // rxvt extension 3747 { 1011, PrivMode_Keypress }, // rxvt extension
3716#if ENABLE_FRILLS 3748#if ENABLE_FRILLS
3969 if (nargs > i + 2 && arg[i + 1] == 5) 4001 if (nargs > i + 2 && arg[i + 1] == 5)
3970 { 4002 {
3971 scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); 4003 scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg);
3972 i += 2; 4004 i += 2;
3973 } 4005 }
4006 else if (nargs > i + 4 && arg[i + 1] == 2)
4007 {
4008 unsigned int r = arg[i + 2];
4009 unsigned int g = arg[i + 3];
4010 unsigned int b = arg[i + 4];
4011 unsigned int idx = map_rgb24_color (r, g, b);
4012 scr_color (idx, Color_fg);
4013 i += 4;
4014 }
3974 break; 4015 break;
3975 case 39: /* default fg */ 4016 case 39: /* default fg */
3976 scr_color (Color_fg, Color_fg); 4017 scr_color (Color_fg, Color_fg);
3977 break; 4018 break;
3978 4019
3989 case 48: // set bg color, ISO 8613-6 4030 case 48: // set bg color, ISO 8613-6
3990 if (nargs > i + 2 && arg[i + 1] == 5) 4031 if (nargs > i + 2 && arg[i + 1] == 5)
3991 { 4032 {
3992 scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); 4033 scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg);
3993 i += 2; 4034 i += 2;
4035 }
4036 else if (nargs > i + 4 && arg[i + 1] == 2)
4037 {
4038 unsigned int r = arg[i + 2];
4039 unsigned int g = arg[i + 3];
4040 unsigned int b = arg[i + 4];
4041 unsigned int idx = map_rgb24_color (r, g, b);
4042 scr_color (idx, Color_bg);
4043 i += 4;
3994 } 4044 }
3995 break; 4045 break;
3996 case 49: /* default bg */ 4046 case 49: /* default bg */
3997 scr_color (Color_bg, Color_bg); 4047 scr_color (Color_bg, Color_bg);
3998 break; 4048 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines