diff options
Diffstat (limited to 'src/Netizen.cc')
-rw-r--r-- | src/Netizen.cc | 107 |
1 files changed, 41 insertions, 66 deletions
diff --git a/src/Netizen.cc b/src/Netizen.cc index 24f4a4c..56bfe52 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,125 +21,100 @@ | |||
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(scr->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 | #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(); | 58 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWorkspaceCountAtom(); |
72 | event.xclient.data.l[1] = screen->getCount(); | 59 | event.xclient.data.l[1] = screen->getCount(); |
73 | 60 | ||
74 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 61 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
75 | |||
76 | |||
77 | } | 62 | } |
78 | 63 | ||
79 | 64 | ||
80 | void Netizen::sendCurrentWorkspace(void) { | 65 | void 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 | 66 | ||
91 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyCurrentWorkspaceAtom(); | 67 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyCurrentWorkspaceAtom(); |
92 | event.xclient.data.l[1] = screen->getCurrentWorkspaceID(); | 68 | event.xclient.data.l[1] = screen->getCurrentWorkspaceID(); |
93 | 69 | ||
94 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 70 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
95 | |||
96 | } | 71 | } |
97 | 72 | ||
98 | 73 | ||
99 | void Netizen::sendWindowFocus(Window w) { | 74 | void Netizen::sendWindowFocus(Window w) { |
100 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowFocusAtom(); | 75 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowFocusAtom(); |
101 | event.xclient.data.l[1] = w; | 76 | event.xclient.data.l[1] = w; |
102 | 77 | ||
103 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 78 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
104 | } | 79 | } |
105 | 80 | ||
106 | 81 | ||
107 | void Netizen::sendWindowAdd(Window w, unsigned long p) { | 82 | void Netizen::sendWindowAdd(Window w, unsigned long p) { |
108 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowAddAtom(); | 83 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowAddAtom(); |
109 | event.xclient.data.l[1] = w; | 84 | event.xclient.data.l[1] = w; |
110 | event.xclient.data.l[2] = p; | 85 | event.xclient.data.l[2] = p; |
111 | 86 | ||
112 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 87 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
113 | 88 | ||
114 | event.xclient.data.l[2] = 0l; | 89 | event.xclient.data.l[2] = 0l; |
115 | } | 90 | } |
116 | 91 | ||
117 | 92 | ||
118 | void Netizen::sendWindowDel(Window w) { | 93 | void Netizen::sendWindowDel(Window w) { |
119 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowDelAtom(); | 94 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowDelAtom(); |
120 | event.xclient.data.l[1] = w; | 95 | event.xclient.data.l[1] = w; |
121 | 96 | ||
122 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 97 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
123 | } | 98 | } |
124 | 99 | ||
125 | 100 | ||
126 | void Netizen::sendWindowRaise(Window w) { | 101 | void Netizen::sendWindowRaise(Window w) { |
127 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowRaiseAtom(); | 102 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowRaiseAtom(); |
128 | event.xclient.data.l[1] = w; | 103 | event.xclient.data.l[1] = w; |
129 | 104 | ||
130 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 105 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
131 | } | 106 | } |
132 | 107 | ||
133 | 108 | ||
134 | void Netizen::sendWindowLower(Window w) { | 109 | void Netizen::sendWindowLower(Window w) { |
135 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowLowerAtom(); | 110 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowLowerAtom(); |
136 | event.xclient.data.l[1] = w; | 111 | event.xclient.data.l[1] = w; |
137 | 112 | ||
138 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 113 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); |
139 | } | 114 | } |
140 | 115 | ||
141 | 116 | ||
142 | void Netizen::sendConfigNotify(XEvent *e) { | 117 | void Netizen::sendConfigNotify(XEvent *e) { |
143 | XSendEvent(basedisplay->getXDisplay(), window, False, | 118 | XSendEvent(basedisplay->getXDisplay(), window, False, |
144 | StructureNotifyMask, e); | 119 | StructureNotifyMask, e); |
145 | } | 120 | } |