浏览代码

Raise App Terminate event on SIGTERM.

woollybah 6 年之前
父节点
当前提交
377b2f8580
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      systemdefault.mod/system.linux.c

+ 10 - 1
systemdefault.mod/system.linux.c

@@ -101,9 +101,18 @@ void bbSystemShutdown(){
 //	XCloseDisplay(x_display);	causes crash with fltk canvas usage
 }
 
+void bbAppTerminate(int signum) {
+    bbSystemEmitEvent( BBEVENT_APPTERMINATE,&bbNullObject,0,0,0,0,&bbNullObject );
+}
+
 void bbSystemStartup(){
 	atexit( bbSystemShutdown );
-	
+
+	struct sigaction action;
+    memset(&action, 0, sizeof(struct sigaction));
+    action.sa_handler = bbAppTerminate;
+    sigaction(SIGTERM, &action, NULL);
+
 	XInitThreads();
 	
 	x_display=XOpenDisplay(0);