summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2013-12-13 10:26:03 +0000
committerPierre Ossman <ossman@cendio.se>2013-12-13 10:26:03 +0000
commitf7e88141c3db591149d4d569e6852843b61d9c92 (patch)
tree05045547e7bf7bbe2695e8d9f1a67ea208de14b7 /src
parent7bffc7bd3be1cc3e5c27c3a45e7002ed3711bbc6 (diff)
Catch WM_QUIT and convert it to SIGTERM. This gives Windows
applications a convenient way to request termination, rather than forcing it. And it does so in a way that mimics UNIX's way, allowing code reuse. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10030 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_win32.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index ce480b5d7..ea4f5f390 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -36,6 +36,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
+#include <signal.h>
#ifdef __CYGWIN__
# include <sys/time.h>
# include <unistd.h>
@@ -403,6 +404,9 @@ int fl_wait(double time_to_wait) {
have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE);
if (have_message > 0) {
while (have_message != 0 && have_message != -1) {
+ // Let applications treat WM_QUIT identical to SIGTERM on *nix
+ if (fl_msg.message == WM_QUIT)
+ raise(SIGTERM);
if (fl_msg.message == fl_wake_msg) {
// Used for awaking wait() from another thread
thread_message_ = (void*)fl_msg.wParam;