diff options
| author | Manolo Gouy <Manolo> | 2011-09-29 16:04:24 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-09-29 16:04:24 +0000 |
| commit | d9cda5c3aa48da9ef3238d993b34cde7047175d8 (patch) | |
| tree | 751d1c5daa9c837444e53a2ed955dcfb2c6c302f /FL | |
| parent | bc1b17056a44af5890cb2b5ec56cf9fbb72ccea4 (diff) | |
Fix STR#2695 & 2697: correct computation of work areas with multiple screens.
This introduces 3 new functions
static void Fl::screen_work_area(X,Y,W,H)
static void Fl::screen_work_area(X,Y,W,H,mx,my)
static void Fl::screen_work_area(X,Y,W,H,screen_no)
that compute screen work areas and are used by FLTK to position menu windows.
The Fl::x(),y(),w(),h() functions are made consistent across platforms: they return
the origin/size of the work area of the main screen (as far as possible, see below).
On the Mac OS platform, all screen functions reflect changes in screen number and
positions without requiring the application to restart.
On the X11 platform, I did not find an API to compute the main screen work area
in all conditions. What's used does compute the correct work area when there's
a single screen, but not when there are several, because it returns an area that
encompasses all screens. The implemented workaround is that Fl::x(),y(),w(),h()
and Fl::screen_work_area(X,Y,W,H,0) return the exact work area when there's
a single screen, and return the full screen area when there are several.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9084 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl.H | 18 | ||||
| -rw-r--r-- | FL/mac.H | 2 |
2 files changed, 16 insertions, 4 deletions
@@ -757,13 +757,13 @@ public: fl global screen functions declared in <FL/Fl.H> @{ */ // screen size: - /** Returns the origin of the current screen work area, where 0 indicates the left side of the screen. */ + /** Returns the leftmost x coordinate of the main screen work area. */ static int x(); // platform dependent - /** Returns the origin of the current screen work area, where 0 indicates the top edge of the screen. */ + /** Returns the topmost y coordinate of the main screen work area. */ static int y(); // platform dependent - /** Returns the width of the screen work area in pixels. */ + /** Returns the width in pixels of the main screen work area. */ static int w(); // platform dependent - /** Returns the height of the screen work area in pixels. */ + /** Returns the height in pixels of the main screen work area. */ static int h(); // platform dependent // multi-head support: @@ -780,6 +780,16 @@ public: static void screen_xywh(int &X, int &Y, int &W, int &H, int n); static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh); static void screen_dpi(float &h, float &v, int n=0); + static void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my); + static void screen_work_area(int &X, int &Y, int &W, int &H, int n); + /** + Gets the bounding box of the work area of the screen that contains the mouse pointer. + \param[out] X,Y,W,H the work area bounding box + \see void screen_work_area(int &x, int &y, int &w, int &h, int mx, int my) + */ + static void screen_work_area(int &X, int &Y, int &W, int &H) { + screen_work_area(X, Y, W, H, e_x_root, e_y_root); + } /** @} */ @@ -125,6 +125,8 @@ public: static CGContextRef nwse_cursor_image(void); static CGContextRef none_cursor_image(void); static void *get_carbon_function(const char *name); + static void screen_work_area(int &X, int &Y, int &W, int &H, int n); // compute work area of a given screen + static void mac_screen_init(void); // recompute screen number and dimensions private: static void relink(Fl_Window*, Fl_Window*); bool subwindow; |
