mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2024-11-28 19:14:14 +01:00
132 lines
4.7 KiB
Diff
132 lines
4.7 KiB
Diff
diff -up fltk-1.3.0r9619/FL/Fl.H.screen_num fltk-1.3.0r9619/FL/Fl.H
|
|
--- fltk-1.3.0r9619/FL/Fl.H.screen_num 2012-07-03 13:49:28.663085580 +0200
|
|
+++ fltk-1.3.0r9619/FL/Fl.H 2012-07-03 13:49:28.731084402 +0200
|
|
@@ -806,6 +806,8 @@ public:
|
|
static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
|
|
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 int screen_num(int x, int y);
|
|
+ static int screen_num(int x, int y, int w, int h);
|
|
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);
|
|
diff -up fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num fltk-1.3.0r9619/src/screen_xywh.cxx
|
|
--- fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num 2012-03-23 17:47:53.000000000 +0100
|
|
+++ fltk-1.3.0r9619/src/screen_xywh.cxx 2012-07-03 13:58:01.947195396 +0200
|
|
@@ -215,21 +215,6 @@ int Fl::screen_count() {
|
|
return num_screens ? num_screens : 1;
|
|
}
|
|
|
|
-static int find_screen_with_point(int mx, int my) {
|
|
- int screen = 0;
|
|
- if (num_screens < 0) screen_init();
|
|
-
|
|
- for (int i = 0; i < num_screens; i ++) {
|
|
- int sx, sy, sw, sh;
|
|
- Fl::screen_xywh(sx, sy, sw, sh, i);
|
|
- if ((mx >= sx) && (mx < (sx+sw)) && (my >= sy) && (my < (sy+sh))) {
|
|
- screen = i;
|
|
- break;
|
|
- }
|
|
- }
|
|
- return screen;
|
|
-}
|
|
-
|
|
/**
|
|
Gets the bounding box of a screen
|
|
that contains the specified screen position \p mx, \p my
|
|
@@ -237,7 +222,7 @@ static int find_screen_with_point(int mx
|
|
\param[in] mx, my the absolute screen position
|
|
*/
|
|
void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my) {
|
|
- screen_xywh(X, Y, W, H, find_screen_with_point(mx, my));
|
|
+ screen_xywh(X, Y, W, H, screen_num(mx, my));
|
|
}
|
|
|
|
|
|
@@ -248,7 +233,7 @@ void Fl::screen_xywh(int &X, int &Y, int
|
|
\param[in] mx, my the absolute screen position
|
|
*/
|
|
void Fl::screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my) {
|
|
- screen_work_area(X, Y, W, H, find_screen_with_point(mx, my));
|
|
+ screen_work_area(X, Y, W, H, screen_num(mx, my));
|
|
}
|
|
|
|
/**
|
|
@@ -321,6 +306,38 @@ void Fl::screen_xywh(int &X, int &Y, int
|
|
#endif // WIN32
|
|
}
|
|
|
|
+/**
|
|
+ Gets the screen bounding rect for the screen
|
|
+ which intersects the most with the rectangle
|
|
+ defined by \p mx, \p my, \p mw, \p mh.
|
|
+ \param[out] X,Y,W,H the corresponding screen bounding box
|
|
+ \param[in] mx, my, mw, mh the rectangle to search for intersection with
|
|
+ \see void screen_xywh(int &X, int &Y, int &W, int &H, int n)
|
|
+ */
|
|
+void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) {
|
|
+ screen_xywh(X, Y, W, H, screen_num(mx, my, mw, mh));
|
|
+}
|
|
+
|
|
+/**
|
|
+ Gets the screen number of a screen
|
|
+ that contains the specified screen position \p x, \p y
|
|
+ \param[in] x, y the absolute screen position
|
|
+*/
|
|
+int Fl::screen_num(int x, int y) {
|
|
+ int screen = 0;
|
|
+ if (num_screens < 0) screen_init();
|
|
+
|
|
+ for (int i = 0; i < num_screens; i ++) {
|
|
+ int sx, sy, sw, sh;
|
|
+ Fl::screen_xywh(sx, sy, sw, sh, i);
|
|
+ if ((x >= sx) && (x < (sx+sw)) && (y >= sy) && (y < (sy+sh))) {
|
|
+ screen = i;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ return screen;
|
|
+}
|
|
+
|
|
static inline float fl_intersection(int x1, int y1, int w1, int h1,
|
|
int x2, int y2, int w2, int h2) {
|
|
if(x1+w1 < x2 || x2+w2 < x1 || y1+h1 < y2 || y2+h2 < y1)
|
|
@@ -333,30 +350,27 @@ static inline float fl_intersection(int
|
|
}
|
|
|
|
/**
|
|
- Gets the screen bounding rect for the screen
|
|
+ Gets the screen number for the screen
|
|
which intersects the most with the rectangle
|
|
- defined by \p mx, \p my, \p mw, \p mh.
|
|
- \param[out] X,Y,W,H the corresponding screen bounding box
|
|
- \param[in] mx, my, mw, mh the rectangle to search for intersection with
|
|
- \see void screen_xywh(int &X, int &Y, int &W, int &H, int n)
|
|
+ defined by \p x, \p y, \p w, \p h.
|
|
+ \param[in] x, y, w, h the rectangle to search for intersection with
|
|
*/
|
|
-void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) {
|
|
+int Fl::screen_num(int x, int y, int w, int h) {
|
|
int best_screen = 0;
|
|
float best_intersection = 0.;
|
|
for(int i = 0; i < Fl::screen_count(); i++) {
|
|
int sx, sy, sw, sh;
|
|
Fl::screen_xywh(sx, sy, sw, sh, i);
|
|
- float sintersection = fl_intersection(mx, my, mw, mh, sx, sy, sw, sh);
|
|
+ float sintersection = fl_intersection(x, y, w, h, sx, sy, sw, sh);
|
|
if(sintersection > best_intersection) {
|
|
best_screen = i;
|
|
best_intersection = sintersection;
|
|
}
|
|
}
|
|
- screen_xywh(X, Y, W, H, best_screen);
|
|
+ return best_screen;
|
|
}
|
|
|
|
|
|
-
|
|
/**
|
|
Gets the screen resolution in dots-per-inch for the given screen.
|
|
\param[out] h, v horizontal and vertical resolution
|