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.274 by root, Fri Jan 20 10:27:08 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
461 { 458 {
462 switch (keysym) 459 switch (keysym)
463 { 460 {
464 /* normal XTerm key bindings */ 461 /* normal XTerm key bindings */
465 case XK_Insert: /* Shift+Insert = paste mouse selection */ 462 case XK_Insert: /* Shift+Insert = paste mouse selection */
466 selection_request (ev.time, Sel_Primary); 463 selection_request (ev.time);
467 return; 464 return;
468#if TODO 465#if TODO
469 /* rxvt extras */ 466 /* rxvt extras */
470 case XK_KP_Add: /* Shift+KP_Add = bigger font */ 467 case XK_KP_Add: /* Shift+KP_Add = bigger font */
471 change_font (FONT_UP); 468 change_font (FONT_UP);
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)
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
1407 && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) 1394 && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END)))
1408 { 1395 {
1396 if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS])
1397 {
1398 if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END)))
1399 {
1409 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) 1400 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW])
1401 {
1402 if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END)))
1410 destroy (); 1403 destroy ();
1404 }
1411#if ENABLE_EWMH 1405#if ENABLE_EWMH
1412 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) 1406 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING])
1413 XSendEvent (disp, ev.xclient.window = display->root, 1407 XSendEvent (disp, ev.xclient.window = display->root,
1414 False, SubstructureRedirectMask | SubstructureNotifyMask, 1408 False, SubstructureRedirectMask | SubstructureNotifyMask,
1415 &ev); 1409 &ev);
1410#endif
1411 }
1412 }
1413#if ENABLE_XEMBED
1414 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED])
1415 {
1416 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
1417 focus_in ();
1418 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1419 focus_out ();
1420 }
1416#endif 1421#endif
1417 } 1422 }
1418#if ENABLE_XEMBED
1419 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED])
1420 {
1421 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
1422 focus_in ();
1423 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1424 focus_out ();
1425 }
1426#endif
1427#ifdef OFFIX_DND
1428 /* OffiX Dnd (drag 'n' drop) protocol */
1429 else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL]
1430 && (ev.xclient.data.l[0] == DndFile
1431 || ev.xclient.data.l[0] == DndDir
1432 || ev.xclient.data.l[0] == DndLink))
1433 {
1434 /* Get Dnd data */
1435 Atom ActualType;
1436 int ActualFormat;
1437 unsigned char *data;
1438 unsigned long Size, RemainingBytes;
1439
1440 XGetWindowProperty (disp, display->root,
1441 xa[XA_DNDSELECTION],
1442 0L, 1000000L,
1443 False, AnyPropertyType,
1444 &ActualType, &ActualFormat,
1445 &Size, &RemainingBytes,
1446 &data);
1447 set_string_property (XA_CUT_BUFFER0, data);
1448 XFree (data);
1449 selection_paste (display->root, XA_CUT_BUFFER0, true);
1450 XSetInputFocus (disp, display->root, RevertToNone, CurrentTime);
1451 }
1452#endif /* OFFIX_DND */
1453 break; 1423 break;
1454 1424
1455 case MappingNotify: 1425 case MappingNotify:
1456 XRefreshKeyboardMapping (&ev.xmapping); 1426 XRefreshKeyboardMapping (&ev.xmapping);
1457 break; 1427 break;
1509#endif 1479#endif
1510 } 1480 }
1511 break; 1481 break;
1512 1482
1513 case PropertyNotify: 1483 case PropertyNotify:
1484 if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END)))
1514 if (ev.xproperty.atom == xa[XA_VT_SELECTION] 1485 if (ev.xproperty.atom == xa[XA_VT_SELECTION]
1515 && ev.xproperty.state == PropertyNewValue) 1486 && ev.xproperty.state == PropertyNewValue)
1516 selection_property (ev.xproperty.window, ev.xproperty.atom); 1487 selection_property (ev.xproperty.window, ev.xproperty.atom);
1517 1488
1518 break; 1489 break;
1519 1490
1520 case SelectionClear: 1491 case SelectionClear:
1521 selection_clear (); 1492 selection_clear ();
1839 /* 1810 /*
1840 * VT window processing of button press 1811 * VT window processing of button press
1841 */ 1812 */
1842 if (ev.window == vt) 1813 if (ev.window == vt)
1843 { 1814 {
1815 if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1816 return;
1817
1844#if ISO_14755 1818#if ISO_14755
1845 // 5.4 1819 // 5.4
1846 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 1820 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
1847 { 1821 {
1848 iso14755_54 (ev.x, ev.y); 1822 iso14755_54 (ev.x, ev.y);
1890 else 1864 else
1891 { 1865 {
1892 if (ev.button != MEvent.button) 1866 if (ev.button != MEvent.button)
1893 MEvent.clicks = 0; 1867 MEvent.clicks = 0;
1894 1868
1895 if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END)))
1896 switch (ev.button) 1869 switch (ev.button)
1897 { 1870 {
1898 case Button1: 1871 case Button1:
1899 /* allow meta + click to select rectangular areas */ 1872 /* allow meta + click to select rectangular areas */
1900 /* should be done in screen.C */ 1873 /* should be done in screen.C */
1901#if ENABLE_FRILLS 1874#if ENABLE_FRILLS
1902 selection.rect = !!(ev.state & ModMetaMask); 1875 selection.rect = !!(ev.state & ModMetaMask);
1903#else 1876#else
1904 selection.rect = false; 1877 selection.rect = false;
1905#endif 1878#endif
1906 1879
1907 /* allow shift+left click to extend selection */ 1880 /* allow shift+left click to extend selection */
1908 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) 1881 if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report))
1909 { 1882 {
1910 if (MEvent.button == Button1 && clickintime) 1883 if (MEvent.button == Button1 && clickintime)
1911 selection_rotate (ev.x, ev.y); 1884 selection_rotate (ev.x, ev.y);
1912 else 1885 else
1913 selection_extend (ev.x, ev.y, 1); 1886 selection_extend (ev.x, ev.y, 1);
1914 } 1887 }
1915 else 1888 else
1916 { 1889 {
1917 if (MEvent.button == Button1 && clickintime) 1890 if (MEvent.button == Button1 && clickintime)
1918 MEvent.clicks++; 1891 MEvent.clicks++;
1919 else 1892 else
1920 MEvent.clicks = 1; 1893 MEvent.clicks = 1;
1921 1894
1922 selection_click (MEvent.clicks, ev.x, ev.y); 1895 selection_click (MEvent.clicks, ev.x, ev.y);
1923 } 1896 }
1924 1897
1925 MEvent.button = Button1; 1898 MEvent.button = Button1;
1926 break; 1899 break;
1927 1900
1928 case Button3: 1901 case Button3:
1929 if (MEvent.button == Button3 && clickintime) 1902 if (MEvent.button == Button3 && clickintime)
1930 selection_rotate (ev.x, ev.y); 1903 selection_rotate (ev.x, ev.y);
1931 else 1904 else
1932 selection_extend (ev.x, ev.y, 1); 1905 selection_extend (ev.x, ev.y, 1);
1933 1906
1934 MEvent.button = Button3; 1907 MEvent.button = Button3;
1935 break; 1908 break;
1936 } 1909 }
1937 } 1910 }
1938 1911
1939 MEvent.time = ev.time; 1912 MEvent.time = ev.time;
1940 return; 1913 return;
1941 } 1914 }
1942 1915
2105 sel_scroll_ev.stop(); 2078 sel_scroll_ev.stop();
2106#endif 2079#endif
2107 2080
2108 if (ev.window == vt) 2081 if (ev.window == vt)
2109 { 2082 {
2083 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2084 return;
2085
2110#if ISO_14755 2086#if ISO_14755
2111 // 5.4 2087 // 5.4
2112 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) 2088 if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54))
2113 return; 2089 return;
2114#endif 2090#endif
2091
2115 if (reportmode) 2092 if (reportmode)
2116 { 2093 {
2117 /* mouse report from vt window */ 2094 /* mouse report from vt window */
2118 /* don't report release of wheel "buttons" */ 2095 /* don't report release of wheel "buttons" */
2119 if (ev.button >= 4) 2096 if (ev.button >= 4)
2143 if (priv_modes & PrivMode_mouse_report 2120 if (priv_modes & PrivMode_mouse_report
2144 && bypass_keystate 2121 && bypass_keystate
2145 && ev.button == Button1 && MEvent.clicks <= 1) 2122 && ev.button == Button1 && MEvent.clicks <= 1)
2146 selection_extend (ev.x, ev.y, 0); 2123 selection_extend (ev.x, ev.y, 0);
2147 2124
2148 if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END)))
2149 return;
2150
2151 switch (ev.button) 2125 switch (ev.button)
2152 { 2126 {
2153 case Button1: 2127 case Button1:
2154 case Button3: 2128 case Button3:
2155 selection_make (ev.time); 2129 selection_make (ev.time);
2156 break; 2130 break;
2157 2131
2158 case Button2: 2132 case Button2:
2159 if (IN_RANGE_EXC (ev.x, 0, width) 2133 if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window?
2160 && IN_RANGE_EXC (ev.y, 0, height)) // inside window? 2134 selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary);
2161 {
2162 if (ev.state & ShiftMask)
2163 selection_request (ev.time, Sel_Clipboard);
2164 else
2165 selection_request (ev.time, Sel_Primary);
2166 }
2167 break; 2135 break;
2168 2136
2169#ifdef MOUSE_WHEEL 2137#ifdef MOUSE_WHEEL
2170 case Button4: 2138 case Button4:
2171 case Button5: 2139 case Button5:
2651 am_transparent = 0; 2619 am_transparent = 0;
2652 /* XXX: also turn off Opt_transparent? */ 2620 /* XXX: also turn off Opt_transparent? */
2653 } 2621 }
2654 else 2622 else
2655 { 2623 {
2656#if WAIT_FOR_WM
2657 /* wait (an arbitrary period) for the WM to do its thing
2658 * needed for fvwm2.2.2 (and before?) */
2659 sleep (1);
2660#endif
2661 for (n = 0; n < (unsigned int)i; n++) 2624 for (n = 0; n < (unsigned int)i; n++)
2662 { 2625 {
2663 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); 2626 XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative);
2664 XClearWindow (disp, parent[n]); 2627 XClearWindow (disp, parent[n]);
2665 } 2628 }
3316 ndef = get_byte_array_bit (csi_defaults, i); 3279 ndef = get_byte_array_bit (csi_defaults, i);
3317 for (p = 0; p < nargs; p++) 3280 for (p = 0; p < nargs; p++)
3318 if (arg[p] == -1) 3281 if (arg[p] == -1)
3319 arg[p] = ndef; 3282 arg[p] = ndef;
3320 3283
3321#ifdef DEBUG_CMD
3322 fprintf (stderr, "CSI ");
3323 for (p = 0; p < nargs; p++)
3324 fprintf (stderr, "%d%s", arg[p], p < nargs - 1 ? ";" : "");
3325 fprintf (stderr, "%c\n", ch);
3326#endif
3327
3328 /* 3284 /*
3329 * private mode handling 3285 * private mode handling
3330 */ 3286 */
3331 if (priv) 3287 if (priv)
3332 { 3288 {
3333 switch (priv) 3289 switch (priv)
3334 { 3290 {
3335 case '>': 3291 case '>':
3336 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 //
3337 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 }
3338 break; 3303 break;
3339 case '?': 3304 case '?':
3340 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') 3305 if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't')
3341 process_terminal_mode (ch, priv, nargs, arg); 3306 process_terminal_mode (ch, priv, nargs, arg);
3342 break; 3307 break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines