MacOS 10.10+: Fl_Window::fullscreen() and fullscreen_off() no longer call Fl_Window::hide() + Fl_Window::show()
The new procedure essentially resizes the window, as done on the X11+EWMH and Windows platforms. This improves in particular the possibility to turn an Fl_Gl_Window fullscreen on and off. MacOS 10.10+ is required because the procedure isn't stable (random crashes during fast switches) with 10.9. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@13051 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
226b64e9bd
commit
39bb0bf488
@ -2926,18 +2926,42 @@ void Fl_X::GLcontext_makecurrent(NSOpenGLContext* ctxt)
|
|||||||
|
|
||||||
void Fl_Window::fullscreen_x() {
|
void Fl_Window::fullscreen_x() {
|
||||||
_set_fullscreen();
|
_set_fullscreen();
|
||||||
/* On OS X < 10.6, it is necessary to recreate the window. This is done
|
if (fl_mac_os_version < 101000) {
|
||||||
with hide+show. */
|
// On OS X < 10.6, it is necessary to recreate the window. This is done with hide+show.
|
||||||
hide();
|
// The alternative procedure isn't stable until MacOS 10.10
|
||||||
show();
|
hide();
|
||||||
|
show();
|
||||||
|
} else {
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||||
|
[i->xid setStyleMask:NSBorderlessWindowMask]; //10.6
|
||||||
|
#endif
|
||||||
|
[i->xid setLevel:NSStatusWindowLevel];
|
||||||
|
int X,Y,W,H;
|
||||||
|
Fl::screen_xywh(X, Y, W, H, x(), y(), w(), h());
|
||||||
|
resize(X, Y, W, H);
|
||||||
|
}
|
||||||
Fl::handle(FL_FULLSCREEN, this);
|
Fl::handle(FL_FULLSCREEN, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Window::fullscreen_off_x(int X, int Y, int W, int H) {
|
void Fl_Window::fullscreen_off_x(int X, int Y, int W, int H) {
|
||||||
_clear_fullscreen();
|
_clear_fullscreen();
|
||||||
hide();
|
if (fl_mac_os_version < 101000) {
|
||||||
resize(X, Y, W, H);
|
hide();
|
||||||
show();
|
resize(X, Y, W, H);
|
||||||
|
show();
|
||||||
|
} else {
|
||||||
|
NSUInteger winstyle = (border() ?
|
||||||
|
(NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask) : NSBorderlessWindowMask);
|
||||||
|
if (!modal()) winstyle |= NSMiniaturizableWindowMask;
|
||||||
|
NSInteger level = NSNormalWindowLevel;
|
||||||
|
if (modal()) level = modal_window_level();
|
||||||
|
else if (non_modal()) level = non_modal_window_level();
|
||||||
|
[i->xid setLevel:level];
|
||||||
|
resize(X, Y, W, H);
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||||
|
[i->xid setStyleMask:winstyle]; //10.6
|
||||||
|
#endif
|
||||||
|
}
|
||||||
Fl::handle(FL_FULLSCREEN, this);
|
Fl::handle(FL_FULLSCREEN, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3293,7 +3317,7 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
|
|||||||
by += parent->y();
|
by += parent->y();
|
||||||
parent = parent->window();
|
parent = parent->window();
|
||||||
}
|
}
|
||||||
NSRect r = NSMakeRect(bx, main_screen_height - (by + H), W, H + (border()?bt:0));
|
NSRect r = NSMakeRect(bx, main_screen_height - (by + H), W, H + ( (border()&&!fullscreen_active())?bt:0 ));
|
||||||
if (visible_r()) [fl_xid(this) setFrame:r display:YES];
|
if (visible_r()) [fl_xid(this) setFrame:r display:YES];
|
||||||
} else {
|
} else {
|
||||||
bx = X; by = Y;
|
bx = X; by = Y;
|
||||||
|
Loading…
Reference in New Issue
Block a user