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
This commit is contained in:
Manolo Gouy
2016-04-18 11:58:46 +00:00
parent 6818216c30
commit 85b5f02a8b
12 changed files with 27 additions and 33 deletions
+1
View File
@@ -102,6 +102,7 @@ public:
// --- window management // --- window management
virtual void take_focus(); virtual void take_focus();
virtual void flush(); // the default implementation may be enough
virtual void flush_double(); virtual void flush_double();
virtual void flush_overlay(); virtual void flush_overlay();
virtual void flush_single(); virtual void flush_single();
-1
View File
@@ -134,7 +134,6 @@ public:
static Fl_X* i(const Fl_Window* w) {return (Fl_X*)w->i;} 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 int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
static void make(Fl_Window*); static void make(Fl_Window*);
void flush();
static void set_high_resolution(bool); static void set_high_resolution(bool);
CGRect* subRect() { return subRect_; } // getter CGRect* subRect() { return subRect_; } // getter
void subRect(CGRect *r) { subRect_ = r; } // setter void subRect(CGRect *r) { subRect_ = r; } // setter
-1
View File
@@ -66,7 +66,6 @@ public:
int &bt,int &bx,int &by); int &bt,int &bx,int &by);
void make_fullscreen(int X, int Y, int W, int H); void make_fullscreen(int X, int Y, int W, int H);
void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
void flush() {w->flush();}
void set_minmax(LPMINMAXINFO minmax); void set_minmax(LPMINMAXINFO minmax);
void mapraise(); void mapraise();
int set_cursor(Fl_Cursor); int set_cursor(Fl_Cursor);
-2
View File
@@ -127,8 +127,6 @@ public:
int set_cursor(const Fl_RGB_Image*, int, int); int set_cursor(const Fl_RGB_Image*, int, int);
static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap); static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
static Fl_X* set_xid(Fl_Window*, Window); 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 x(Fl_Window* wi, int X) {wi->x(X);}
static void y(Fl_Window* wi, int Y) {wi->y(Y);} static void y(Fl_Window* wi, int Y) {wi->y(Y);}
static void activate_window(Window w); static void activate_window(Window w);
+4 -1
View File
@@ -684,7 +684,10 @@ void Fl::flush() {
if (i->wait_for_expose) {damage_ = 1; continue;} if (i->wait_for_expose) {damage_ = 1; continue;}
Fl_Window* wi = i->w; Fl_Window* wi = i->w;
if (!wi->visible_r()) continue; 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: // destroy damage regions for windows that don't use them:
if (i->region) { if (i->region) {
fl_graphics_driver->XDestroyRegion(i->region); fl_graphics_driver->XDestroyRegion(i->region);
+1 -1
View File
@@ -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(); Fl_Window *save_front = Fl::first_window();
win->show(); win->show();
Fl::check(); 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; uchar *image_data;
image_data = fl_read_image(NULL, x, y, w, h); image_data = fl_read_image(NULL, x, y, w, h);
if (save_front != win) save_front->show(); if (save_front != win) save_front->show();
+5
View File
@@ -223,6 +223,11 @@ void Fl_Window_Driver::redraw_overlay() {
Fl::damage(FL_DAMAGE_CHILD); Fl::damage(FL_DAMAGE_CHILD);
} }
void Fl_Window_Driver::flush()
{
pWindow->flush();
}
// //
// End of "$Id$". // End of "$Id$".
// //
+14 -12
View File
@@ -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, // through_drawRect = YES means the drawRect: message was sent to the view,
// thus the graphics context was prepared by the system // thus the graphics context was prepared by the system
static BOOL through_drawRect = NO; 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 BOOL through_Fl_X_flush = NO;
static int im_enabled = -1; static int im_enabled = -1;
// OS version-dependent pasteboard type names // OS version-dependent pasteboard type names
@@ -1940,7 +1940,7 @@ static void handleUpdateEvent( Fl_Window *window )
i->region = 0; i->region = 0;
} }
window->clear_damage(FL_DAMAGE_ALL); window->clear_damage(FL_DAMAGE_ALL);
i->flush(); window->driver()->flush();
window->clear_damage(); 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 * 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()) { if (w->as_gl_window()) {
w->flush(); Fl_Window_Driver::flush();
} else { } else {
make_current_counts = 1; make_current_counts = 1;
if (!through_drawRect) [[xid contentView] lockFocus]; if (!through_drawRect) [[fl_xid(w) contentView] lockFocus];
through_Fl_X_flush = YES; through_Fl_X_flush = YES;
w->flush(); Fl_Window_Driver::flush();
through_Fl_X_flush = NO; through_Fl_X_flush = NO;
if (!through_drawRect) [[xid contentView] unlockFocus]; if (!through_drawRect) [[fl_xid(w) contentView] unlockFocus];
make_current_counts = 0; make_current_counts = 0;
Fl_Cocoa_Window_Driver::q_release_context(); 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. 1) When a window is created or resized.
The system sends the drawRect: message to the window's view after having prepared the current 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 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 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. uses the window's graphics context. The window's draw() function is then executed.
2) At each round of the FLTK event loop. 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 Fl::flush() is called, that calls Fl_Cocoa_Window_Driver::flush() on each window that needs drawing.
through_Fl_X_flush is set to YES. Fl_X::flush() locks the focus to the view and calls Fl_Window::flush() Variable through_Fl_X_flush is set to YES. Fl_Cocoa_Window_Driver::flush() locks the focus to the
that calls Fl_Window::make_current() which uses the window's graphics context. view and calls Fl_Window::flush() that calls Fl_Window::make_current() which uses the window's
Fl_Window::flush() then runs the window's draw() function. 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. 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 This occurs for instance in the idle callback function of the mandelbrot test program. Variable
+1 -1
View File
@@ -1116,7 +1116,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
// Very annoying! // Very annoying!
fl_GetDC(hWnd); // Make sure we have a DC for this window... fl_GetDC(hWnd); // Make sure we have a DC for this window...
fl_save_pen(); fl_save_pen();
i->flush(); window->driver()->flush();
fl_restore_pen(); fl_restore_pen();
window->clear_damage(); window->clear_damage();
} return 0; } return 0;
@@ -77,6 +77,7 @@ public:
// --- window management // --- window management
virtual void take_focus(); virtual void take_focus();
virtual void flush();
virtual void flush_double(); virtual void flush_double();
virtual void flush_overlay(); virtual void flush_overlay();
virtual void draw_begin(); virtual void draw_begin();
@@ -108,15 +108,6 @@ void Fl_PicoAndroid_Window_Driver::flush_single()
scr->drawFrame(); 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 #if 0
void Fl_PicoAndroid_Window_Driver::flush() void Fl_PicoAndroid_Window_Driver::flush()
@@ -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 $". // End of "$Id: Fl_PicoSDL_Screen_Driver.cxx 11253 2016-03-01 00:54:21Z matt $".
// //