From 4a5489bdf412189fc39d8d5e1381c3bd672cdd1f Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 13 Dec 2005 15:58:02 +0000
Subject: [PATCH] - Ctrl+w should close windows on non-Mac and non-Windows
 archs - Escape should close dialogs on all archs

---
 Fltk/Shortcut_Window.h | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/Fltk/Shortcut_Window.h b/Fltk/Shortcut_Window.h
index ba0994116c..ec3ec52a42 100644
--- a/Fltk/Shortcut_Window.h
+++ b/Fltk/Shortcut_Window.h
@@ -35,16 +35,15 @@ class Dialog_Window : public Fl_Double_Window {
     case FL_SHORTCUT:
     case FL_KEYBOARD:
 #if defined(__APPLE__)
-      if(Fl::test_shortcut(FL_META+'w')){
-	do_callback();
-	return 1;
-      }
+      if(Fl::test_shortcut(FL_META+'w') || Fl::test_shortcut(FL_Escape)){
 #elif defined(WIN32)
-      if(Fl::test_shortcut(FL_ALT+FL_F+4)){
+      if(Fl::test_shortcut(FL_ALT+FL_F+4) || Fl::test_shortcut(FL_Escape)){
+#else
+      if(Fl::test_shortcut(FL_CTRL+'w') || Fl::test_shortcut(FL_Escape)){
+#endif
 	do_callback();
 	return 1;
       }
-#endif
       break;
     }
     return Fl_Double_Window::handle(event);
@@ -69,17 +68,15 @@ class Main_Window : public Fl_Window {
     case FL_KEYBOARD:
 #if defined(__APPLE__)
       if(Fl::test_shortcut(FL_META+'w')){
-	if(fl_choice("Do you really want to quit?", "Cancel", "Quit", NULL))
-	  do_callback();
-	return 1;
-      }
 #elif defined(WIN32)
       if(Fl::test_shortcut(FL_ALT+FL_F+4)){
+#else
+      if(Fl::test_shortcut(FL_CTRL+'w')){
+#endif
 	if(fl_choice("Do you really want to quit?", "Cancel", "Quit", NULL))
 	  do_callback();
 	return 1;
       }
-#endif
       break;
     }
     return Fl_Window::handle(event);
-- 
GitLab