From 76454cb77bacee054c5e763fa6a8472a5be90cab Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 26 May 2011 13:48:00 +0000 Subject: #2646: improved queries for screen sizes. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8738 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/screen_xywh.cxx | 53 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 14 deletions(-) (limited to 'src') 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, -- cgit v1.2.3