… | |
… | |
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 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
1407 | && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) |
1408 | { |
1408 | { |
|
|
1409 | if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) |
|
|
1410 | { |
|
|
1411 | if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) |
|
|
1412 | { |
1409 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1413 | if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
|
|
1414 | { |
|
|
1415 | if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) |
1410 | destroy (); |
1416 | destroy (); |
|
|
1417 | } |
1411 | #if ENABLE_EWMH |
1418 | #if ENABLE_EWMH |
1412 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1419 | else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) |
1413 | XSendEvent (disp, ev.xclient.window = display->root, |
1420 | XSendEvent (disp, ev.xclient.window = display->root, |
1414 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1421 | False, SubstructureRedirectMask | SubstructureNotifyMask, |
1415 | &ev); |
1422 | &ev); |
|
|
1423 | #endif |
|
|
1424 | } |
|
|
1425 | } |
|
|
1426 | #if ENABLE_XEMBED |
|
|
1427 | else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1428 | { |
|
|
1429 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1430 | focus_in (); |
|
|
1431 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1432 | focus_out (); |
|
|
1433 | } |
1416 | #endif |
1434 | #endif |
1417 | } |
1435 | } |
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; |
1436 | break; |
1454 | |
1437 | |
1455 | case MappingNotify: |
1438 | case MappingNotify: |
1456 | XRefreshKeyboardMapping (&ev.xmapping); |
1439 | XRefreshKeyboardMapping (&ev.xmapping); |
1457 | break; |
1440 | break; |
… | |
… | |
1509 | #endif |
1492 | #endif |
1510 | } |
1493 | } |
1511 | break; |
1494 | break; |
1512 | |
1495 | |
1513 | case PropertyNotify: |
1496 | case PropertyNotify: |
|
|
1497 | if (!HOOK_INVOKE ((this, HOOK_PROPERTY_NOTIFY, DT_XEVENT, &ev, DT_END))) |
1514 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1498 | if (ev.xproperty.atom == xa[XA_VT_SELECTION] |
1515 | && ev.xproperty.state == PropertyNewValue) |
1499 | && ev.xproperty.state == PropertyNewValue) |
1516 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1500 | selection_property (ev.xproperty.window, ev.xproperty.atom); |
1517 | |
1501 | |
1518 | break; |
1502 | break; |
1519 | |
1503 | |
1520 | case SelectionClear: |
1504 | case SelectionClear: |
1521 | selection_clear (); |
1505 | selection_clear (); |
… | |
… | |
1839 | /* |
1823 | /* |
1840 | * VT window processing of button press |
1824 | * VT window processing of button press |
1841 | */ |
1825 | */ |
1842 | if (ev.window == vt) |
1826 | if (ev.window == vt) |
1843 | { |
1827 | { |
|
|
1828 | if (HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1829 | return; |
|
|
1830 | |
1844 | #if ISO_14755 |
1831 | #if ISO_14755 |
1845 | // 5.4 |
1832 | // 5.4 |
1846 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1833 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
1847 | { |
1834 | { |
1848 | iso14755_54 (ev.x, ev.y); |
1835 | iso14755_54 (ev.x, ev.y); |
… | |
… | |
1890 | else |
1877 | else |
1891 | { |
1878 | { |
1892 | if (ev.button != MEvent.button) |
1879 | if (ev.button != MEvent.button) |
1893 | MEvent.clicks = 0; |
1880 | MEvent.clicks = 0; |
1894 | |
1881 | |
1895 | if (!HOOK_INVOKE ((this, HOOK_BUTTON_PRESS, DT_XEVENT, &ev, DT_END))) |
|
|
1896 | switch (ev.button) |
1882 | switch (ev.button) |
1897 | { |
1883 | { |
1898 | case Button1: |
1884 | case Button1: |
1899 | /* allow meta + click to select rectangular areas */ |
1885 | /* allow meta + click to select rectangular areas */ |
1900 | /* should be done in screen.C */ |
1886 | /* should be done in screen.C */ |
1901 | #if ENABLE_FRILLS |
1887 | #if ENABLE_FRILLS |
1902 | selection.rect = !!(ev.state & ModMetaMask); |
1888 | selection.rect = !!(ev.state & ModMetaMask); |
1903 | #else |
1889 | #else |
1904 | selection.rect = false; |
1890 | selection.rect = false; |
1905 | #endif |
1891 | #endif |
1906 | |
1892 | |
1907 | /* allow shift+left click to extend selection */ |
1893 | /* allow shift+left click to extend selection */ |
1908 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1894 | if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) |
1909 | { |
1895 | { |
1910 | if (MEvent.button == Button1 && clickintime) |
1896 | if (MEvent.button == Button1 && clickintime) |
1911 | selection_rotate (ev.x, ev.y); |
1897 | selection_rotate (ev.x, ev.y); |
1912 | else |
1898 | else |
1913 | selection_extend (ev.x, ev.y, 1); |
1899 | selection_extend (ev.x, ev.y, 1); |
1914 | } |
1900 | } |
1915 | else |
1901 | else |
1916 | { |
1902 | { |
1917 | if (MEvent.button == Button1 && clickintime) |
1903 | if (MEvent.button == Button1 && clickintime) |
1918 | MEvent.clicks++; |
1904 | MEvent.clicks++; |
1919 | else |
1905 | else |
1920 | MEvent.clicks = 1; |
1906 | MEvent.clicks = 1; |
1921 | |
1907 | |
1922 | selection_click (MEvent.clicks, ev.x, ev.y); |
1908 | selection_click (MEvent.clicks, ev.x, ev.y); |
1923 | } |
1909 | } |
1924 | |
1910 | |
1925 | MEvent.button = Button1; |
1911 | MEvent.button = Button1; |
1926 | break; |
1912 | break; |
1927 | |
1913 | |
1928 | case Button3: |
1914 | case Button3: |
1929 | if (MEvent.button == Button3 && clickintime) |
1915 | if (MEvent.button == Button3 && clickintime) |
1930 | selection_rotate (ev.x, ev.y); |
1916 | selection_rotate (ev.x, ev.y); |
1931 | else |
1917 | else |
1932 | selection_extend (ev.x, ev.y, 1); |
1918 | selection_extend (ev.x, ev.y, 1); |
1933 | |
1919 | |
1934 | MEvent.button = Button3; |
1920 | MEvent.button = Button3; |
1935 | break; |
1921 | break; |
1936 | } |
1922 | } |
1937 | } |
1923 | } |
1938 | |
1924 | |
1939 | MEvent.time = ev.time; |
1925 | MEvent.time = ev.time; |
1940 | return; |
1926 | return; |
1941 | } |
1927 | } |
1942 | |
1928 | |
… | |
… | |
2105 | sel_scroll_ev.stop(); |
2091 | sel_scroll_ev.stop(); |
2106 | #endif |
2092 | #endif |
2107 | |
2093 | |
2108 | if (ev.window == vt) |
2094 | if (ev.window == vt) |
2109 | { |
2095 | { |
|
|
2096 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2097 | return; |
|
|
2098 | |
2110 | #if ISO_14755 |
2099 | #if ISO_14755 |
2111 | // 5.4 |
2100 | // 5.4 |
2112 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2101 | if (iso14755buf & (ISO_14755_STARTED | ISO_14755_54)) |
2113 | return; |
2102 | return; |
2114 | #endif |
2103 | #endif |
|
|
2104 | |
2115 | if (reportmode) |
2105 | if (reportmode) |
2116 | { |
2106 | { |
2117 | /* mouse report from vt window */ |
2107 | /* mouse report from vt window */ |
2118 | /* don't report release of wheel "buttons" */ |
2108 | /* don't report release of wheel "buttons" */ |
2119 | if (ev.button >= 4) |
2109 | if (ev.button >= 4) |
… | |
… | |
2143 | if (priv_modes & PrivMode_mouse_report |
2133 | if (priv_modes & PrivMode_mouse_report |
2144 | && bypass_keystate |
2134 | && bypass_keystate |
2145 | && ev.button == Button1 && MEvent.clicks <= 1) |
2135 | && ev.button == Button1 && MEvent.clicks <= 1) |
2146 | selection_extend (ev.x, ev.y, 0); |
2136 | selection_extend (ev.x, ev.y, 0); |
2147 | |
2137 | |
2148 | if (HOOK_INVOKE ((this, HOOK_BUTTON_RELEASE, DT_XEVENT, &ev, DT_END))) |
|
|
2149 | return; |
|
|
2150 | |
|
|
2151 | switch (ev.button) |
2138 | switch (ev.button) |
2152 | { |
2139 | { |
2153 | case Button1: |
2140 | case Button1: |
2154 | case Button3: |
2141 | case Button3: |
2155 | selection_make (ev.time); |
2142 | selection_make (ev.time); |
2156 | break; |
2143 | break; |
2157 | |
2144 | |
2158 | case Button2: |
2145 | case Button2: |
2159 | 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? |
2160 | selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); |
2147 | selection_request (ev.time, ev.state & ModMetaMask ? Sel_Primary : Sel_Primary); |
2161 | break; |
2148 | break; |
2162 | |
2149 | |
2163 | #ifdef MOUSE_WHEEL |
2150 | #ifdef MOUSE_WHEEL |
2164 | case Button4: |
2151 | case Button4: |
2165 | case Button5: |
2152 | case Button5: |
… | |
… | |
2645 | am_transparent = 0; |
2632 | am_transparent = 0; |
2646 | /* XXX: also turn off Opt_transparent? */ |
2633 | /* XXX: also turn off Opt_transparent? */ |
2647 | } |
2634 | } |
2648 | else |
2635 | else |
2649 | { |
2636 | { |
2650 | #if WAIT_FOR_WM |
|
|
2651 | /* wait (an arbitrary period) for the WM to do its thing |
|
|
2652 | * needed for fvwm2.2.2 (and before?) */ |
|
|
2653 | sleep (1); |
|
|
2654 | #endif |
|
|
2655 | for (n = 0; n < (unsigned int)i; n++) |
2637 | for (n = 0; n < (unsigned int)i; n++) |
2656 | { |
2638 | { |
2657 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2639 | XSetWindowBackgroundPixmap (disp, parent[n], ParentRelative); |
2658 | XClearWindow (disp, parent[n]); |
2640 | XClearWindow (disp, parent[n]); |
2659 | } |
2641 | } |