summaryrefslogtreecommitdiffstats
path: root/contrib/fltk/12-fltk-1.3.2-xhandlers.patch
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/fltk/12-fltk-1.3.2-xhandlers.patch')
-rw-r--r--contrib/fltk/12-fltk-1.3.2-xhandlers.patch82
1 files changed, 49 insertions, 33 deletions
diff --git a/contrib/fltk/12-fltk-1.3.2-xhandlers.patch b/contrib/fltk/12-fltk-1.3.2-xhandlers.patch
index cf6cefbf..0ac3fe4b 100644
--- a/contrib/fltk/12-fltk-1.3.2-xhandlers.patch
+++ b/contrib/fltk/12-fltk-1.3.2-xhandlers.patch
@@ -5,8 +5,8 @@ diff -up fltk-1.3.2/FL/Fl.H.xhandlers fltk-1.3.2/FL/Fl.H
/** Signature of add_handler functions passed as parameters */
typedef int (*Fl_Event_Handler)(int event);
-+/** Signature of add_xhandler functions passed as parameters */
-+typedef bool (*Fl_XEvent_Handler)(void *event, void *data);
++/** Signature of add_system_handler functions passed as parameters */
++typedef int (*Fl_System_Handler)(void *event, void *data);
+
/** Signature of set_abort functions passed as parameters */
typedef void (*Fl_Abort_Handler)(const char *format,...);
@@ -15,8 +15,8 @@ diff -up fltk-1.3.2/FL/Fl.H.xhandlers fltk-1.3.2/FL/Fl.H
static void focus(Fl_Widget*);
static void add_handler(Fl_Event_Handler h);
static void remove_handler(Fl_Event_Handler h);
-+ static void add_xhandler(Fl_XEvent_Handler h, void *data);
-+ static void remove_xhandler(Fl_XEvent_Handler h);
++ static void add_system_handler(Fl_System_Handler h, void *data);
++ static void remove_system_handler(Fl_System_Handler h);
static void event_dispatch(Fl_Event_Dispatch d);
static Fl_Event_Dispatch event_dispatch();
/** @} */
@@ -27,7 +27,7 @@ diff -up fltk-1.3.2/src/Fl_cocoa.mm.xhandlers fltk-1.3.2/src/Fl_cocoa.mm
}
@end
-+extern bool fl_send_xhandlers(void *e);
++extern int fl_send_system_handlers(void *e);
+
static void clipboard_check(void);
@@ -37,7 +37,7 @@ diff -up fltk-1.3.2/src/Fl_cocoa.mm.xhandlers fltk-1.3.2/src/Fl_cocoa.mm
// update clipboard status
clipboard_check();
+
-+ if (fl_send_xhandlers(theEvent))
++ if (fl_send_system_handlers(theEvent))
+ return;
+
NSEventType type = [theEvent type];
@@ -46,7 +46,7 @@ diff -up fltk-1.3.2/src/Fl_cocoa.mm.xhandlers fltk-1.3.2/src/Fl_cocoa.mm
diff -up fltk-1.3.2/src/Fl.cxx.xhandlers fltk-1.3.2/src/Fl.cxx
--- fltk-1.3.2/src/Fl.cxx.xhandlers 2014-07-22 15:23:18.085334432 +0200
+++ fltk-1.3.2/src/Fl.cxx 2014-07-22 15:23:18.095334607 +0200
-@@ -891,6 +891,67 @@ static int send_handlers(int e) {
+@@ -891,6 +891,83 @@ static int send_handlers(int e) {
return 0;
}
@@ -55,59 +55,75 @@ diff -up fltk-1.3.2/src/Fl.cxx.xhandlers fltk-1.3.2/src/Fl.cxx
+// System event handlers:
+
+
-+struct xhandler_link {
-+ Fl_XEvent_Handler handle;
++struct system_handler_link {
++ Fl_System_Handler handle;
+ void *data;
-+ xhandler_link *next;
++ system_handler_link *next;
+};
+
+
-+static xhandler_link *xhandlers = 0;
++static system_handler_link *sys_handlers = 0;
+
+
+/**
-+ Install a function to intercept system events. FLTK calls each of
-+ these functions as soon as a new system event is received. The
-+ processing will stop at the first function to return true. If all
-+ functions return false then the event is passed on for normal
-+ handling by FLTK.
++ \brief Install a function to intercept system events.
+
-+ \see Fl::remove_xhandler(Fl_XEvent_Handler)
++ FLTK calls each of these functions as soon as a new system event is
++ received. The processing will stop at the first function to return
++ non-zero. If all functions return zero then the event is passed on
++ for normal handling by FLTK.
++
++ Each function will be called with a pointer to the system event as
++ the first argument and \p data as the second argument. The system
++ event pointer will always be void *, but will point to different
++ objects depending on the platform:
++ - X11: XEvent
++ - Windows: MSG
++ - OS X: NSEvent
++
++ \param ha The event handler function to register
++ \param data User data to include on each call
++
++ \see Fl::remove_system_handler(Fl_System_Handler)
+*/
-+void Fl::add_xhandler(Fl_XEvent_Handler ha, void *data) {
-+ xhandler_link *l = new xhandler_link;
++void Fl::add_system_handler(Fl_System_Handler ha, void *data) {
++ system_handler_link *l = new system_handler_link;
+ l->handle = ha;
+ l->data = data;
-+ l->next = xhandlers;
-+ xhandlers = l;
++ l->next = sys_handlers;
++ sys_handlers = l;
+}
+
+
+/**
+ Removes a previously added system event handler.
++
++ \param ha The event handler function to remove
++
++ \see Fl::add_system_handler(Fl_System_Handler)
+*/
-+void Fl::remove_xhandler(Fl_XEvent_Handler ha) {
-+ xhandler_link *l, *p;
++void Fl::remove_system_handler(Fl_System_Handler ha) {
++ system_handler_link *l, *p;
+
+ // Search for the handler in the list...
-+ for (l = xhandlers, p = 0; l && l->handle != ha; p = l, l = l->next);
++ for (l = sys_handlers, p = 0; l && l->handle != ha; p = l, l = l->next);
+
+ if (l) {
+ // Found it, so remove it from the list...
+ if (p) p->next = l->next;
-+ else xhandlers = l->next;
++ else sys_handlers = l->next;
+
+ // And free the record...
+ delete l;
+ }
+}
+
-+bool fl_send_xhandlers(void *e) {
-+ for (const xhandler_link *hl = xhandlers; hl; hl = hl->next) {
++int fl_send_system_handlers(void *e) {
++ for (const system_handler_link *hl = sys_handlers; hl; hl = hl->next) {
+ if (hl->handle(e, hl->data))
-+ return true;
++ return 1;
+ }
-+ return false;
++ return 0;
+}
+
+
@@ -121,7 +137,7 @@ diff -up fltk-1.3.2/src/Fl_win32.cxx.xhandlers fltk-1.3.2/src/Fl_win32.cxx
return r;
}
-+extern bool fl_send_xhandlers(void *e);
++extern int fl_send_system_handlers(void *e);
+
IActiveIMMApp *fl_aimm = NULL;
MSG fl_msg;
@@ -150,7 +166,7 @@ diff -up fltk-1.3.2/src/Fl_win32.cxx.xhandlers fltk-1.3.2/src/Fl_win32.cxx
- DispatchMessageW(&fl_msg);
- have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE);
+ while ((have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE)) > 0) {
-+ if (fl_send_xhandlers(&fl_msg))
++ if (fl_send_system_handlers(&fl_msg))
+ continue;
+
+ // Let applications treat WM_QUIT identical to SIGTERM on *nix
@@ -178,7 +194,7 @@ diff -up fltk-1.3.2/src/Fl_x.cxx.xhandlers fltk-1.3.2/src/Fl_x.cxx
remove_fd(n, -1);
}
-+extern bool fl_send_xhandlers(void *e);
++extern int fl_send_system_handlers(void *e);
+
#if CONSOLIDATE_MOTION
static Fl_Window* send_motion;
@@ -187,7 +203,7 @@ diff -up fltk-1.3.2/src/Fl_x.cxx.xhandlers fltk-1.3.2/src/Fl_x.cxx
while (XEventsQueued(fl_display,QueuedAfterReading)) {
XEvent xevent;
XNextEvent(fl_display, &xevent);
-+ if (fl_send_xhandlers(&xevent))
++ if (fl_send_system_handlers(&xevent))
+ continue;
fl_handle(xevent);
}