summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2014-12-11 22:25:31 +0000
committerManolo Gouy <Manolo>2014-12-11 22:25:31 +0000
commite230a34cfdab9515fa3041a4947cc5b22afdf7e6 (patch)
tree5a5649804066c1ca5a3afae368b0b05abc8b60a4 /src
parentbf07d892a36926b4f41998fba179fa8d3b87174c (diff)
It is necessary to compute Fl_X::mapped_to_retina after the window is mapped
because the windowDidMove notification is not always sent. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10484 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index dcbee5d27..eca0cbf70 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -1134,6 +1134,21 @@ static void orderfront_subwindows(FLWindow *xid)
}
}
+//determines whether the window is mapped to a retina display
+static void compute_mapped_to_retina(Fl_Window *window)
+{
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if (fl_mac_os_version >= 100700) { // determine whether window is now mapped to a retina display
+ bool *mapped = &(Fl_X::i(window)->mapped_to_retina);
+ bool previous = *mapped;
+ NSSize s = [[fl_xid(window) contentView] convertSizeToBacking:NSMakeSize(10, 10)];
+ *mapped = (int(s.width + 0.5) > 10);
+ // window needs redrawn when moving from low res to retina
+ if ((!previous) && *mapped) window->redraw();
+ }
+#endif
+}
+
@interface FLWindowDelegateBefore10_6 : FLWindowDelegate
- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client;
@end
@@ -1191,16 +1206,7 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
update_e_xy_and_e_xy_root(nsw);
resize_from_system = NULL;
window->position((int)pt2.x, (int)(main_screen_height - pt2.y));
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if (fl_mac_os_version >= 100700) { // determine whether window is now mapped to a retina display
- bool *mapped = &(Fl_X::i(window)->mapped_to_retina);
- bool previous = *mapped;
- NSSize s = [[nsw contentView] convertSizeToBacking:NSMakeSize(10, 10)];
- *mapped = (int(s.width + 0.5) > 10);
- // window needs redrawn when moving from low res to retina
- if ((!previous) && *mapped) window->redraw();
- }
-#endif
+ compute_mapped_to_retina(window);
position_subwindows(window, YES);
}
fl_unlock_function();
@@ -2811,6 +2817,7 @@ void Fl_X::make(Fl_Window* w)
crect = [cw frame];
w->x(int(crect.origin.x));
w->y(int(main_screen_height - (crect.origin.y + w->h())));
+ compute_mapped_to_retina(w);
}
int old_event = Fl::e_number;