Fl_Window::flush() is virtual and
protected.
In all derived window classes flush() is virtual and
public.
I don't see a reason why this is so, maybe it's by accident? I
verified that the situation is the same in FLTK 1.3.x.
RFC: Should we make
Fl_Window::flush() public?
No one complained but it looks neither required nor intended that
it's protected.
Details:
This minimal (complete) example program shows the issue:
#include <FL/Fl_Double_Window.H>
int main(int argc, char **argv) {
auto window = new Fl_Window(340, 180);
window->end();
window->show(argc, argv);
window->flush();
return Fl::run();
}
Error message from `fltk-config --compile`:
test/hello.cxx: In function ‘int main(int, char**)’:
test/hello.cxx:22:16: error: ‘virtual void Fl_Window::flush()’ is protected within this context
22 | window->flush();
| ~~~~~~~~~~~~~^~
In file included from [...]/FL/Fl_Double_Window.H:23,
from test/hello.cxx:17:
[...]/FL/Fl_Window.H:102:16: note: declared protected here
102 | virtual void flush();
| ^~~~~
"Solution":
Replace '
new Fl_Window(340, 180);' with '
new Fl_Double_Window(340, 180);' or any other Fl_*_Window class
and it works.
This doesn't look like intended. Since Fl_Window::flush() "makes the
window current" I don't see a reason not to make it public.
Docs say: "Forces the window to be drawn,
this window is also
made current and calls
draw(). "