summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-06-17 06:53:44 +0000
committerManolo Gouy <Manolo>2017-06-17 06:53:44 +0000
commit2cda5a4fa682372f294a7a8e9e2b90a9fdb15610 (patch)
tree4040f478267a4ff808c4eaf8ee1aa92014e6465c /src
parentea56e744afd2029da309bbf33f33a5e505610306 (diff)
Make Fl_Screen_Driver::get_mouse(int&, int&) return the number of the mouse-containing screen.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12264 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Screen_Driver.cxx18
-rw-r--r--src/Fl_cocoa.mm3
-rw-r--r--src/Fl_win32.cxx3
-rw-r--r--src/Fl_x.cxx6
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H2
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H2
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.H3
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.cxx11
-rw-r--r--src/screen_xywh.cxx8
9 files changed, 18 insertions, 38 deletions
diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx
index ec1474cc5..54581c551 100644
--- a/src/Fl_Screen_Driver.cxx
+++ b/src/Fl_Screen_Driver.cxx
@@ -54,28 +54,12 @@ int Fl_Screen_Driver::visual(int) {
}
-void Fl_Screen_Driver::screen_xywh(int &X, int &Y, int &W, int &H)
-{
- int x, y;
- get_mouse(x, y);
- screen_xywh(X, Y, W, H, x, y);
-}
-
-
void Fl_Screen_Driver::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my)
{
screen_xywh(X, Y, W, H, screen_num(mx, my));
}
-void Fl_Screen_Driver::screen_work_area(int &X, int &Y, int &W, int &H)
-{
- int x, y;
- get_mouse(x, y);
- screen_work_area(X, Y, W, H, x, y);
-}
-
-
void Fl_Screen_Driver::screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my)
{
screen_work_area(X, Y, W, H, screen_num(mx, my));
@@ -103,7 +87,7 @@ int Fl_Screen_Driver::screen_num(int x, int y)
for (int i = 0; i < num_screens; i ++) {
int sx, sy, sw, sh;
- Fl::screen_xywh(sx, sy, sw, sh, i);
+ screen_xywh(sx, sy, sw, sh, i);
if ((x >= sx) && (x < (sx+sw)) && (y >= sy) && (y < (sy+sh))) {
screen = i;
break;
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 41b3e9e41..743f0c5a1 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -1896,12 +1896,13 @@ void Fl_Cocoa_Screen_Driver::screen_work_area(int &X, int &Y, int &W, int &H, in
/*
* get the current mouse pointer world coordinates
*/
-void Fl_Cocoa_Screen_Driver::get_mouse(int &x, int &y)
+int Fl_Cocoa_Screen_Driver::get_mouse(int &x, int &y)
{
open_display();
NSPoint pt = [NSEvent mouseLocation];
x = int(pt.x);
y = int(main_screen_height - pt.y);
+ return screen_num(x, y);
}
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 9a99a565a..371a760b9 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -583,11 +583,12 @@ void Fl_WinAPI_Screen_Driver::disable_im() {
////////////////////////////////////////////////////////////////
-void Fl_WinAPI_Screen_Driver::get_mouse(int &x, int &y) {
+int Fl_WinAPI_Screen_Driver::get_mouse(int &x, int &y) {
POINT p;
GetCursorPos(&p);
x = p.x;
y = p.y;
+ return screen_num(x, y);
}
////////////////////////////////////////////////////////////////
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index d2dcc8e7e..00d985582 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -733,10 +733,12 @@ int Fl_X11_Screen_Driver::get_mouse_unscaled(int &mx, int &my) {
}
-void Fl_X11_Screen_Driver::get_mouse(int &xx, int &yy) {
- float s = scale(get_mouse_unscaled(xx, yy));
+int Fl_X11_Screen_Driver::get_mouse(int &xx, int &yy) {
+ int snum = get_mouse_unscaled(xx, yy);
+ float s = scale(snum);
xx = xx/s;
yy = yy/s;
+ return snum;
}
////////////////////////////////////////////////////////////////
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
index e64d394f4..c13c5ed05 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
+++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H
@@ -90,7 +90,7 @@ public:
virtual int compose(int &del);
virtual uchar *read_image(uchar *p, int x, int y, int w, int h, int alpha);
virtual int input_widget_handle_key(int key, unsigned mods, unsigned shift, Fl_Input *input);
- virtual void get_mouse(int &x, int &y);
+ virtual int get_mouse(int &x, int &y);
virtual void enable_im();
virtual void disable_im();
virtual void open_display_platform();
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H
index 2916beb73..503eb308d 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H
@@ -74,7 +74,7 @@ public:
virtual int dnd(int unused);
virtual int compose(int &del);
virtual Fl_RGB_Image *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha);
- virtual void get_mouse(int &x, int &y);
+ virtual int get_mouse(int &x, int &y);
virtual void enable_im();
virtual void disable_im();
virtual void open_display_platform();
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.H b/src/drivers/X11/Fl_X11_Screen_Driver.H
index ac03a42ca..db986b33c 100644
--- a/src/drivers/X11/Fl_X11_Screen_Driver.H
+++ b/src/drivers/X11/Fl_X11_Screen_Driver.H
@@ -57,7 +57,6 @@ public:
virtual float desktop_scale_factor();
int screen_num_unscaled(int x, int y);
int screen_num_unscaled(int x, int y, int w, int h);
- virtual void screen_xywh(int &X, int &Y, int &W, int &H);
#endif
static int ewmh_supported();
@@ -96,7 +95,7 @@ public:
virtual void compose_reset();
virtual int text_display_can_leak();
virtual Fl_RGB_Image *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha);
- virtual void get_mouse(int &x, int &y);
+ virtual int get_mouse(int &x, int &y);
virtual void enable_im();
virtual void disable_im();
virtual void open_display_platform();
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
index 1e1f8a265..d1390e862 100644
--- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
@@ -1215,17 +1215,6 @@ int Fl_X11_Screen_Driver::screen_num_unscaled(int x, int y, int w, int h)
#endif
#if USE_XFT
-void Fl_X11_Screen_Driver::screen_xywh(int &X, int &Y, int &W, int &H)
-{
- int xx, yy;
- int ns = get_mouse_unscaled(xx,yy);
- float s = screens[ns].scale;
- X = screens[ns].x_org / s;
- Y = screens[ns].y_org / s;
- W = screens[ns].width / s;
- H = screens[ns].height / s;
-}
-
#if HAVE_DLSYM && HAVE_DLFCN_H
diff --git a/src/screen_xywh.cxx b/src/screen_xywh.cxx
index 335f457e1..ff7c2ea4d 100644
--- a/src/screen_xywh.cxx
+++ b/src/screen_xywh.cxx
@@ -171,7 +171,9 @@ void Fl::screen_dpi(float &h, float &v, int n)
*/
void Fl::screen_xywh(int &X, int &Y, int &W, int &H)
{
- Fl::screen_driver()->screen_xywh(X, Y, W, H);
+ int mx, my;
+ int nscreen = Fl::screen_driver()->get_mouse(mx, my);
+ Fl::screen_driver()->screen_xywh(X, Y, W, H, nscreen);
}
@@ -182,7 +184,9 @@ void Fl::screen_xywh(int &X, int &Y, int &W, int &H)
*/
void Fl::screen_work_area(int &X, int &Y, int &W, int &H)
{
- Fl::screen_driver()->screen_xywh(X, Y, W, H);
+ int mx, my;
+ int nscreen = Fl::screen_driver()->get_mouse(mx, my);
+ Fl::screen_driver()->screen_work_area(X, Y, W, H, nscreen);
}