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.279 by root, Sat Jan 21 14:25:05 2006 UTC vs.
Revision 1.283 by root, Tue Jan 24 19:40:12 2006 UTC

299rxvt_term::lookup_key (XKeyEvent &ev) 299rxvt_term::lookup_key (XKeyEvent &ev)
300{ 300{
301 int ctrl, meta, shft, len; 301 int ctrl, meta, shft, len;
302 unsigned int newlen; 302 unsigned int newlen;
303 KeySym keysym; 303 KeySym keysym;
304#ifdef DEBUG_CMD
305 static int debug_key = 1; /* accessible by a debugger only */
306#endif
307 int valid_keysym; 304 int valid_keysym;
308 char kbuf[KBUFSZ]; 305 char kbuf[KBUFSZ];
309 306
310 /* 307 /*
311 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an 308 * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an
902 { 899 {
903 const char ch = C0_ESC; 900 const char ch = C0_ESC;
904 tt_write (&ch, 1); 901 tt_write (&ch, 1);
905 } 902 }
906 903
907#if defined(DEBUG_CMD)
908 /* Display keyboard buffer contents */
909 unsigned char *p;
910 int i;
911
912 fprintf (stderr, "key 0x%04X [%d]: `", (unsigned int)keysym, len);
913 for (i = 0, p = kbuf; i < len; i++, p++)
914 fprintf (stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p);
915 fprintf (stderr, "'\n");
916#endif /* DEBUG_CMD */
917 tt_write (kbuf, (unsigned int)len); 904 tt_write (kbuf, (unsigned int)len);
918} 905}
919/*}}} */ 906/*}}} */
920 907
921#if defined (KEYSYM_RESOURCE) 908#if defined (KEYSYM_RESOURCE)
1823 /* 1810 /*
1824 * VT window processing of button press 1811 * VT window processing of button press
1825 */ 1812 */
1826 if (ev.window == vt) 1813 if (ev.window == vt)
1827 { 1814 {
1815 if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1816 return;
1817
1828#if ISO_14755 1818#if ISO_14755
1829 // 5.4 1819 // 5.4
1830 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 1820 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
1831 { 1821 {
1832 iso14755_54 (ev.x, ev.y); 1822 iso14755_54 (ev.x, ev.y);
1874 else 1864 else
1875 { 1865 {
1876 if (ev.button != MEvent.button) 1866 if (ev.button != MEvent.button)
1877 MEvent.clicks = 0; 1867 MEvent.clicks = 0;
1878 1868
1879 if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1880 switch (ev.button) 1869 switch (ev.button)
1881 { 1870 {
1882 case Button1: 1871 case Button1:
1883 /* allow meta + click to select rectangular areas */ 1872 /* allow meta + click to select rectangular areas */
1884 /* should be done in screen.C */ 1873 /* should be done in screen.C */
1885#if ENABLE_FRILLS 1874#if ENABLE_FRILLS
1886 selection.rect = !!(ev.state & ModMetaMask); 1875 selection.rect = !!(ev.state & ModMetaMask);
1887#else 1876#else
1888 selection.rect = false; 1877 selection.rect = false;
1889#endif 1878#endif
1890 1879
1891 /* allow shift+left click to extend selection */ 1880 /* allow shift+left click to extend selection */
1892 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) 1881 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report))
1893 { 1882 {
1894 if (MEvent.button == Button1 && clickintime) 1883 if (MEvent.button == Button1 && clickintime)
1895 selection_rotate (ev.x, ev.y); 1884 selection_rotate (ev.x, ev.y);
1896 else 1885 else
1897 selection_extend (ev.x, ev.y, 1); 1886 selection_extend (ev.x, ev.y, 1);
1898 } 1887 }
1899 else 1888 else
1900 { 1889 {
1901 if (MEvent.button == Button1 && clickintime) 1890 if (MEvent.button == Button1 && clickintime)
1902 MEvent.clicks++; 1891 MEvent.clicks++;
1903 else 1892 else
1904 MEvent.clicks = 1; 1893 MEvent.clicks = 1;
1905 1894
1906 selection_click (MEvent.clicks, ev.x, ev.y); 1895 selection_click (MEvent.clicks, ev.x, ev.y);
1907 } 1896 }
1908 1897
1909 MEvent.button = Button1; 1898 MEvent.button = Button1;
1910 break; 1899 break;
1911 1900
1912 case Button3: 1901 case Button3:
1913 if (MEvent.button == Button3 && clickintime) 1902 if (MEvent.button == Button3 && clickintime)
1914 selection_rotate (ev.x, ev.y); 1903 selection_rotate (ev.x, ev.y);
1915 else 1904 else
1916 selection_extend (ev.x, ev.y, 1); 1905 selection_extend (ev.x, ev.y, 1);
1917 1906
1918 MEvent.button = Button3; 1907 MEvent.button = Button3;
1919 break; 1908 break;
1920 } 1909 }
1921 } 1910 }
1922 1911
1923 MEvent.time = ev.time; 1912 MEvent.time = ev.time;
1924 return; 1913 return;
1925 } 1914 }
1926 1915
2089 sel_scroll_ev.stop(); 2078 sel_scroll_ev.stop();
2090#endif 2079#endif
2091 2080
2092 if (ev.window == vt) 2081 if (ev.window == vt)
2093 { 2082 {
2083 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2084 return;
2085
2094#if ISO_14755 2086#if ISO_14755
2095 // 5.4 2087 // 5.4
2096 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 2088 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
2097 return; 2089 return;
2098#endif 2090#endif
2091
2099 if (reportmode) 2092 if (reportmode)
2100 { 2093 {
2101 /* mouse report from vt window */ 2094 /* mouse report from vt window */
2102 /* don't report release of wheel "buttons" */ 2095 /* don't report release of wheel "buttons" */
2103 if (ev.button >= 4) 2096 if (ev.button >= 4)
2127 if (priv_modes & PrivMode_mouse_report 2120 if (priv_modes & PrivMode_mouse_report
2128 && bypass_keystate 2121 && bypass_keystate
2129 && ev.button == Button1 && MEvent.clicks <= 1) 2122 && ev.button == Button1 && MEvent.clicks <= 1)
2130 selection_extend (ev.x, ev.y, 0); 2123 selection_extend (ev.x, ev.y, 0);
2131 2124
2132 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2133 return;
2134
2135 switch (ev.button) 2125 switch (ev.button)
2136 { 2126 {
2137 case Button1: 2127 case Button1:
2138 case Button3: 2128 case Button3:
2139 selection_make (ev.time); 2129 selection_make (ev.time);
2140 break; 2130 break;
2141 2131
2142 case Button2: 2132 case Button2:
2143 if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? 2133 if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window?
2144 selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); 2134 selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary);
2145 break; 2135 break;
2146 2136
2147#ifdef MOUSE_WHEEL 2137#ifdef MOUSE_WHEEL
2148 case Button4: 2138 case Button4:
2149 case Button5: 2139 case Button5:
3289 ndef = get_byte_array_bit (csi_defaults, i); 3279 ndef = get_byte_array_bit (csi_defaults, i);
3290 for (p = 0; p < nargs; p++) 3280 for (p = 0; p < nargs; p++)
3291 if (arg[p] == -1) 3281 if (arg[p] == -1)
3292 arg[p] = ndef; 3282 arg[p] = ndef;
3293 3283
3294#ifdef DEBUG_CMD
3295 fprintf (stderr, "CSI ");
3296 for (p = 0; p < nargs; p++)
3297 fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : "");
3298 fprintf (stderr, "%c\n", ch);
3299#endif
3300
3301 /* 3284 /*
3302 * private mode handling 3285 * private mode handling
3303 */ 3286 */
3304 if (priv) 3287 if (priv)
3305 { 3288 {
3306 switch (priv) 3289 switch (priv)
3307 { 3290 {
3308 case '>': 3291 case '>':
3309 if (ch == CSI_DA) /* secondary device attributes */ 3292 if (ch == CSI_DA) /* secondary device attributes */
3293 {
3294 // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt,
3295 // 'U' for rxvt-unicode <= 7.2, and Mm85 (e.g. 7385 for 7.3) for later versions.
3296 //
3297 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
3298 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify
3299 // that we do not support xterm mouse reporting (should be 95 when we do).
3300 //
3310 tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); 3301 tt_printf ("\033[>%c%c85;94;0c", VERSION[0], VERSION[1]);
3302 }
3311 break; 3303 break;
3312 case '?': 3304 case '?':
3313 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 3305 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
3314 process_terminal_mode (ch, priv, nargs, arg); 3306 process_terminal_mode (ch, priv, nargs, arg);
3315 break; 3307 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines