diff options
author | fluxgen <fluxgen> | 2002-08-13 23:58:26 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-08-13 23:58:26 (GMT) |
commit | 76a1c5c161de5142ae468575dcba537f02d31686 (patch) | |
tree | 58692add00a65a77624fc4088c8cf142b4f7ac54 | |
parent | bfbbac747848e3f31c12b9fe73712110d7ec4fdc (diff) | |
download | fluxbox_paul-76a1c5c161de5142ae468575dcba537f02d31686.zip fluxbox_paul-76a1c5c161de5142ae468575dcba537f02d31686.tar.bz2 |
removed handleSignal, this is done in class Fluxbox now with FbTk SignalHandler
-rw-r--r-- | src/BaseDisplay.cc | 94 | ||||
-rw-r--r-- | src/BaseDisplay.hh | 8 |
2 files changed, 3 insertions, 99 deletions
diff --git a/src/BaseDisplay.cc b/src/BaseDisplay.cc index d214906..da300c6 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.16 2002/08/04 15:09:30 fluxgen Exp $ | 25 | // $Id: BaseDisplay.cc,v 1.17 2002/08/13 23:58:26 fluxgen Exp $ |
26 | 26 | ||
27 | // use GNU extensions | 27 | // use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -124,72 +124,6 @@ static int handleXErrors(Display *, XErrorEvent *e) { | |||
124 | return(False); | 124 | return(False); |
125 | } | 125 | } |
126 | 126 | ||
127 | |||
128 | // signal handler to allow for proper and gentle shutdown | ||
129 | |||
130 | #ifndef HAVE_SIGACTION | ||
131 | static RETSIGTYPE signalhandler(int sig) { | ||
132 | #else // HAVE_SIGACTION | ||
133 | static void signalhandler(int sig) { | ||
134 | #endif // HAVE_SIGACTION | ||
135 | I18n *i18n = I18n::instance(); | ||
136 | static int re_enter = 0; | ||
137 | |||
138 | switch (sig) { | ||
139 | case SIGCHLD: // we don't want the child process to kill us | ||
140 | int status; | ||
141 | waitpid(-1, &status, WNOHANG | WUNTRACED); | ||
142 | |||
143 | #ifndef HAVE_SIGACTION | ||
144 | // assume broken, braindead sysv signal semantics | ||
145 | signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler); | ||
146 | #endif // HAVE_SIGACTION | ||
147 | |||
148 | break; | ||
149 | |||
150 | default: | ||
151 | if (base_display->handleSignal(sig)) { | ||
152 | |||
153 | #ifndef HAVE_SIGACTION | ||
154 | // assume broken, braindead sysv signal semantics | ||
155 | signal(sig, (RETSIGTYPE (*)(int)) signalhandler); | ||
156 | #endif // HAVE_SIGACTION | ||
157 | |||
158 | return; | ||
159 | } | ||
160 | |||
161 | fprintf(stderr, | ||
162 | i18n->getMessage( | ||
163 | FBNLS::BaseDisplaySet, FBNLS::BaseDisplaySignalCaught, | ||
164 | "%s: signal %d caught\n"), | ||
165 | base_display->getApplicationName(), sig); | ||
166 | |||
167 | if (! base_display->isStartup() && ! re_enter) { | ||
168 | internal_error = True; | ||
169 | |||
170 | re_enter = 1; | ||
171 | fprintf(stderr, | ||
172 | i18n->getMessage( | ||
173 | FBNLS::BaseDisplaySet, FBNLS::BaseDisplayShuttingDown, | ||
174 | "shutting down\n")); | ||
175 | base_display->shutdown(); | ||
176 | } | ||
177 | |||
178 | if (sig != SIGTERM && sig != SIGINT) { | ||
179 | fprintf(stderr, | ||
180 | i18n->getMessage( | ||
181 | FBNLS::BaseDisplaySet, FBNLS::BaseDisplayAborting, | ||
182 | "aborting... dumping core\n")); | ||
183 | abort(); | ||
184 | } | ||
185 | |||
186 | exit(0); | ||
187 | |||
188 | break; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | |||
193 | // convenience functions | 127 | // convenience functions |
194 | #ifndef __EMX__ | 128 | #ifndef __EMX__ |
195 | void bexec(const char *command, char *displaystring) { | 129 | void bexec(const char *command, char *displaystring) { |
@@ -213,32 +147,6 @@ m_server_grabs(0) | |||
213 | I18n *i18n = I18n::instance(); | 147 | I18n *i18n = I18n::instance(); |
214 | ::base_display = this; | 148 | ::base_display = this; |
215 | 149 | ||
216 | #ifdef HAVE_SIGACTION | ||
217 | struct sigaction action; | ||
218 | |||
219 | action.sa_handler = signalhandler; | ||
220 | action.sa_mask = sigset_t(); | ||
221 | action.sa_flags = SA_NOCLDSTOP | SA_NODEFER; | ||
222 | |||
223 | sigaction(SIGSEGV, &action, NULL); | ||
224 | sigaction(SIGFPE, &action, NULL); | ||
225 | sigaction(SIGTERM, &action, NULL); | ||
226 | sigaction(SIGINT, &action, NULL); | ||
227 | sigaction(SIGCHLD, &action, NULL); | ||
228 | sigaction(SIGHUP, &action, NULL); | ||
229 | sigaction(SIGUSR1, &action, NULL); | ||
230 | sigaction(SIGUSR2, &action, NULL); | ||
231 | #else // !HAVE_SIGACTION | ||
232 | signal(SIGSEGV, (RETSIGTYPE (*)(int)) signalhandler); | ||
233 | signal(SIGFPE, (RETSIGTYPE (*)(int)) signalhandler); | ||
234 | signal(SIGTERM, (RETSIGTYPE (*)(int)) signalhandler); | ||
235 | signal(SIGINT, (RETSIGTYPE (*)(int)) signalhandler); | ||
236 | signal(SIGUSR1, (RETSIGTYPE (*)(int)) signalhandler); | ||
237 | signal(SIGUSR2, (RETSIGTYPE (*)(int)) signalhandler); | ||
238 | signal(SIGHUP, (RETSIGTYPE (*)(int)) signalhandler); | ||
239 | signal(SIGCHLD, (RETSIGTYPE (*)(int)) signalhandler); | ||
240 | #endif // HAVE_SIGACTION | ||
241 | |||
242 | if (! (m_display = XOpenDisplay(dpy_name))) { | 150 | if (! (m_display = XOpenDisplay(dpy_name))) { |
243 | fprintf(stderr, | 151 | fprintf(stderr, |
244 | i18n-> | 152 | i18n-> |
diff --git a/src/BaseDisplay.hh b/src/BaseDisplay.hh index 8b9b186..1adc8d3 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.23 2002/08/04 15:09:30 fluxgen Exp $ | 25 | // $Id: BaseDisplay.hh,v 1.24 2002/08/13 23:58:26 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef BASEDISPLAY_HH | 27 | #ifndef BASEDISPLAY_HH |
28 | #define BASEDISPLAY_HH | 28 | #define BASEDISPLAY_HH |
@@ -97,7 +97,7 @@ public: | |||
97 | inline const char *getApplicationName() const { return m_app_name; } | 97 | inline const char *getApplicationName() const { return m_app_name; } |
98 | 98 | ||
99 | inline int getNumberOfScreens() const { return number_of_screens; } | 99 | inline int getNumberOfScreens() const { return number_of_screens; } |
100 | inline int getShapeEventBase() const { return shape.event_basep; } | 100 | inline int getShapeEventBase() const { return shape.event_basep; } |
101 | 101 | ||
102 | inline void shutdown() { m_shutdown = true; } | 102 | inline void shutdown() { m_shutdown = true; } |
103 | inline void run() { m_startup = m_shutdown = false; } | 103 | inline void run() { m_startup = m_shutdown = false; } |
@@ -108,10 +108,6 @@ public: | |||
108 | void ungrab(); | 108 | void ungrab(); |
109 | void eventLoop(); | 109 | void eventLoop(); |
110 | 110 | ||
111 | // another pure virtual... this is used to handle signals that BaseDisplay | ||
112 | // doesn't understand itself | ||
113 | virtual Bool handleSignal(int) = 0; | ||
114 | |||
115 | class GrabGuard:private NotCopyable | 111 | class GrabGuard:private NotCopyable |
116 | { | 112 | { |
117 | public: | 113 | public: |