summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2026-01-08 21:22:03 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2026-01-08 21:22:03 +0100
commit4908dfd72a343ee7c35bc55a55ad860052e21fae (patch)
treefc8e9a7af14ce3b70648870593a4724a14a4ff66 /src
parent7fae181d9503c436a486c6810c07a3320a27d233 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt40
-rw-r--r--src/Fl_cocoa.mm11
-rw-r--r--src/Fl_grab.cxx3
-rw-r--r--src/Fl_win32.cxx2
-rw-r--r--src/drivers/Wayland/fl_wayland_platform_init.cxx3
-rw-r--r--src/drivers/X11/fl_X11_platform_init.cxx2
6 files changed, 45 insertions, 16 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 55f5166b2..bae8d0e81 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -241,7 +241,6 @@ if(FLTK_USE_X11 AND NOT FLTK_USE_WAYLAND)
drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx
drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx
drivers/X11/fl_X11_platform_init.cxx
- drivers/Base/Fl_Base_Pen_Events.cxx
Fl_x.cxx
fl_dnd_x.cxx
Fl_Native_File_Chooser_FLTK.cxx
@@ -249,9 +248,9 @@ if(FLTK_USE_X11 AND NOT FLTK_USE_WAYLAND)
Fl_get_key.cxx
)
- list(APPEND DRIVER_FILES
- Fl_Native_File_Chooser_Kdialog.cxx
- Fl_Native_File_Chooser_Zenity.cxx)
+ list(APPEND DRIVER_FILES
+ Fl_Native_File_Chooser_Kdialog.cxx
+ Fl_Native_File_Chooser_Zenity.cxx)
if(FLTK_USE_CAIRO)
list(APPEND DRIVER_FILES
@@ -291,7 +290,6 @@ if(FLTK_USE_X11 AND NOT FLTK_USE_WAYLAND)
drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.H
drivers/Xlib/Fl_Xlib_Image_Surface_Driver.H
drivers/Unix/Fl_Unix_System_Driver.H
- drivers/Base/Fl_Base_Pen_Events.H
)
if(FLTK_USE_CAIRO)
set(DRIVER_HEADER_FILES ${DRIVER_HEADER_FILES}
@@ -319,7 +317,6 @@ elseif(FLTK_USE_WAYLAND)
drivers/Wayland/fl_wayland_clipboard_dnd.cxx
drivers/Wayland/fl_wayland_platform_init.cxx
drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
- drivers/Base/Fl_Base_Pen_Events.cxx
Fl_Native_File_Chooser_FLTK.cxx
Fl_Native_File_Chooser_GTK.cxx
)
@@ -351,7 +348,6 @@ elseif(FLTK_USE_WAYLAND)
drivers/Wayland/Fl_Wayland_Copy_Surface_Driver.H
drivers/Wayland/Fl_Wayland_Image_Surface_Driver.H
drivers/Unix/Fl_Unix_System_Driver.H
- drivers/Base/Fl_Base_Pen_Events.H
)
elseif(APPLE)
@@ -373,7 +369,6 @@ elseif(APPLE)
drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
drivers/Posix/Fl_Posix_System_Driver.cxx
drivers/Darwin/Fl_Darwin_System_Driver.cxx
- drivers/Base/Fl_Base_Pen_Events.cxx
Fl_get_key_mac.cxx
drivers/Darwin/fl_macOS_platform_init.cxx
)
@@ -387,7 +382,6 @@ elseif(APPLE)
drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.H
drivers/Quartz/Fl_Font.H
drivers/Quartz/Fl_Quartz_Image_Surface_Driver.H
- drivers/Base/Fl_Base_Pen_Events.H
)
else()
@@ -399,7 +393,6 @@ else()
drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
drivers/WinAPI/Fl_WinAPI_Printer_Driver.cxx
- drivers/WinAPI/Fl_WinAPI_Pen_Driver.cxx
drivers/GDI/Fl_GDI_Graphics_Driver.cxx
drivers/GDI/Fl_GDI_Graphics_Driver_arci.cxx
drivers/GDI/Fl_GDI_Graphics_Driver_color.cxx
@@ -410,7 +403,6 @@ else()
drivers/GDI/Fl_GDI_Graphics_Driver_vertex.cxx
drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx
- drivers/Base/Fl_Base_Pen_Events.cxx
Fl_win32.cxx
fl_dnd_win32.cxx
Fl_Native_File_Chooser_WIN32.cxx
@@ -425,11 +417,29 @@ else()
drivers/GDI/Fl_Font.H
drivers/GDI/Fl_GDI_Copy_Surface_Driver.H
drivers/GDI/Fl_GDI_Image_Surface_Driver.H
- drivers/Base/Fl_Base_Pen_Events.H
)
+ # Optional Pen/Tablet Support
+
+ if(FLTK_OPTION_PEN_SUPPORT)
+ list(APPEND DRIVER_FILES
+ drivers/WinAPI/Fl_WinAPI_Pen_Driver.cxx
+ )
+ endif(FLTK_OPTION_PEN_SUPPORT)
+
endif(FLTK_USE_X11 AND NOT FLTK_USE_WAYLAND)
+# Common Pen/Tablet Support Files
+
+if(FLTK_OPTION_PEN_SUPPORT)
+ list(APPEND DRIVER_FILES
+ drivers/Base/Fl_Base_Pen_Events.cxx
+ )
+ list(APPEND DRIVER_HEADER_FILES
+ drivers/Base/Fl_Base_Pen_Events.H
+ )
+endif(FLTK_OPTION_PEN_SUPPORT)
+
source_group("Header Files" FILES ${HEADER_FILES})
source_group("Private Header Files" FILES ${PRIVATE_HEADER_FILES})
source_group("Driver Source Files" FILES ${DRIVER_FILES})
@@ -632,10 +642,14 @@ if(APPLE AND NOT FLTK_BACKEND_X11)
set(MMFILES
Fl_cocoa.mm
drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
- drivers/Cocoa/Fl_Cocoa_Pen_Events.mm
Fl_Native_File_Chooser_MAC.mm
Fl_MacOS_Sys_Menu_Bar.mm
)
+ if(FLTK_OPTION_PEN_SUPPORT)
+ list(APPEND MMFILES
+ drivers/Cocoa/Fl_Cocoa_Pen_Events.mm
+ )
+ endif()
source_group("ObjC Source Files" FILES ${MMFILES})
else()
set(MMFILES)
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);
}
diff --git a/src/Fl_grab.cxx b/src/Fl_grab.cxx
index d9f47c445..9def8ee4f 100644
--- a/src/Fl_grab.cxx
+++ b/src/Fl_grab.cxx
@@ -14,6 +14,7 @@
// https://www.fltk.org/bugs.php
//
+#include <config.h>
#include <FL/Fl.H>
#include "Fl_Screen_Driver.H"
@@ -27,6 +28,8 @@
void Fl::grab(Fl_Window *win)
{
+#if defined(FLTK_HAVE_PEN_SUPPORT)
Fl::Pen::release();
+#endif
screen_driver()->grab(win);
}
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index abb875be7..cbc5fbd83 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1837,9 +1837,11 @@ content key keyboard layout
return 0;
default: {
+#if defined(FLTK_HAVE_PEN_SUPPORT)
LRESULT ret = fl_win32_tablet_handler(fl_msg);
if (ret != -1)
return ret;
+#endif
if (Fl::handle(0, 0))
return 0;
break; }
diff --git a/src/drivers/Wayland/fl_wayland_platform_init.cxx b/src/drivers/Wayland/fl_wayland_platform_init.cxx
index a97e3846b..4c4477740 100644
--- a/src/drivers/Wayland/fl_wayland_platform_init.cxx
+++ b/src/drivers/Wayland/fl_wayland_platform_init.cxx
@@ -145,6 +145,8 @@ Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, i
return new Fl_Wayland_Image_Surface_Driver(w, h, high_res, off);
}
+#if defined(FLTK_HAVE_PEN_SUPPORT)
+
namespace Fl {
namespace Pen {
Driver default_driver;
@@ -152,3 +154,4 @@ Driver& driver = default_driver;
} // namespace Pen
} // namespace Fl
+#endif // FLTK_HAVE_PEN_SUPPORT
diff --git a/src/drivers/X11/fl_X11_platform_init.cxx b/src/drivers/X11/fl_X11_platform_init.cxx
index 022513d5a..6a2851900 100644
--- a/src/drivers/X11/fl_X11_platform_init.cxx
+++ b/src/drivers/X11/fl_X11_platform_init.cxx
@@ -75,9 +75,11 @@ Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, i
return new Fl_Xlib_Image_Surface_Driver(w, h, high_res, off);
}
+#if defined(FLTK_HAVE_PEN_SUPPORT)
namespace Fl {
namespace Pen {
Driver default_driver;
Driver& driver = default_driver;
} // namespace Pen
} // namespace Fl
+#endif // FLTK_HAVE_PEN_SUPPORT