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.592 by root, Thu Jun 17 00:49:20 2021 UTC vs.
Revision 1.598 by sf-exg, Sun Sep 18 20:32:17 2022 UTC

25 * - extensive modifications 25 * - extensive modifications
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-2021 Marc Lehmann <schmorp@schmorp.de>
31 * Copyright (c) 2007,2015 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
3019 case 7: /* unofficial extension */ 3019 case 7: /* unofficial extension */
3020 if (option (Opt_insecure)) 3020 if (option (Opt_insecure))
3021 tt_printf ("%-.250s\012", rs[Rs_display_name]); 3021 tt_printf ("%-.250s\012", rs[Rs_display_name]);
3022 break; 3022 break;
3023 case 8: /* unofficial extension */ 3023 case 8: /* unofficial extension */
3024 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); 3024 process_xterm_seq (XTerm_title, (char *)RESNAME "-" VERSION, CHAR_ST); // char * cast verified
3025 break; 3025 break;
3026 } 3026 }
3027 break; 3027 break;
3028 3028
3029 case CSI_TBC: /* 8.3.155: (0) TABULATION CLEAR */ 3029 case CSI_TBC: /* 8.3.155: (0) TABULATION CLEAR */
3334 3334
3335 uint32_t color = (a << 24) | (r << 16) | (g << 8) | b; 3335 uint32_t color = (a << 24) | (r << 16) | (g << 8) | b;
3336 3336
3337 /* we allow one of the 6 closest neighbouring colours */ 3337 /* we allow one of the 6 closest neighbouring colours */
3338 /* to replace the current color, if they not used recently */ 3338 /* to replace the current color, if they not used recently */
3339 #if 0
3339 static const signed char dxyz[][3] = { 3340 static const unsigned char dxyz[][3] = {
3340 0, 0, 0, 3341 0, 0, 0,
3341 0, 0, 4, 3342 0, 0, 4,
3342 0, 4, 0,
3343 4, 0, 0,
3344 0, 4, 4, 3343 0, 4, 4,
3345 4, 4, 0, 3344 4, 4, 0,
3346 4, 0, 4, 3345 4, 0, 4,
3346 0, 4, 0,
3347 4, 0, 0,
3347 }; 3348 };
3349 #else
3350 // silly compressed verlapping triplets version of above
3351 static const unsigned char dxyz[] = {
3352 0, 0, 0, 4, 4, 0, 4, 0, 0,
3353 };
3354 #endif
3348 3355
3349 static const unsigned char color_level[8][32] = { 3356 static const unsigned char color_level[8][32] = {
3350 // neighbour index 3357 // neighbour index
3351 {0, 0, 1, 0, 0, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}, 3358 {0, 0, 1, 0, 0, 1, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3},
3352 {0, 1, 0, 1, 1, 2, 1, 1, 2, 2, 3, 3, 2, 2, 2, 3, 3, 3, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4}, 3359 {0, 1, 0, 1, 1, 2, 1, 1, 2, 2, 3, 3, 2, 2, 2, 3, 3, 3, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4},
3359 {0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6}, 3366 {0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6},
3360 }; 3367 };
3361 3368
3362 unsigned int idx; 3369 unsigned int idx;
3363 3370
3364 for (int n = 0; n < ecb_array_length (dxyz); ++n) 3371 for (int n = 0; n < ecb_array_length (dxyz) - 2; ++n)
3365 { 3372 {
3366 unsigned int idx_r = color_level[ Red_levels - dxyz[n][0]][r / 8]; 3373 unsigned int idx_r = color_level[ Red_levels - dxyz[n + 0]][r / 8];
3367 unsigned int idx_g = color_level[Green_levels - dxyz[n][1]][g / 8]; 3374 unsigned int idx_g = color_level[Green_levels - dxyz[n + 1]][g / 8];
3368 unsigned int idx_b = color_level[ Blue_levels - dxyz[n][2]][b / 8]; 3375 unsigned int idx_b = color_level[ Blue_levels - dxyz[n + 2]][b / 8];
3369 unsigned int index = colorcube_index (idx_r, idx_g, idx_b); 3376 unsigned int index = colorcube_index (idx_r, idx_g, idx_b);
3370 3377
3371 if (n == 0) 3378 if (n == 0)
3372 idx = index; 3379 idx = index;
3373 3380
3383 idx = index; 3390 idx = index;
3384 goto update; 3391 goto update;
3385 } 3392 }
3386 3393
3387 // like (rgb24_seqno[idx] > rgb24_seqno[index]) 3394 // like (rgb24_seqno[idx] > rgb24_seqno[index])
3388 // but also handles wrap around values good enough 3395 // but also handles wrap around values well enough
3389 if ((uint16_t)(rgb24_seqno[idx] - rgb24_seqno[index]) < 0x7fff) 3396 if ((uint16_t)(rgb24_seqno[idx] - rgb24_seqno[index]) < 0x8000)
3390 idx = index; 3397 idx = index;
3391 } 3398 }
3392 3399
3393update: 3400update:
3394 rgb24_color[idx] = color; 3401 rgb24_color[idx] = color;
3405void 3412void
3406rxvt_term::process_color_seq (int report, int color, const char *str, char resp) 3413rxvt_term::process_color_seq (int report, int color, const char *str, char resp)
3407{ 3414{
3408 if (str[0] == '?' && !str[1]) 3415 if (str[0] == '?' && !str[1])
3409 { 3416 {
3410 if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR))
3411 return;
3412
3413 rgba c; 3417 rgba c;
3414 pix_colors_focused[color].get (c); 3418 pix_colors_focused[color].get (c);
3415 color -= minCOLOR; 3419 char rgba_str[32];
3416 3420
3417#if XFT 3421#if XFT
3418 if (c.a != rgba::MAX_CC) 3422 if (c.a != rgba::MAX_CC)
3419 tt_printf ("\033]%d;%d;rgba:%04x/%04x/%04x/%04x%c", report, color, c.r, c.g, c.b, c.a, resp); 3423 snprintf (rgba_str, sizeof (rgba_str), "rgba:%04x/%04x/%04x/%04x", c.r, c.g, c.b, c.a);
3420 else 3424 else
3421#endif 3425#endif
3422 tt_printf ("\033]%d;%d;rgb:%04x/%04x/%04x%c", report, color, c.r, c.g, c.b, resp); 3426 snprintf (rgba_str, sizeof (rgba_str), "rgb:%04x/%04x/%04x", c.r, c.g, c.b);
3427
3428 if (IN_RANGE_INC (color, minCOLOR, maxTermCOLOR))
3429 tt_printf ("\033]%d;%d;%s%c", report, color - minCOLOR, rgba_str, resp);
3430 else
3431 tt_printf ("\033]%d;%s%c", report, rgba_str, resp);
3423 } 3432 }
3424 else 3433 else
3425 set_window_color (color, str); 3434 set_window_color (color, str);
3426} 3435}
3427 3436
3599 rs[Rs_name], VERSION[0], VERSION[2], 3608 rs[Rs_name], VERSION[0], VERSION[2],
3600 resp); 3609 resp);
3601 break; 3610 break;
3602 3611
3603#if !ENABLE_MINIMAL 3612#if !ENABLE_MINIMAL
3613 case URxvt_cellinfo:
3614 if (query)
3615 tt_printf ("\33]%d;%d;%d;%d%c", saveop,
3616 fwidth, fheight, fbase,
3617 resp);
3618 break;
3619
3604 case URxvt_locale: 3620 case URxvt_locale:
3605 if (query) 3621 if (query)
3606 tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); 3622 tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp);
3607 else 3623 else
3608 { 3624 {
3731 // 1037 send DEL for keypad delete NYI 3747 // 1037 send DEL for keypad delete NYI
3732 { 1047, PrivMode_Screen }, 3748 { 1047, PrivMode_Screen },
3733 // 1048 save and restore cursor, implemented in code 3749 // 1048 save and restore cursor, implemented in code
3734 { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ 3750 { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */
3735 // 1051, 1052, 1060, 1061 keyboard emulation NYI 3751 // 1051, 1052, 1060, 1061 keyboard emulation NYI
3752#if ENABLE_FRILLS
3736 { 2004, PrivMode_BracketPaste }, 3753 { 2004, PrivMode_BracketPaste },
3754#endif
3737 }; 3755 };
3738 3756
3739 if (nargs == 0) 3757 if (nargs == 0)
3740 return; 3758 return;
3741 3759

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines