1 // Netizen.cc for Openbox
2 // Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
3 // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
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
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 // DEALINGS IN THE SOFTWARE.
23 // stupid macros needed to access some functions in version 2 of the GNU C
30 #include "../config.h"
31 #endif // HAVE_CONFIG_H
36 Netizen::Netizen(BScreen *scr, Window win) {
38 basedisplay = screen->getBaseDisplay();
41 event.type = ClientMessage;
42 event.xclient.message_type = basedisplay->getOpenboxStructureMessagesAtom();
43 event.xclient.display = basedisplay->getXDisplay();
44 event.xclient.window = window;
45 event.xclient.format = 32;
46 event.xclient.data.l[0] = basedisplay->getOpenboxNotifyStartupAtom();
47 event.xclient.data.l[1] = event.xclient.data.l[2] =
48 event.xclient.data.l[3] = event.xclient.data.l[4] = 0l;
50 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
54 void Netizen::sendWorkspaceCount(void) {
55 event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWorkspaceCountAtom();
56 event.xclient.data.l[1] = screen->getCount();
58 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
62 void Netizen::sendCurrentWorkspace(void) {
63 event.xclient.data.l[0] = basedisplay->getOpenboxNotifyCurrentWorkspaceAtom();
64 event.xclient.data.l[1] = screen->getCurrentWorkspaceID();
66 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
70 void Netizen::sendWindowFocus(Window w) {
71 event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowFocusAtom();
72 event.xclient.data.l[1] = w;
74 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
78 void Netizen::sendWindowAdd(Window w, unsigned long p) {
79 event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowAddAtom();
80 event.xclient.data.l[1] = w;
81 event.xclient.data.l[2] = p;
83 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
85 event.xclient.data.l[2] = 0l;
89 void Netizen::sendWindowDel(Window w) {
90 event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowDelAtom();
91 event.xclient.data.l[1] = w;
93 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
97 void Netizen::sendWindowRaise(Window w) {
98 event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowRaiseAtom();
99 event.xclient.data.l[1] = w;
101 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
105 void Netizen::sendWindowLower(Window w) {
106 event.xclient.data.l[0] = basedisplay->getOpenboxNotifyWindowLowerAtom();
107 event.xclient.data.l[1] = w;
109 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
113 void Netizen::sendConfigNotify(XEvent *e) {
114 XSendEvent(basedisplay->getXDisplay(), window, False,
115 StructureNotifyMask, e);