summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2007-02-13 14:36:08 +0000
committerMatthias Melcher <fltk@matthiasm.com>2007-02-13 14:36:08 +0000
commit1b6f493c5573081e1f27a7f12637644af9aeff52 (patch)
tree46cdeb78567440f42cd6edab5b45a4bacfd40372 /src
parent8adb964b4899594d920ac13237ad3a6b8d08e200 (diff)
Updated 'hotspot' positioning of windows in OS X and WIN32 to keep the hotspotted window entirely on the screen that contaings the mouse pointer (STR #1599).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5696 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Window_hotspot.cxx53
1 files changed, 32 insertions, 21 deletions
diff --git a/src/Fl_Window_hotspot.cxx b/src/Fl_Window_hotspot.cxx
index ea2c5fb64..7398cc3bc 100644
--- a/src/Fl_Window_hotspot.cxx
+++ b/src/Fl_Window_hotspot.cxx
@@ -40,35 +40,46 @@ void Fl_Window::hotspot(int X, int Y, int offscreen) {
// If offscreen is 0 (the default), make sure that the window
// stays on the screen, if possible.
if (!offscreen) {
-#if defined(WIN32) || defined(__APPLE__)
- // These will be used by reference, so we must passed different variables
- int bt,bx,by;
- x(X);y(Y);
- Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
- //force FL_FORCE_POSITION to be set in Fl_Window::resize()
- if (X==x()) x(X-1);
-#else
int scr_x, scr_y, scr_w, scr_h;
Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h);
+ int top = 0;
+ int left = 0;
+ int right = 0;
+ 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 {
+ ret = 1;
+ left = right = GetSystemMetrics(SM_CXFIXEDFRAME);
+ top = bottom = GetSystemMetrics(SM_CYFIXEDFRAME);
+ }
+ top += GetSystemMetrics(SM_CYCAPTION);
+#elif defined(__APPLE__)
+ 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.
- const int top = 20;
- const int left = 4;
- const int right = 4;
- const int bottom = 8;
- if (X+w()+right > scr_w-scr_x) X = scr_w-scr_x-right-w();
- if (X-left < scr_x) X = left;
- if (Y+h()+bottom > scr_h-scr_y) Y = scr_h-scr_y-bottom-h();
- if (Y-top < scr_y) Y = top;
+ top = 20;
+ left = 4;
+ right = 4;
+ bottom = 8;
+#endif
}
// now insure contents are on-screen (more important than border):
- if (X+w() > scr_w-scr_x) X = scr_w-scr_x-w();
- if (X < scr_x) X = scr_x;
- if (Y+h() > scr_h-scr_y) Y = scr_h-scr_y-h();
- if (Y < scr_y) Y = scr_y;
-#endif
+ if (X+w()+right > scr_w-scr_x) X = scr_w-scr_x-right-w();
+ if (X-left < scr_x) X = left;
+ if (Y+h()+bottom > scr_h-scr_y) Y = scr_h-scr_y-bottom-h();
+ if (Y-top < scr_y) Y = top;
+ // make sure that we will force this position
+ if (X==x()) x(X-1);
}
position(X,Y);