diff options
Diffstat (limited to 'src/Ewmh.hh')
-rw-r--r-- | src/Ewmh.hh | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/Ewmh.hh b/src/Ewmh.hh new file mode 100644 index 0000000..c4419ba --- /dev/null +++ b/src/Ewmh.hh | |||
@@ -0,0 +1,104 @@ | |||
1 | // Ewmh.hh for fluxbox | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@fluxbox.org) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id: Ewmh.hh,v 1.12 2003/09/23 13:52:05 rathnor Exp $ | ||
23 | |||
24 | #include "AtomHandler.hh" | ||
25 | |||
26 | #include <X11/Xatom.h> | ||
27 | #include <vector> | ||
28 | #include <map> | ||
29 | |||
30 | class Ewmh:public AtomHandler { | ||
31 | public: | ||
32 | |||
33 | Ewmh(); | ||
34 | ~Ewmh(); | ||
35 | void initForScreen(BScreen &screen); | ||
36 | void setupFrame(FluxboxWindow &win); | ||
37 | void setupClient(WinClient &winclient); | ||
38 | |||
39 | void updateClientList(BScreen &screen); | ||
40 | void updateWorkspaceNames(BScreen &screen); | ||
41 | void updateCurrentWorkspace(BScreen &screen); | ||
42 | void updateWorkspaceCount(BScreen &screen); | ||
43 | |||
44 | void updateState(FluxboxWindow &win); | ||
45 | void updateLayer(FluxboxWindow &win); | ||
46 | void updateHints(FluxboxWindow &win); | ||
47 | void updateWorkspace(FluxboxWindow &win); | ||
48 | |||
49 | |||
50 | bool checkClientMessage(const XClientMessageEvent &ce, | ||
51 | BScreen * screen, WinClient * const winclient); | ||
52 | |||
53 | bool propertyNotify(WinClient &winclient, Atom the_property); | ||
54 | void updateFrameClose(FluxboxWindow &win); | ||
55 | |||
56 | //ignore this one | ||
57 | void updateClientClose(WinClient &winclient) {} | ||
58 | |||
59 | void setFullscreen(FluxboxWindow &win, bool value); | ||
60 | |||
61 | private: | ||
62 | |||
63 | typedef struct WindowState { | ||
64 | WindowState(int x, int y, unsigned int width, unsigned int height, int layer, unsigned int decor); | ||
65 | int x, y, layer; | ||
66 | unsigned int width, height, decor; | ||
67 | } WindowState; | ||
68 | |||
69 | enum { STATE_REMOVE = 0, STATE_ADD = 1, STATE_TOGGLE = 2}; | ||
70 | |||
71 | void setState(FluxboxWindow &win, Atom state, bool value); | ||
72 | void toggleState(FluxboxWindow &win, Atom state); | ||
73 | void createAtoms(); | ||
74 | void updateStrut(WinClient &winclient); | ||
75 | |||
76 | // root window properties | ||
77 | Atom m_net_supported, m_net_client_list, m_net_client_list_stacking, | ||
78 | m_net_number_of_desktops, m_net_desktop_geometry, m_net_desktop_viewport, | ||
79 | m_net_current_desktop, m_net_desktop_names, m_net_active_window, m_net_workarea, | ||
80 | m_net_supporting_wm_check, m_net_virtual_roots, m_net_moveresize_window; | ||
81 | |||
82 | // root window messages | ||
83 | Atom m_net_close_window, m_net_wm_moveresize; | ||
84 | |||
85 | // application window properties | ||
86 | Atom m_net_properties, m_net_wm_name, m_net_wm_desktop, m_net_wm_window_type, | ||
87 | m_net_wm_state, m_net_wm_state_sticky, m_net_wm_state_shaded, | ||
88 | m_net_wm_state_maximized_horz, m_net_wm_state_maximized_vert, | ||
89 | m_net_wm_state_fullscreen, | ||
90 | m_net_wm_strut, m_net_wm_icon_geometry, m_net_wm_icon, m_net_wm_pid, | ||
91 | m_net_wm_handled_icons; | ||
92 | |||
93 | // application protocols | ||
94 | Atom m_net_wm_ping; | ||
95 | |||
96 | std::vector<Window> m_windows; | ||
97 | typedef std::map<FluxboxWindow *, WindowState *> SavedState; | ||
98 | SavedState m_savedstate; | ||
99 | |||
100 | WindowState *getState(FluxboxWindow &win); | ||
101 | void clearState(FluxboxWindow &win); | ||
102 | void saveState(FluxboxWindow &win, WindowState *state); | ||
103 | |||
104 | }; | ||