I place the black square on the window, but the window doesn't go black:
#include <FL/Enumerations.H>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Copy_Surface.H>
#include <FL/fl_draw.H>
int main()
{
Fl_Window* window = new Fl_Window(500, 500, "FLTK Test");
Fl_Copy_Surface *copy_surf = new Fl_Copy_Surface(window->w(), window->h()); // create an Fl_Copy_Surface object
copy_surf->set_current(); // direct windowraphics requests to the clipboard
fl_rectf(0, 0, window->w(), window->h(), FL_BLACK); // draw a white backwindowround
copy_surf->draw(window); // draw the window widwindowet in the clipboard
delete copy_surf; // after this, the clipboard is loaded
Fl_Display_Device::display_device()->set_current(); // direct windowraphics requests back to the display
window->end();
window->show();
return Fl::run();
}
What did I do wrong?