… | |
… | |
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 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 3 of the License, or |
36 | * (at your option) any later version. |
36 | * (at your option) any later version. |
37 | * |
37 | * |
38 | * This program is distributed in the hope that it will be useful, |
38 | * This program is distributed in the hope that it will be useful, |
39 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
39 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
40 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
40 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
… | |
… | |
415 | rxvt_term::key_press (XKeyEvent &ev) |
415 | rxvt_term::key_press (XKeyEvent &ev) |
416 | { |
416 | { |
417 | int ctrl, meta, shft, len; |
417 | int ctrl, meta, shft, len; |
418 | KeySym keysym; |
418 | KeySym keysym; |
419 | int valid_keysym; |
419 | int valid_keysym; |
420 | char rkbuf[KBUFSZ]; |
420 | char rkbuf[KBUFSZ + 1]; |
421 | char *kbuf = rkbuf + 1; |
421 | char *kbuf = rkbuf + 1; |
422 | |
422 | |
423 | #if ISO_14755 |
423 | #if ISO_14755 |
424 | if (iso14755buf & ISO_14755_52) |
424 | if (iso14755buf & ISO_14755_52) |
425 | return; |
425 | return; |
… | |
… | |
697 | ) |
697 | ) |
698 | { |
698 | { |
699 | *--kbuf = C0_ESC; |
699 | *--kbuf = C0_ESC; |
700 | len++; |
700 | len++; |
701 | } |
701 | } |
|
|
702 | |
|
|
703 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
|
|
704 | return; |
702 | |
705 | |
703 | if (valid_keysym) |
706 | if (valid_keysym) |
704 | { |
707 | { |
705 | #ifdef KEYSYM_RESOURCE |
708 | #ifdef KEYSYM_RESOURCE |
706 | if (keyboard->dispatch (this, keysym, ev.state, kbuf, len)) |
709 | if (keyboard->dispatch (this, keysym, ev.state, kbuf, len)) |
… | |
… | |
871 | return; |
874 | return; |
872 | } |
875 | } |
873 | #endif |
876 | #endif |
874 | } |
877 | } |
875 | |
878 | |
876 | if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) |
|
|
877 | return; |
|
|
878 | |
|
|
879 | if (len <= 0) |
879 | if (len <= 0) |
880 | return; /* not mapped */ |
880 | return; /* not mapped */ |
881 | |
881 | |
882 | if (option (Opt_scrollTtyKeypress)) |
|
|
883 | if (view_start) |
|
|
884 | { |
|
|
885 | view_start = 0; |
|
|
886 | want_refresh = 1; |
|
|
887 | } |
|
|
888 | |
|
|
889 | tt_write (kbuf, (unsigned int)len); |
882 | tt_write_user_input (kbuf, (unsigned int)len); |
890 | } |
883 | } |
891 | |
884 | |
892 | void ecb_cold |
885 | void ecb_cold |
893 | rxvt_term::key_release (XKeyEvent &ev) |
886 | rxvt_term::key_release (XKeyEvent &ev) |
894 | { |
887 | { |
… | |
… | |
4045 | |
4038 | |
4046 | want_refresh = 1; |
4039 | want_refresh = 1; |
4047 | } |
4040 | } |
4048 | /*}}} */ |
4041 | /*}}} */ |
4049 | |
4042 | |
4050 | /* ------------------------------------------------------------------------- */ |
4043 | /* ---------------------------------------------------------------------- */ |
|
|
4044 | /* Write data to the pty as typed by the user, pasted with the mouse, |
|
|
4045 | * or generated by us in response to a query ESC sequence. |
|
|
4046 | */ |
4051 | |
4047 | |
4052 | /* |
4048 | /* |
4053 | * Send printf () formatted output to the command. |
4049 | * Send printf () formatted output to the command. |
4054 | * Only use for small amounts of data. |
4050 | * Only use for small amounts of data. |
4055 | */ |
4051 | */ |
… | |
… | |
4063 | vsnprintf ((char *)buf, 256, fmt, arg_ptr); |
4059 | vsnprintf ((char *)buf, 256, fmt, arg_ptr); |
4064 | va_end (arg_ptr); |
4060 | va_end (arg_ptr); |
4065 | tt_write (buf, strlen (buf)); |
4061 | tt_write (buf, strlen (buf)); |
4066 | } |
4062 | } |
4067 | |
4063 | |
4068 | /* ---------------------------------------------------------------------- */ |
|
|
4069 | /* Write data to the pty as typed by the user, pasted with the mouse, |
4064 | /* Write data to the pty as typed by the user. */ |
4070 | * or generated by us in response to a query ESC sequence. |
4065 | void |
4071 | */ |
4066 | rxvt_term::tt_write_user_input (const char *data, unsigned int len) |
4072 | static const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
4067 | { |
|
|
4068 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
|
|
4069 | return; |
|
|
4070 | |
|
|
4071 | if (option (Opt_scrollTtyKeypress)) |
|
|
4072 | if (view_start) |
|
|
4073 | { |
|
|
4074 | view_start = 0; |
|
|
4075 | want_refresh = 1; |
|
|
4076 | } |
|
|
4077 | |
|
|
4078 | tt_write_ (data, len); |
|
|
4079 | } |
4073 | |
4080 | |
4074 | void |
4081 | void |
4075 | rxvt_term::tt_write (const char *data, unsigned int len) |
4082 | rxvt_term::tt_write (const char *data, unsigned int len) |
4076 | { |
4083 | { |
4077 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4084 | if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) |
4078 | return; |
4085 | return; |
4079 | |
4086 | |
|
|
4087 | tt_write_ (data, len); |
|
|
4088 | } |
|
|
4089 | |
|
|
4090 | static const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT |
|
|
4091 | |
|
|
4092 | void |
|
|
4093 | rxvt_term::tt_write_ (const char *data, unsigned int len) |
|
|
4094 | { |
4080 | if (pty->pty < 0) |
4095 | if (pty->pty < 0) |
4081 | return; |
4096 | return; |
4082 | |
4097 | |
4083 | if (v_buflen == 0) |
4098 | if (v_buflen == 0) |
4084 | { |
4099 | { |