diff options
author | fluxgen <fluxgen> | 2002-08-14 21:59:28 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-08-14 21:59:28 (GMT) |
commit | ab4fef4450d40364cd97f7ad2af227cb957014c3 (patch) | |
tree | f0eeb6b37751af76abc64d0bfe72dada28ab8429 /src | |
parent | 238526bd48a9318672f8e2c20e8a3b3dbf16927d (diff) | |
download | fluxbox-ab4fef4450d40364cd97f7ad2af227cb957014c3.zip fluxbox-ab4fef4450d40364cd97f7ad2af227cb957014c3.tar.bz2 |
change to singleton fbatoms
Diffstat (limited to 'src')
-rw-r--r-- | src/Netizen.cc | 58 | ||||
-rw-r--r-- | src/Netizen.hh | 31 |
2 files changed, 41 insertions, 48 deletions
diff --git a/src/Netizen.cc b/src/Netizen.cc index 56bfe52..bfc32a0 100644 --- a/src/Netizen.cc +++ b/src/Netizen.cc | |||
@@ -19,8 +19,11 @@ | |||
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 | 22 | #include "Netizen.hh" |
23 | // library | 23 | |
24 | #include "Screen.hh" | ||
25 | |||
26 | // use GNU extensions | ||
24 | #ifndef _GNU_SOURCE | 27 | #ifndef _GNU_SOURCE |
25 | #define _GNU_SOURCE | 28 | #define _GNU_SOURCE |
26 | #endif // _GNU_SOURCE | 29 | #endif // _GNU_SOURCE |
@@ -29,92 +32,85 @@ | |||
29 | #include "../config.h" | 32 | #include "../config.h" |
30 | #endif // HAVE_CONFIG_H | 33 | #endif // HAVE_CONFIG_H |
31 | 34 | ||
32 | #include "Netizen.hh" | ||
33 | |||
34 | |||
35 | Netizen::Netizen(BScreen *scr, Window win): | 35 | Netizen::Netizen(BScreen *scr, Window win): |
36 | screen(scr), | 36 | screen(scr), |
37 | basedisplay(scr->getBaseDisplay()), | 37 | m_display(scr->getBaseDisplay()->getXDisplay()), |
38 | window(win) { | 38 | window(win) { |
39 | screen = scr; | ||
40 | basedisplay = screen->getBaseDisplay(); | ||
41 | window = win; | 39 | window = win; |
42 | 40 | ||
43 | event.type = ClientMessage; | 41 | event.type = ClientMessage; |
44 | event.xclient.message_type = basedisplay->getFluxboxStructureMessagesAtom(); | 42 | event.xclient.message_type = FbAtoms::instance()->getFluxboxStructureMessagesAtom(); |
45 | event.xclient.display = basedisplay->getXDisplay(); | 43 | event.xclient.display = m_display; |
46 | event.xclient.window = window; | 44 | event.xclient.window = window; |
47 | event.xclient.format = 32; | 45 | event.xclient.format = 32; |
48 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyStartupAtom(); | 46 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyStartupAtom(); |
49 | event.xclient.data.l[1] = event.xclient.data.l[2] = | 47 | event.xclient.data.l[1] = event.xclient.data.l[2] = |
50 | event.xclient.data.l[3] = event.xclient.data.l[4] = 0l; | 48 | event.xclient.data.l[3] = event.xclient.data.l[4] = 0l; |
51 | 49 | ||
52 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 50 | XSendEvent(m_display, window, False, NoEventMask, &event); |
53 | } | 51 | } |
54 | 52 | ||
55 | 53 | ||
56 | void Netizen::sendWorkspaceCount(void) { | 54 | void Netizen::sendWorkspaceCount() { |
57 | 55 | ||
58 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWorkspaceCountAtom(); | 56 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWorkspaceCountAtom(); |
59 | event.xclient.data.l[1] = screen->getCount(); | 57 | event.xclient.data.l[1] = screen->getCount(); |
60 | 58 | ||
61 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 59 | XSendEvent(m_display, window, False, NoEventMask, &event); |
62 | } | 60 | } |
63 | 61 | ||
64 | 62 | ||
65 | void Netizen::sendCurrentWorkspace(void) { | 63 | void Netizen::sendCurrentWorkspace() { |
66 | 64 | ||
67 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyCurrentWorkspaceAtom(); | 65 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyCurrentWorkspaceAtom(); |
68 | event.xclient.data.l[1] = screen->getCurrentWorkspaceID(); | 66 | event.xclient.data.l[1] = screen->getCurrentWorkspaceID(); |
69 | 67 | ||
70 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 68 | XSendEvent(m_display, window, False, NoEventMask, &event); |
71 | } | 69 | } |
72 | 70 | ||
73 | 71 | ||
74 | void Netizen::sendWindowFocus(Window w) { | 72 | void Netizen::sendWindowFocus(Window w) { |
75 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowFocusAtom(); | 73 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowFocusAtom(); |
76 | event.xclient.data.l[1] = w; | 74 | event.xclient.data.l[1] = w; |
77 | 75 | ||
78 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 76 | XSendEvent(m_display, window, False, NoEventMask, &event); |
79 | } | 77 | } |
80 | 78 | ||
81 | 79 | ||
82 | void Netizen::sendWindowAdd(Window w, unsigned long p) { | 80 | void Netizen::sendWindowAdd(Window w, unsigned long p) { |
83 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowAddAtom(); | 81 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowAddAtom(); |
84 | event.xclient.data.l[1] = w; | 82 | event.xclient.data.l[1] = w; |
85 | event.xclient.data.l[2] = p; | 83 | event.xclient.data.l[2] = p; |
86 | 84 | ||
87 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 85 | XSendEvent(m_display, window, False, NoEventMask, &event); |
88 | 86 | ||
89 | event.xclient.data.l[2] = 0l; | 87 | event.xclient.data.l[2] = 0l; |
90 | } | 88 | } |
91 | 89 | ||
92 | 90 | ||
93 | void Netizen::sendWindowDel(Window w) { | 91 | void Netizen::sendWindowDel(Window w) { |
94 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowDelAtom(); | 92 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowDelAtom(); |
95 | event.xclient.data.l[1] = w; | 93 | event.xclient.data.l[1] = w; |
96 | 94 | ||
97 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 95 | XSendEvent(m_display, window, False, NoEventMask, &event); |
98 | } | 96 | } |
99 | 97 | ||
100 | 98 | ||
101 | void Netizen::sendWindowRaise(Window w) { | 99 | void Netizen::sendWindowRaise(Window w) { |
102 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowRaiseAtom(); | 100 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowRaiseAtom(); |
103 | event.xclient.data.l[1] = w; | 101 | event.xclient.data.l[1] = w; |
104 | 102 | ||
105 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 103 | XSendEvent(m_display, window, False, NoEventMask, &event); |
106 | } | 104 | } |
107 | 105 | ||
108 | 106 | ||
109 | void Netizen::sendWindowLower(Window w) { | 107 | void Netizen::sendWindowLower(Window w) { |
110 | event.xclient.data.l[0] = basedisplay->getFluxboxNotifyWindowLowerAtom(); | 108 | event.xclient.data.l[0] = FbAtoms::instance()->getFluxboxNotifyWindowLowerAtom(); |
111 | event.xclient.data.l[1] = w; | 109 | event.xclient.data.l[1] = w; |
112 | 110 | ||
113 | XSendEvent(basedisplay->getXDisplay(), window, False, NoEventMask, &event); | 111 | XSendEvent(m_display, window, False, NoEventMask, &event); |
114 | } | 112 | } |
115 | 113 | ||
116 | |||
117 | void Netizen::sendConfigNotify(XEvent *e) { | 114 | void Netizen::sendConfigNotify(XEvent *e) { |
118 | XSendEvent(basedisplay->getXDisplay(), window, False, | 115 | XSendEvent(m_display, window, False, StructureNotifyMask, e); |
119 | StructureNotifyMask, e); | ||
120 | } | 116 | } |
diff --git a/src/Netizen.hh b/src/Netizen.hh index c9460bb..948d0d2 100644 --- a/src/Netizen.hh +++ b/src/Netizen.hh | |||
@@ -1,3 +1,5 @@ | |||
1 | // Netizen.hh for Fluxbox | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
1 | // Netizen.hh for Blackbox - An X11 Window Manager | 3 | // Netizen.hh for Blackbox - An X11 Window Manager |
2 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) | 4 | // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) |
3 | // | 5 | // |
@@ -22,34 +24,29 @@ | |||
22 | #ifndef NETIZEN_HH | 24 | #ifndef NETIZEN_HH |
23 | #define NETIZEN_HH | 25 | #define NETIZEN_HH |
24 | 26 | ||
25 | // forward declaration | ||
26 | class Netizen; | ||
27 | |||
28 | #include <X11/Xlib.h> | 27 | #include <X11/Xlib.h> |
29 | 28 | ||
30 | #include "BaseDisplay.hh" | 29 | class BScreen; |
31 | #include "Screen.hh" | ||
32 | |||
33 | 30 | ||
34 | class Netizen { | 31 | class Netizen { |
35 | public: | 32 | public: |
36 | Netizen(BScreen *, Window); | 33 | Netizen(BScreen *scr, Window w); |
37 | 34 | ||
38 | inline const Window &getWindowID(void) const { return window; } | 35 | inline Window getWindowID() const { return window; } |
39 | 36 | ||
40 | void sendWorkspaceCount(void); | 37 | void sendWorkspaceCount(); |
41 | void sendCurrentWorkspace(void); | 38 | void sendCurrentWorkspace(); |
42 | 39 | ||
43 | void sendWindowFocus(Window); | 40 | void sendWindowFocus(Window w); |
44 | void sendWindowAdd(Window, unsigned long); | 41 | void sendWindowAdd(Window w, unsigned long p); |
45 | void sendWindowDel(Window); | 42 | void sendWindowDel(Window w); |
46 | void sendWindowRaise(Window); | 43 | void sendWindowRaise(Window w); |
47 | void sendWindowLower(Window); | 44 | void sendWindowLower(Window w); |
48 | 45 | ||
49 | void sendConfigNotify(XEvent *); | 46 | void sendConfigNotify(XEvent *xe); |
50 | private: | 47 | private: |
51 | BScreen *screen; | 48 | BScreen *screen; |
52 | BaseDisplay *basedisplay; | 49 | Display *m_display; ///< display connection |
53 | Window window; | 50 | Window window; |
54 | XEvent event; | 51 | XEvent event; |
55 | 52 | ||