… | |
… | |
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-2011 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 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 2 of the License, or |
35 | * the Free Software Foundation; either version 2 of the License, or |
… | |
… | |
400 | break; |
400 | break; |
401 | } |
401 | } |
402 | return param; |
402 | return param; |
403 | } |
403 | } |
404 | |
404 | |
|
|
405 | static inline wchar_t * |
|
|
406 | rxvt_wcsdup (const wchar_t *str, int len) |
|
|
407 | { |
|
|
408 | wchar_t *r = (wchar_t *)rxvt_malloc ((len + 1) * sizeof (wchar_t)); |
|
|
409 | memcpy (r, str, len * sizeof (wchar_t)); |
|
|
410 | r[len] = 0; |
|
|
411 | return r; |
|
|
412 | } |
|
|
413 | |
405 | void ecb_cold |
414 | void ecb_cold |
406 | rxvt_term::key_press (XKeyEvent &ev) |
415 | rxvt_term::key_press (XKeyEvent &ev) |
407 | { |
416 | { |
408 | int ctrl, meta, shft, len; |
417 | int ctrl, meta, shft, len; |
409 | KeySym keysym; |
418 | KeySym keysym; |
410 | int valid_keysym; |
419 | int valid_keysym; |
411 | char kbuf[KBUFSZ]; |
420 | char rkbuf[KBUFSZ]; |
|
|
421 | char *kbuf = rkbuf + 1; |
412 | |
422 | |
413 | #if ISO_14755 |
423 | #if ISO_14755 |
414 | if (iso14755buf & ISO_14755_52) |
424 | if (iso14755buf & ISO_14755_52) |
415 | return; |
425 | return; |
416 | #endif |
426 | #endif |
… | |
… | |
576 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
586 | case XK_KP_Subtract: /* Shift+KP_Subtract = smaller font */ |
577 | return; |
587 | return; |
578 | #endif |
588 | #endif |
579 | } |
589 | } |
580 | } |
590 | } |
|
|
591 | } |
|
|
592 | |
|
|
593 | if (ctrl && meta && (keysym == XK_c || keysym == XK_v)) |
|
|
594 | { |
|
|
595 | if (keysym == XK_v) |
|
|
596 | selection_request (ev.time, Sel_Clipboard); |
|
|
597 | else if (selection.len > 0) |
|
|
598 | { |
|
|
599 | free (selection.clip_text); |
|
|
600 | selection.clip_text = rxvt_wcsdup (selection.text, selection.len); |
|
|
601 | selection.clip_len = selection.len; |
|
|
602 | selection_grab (CurrentTime, true); |
|
|
603 | } |
|
|
604 | |
|
|
605 | return; |
581 | } |
606 | } |
582 | |
607 | |
583 | #if ENABLE_FRILLS || ISO_14755 |
608 | #if ENABLE_FRILLS || ISO_14755 |
584 | // ISO 14755 support |
609 | // ISO 14755 support |
585 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_51)) |
610 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_51)) |
… | |
… | |
832 | #endif |
857 | #endif |
833 | /* nil */ ; |
858 | /* nil */ ; |
834 | } |
859 | } |
835 | } |
860 | } |
836 | |
861 | |
|
|
862 | /* escape prefix */ |
|
|
863 | if (len && meta |
|
|
864 | #ifdef META8_OPTION |
|
|
865 | && meta_char == C0_ESC |
|
|
866 | #endif |
|
|
867 | ) |
|
|
868 | { |
|
|
869 | *--kbuf = C0_ESC; |
|
|
870 | len++; |
|
|
871 | } |
|
|
872 | |
837 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
873 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
838 | return; |
874 | return; |
839 | |
875 | |
840 | if (len <= 0) |
876 | if (len <= 0) |
841 | return; /* not mapped */ |
877 | return; /* not mapped */ |
… | |
… | |
844 | if (view_start) |
880 | if (view_start) |
845 | { |
881 | { |
846 | view_start = 0; |
882 | view_start = 0; |
847 | want_refresh = 1; |
883 | want_refresh = 1; |
848 | } |
884 | } |
849 | |
|
|
850 | /* escape prefix */ |
|
|
851 | if (meta |
|
|
852 | #ifdef META8_OPTION |
|
|
853 | && meta_char == C0_ESC |
|
|
854 | #endif |
|
|
855 | ) |
|
|
856 | { |
|
|
857 | const char ch = C0_ESC; |
|
|
858 | tt_write (&ch, 1); |
|
|
859 | } |
|
|
860 | |
885 | |
861 | tt_write (kbuf, (unsigned int)len); |
886 | tt_write (kbuf, (unsigned int)len); |
862 | } |
887 | } |
863 | |
888 | |
864 | void ecb_cold |
889 | void ecb_cold |
… | |
… | |
3379 | &nitems, &bytes_after, &value) == Success |
3404 | &nitems, &bytes_after, &value) == Success |
3380 | && actual_type != None |
3405 | && actual_type != None |
3381 | && actual_format == 8) |
3406 | && actual_format == 8) |
3382 | str = (const char *)(value); |
3407 | str = (const char *)(value); |
3383 | |
3408 | |
3384 | tt_printf ("\033]%d;%s%c", op, str, resp); |
3409 | tt_printf ("\033]%d;%s%c", op, option (Opt_insecure) ? str : "", resp); |
3385 | |
3410 | |
3386 | XFree (value); |
3411 | XFree (value); |
3387 | } |
3412 | } |
3388 | else |
3413 | else |
3389 | { |
3414 | { |