… | |
… | |
1401 | case ButtonRelease: |
1401 | case ButtonRelease: |
1402 | button_release (ev.xbutton); |
1402 | button_release (ev.xbutton); |
1403 | break; |
1403 | break; |
1404 | |
1404 | |
1405 | case ClientMessage: |
1405 | case ClientMessage: |
1406 | if (ev.xclient.format == 32) |
1406 | if (ev.xclient.format == 32 |
|
|
1407 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1407 | { |
1408 | { |
1408 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1409 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1409 | { |
1410 | { |
1410 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1411 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
1411 | { |
1412 | { |
|
|
1413 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1414 | { |
1412 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, ev, DT_END))) |
1415 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1413 | destroy (); |
1416 | destroy (); |
|
|
1417 | } |
|
|
1418 | #if ENABLE_EWMH |
|
|
1419 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
|
|
1420 | XSendEvent (disp, ev.xclient.window = display->root, |
|
|
1421 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
|
|
1422 | &ev); |
|
|
1423 | #endif |
1414 | } |
1424 | } |
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 | } |
1425 | } |
1422 | #if ENABLE_XEMBED |
1426 | #if ENABLE_XEMBED |
1423 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
1427 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
1424 | { |
1428 | { |
1425 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
1429 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
… | |
… | |
1488 | #endif |
1492 | #endif |
1489 | } |
1493 | } |
1490 | break; |
1494 | break; |
1491 | |
1495 | |
1492 | case PropertyNotify: |
1496 | case PropertyNotify: |
|
|
1497 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1493 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1498 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1494 | && ev.xproperty.state == PropertyNewValue) |
1499 | && ev.xproperty.state == PropertyNewValue) |
1495 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1500 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1496 | |
1501 | |
1497 | break; |
1502 | break; |
1498 | |
1503 | |
1499 | case SelectionClear: |
1504 | case SelectionClear: |
1500 | selection_clear (); |
1505 | selection_clear (); |
… | |
… | |
1818 | /* |
1823 | /* |
1819 | * VT window processing of button press |
1824 | * VT window processing of button press |
1820 | */ |
1825 | */ |
1821 | if (ev.window == vt) |
1826 | if (ev.window == vt) |
1822 | { |
1827 | { |
|
|
1828 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1829 | return; |
|
|
1830 | |
1823 | #if ISO_14755 |
1831 | #if ISO_14755 |
1824 | // 5.4 |
1832 | // 5.4 |
1825 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1833 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1826 | { |
1834 | { |
1827 | iso14755_54 (ev.x, ev.y); |
1835 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1869 | else |
1877 | else |
1870 | { |
1878 | { |
1871 | if (ev.button != MEvent.button) |
1879 | if (ev.button != MEvent.button) |
1872 | MEvent.clicks = 0; |
1880 | MEvent.clicks = 0; |
1873 | |
1881 | |
1874 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1875 | switch (ev.button) |
1882 | switch (ev.button) |
1876 | { |
1883 | { |
1877 | case Button1: |
1884 | case Button1: |
1878 | /* allow meta + click to select rectangular areas */ |
1885 | /* allow meta + click to select rectangular areas */ |
1879 | /* should be done in screen.C */ |
1886 | /* should be done in screen.C */ |
1880 | #if ENABLE_FRILLS |
1887 | #if ENABLE_FRILLS |
1881 | selection.rect = !!(ev.state & ModMetaMask); |
1888 | selection.rect = !!(ev.state & ModMetaMask); |
1882 | #else |
1889 | #else |
1883 | selection.rect = false; |
1890 | selection.rect = false; |
1884 | #endif |
1891 | #endif |
1885 | |
1892 | |
1886 | /* allow shift+left click to extend selection */ |
1893 | /* allow shift+left click to extend selection */ |
1887 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1894 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1888 | { |
1895 | { |
1889 | if (MEvent.button == Button1 && clickintime) |
1896 | if (MEvent.button == Button1 && clickintime) |
1890 | selection_rotate (ev.x, ev.y); |
1897 | selection_rotate (ev.x, ev.y); |
1891 | else |
1898 | else |
1892 | selection_extend (ev.x, ev.y, 1); |
1899 | selection_extend (ev.x, ev.y, 1); |
1893 | } |
1900 | } |
1894 | else |
1901 | else |
1895 | { |
1902 | { |
1896 | if (MEvent.button == Button1 && clickintime) |
1903 | if (MEvent.button == Button1 && clickintime) |
1897 | MEvent.clicks++; |
1904 | MEvent.clicks++; |
1898 | else |
1905 | else |
1899 | MEvent.clicks = 1; |
1906 | MEvent.clicks = 1; |
1900 | |
1907 | |
1901 | selection_click (MEvent.clicks, ev.x, ev.y); |
1908 | selection_click (MEvent.clicks, ev.x, ev.y); |
1902 | } |
1909 | } |
1903 | |
1910 | |
1904 | MEvent.button = Button1; |
1911 | MEvent.button = Button1; |
1905 | break; |
1912 | break; |
1906 | |
1913 | |
1907 | case Button3: |
1914 | case Button3: |
1908 | if (MEvent.button == Button3 && clickintime) |
1915 | if (MEvent.button == Button3 && clickintime) |
1909 | selection_rotate (ev.x, ev.y); |
1916 | selection_rotate (ev.x, ev.y); |
1910 | else |
1917 | else |
1911 | selection_extend (ev.x, ev.y, 1); |
1918 | selection_extend (ev.x, ev.y, 1); |
1912 | |
1919 | |
1913 | MEvent.button = Button3; |
1920 | MEvent.button = Button3; |
1914 | break; |
1921 | break; |
1915 | } |
1922 | } |
1916 | } |
1923 | } |
1917 | |
1924 | |
1918 | MEvent.time = ev.time; |
1925 | MEvent.time = ev.time; |
1919 | return; |
1926 | return; |
1920 | } |
1927 | } |
1921 | |
1928 | |
… | |
… | |
2084 | sel_scroll_ev.stop(); |
2091 | sel_scroll_ev.stop(); |
2085 | #endif |
2092 | #endif |
2086 | |
2093 | |
2087 | if (ev.window == vt) |
2094 | if (ev.window == vt) |
2088 | { |
2095 | { |
|
|
2096 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2097 | return; |
|
|
2098 | |
2089 | #if ISO_14755 |
2099 | #if ISO_14755 |
2090 | // 5.4 |
2100 | // 5.4 |
2091 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2101 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2092 | return; |
2102 | return; |
2093 | #endif |
2103 | #endif |
|
|
2104 | |
2094 | if (reportmode) |
2105 | if (reportmode) |
2095 | { |
2106 | { |
2096 | /* mouse report from vt window */ |
2107 | /* mouse report from vt window */ |
2097 | /* don't report release of wheel "buttons" */ |
2108 | /* don't report release of wheel "buttons" */ |
2098 | if (ev.button >= 4) |
2109 | if (ev.button >= 4) |
… | |
… | |
2122 | if (priv_modes & PrivMode_mouse_report |
2133 | if (priv_modes & PrivMode_mouse_report |
2123 | && bypass_keystate |
2134 | && bypass_keystate |
2124 | && ev.button == Button1 && MEvent.clicks <= 1) |
2135 | && ev.button == Button1 && MEvent.clicks <= 1) |
2125 | selection_extend (ev.x, ev.y, 0); |
2136 | selection_extend (ev.x, ev.y, 0); |
2126 | |
2137 | |
2127 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2128 | return; |
|
|
2129 | |
|
|
2130 | switch (ev.button) |
2138 | switch (ev.button) |
2131 | { |
2139 | { |
2132 | case Button1: |
2140 | case Button1: |
2133 | case Button3: |
2141 | case Button3: |
2134 | selection_make (ev.time); |
2142 | selection_make (ev.time); |
2135 | break; |
2143 | break; |
2136 | |
2144 | |
2137 | case Button2: |
2145 | case Button2: |
2138 | if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? |
2146 | 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); |
2147 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2140 | break; |
2148 | break; |
2141 | |
2149 | |
2142 | #ifdef MOUSE_WHEEL |
2150 | #ifdef MOUSE_WHEEL |
2143 | case Button4: |
2151 | case Button4: |
2144 | case Button5: |
2152 | case Button5: |
… | |
… | |
2624 | am_transparent = 0; |
2632 | am_transparent = 0; |
2625 | /* XXX: also turn off Opt_transparent? */ |
2633 | /* XXX: also turn off Opt_transparent? */ |
2626 | } |
2634 | } |
2627 | else |
2635 | else |
2628 | { |
2636 | { |
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++) |
2637 | for (n = 0; n < (unsigned int)i; n++) |
2635 | { |
2638 | { |
2636 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2639 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2637 | XClearWindow (disp, parent[n]); |
2640 | XClearWindow (disp, parent[n]); |
2638 | } |
2641 | } |
… | |
… | |
3305 | { |
3308 | { |
3306 | switch (priv) |
3309 | switch (priv) |
3307 | { |
3310 | { |
3308 | case '>': |
3311 | case '>': |
3309 | if (ch == CSI_DA) /* secondary device attributes */ |
3312 | if (ch == CSI_DA) /* secondary device attributes */ |
|
|
3313 | { |
|
|
3314 | // first parameter is normally 0 for vt100, 1 for some newer vtxxx, 'R' for rxvt, |
|
|
3315 | // 'U' for rxvt-unicode <= 7.2, and Mm85 (e.g. 7385 for 7.3) for later versions. |
|
|
3316 | // |
|
|
3317 | // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt |
|
|
3318 | // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify |
|
|
3319 | // that we do not support xterm mouse reporting (should be 95 when we do). |
|
|
3320 | // |
3310 | tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); |
3321 | tt_printf ("\033[>%c%c85;94;0c", VERSION[0], VERSION[1]); |
|
|
3322 | } |
3311 | break; |
3323 | break; |
3312 | case '?': |
3324 | case '?': |
3313 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3325 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3314 | process_terminal_mode (ch, priv, nargs, arg); |
3326 | process_terminal_mode (ch, priv, nargs, arg); |
3315 | break; |
3327 | break; |