diff options
-rw-r--r-- | src/Ewmh.cc | 66 |
1 files changed, 63 insertions, 3 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc index ea23a22..d4cfb3f 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc | |||
@@ -50,6 +50,19 @@ using namespace std; | |||
50 | #define FB_new_nothrow new(std::nothrow) | 50 | #define FB_new_nothrow new(std::nothrow) |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | enum EwmhMoveResizeDirection { | ||
54 | _NET_WM_MOVERESIZE_SIZE_TOPLEFT = 0, | ||
55 | _NET_WM_MOVERESIZE_SIZE_TOP = 1, | ||
56 | _NET_WM_MOVERESIZE_SIZE_TOPRIGHT = 2, | ||
57 | _NET_WM_MOVERESIZE_SIZE_RIGHT = 3, | ||
58 | _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT = 4, | ||
59 | _NET_WM_MOVERESIZE_SIZE_BOTTOM = 5, | ||
60 | _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT = 6, | ||
61 | _NET_WM_MOVERESIZE_SIZE_LEFT = 7, | ||
62 | _NET_WM_MOVERESIZE_MOVE = 8, // movement only | ||
63 | _NET_WM_MOVERESIZE_SIZE_KEYBOARD = 9, // size via keyboard | ||
64 | _NET_WM_MOVERESIZE_MOVE_KEYBOARD = 10 | ||
65 | }; | ||
53 | 66 | ||
54 | Ewmh::Ewmh() { | 67 | Ewmh::Ewmh() { |
55 | createAtoms(); | 68 | createAtoms(); |
@@ -106,6 +119,8 @@ void Ewmh::initForScreen(BScreen &screen) { | |||
106 | // window properties | 119 | // window properties |
107 | m_net_wm_strut, | 120 | m_net_wm_strut, |
108 | m_net_wm_state, | 121 | m_net_wm_state, |
122 | m_net_wm_name, | ||
123 | m_net_wm_icon_name, | ||
109 | 124 | ||
110 | // states that we support: | 125 | // states that we support: |
111 | m_net_wm_state_sticky, | 126 | m_net_wm_state_sticky, |
@@ -149,6 +164,9 @@ void Ewmh::initForScreen(BScreen &screen) { | |||
149 | m_net_workarea, | 164 | m_net_workarea, |
150 | m_net_restack_window, | 165 | m_net_restack_window, |
151 | 166 | ||
167 | // m_net_wm_moveresize, | ||
168 | |||
169 | |||
152 | // desktop properties | 170 | // desktop properties |
153 | m_net_wm_desktop, | 171 | m_net_wm_desktop, |
154 | m_net_desktop_names, | 172 | m_net_desktop_names, |
@@ -813,13 +831,55 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, | |||
813 | 831 | ||
814 | FbTk::XLayerItem &below_item = winclient->fbwindow()->layerItem(); | 832 | FbTk::XLayerItem &below_item = winclient->fbwindow()->layerItem(); |
815 | FbTk::XLayerItem &above_item = above_win->fbwindow()->layerItem(); | 833 | FbTk::XLayerItem &above_item = above_win->fbwindow()->layerItem(); |
834 | |||
816 | // this might break the transient_for layering | 835 | // this might break the transient_for layering |
817 | below_item.getLayer().stackBelowItem(&below_item, &above_item); | ||
818 | 836 | ||
819 | return true; | 837 | // do restack if both items are on the same layer |
838 | // else ignore restack | ||
839 | if (&below_item.getLayer() == &above_item.getLayer()) | ||
840 | below_item.getLayer().stackBelowItem(&below_item, &above_item); | ||
841 | |||
820 | 842 | ||
821 | } | 843 | return true; |
822 | 844 | ||
845 | } /* Still in progress... | ||
846 | else if (ce.message_type == m_net_wm_moveresize) { | ||
847 | if (winclient == 0 || winclient->fbwindow() == 0) | ||
848 | return true; | ||
849 | // data.l[0] = x_root | ||
850 | // data.l[1] = y_root | ||
851 | // data.l[2] = direction | ||
852 | // data.l[3] = button | ||
853 | // data.l[4] = source indication | ||
854 | cerr<<"("<<ce.data.l[0]<<", "<<ce.data.l[1]<<")"<<endl; | ||
855 | cerr<<"dir="<<ce.data.l[2]<<endl; | ||
856 | cerr<<"button="<<ce.data.l[3]<<endl; | ||
857 | cerr<<"source="<<ce.data.l[4]<<endl; | ||
858 | switch (ce.data.l[2] ) { | ||
859 | case _NET_WM_MOVERESIZE_SIZE_TOPLEFT: | ||
860 | case _NET_WM_MOVERESIZE_SIZE_TOP: | ||
861 | case _NET_WM_MOVERESIZE_SIZE_TOPRIGHT: | ||
862 | case _NET_WM_MOVERESIZE_SIZE_RIGHT: | ||
863 | case _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT: | ||
864 | case _NET_WM_MOVERESIZE_SIZE_BOTTOM: | ||
865 | case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT: | ||
866 | case _NET_WM_MOVERESIZE_SIZE_LEFT: | ||
867 | case _NET_WM_MOVERESIZE_SIZE_KEYBOARD: | ||
868 | winclient->fbwindow()->startResizing(ce.data.l[0], ce.data.l[1], | ||
869 | static_cast<FluxboxWindow::ResizeDirection> | ||
870 | (ce.data.l[2])); | ||
871 | break; | ||
872 | case _NET_WM_MOVERESIZE_MOVE: | ||
873 | case _NET_WM_MOVERESIZE_MOVE_KEYBOARD: | ||
874 | winclient->fbwindow()->startMoving(ce.data.l[0], ce.data.l[1]); | ||
875 | break; | ||
876 | default: | ||
877 | cerr << "Ewmh: Unknown move/resize direction: " << ce.data.l[2] << endl; | ||
878 | break; | ||
879 | } | ||
880 | return true; | ||
881 | } | ||
882 | */ | ||
823 | // we didn't handle the ce.message_type here | 883 | // we didn't handle the ce.message_type here |
824 | return false; | 884 | return false; |
825 | } | 885 | } |