aboutsummaryrefslogtreecommitdiffstats
path: root/XWindow.c
diff options
context:
space:
mode:
authorreinelt <>2000-08-09 09:50:29 +0000
committerreinelt <>2000-08-09 09:50:29 +0000
commit58deee6b03e396b6cba5e4e888940419c240866b (patch)
treeddf01503c9b524efbe08b2887ab9b9f0bed1dc55 /XWindow.c
parenta7f2de2a1d1fb7b5c8b3ba277ea66f01e692dd18 (diff)
downloadlcd4linux-58deee6b03e396b6cba5e4e888940419c240866b.tar.gz
[lcd4linux @ 2000-08-09 09:50:29 by reinelt]
opened 0.98 development removed driver-specific signal-handlers added 'quit'-function to driver structure added global signal-handler
Diffstat (limited to 'XWindow.c')
-rw-r--r--XWindow.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/XWindow.c b/XWindow.c
index 124dac2..0956138 100644
--- a/XWindow.c
+++ b/XWindow.c
@@ -1,4 +1,4 @@
-/* $Id: XWindow.c,v 1.18 2000/05/02 23:07:48 herp Exp $
+/* $Id: XWindow.c,v 1.19 2000/08/09 09:50:29 reinelt Exp $
*
* X11 Driver for LCD4Linux
*
@@ -20,6 +20,13 @@
*
*
* $Log: XWindow.c,v $
+ * Revision 1.19 2000/08/09 09:50:29 reinelt
+ *
+ * opened 0.98 development
+ * removed driver-specific signal-handlers
+ * added 'quit'-function to driver structure
+ * added global signal-handler
+ *
* Revision 1.18 2000/05/02 23:07:48 herp
* Crystalfontz initial coding
*
@@ -103,7 +110,7 @@
#include <sys/sem.h>
#include <sys/shm.h>
#include <unistd.h>
-#include <signal.h>
+#include <signal.h>
#include "cfg.h"
#include "display.h"
@@ -174,29 +181,11 @@ static void shmcleanup() {
if (shmid>-1) shmctl(shmid,IPC_RMID,NULL);
}
-static void quit(int nsig) {
- semcleanup();
- shmcleanup();
- if (ppid!=getpid())
- kill(ppid,nsig);
- exit(0);
-}
-
static void quit_updater() {
if (async_updater_pid>1)
kill(async_updater_pid,15);
}
-static void init_signals() {
-unsigned int oksig=(1<<SIGBUS)|(1<<SIGFPE)|(1<<SIGSEGV)|
- (1<<SIGTSTP)|(1<<SIGCHLD)|(1<<SIGCONT)|
- (1<<SIGTTIN)|(1<<SIGWINCH);
-int i;
- for(i=0;i<NSIG;i++)
- if (((1<<i)&oksig)==0)
- signal(i,quit);
-}
-
static int init_shm(int nbytes,unsigned char **buf) {
shmid=shmget(IPC_PRIVATE,nbytes,SHM_R|SHM_W);
@@ -345,7 +334,6 @@ char *s;
if (pix_init(rows,cols,xres,yres)==-1) return -1;
if (init_x(rows,cols,xres,yres)==-1) return -1;
- init_signals();
if (init_shm(rows*cols*xres*yres,&BackupLCDpixmap)==-1) return -1;
memset(BackupLCDpixmap,0xff,rows*yres*cols*xres);
if (init_thread(rows*cols*xres*yres)==-1) return -1;
@@ -402,6 +390,15 @@ int x,y;
return 0;
}
+int xlcdquit(void) {
+ semcleanup();
+ shmcleanup();
+ if (ppid!=getpid())
+ // FIXME: kill(ppid,nsig);
+ kill(ppid,SIGTERM);
+ return 0;
+}
+
/*
* this one should only be called from the updater-thread
* no user serviceable parts inside
@@ -499,7 +496,7 @@ XEvent ev;
}
LCD XWindow[] = {
- { "X11", 0, 0, 0, 0, BARS, xlcdinit, xlcdclear, xlcdput, xlcdbar, xlcdflush },
+ { "X11", 0, 0, 0, 0, BARS, xlcdinit, xlcdclear, xlcdput, xlcdbar, xlcdflush, xlcdquit },
{ NULL }
};