diff options
| -rw-r--r-- | FL/Fl_Window_Driver.H | 1 | ||||
| -rw-r--r-- | FL/mac.H | 1 | ||||
| -rw-r--r-- | FL/win32.H | 1 | ||||
| -rw-r--r-- | FL/x.H | 2 | ||||
| -rw-r--r-- | src/Fl.cxx | 5 | ||||
| -rw-r--r-- | src/Fl_Widget_Surface.cxx | 2 | ||||
| -rw-r--r-- | src/Fl_Window_Driver.cxx | 5 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 26 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx | 9 | ||||
| -rw-r--r-- | src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx | 5 |
12 files changed, 27 insertions, 33 deletions
diff --git a/FL/Fl_Window_Driver.H b/FL/Fl_Window_Driver.H index db1f33f9f..62fe68637 100644 --- a/FL/Fl_Window_Driver.H +++ b/FL/Fl_Window_Driver.H @@ -102,6 +102,7 @@ public: // --- window management virtual void take_focus(); + virtual void flush(); // the default implementation may be enough virtual void flush_double(); virtual void flush_overlay(); virtual void flush_single(); @@ -134,7 +134,6 @@ public: static Fl_X* i(const Fl_Window* w) {return (Fl_X*)w->i;} static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&); static void make(Fl_Window*); - void flush(); static void set_high_resolution(bool); CGRect* subRect() { return subRect_; } // getter void subRect(CGRect *r) { subRect_ = r; } // setter diff --git a/FL/win32.H b/FL/win32.H index b866f0796..0a43a2c75 100644 --- a/FL/win32.H +++ b/FL/win32.H @@ -66,7 +66,6 @@ public: int &bt,int &bx,int &by); void make_fullscreen(int X, int Y, int W, int H); void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} - void flush() {w->flush();} void set_minmax(LPMINMAXINFO minmax); void mapraise(); int set_cursor(Fl_Cursor); @@ -127,8 +127,6 @@ public: int set_cursor(const Fl_RGB_Image*, int, int); static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap); static Fl_X* set_xid(Fl_Window*, Window); - // kludges to get around protection: - void flush() {w->flush();} static void x(Fl_Window* wi, int X) {wi->x(X);} static void y(Fl_Window* wi, int Y) {wi->y(Y);} static void activate_window(Window w); diff --git a/src/Fl.cxx b/src/Fl.cxx index 38b9434b5..082f818b6 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -684,7 +684,10 @@ void Fl::flush() { if (i->wait_for_expose) {damage_ = 1; continue;} Fl_Window* wi = i->w; if (!wi->visible_r()) continue; - if (wi->damage()) {i->flush(); wi->clear_damage();} + if (wi->damage()) { + wi->driver()->flush(); + wi->clear_damage(); + } // destroy damage regions for windows that don't use them: if (i->region) { fl_graphics_driver->XDestroyRegion(i->region); diff --git a/src/Fl_Widget_Surface.cxx b/src/Fl_Widget_Surface.cxx index 3d557cdde..547df69d3 100644 --- a/src/Fl_Widget_Surface.cxx +++ b/src/Fl_Widget_Surface.cxx @@ -153,7 +153,7 @@ void Fl_Widget_Surface::print_window_part(Fl_Window *win, int x, int y, int w, i Fl_Window *save_front = Fl::first_window(); win->show(); Fl::check(); - Fl_X::i(win)->flush(); // makes the window current necessary for fl_read_image + win->driver()->flush(); // makes the window current necessary for fl_read_image uchar *image_data; image_data = fl_read_image(NULL, x, y, w, h); if (save_front != win) save_front->show(); diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx index 012eb9a93..ac438d32a 100644 --- a/src/Fl_Window_Driver.cxx +++ b/src/Fl_Window_Driver.cxx @@ -223,6 +223,11 @@ void Fl_Window_Driver::redraw_overlay() { Fl::damage(FL_DAMAGE_CHILD); } +void Fl_Window_Driver::flush() +{ + pWindow->flush(); +} + // // End of "$Id$". // diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 4a205b03a..eebd07da1 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -101,7 +101,7 @@ static int main_screen_height; // height of menubar-containing screen used to co // through_drawRect = YES means the drawRect: message was sent to the view, // thus the graphics context was prepared by the system static BOOL through_drawRect = NO; -// through_Fl_X_flush = YES means Fl_X::flush() was called +// through_Fl_X_flush = YES means Fl_Cocoa_Window_Driver::flush() was called static BOOL through_Fl_X_flush = NO; static int im_enabled = -1; // OS version-dependent pasteboard type names @@ -1940,7 +1940,7 @@ static void handleUpdateEvent( Fl_Window *window ) i->region = 0; } window->clear_damage(FL_DAMAGE_ALL); - i->flush(); + window->driver()->flush(); window->clear_damage(); } @@ -2856,17 +2856,18 @@ void Fl_X::GLcontext_makecurrent(NSOpenGLContext* ctxt) /* * Initialize the given port for redraw and call the window's flush() to actually draw the content */ -void Fl_X::flush() +void Fl_Cocoa_Window_Driver::flush() { + Fl_Window *w = pWindow; if (w->as_gl_window()) { - w->flush(); + Fl_Window_Driver::flush(); } else { make_current_counts = 1; - if (!through_drawRect) [[xid contentView] lockFocus]; + if (!through_drawRect) [[fl_xid(w) contentView] lockFocus]; through_Fl_X_flush = YES; - w->flush(); + Fl_Window_Driver::flush(); through_Fl_X_flush = NO; - if (!through_drawRect) [[xid contentView] unlockFocus]; + if (!through_drawRect) [[fl_xid(w) contentView] unlockFocus]; make_current_counts = 0; Fl_Cocoa_Window_Driver::q_release_context(); } @@ -3226,15 +3227,16 @@ void Fl_Cocoa_Window_Driver::resize(int X,int Y,int W,int H) { 1) When a window is created or resized. The system sends the drawRect: message to the window's view after having prepared the current graphics context to draw to this view. Processing of drawRect: sets variable through_drawRect - to YES and calls handleUpdateEvent() that calls Fl_X::flush(). Fl_X::flush() sets through_Fl_X_flush + to YES and calls handleUpdateEvent() that calls Fl_Cocoa_Window_Driver::flush(). + Fl_Cocoa_Window_Driver::flush() sets through_Fl_X_flush to YES and calls Fl_Window::flush() that calls Fl_Window::make_current() that uses the window's graphics context. The window's draw() function is then executed. 2) At each round of the FLTK event loop. - Fl::flush() is called, that calls Fl_X::flush() on each window that needs drawing. Variable - through_Fl_X_flush is set to YES. Fl_X::flush() locks the focus to the view and calls Fl_Window::flush() - that calls Fl_Window::make_current() which uses the window's graphics context. - Fl_Window::flush() then runs the window's draw() function. + Fl::flush() is called, that calls Fl_Cocoa_Window_Driver::flush() on each window that needs drawing. + Variable through_Fl_X_flush is set to YES. Fl_Cocoa_Window_Driver::flush() locks the focus to the + view and calls Fl_Window::flush() that calls Fl_Window::make_current() which uses the window's + graphics context. Fl_Window::flush() then runs the window's draw() function. 3) An FLTK application can call Fl_Window::make_current() at any time before it draws to a window. This occurs for instance in the idle callback function of the mandelbrot test program. Variable diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 3bf114404..f9b48b78a 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1116,7 +1116,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar // Very annoying! fl_GetDC(hWnd); // Make sure we have a DC for this window... fl_save_pen(); - i->flush(); + window->driver()->flush(); fl_restore_pen(); window->clear_damage(); } return 0; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index 67e2aa77c..9f72f7725 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -77,6 +77,7 @@ public: // --- window management virtual void take_focus(); + virtual void flush(); virtual void flush_double(); virtual void flush_overlay(); virtual void draw_begin(); diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx index b2024bf01..82c5d0927 100644 --- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx @@ -108,15 +108,6 @@ void Fl_PicoAndroid_Window_Driver::flush_single() scr->drawFrame(); } -#if !defined(FL_DOXYGEN) // FIXME - silence Doxygen warning - -void Fl_X::flush() -{ - w->flush(); -} - -#endif // !defined(FL_DOXYGEN) // FIXME - silence Doxygen warning - #if 0 void Fl_PicoAndroid_Window_Driver::flush() diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx index f4cd70926..e12fc1ae5 100644 --- a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx +++ b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx @@ -167,11 +167,6 @@ void Fl::remove_fd(int) { } -void Fl_X::flush() -{ - w->flush(); -} - // // End of "$Id: Fl_PicoSDL_Screen_Driver.cxx 11253 2016-03-01 00:54:21Z matt $". // |
