summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-03-23 14:36:58 +0000
committerManolo Gouy <Manolo>2016-03-23 14:36:58 +0000
commitaffdcdb525b3a606115b3a6444f0ab7dcc4b48ac (patch)
tree8ea7b48838875022aae56edd038910399b517fd7 /src/drivers
parent979740ce91525cc301a9173731d6aaf3004a6c88 (diff)
Rewrite Fl_Window::fullscreen_x() under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11407 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H2
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx19
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H2
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx77
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.H2
5 files changed, 102 insertions, 0 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
index 07a6dd8a3..7bb5b370f 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
@@ -80,6 +80,8 @@ public:
virtual void hide();
virtual void map();
virtual void unmap();
+ virtual void fullscreen_on();
+ virtual void fullscreen_off(int X, int Y, int W, int H);
virtual void shape(const Fl_Image* img);
// that one is implemented in Fl_Cocoa.mm because it uses Objective-c
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
index 5d97ac91d..0354b1255 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
@@ -239,6 +239,25 @@ void Fl_Cocoa_Window_Driver::hide() {
delete ip;
}
+
+void Fl_Cocoa_Window_Driver::fullscreen_on() {
+ pWindow->_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, pWindow);
+}
+
+
+void Fl_Cocoa_Window_Driver::fullscreen_off(int X, int Y, int W, int H) {
+ pWindow->_clear_fullscreen();
+ hide();
+ resize(X, Y, W, H);
+ show();
+ Fl::handle(FL_FULLSCREEN, pWindow);
+}
+
//
// End of "$Id$".
//
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
index 27fb5bc7e..b1218ab6c 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
@@ -85,6 +85,8 @@ public:
virtual void hide();
virtual void map();
virtual void unmap();
+ virtual void fullscreen_on();
+ virtual void fullscreen_off(int X, int Y, int W, int H);
virtual void shape(const Fl_Image* img);
virtual void icons(const Fl_RGB_Image *icons[], int count);
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index a14430af9..4eadbddfd 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -531,6 +531,83 @@ void Fl_WinAPI_Window_Driver::unmap() {
ShowWindow(fl_xid(pWindow), SW_HIDE);
}
+
+void Fl_X::make_fullscreen(int X, int Y, int W, int H) {
+ int top, bottom, left, right;
+ int sx, sy, sw, sh;
+
+ top = w->fullscreen_screen_top;
+ bottom = w->fullscreen_screen_bottom;
+ left = w->fullscreen_screen_left;
+ right = w->fullscreen_screen_right;
+
+ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) {
+ top = Fl::screen_num(X, Y, W, H);
+ bottom = top;
+ left = top;
+ right = top;
+ }
+
+ Fl::screen_xywh(sx, sy, sw, sh, top);
+ Y = sy;
+ Fl::screen_xywh(sx, sy, sw, sh, bottom);
+ H = sy + sh - Y;
+ Fl::screen_xywh(sx, sy, sw, sh, left);
+ X = sx;
+ Fl::screen_xywh(sx, sy, sw, sh, right);
+ W = sx + sw - X;
+
+ DWORD flags = GetWindowLong(xid, GWL_STYLE);
+ flags = flags & ~(WS_THICKFRAME|WS_CAPTION);
+ SetWindowLong(xid, GWL_STYLE, flags);
+
+ // SWP_NOSENDCHANGING is so that we can override size limits
+ SetWindowPos(xid, HWND_TOP, X, Y, W, H, SWP_NOSENDCHANGING | SWP_FRAMECHANGED);
+}
+
+
+void Fl_WinAPI_Window_Driver::fullscreen_on() {
+ pWindow->_set_fullscreen();
+ Fl_X::i(pWindow)->make_fullscreen(pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h());
+ Fl::handle(FL_FULLSCREEN, pWindow);
+}
+
+
+void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) {
+ pWindow->_clear_fullscreen();
+ DWORD style = GetWindowLong(fl_xid(pWindow), GWL_STYLE);
+ // Remove the xid temporarily so that Fl_X::fake_X_wm() behaves like it
+ // does in Fl_X::make().
+ HWND xid = fl_xid(pWindow);
+ Fl_X::i(pWindow)->xid = NULL;
+ int wx, wy, bt, bx, by;
+ switch (Fl_X::fake_X_wm(pWindow, wx, wy, bt, bx, by)) {
+ case 0:
+ break;
+ case 1:
+ style |= WS_CAPTION;
+ break;
+ case 2:
+ if (pWindow->border()) {
+ style |= WS_THICKFRAME | WS_CAPTION;
+ }
+ break;
+ }
+ Fl_X::i(pWindow)->xid = xid;
+ // Adjust for decorations (but not if that puts the decorations
+ // outside the screen)
+ if ((X != pWindow->x()) || (Y != pWindow->y())) {
+ X -= bx;
+ Y -= by+bt;
+ }
+ W += bx*2;
+ H += by*2+bt;
+ SetWindowLong(fl_xid(pWindow), GWL_STYLE, style);
+ SetWindowPos(fl_xid(pWindow), 0, X, Y, W, H,
+ SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
+ Fl::handle(FL_FULLSCREEN, pWindow);
+}
+
//
// End of "$Id$".
//
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H
index b2582a57b..89b16a4d9 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.H
+++ b/src/drivers/X11/Fl_X11_Window_Driver.H
@@ -94,6 +94,8 @@ public:
virtual void hide();
virtual void map();
virtual void unmap();
+ virtual void fullscreen_on();
+ virtual void fullscreen_off(int X, int Y, int W, int H);
virtual void shape(const Fl_Image* img);
virtual void icons(const Fl_RGB_Image *icons[], int count);