Move wait_for_expose member variable from class Fl_X to class Fl_Window_Driver.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11653 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2016-04-18 16:11:15 +00:00
parent 0629b40afd
commit e790ac9653
16 changed files with 23 additions and 36 deletions

View File

@ -52,6 +52,7 @@ public:
Fl_Window_Driver(Fl_Window *);
virtual ~Fl_Window_Driver();
static Fl_Window_Driver *newWindowDriver(Fl_Window *);
int wait_for_expose_value;
// --- frequently used accessors to public window data
/** returns the x coordinate of the window. */
@ -119,7 +120,7 @@ public:
virtual void label(const char *name, const char *mininame);
virtual Fl_X *makeWindow() { /* FIXME: move Fl_X::make(Fl_Window*) here for OSX, MSWin, and X11 */ return 0; }
virtual void wait_for_expose() {}
virtual void wait_for_expose();
virtual void destroy_double_buffer();
virtual void show();
virtual void show_menu();

View File

@ -128,7 +128,6 @@ public:
Fl_Window *w; // FLTK window for
Fl_Region region;
Fl_X *next; // chain of mapped windows
int wait_for_expose;
static Fl_X* first;
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&);

View File

@ -54,7 +54,6 @@ public:
Fl_Window* w;
Fl_Region region;
Fl_X *next;
int wait_for_expose;
HDC private_dc; // used for OpenGL
HDC saved_hdc; // saves the handle of the DC currently loaded
// static variables, static functions and member functions

1
FL/x.H
View File

@ -117,7 +117,6 @@ public:
Fl_Window *w;
Fl_Region region;
Fl_X *next;
char wait_for_expose;
static Fl_X* first;
static Fl_X* i(const Fl_Window* wi) {return wi->i;}
static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);

View File

@ -681,8 +681,8 @@ void Fl::flush() {
if (damage()) {
damage_ = 0;
for (Fl_X* i = Fl_X::first; i; i = i->next) {
if (i->wait_for_expose) {damage_ = 1; continue;}
Fl_Window* wi = i->w;
if (wi->driver()->wait_for_expose_value) {damage_ = 1; continue;}
if (!wi->visible_r()) continue;
if (wi->damage()) {
wi->driver()->flush();

View File

@ -240,6 +240,14 @@ int Fl_Window_Driver::set_cursor(const Fl_RGB_Image*, int, int) {
return 0;
}
void Fl_Window_Driver::wait_for_expose() {
if (!shown()) return;
Fl_X *i = Fl_X::i(pWindow);
while (!i || wait_for_expose_value) {
Fl::wait();
}
}
//
// End of "$Id$".
//

View File

@ -1931,9 +1931,9 @@ static void handleUpdateEvent( Fl_Window *window )
static convertSizeIMP addr = (convertSizeIMP)[NSView instanceMethodForSelector:@selector(convertSizeToBacking:)];
NSSize s = addr([i->xid contentView], @selector(convertSizeToBacking:), NSMakeSize(10, 10));
i->mapped_to_retina( int(s.width + 0.5) > 10 );
if (i->wait_for_expose == 0 && previous != i->mapped_to_retina()) i->changed_resolution(true);
if (window->driver()->wait_for_expose_value == 0 && previous != i->mapped_to_retina()) i->changed_resolution(true);
}
i->wait_for_expose = 0;
window->driver()->wait_for_expose_value = 0;
if ( i->region ) {
Fl_Graphics_Driver::default_driver().XDestroyRegion(i->region);
@ -3001,7 +3001,7 @@ void Fl_X::make(Fl_Window* w)
}
x->xid = cw;
x->w = w; w->i = x;
x->wait_for_expose = 1;
w->driver()->wait_for_expose_value = 1;
if (!w->parent()) {
x->next = Fl_X::first;
Fl_X::first = x;

View File

@ -1083,7 +1083,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_PAINT: {
Fl_Region R;
Fl_X *i = Fl_X::i(window);
i->wait_for_expose = 0;
window->driver()->wait_for_expose_value = 0;
char redraw_whole_window = false;
if (!i->region && window->damage()) {
// Redraw the whole window...
@ -1585,7 +1585,7 @@ void Fl_WinAPI_Window_Driver::resize(int X,int Y,int W,int H) {
// with no width or height will never get an exposure event
Fl_X *i = Fl_X::i(pWindow);
if (i && W>0 && H>0)
i->wait_for_expose = 1;
wait_for_expose_value = 1;
}
} else {
x(X); y(Y);
@ -1850,7 +1850,7 @@ Fl_X* Fl_X::make(Fl_Window* w) {
if (!fl_clipboard_notify_empty() && clipboard_wnd == NULL)
fl_clipboard_notify_target(x->xid);
x->wait_for_expose = 1;
w->driver()->wait_for_expose_value = 1;
if (Fl_Window::show_iconic_) {showit = 0; Fl_Window::show_iconic_ = 0;}
if (showit) {
w->set_visible();

View File

@ -1633,7 +1633,7 @@ fprintf(stderr,"\n");*/
break;
case Expose:
Fl_X::i(window)->wait_for_expose = 0;
window->driver()->wait_for_expose_value = 0;
# if 0
// try to keep windows on top even if WM_TRANSIENT_FOR does not work:
// opaque move/resize window managers do not like this, so I disabled it.
@ -2220,7 +2220,7 @@ Fl_X* Fl_X::set_xid(Fl_Window* win, Window winxid) {
xp->w = win; win->i = xp;
xp->next = Fl_X::first;
xp->region = 0;
xp->wait_for_expose = 1;
win->driver()->wait_for_expose_value = 1;
#ifdef USE_XDBE
((Fl_X11_Window_Driver*)win->pWindowDriver)->backbuffer_bad = 1;
#endif

View File

@ -80,7 +80,7 @@ Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow()
pNativeWindow = scr->pApp->window;
// x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED);
x->next = Fl_X::first;
x->wait_for_expose = 0;
wait_for_expose_value = 0;
pWindow->i = x;
Fl_X::first = x;

View File

@ -61,7 +61,7 @@ double Fl_PicoSDL_Screen_Driver::wait(double time_to_wait)
//event->window.windowID
if ( !window ) break;;
Fl_X *i = Fl_X::i(Fl::first_window());
i->wait_for_expose = 0;
i->w->driver()->wait_for_expose_value = 0;
if ( i->region ) {
XDestroyRegion(i->region);
@ -70,7 +70,7 @@ double Fl_PicoSDL_Screen_Driver::wait(double time_to_wait)
window->clear_damage(FL_DAMAGE_ALL);
i->flush();
window->clear_damage();
Fl_X::first->wait_for_expose = 0;
Fl_X::first->w->driver()->wait_for_expose_value = 0;
}
break;
}

View File

@ -77,7 +77,7 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow()
}
x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED);
x->next = Fl_X::first;
x->wait_for_expose = 0;
wait_for_expose_value = 0;
pWindow->i = x;
Fl_X::first = x;

View File

@ -103,7 +103,6 @@ public:
void set_icons(); // driver-internal support function
// this one is implemented in Fl_win32.cxx
virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right);
virtual void wait_for_expose();
virtual int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y,
void (*draw_area)(void*, int,int,int,int), void* data);
};

View File

@ -360,15 +360,6 @@ void Fl_WinAPI_Window_Driver::free_icons() {
}
void Fl_WinAPI_Window_Driver::wait_for_expose() {
if (!shown()) return;
Fl_X *i = Fl_X::i(pWindow);
while (!i || i->wait_for_expose) {
Fl::wait();
}
}
void Fl_WinAPI_Window_Driver::make_current() {
fl_GetDC(fl_xid(pWindow));

View File

@ -118,7 +118,6 @@ public:
virtual void free_icons();
void set_icons(); // driver-internal support function
virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right);
virtual void wait_for_expose();
virtual int can_do_overlay();
virtual void redraw_overlay();
virtual int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data);

View File

@ -428,14 +428,6 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F
previous->Fl_Surface_Device::set_current();
}
void Fl_X11_Window_Driver::wait_for_expose() {
if (!shown()) return;
Fl_X *i = Fl_X::i(pWindow);
while (!i || i->wait_for_expose) {
Fl::wait();
}
}
// make X drawing go into this window (called by subclass flush() impl.)
void Fl_X11_Window_Driver::make_current() {