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.277 by root, Fri Jan 20 12:16:28 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)
1492#endif 1479#endif
1493 } 1480 }
1494 break; 1481 break;
1495 1482
1496 case PropertyNotify: 1483 case PropertyNotify:
1484 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END)))
1497 if (ev.xproperty.atom == xa[XA_VT_SELECTION] 1485 if (ev.xproperty.atom == xa[XA_VT_SELECTION]
1498 && ev.xproperty.state == PropertyNewValue) 1486 && ev.xproperty.state == PropertyNewValue)
1499 selection_property (ev.xproperty.window, ev.xproperty.atom); 1487 selection_property (ev.xproperty.window, ev.xproperty.atom);
1500 1488
1501 break; 1489 break;
1502 1490
1503 case SelectionClear: 1491 case SelectionClear:
1504 selection_clear (); 1492 selection_clear ();
1822 /* 1810 /*
1823 * VT window processing of button press 1811 * VT window processing of button press
1824 */ 1812 */
1825 if (ev.window == vt) 1813 if (ev.window == vt)
1826 { 1814 {
1815 if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1816 return;
1817
1827#if ISO_14755 1818#if ISO_14755
1828 // 5.4 1819 // 5.4
1829 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 1820 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
1830 { 1821 {
1831 iso14755_54 (ev.x, ev.y); 1822 iso14755_54 (ev.x, ev.y);
1873 else 1864 else
1874 { 1865 {
1875 if (ev.button != MEvent.button) 1866 if (ev.button != MEvent.button)
1876 MEvent.clicks = 0; 1867 MEvent.clicks = 0;
1877 1868
1878 if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1879 switch (ev.button) 1869 switch (ev.button)
1880 { 1870 {
1881 case Button1: 1871 case Button1:
1882 /* allow meta + click to select rectangular areas */ 1872 /* allow meta + click to select rectangular areas */
1883 /* should be done in screen.C */ 1873 /* should be done in screen.C */
1884#if ENABLE_FRILLS 1874#if ENABLE_FRILLS
1885 selection.rect = !!(ev.state & ModMetaMask); 1875 selection.rect = !!(ev.state & ModMetaMask);
1886#else 1876#else
1887 selection.rect = false; 1877 selection.rect = false;
1888#endif 1878#endif
1889 1879
1890 /* allow shift+left click to extend selection */ 1880 /* allow shift+left click to extend selection */
1891 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) 1881 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report))
1892 { 1882 {
1893 if (MEvent.button == Button1 && clickintime) 1883 if (MEvent.button == Button1 && clickintime)
1894 selection_rotate (ev.x, ev.y); 1884 selection_rotate (ev.x, ev.y);
1895 else 1885 else
1896 selection_extend (ev.x, ev.y, 1); 1886 selection_extend (ev.x, ev.y, 1);
1897 } 1887 }
1898 else 1888 else
1899 { 1889 {
1900 if (MEvent.button == Button1 && clickintime) 1890 if (MEvent.button == Button1 && clickintime)
1901 MEvent.clicks++; 1891 MEvent.clicks++;
1902 else 1892 else
1903 MEvent.clicks = 1; 1893 MEvent.clicks = 1;
1904 1894
1905 selection_click (MEvent.clicks, ev.x, ev.y); 1895 selection_click (MEvent.clicks, ev.x, ev.y);
1906 } 1896 }
1907 1897
1908 MEvent.button = Button1; 1898 MEvent.button = Button1;
1909 break; 1899 break;
1910 1900
1911 case Button3: 1901 case Button3:
1912 if (MEvent.button == Button3 && clickintime) 1902 if (MEvent.button == Button3 && clickintime)
1913 selection_rotate (ev.x, ev.y); 1903 selection_rotate (ev.x, ev.y);
1914 else 1904 else
1915 selection_extend (ev.x, ev.y, 1); 1905 selection_extend (ev.x, ev.y, 1);
1916 1906
1917 MEvent.button = Button3; 1907 MEvent.button = Button3;
1918 break; 1908 break;
1919 } 1909 }
1920 } 1910 }
1921 1911
1922 MEvent.time = ev.time; 1912 MEvent.time = ev.time;
1923 return; 1913 return;
1924 } 1914 }
1925 1915
2088 sel_scroll_ev.stop(); 2078 sel_scroll_ev.stop();
2089#endif 2079#endif
2090 2080
2091 if (ev.window == vt) 2081 if (ev.window == vt)
2092 { 2082 {
2083 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2084 return;
2085
2093#if ISO_14755 2086#if ISO_14755
2094 // 5.4 2087 // 5.4
2095 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 2088 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
2096 return; 2089 return;
2097#endif 2090#endif
2091
2098 if (reportmode) 2092 if (reportmode)
2099 { 2093 {
2100 /* mouse report from vt window */ 2094 /* mouse report from vt window */
2101 /* don't report release of wheel "buttons" */ 2095 /* don't report release of wheel "buttons" */
2102 if (ev.button >= 4) 2096 if (ev.button >= 4)
2126 if (priv_modes & PrivMode_mouse_report 2120 if (priv_modes & PrivMode_mouse_report
2127 && bypass_keystate 2121 && bypass_keystate
2128 && ev.button == Button1 && MEvent.clicks <= 1) 2122 && ev.button == Button1 && MEvent.clicks <= 1)
2129 selection_extend (ev.x, ev.y, 0); 2123 selection_extend (ev.x, ev.y, 0);
2130 2124
2131 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2132 return;
2133
2134 switch (ev.button) 2125 switch (ev.button)
2135 { 2126 {
2136 case Button1: 2127 case Button1:
2137 case Button3: 2128 case Button3:
2138 selection_make (ev.time); 2129 selection_make (ev.time);
2139 break; 2130 break;
2140 2131
2141 case Button2: 2132 case Button2:
2142 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?
2143 selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); 2134 selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary);
2144 break; 2135 break;
2145 2136
2146#ifdef MOUSE_WHEEL 2137#ifdef MOUSE_WHEEL
2147 case Button4: 2138 case Button4:
2148 case Button5: 2139 case Button5:
2628 am_transparent = 0; 2619 am_transparent = 0;
2629 /* XXX: also turn off Opt_transparent? */ 2620 /* XXX: also turn off Opt_transparent? */
2630 } 2621 }
2631 else 2622 else
2632 { 2623 {
2633#if WAIT_FOR_WM
2634 /* wait (an arbitrary period) for the WM to do its thing
2635 * needed for fvwm2.2.2 (and before?) */
2636 sleep (1);
2637#endif
2638 for (n = 0; n < (unsigned int)i; n++) 2624 for (n = 0; n < (unsigned int)i; n++)
2639 { 2625 {
2640 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); 2626 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative);
2641 XClearWindow (disp, parent[n]); 2627 XClearWindow (disp, parent[n]);
2642 } 2628 }
3293 ndef = get_byte_array_bit (csi_defaults, i); 3279 ndef = get_byte_array_bit (csi_defaults, i);
3294 for (p = 0; p < nargs; p++) 3280 for (p = 0; p < nargs; p++)
3295 if (arg[p] == -1) 3281 if (arg[p] == -1)
3296 arg[p] = ndef; 3282 arg[p] = ndef;
3297 3283
3298#ifdef DEBUG_CMD
3299 fprintf (stderr, "CSI ");
3300 for (p = 0; p < nargs; p++)
3301 fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : "");
3302 fprintf (stderr, "%c\n", ch);
3303#endif
3304
3305 /* 3284 /*
3306 * private mode handling 3285 * private mode handling
3307 */ 3286 */
3308 if (priv) 3287 if (priv)
3309 { 3288 {
3310 switch (priv) 3289 switch (priv)
3311 { 3290 {
3312 case '>': 3291 case '>':
3313 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 //
3314 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 }
3315 break; 3303 break;
3316 case '?': 3304 case '?':
3317 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 3305 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
3318 process_terminal_mode (ch, priv, nargs, arg); 3306 process_terminal_mode (ch, priv, nargs, arg);
3319 break; 3307 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines