summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Ewmh.cc32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 210122d..246dc70 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -1,5 +1,5 @@
1// Ewmh.cc for fluxbox 1// Ewmh.cc for fluxbox
2// Copyright (c) 2002 Henrik Kinnunen (fluxgen@fluxbox.org) 2// Copyright (c) 2002-2003 Henrik Kinnunen (fluxgen at user.sourceforge.net)
3// 3//
4// Permission is hereby granted, free of charge, to any person obtaining a 4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 5// copy of this software and associated documentation files (the "Software"),
@@ -13,13 +13,13 @@
13// 13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 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, 15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 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 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 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 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.11 2003/03/03 21:51:00 rathnor Exp $ 22// $Id: Ewmh.cc,v 1.12 2003/03/04 11:06:03 fluxgen Exp $
23 23
24#include "Ewmh.hh" 24#include "Ewmh.hh"
25 25
@@ -37,13 +37,14 @@ Ewmh::Ewmh() {
37 37
38Ewmh::~Ewmh() { 38Ewmh::~Ewmh() {
39 while (!m_windows.empty()) { 39 while (!m_windows.empty()) {
40 XDestroyWindow(BaseDisplay::getXDisplay(), m_windows.back()); 40 XDestroyWindow(FbTk::App::instance()->display(), m_windows.back());
41 m_windows.pop_back(); 41 m_windows.pop_back();
42 } 42 }
43} 43}
44 44
45void Ewmh::initForScreen(BScreen &screen) { 45void Ewmh::initForScreen(BScreen &screen) {
46 Display *disp = BaseDisplay::getXDisplay(); 46 Display *disp = FbTk::App::getXDisplay();
47
47 48
48 Window wincheck = XCreateSimpleWindow(disp, 49 Window wincheck = XCreateSimpleWindow(disp,
49 screen.getRootWindow(), 0, 0, 5, 5, 0, 0, 0); 50 screen.getRootWindow(), 0, 0, 5, 5, 0, 0, 0);
@@ -83,14 +84,16 @@ void Ewmh::initForScreen(BScreen &screen) {
83 84
84 XChangeProperty(disp, screen.getRootWindow(), 85 XChangeProperty(disp, screen.getRootWindow(),
85 m_net_supported, XA_ATOM, 32, 86 m_net_supported, XA_ATOM, 32,
86 PropModeReplace, (unsigned char *) &atomsupported, (sizeof atomsupported)/sizeof atomsupported[0]); 87 PropModeReplace,
88 (unsigned char *) &atomsupported,
89 (sizeof atomsupported)/sizeof atomsupported[0]);
87 90
88 91
89} 92}
90 93
91void Ewmh::setupWindow(FluxboxWindow &win) { 94void Ewmh::setupWindow(FluxboxWindow &win) {
92 95
93 Display *disp = BaseDisplay::getXDisplay(); 96 Display *disp = FbTk::App::instance()->display();
94 Atom ret_type; 97 Atom ret_type;
95 int fmt; 98 int fmt;
96 unsigned long nitems, bytes_after; 99 unsigned long nitems, bytes_after;
@@ -156,7 +159,7 @@ void Ewmh::updateClientList(BScreen &screen) {
156 159
157 //number of windows to show in client list 160 //number of windows to show in client list
158 num = win; 161 num = win;
159 XChangeProperty(BaseDisplay::getXDisplay(), 162 XChangeProperty(FbTk::App::instance()->display(),
160 screen.getRootWindow(), 163 screen.getRootWindow(),
161 m_net_client_list, 164 m_net_client_list,
162 XA_CARDINAL, 32, 165 XA_CARDINAL, 32,
@@ -177,7 +180,7 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
177 } 180 }
178 181
179 if (XStringListToTextProperty(names, number_of_desks, &text)) { 182 if (XStringListToTextProperty(names, number_of_desks, &text)) {
180 XSetTextProperty(BaseDisplay::getXDisplay(), screen.getRootWindow(), 183 XSetTextProperty(FbTk::App::instance()->display(), screen.getRootWindow(),
181 &text, m_net_desktop_names); 184 &text, m_net_desktop_names);
182 XFree(text.value); 185 XFree(text.value);
183 } 186 }
@@ -188,7 +191,7 @@ void Ewmh::updateWorkspaceNames(BScreen &screen) {
188 191
189void Ewmh::updateCurrentWorkspace(BScreen &screen) { 192void Ewmh::updateCurrentWorkspace(BScreen &screen) {
190 size_t workspace = screen.getCurrentWorkspaceID(); 193 size_t workspace = screen.getCurrentWorkspaceID();
191 XChangeProperty(BaseDisplay::getXDisplay(), 194 XChangeProperty(FbTk::App::instance()->display(),
192 screen.getRootWindow(), 195 screen.getRootWindow(),
193 m_net_current_desktop, XA_CARDINAL, 32, PropModeReplace, 196 m_net_current_desktop, XA_CARDINAL, 32, PropModeReplace,
194 (unsigned char *)&workspace, 1); 197 (unsigned char *)&workspace, 1);
@@ -197,7 +200,7 @@ void Ewmh::updateCurrentWorkspace(BScreen &screen) {
197 200
198void Ewmh::updateWorkspaceCount(BScreen &screen) { 201void Ewmh::updateWorkspaceCount(BScreen &screen) {
199 size_t numworkspaces = screen.getCount(); 202 size_t numworkspaces = screen.getCount();
200 XChangeProperty(BaseDisplay::getXDisplay(), screen.getRootWindow(), 203 XChangeProperty(FbTk::App::instance()->display(), screen.getRootWindow(),
201 m_net_number_of_desktops, XA_CARDINAL, 32, PropModeReplace, 204 m_net_number_of_desktops, XA_CARDINAL, 32, PropModeReplace,
202 (unsigned char *)&numworkspaces, 1); 205 (unsigned char *)&numworkspaces, 1);
203} 206}
@@ -219,7 +222,7 @@ void Ewmh::updateWorkspace(FluxboxWindow &win) {
219 if (win.isStuck()) 222 if (win.isStuck())
220 workspace = 0xFFFFFFFF; // appear on all desktops/workspaces 223 workspace = 0xFFFFFFFF; // appear on all desktops/workspaces
221 224
222 XChangeProperty(BaseDisplay::getXDisplay(), win.getClientWindow(), 225 XChangeProperty(FbTk::App::instance()->display(), win.getClientWindow(),
223 m_net_wm_desktop, XA_CARDINAL, 32, PropModeReplace, 226 m_net_wm_desktop, XA_CARDINAL, 32, PropModeReplace,
224 (unsigned char *)&workspace, 1); 227 (unsigned char *)&workspace, 1);
225} 228}
@@ -232,7 +235,8 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, F
232 return true; 235 return true;
233 // ce.data.l[0] = workspace number 236 // ce.data.l[0] = workspace number
234 // valid window and workspace number? 237 // valid window and workspace number?
235 if (win == 0 || static_cast<unsigned int>(ce.data.l[0]) >= screen->getCount()) 238 if (win == 0 ||
239 static_cast<unsigned int>(ce.data.l[0]) >= screen->getCount())
236 return true; 240 return true;
237 241
238 screen->sendToWorkspace(ce.data.l[0], win, false); 242 screen->sendToWorkspace(ce.data.l[0], win, false);
@@ -327,7 +331,7 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, BScreen * screen, F
327 331
328 332
329void Ewmh::createAtoms() { 333void Ewmh::createAtoms() {
330 Display *disp = BaseDisplay::getXDisplay(); 334 Display *disp = FbTk::App::instance()->display();
331 m_net_supported = XInternAtom(disp, "_NET_SUPPORTED", False); 335 m_net_supported = XInternAtom(disp, "_NET_SUPPORTED", False);
332 m_net_client_list = XInternAtom(disp, "_NET_CLIENT_LIST", False); 336 m_net_client_list = XInternAtom(disp, "_NET_CLIENT_LIST", False);
333 m_net_client_list_stacking = XInternAtom(disp, "_NET_CLIENT_LIST_STACKING", False); 337 m_net_client_list_stacking = XInternAtom(disp, "_NET_CLIENT_LIST_STACKING", False);