aboutsummaryrefslogtreecommitdiff
path: root/src/BaseDisplay.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-08-13 23:58:26 (GMT)
committerfluxgen <fluxgen>2002-08-13 23:58:26 (GMT)
commit76a1c5c161de5142ae468575dcba537f02d31686 (patch)
tree58692add00a65a77624fc4088c8cf142b4f7ac54 /src/BaseDisplay.cc
parentbfbbac747848e3f31c12b9fe73712110d7ec4fdc (diff)
downloadfluxbox-76a1c5c161de5142ae468575dcba537f02d31686.zip
fluxbox-76a1c5c161de5142ae468575dcba537f02d31686.tar.bz2
removed handleSignal, this is done in class Fluxbox now with FbTk SignalHandler
Diffstat (limited to 'src/BaseDisplay.cc')
-rw-r--r--src/BaseDisplay.cc94
1 files changed, 1 insertions, 93 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
131static RETSIGTYPE signalhandler(int sig) {
132#else // HAVE_SIGACTION
133static 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__
195void bexec(const char *command, char *displaystring) { 129void 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->