summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/mac.H1
-rw-r--r--src/Fl_Window.cxx7
-rw-r--r--src/Fl_cocoa.mm12
3 files changed, 10 insertions, 10 deletions
diff --git a/FL/mac.H b/FL/mac.H
index a089a0dbb..f5fd0b6f6 100644
--- a/FL/mac.H
+++ b/FL/mac.H
@@ -208,7 +208,6 @@ public:
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 calc_mac_os_version(void); // computes the fl_mac_os_version global variable
- static void do_wait_for_expose();
private:
#if FLTK_ABI_VERSION >= 10304
CGRect* subRect_; // makes sure subwindow remains inside its parent window
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index 50bc65e94..134d886de 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -401,6 +401,8 @@ void Fl_Window::free_icons() {
#endif
}
+
+#ifndef __APPLE__
/**
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() {
if (!shown()) return;
-#ifdef __APPLE__
- Fl_X::do_wait_for_expose();
-#else
while (!i || i->wait_for_expose) {
Fl::wait();
}
-#endif
}
+#endif // ! __APPLE__
//
// End of "$Id$".
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 9c91a79f8..1c10d659b 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -3085,11 +3085,13 @@ void Fl_Window::size_range_() {
}
}
-void Fl_X::do_wait_for_expose()
-{ // this will make freshly created windows appear on the screen
- [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO];
- if (fl_mac_os_version >= 101100) { // this extra message seems necessary with 10.11
- [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO];
+void Fl_Window::wait_for_expose()
+{
+ if (shown()) {
+ // this makes freshly created windows appear on the screen, if they are not there already
+ NSModalSession session = [NSApp beginModalSessionForWindow:i->xid];
+ [NSApp runModalSession:session];
+ [NSApp endModalSession:session];
}
}