diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Netizen.cc | 82 | ||||
-rw-r--r-- | src/Netizen.hh | 38 |
2 files changed, 58 insertions, 62 deletions
diff --git a/src/Netizen.cc b/src/Netizen.cc index f23ec13..8117ae1 100644 --- a/src/Netizen.cc +++ b/src/Netizen.cc | |||
@@ -13,7 +13,7 @@ | |||
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 |
@@ -21,43 +21,44 @@ | |||
21 | 21 | ||
22 | // stupid macros needed to access some functions in version 2 of the GNU C | 22 | // stupid macros needed to access some functions in version 2 of the GNU C |
23 | // library | 23 | // library |
24 | #ifndef _GNU_SOURCE | 24 | #ifndef _GNU_SOURCE |
25 | #define _GNU_SOURCE | 25 | #define _GNU_SOURCE |
26 | #endif // _GNU_SOURCE | 26 | #endif // _GNU_SOURCE |
27 | 27 | ||
28 | #ifdef HAVE_CONFIG_H | 28 | #ifdef HAVE_CONFIG_H |
29 | #include "../config.h" | 29 | #include "../config.h" |
30 | #endif // HAVE_CONFIG_H | 30 | #endif // HAVE_CONFIG_H |
31 | 31 | ||
32 | #include "Netizen.hh" | 32 | #include "Netizen.hh" |
33 | 33 | ||
34 | 34 | ||
35 | Netizen::Netizen(BScreen *scr, Window win) { | 35 | Netizen::Netizen(BScreen *scr, Window win): |
36 | screen = scr; | 36 | screen(scr), |
37 | basedisplay = screen->getBaseDisplay(); | 37 | basedisplay(screen->getBaseDisplay()), |
38 | window = win; | 38 | window(win) { |
39 | screen = scr; | ||
40 | basedisplay = screen->getBaseDisplay(); | ||
41 | window = win; | ||
39 | 42 | ||
40 | event.type = ClientMessage; | 43 | event.type = ClientMessage; |
41 | event.xclient.message_type = basedisplay->getFluxboxStructureMessagesAtom(); | 44 | event.xclient.message_type = basedisplay->getFluxboxStructureMessagesAtom(); |
42 | event.xclient.display = basedisplay->getXDisplay(); | 45 | event.xclient.display = basedisplay->getXDisplay(); |
43 | event.xclient.window = window; | 46 | event.xclient.window = window; |
44 | event.xclient.format = 32; | 47 | event.xclient.format = 32; |
45 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyStartupAtom(); | 48 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyStartupAtom(); |
46 | event.xclient.data.l[1] = event.xclient.data.l[2] = | 49 | event.xclient.data.l[1] = event.xclient.data.l[2] = |
47 | event.xclient.data.l[3] = event.xclient.data.l[4] = 0l; | 50 | event.xclient.data.l[3] = event.xclient.data.l[4] = 0l; |
48 | 51 | ||
49 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 52 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
50 | } | 53 | } |
51 | 54 | ||
52 | 55 | ||
53 | void Netizen::sendWorkspaceCount(void) { | 56 | void Netizen::sendWorkspaceCount(void) { |
54 | 57 | ||
55 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWorkspaceCountAtom(); | 58 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWorkspaceCountAtom(); |
56 | event.xclient.data.l[1] = screen->getCount(); | 59 | event.xclient.data.l[1] = screen->getCount(); |
57 | 60 | ||
58 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 61 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
59 | |||
60 | |||
61 | } | 62 | } |
62 | 63 | ||
63 | 64 | ||
@@ -67,54 +68,53 @@ void Netizen::sendCurrentWorkspace(void) { | |||
67 | event.xclient.data.l[1] = screen->getCurrentWorkspaceID(); | 68 | event.xclient.data.l[1] = screen->getCurrentWorkspaceID(); |
68 | 69 | ||
69 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 70 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
70 | |||
71 | } | 71 | } |
72 | 72 | ||
73 | 73 | ||
74 | void Netizen::sendWindowFocus(Window w) { | 74 | void Netizen::sendWindowFocus(Window w) { |
75 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowFocusAtom(); | 75 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowFocusAtom(); |
76 | event.xclient.data.l[1] = w; | 76 | event.xclient.data.l[1] = w; |
77 | 77 | ||
78 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 78 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | void Netizen::sendWindowAdd(Window w, unsigned long p) { | 82 | void Netizen::sendWindowAdd(Window w, unsigned long p) { |
83 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowAddAtom(); | 83 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowAddAtom(); |
84 | event.xclient.data.l[1] = w; | 84 | event.xclient.data.l[1] = w; |
85 | event.xclient.data.l[2] = p; | 85 | event.xclient.data.l[2] = p; |
86 | 86 | ||
87 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 87 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
88 | 88 | ||
89 | event.xclient.data.l[2] = 0l; | 89 | event.xclient.data.l[2] = 0l; |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | void Netizen::sendWindowDel(Window w) { | 93 | void Netizen::sendWindowDel(Window w) { |
94 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowDelAtom(); | 94 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowDelAtom(); |
95 | event.xclient.data.l[1] = w; | 95 | event.xclient.data.l[1] = w; |
96 | 96 | ||
97 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 97 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | void Netizen::sendWindowRaise(Window w) { | 101 | void Netizen::sendWindowRaise(Window w) { |
102 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowRaiseAtom(); | 102 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowRaiseAtom(); |
103 | event.xclient.data.l[1] = w; | 103 | event.xclient.data.l[1] = w; |
104 | 104 | ||
105 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 105 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | void Netizen::sendWindowLower(Window w) { | 109 | void Netizen::sendWindowLower(Window w) { |
110 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowLowerAtom(); | 110 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowLowerAtom(); |
111 | event.xclient.data.l[1] = w; | 111 | event.xclient.data.l[1] = w; |
112 | 112 | ||
113 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 113 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | void Netizen::sendConfigNotify(XEvent *e) { | 117 | void Netizen::sendConfigNotify(XEvent *e) { |
118 | XSendEvent(basedisplay->getXDisplay(), window, False, | 118 | XSendEvent(basedisplay->getXDisplay(), window, False, |
119 | StructureNotifyMask, e); | 119 | StructureNotifyMask, e); |
120 | } | 120 | } |
diff --git a/src/Netizen.hh b/src/Netizen.hh index 1c4a2b4..bb12735 100644 --- a/src/Netizen.hh +++ b/src/Netizen.hh | |||
@@ -13,14 +13,14 @@ | |||
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 | #ifndef _NETIZEN_HH_ | 22 | #ifndef _NETIZEN_HH_ |
23 | #define _NETIZEN_HH_ | 23 | #define _NETIZEN_HH_ |
24 | 24 | ||
25 | // forward declaration | 25 | // forward declaration |
26 | class Netizen; | 26 | class Netizen; |
@@ -33,30 +33,26 @@ class Netizen; | |||
33 | 33 | ||
34 | class Netizen { | 34 | class Netizen { |
35 | private: | 35 | private: |
36 | BaseDisplay *basedisplay; | 36 | BScreen *screen; |
37 | BScreen *screen; | 37 | BaseDisplay *basedisplay; |
38 | Window window; | 38 | Window window; |
39 | XEvent event; | 39 | XEvent event; |
40 | |||
41 | |||
42 | protected: | ||
43 | |||
44 | 40 | ||
45 | public: | 41 | public: |
46 | Netizen(BScreen *, Window); | 42 | Netizen(BScreen *, Window); |
47 | 43 | ||
48 | inline const Window &getWindowID(void) const { return window; } | 44 | inline const Window &getWindowID(void) const { return window; } |
49 | 45 | ||
50 | void sendWorkspaceCount(void); | 46 | void sendWorkspaceCount(void); |
51 | void sendCurrentWorkspace(void); | 47 | void sendCurrentWorkspace(void); |
52 | 48 | ||
53 | void sendWindowFocus(Window); | 49 | void sendWindowFocus(Window); |
54 | void sendWindowAdd(Window, unsigned long); | 50 | void sendWindowAdd(Window, unsigned long); |
55 | void sendWindowDel(Window); | 51 | void sendWindowDel(Window); |
56 | void sendWindowRaise(Window); | 52 | void sendWindowRaise(Window); |
57 | void sendWindowLower(Window); | 53 | void sendWindowLower(Window); |
58 | 54 | ||
59 | void sendConfigNotify(XEvent *); | 55 | void sendConfigNotify(XEvent *); |
60 | }; | 56 | }; |
61 | 57 | ||
62 | 58 | ||