On a related note, how do we envisage the "Fl::Pen::DETECTED" and related items working? They seem to be taking the same values as existing FLTK event codes, so I'm not sure how that works.They are included, for example, in names.h, so I'm not sure how to distinguish between, say, FL_RELEASE and Fl::Pen::DETECTED which will both be 2 at that point..?I'm missing something here?
On a related note, how do we envisage the "Fl::Pen::DETECTED" and related items working? They seem to be taking the same values as existing FLTK event codes, so I'm not sure how that works.
... I decided to create a CMake option to enable or disable pen support at build time (default: ON!). ...
Ian, this should keep you going with "classic" (32-bit) MinGW for now ... unless your older version has even more issues.
Please watch my commits, pull the latest Git version once I committed the option, and let us know how it works for you. Don't forget to set `CMAKE_CXX_EXTENSIONS:BOOL=ON` if you get errors like `_strdup() not declared`.
I'll post here when I pushed my commit.
commit 4908dfd72a343ee7c35bc55a55ad860052e21fae
Author: Albrecht Schlosser <...>
Date: Thu Jan 8 21:22:03 2026 +0100
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.
I know that we did similar things (redefine WINVER and/or define some
unknown symbols) in other source files. We might need to do that in our
pen related source files as well ...
Since you're using Win11 it looks as if TDM-gcc is the culprit. (?)
Therefore I decided to create a CMake option to enable or disable pen
support at build time (default: ON!). My first tests using MinGW were
successful, but I need to do some more work for all platforms. Note to
Matthias: I know that we discussed adding an option and I didn't want to
do this to avoid having even more options. However, to avoid build
problems, it seems necessary, and I'm working on it.
Ian, this should keep you going with "classic" (32-bit) MinGW for now
... unless your older version has even more issues.
Please watch my commits, pull the latest Git version once I committed
the option, and let us know how it works for you. Don't forget to set
`CMAKE_CXX_EXTENSIONS:BOOL=ON` if you get errors like `_strdup() not
declared`.
On Thursday, 8 January 2026 at 17:26:25 UTC Albrecht-S wrote:
I know that we did similar things (redefine WINVER and/or define some
unknown symbols) in other source files. We might need to do that in our
pen related source files as well ...Yeah: I'll post the "tweak" I used to test this, for reference, though I'm not really proposing we deploy this "fix"...Two files, a patch to Fl_WinAPI_Pen_Driver.cxx and a small header. This is "enough" to get the code to build/work reliably with my old TDM mingw64, but is not enough to make it work with the mingw32. (Note that this patch "pre-dates" Albrecht's addition of an option to disable the pen support in the code, though is orthogonal to it so doesn't conflict.)
On Thursday, 8 January 2026 at 17:26:25 UTC Albrecht-S wrote:
I know that we did similar things (redefine WINVER and/or define some
unknown symbols) in other source files. We might need to do that in our
pen related source files as well ...
Yeah: I'll post the "tweak" I used to test this, for reference, though I'm not really proposing we deploy this "fix"...
Two files, a patch to Fl_WinAPI_Pen_Driver.cxx and a small header. This is "enough" to get the code to build/work reliably with my old TDM mingw64, but is not enough to make it work with the mingw32. (Note that this patch "pre-dates" Albrecht's addition of an option to disable the pen support in the code, though is orthogonal to it so doesn't conflict.)
Since you're using Win11 it looks as if TDM-gcc is the culprit. (?)
Yes, certainly so, it's not the OS or the code per se.
Indeed, being pedantic about it, it is not even the compilers, it is the WIN API header files shipped with the compiler that are at fault here.
In both cases (the TDM mingw64 and the old mingw32-6.0.2) if I contrive to "fix" the WIN API header files then it all compiles just fine.
Therefore I decided to create a CMake option to enable or disable pen
support at build time (default: ON!). ...
Ian, this should keep you going with "classic" (32-bit) MinGW for now
... unless your older version has even more issues.
Please watch my commits, pull the latest Git version once I committed
the option, and let us know how it works for you. Don't forget to set
`CMAKE_CXX_EXTENSIONS:BOOL=ON` if you get errors like `_strdup() not
declared`.
OK, tested with the PEN support set to off, compiles and works fine with both of the old toolchains, so that's good.
Second attempt to post the tweaked files for this test - first one was blocked. Dunno why; here's hoping!
// Some versions of MinGW now require us to explicitly include winerror to get S_OK defined -#include <winerror.h> +//#include <winerror.h>As the comment above the line in question says, there were reasons that we had to `#include <winerror.h>`, but you commented this line out. Why did you do that, what did it fix, or ... ? Is it possible that one of your build systems doesn't provide `winerror.h` ?
Two files, a patch to Fl_WinAPI_Pen_Driver.cxx and a small header. This is "enough" to get the code to build/work reliably with my old TDM mingw64, but is not enough to make it work with the mingw32. (Note that this patch "pre-dates" Albrecht's addition of an option to disable the pen support in the code, though is orthogonal to it so doesn't conflict.)It's a shame it doesn't work with your old MinGW(-32) version. I'll try it with my version later when I have time.
In both cases (the TDM mingw64 and the old mingw32-6.0.2) if I contrive to "fix" the WIN API header files then it all compiles just fine.But I guess it wouldn't work on "older" Windows versions anyway, as we read already, some of the features require Win8, others require Win10. So I think either disabling pen support by build option or loading DLL's dynamically would be required to make it work on older systems. I'd really prefer not to add even more dynamic DLL loading for features that many users won't need (which means: after all I'd prefer the build option).
Did you need to set `CMAKE_CXX_EXTENSIONS:BOOL=ON` or did it work w/o setting this?
Hmm, there's one point in your patch that makes me wonder why you did this:
// Some versions of MinGW now require us to explicitly include winerror to get S_OK defined -#include <winerror.h> +//#include <winerror.h> As the comment above the line in question says, there were reasons that we had to `#include <winerror.h>`, but you commented this line out. Why did you do that, what did it fix, or ... ? Is it possible that one of your build systems doesn't provide `winerror.h` ?
On Friday, 9 January 2026 at 13:12:33 UTC Albrecht-S wrote:
Two files, a patch to Fl_WinAPI_Pen_Driver.cxx and a small header. This is "enough" to get the code to build/work reliably with my old TDM mingw64, but is not enough to make it work with the mingw32. (Note that this patch "pre-dates" Albrecht's addition of an option to disable the pen support in the code, though is orthogonal to it so doesn't conflict.)
It's a shame it doesn't work with your old MinGW(-32) version. I'll try it with my version later when I have time.
The _really_ old mingw32 headers need more stuff added, beyond the handful of #defines I added. In particular, they need a few structs added, and I didn't want to (re-)define those structs without first checking to see if they were already defined - which isn't easy to do at compile time (it's easy to check for #defines at compile though...)
If I do add the missing structs, then the old toolchain works.It really is just the the WIN API headers are so very out of date...
Did you need to set `CMAKE_CXX_EXTENSIONS:BOOL=ON` or did it work w/o setting this?
Sorry yes, good point - I did have `CMAKE_CXX_EXTENSIONS:BOOL=ON` during these tests.