summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-19 22:43:48 (GMT)
committerfluxgen <fluxgen>2003-05-19 22:43:48 (GMT)
commitb17abb05c8a8ce19f18039b8c306c92daa7c9acf (patch)
tree05932a0be04238ef12608abe99bd6011e28926c6 /src
parent3027bf1341cf3ac82889846ceeb1e9cf7f955502 (diff)
downloadfluxbox_lack-b17abb05c8a8ce19f18039b8c306c92daa7c9acf.zip
fluxbox_lack-b17abb05c8a8ce19f18039b8c306c92daa7c9acf.tar.bz2
using property and changeProperty
Diffstat (limited to 'src')
-rw-r--r--src/Ewmh.cc42
-rw-r--r--src/Gnome.cc59
-rw-r--r--src/Window.cc12
3 files changed, 49 insertions, 64 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index d96a6d3..9df4967 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Ewmh.cc,v 1.25 2003/05/15 12:00:42 fluxgen Exp $ 22// $Id: Ewmh.cc,v 1.26 2003/05/19 22:40:16 fluxgen Exp $
23 23
24#include "Ewmh.hh" 24#include "Ewmh.hh"
25 25
@@ -56,8 +56,8 @@ void Ewmh::initForScreen(BScreen &screen) {
56 if (wincheck != None) { 56 if (wincheck != None) {
57 m_windows.push_back(wincheck); 57 m_windows.push_back(wincheck);
58 58
59 XChangeProperty(disp, screen.rootWindow().window(), m_net_supporting_wm_check, XA_WINDOW, 32, 59 screen.rootWindow().changeProperty(m_net_supporting_wm_check, XA_WINDOW, 32,
60 PropModeReplace, (unsigned char *) &wincheck, 1); 60 PropModeReplace, (unsigned char *) &wincheck, 1);
61 XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32, 61 XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32,
62 PropModeReplace, (unsigned char *) &wincheck, 1); 62 PropModeReplace, (unsigned char *) &wincheck, 1);
63 63
@@ -86,18 +86,16 @@ void Ewmh::initForScreen(BScreen &screen) {
86 m_net_supporting_wm_check 86 m_net_supporting_wm_check
87 }; 87 };
88 88
89 XChangeProperty(disp, screen.rootWindow().window(), 89 screen.rootWindow().changeProperty(m_net_supported, XA_ATOM, 32,
90 m_net_supported, XA_ATOM, 32, 90 PropModeReplace,
91 PropModeReplace, 91 (unsigned char *) &atomsupported,
92 (unsigned char *) &atomsupported, 92 (sizeof atomsupported)/sizeof atomsupported[0]);
93 (sizeof atomsupported)/sizeof atomsupported[0]);
94 93
95 94
96} 95}
97 96
98void Ewmh::setupWindow(FluxboxWindow &win) { 97void Ewmh::setupWindow(FluxboxWindow &win) {
99 98
100 Display *disp = FbTk::App::instance()->display();
101 Atom ret_type; 99 Atom ret_type;
102 int fmt; 100 int fmt;
103 unsigned long nitems, bytes_after; 101 unsigned long nitems, bytes_after;
@@ -112,10 +110,9 @@ void Ewmh::setupWindow(FluxboxWindow &win) {
112 XFree(data); 110 XFree(data);
113 } 111 }
114*/ 112*/
115 if (XGetWindowProperty(disp, win.clientWindow(), 113 if (win.winClient().property(m_net_wm_desktop, 0, 1, False, XA_CARDINAL,
116 m_net_wm_desktop, 0, 1, False, XA_CARDINAL, 114 &ret_type, &fmt, &nitems, &bytes_after,
117 &ret_type, &fmt, &nitems, &bytes_after, 115 (unsigned char **) &data) && data) {
118 (unsigned char **) &data) == Success && data) {
119 unsigned int desktop = static_cast<unsigned int>(*data); 116 unsigned int desktop = static_cast<unsigned int>(*data);
120 if (desktop == 0xFFFFFFFF && !win.isStuck()) 117 if (desktop == 0xFFFFFFFF && !win.isStuck())
121 win.stick(); 118 win.stick();
@@ -192,11 +189,9 @@ void Ewmh::updateClientList(BScreen &screen) {
192 189
193 //number of windows to show in client list 190 //number of windows to show in client list
194 num = win; 191 num = win;
195 XChangeProperty(FbTk::App::instance()->display(), 192 screen.rootWindow().changeProperty(m_net_client_list,
196 screen.rootWindow().window(), 193 XA_CARDINAL, 32,
197 m_net_client_list, 194 PropModeReplace, (unsigned char *)wl, num);
198 XA_CARDINAL, 32,
199 PropModeReplace, (unsigned char *)wl, num);
200 195
201 delete [] wl; 196 delete [] wl;
202} 197}
@@ -224,18 +219,15 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
224 219
225void Ewmh::updateCurrentWorkspace(BScreen &screen) { 220void Ewmh::updateCurrentWorkspace(BScreen &screen) {
226 size_t workspace = screen.currentWorkspaceID(); 221 size_t workspace = screen.currentWorkspaceID();
227 XChangeProperty(FbTk::App::instance()->display(), 222 screen.rootWindow().changeProperty(m_net_current_desktop, XA_CARDINAL, 32, PropModeReplace,
228 screen.rootWindow().window(), 223 (unsigned char *)&workspace, 1);
229 m_net_current_desktop, XA_CARDINAL, 32, PropModeReplace,
230 (unsigned char *)&workspace, 1);
231 224
232} 225}
233 226
234void Ewmh::updateWorkspaceCount(BScreen &screen) { 227void Ewmh::updateWorkspaceCount(BScreen &screen) {
235 size_t numworkspaces = screen.getCount(); 228 size_t numworkspaces = screen.getCount();
236 XChangeProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), 229 screen.rootWindow().changeProperty(m_net_number_of_desktops, XA_CARDINAL, 32, PropModeReplace,
237 m_net_number_of_desktops, XA_CARDINAL, 32, PropModeReplace, 230 (unsigned char *)&numworkspaces, 1);
238 (unsigned char *)&numworkspaces, 1);
239} 231}
240 232
241void Ewmh::updateState(FluxboxWindow &win) { 233void Ewmh::updateState(FluxboxWindow &win) {
diff --git a/src/Gnome.cc b/src/Gnome.cc
index bb867ac..bafcd78 100644
--- a/src/Gnome.cc
+++ b/src/Gnome.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Gnome.cc,v 1.24 2003/05/15 12:00:42 fluxgen Exp $ 22// $Id: Gnome.cc,v 1.25 2003/05/19 22:40:40 fluxgen Exp $
23 23
24#include "Gnome.hh" 24#include "Gnome.hh"
25 25
@@ -53,9 +53,9 @@ void Gnome::initForScreen(BScreen &screen) {
53 Window gnome_win = XCreateSimpleWindow(disp, 53 Window gnome_win = XCreateSimpleWindow(disp,
54 screen.rootWindow().window(), 0, 0, 5, 5, 0, 0, 0); 54 screen.rootWindow().window(), 0, 0, 5, 5, 0, 0, 0);
55 // supported WM check 55 // supported WM check
56 XChangeProperty(disp, screen.rootWindow().window(), 56 screen.rootWindow().changeProperty(m_gnome_wm_supporting_wm_check,
57 m_gnome_wm_supporting_wm_check, 57 XA_CARDINAL, 32,
58 XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &gnome_win, 1); 58 PropModeReplace, (unsigned char *) &gnome_win, 1);
59 59
60 XChangeProperty(disp, gnome_win, 60 XChangeProperty(disp, gnome_win,
61 m_gnome_wm_supporting_wm_check, 61 m_gnome_wm_supporting_wm_check,
@@ -71,9 +71,10 @@ void Gnome::initForScreen(BScreen &screen) {
71 }; 71 };
72 72
73 //list atoms that we support 73 //list atoms that we support
74 XChangeProperty(disp, screen.rootWindow().window(), 74 screen.rootWindow().changeProperty(m_gnome_wm_prot,
75 m_gnome_wm_prot, XA_ATOM, 32, PropModeReplace, 75 XA_ATOM, 32, PropModeReplace,
76 (unsigned char *)gnomeatomlist, (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]); 76 (unsigned char *)gnomeatomlist,
77 (sizeof gnomeatomlist)/sizeof gnomeatomlist[0]);
77 78
78 m_gnomewindows.push_back(gnome_win); 79 m_gnomewindows.push_back(gnome_win);
79 80
@@ -92,10 +93,9 @@ void Gnome::setupWindow(FluxboxWindow &win) {
92 unsigned long nitems, bytes_after; 93 unsigned long nitems, bytes_after;
93 long flags, *data = 0; 94 long flags, *data = 0;
94 95
95 if (XGetWindowProperty(disp, win.clientWindow(), 96 if (win.winClient().property(m_gnome_wm_win_state, 0, 1, False, XA_CARDINAL,
96 m_gnome_wm_win_state, 0, 1, False, XA_CARDINAL, 97 &ret_type, &fmt, &nitems, &bytes_after,
97 &ret_type, &fmt, &nitems, &bytes_after, 98 (unsigned char **) &data) && data) {
98 (unsigned char **) &data) == Success && data) {
99 flags = *data; 99 flags = *data;
100 setState(&win, flags); 100 setState(&win, flags);
101 XFree (data); 101 XFree (data);
@@ -172,11 +172,9 @@ void Gnome::updateClientList(BScreen &screen) {
172 } 172 }
173 //number of windows to show in client list 173 //number of windows to show in client list
174 num = win; 174 num = win;
175 XChangeProperty(FbTk::App::instance()->display(), 175 screen.rootWindow().changeProperty(m_gnome_wm_win_client_list,
176 screen.rootWindow().window(), 176 XA_CARDINAL, 32,
177 m_gnome_wm_win_client_list, 177 PropModeReplace, (unsigned char *)wl, num);
178 XA_CARDINAL, 32,
179 PropModeReplace, (unsigned char *)wl, num);
180 178
181 delete[] wl; 179 delete[] wl;
182} 180}
@@ -206,19 +204,16 @@ void Gnome::updateWorkspaceNames(BScreen &screen) {
206 204
207void Gnome::updateCurrentWorkspace(BScreen &screen) { 205void Gnome::updateCurrentWorkspace(BScreen &screen) {
208 int workspace = screen.currentWorkspaceID(); 206 int workspace = screen.currentWorkspaceID();
209 XChangeProperty(FbTk::App::instance()->display(), 207 screen.rootWindow().changeProperty(m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace,
210 screen.rootWindow().window(), 208 (unsigned char *)&workspace, 1);
211 m_gnome_wm_win_workspace, XA_CARDINAL, 32, PropModeReplace,
212 (unsigned char *)&workspace, 1);
213 209
214 updateClientList(screen); // make sure the client list is updated too 210 updateClientList(screen); // make sure the client list is updated too
215} 211}
216 212
217void Gnome::updateWorkspaceCount(BScreen &screen) { 213void Gnome::updateWorkspaceCount(BScreen &screen) {
218 int numworkspaces = screen.getCount(); 214 int numworkspaces = screen.getCount();
219 XChangeProperty(FbTk::App::instance()->display(), screen.rootWindow().window(), 215 screen.rootWindow().changeProperty(m_gnome_wm_win_workspace_count, XA_CARDINAL, 32, PropModeReplace,
220 m_gnome_wm_win_workspace_count, XA_CARDINAL, 32, PropModeReplace, 216 (unsigned char *)&numworkspaces, 1);
221 (unsigned char *)&numworkspaces, 1);
222} 217}
223 218
224void Gnome::updateWorkspace(FluxboxWindow &win) { 219void Gnome::updateWorkspace(FluxboxWindow &win) {
@@ -227,9 +222,9 @@ void Gnome::updateWorkspace(FluxboxWindow &win) {
227 cerr<<__FILE__<<"("<<__LINE__<<"): setting workspace("<<val<< 222 cerr<<__FILE__<<"("<<__LINE__<<"): setting workspace("<<val<<
228 ") for window("<<&win<<")"<<endl; 223 ") for window("<<&win<<")"<<endl;
229#endif // DEBUG 224#endif // DEBUG
230 XChangeProperty(FbTk::App::instance()->display(), win.clientWindow(), 225 win.winClient().changeProperty(m_gnome_wm_win_workspace,
231 m_gnome_wm_win_workspace, 226 XA_CARDINAL, 32, PropModeReplace,
232 XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); 227 (unsigned char *)&val, 1);
233} 228}
234 229
235void Gnome::updateState(FluxboxWindow &win) { 230void Gnome::updateState(FluxboxWindow &win) {
@@ -242,18 +237,18 @@ void Gnome::updateState(FluxboxWindow &win) {
242 if (win.isShaded()) 237 if (win.isShaded())
243 state |= WIN_STATE_SHADED; 238 state |= WIN_STATE_SHADED;
244 239
245 XChangeProperty(FbTk::App::instance()->display(), win.clientWindow(), 240 win.winClient().changeProperty(m_gnome_wm_win_state,
246 m_gnome_wm_win_state, 241 XA_CARDINAL, 32,
247 XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&state, 1); 242 PropModeReplace, (unsigned char *)&state, 1);
248} 243}
249 244
250void Gnome::updateLayer(FluxboxWindow &win) { 245void Gnome::updateLayer(FluxboxWindow &win) {
251 //TODO - map from flux layers to gnome ones 246 //TODO - map from flux layers to gnome ones
252 // our layers are in the opposite direction to GNOME 247 // our layers are in the opposite direction to GNOME
253 int layernum = Fluxbox::instance()->getDesktopLayer() - win.layerNum(); 248 int layernum = Fluxbox::instance()->getDesktopLayer() - win.layerNum();
254 XChangeProperty(FbTk::App::instance()->display(), win.clientWindow(), 249 win.winClient().changeProperty(m_gnome_wm_win_layer,
255 m_gnome_wm_win_layer, 250 XA_CARDINAL, 32, PropModeReplace,
256 XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&layernum, 1); 251 (unsigned char *)&layernum, 1);
257 252
258} 253}
259 254
diff --git a/src/Window.cc b/src/Window.cc
index 488a37b..032c4cd 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.181 2003/05/19 15:39:06 rathnor Exp $ 25// $Id: Window.cc,v 1.182 2003/05/19 22:43:48 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -1023,8 +1023,7 @@ void FluxboxWindow::getMWMHints() {
1023 Atom atom_return; 1023 Atom atom_return;
1024 unsigned long num, len; 1024 unsigned long num, len;
1025 Atom motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False); 1025 Atom motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
1026 if (!XGetWindowProperty(display, m_client->window(), 1026 if (!m_client->property(motif_wm_hints, 0,
1027 motif_wm_hints, 0,
1028 PropMwmHintsElements, false, 1027 PropMwmHintsElements, false,
1029 motif_wm_hints, &atom_return, 1028 motif_wm_hints, &atom_return,
1030 &format, &num, &len, 1029 &format, &num, &len,
@@ -1835,12 +1834,11 @@ void FluxboxWindow::restoreAttributes() {
1835 FbAtoms *fbatoms = FbAtoms::instance(); 1834 FbAtoms *fbatoms = FbAtoms::instance();
1836 1835
1837 BlackboxAttributes *net; 1836 BlackboxAttributes *net;
1838 if (XGetWindowProperty(display, m_client->window(), 1837 if (m_client->property(fbatoms->getFluxboxAttributesAtom(), 0l,
1839 fbatoms->getFluxboxAttributesAtom(), 0l,
1840 PropBlackboxAttributesElements, false, 1838 PropBlackboxAttributesElements, false,
1841 fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo, 1839 fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo,
1842 &nitems, &ulfoo, (unsigned char **) &net) == 1840 &nitems, &ulfoo, (unsigned char **) &net) &&
1843 Success && net && nitems == (unsigned)PropBlackboxAttributesElements) { 1841 net && nitems == (unsigned)PropBlackboxAttributesElements) {
1844 m_blackbox_attrib.flags = net->flags; 1842 m_blackbox_attrib.flags = net->flags;
1845 m_blackbox_attrib.attrib = net->attrib; 1843 m_blackbox_attrib.attrib = net->attrib;
1846 m_blackbox_attrib.workspace = net->workspace; 1844 m_blackbox_attrib.workspace = net->workspace;