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.278 by root, Fri Jan 20 18:50:49 2006 UTC vs.
Revision 1.284 by root, Wed Jan 25 02:42:06 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)
1278 tt_printf ("\033[M%c%c%c", 1265 tt_printf ("\033[M%c%c%c",
1279 (32 + button_number + key_state), 1266 (32 + button_number + key_state),
1280 (32 + x + 1), 1267 (32 + x + 1),
1281 (32 + y + 1)); 1268 (32 + y + 1));
1282} 1269}
1283
1284#ifdef USING_W11LIB
1285void
1286rxvt_W11_process_x_event (XEvent *ev)
1287{
1288 rxvt_t *r = rxvt_get_r ();
1289
1290 x_cb (*ev);
1291}
1292#endif
1293 1270
1294/*{{{ process an X event */ 1271/*{{{ process an X event */
1295void 1272void
1296rxvt_term::x_cb (XEvent &ev) 1273rxvt_term::x_cb (XEvent &ev)
1297{ 1274{
1823 /* 1800 /*
1824 * VT window processing of button press 1801 * VT window processing of button press
1825 */ 1802 */
1826 if (ev.window == vt) 1803 if (ev.window == vt)
1827 { 1804 {
1805 if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1806 return;
1807
1828#if ISO_14755 1808#if ISO_14755
1829 // 5.4 1809 // 5.4
1830 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 1810 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
1831 { 1811 {
1832 iso14755_54 (ev.x, ev.y); 1812 iso14755_54 (ev.x, ev.y);
1874 else 1854 else
1875 { 1855 {
1876 if (ev.button != MEvent.button) 1856 if (ev.button != MEvent.button)
1877 MEvent.clicks = 0; 1857 MEvent.clicks = 0;
1878 1858
1879 if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1880 switch (ev.button) 1859 switch (ev.button)
1881 { 1860 {
1882 case Button1: 1861 case Button1:
1883 /* allow meta + click to select rectangular areas */ 1862 /* allow meta + click to select rectangular areas */
1884 /* should be done in screen.C */ 1863 /* should be done in screen.C */
1885#if ENABLE_FRILLS 1864#if ENABLE_FRILLS
1886 selection.rect = !!(ev.state & ModMetaMask); 1865 selection.rect = !!(ev.state & ModMetaMask);
1887#else 1866#else
1888 selection.rect = false; 1867 selection.rect = false;
1889#endif 1868#endif
1890 1869
1891 /* allow shift+left click to extend selection */ 1870 /* allow shift+left click to extend selection */
1892 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) 1871 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report))
1893 { 1872 {
1894 if (MEvent.button == Button1 && clickintime) 1873 if (MEvent.button == Button1 && clickintime)
1895 selection_rotate (ev.x, ev.y); 1874 selection_rotate (ev.x, ev.y);
1896 else 1875 else
1897 selection_extend (ev.x, ev.y, 1); 1876 selection_extend (ev.x, ev.y, 1);
1898 } 1877 }
1899 else 1878 else
1900 { 1879 {
1901 if (MEvent.button == Button1 && clickintime) 1880 if (MEvent.button == Button1 && clickintime)
1902 MEvent.clicks++; 1881 MEvent.clicks++;
1903 else 1882 else
1904 MEvent.clicks = 1; 1883 MEvent.clicks = 1;
1905 1884
1906 selection_click (MEvent.clicks, ev.x, ev.y); 1885 selection_click (MEvent.clicks, ev.x, ev.y);
1907 } 1886 }
1908 1887
1909 MEvent.button = Button1; 1888 MEvent.button = Button1;
1910 break; 1889 break;
1911 1890
1912 case Button3: 1891 case Button3:
1913 if (MEvent.button == Button3 && clickintime) 1892 if (MEvent.button == Button3 && clickintime)
1914 selection_rotate (ev.x, ev.y); 1893 selection_rotate (ev.x, ev.y);
1915 else 1894 else
1916 selection_extend (ev.x, ev.y, 1); 1895 selection_extend (ev.x, ev.y, 1);
1917 1896
1918 MEvent.button = Button3; 1897 MEvent.button = Button3;
1919 break; 1898 break;
1920 } 1899 }
1921 } 1900 }
1922 1901
1923 MEvent.time = ev.time; 1902 MEvent.time = ev.time;
1924 return; 1903 return;
1925 } 1904 }
1926 1905
2089 sel_scroll_ev.stop(); 2068 sel_scroll_ev.stop();
2090#endif 2069#endif
2091 2070
2092 if (ev.window == vt) 2071 if (ev.window == vt)
2093 { 2072 {
2073 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2074 return;
2075
2094#if ISO_14755 2076#if ISO_14755
2095 // 5.4 2077 // 5.4
2096 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 2078 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
2097 return; 2079 return;
2098#endif 2080#endif
2081
2099 if (reportmode) 2082 if (reportmode)
2100 { 2083 {
2101 /* mouse report from vt window */ 2084 /* mouse report from vt window */
2102 /* don't report release of wheel "buttons" */ 2085 /* don't report release of wheel "buttons" */
2103 if (ev.button >= 4) 2086 if (ev.button >= 4)
2127 if (priv_modes & PrivMode_mouse_report 2110 if (priv_modes & PrivMode_mouse_report
2128 && bypass_keystate 2111 && bypass_keystate
2129 && ev.button == Button1 && MEvent.clicks <= 1) 2112 && ev.button == Button1 && MEvent.clicks <= 1)
2130 selection_extend (ev.x, ev.y, 0); 2113 selection_extend (ev.x, ev.y, 0);
2131 2114
2132 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2133 return;
2134
2135 switch (ev.button) 2115 switch (ev.button)
2136 { 2116 {
2137 case Button1: 2117 case Button1:
2138 case Button3: 2118 case Button3:
2139 selection_make (ev.time); 2119 selection_make (ev.time);
2140 break; 2120 break;
2141 2121
2142 case Button2: 2122 case Button2:
2143 if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? 2123 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); 2124 selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary);
2145 break; 2125 break;
2146 2126
2147#ifdef MOUSE_WHEEL 2127#ifdef MOUSE_WHEEL
2148 case Button4: 2128 case Button4:
2149 case Button5: 2129 case Button5:
2629 am_transparent = 0; 2609 am_transparent = 0;
2630 /* XXX: also turn off Opt_transparent? */ 2610 /* XXX: also turn off Opt_transparent? */
2631 } 2611 }
2632 else 2612 else
2633 { 2613 {
2634#if WAIT_FOR_WM
2635 /* wait (an arbitrary period) for the WM to do its thing
2636 * needed for fvwm2.2.2 (and before?) */
2637 sleep (1);
2638#endif
2639 for (n = 0; n < (unsigned int)i; n++) 2614 for (n = 0; n < (unsigned int)i; n++)
2640 { 2615 {
2641 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); 2616 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative);
2642 XClearWindow (disp, parent[n]); 2617 XClearWindow (disp, parent[n]);
2643 } 2618 }
3294 ndef = get_byte_array_bit (csi_defaults, i); 3269 ndef = get_byte_array_bit (csi_defaults, i);
3295 for (p = 0; p < nargs; p++) 3270 for (p = 0; p < nargs; p++)
3296 if (arg[p] == -1) 3271 if (arg[p] == -1)
3297 arg[p] = ndef; 3272 arg[p] = ndef;
3298 3273
3299#ifdef DEBUG_CMD
3300 fprintf (stderr, "CSI ");
3301 for (p = 0; p < nargs; p++)
3302 fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : "");
3303 fprintf (stderr, "%c\n", ch);
3304#endif
3305
3306 /* 3274 /*
3307 * private mode handling 3275 * private mode handling
3308 */ 3276 */
3309 if (priv) 3277 if (priv)
3310 { 3278 {
3311 switch (priv) 3279 switch (priv)
3312 { 3280 {
3313 case '>': 3281 case '>':
3314 if (ch == CSI_DA) /* secondary device attributes */ 3282 if (ch == CSI_DA) /* secondary device attributes */
3283 {
3284 // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt,
3285 // 'U' for rxvt-unicode <= 7.2, and Mm85 (e.g. 7385 for 7.3) for later versions.
3286 //
3287 // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
3288 // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify
3289 // that we do not support xterm mouse reporting (should be 95 when we do).
3290 //
3315 tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); 3291 tt_printf ("\033[>%c%c85;94;0c", VERSION[0], VERSION[1]);
3292 }
3316 break; 3293 break;
3317 case '?': 3294 case '?':
3318 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 3295 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
3319 process_terminal_mode (ch, priv, nargs, arg); 3296 process_terminal_mode (ch, priv, nargs, arg);
3320 break; 3297 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines