aboutsummaryrefslogtreecommitdiff
path: root/src/Netizen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Netizen.cc')
-rw-r--r--src/Netizen.cc131
1 files changed, 51 insertions, 80 deletions
diff --git a/src/Netizen.cc b/src/Netizen.cc
index 24f4a4c..bfc32a0 100644
--- a/src/Netizen.cc
+++ b/src/Netizen.cc
@@ -13,133 +13,104 @@
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// stupid macros needed to access some functions in version 2 of the GNU C
23// library
24#ifndef _GNU_SOURCE
25#define _GNU_SOURCE
26#endif // _GNU_SOURCE
27
28#ifdef HAVE_CONFIG_H
29#include "../config.h"
30#endif // HAVE_CONFIG_H
31
32#include "Netizen.hh" 22#include "Netizen.hh"
33 23
24#include "Screen.hh"
34 25
35Netizen::Netizen(BScreen *scr, Window win) { 26// use GNU extensions
36 screen = scr; 27#ifndef _GNU_SOURCE
37 basedisplay = screen->getBaseDisplay(); 28#define _GNU_SOURCE
38 window = win; 29#endif // _GNU_SOURCE
39 30
40 event.type = ClientMessage; 31#ifdef HAVE_CONFIG_H
41 event.xclient.message_type = basedisplay->getFluxboxStructureMessagesAtom(); 32#include "../config.h"
42 event.xclient.display = basedisplay->getXDisplay(); 33#endif // HAVE_CONFIG_H
43 event.xclient.window = window;
44 event.xclient.format = 32;
45 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyStartupAtom();
46 event.xclient.data.l[1] = event.xclient.data.l[2] =
47 event.xclient.data.l[3] = event.xclient.data.l[4] = 0l;
48 34
49 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); 35Netizen::Netizen(BScreen *scr, Window win):
36screen(scr),
37m_display(scr->getBaseDisplay()->getXDisplay()),
38window(win) {
39 window = win;
40
41 event.type = ClientMessage;
42 event.xclient.message_type = FbAtoms::instance()->getFluxboxStructureMessagesAtom();
43 event.xclient.display = m_display;
44 event.xclient.window = window;
45 event.xclient.format = 32;
46 event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyStartupAtom();
47 event.xclient.data.l[1] = event.xclient.data.l[2] =
48 event.xclient.data.l[3] = event.xclient.data.l[4] = 0l;
49
50 XSendEvent(m_display, window, False, NoEventMask, &event);
50} 51}
51 52
52 53
53void Netizen::sendWorkspaceCount(void) { 54void Netizen::sendWorkspaceCount() {
54 55
55 #ifdef GNOME 56 event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWorkspaceCountAtom();
56/* long val = screen->getCount(); 57 event.xclient.data.l[1] = screen->getCount();
57 XChangeProperty(basedisplay->getXDisplay(), screen->getRootWindow(),
58 basedisplay->getGnomeWorkspaceCountAtom(), XA_CARDINAL, 32,
59 PropModeReplace, (unsigned char *)&val, 1);*/
60 printf("UPDATE!\n");
61 unsigned long data=(unsigned long) screen->getCount();
62 Atom atom_set;
63 // CARD32 val;
64
65 atom_set = XInternAtom(basedisplay->getXDisplay(), "_WIN_WORKSPACE_COUNT", False);
66 // val = mode.numdesktops;
67 XChangeProperty(basedisplay->getXDisplay(), window, atom_set,
68 XA_CARDINAL, 32, PropModeReplace,(unsigned char *)&data, 1);
69 #endif //GNOME
70
71 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWorkspaceCountAtom();
72 event.xclient.data.l[1] = screen->getCount();
73
74 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
75
76
77}
78 58
59 XSendEvent(m_display, window, False, NoEventMask, &event);
60}
79 61
80void Netizen::sendCurrentWorkspace(void) {
81 #ifdef GNOME
82 //update atom to workspace
83 long val;
84 val = screen->getCurrentWorkspaceID();
85 XChangeProperty(basedisplay->getXDisplay(), screen->getRootWindow(),
86 basedisplay->getGnomeWorkspaceAtom(), XA_CARDINAL, 32,
87 PropModeReplace, (unsigned char *)&val, 1);
88 62
89 #endif 63void Netizen::sendCurrentWorkspace() {
90 64
91 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyCurrentWorkspaceAtom(); 65 event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyCurrentWorkspaceAtom();
92 event.xclient.data.l[1] = screen->getCurrentWorkspaceID(); 66 event.xclient.data.l[1] = screen->getCurrentWorkspaceID();
93 67
94 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); 68 XSendEvent(m_display, window, False, NoEventMask, &event);
95
96} 69}
97 70
98 71
99void Netizen::sendWindowFocus(Window w) { 72void Netizen::sendWindowFocus(Window w) {
100 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowFocusAtom(); 73 event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowFocusAtom();
101 event.xclient.data.l[1] = w; 74 event.xclient.data.l[1] = w;
102 75
103 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); 76 XSendEvent(m_display, window, False, NoEventMask, &event);
104} 77}
105 78
106 79
107void Netizen::sendWindowAdd(Window w, unsigned long p) { 80void Netizen::sendWindowAdd(Window w, unsigned long p) {
108 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowAddAtom(); 81 event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowAddAtom();
109 event.xclient.data.l[1] = w; 82 event.xclient.data.l[1] = w;
110 event.xclient.data.l[2] = p; 83 event.xclient.data.l[2] = p;
111 84
112 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); 85 XSendEvent(m_display, window, False, NoEventMask, &event);
113 86
114 event.xclient.data.l[2] = 0l; 87 event.xclient.data.l[2] = 0l;
115} 88}
116 89
117 90
118void Netizen::sendWindowDel(Window w) { 91void Netizen::sendWindowDel(Window w) {
119 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowDelAtom(); 92 event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowDelAtom();
120 event.xclient.data.l[1] = w; 93 event.xclient.data.l[1] = w;
121 94
122 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); 95 XSendEvent(m_display, window, False, NoEventMask, &event);
123} 96}
124 97
125 98
126void Netizen::sendWindowRaise(Window w) { 99void Netizen::sendWindowRaise(Window w) {
127 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowRaiseAtom(); 100 event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowRaiseAtom();
128 event.xclient.data.l[1] = w; 101 event.xclient.data.l[1] = w;
129 102
130 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); 103 XSendEvent(m_display, window, False, NoEventMask, &event);
131} 104}
132 105
133 106
134void Netizen::sendWindowLower(Window w) { 107void Netizen::sendWindowLower(Window w) {
135 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowLowerAtom(); 108 event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowLowerAtom();
136 event.xclient.data.l[1] = w; 109 event.xclient.data.l[1] = w;
137 110
138 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); 111 XSendEvent(m_display, window, False, NoEventMask, &event);
139} 112}
140 113
141
142void Netizen::sendConfigNotify(XEvent *e) { 114void Netizen::sendConfigNotify(XEvent *e) {
143 XSendEvent(basedisplay->getXDisplay(), window, False, 115 XSendEvent(m_display, window, False, StructureNotifyMask, e);
144 StructureNotifyMask, e);
145} 116}