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.548 by sf-exg, Tue Apr 29 13:10:06 2014 UTC vs.
Revision 1.552 by sf-exg, Fri Jul 25 17:03:38 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
413 413
414void ecb_cold 414void ecb_cold
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 = NoSymbol;
419 int valid_keysym;
420 char rkbuf[KBUFSZ + 1]; 419 char rkbuf[KBUFSZ + 1];
421 char *kbuf = rkbuf + 1; 420 char *kbuf = rkbuf + 1;
422 421
423#if ISO_14755 422#if ISO_14755
424 if (iso14755buf & ISO_14755_52) 423 if (iso14755buf & ISO_14755_52)
483 } 482 }
484 } 483 }
485 else 484 else
486 len = 0; 485 len = 0;
487 } 486 }
488
489 valid_keysym = status_return == XLookupKeySym
490 || status_return == XLookupBoth;
491 } 487 }
492 else 488 else
493#endif 489#endif
494 { 490 {
495 len = XLookupString (&ev, kbuf, KBUFSZ, &keysym, &compose); 491 len = XLookupString (&ev, kbuf, KBUFSZ, &keysym, &compose);
496 valid_keysym = keysym != NoSymbol;
497 }
498
499 if (valid_keysym)
500 { 492 }
493
494 if (keysym != NoSymbol)
495 {
496 KeySym orig_keysym = keysym;
497
498 /* Shift + F1 - F10 generates F11 - F20 */
499 if (shft && keysym >= XK_F1 && keysym <= XK_F10)
500 {
501 keysym += (XK_F11 - XK_F1);
502 shft = 0; /* turn off Shift */
503 }
504
501 if (keysym >= 0xFF00 && keysym <= 0xFFFF) 505 if (keysym >= 0xFF00 && keysym <= 0xFFFF)
502 { 506 {
503 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; 507 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
504 unsigned int newlen = 1; 508 unsigned int newlen = 1;
505 509
685 meta = 0; 689 meta = 0;
686 } 690 }
687#endif 691#endif
688 /* nil */ ; 692 /* nil */ ;
689 } 693 }
694
695 keysym = orig_keysym;
690 } 696 }
691 697
692 /* escape prefix */ 698 /* escape prefix */
693 if (len && meta 699 if (len && meta
694#ifdef META8_OPTION 700#ifdef META8_OPTION
701 } 707 }
702 708
703 if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END))) 709 if (HOOK_INVOKE ((this, HOOK_KEY_PRESS, DT_XEVENT, &ev, DT_INT, keysym, DT_STR_LEN, kbuf, len, DT_END)))
704 return; 710 return;
705 711
706 if (valid_keysym) 712 if (keysym != NoSymbol)
707 { 713 {
708#ifdef KEYSYM_RESOURCE 714#ifdef KEYSYM_RESOURCE
709 if (keyboard->dispatch (this, keysym, ev.state, kbuf, len)) 715 if (keyboard->dispatch (this, keysym, ev.state, kbuf, len))
710 return; 716 return;
711#endif 717#endif
770#endif 776#endif
771 } 777 }
772 778
773 if (shft) 779 if (shft)
774 { 780 {
775 /* Shift + F1 - F10 generates F11 - F20 */
776 if (keysym >= XK_F1 && keysym <= XK_F10)
777 {
778 keysym += (XK_F11 - XK_F1);
779 shft = 0; /* turn off Shift */
780 }
781 else if (!ctrl && !meta && (priv_modes & PrivMode_ShiftKeys)) 781 if (!ctrl && !meta && (priv_modes & PrivMode_ShiftKeys))
782 { 782 {
783 switch (keysym) 783 switch (keysym)
784 { 784 {
785 /* normal XTerm key bindings */ 785 /* normal XTerm key bindings */
786 case XK_Insert: /* Shift+Insert = paste mouse selection */ 786 case XK_Insert: /* Shift+Insert = paste mouse selection */
4038 4038
4039 want_refresh = 1; 4039 want_refresh = 1;
4040} 4040}
4041/*}}} */ 4041/*}}} */
4042 4042
4043/* ------------------------------------------------------------------------- */ 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 */
4044 4047
4045/* 4048/*
4046 * Send printf () formatted output to the command. 4049 * Send printf () formatted output to the command.
4047 * Only use for small amounts of data. 4050 * Only use for small amounts of data.
4048 */ 4051 */
4060 4063
4061/* Write data to the pty as typed by the user. */ 4064/* Write data to the pty as typed by the user. */
4062void 4065void
4063rxvt_term::tt_write_user_input (const char *data, unsigned int len) 4066rxvt_term::tt_write_user_input (const char *data, unsigned int len)
4064{ 4067{
4068 if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END)))
4069 return;
4070
4065 if (option (Opt_scrollTtyKeypress)) 4071 if (option (Opt_scrollTtyKeypress))
4066 if (view_start) 4072 if (view_start)
4067 { 4073 {
4068 view_start = 0; 4074 view_start = 0;
4069 want_refresh = 1; 4075 want_refresh = 1;
4070 } 4076 }
4071 4077
4072 tt_write (data, len); 4078 tt_write_ (data, len);
4073} 4079}
4074
4075/* ---------------------------------------------------------------------- */
4076/* Write data to the pty as typed by the user, pasted with the mouse,
4077 * or generated by us in response to a query ESC sequence.
4078 */
4079static const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT
4080 4080
4081void 4081void
4082rxvt_term::tt_write (const char *data, unsigned int len) 4082rxvt_term::tt_write (const char *data, unsigned int len)
4083{ 4083{
4084 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)))
4085 return; 4085 return;
4086 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{
4087 if (pty->pty < 0) 4095 if (pty->pty < 0)
4088 return; 4096 return;
4089 4097
4090 if (v_buflen == 0) 4098 if (v_buflen == 0)
4091 { 4099 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines