I have a small C++ app that uses several FLTK features and currently runs well from the command line - I want to run it at boot-up using rc.local for auto start, but I don't know if the desktop GUI is required to be running for FLTK-based apps to operate. Can one run a FLTK app without having first launched the GUI?
If you want to start X yourself, first disable the default
desktop from starting up automatically on your RPI
so the machine boots to a text login console, so you can take
over starting X yourself.
Then create two scripts, for example:
/usr/local/bin/my-start-x
/usr/local/bin/my-start-apps
Your rc.local would run that first script, /usr/local/bin/my-start-x,
perhaps starting it in the background
so it doesn't block the rest of your rc.local.
The contents of /usr/local/bin/my-start-x
would be:
#!/bin/sh
xinit /usr/local/bin/my-start-apps -xinit --
..and the contents of my-start-apps would
be:
#!/bin/sh
/path/to/your/fltk-app -arg1 -arg2 &
What you should end up with is a plain X11 graphics screen,
no window manager, just the default
X environment. Your second script, 'my-start-apps' handles
starting your FLTK application, which will
inherit a DISPLAY variable that is already set, IIRC.
Up to your app to handle window placement, as you'll have no
window manager to let the user move
stuff around (which is probably what you want), and there will
be no window manager hot keys to let
the user accidentally trigger window minimize/window
close/etc, suitable for e.g. a kiosk or other dedicated
function machine.