diff options
Diffstat (limited to 'util/fbcompose/Atoms.cc')
-rw-r--r-- | util/fbcompose/Atoms.cc | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/util/fbcompose/Atoms.cc b/util/fbcompose/Atoms.cc new file mode 100644 index 0000000..362f96f --- /dev/null +++ b/util/fbcompose/Atoms.cc | |||
@@ -0,0 +1,120 @@ | |||
1 | /** Atoms.cc file for the fluxbox compositor. */ | ||
2 | |||
3 | // Copyright (c) 2011 Gediminas Liktaras (gliktaras at gmail dot com) | ||
4 | // | ||
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | // of this software and associated documentation files (the "Software"), to deal | ||
7 | // in the Software without restriction, including without limitation the rights | ||
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | // copies of the Software, and to permit persons to whom the Software is | ||
10 | // furnished to do so, subject to the following conditions: | ||
11 | // | ||
12 | // The above copyright notice and this permission notice shall be included in | ||
13 | // all copies or substantial portions of the Software. | ||
14 | // | ||
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
21 | // THE SOFTWARE. | ||
22 | |||
23 | |||
24 | #include "Atoms.hh" | ||
25 | |||
26 | #include "FbTk/App.hh" | ||
27 | |||
28 | #include <X11/Xatom.h> | ||
29 | |||
30 | #include <sstream> | ||
31 | |||
32 | using namespace FbCompositor; | ||
33 | |||
34 | |||
35 | //--- MAIN METHODS ------------------------------------------------------------- | ||
36 | |||
37 | // Returns the _NET_ACTIVE_WINDOW atom. | ||
38 | Atom Atoms::activeWindowAtom() { | ||
39 | static Atom atom = XInternAtom(FbTk::App::instance()->display(), "_NET_ACTIVE_WINDOW", False); | ||
40 | return atom; | ||
41 | } | ||
42 | |||
43 | // Returns the _NET_WM_CM_Sxx atoms. | ||
44 | Atom Atoms::compositingSelectionAtom(int screen_number) { | ||
45 | std::stringstream ss; | ||
46 | ss << "_NET_WM_CM_S" << screen_number; | ||
47 | return XInternAtom(FbTk::App::instance()->display(), ss.str().c_str(), False); | ||
48 | } | ||
49 | |||
50 | // Returns the _FLUXBOX_CURRENT_ICONBAR_ITEM atom. | ||
51 | Atom Atoms::currentIconbarItemAtom() { | ||
52 | static Atom atom = XInternAtom(FbTk::App::instance()->display(), "_FLUXBOX_CURRENT_ICONBAR_ITEM", False); | ||
53 | return atom; | ||
54 | } | ||
55 | |||
56 | // Returns the _NET_WM_WINDOW_OPACITY atom. | ||
57 | Atom Atoms::opacityAtom() { | ||
58 | static Atom atom = XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_OPACITY", False); | ||
59 | return atom; | ||
60 | } | ||
61 | |||
62 | // Returns the _FLUXBOX_RECONFIGURE_RECT atom. | ||
63 | Atom Atoms::reconfigureRectAtom() { | ||
64 | static Atom atom = XInternAtom(FbTk::App::instance()->display(), "_FLUXBOX_RECONFIGURE_RECT", False); | ||
65 | return atom; | ||
66 | } | ||
67 | |||
68 | // Returns the atoms that (might) correspond to background pixmap (i.e. wallpapers). | ||
69 | std::vector<Atom> Atoms::rootPixmapAtoms() { | ||
70 | static std::vector<Atom> atoms; | ||
71 | |||
72 | static bool initialized = false; | ||
73 | if (!initialized) { | ||
74 | atoms.push_back(XInternAtom(FbTk::App::instance()->display(), "_XROOTPMAP_ID", False)); | ||
75 | atoms.push_back(XInternAtom(FbTk::App::instance()->display(), "_XSETROOT_ID", False)); | ||
76 | atoms.push_back(XInternAtom(FbTk::App::instance()->display(), "ESETROOT_PMAP_ID", False)); | ||
77 | initialized = true; | ||
78 | } | ||
79 | |||
80 | return atoms; | ||
81 | } | ||
82 | |||
83 | // Returns the _NET_WM_WINDOW_TYPE atom. | ||
84 | Atom Atoms::windowTypeAtom() { | ||
85 | static Atom atom = XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_TYPE", False); | ||
86 | return atom; | ||
87 | } | ||
88 | |||
89 | // Returns a vector with atoms and the correspoding WindowType enum members. | ||
90 | std::vector< std::pair<Atom, WindowType> > Atoms::windowTypeAtomList() { | ||
91 | static std::vector< std::pair<Atom, WindowType> > atom_list; | ||
92 | |||
93 | static bool initialized = false; | ||
94 | if (!initialized) { | ||
95 | atom_list.push_back(std::make_pair(XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_TYPE_DESKTOP", False), WinType_Desktop)); | ||
96 | atom_list.push_back(std::make_pair(XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_TYPE_DIALOG", False), WinType_Dialog)); | ||
97 | atom_list.push_back(std::make_pair(XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_TYPE_DOCK", False), WinType_Dock)); | ||
98 | atom_list.push_back(std::make_pair(XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_TYPE_MENU", False), WinType_Menu)); | ||
99 | atom_list.push_back(std::make_pair(XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_TYPE_NORMAL", False), WinType_Normal)); | ||
100 | atom_list.push_back(std::make_pair(XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_TYPE_SPLASH", False), WinType_Splash)); | ||
101 | atom_list.push_back(std::make_pair(XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_TYPE_TOOLBAR", False), WinType_Toolbar)); | ||
102 | atom_list.push_back(std::make_pair(XInternAtom(FbTk::App::instance()->display(), "_NET_WM_WINDOW_TYPE_UTILITY", False), WinType_Utility)); | ||
103 | atom_list.push_back(std::make_pair(None, WinType_Normal)); // Default | ||
104 | initialized = true; | ||
105 | } | ||
106 | |||
107 | return atom_list; | ||
108 | } | ||
109 | |||
110 | // Returns the _WIN_WORKSPACE atom. | ||
111 | Atom Atoms::workspaceAtom() { | ||
112 | static Atom atom = XInternAtom(FbTk::App::instance()->display(), "_WIN_WORKSPACE", False); | ||
113 | return atom; | ||
114 | } | ||
115 | |||
116 | // Returns the _WIN_WORKSPACE_COUNT atom. | ||
117 | Atom Atoms::workspaceCountAtom() { | ||
118 | static Atom atom = XInternAtom(FbTk::App::instance()->display(), "_WIN_WORKSPACE_COUNT", False); | ||
119 | return atom; | ||
120 | } | ||