aboutsummaryrefslogtreecommitdiff
path: root/src/Netizen.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2001-12-11 20:47:02 (GMT)
committerfluxgen <fluxgen>2001-12-11 20:47:02 (GMT)
commit18830ac9add80cbd3bf7369307d7e35a519dca9b (patch)
tree4759a5434a34ba317fe77bbf8b0ed9bb57bb6018 /src/Netizen.cc
parent1523b48bff07dead084af3064ad11c79a9b25df0 (diff)
downloadfluxbox-18830ac9add80cbd3bf7369307d7e35a519dca9b.zip
fluxbox-18830ac9add80cbd3bf7369307d7e35a519dca9b.tar.bz2
Initial revision
Diffstat (limited to 'src/Netizen.cc')
-rw-r--r--src/Netizen.cc145
1 files changed, 145 insertions, 0 deletions
diff --git a/src/Netizen.cc b/src/Netizen.cc
new file mode 100644
index 0000000..24f4a4c
--- /dev/null
+++ b/src/Netizen.cc
@@ -0,0 +1,145 @@
1// Netizen.cc for Blackbox - An X11 Window Manager
2// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
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,
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
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
20// DEALINGS IN THE SOFTWARE.
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"
33
34
35Netizen::Netizen(BScreen *scr, Window win) {
36 screen = scr;
37 basedisplay = screen->getBaseDisplay();
38 window = win;
39
40 event.type = ClientMessage;
41 event.xclient.message_type = basedisplay->getFluxboxStructureMessagesAtom();
42 event.xclient.display = basedisplay->getXDisplay();
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
49 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
50}
51
52
53void Netizen::sendWorkspaceCount(void) {
54
55 #ifdef GNOME
56/* long val = 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
79
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
89 #endif
90
91 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyCurrentWorkspaceAtom();
92 event.xclient.data.l[1] = screen->getCurrentWorkspaceID();
93
94 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
95
96}
97
98
99void Netizen::sendWindowFocus(Window w) {
100 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowFocusAtom();
101 event.xclient.data.l[1] = w;
102
103 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
104}
105
106
107void Netizen::sendWindowAdd(Window w, unsigned long p) {
108 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowAddAtom();
109 event.xclient.data.l[1] = w;
110 event.xclient.data.l[2] = p;
111
112 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
113
114 event.xclient.data.l[2] = 0l;
115}
116
117
118void Netizen::sendWindowDel(Window w) {
119 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowDelAtom();
120 event.xclient.data.l[1] = w;
121
122 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
123}
124
125
126void Netizen::sendWindowRaise(Window w) {
127 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowRaiseAtom();
128 event.xclient.data.l[1] = w;
129
130 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
131}
132
133
134void Netizen::sendWindowLower(Window w) {
135 event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowLowerAtom();
136 event.xclient.data.l[1] = w;
137
138 XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event);
139}
140
141
142void Netizen::sendConfigNotify(XEvent *e) {
143 XSendEvent(basedisplay->getXDisplay(), window, False,
144 StructureNotifyMask, e);
145}