diff options
author | fluxgen <fluxgen> | 2002-08-04 15:09:30 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-08-04 15:09:30 (GMT) |
commit | 9789f8cb6b81e6dfd7cab05d0760790fb8c0aa5a (patch) | |
tree | f80974d4d822e62128cf499864d7dc9d5e64b978 /src | |
parent | 33d482aba5053964594fb3c5b6f6a1537ca10cbf (diff) | |
download | fluxbox-9789f8cb6b81e6dfd7cab05d0760790fb8c0aa5a.zip fluxbox-9789f8cb6b81e6dfd7cab05d0760790fb8c0aa5a.tar.bz2 |
const correct and some comments
Diffstat (limited to 'src')
-rw-r--r-- | src/BaseDisplay.cc | 10 | ||||
-rw-r--r-- | src/BaseDisplay.hh | 83 |
2 files changed, 48 insertions, 45 deletions
diff --git a/src/BaseDisplay.cc b/src/BaseDisplay.cc index 2b5a194..d214906 100644 --- a/src/BaseDisplay.cc +++ b/src/BaseDisplay.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // 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 |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: BaseDisplay.cc,v 1.15 2002/07/19 21:16:53 fluxgen Exp $ | 25 | // $Id: BaseDisplay.cc,v 1.16 2002/08/04 15:09:30 fluxgen Exp $ |
26 | 26 | ||
27 | // use GNU extensions | 27 | // use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -136,7 +136,7 @@ static void signalhandler(int sig) { | |||
136 | static int re_enter = 0; | 136 | static int re_enter = 0; |
137 | 137 | ||
138 | switch (sig) { | 138 | switch (sig) { |
139 | case SIGCHLD: | 139 | case SIGCHLD: // we don't want the child process to kill us |
140 | int status; | 140 | int status; |
141 | waitpid(-1, &status, WNOHANG | WUNTRACED); | 141 | waitpid(-1, &status, WNOHANG | WUNTRACED); |
142 | 142 | ||
@@ -192,18 +192,18 @@ static void signalhandler(int sig) { | |||
192 | 192 | ||
193 | // convenience functions | 193 | // convenience functions |
194 | #ifndef __EMX__ | 194 | #ifndef __EMX__ |
195 | void bexec(const char *command, char* displaystring) { | 195 | void bexec(const char *command, char *displaystring) { |
196 | if (! fork()) { | 196 | if (! fork()) { |
197 | setsid(); | 197 | setsid(); |
198 | putenv(displaystring); | 198 | putenv(displaystring); |
199 | execl("/bin/sh", "/bin/sh", "-c", command, NULL); | 199 | execl("/bin/sh", "/bin/sh", "-c", command, 0); |
200 | exit(0); | 200 | exit(0); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | #endif // !__EMX__ | 203 | #endif // !__EMX__ |
204 | 204 | ||
205 | 205 | ||
206 | BaseDisplay::BaseDisplay(char *app_name, char *dpy_name):FbAtoms(0), | 206 | BaseDisplay::BaseDisplay(const char *app_name, const char *dpy_name):FbAtoms(0), |
207 | m_startup(true), m_shutdown(false), | 207 | m_startup(true), m_shutdown(false), |
208 | m_display_name(XDisplayName(dpy_name)), m_app_name(app_name), | 208 | m_display_name(XDisplayName(dpy_name)), m_app_name(app_name), |
209 | m_server_grabs(0) | 209 | m_server_grabs(0) |
diff --git a/src/BaseDisplay.hh b/src/BaseDisplay.hh index 46d8a66..8b9b186 100644 --- a/src/BaseDisplay.hh +++ b/src/BaseDisplay.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // 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 |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: BaseDisplay.hh,v 1.22 2002/07/19 21:14:11 fluxgen Exp $ | 25 | // $Id: BaseDisplay.hh,v 1.23 2002/08/04 15:09:30 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef BASEDISPLAY_HH | 27 | #ifndef BASEDISPLAY_HH |
28 | #define BASEDISPLAY_HH | 28 | #define BASEDISPLAY_HH |
@@ -46,15 +46,18 @@ class ScreenInfo; | |||
46 | #define PropBlackboxHintsElements (5) | 46 | #define PropBlackboxHintsElements (5) |
47 | #define PropBlackboxAttributesElements (8) | 47 | #define PropBlackboxAttributesElements (8) |
48 | 48 | ||
49 | void bexec(const char *command, char* displaystring); | 49 | /// obsolete |
50 | void bexec(const char *command, char *displaystring); | ||
50 | 51 | ||
51 | class BaseDisplay:private NotCopyable, public FbAtoms | 52 | class BaseDisplay:private NotCopyable, public FbAtoms |
52 | { | 53 | { |
53 | |||
54 | public: | 54 | public: |
55 | BaseDisplay(char *, char * = 0); | 55 | BaseDisplay(const char *app_name, const char *display_name = 0); |
56 | virtual ~BaseDisplay(void); | 56 | virtual ~BaseDisplay(); |
57 | 57 | /** | |
58 | obsolete | ||
59 | @see FluxboxWindow | ||
60 | */ | ||
58 | enum Attrib { | 61 | enum Attrib { |
59 | ATTRIB_SHADED = 0x01, | 62 | ATTRIB_SHADED = 0x01, |
60 | ATTRIB_MAXHORIZ = 0x02, | 63 | ATTRIB_MAXHORIZ = 0x02, |
@@ -79,31 +82,31 @@ public: | |||
79 | 82 | ||
80 | inline ScreenInfo *getScreenInfo(int s) { return screenInfoList[s]; } | 83 | inline ScreenInfo *getScreenInfo(int s) { return screenInfoList[s]; } |
81 | 84 | ||
82 | inline bool hasShapeExtensions(void) const { return shape.extensions; } | 85 | inline bool hasShapeExtensions() const { return shape.extensions; } |
83 | inline bool doShutdown(void) const { return m_shutdown; } | 86 | inline bool doShutdown() const { return m_shutdown; } |
84 | inline bool isStartup(void) const { return m_startup; } | 87 | inline bool isStartup() const { return m_startup; } |
85 | 88 | ||
86 | inline const Cursor &getSessionCursor(void) const { return cursor.session; } | 89 | inline const Cursor &getSessionCursor() const { return cursor.session; } |
87 | inline const Cursor &getMoveCursor(void) const { return cursor.move; } | 90 | inline const Cursor &getMoveCursor() const { return cursor.move; } |
88 | inline const Cursor &getLowerLeftAngleCursor(void) const { return cursor.ll_angle; } | 91 | inline const Cursor &getLowerLeftAngleCursor() const { return cursor.ll_angle; } |
89 | inline const Cursor &getLowerRightAngleCursor(void) const { return cursor.lr_angle; } | 92 | inline const Cursor &getLowerRightAngleCursor() const { return cursor.lr_angle; } |
90 | 93 | ||
91 | inline Display *getXDisplay(void) { return m_display; } | 94 | inline Display *getXDisplay() { return m_display; } |
92 | 95 | ||
93 | inline const char *getXDisplayName(void) const { return const_cast<const char *>(m_display_name); } | 96 | inline const char *getXDisplayName() const { return m_display_name; } |
94 | inline const char *getApplicationName(void) const { return const_cast<const char *>(m_app_name); } | 97 | inline const char *getApplicationName() const { return m_app_name; } |
95 | 98 | ||
96 | inline int getNumberOfScreens(void) const { return number_of_screens; } | 99 | inline int getNumberOfScreens() const { return number_of_screens; } |
97 | inline int getShapeEventBase(void) const { return shape.event_basep; } | 100 | inline int getShapeEventBase() const { return shape.event_basep; } |
98 | 101 | ||
99 | inline void shutdown(void) { m_shutdown = true; } | 102 | inline void shutdown() { m_shutdown = true; } |
100 | inline void run(void) { m_startup = m_shutdown = false; } | 103 | inline void run() { m_startup = m_shutdown = false; } |
101 | 104 | ||
102 | bool validateWindow(Window); | 105 | bool validateWindow(Window); |
103 | 106 | ||
104 | void grab(void); | 107 | void grab(); |
105 | void ungrab(void); | 108 | void ungrab(); |
106 | void eventLoop(void); | 109 | void eventLoop(); |
107 | 110 | ||
108 | // another pure virtual... this is used to handle signals that BaseDisplay | 111 | // another pure virtual... this is used to handle signals that BaseDisplay |
109 | // doesn't understand itself | 112 | // doesn't understand itself |
@@ -120,6 +123,9 @@ public: | |||
120 | BaseDisplay &m_bd; | 123 | BaseDisplay &m_bd; |
121 | }; | 124 | }; |
122 | 125 | ||
126 | protected: | ||
127 | virtual void process_event(XEvent *) = 0; | ||
128 | |||
123 | private: | 129 | private: |
124 | struct cursor { | 130 | struct cursor { |
125 | Cursor session, move, ll_angle, lr_angle; | 131 | Cursor session, move, ll_angle, lr_angle; |
@@ -136,37 +142,34 @@ private: | |||
136 | typedef std::vector<ScreenInfo *> ScreenInfoList; | 142 | typedef std::vector<ScreenInfo *> ScreenInfoList; |
137 | ScreenInfoList screenInfoList; | 143 | ScreenInfoList screenInfoList; |
138 | 144 | ||
139 | char *m_display_name, *m_app_name; | 145 | const char *m_display_name, *m_app_name; |
140 | int number_of_screens, m_server_grabs, colors_per_channel; | 146 | int number_of_screens, m_server_grabs, colors_per_channel; |
141 | 147 | ||
142 | protected: | ||
143 | virtual void process_event(XEvent *) = 0; | ||
144 | |||
145 | }; | 148 | }; |
146 | 149 | ||
147 | 150 | ||
148 | class ScreenInfo { | 151 | class ScreenInfo { |
149 | public: | 152 | public: |
150 | ScreenInfo(BaseDisplay *, int); | 153 | ScreenInfo(BaseDisplay *bdisp, int screen_num); |
151 | ~ScreenInfo(void); | 154 | ~ScreenInfo(); |
152 | 155 | ||
153 | inline BaseDisplay *getBaseDisplay(void) { return basedisplay; } | 156 | inline BaseDisplay *getBaseDisplay() { return basedisplay; } |
154 | 157 | ||
155 | inline Visual *getVisual(void) { return visual; } | 158 | inline Visual *getVisual() { return visual; } |
156 | inline const Window &getRootWindow(void) const { return root_window; } | 159 | inline const Window &getRootWindow() const { return root_window; } |
157 | inline const Colormap &colormap(void) const { return m_colormap; } | 160 | inline const Colormap &colormap() const { return m_colormap; } |
158 | 161 | ||
159 | inline int getDepth(void) const { return depth; } | 162 | inline int getDepth() const { return depth; } |
160 | inline int getScreenNumber(void) const { return screen_number; } | 163 | inline int getScreenNumber() const { return screen_number; } |
161 | 164 | ||
162 | inline unsigned int getWidth(void) const { return width; } | 165 | inline unsigned int getWidth() const { return width; } |
163 | inline unsigned int getHeight(void) const { return height; } | 166 | inline unsigned int getHeight() const { return height; } |
164 | 167 | ||
165 | #ifdef XINERAMA | 168 | #ifdef XINERAMA |
166 | inline bool hasXinerama(void) const { return m_hasXinerama; } | 169 | inline bool hasXinerama() const { return m_hasXinerama; } |
167 | inline int getNumHeads(void) const { return xineramaNumHeads; } | 170 | inline int getNumHeads() const { return xineramaNumHeads; } |
168 | unsigned int getHead(int x, int y) const; | 171 | unsigned int getHead(int x, int y) const; |
169 | unsigned int getCurrHead(void) const; | 172 | unsigned int getCurrHead() const; |
170 | unsigned int getHeadWidth(unsigned int head) const; | 173 | unsigned int getHeadWidth(unsigned int head) const; |
171 | unsigned int getHeadHeight(unsigned int head) const; | 174 | unsigned int getHeadHeight(unsigned int head) const; |
172 | int getHeadX(unsigned int head) const; | 175 | int getHeadX(unsigned int head) const; |