diff options
| author | Manolo Gouy <Manolo> | 2016-03-23 14:36:58 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-03-23 14:36:58 +0000 |
| commit | affdcdb525b3a606115b3a6444f0ab7dcc4b48ac (patch) | |
| tree | 8ea7b48838875022aae56edd038910399b517fd7 /src | |
| parent | 979740ce91525cc301a9173731d6aaf3004a6c88 (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')
| -rw-r--r-- | src/Fl_Window_Driver.cxx | 5 | ||||
| -rw-r--r-- | src/Fl_Window_fullscreen.cxx | 7 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 17 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 74 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 19 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 77 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.H | 2 |
9 files changed, 111 insertions, 94 deletions
diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx index f9dc31c79..6122d69d4 100644 --- a/src/Fl_Window_Driver.cxx +++ b/src/Fl_Window_Driver.cxx @@ -43,6 +43,11 @@ int Fl_Window_Driver::maxh() {return pWindow->maxh;} void Fl_Window_Driver::force_position(int c) { pWindow->force_position(c); } void Fl_Window_Driver::x(int X) {pWindow->x(X); } void Fl_Window_Driver::y(int Y) {pWindow->y(Y); } +int Fl_Window_Driver::fullscreen_screen_top() {return pWindow->fullscreen_screen_top;} +int Fl_Window_Driver::fullscreen_screen_bottom() {return pWindow->fullscreen_screen_bottom;} +int Fl_Window_Driver::fullscreen_screen_left() {return pWindow->fullscreen_screen_left;} +int Fl_Window_Driver::fullscreen_screen_right() {return pWindow->fullscreen_screen_right;} + unsigned char Fl_Window_Driver::size_range_set() {return pWindow->size_range_set;} diff --git a/src/Fl_Window_fullscreen.cxx b/src/Fl_Window_fullscreen.cxx index b96ac9369..e005302cc 100644 --- a/src/Fl_Window_fullscreen.cxx +++ b/src/Fl_Window_fullscreen.cxx @@ -28,6 +28,7 @@ #include <FL/Fl.H> #include <FL/x.H> +#include <FL/Fl_Window_Driver.H> #include <config.h> @@ -67,7 +68,7 @@ void Fl_Window::fullscreen() { no_fullscreen_w = w(); no_fullscreen_h = h(); if (shown() && !(flags() & Fl_Widget::FULLSCREEN)) { - fullscreen_x(); + pWindowDriver->fullscreen_on(); } else { set_flag(FULLSCREEN); } @@ -75,7 +76,7 @@ void Fl_Window::fullscreen() { void Fl_Window::fullscreen_off(int X,int Y,int W,int H) { if (shown() && (flags() & Fl_Widget::FULLSCREEN)) { - fullscreen_off_x(X, Y, W, H); + pWindowDriver->fullscreen_off(X, Y, W, H); } else { clear_flag(FULLSCREEN); } @@ -105,7 +106,7 @@ void Fl_Window::fullscreen_screens(int top, int bottom, int left, int right) { } if (shown() && fullscreen_active()) - fullscreen_x(); + pWindowDriver->fullscreen_on(); } diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 35239835e..88199d9bc 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2851,23 +2851,6 @@ void Fl_X::GLcontext_makecurrent(NSOpenGLContext* ctxt) [ctxt makeCurrentContext]; } -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); -} - /* * Initialize the given port for redraw and call the window's flush() to actually draw the content */ diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 70b382e3a..a2940940b 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1606,80 +1606,6 @@ void Fl_WinAPI_Window_Driver::resize(int X,int Y,int W,int H) { } } -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_Window::fullscreen_x() { - _set_fullscreen(); - i->make_fullscreen(x(), y(), w(), h()); - Fl::handle(FL_FULLSCREEN, this); -} - -void Fl_Window::fullscreen_off_x(int X, int Y, int W, int H) { - _clear_fullscreen(); - DWORD style = GetWindowLong(fl_xid(this), 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(this); - Fl_X::i(this)->xid = NULL; - int wx, wy, bt, bx, by; - switch (Fl_X::fake_X_wm(this, wx, wy, bt, bx, by)) { - case 0: - break; - case 1: - style |= WS_CAPTION; - break; - case 2: - if (border()) { - style |= WS_THICKFRAME | WS_CAPTION; - } - break; - } - Fl_X::i(this)->xid = xid; - // Adjust for decorations (but not if that puts the decorations - // outside the screen) - if ((X != x()) || (Y != y())) { - X -= bx; - Y -= by+bt; - } - W += bx*2; - H += by*2+bt; - SetWindowLong(fl_xid(this), GWL_STYLE, style); - SetWindowPos(fl_xid(this), 0, X, Y, W, H, - SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); - Fl::handle(FL_FULLSCREEN, this); -} - //////////////////////////////////////////////////////////////// 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); |
