diff options
| -rw-r--r-- | FL/Fl_Window_Driver.H | 2 | ||||
| -rw-r--r-- | src/Fl_Window_hotspot.cxx | 29 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 8 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 12 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 9 |
8 files changed, 37 insertions, 26 deletions
diff --git a/FL/Fl_Window_Driver.H b/FL/Fl_Window_Driver.H index 4779f4354..94a25c9fa 100644 --- a/FL/Fl_Window_Driver.H +++ b/FL/Fl_Window_Driver.H @@ -96,6 +96,8 @@ public: virtual void use_border(); virtual void size_range(); virtual void iconize() {} + virtual void decoration_sizes(int *top, int *left, int *right, int *bottom) { + *top = *left = *right = *bottom = 0; } // --- window shape stuff void shape_pixmap_(Fl_Image* pixmap); // TODO: check diff --git a/src/Fl_Window_hotspot.cxx b/src/Fl_Window_hotspot.cxx index 41aeddde8..21813ddfc 100644 --- a/src/Fl_Window_hotspot.cxx +++ b/src/Fl_Window_hotspot.cxx @@ -18,8 +18,7 @@ #include <FL/Fl.H> #include <FL/Fl_Window.H> -#include <FL/x.H> -#include <stdio.h> +#include <FL/Fl_Window_Driver.H> void Fl_Window::hotspot(int X, int Y, int offscreen) { int mx,my; @@ -40,30 +39,9 @@ void Fl_Window::hotspot(int X, int Y, int offscreen) { int bottom = 0; if (border()) { -#ifdef WIN32 - if (size_range_set && (maxw != minw || maxh != minh)) { - left = right = GetSystemMetrics(SM_CXSIZEFRAME); - top = bottom = GetSystemMetrics(SM_CYSIZEFRAME); - } else { - left = right = GetSystemMetrics(SM_CXFIXEDFRAME); - top = bottom = GetSystemMetrics(SM_CYFIXEDFRAME); - } - top += GetSystemMetrics(SM_CYCAPTION); -#elif defined(__APPLE__) // PORTME: Fl_Window_Driver - platform window driver - top = 24; - left = 2; - right = 2; - bottom = 2; -#else - // Ensure border is on screen; these values are generic enough - // to work with many window managers, and are based on KDE defaults. - top = 20; - left = 4; - right = 4; - bottom = 8; -#endif + pWindowDriver->decoration_sizes(&top, &left, &right, &bottom); } - // now insure contents are on-screen (more important than border): + // now ensure contents are on-screen (more important than border): if (X+w()+right > scr_w+scr_x) X = scr_w+scr_x-right-w(); if (X-left < scr_x) X = left + scr_x; if (Y+h()+bottom > scr_h+scr_y) Y = scr_h+scr_y-bottom-h(); @@ -85,7 +63,6 @@ void Fl_Window::hotspot(const Fl_Widget *o, int offscreen) { hotspot(X,Y,offscreen); } - // // End of "$Id$". // diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index 8cce010f6..a9bc4b68a 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -84,6 +84,7 @@ public: virtual void fullscreen_off(int X, int Y, int W, int H); virtual void size_range(); virtual void iconize(); + virtual void decoration_sizes(int *top, int *left, int *right, int *bottom); 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 0354b1255..ec1d2cf73 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -258,6 +258,14 @@ void Fl_Cocoa_Window_Driver::fullscreen_off(int X, int Y, int W, int H) { Fl::handle(FL_FULLSCREEN, pWindow); } + +void Fl_Cocoa_Window_Driver::decoration_sizes(int *top, int *left, int *right, int *bottom) { + *top = 24; + *left = 2; + *right = 2; + *bottom = 2; +} + // // End of "$Id$". // diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H index 2cae854ef..a6fa71ec4 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H @@ -88,6 +88,7 @@ public: virtual void fullscreen_on(); virtual void fullscreen_off(int X, int Y, int W, int H); virtual void iconize(); + virtual void decoration_sizes(int *top, int *left, int *right, int *bottom); 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 dd3b64168..c2afc67f3 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -613,6 +613,18 @@ void Fl_WinAPI_Window_Driver::iconize() { ShowWindow(fl_xid(pWindow), SW_SHOWMINNOACTIVE); } + +void Fl_WinAPI_Window_Driver::decoration_sizes(int *top, int *left, int *right, int *bottom) { + if (size_range_set() && (maxw() != minw() || maxh() != minh())) { + *left = *right = GetSystemMetrics(SM_CXSIZEFRAME); + *top = *bottom = GetSystemMetrics(SM_CYSIZEFRAME); + } else { + *left = *right = GetSystemMetrics(SM_CXFIXEDFRAME); + *top = *bottom = GetSystemMetrics(SM_CYFIXEDFRAME); + } + *top += GetSystemMetrics(SM_CYCAPTION); +} + // // End of "$Id$". // diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H index 35cee4afd..de2d65446 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.H +++ b/src/drivers/X11/Fl_X11_Window_Driver.H @@ -99,6 +99,7 @@ public: virtual void use_border(); virtual void size_range(); virtual void iconize(); + virtual void decoration_sizes(int *top, int *left, int *right, int *bottom); virtual void shape(const Fl_Image* img); virtual void icons(const Fl_RGB_Image *icons[], int count); diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 2d6782eaf..7ae170284 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -508,6 +508,15 @@ void Fl_X11_Window_Driver::iconize() { XIconifyWindow(fl_display, fl_xid(pWindow), fl_screen); } +void Fl_X11_Window_Driver::decoration_sizes(int *top, int *left, int *right, int *bottom) { + // Ensure border is on screen; these values are generic enough + // to work with many window managers, and are based on KDE defaults. + *top = 20; + *left = 4; + *right = 4; + *bottom = 8; +} + // // End of "$Id$". // |
