Improved Mac OS implementation of Fl_Window::wait_for_expose().

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10828 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2015-08-11 11:47:21 +00:00
parent e9888e09c5
commit 1e6bc1c73a
3 changed files with 10 additions and 10 deletions
-1
View File
@@ -208,7 +208,6 @@ public:
static Fl_Fontdesc* calc_fl_fonts(void); // computes the fl_fonts global variable static Fl_Fontdesc* calc_fl_fonts(void); // computes the fl_fonts global variable
static int dnd(int use_selection); // call Fl_X::dnd(1) to support text dragging static int dnd(int use_selection); // call Fl_X::dnd(1) to support text dragging
static int calc_mac_os_version(void); // computes the fl_mac_os_version global variable static int calc_mac_os_version(void); // computes the fl_mac_os_version global variable
static void do_wait_for_expose();
private: private:
#if FLTK_ABI_VERSION >= 10304 #if FLTK_ABI_VERSION >= 10304
CGRect* subRect_; // makes sure subwindow remains inside its parent window CGRect* subRect_; // makes sure subwindow remains inside its parent window
+3 -4
View File
@@ -401,6 +401,8 @@ void Fl_Window::free_icons() {
#endif #endif
} }
#ifndef __APPLE__
/** /**
Waits for the window to be displayed after calling show(). Waits for the window to be displayed after calling show().
@@ -462,14 +464,11 @@ void Fl_Window::free_icons() {
void Fl_Window::wait_for_expose() { void Fl_Window::wait_for_expose() {
if (!shown()) return; if (!shown()) return;
#ifdef __APPLE__
Fl_X::do_wait_for_expose();
#else
while (!i || i->wait_for_expose) { while (!i || i->wait_for_expose) {
Fl::wait(); Fl::wait();
} }
#endif
} }
#endif // ! __APPLE__
// //
// End of "$Id$". // End of "$Id$".
+7 -5
View File
@@ -3085,11 +3085,13 @@ void Fl_Window::size_range_() {
} }
} }
void Fl_X::do_wait_for_expose() void Fl_Window::wait_for_expose()
{ // this will make freshly created windows appear on the screen {
[NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO]; if (shown()) {
if (fl_mac_os_version >= 101100) { // this extra message seems necessary with 10.11 // this makes freshly created windows appear on the screen, if they are not there already
[NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO]; NSModalSession session = [NSApp beginModalSessionForWindow:i->xid];
[NSApp runModalSession:session];
[NSApp endModalSession:session];
} }
} }