Rewrite Fl_Window::wait_for_expose() using the window driver approach.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11346 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2016-03-11 08:31:36 +00:00
parent 2952c530b8
commit 408d0672a4
8 changed files with 26 additions and 12 deletions

View File

@ -64,6 +64,7 @@ public:
virtual void icon(const void * ic) {}
virtual void free_icons() {}
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() {}
};

View File

@ -363,8 +363,6 @@ void Fl_Window::free_icons() {
pWindowDriver->free_icons();
}
#ifndef __APPLE__ // PORTME: Fl_Window_Driver - platform window driver
/**
Waits for the window to be displayed after calling show().
@ -425,16 +423,10 @@ void Fl_Window::free_icons() {
Note that the window will not be responsive until the event loop
is started with Fl::run().
*/
void Fl_Window::wait_for_expose() {
if (!shown()) return;
while (!i || i->wait_for_expose) {
Fl::wait();
}
pWindowDriver->wait_for_expose();
}
#endif // ! __APPLE__ // PORTME: Fl_Window_Driver - platform window driver
//
// End of "$Id$".
//

View File

@ -3095,11 +3095,11 @@ void Fl_Window::size_range_() {
}
}
void Fl_Window::wait_for_expose()
void Fl_Cocoa_Window_Driver::wait_for_expose()
{
if (shown()) {
if (pWindow->shown()) { //TODO: do that also for pWindow's subwindows
// this makes freshly created windows appear on the screen, if they are not there already
NSModalSession session = [NSApp beginModalSessionForWindow:i->xid];
NSModalSession session = [NSApp beginModalSessionForWindow:Fl_X::i(pWindow)->xid];
[NSApp runModalSession:session];
[NSApp endModalSession:session];
}

View File

@ -65,6 +65,8 @@ public:
virtual void draw();
// that one is implemented in Fl_Cocoa.mm because it uses Objective-c
virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right);
//this one is in Fl_cocoa.mm because it uses Objective-c
virtual void wait_for_expose();
};

View File

@ -75,6 +75,7 @@ public:
void icons(HICON big_icon, HICON small_icon);
// 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();
};

View File

@ -18,6 +18,7 @@
#include "../../config_lib.h"
#include <FL/Fl.H>
#include "Fl_WinAPI_Window_Driver.H"
#include <windows.h>
@ -247,6 +248,14 @@ void Fl_WinAPI_Window_Driver::icons(HICON big_icon, HICON small_icon)
Fl_X::i(pWindow)->set_icons();
}
void Fl_WinAPI_Window_Driver::wait_for_expose() {
if (!pWindow->shown()) return;
Fl_X *i = Fl_X::i(pWindow);
while (!i || i->wait_for_expose) {
Fl::wait();
}
}
//
// End of "$Id$".
//

View File

@ -74,6 +74,7 @@ public:
virtual void icon(const void * ic);
virtual void free_icons();
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();
};

View File

@ -331,6 +331,14 @@ 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 (!pWindow->shown()) return;
Fl_X *i = Fl_X::i(pWindow);
while (!i || i->wait_for_expose) {
Fl::wait();
}
}
//
// End of "$Id$".
//