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.276 by root, Fri Jan 20 11:02:46 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{
1401 case ButtonRelease: 1378 case ButtonRelease:
1402 button_release (ev.xbutton); 1379 button_release (ev.xbutton);
1403 break; 1380 break;
1404 1381
1405 case ClientMessage: 1382 case ClientMessage:
1406 if (ev.xclient.format == 32) 1383 if (ev.xclient.format == 32
1384 && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END)))
1407 { 1385 {
1408 if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) 1386 if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS])
1409 { 1387 {
1410 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) 1388 if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END)))
1411 { 1389 {
1390 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW])
1391 {
1412 if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, ev, DT_END))) 1392 if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END)))
1413 destroy (); 1393 destroy ();
1394 }
1395#if ENABLE_EWMH
1396 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING])
1397 XSendEvent (disp, ev.xclient.window = display->root,
1398 False, SubstructureRedirectMask | SubstructureNotifyMask,
1399 &ev);
1400#endif
1414 } 1401 }
1415#if ENABLE_EWMH
1416 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING])
1417 XSendEvent (disp, ev.xclient.window = display->root,
1418 False, SubstructureRedirectMask | SubstructureNotifyMask,
1419 &ev);
1420#endif
1421 } 1402 }
1422#if ENABLE_XEMBED 1403#if ENABLE_XEMBED
1423 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) 1404 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED])
1424 { 1405 {
1425 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) 1406 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
1488#endif 1469#endif
1489 } 1470 }
1490 break; 1471 break;
1491 1472
1492 case PropertyNotify: 1473 case PropertyNotify:
1474 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END)))
1493 if (ev.xproperty.atom == xa[XA_VT_SELECTION] 1475 if (ev.xproperty.atom == xa[XA_VT_SELECTION]
1494 && ev.xproperty.state == PropertyNewValue) 1476 && ev.xproperty.state == PropertyNewValue)
1495 selection_property (ev.xproperty.window, ev.xproperty.atom); 1477 selection_property (ev.xproperty.window, ev.xproperty.atom);
1496 1478
1497 break; 1479 break;
1498 1480
1499 case SelectionClear: 1481 case SelectionClear:
1500 selection_clear (); 1482 selection_clear ();
1818 /* 1800 /*
1819 * VT window processing of button press 1801 * VT window processing of button press
1820 */ 1802 */
1821 if (ev.window == vt) 1803 if (ev.window == vt)
1822 { 1804 {
1805 if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1806 return;
1807
1823#if ISO_14755 1808#if ISO_14755
1824 // 5.4 1809 // 5.4
1825 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 1810 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
1826 { 1811 {
1827 iso14755_54 (ev.x, ev.y); 1812 iso14755_54 (ev.x, ev.y);
1869 else 1854 else
1870 { 1855 {
1871 if (ev.button != MEvent.button) 1856 if (ev.button != MEvent.button)
1872 MEvent.clicks = 0; 1857 MEvent.clicks = 0;
1873 1858
1874 if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1875 switch (ev.button) 1859 switch (ev.button)
1876 { 1860 {
1877 case Button1: 1861 case Button1:
1878 /* allow meta + click to select rectangular areas */ 1862 /* allow meta + click to select rectangular areas */
1879 /* should be done in screen.C */ 1863 /* should be done in screen.C */
1880#if ENABLE_FRILLS 1864#if ENABLE_FRILLS
1881 selection.rect = !!(ev.state & ModMetaMask); 1865 selection.rect = !!(ev.state & ModMetaMask);
1882#else 1866#else
1883 selection.rect = false; 1867 selection.rect = false;
1884#endif 1868#endif
1885 1869
1886 /* allow shift+left click to extend selection */ 1870 /* allow shift+left click to extend selection */
1887 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) 1871 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report))
1888 { 1872 {
1889 if (MEvent.button == Button1 && clickintime) 1873 if (MEvent.button == Button1 && clickintime)
1890 selection_rotate (ev.x, ev.y); 1874 selection_rotate (ev.x, ev.y);
1891 else 1875 else
1892 selection_extend (ev.x, ev.y, 1); 1876 selection_extend (ev.x, ev.y, 1);
1893 } 1877 }
1894 else 1878 else
1895 { 1879 {
1896 if (MEvent.button == Button1 && clickintime) 1880 if (MEvent.button == Button1 && clickintime)
1897 MEvent.clicks++; 1881 MEvent.clicks++;
1898 else 1882 else
1899 MEvent.clicks = 1; 1883 MEvent.clicks = 1;
1900 1884
1901 selection_click (MEvent.clicks, ev.x, ev.y); 1885 selection_click (MEvent.clicks, ev.x, ev.y);
1902 } 1886 }
1903 1887
1904 MEvent.button = Button1; 1888 MEvent.button = Button1;
1905 break; 1889 break;
1906 1890
1907 case Button3: 1891 case Button3:
1908 if (MEvent.button == Button3 && clickintime) 1892 if (MEvent.button == Button3 && clickintime)
1909 selection_rotate (ev.x, ev.y); 1893 selection_rotate (ev.x, ev.y);
1910 else 1894 else
1911 selection_extend (ev.x, ev.y, 1); 1895 selection_extend (ev.x, ev.y, 1);
1912 1896
1913 MEvent.button = Button3; 1897 MEvent.button = Button3;
1914 break; 1898 break;
1915 } 1899 }
1916 } 1900 }
1917 1901
1918 MEvent.time = ev.time; 1902 MEvent.time = ev.time;
1919 return; 1903 return;
1920 } 1904 }
1921 1905
2084 sel_scroll_ev.stop(); 2068 sel_scroll_ev.stop();
2085#endif 2069#endif
2086 2070
2087 if (ev.window == vt) 2071 if (ev.window == vt)
2088 { 2072 {
2073 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2074 return;
2075
2089#if ISO_14755 2076#if ISO_14755
2090 // 5.4 2077 // 5.4
2091 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 2078 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
2092 return; 2079 return;
2093#endif 2080#endif
2081
2094 if (reportmode) 2082 if (reportmode)
2095 { 2083 {
2096 /* mouse report from vt window */ 2084 /* mouse report from vt window */
2097 /* don't report release of wheel "buttons" */ 2085 /* don't report release of wheel "buttons" */
2098 if (ev.button >= 4) 2086 if (ev.button >= 4)
2122 if (priv_modes & PrivMode_mouse_report 2110 if (priv_modes & PrivMode_mouse_report
2123 && bypass_keystate 2111 && bypass_keystate
2124 && ev.button == Button1 && MEvent.clicks <= 1) 2112 && ev.button == Button1 && MEvent.clicks <= 1)
2125 selection_extend (ev.x, ev.y, 0); 2113 selection_extend (ev.x, ev.y, 0);
2126 2114
2127 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2128 return;
2129
2130 switch (ev.button) 2115 switch (ev.button)
2131 { 2116 {
2132 case Button1: 2117 case Button1:
2133 case Button3: 2118 case Button3:
2134 selection_make (ev.time); 2119 selection_make (ev.time);
2135 break; 2120 break;
2136 2121
2137 case Button2: 2122 case Button2:
2138 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?
2139 selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); 2124 selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary);
2140 break; 2125 break;
2141 2126
2142#ifdef MOUSE_WHEEL 2127#ifdef MOUSE_WHEEL
2143 case Button4: 2128 case Button4:
2144 case Button5: 2129 case Button5:
2624 am_transparent = 0; 2609 am_transparent = 0;
2625 /* XXX: also turn off Opt_transparent? */ 2610 /* XXX: also turn off Opt_transparent? */
2626 } 2611 }
2627 else 2612 else
2628 { 2613 {
2629#if WAIT_FOR_WM
2630 /* wait (an arbitrary period) for the WM to do its thing
2631 * needed for fvwm2.2.2 (and before?) */
2632 sleep (1);
2633#endif
2634 for (n = 0; n < (unsigned int)i; n++) 2614 for (n = 0; n < (unsigned int)i; n++)
2635 { 2615 {
2636 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); 2616 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative);
2637 XClearWindow (disp, parent[n]); 2617 XClearWindow (disp, parent[n]);
2638 } 2618 }
3289 ndef = get_byte_array_bit (csi_defaults, i); 3269 ndef = get_byte_array_bit (csi_defaults, i);
3290 for (p = 0; p < nargs; p++) 3270 for (p = 0; p < nargs; p++)
3291 if (arg[p] == -1) 3271 if (arg[p] == -1)
3292 arg[p] = ndef; 3272 arg[p] = ndef;
3293 3273
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 /* 3274 /*
3302 * private mode handling 3275 * private mode handling
3303 */ 3276 */
3304 if (priv) 3277 if (priv)
3305 { 3278 {
3306 switch (priv) 3279 switch (priv)
3307 { 3280 {
3308 case '>': 3281 case '>':
3309 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 //
3310 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 }
3311 break; 3293 break;
3312 case '?': 3294 case '?':
3313 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 3295 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
3314 process_terminal_mode (ch, priv, nargs, arg); 3296 process_terminal_mode (ch, priv, nargs, arg);
3315 break; 3297 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines