DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2532
Version: 1.3-feature


Here is a patch to allow Fl::handle be overridable by a user application,
it comes for me as a need to use exceptions to handle errors in my
application and found a problem with mingw on win32, even using vc++ or
gcc on linux that do works with exceptions very well, the best place I
found to install a global exception catch that is recoverable is at
fl::handle entry point.


Link: http://www.fltk.org/str.php?L2532
Version: 1.3-feature
Index: FL/Fl.H
===================================================================
--- FL/Fl.H     (revision 8292)
+++ FL/Fl.H     (working copy)
@@ -104,6 +104,9 @@
 /** signature of args functions passed as parameters */
 typedef int (*Fl_Args_Handler)(int argc, char **argv, int &i);
 
+/** signature of main event handler */
+typedef int (*Fl_Main_Event_Handler)(int e, Fl_Window* w);
+
 /** @} */ /* group callback_functions */
 
 
@@ -682,8 +685,10 @@
   static int test_shortcut(Fl_Shortcut);
 
   // event destinations:
-  static int handle(int, Fl_Window*);
-  /**  Gets the widget that is below the mouse. 
+  static Fl_Main_Event_Handler main_handle;
+  static int default_main_handle(int, Fl_Window*);
+  static int handle(int e, Fl_Window* w) {return (*main_handle)(e, w);};
+  /**  Gets the widget that is below the mouse.
        \see  belowmouse(Fl_Widget*) */
   static Fl_Widget* belowmouse() {return belowmouse_;}
   static void belowmouse(Fl_Widget*);
Index: src/Fl.cxx
===================================================================
--- src/Fl.cxx  (revision 8292)
+++ src/Fl.cxx  (working copy)
@@ -972,7 +972,9 @@
   return ret;
 }
 
-int Fl::handle(int e, Fl_Window* window)
+Fl_Main_Event_Handler Fl::main_handle = &Fl::default_main_handle;
+
+int Fl::default_main_handle(int e, Fl_Window* window)
 /**
   Sends the event to a window for processing.  Returns non-zero if any
   widget uses the event.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to