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
This commit is contained in:
parent
979740ce91
commit
affdcdb525
@ -82,8 +82,6 @@ private:
|
|||||||
|
|
||||||
void size_range_();
|
void size_range_();
|
||||||
void _Fl_Window(); // constructor innards
|
void _Fl_Window(); // constructor innards
|
||||||
void fullscreen_x(); // platform-specific part of sending a window to full screen
|
|
||||||
void fullscreen_off_x(int X, int Y, int W, int H);// platform-specific part of leaving full screen
|
|
||||||
|
|
||||||
// unimplemented copy ctor and assignment operator
|
// unimplemented copy ctor and assignment operator
|
||||||
Fl_Window(const Fl_Window&);
|
Fl_Window(const Fl_Window&);
|
||||||
|
@ -57,6 +57,10 @@ public:
|
|||||||
int minh();
|
int minh();
|
||||||
int maxw();
|
int maxw();
|
||||||
int maxh();
|
int maxh();
|
||||||
|
int fullscreen_screen_top();
|
||||||
|
int fullscreen_screen_bottom();
|
||||||
|
int fullscreen_screen_left();
|
||||||
|
int fullscreen_screen_right();
|
||||||
unsigned char size_range_set();
|
unsigned char size_range_set();
|
||||||
void force_position(int c);
|
void force_position(int c);
|
||||||
void x(int X);
|
void x(int X);
|
||||||
@ -87,6 +91,8 @@ public:
|
|||||||
int hide_common();
|
int hide_common();
|
||||||
virtual void map() {}
|
virtual void map() {}
|
||||||
virtual void unmap() {}
|
virtual void unmap() {}
|
||||||
|
virtual void fullscreen_on() {}
|
||||||
|
virtual void fullscreen_off(int X, int Y, int W, int H) {}
|
||||||
|
|
||||||
// --- window shape stuff
|
// --- window shape stuff
|
||||||
void shape_pixmap_(Fl_Image* pixmap); // TODO: check
|
void shape_pixmap_(Fl_Image* pixmap); // TODO: check
|
||||||
|
@ -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::force_position(int c) { pWindow->force_position(c); }
|
||||||
void Fl_Window_Driver::x(int X) {pWindow->x(X); }
|
void Fl_Window_Driver::x(int X) {pWindow->x(X); }
|
||||||
void Fl_Window_Driver::y(int Y) {pWindow->y(Y); }
|
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;}
|
unsigned char Fl_Window_Driver::size_range_set() {return pWindow->size_range_set;}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <FL/Fl.H>
|
#include <FL/Fl.H>
|
||||||
#include <FL/x.H>
|
#include <FL/x.H>
|
||||||
|
#include <FL/Fl_Window_Driver.H>
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ void Fl_Window::fullscreen() {
|
|||||||
no_fullscreen_w = w();
|
no_fullscreen_w = w();
|
||||||
no_fullscreen_h = h();
|
no_fullscreen_h = h();
|
||||||
if (shown() && !(flags() & Fl_Widget::FULLSCREEN)) {
|
if (shown() && !(flags() & Fl_Widget::FULLSCREEN)) {
|
||||||
fullscreen_x();
|
pWindowDriver->fullscreen_on();
|
||||||
} else {
|
} else {
|
||||||
set_flag(FULLSCREEN);
|
set_flag(FULLSCREEN);
|
||||||
}
|
}
|
||||||
@ -75,7 +76,7 @@ void Fl_Window::fullscreen() {
|
|||||||
|
|
||||||
void Fl_Window::fullscreen_off(int X,int Y,int W,int H) {
|
void Fl_Window::fullscreen_off(int X,int Y,int W,int H) {
|
||||||
if (shown() && (flags() & Fl_Widget::FULLSCREEN)) {
|
if (shown() && (flags() & Fl_Widget::FULLSCREEN)) {
|
||||||
fullscreen_off_x(X, Y, W, H);
|
pWindowDriver->fullscreen_off(X, Y, W, H);
|
||||||
} else {
|
} else {
|
||||||
clear_flag(FULLSCREEN);
|
clear_flag(FULLSCREEN);
|
||||||
}
|
}
|
||||||
@ -105,7 +106,7 @@ void Fl_Window::fullscreen_screens(int top, int bottom, int left, int right) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shown() && fullscreen_active())
|
if (shown() && fullscreen_active())
|
||||||
fullscreen_x();
|
pWindowDriver->fullscreen_on();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2851,23 +2851,6 @@ void Fl_X::GLcontext_makecurrent(NSOpenGLContext* ctxt)
|
|||||||
[ctxt makeCurrentContext];
|
[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
|
* Initialize the given port for redraw and call the window's flush() to actually draw the content
|
||||||
*/
|
*/
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -80,6 +80,8 @@ public:
|
|||||||
virtual void hide();
|
virtual void hide();
|
||||||
virtual void map();
|
virtual void map();
|
||||||
virtual void unmap();
|
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 shape(const Fl_Image* img);
|
||||||
// that one is implemented in Fl_Cocoa.mm because it uses Objective-c
|
// that one is implemented in Fl_Cocoa.mm because it uses Objective-c
|
||||||
|
@ -239,6 +239,25 @@ void Fl_Cocoa_Window_Driver::hide() {
|
|||||||
delete ip;
|
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$".
|
// End of "$Id$".
|
||||||
//
|
//
|
||||||
|
@ -85,6 +85,8 @@ public:
|
|||||||
virtual void hide();
|
virtual void hide();
|
||||||
virtual void map();
|
virtual void map();
|
||||||
virtual void unmap();
|
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 shape(const Fl_Image* img);
|
||||||
virtual void icons(const Fl_RGB_Image *icons[], int count);
|
virtual void icons(const Fl_RGB_Image *icons[], int count);
|
||||||
|
@ -531,6 +531,83 @@ void Fl_WinAPI_Window_Driver::unmap() {
|
|||||||
ShowWindow(fl_xid(pWindow), SW_HIDE);
|
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$".
|
// End of "$Id$".
|
||||||
//
|
//
|
||||||
|
@ -94,6 +94,8 @@ public:
|
|||||||
virtual void hide();
|
virtual void hide();
|
||||||
virtual void map();
|
virtual void map();
|
||||||
virtual void unmap();
|
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 shape(const Fl_Image* img);
|
||||||
virtual void icons(const Fl_RGB_Image *icons[], int count);
|
virtual void icons(const Fl_RGB_Image *icons[], int count);
|
||||||
|
Loading…
Reference in New Issue
Block a user