]> icculus.org git repositories - mikachu/openbox.git/blob - src/Netizen.cc
use the raw screen size not the strut adjusted size to determine max_height and width...
[mikachu/openbox.git] / src / Netizen.cc
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
2 // Netizen.cc for Blackbox - An X11 Window Manager
3 // Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
4 // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a
7 // copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the
11 // Software is furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 // DEALINGS IN THE SOFTWARE.
23
24 #ifdef    HAVE_CONFIG_H
25 #include "../config.h"
26 #endif // HAVE_CONFIG_H
27
28 #include "Netizen.hh"
29 #include "Screen.hh"
30
31 Netizen::Netizen(BScreen *scr, Window win) {
32   screen = scr;
33   blackbox = scr->getBlackbox();
34   window = win;
35
36   event.type = ClientMessage;
37   event.xclient.message_type =
38     blackbox->getBlackboxStructureMessagesAtom();
39   event.xclient.display = blackbox->getXDisplay();
40   event.xclient.window = window;
41   event.xclient.format = 32;
42   event.xclient.data.l[0] = blackbox->getBlackboxNotifyStartupAtom();
43   event.xclient.data.l[1] = event.xclient.data.l[2] =
44     event.xclient.data.l[3] = event.xclient.data.l[4] = 0l;
45
46   XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
47 }
48
49
50 void Netizen::sendWorkspaceCount(void) {
51   event.xclient.data.l[0] =
52     blackbox->getBlackboxNotifyWorkspaceCountAtom();
53   event.xclient.data.l[1] = screen->getWorkspaceCount();
54
55   XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
56 }
57
58
59 void Netizen::sendCurrentWorkspace(void) {
60   event.xclient.data.l[0] =
61     blackbox->getBlackboxNotifyCurrentWorkspaceAtom();
62   event.xclient.data.l[1] = screen->getCurrentWorkspaceID();
63
64   XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
65 }
66
67
68 void Netizen::sendWindowFocus(Window w) {
69   event.xclient.data.l[0] = blackbox->getBlackboxNotifyWindowFocusAtom();
70   event.xclient.data.l[1] = w;
71
72   XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
73 }
74
75
76 void Netizen::sendWindowAdd(Window w, unsigned long p) {
77   event.xclient.data.l[0] = blackbox->getBlackboxNotifyWindowAddAtom();
78   event.xclient.data.l[1] = w;
79   event.xclient.data.l[2] = p;
80
81   XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
82
83   event.xclient.data.l[2] = 0l;
84 }
85
86
87 void Netizen::sendWindowDel(Window w) {
88   event.xclient.data.l[0] = blackbox->getBlackboxNotifyWindowDelAtom();
89   event.xclient.data.l[1] = w;
90
91   XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
92 }
93
94
95 void Netizen::sendWindowRaise(Window w) {
96   event.xclient.data.l[0] = blackbox->getBlackboxNotifyWindowRaiseAtom();
97   event.xclient.data.l[1] = w;
98
99   XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
100 }
101
102
103 void Netizen::sendWindowLower(Window w) {
104   event.xclient.data.l[0] = blackbox->getBlackboxNotifyWindowLowerAtom();
105   event.xclient.data.l[1] = w;
106
107   XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
108 }
109
110
111 void Netizen::sendConfigNotify(XEvent *e) {
112   XSendEvent(blackbox->getXDisplay(), window, False,
113              StructureNotifyMask, e);
114 }