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.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)
1401 case ButtonRelease: 1388 case ButtonRelease:
1402 button_release (ev.xbutton); 1389 button_release (ev.xbutton);
1403 break; 1390 break;
1404 1391
1405 case ClientMessage: 1392 case ClientMessage:
1406 if (ev.xclient.format == 32) 1393 if (ev.xclient.format == 32
1394 && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END)))
1407 { 1395 {
1408 if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) 1396 if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS])
1409 { 1397 {
1410 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) 1398 if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END)))
1411 { 1399 {
1400 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW])
1401 {
1412 if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, ev, DT_END))) 1402 if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END)))
1413 destroy (); 1403 destroy ();
1404 }
1405#if ENABLE_EWMH
1406 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING])
1407 XSendEvent (disp, ev.xclient.window = display->root,
1408 False, SubstructureRedirectMask | SubstructureNotifyMask,
1409 &ev);
1410#endif
1414 } 1411 }
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 } 1412 }
1422#if ENABLE_XEMBED 1413#if ENABLE_XEMBED
1423 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) 1414 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED])
1424 { 1415 {
1425 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) 1416 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
1488#endif 1479#endif
1489 } 1480 }
1490 break; 1481 break;
1491 1482
1492 case PropertyNotify: 1483 case PropertyNotify:
1484 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END)))
1493 if (ev.xproperty.atom == xa[XA_VT_SELECTION] 1485 if (ev.xproperty.atom == xa[XA_VT_SELECTION]
1494 && ev.xproperty.state == PropertyNewValue) 1486 && ev.xproperty.state == PropertyNewValue)
1495 selection_property (ev.xproperty.window, ev.xproperty.atom); 1487 selection_property (ev.xproperty.window, ev.xproperty.atom);
1496 1488
1497 break; 1489 break;
1498 1490
1499 case SelectionClear: 1491 case SelectionClear:
1500 selection_clear (); 1492 selection_clear ();
1818 /* 1810 /*
1819 * VT window processing of button press 1811 * VT window processing of button press
1820 */ 1812 */
1821 if (ev.window == vt) 1813 if (ev.window == vt)
1822 { 1814 {
1815 if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1816 return;
1817
1823#if ISO_14755 1818#if ISO_14755
1824 // 5.4 1819 // 5.4
1825 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 1820 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
1826 { 1821 {
1827 iso14755_54 (ev.x, ev.y); 1822 iso14755_54 (ev.x, ev.y);
1869 else 1864 else
1870 { 1865 {
1871 if (ev.button != MEvent.button) 1866 if (ev.button != MEvent.button)
1872 MEvent.clicks = 0; 1867 MEvent.clicks = 0;
1873 1868
1874 if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1875 switch (ev.button) 1869 switch (ev.button)
1876 { 1870 {
1877 case Button1: 1871 case Button1:
1878 /* allow meta + click to select rectangular areas */ 1872 /* allow meta + click to select rectangular areas */
1879 /* should be done in screen.C */ 1873 /* should be done in screen.C */
1880#if ENABLE_FRILLS 1874#if ENABLE_FRILLS
1881 selection.rect = !!(ev.state & ModMetaMask); 1875 selection.rect = !!(ev.state & ModMetaMask);
1882#else 1876#else
1883 selection.rect = false; 1877 selection.rect = false;
1884#endif 1878#endif
1885 1879
1886 /* allow shift+left click to extend selection */ 1880 /* allow shift+left click to extend selection */
1887 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) 1881 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report))
1888 { 1882 {
1889 if (MEvent.button == Button1 && clickintime) 1883 if (MEvent.button == Button1 && clickintime)
1890 selection_rotate (ev.x, ev.y); 1884 selection_rotate (ev.x, ev.y);
1891 else 1885 else
1892 selection_extend (ev.x, ev.y, 1); 1886 selection_extend (ev.x, ev.y, 1);
1893 } 1887 }
1894 else 1888 else
1895 { 1889 {
1896 if (MEvent.button == Button1 && clickintime) 1890 if (MEvent.button == Button1 && clickintime)
1897 MEvent.clicks++; 1891 MEvent.clicks++;
1898 else 1892 else
1899 MEvent.clicks = 1; 1893 MEvent.clicks = 1;
1900 1894
1901 selection_click (MEvent.clicks, ev.x, ev.y); 1895 selection_click (MEvent.clicks, ev.x, ev.y);
1902 } 1896 }
1903 1897
1904 MEvent.button = Button1; 1898 MEvent.button = Button1;
1905 break; 1899 break;
1906 1900
1907 case Button3: 1901 case Button3:
1908 if (MEvent.button == Button3 && clickintime) 1902 if (MEvent.button == Button3 && clickintime)
1909 selection_rotate (ev.x, ev.y); 1903 selection_rotate (ev.x, ev.y);
1910 else 1904 else
1911 selection_extend (ev.x, ev.y, 1); 1905 selection_extend (ev.x, ev.y, 1);
1912 1906
1913 MEvent.button = Button3; 1907 MEvent.button = Button3;
1914 break; 1908 break;
1915 } 1909 }
1916 } 1910 }
1917 1911
1918 MEvent.time = ev.time; 1912 MEvent.time = ev.time;
1919 return; 1913 return;
1920 } 1914 }
1921 1915
2084 sel_scroll_ev.stop(); 2078 sel_scroll_ev.stop();
2085#endif 2079#endif
2086 2080
2087 if (ev.window == vt) 2081 if (ev.window == vt)
2088 { 2082 {
2083 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2084 return;
2085
2089#if ISO_14755 2086#if ISO_14755
2090 // 5.4 2087 // 5.4
2091 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 2088 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
2092 return; 2089 return;
2093#endif 2090#endif
2091
2094 if (reportmode) 2092 if (reportmode)
2095 { 2093 {
2096 /* mouse report from vt window */ 2094 /* mouse report from vt window */
2097 /* don't report release of wheel "buttons" */ 2095 /* don't report release of wheel "buttons" */
2098 if (ev.button >= 4) 2096 if (ev.button >= 4)
2122 if (priv_modes & PrivMode_mouse_report 2120 if (priv_modes & PrivMode_mouse_report
2123 && bypass_keystate 2121 && bypass_keystate
2124 && ev.button == Button1 && MEvent.clicks <= 1) 2122 && ev.button == Button1 && MEvent.clicks <= 1)
2125 selection_extend (ev.x, ev.y, 0); 2123 selection_extend (ev.x, ev.y, 0);
2126 2124
2127 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2128 return;
2129
2130 switch (ev.button) 2125 switch (ev.button)
2131 { 2126 {
2132 case Button1: 2127 case Button1:
2133 case Button3: 2128 case Button3:
2134 selection_make (ev.time); 2129 selection_make (ev.time);
2135 break; 2130 break;
2136 2131
2137 case Button2: 2132 case Button2:
2138 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?
2139 selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); 2134 selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary);
2140 break; 2135 break;
2141 2136
2142#ifdef MOUSE_WHEEL 2137#ifdef MOUSE_WHEEL
2143 case Button4: 2138 case Button4:
2144 case Button5: 2139 case Button5:
2624 am_transparent = 0; 2619 am_transparent = 0;
2625 /* XXX: also turn off Opt_transparent? */ 2620 /* XXX: also turn off Opt_transparent? */
2626 } 2621 }
2627 else 2622 else
2628 { 2623 {
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++) 2624 for (n = 0; n < (unsigned int)i; n++)
2635 { 2625 {
2636 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); 2626 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative);
2637 XClearWindow (disp, parent[n]); 2627 XClearWindow (disp, parent[n]);
2638 } 2628 }
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