… | |
… | |
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 | |
3393 | update: |
3400 | update: |
3394 | rgb24_color[idx] = color; |
3401 | rgb24_color[idx] = color; |
… | |
… | |
3599 | rs[Rs_name], VERSION[0], VERSION[2], |
3606 | rs[Rs_name], VERSION[0], VERSION[2], |
3600 | resp); |
3607 | resp); |
3601 | break; |
3608 | break; |
3602 | |
3609 | |
3603 | #if !ENABLE_MINIMAL |
3610 | #if !ENABLE_MINIMAL |
|
|
3611 | case URxvt_cellinfo: |
|
|
3612 | if (query) |
|
|
3613 | tt_printf ("\33]%d;%d;%d;%d%c", saveop, |
|
|
3614 | fwidth, fheight, fbase, |
|
|
3615 | resp); |
|
|
3616 | break; |
|
|
3617 | |
3604 | case URxvt_locale: |
3618 | case URxvt_locale: |
3605 | if (query) |
3619 | if (query) |
3606 | tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); |
3620 | tt_printf ("\33]%d;%-.250s%c", op, option (Opt_insecure) ? locale : "", resp); |
3607 | else |
3621 | else |
3608 | { |
3622 | { |
… | |
… | |
3731 | // 1037 send DEL for keypad delete NYI |
3745 | // 1037 send DEL for keypad delete NYI |
3732 | { 1047, PrivMode_Screen }, |
3746 | { 1047, PrivMode_Screen }, |
3733 | // 1048 save and restore cursor, implemented in code |
3747 | // 1048 save and restore cursor, implemented in code |
3734 | { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ |
3748 | { 1049, PrivMode_Screen }, /* xterm extension, clear screen on ti rather than te */ |
3735 | // 1051, 1052, 1060, 1061 keyboard emulation NYI |
3749 | // 1051, 1052, 1060, 1061 keyboard emulation NYI |
|
|
3750 | #if ENABLE_FRILLS |
3736 | { 2004, PrivMode_BracketPaste }, |
3751 | { 2004, PrivMode_BracketPaste }, |
|
|
3752 | #endif |
3737 | }; |
3753 | }; |
3738 | |
3754 | |
3739 | if (nargs == 0) |
3755 | if (nargs == 0) |
3740 | return; |
3756 | return; |
3741 | |
3757 | |