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.545 by sf-exg, Sat Apr 26 15:05:17 2014 UTC vs.
Revision 1.550 by root, Thu May 22 18:54:32 2014 UTC

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
415rxvt_term::key_press (XKeyEvent &ev) 415rxvt_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
892void ecb_cold 885void ecb_cold
893rxvt_term::key_release (XKeyEvent &ev) 886rxvt_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. 4065void
4071 */ 4066rxvt_term::tt_write_user_input (const char *data, unsigned int len)
4072static 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
4074void 4081void
4075rxvt_term::tt_write (const char *data, unsigned int len) 4082rxvt_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
4090static const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT
4091
4092void
4093rxvt_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 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines