summaryrefslogtreecommitdiff
path: root/src/Fl_cocoa.mm
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2012-03-23 16:47:53 +0000
committerManolo Gouy <Manolo>2012-03-23 16:47:53 +0000
commit08ce2e07d379d6b9925208b5da9323f948b634db (patch)
treecff1ab07cf0952cec8c1cf874ba9bcc7b241a041 /src/Fl_cocoa.mm
parent8cd98f5236618f8ab9d576e709308b43246bc7ac (diff)
Fix STR#2641: true fullscreen windows that cover all their screen including menu bar, task bar, dock.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9299 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_cocoa.mm')
-rw-r--r--src/Fl_cocoa.mm30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 693cd07a4..8c1a5474b 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -931,6 +931,10 @@ void fl_open_callback(void (*cb)(const char *)) {
fl_lock_function();
FLWindow *nsw = (FLWindow*)[notif object];
Fl_Window *window = [nsw getFl_Window];
+ /* Fullscreen windows obscure all other windows so we need to return
+ to a "normal" level when the user switches to another window */
+ if (window->fullscreen_active())
+ [nsw setLevel:NSNormalWindowLevel];
Fl::handle( FL_UNFOCUS, window);
fl_unlock_function();
}
@@ -939,6 +943,9 @@ void fl_open_callback(void (*cb)(const char *)) {
fl_lock_function();
FLWindow *nsw = (FLWindow*)[notif object];
Fl_Window *w = [nsw getFl_Window];
+ /* Restore previous fullscreen level */
+ if (w->fullscreen_active())
+ [nsw setLevel:NSStatusWindowLevel];
if ( w->border() || (!w->modal() && !w->tooltip_window()) ) Fl::handle( FL_FOCUS, w);
fl_unlock_function();
}
@@ -1914,6 +1921,22 @@ static void q_set_window_title(NSWindow *nsw, const char * name, const char *mi
@end
+void Fl_Window::fullscreen_x() {
+ _set_fullscreen();
+ /* On OS X < 10.6, it is necessary to recreate the window. This is done
+ with hide+show. */
+ hide();
+ show();
+ Fl::handle(FL_FULLSCREEN, this);
+}
+
+void Fl_Window::fullscreen_off_x(int X, int Y, int W, int H) {
+ _clear_fullscreen();
+ hide();
+ resize(X, Y, W, H);
+ show();
+ Fl::handle(FL_FULLSCREEN, this);
+}
/*
* go ahead, create that (sub)window
@@ -2030,6 +2053,13 @@ void Fl_X::make(Fl_Window* w)
x->gc = 0;
NSRect crect;
+ if (w->flags() & Fl_Widget::FULLSCREEN) {
+ int sx, sy, sw, sh;
+ Fl::screen_xywh(sx, sy, sw, sh, w->x(), w->y(), w->w(), w->h());
+ w->resize(sx, sy, sw, sh);
+ winstyle = NSBorderlessWindowMask;
+ winlevel = NSStatusWindowLevel;
+ }
crect.origin.x = w->x();
crect.origin.y = main_screen_height - (w->y() + w->h());
crect.size.width=w->w();