summaryrefslogtreecommitdiff
path: root/src/screen_xywh.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2011-05-26 13:48:00 +0000
committerMatthias Melcher <fltk@matthiasm.com>2011-05-26 13:48:00 +0000
commit76454cb77bacee054c5e763fa6a8472a5be90cab (patch)
tree96e074080c02847045b8b5976fb47ea5e72e2635 /src/screen_xywh.cxx
parent9846e7879c9501658ba2bc15fb325da73cbfd793 (diff)
#2646: improved queries for screen sizes.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8738 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/screen_xywh.cxx')
-rw-r--r--src/screen_xywh.cxx53
1 files changed, 39 insertions, 14 deletions
diff --git a/src/screen_xywh.cxx b/src/screen_xywh.cxx
index 32d151f5e..6ee67ba00 100644
--- a/src/screen_xywh.cxx
+++ b/src/screen_xywh.cxx
@@ -219,6 +219,11 @@ void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my) {
}
}
}
+ // if all else fails:
+ X = Fl::x();
+ Y = Fl::y();
+ W = Fl::w();
+ H = Fl::h();
#elif defined(__APPLE__)
if (num_screens > 0) {
int i;
@@ -236,6 +241,11 @@ void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my) {
}
}
}
+ // if all else fails:
+ X = Fl::x();
+ Y = Fl::y();
+ W = Fl::w();
+ H = Fl::h();
#elif HAVE_XINERAMA
if (num_screens > 0 && screens) { // screens == NULL if !XineramaIsActive(fl_display)
int i;
@@ -253,15 +263,20 @@ void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my) {
}
}
}
+ // if all else fails:
+ X = Fl::x();
+ Y = Fl::y();
+ W = Fl::w();
+ H = Fl::h();
#else
(void)mx;
(void)my;
+ X = 0;
+ Y = 0;
+ W = DisplayWidth(fl_display, fl_screen);
+ H = DisplayHeight(fl_display, fl_screen);
#endif // WIN32
- X = Fl::x();
- Y = Fl::y();
- W = Fl::w();
- H = Fl::h();
}
/**
@@ -279,7 +294,11 @@ void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int n) {
Y = screens[n].top;
W = screens[n].right - screens[n].left;
H = screens[n].bottom - screens[n].top;
- return;
+ } else {
+ X = Fl::x();
+ Y = Fl::y();
+ W = Fl::w();
+ H = Fl::h();
}
#elif defined(__APPLE__)
if (num_screens > 0 && n >= 0 && n < num_screens) {
@@ -287,24 +306,30 @@ void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int n) {
Y = screens[n].y;
W = screens[n].width;
H = screens[n].height;
- return;
+ } else {
+ X = Fl::x();
+ Y = Fl::y();
+ W = Fl::w();
+ H = Fl::h();
}
#elif HAVE_XINERAMA
- if (num_screens > 0 && n >= 0 && n < num_screens) {
+ if (num_screens > 0 && n >= 0 && n < num_screens && screens) {
X = screens[n].x_org;
Y = screens[n].y_org;
W = screens[n].width;
H = screens[n].height;
- return;
+ } else {
+ X = Fl::x();
+ Y = Fl::y();
+ W = Fl::w();
+ H = Fl::h();
}
#else
- (void)n;
+ X = 0;
+ Y = 0;
+ W = DisplayWidth(fl_display, fl_screen);
+ H = DisplayHeight(fl_display, fl_screen);
#endif // WIN32
-
- X = Fl::x();
- Y = Fl::y();
- W = Fl::w();
- H = Fl::h();
}
static inline float fl_intersection(int x1, int y1, int w1, int h1,