Private constructor in Fl_Display_Device

11 views
Skip to first unread message

Andreas Held

unread,
Mar 30, 2025, 11:20:28 AM3/30/25
to fltk.general
Hi
I am one of the maintainers of pyFltk, the Python bindings for fltk. We are currently having one issue with class Fl_Display_Device. Namely, the constructor is declared private and this causes problems when we are wrapping this class for exposure to Python. Would it be possible to make the constructor protected?

Best regards

Andreas

Matthias Melcher

unread,
Mar 30, 2025, 3:50:52 PM3/30/25
to fltk.general

The Fl_Display_Device constructor is called by Fl_Display_Device *Fl_Display_Device::display_device() which is usually first called by open_display(). It's a lazy initialization to avoid connecting to the display if an app has the option to run in command line only mode (like Fluid). It should never be called by the user, so it should not be exposed. It's used as a singleton, no more than one instance can ever exit.


If you need read access, you can just call Fl_Display_Device::display_device().


Can you convince Swig to accept a class without constructor? Or is there another reason why you need access?



Reply all
Reply to author
Forward
0 new messages