aboutsummaryrefslogtreecommitdiff
path: root/src/WinClient.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-09-14 23:27:27 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-09-14 23:27:27 (GMT)
commitba316aa18a8813958cedea1cc4d54452e40c4b59 (patch)
tree0ec88a1cceff2e937a6cda6098cbd9598209959e /src/WinClient.cc
parent52f614b59853e425f34790f1795d66f93781f95b (diff)
downloadfluxbox-ba316aa18a8813958cedea1cc4d54452e40c4b59.zip
fluxbox-ba316aa18a8813958cedea1cc4d54452e40c4b59.tar.bz2
code cleanup, missing commit for 2b62cf973318978bc222db7719552148275887db
Diffstat (limited to 'src/WinClient.cc')
-rw-r--r--src/WinClient.cc53
1 files changed, 23 insertions, 30 deletions
diff --git a/src/WinClient.cc b/src/WinClient.cc
index 8b9e0f6..33d9fb4 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -57,6 +57,24 @@ using std::cerr;
57using std::hex; 57using std::hex;
58using std::dec; 58using std::dec;
59 59
60namespace {
61
62void sendMessage(const WinClient& win, Atom atom, Time time) {
63 XEvent ce;
64 ce.xclient.type = ClientMessage;
65 ce.xclient.message_type = FbAtoms::instance()->getWMProtocolsAtom();
66 ce.xclient.display = win.display();
67 ce.xclient.window = win.window();
68 ce.xclient.format = 32;
69 ce.xclient.data.l[0] = atom;
70 ce.xclient.data.l[1] = time;
71 ce.xclient.data.l[2] = 0l;
72 ce.xclient.data.l[3] = 0l;
73 ce.xclient.data.l[4] = 0l;
74 XSendEvent(win.display(), win.window(), false, NoEventMask, &ce);
75}
76
77} // end of anonymous namespace
60 78
61WinClient::TransientWaitMap WinClient::s_transient_wait; 79WinClient::TransientWaitMap WinClient::s_transient_wait;
62 80
@@ -176,19 +194,7 @@ bool WinClient::sendFocus() {
176 " window = 0x"<<hex<<window()<<dec<<endl; 194 " window = 0x"<<hex<<window()<<dec<<endl;
177 195
178 // setup focus msg 196 // setup focus msg
179 XEvent ce; 197 sendMessage(*this, FbAtoms::instance()->getWMTakeFocusAtom(), Fluxbox::instance()->getLastTime());
180 ce.xclient.type = ClientMessage;
181 ce.xclient.message_type = FbAtoms::instance()->getWMProtocolsAtom();
182 ce.xclient.display = display();
183 ce.xclient.window = window();
184 ce.xclient.format = 32;
185 ce.xclient.data.l[0] = FbAtoms::instance()->getWMTakeFocusAtom();
186 ce.xclient.data.l[1] = Fluxbox::instance()->getLastTime();
187 ce.xclient.data.l[2] = 0l;
188 ce.xclient.data.l[3] = 0l;
189 ce.xclient.data.l[4] = 0l;
190 // send focus msg
191 XSendEvent(display(), window(), false, NoEventMask, &ce);
192 FocusControl::setExpectingFocus(this); 198 FocusControl::setExpectingFocus(this);
193 return true; 199 return true;
194} 200}
@@ -198,20 +204,7 @@ void WinClient::sendClose(bool forceful) {
198 XKillClient(display(), window()); 204 XKillClient(display(), window());
199 else { 205 else {
200 // send WM_DELETE message 206 // send WM_DELETE message
201 // fill in XClientMessage structure for delete message 207 sendMessage(*this, FbAtoms::instance()->getWMDeleteAtom(), CurrentTime);
202 XEvent ce;
203 ce.xclient.type = ClientMessage;
204 ce.xclient.message_type = FbAtoms::instance()->getWMProtocolsAtom();
205 ce.xclient.display = display();
206 ce.xclient.window = window();
207 ce.xclient.format = 32;
208 ce.xclient.data.l[0] = FbAtoms::instance()->getWMDeleteAtom();
209 ce.xclient.data.l[1] = CurrentTime;
210 ce.xclient.data.l[2] = 0l;
211 ce.xclient.data.l[3] = 0l;
212 ce.xclient.data.l[4] = 0l;
213 // send event delete message to client window
214 XSendEvent(display(), window(), false, NoEventMask, &ce);
215 } 208 }
216} 209}
217 210
@@ -437,7 +430,7 @@ Window WinClient::getGroupLeftWindow() const {
437 int format; 430 int format;
438 Atom atom_return; 431 Atom atom_return;
439 unsigned long num = 0, len = 0; 432 unsigned long num = 0, len = 0;
440 Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False); 433 static Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False);
441 434
442 Window *data = 0; 435 Window *data = 0;
443 if (property(group_left_hint, 0, 436 if (property(group_left_hint, 0,
@@ -462,7 +455,7 @@ Window WinClient::getGroupLeftWindow() const {
462void WinClient::setGroupLeftWindow(Window win) { 455void WinClient::setGroupLeftWindow(Window win) {
463 if (m_screen.isShuttingdown()) 456 if (m_screen.isShuttingdown())
464 return; 457 return;
465 Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False); 458 static Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False);
466 changeProperty(group_left_hint, XA_WINDOW, 32, 459 changeProperty(group_left_hint, XA_WINDOW, 32,
467 PropModeReplace, (unsigned char *) &win, 1); 460 PropModeReplace, (unsigned char *) &win, 1);
468} 461}
@@ -473,7 +466,7 @@ bool WinClient::hasGroupLeftWindow() const {
473 int format; 466 int format;
474 Atom atom_return; 467 Atom atom_return;
475 unsigned long num = 0, len = 0; 468 unsigned long num = 0, len = 0;
476 Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False); 469 static Atom group_left_hint = XInternAtom(display(), "_FLUXBOX_GROUP_LEFT", False);
477 470
478 Window *data = 0; 471 Window *data = 0;
479 if (property(group_left_hint, 0, 472 if (property(group_left_hint, 0,