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
This commit is contained in:
parent
ea56e744af
commit
2cda5a4fa6
@ -76,16 +76,14 @@ public:
|
||||
virtual int w() = 0;
|
||||
virtual int h() = 0;
|
||||
virtual int screen_count();
|
||||
virtual void screen_xywh(int &X, int &Y, int &W, int &H);
|
||||
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
|
||||
void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
|
||||
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int n) = 0;
|
||||
virtual void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh);
|
||||
void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh);
|
||||
virtual int screen_num(int x, int y);
|
||||
virtual int screen_num(int x, int y, int w, int h);
|
||||
virtual void screen_dpi(float &h, float &v, int n=0) = 0;
|
||||
virtual void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my);
|
||||
void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my);
|
||||
virtual void screen_work_area(int &X, int &Y, int &W, int &H, int n) = 0;
|
||||
virtual void screen_work_area(int &X, int &Y, int &W, int &H);
|
||||
// --- audible output
|
||||
virtual void beep(int type) = 0;
|
||||
// --- global events
|
||||
@ -151,7 +149,7 @@ public:
|
||||
// the default implementation may be enough
|
||||
virtual int input_widget_handle_key(int key, unsigned mods, unsigned shift, Fl_Input *input);
|
||||
// implement to support Fl::get_mouse()
|
||||
virtual void get_mouse(int &x, int &y) {}
|
||||
virtual int get_mouse(int &x, int &y) {return 0;}
|
||||
// optional methods to enable/disable input methods for complex scripts
|
||||
virtual void enable_im() {}
|
||||
virtual void disable_im() {}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user