diff options
Diffstat (limited to 'src/Netizen.cc')
-rw-r--r-- | src/Netizen.cc | 133 |
1 files changed, 50 insertions, 83 deletions
diff --git a/src/Netizen.cc b/src/Netizen.cc index 24f4a4c..c9a58f5 100644 --- a/src/Netizen.cc +++ b/src/Netizen.cc | |||
@@ -1,3 +1,6 @@ | |||
1 | // Netizen.cc for Fluxbox | ||
2 | // Copyright (c) 2001-2003 Henrik Kinnunen (fluxgen(at)users.sourceforge.net) | ||
3 | // | ||
1 | // Netizen.cc for Blackbox - An X11 Window Manager | 4 | // Netizen.cc for Blackbox - An X11 Window Manager |
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 5 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
3 | // | 6 | // |
@@ -13,133 +16,97 @@ | |||
13 | // | 16 | // |
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | 19 | // 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 | 20 | // 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 | 21 | // 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 | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
21 | 24 | ||
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" | 25 | #include "Netizen.hh" |
33 | 26 | ||
27 | #include "Screen.hh" | ||
28 | #include "FbAtoms.hh" | ||
29 | |||
30 | #include "FbTk/App.hh" | ||
34 | 31 | ||
35 | Netizen::Netizen(BScreen *scr, Window win) { | 32 | Netizen::Netizen(const BScreen &scr, Window win): |
36 | screen = scr; | 33 | m_screen(scr), |
37 | basedisplay = screen->getBaseDisplay(); | 34 | m_display(FbTk::App::instance()->display()), |
38 | window = win; | 35 | m_window(win) { |
39 | 36 | ||
40 | event.type = ClientMessage; | 37 | event.type = ClientMessage; |
41 | event.xclient.message_type = basedisplay->getFluxboxStructureMessagesAtom(); | 38 | event.xclient.message_type = FbAtoms::instance()->getFluxboxStructureMessagesAtom(); |
42 | event.xclient.display = basedisplay->getXDisplay(); | 39 | event.xclient.display = m_display; |
43 | event.xclient.window = window; | 40 | event.xclient.window = window(); |
44 | event.xclient.format = 32; | 41 | event.xclient.format = 32; |
45 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyStartupAtom(); | 42 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyStartupAtom(); |
46 | event.xclient.data.l[1] = event.xclient.data.l[2] = | 43 | event.xclient.data.l[1] = event.xclient.data.l[2] = |
47 | event.xclient.data.l[3] = event.xclient.data.l[4] = 0l; | 44 | event.xclient.data.l[3] = event.xclient.data.l[4] = 0l; |
48 | 45 | ||
49 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 46 | XSendEvent(m_display, window(), False, NoEventMask, &event); |
50 | } | 47 | } |
51 | 48 | ||
52 | 49 | ||
53 | void Netizen::sendWorkspaceCount(void) { | 50 | void Netizen::sendWorkspaceCount() { |
54 | 51 | ||
55 | #ifdef GNOME | 52 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWorkspaceCountAtom(); |
56 | /* long val = screen->getCount(); | 53 | event.xclient.data.l[1] = m_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 | 54 | ||
80 | void Netizen::sendCurrentWorkspace(void) { | 55 | XSendEvent(m_display, window(), False, NoEventMask, &event); |
81 | #ifdef GNOME | 56 | } |
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 | 57 | ||
89 | #endif | ||
90 | 58 | ||
91 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyCurrentWorkspaceAtom(); | 59 | void Netizen::sendCurrentWorkspace() { |
92 | event.xclient.data.l[1] = screen->getCurrentWorkspaceID(); | ||
93 | 60 | ||
94 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 61 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyCurrentWorkspaceAtom(); |
62 | event.xclient.data.l[1] = m_screen.currentWorkspaceID(); | ||
95 | 63 | ||
64 | XSendEvent(m_display, window(), False, NoEventMask, &event); | ||
96 | } | 65 | } |
97 | 66 | ||
98 | 67 | ||
99 | void Netizen::sendWindowFocus(Window w) { | 68 | void Netizen::sendWindowFocus(Window w) { |
100 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowFocusAtom(); | 69 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowFocusAtom(); |
101 | event.xclient.data.l[1] = w; | 70 | event.xclient.data.l[1] = w; |
102 | 71 | ||
103 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 72 | XSendEvent(m_display, window(), False, NoEventMask, &event); |
104 | } | 73 | } |
105 | 74 | ||
106 | 75 | ||
107 | void Netizen::sendWindowAdd(Window w, unsigned long p) { | 76 | void Netizen::sendWindowAdd(Window w, unsigned long wkspc) { |
108 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowAddAtom(); | 77 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowAddAtom(); |
109 | event.xclient.data.l[1] = w; | 78 | event.xclient.data.l[1] = w; |
110 | event.xclient.data.l[2] = p; | 79 | event.xclient.data.l[2] = wkspc; |
111 | 80 | ||
112 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 81 | XSendEvent(m_display, window(), False, NoEventMask, &event); |
113 | 82 | ||
114 | event.xclient.data.l[2] = 0l; | 83 | event.xclient.data.l[2] = 0l; |
115 | } | 84 | } |
116 | 85 | ||
117 | 86 | ||
118 | void Netizen::sendWindowDel(Window w) { | 87 | void Netizen::sendWindowDel(Window w) { |
119 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowDelAtom(); | 88 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowDelAtom(); |
120 | event.xclient.data.l[1] = w; | 89 | event.xclient.data.l[1] = w; |
121 | 90 | ||
122 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 91 | XSendEvent(m_display, window(), False, NoEventMask, &event); |
123 | } | 92 | } |
124 | 93 | ||
125 | 94 | ||
126 | void Netizen::sendWindowRaise(Window w) { | 95 | void Netizen::sendWindowRaise(Window w) { |
127 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowRaiseAtom(); | 96 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowRaiseAtom(); |
128 | event.xclient.data.l[1] = w; | 97 | event.xclient.data.l[1] = w; |
129 | 98 | ||
130 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 99 | XSendEvent(m_display, window(), False, NoEventMask, &event); |
131 | } | 100 | } |
132 | 101 | ||
133 | 102 | ||
134 | void Netizen::sendWindowLower(Window w) { | 103 | void Netizen::sendWindowLower(Window w) { |
135 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowLowerAtom(); | 104 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowLowerAtom(); |
136 | event.xclient.data.l[1] = w; | 105 | event.xclient.data.l[1] = w; |
137 | 106 | ||
138 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 107 | XSendEvent(m_display, window(), False, NoEventMask, &event); |
139 | } | 108 | } |
140 | 109 | ||
141 | 110 | void Netizen::sendConfigNotify(XEvent &ev) { | |
142 | void Netizen::sendConfigNotify(XEvent *e) { | 111 | XSendEvent(m_display, window(), False, StructureNotifyMask, &ev); |
143 | XSendEvent(basedisplay->getXDisplay(), window, False, | ||
144 | StructureNotifyMask, e); | ||
145 | } | 112 | } |