From 4908dfd72a343ee7c35bc55a55ad860052e21fae Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Thu, 8 Jan 2026 21:22:03 +0100 Subject: Add CMake option FLTK_OPTION_PEN_SUPPORT (default: ON) This option can be used to disable pen/tablet support if there are build problems on a particular platform or build system (e.g. MinGW) so users can continue to build FLTK 1.5. Users can also choose to disable pen support if they don't need it. --- src/Fl_cocoa.mm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/Fl_cocoa.mm') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 32abcbc88..2a90f5bf1 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -72,7 +72,7 @@ extern int fl_send_system_handlers(void *e); // converting cr lf converter function static void createAppleMenu(void); static void cocoaMouseHandler(NSEvent *theEvent); -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) && defined(FLTK_HAVE_PEN_SUPPORT) static bool cocoaTabletHandler(NSEvent *theEvent, bool lock); extern bool fl_cocoa_tablet_handler(NSEvent*, Fl_Window*); #endif @@ -631,7 +631,7 @@ void Fl_Cocoa_Screen_Driver::breakMacEventLoop() endedAtPoint:(NSPoint)screenPoint operation:(NSDragOperation)operation; #endif - (BOOL)did_view_resolution_change; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) && defined(FLTK_HAVE_PEN_SUPPORT) - (void)tabletProximity:(NSEvent *)theEvent; - (void)tabletPoint:(NSEvent *)theEvent; #endif @@ -1057,6 +1057,7 @@ static void cocoaMagnifyHandler(NSEvent *theEvent) #endif } +#if defined(FLTK_HAVE_PEN_SUPPORT) static bool cocoaTabletHandler(NSEvent *theEvent, bool lock) { @@ -1067,6 +1068,8 @@ static bool cocoaTabletHandler(NSEvent *theEvent, bool lock) return ret; } +#endif // FLTK_HAVE_PEN_SUPPORT + namespace Fl { namespace Private { // Global mouse position at mouse down event @@ -1084,6 +1087,7 @@ static void cocoaMouseHandler(NSEvent *theEvent) fl_lock_function(); +#if defined(FLTK_HAVE_PEN_SUPPORT) // Handle tablet proximity and point subevents if ( ([theEvent type] != NSEventTypeMouseEntered) // does not have a subtype && ([theEvent type] != NSEventTypeMouseExited) ) // does not have a subtype @@ -1098,6 +1102,7 @@ static void cocoaMouseHandler(NSEvent *theEvent) // else fall through into mouse event handling } } +#endif // FLTK_HAVE_PEN_SUPPORT Fl_Window *window = (Fl_Window*)[(FLWindow*)[theEvent window] getFl_Window]; if (!window || !window->shown() ) { @@ -2635,7 +2640,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil; - (void)mouseExited:(NSEvent *)theEvent { cocoaMouseHandler(theEvent); } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) && defined(FLTK_HAVE_PEN_SUPPORT) - (void)tabletProximity:(NSEvent *)theEvent { cocoaTabletHandler(theEvent, true); } -- cgit v1.2.3