summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-04-18 11:58:46 +0000
committerManolo Gouy <Manolo>2016-04-18 11:58:46 +0000
commit85b5f02a8b84182f779c79e671b28c6dc3dd0c25 (patch)
treece113edbaca945da07664dee2d4163144de454c5 /src
parent6818216c3047b7eea83138670f7bb6d02e7314b2 (diff)
Replace member function void Fl_X::flush() by virtual void Fl_Window_Driver::flush()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11646 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx5
-rw-r--r--src/Fl_Widget_Surface.cxx2
-rw-r--r--src/Fl_Window_Driver.cxx5
-rw-r--r--src/Fl_cocoa.mm26
-rw-r--r--src/Fl_win32.cxx2
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H1
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx9
-rw-r--r--src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx5
8 files changed, 26 insertions, 29 deletions
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 $".
//