summaryrefslogtreecommitdiff
path: root/src/drivers/WinAPI
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/WinAPI')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H19
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx10
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H8
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx20
4 files changed, 51 insertions, 6 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H
index 6dbfa7848..682afca25 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H
@@ -42,9 +42,14 @@ protected:
static BOOL CALLBACK screen_cb(HMONITOR mon, HDC, LPRECT r, LPARAM);
BOOL screen_cb(HMONITOR mon, HDC, LPRECT r);
int get_mouse_unscaled(int &mx, int &my);
+#ifdef FLTK_HIDPI_SUPPORT
+ void init_screen_scale_factors();
+#endif
public:
- Fl_WinAPI_Screen_Driver() : Fl_Screen_Driver() { }
+ Fl_WinAPI_Screen_Driver() : Fl_Screen_Driver() {
+ for (int i = 0; i < MAX_SCREENS; i++) scale_of_screen[i] = 1;
+ }
// --- display management
virtual int visual(int flags);
// --- screen configuration
@@ -85,11 +90,17 @@ public:
virtual void offscreen_size(Fl_Offscreen off, int &width, int &height);
#if defined(FLTK_HIDPI_SUPPORT)
virtual APP_SCALING_CAPABILITY rescalable() {
- return SYSTEMWIDE_APP_SCALING;
+ return PER_SCREEN_APP_SCALING;
+ }
+#endif
+#if defined(FLTK_HIDPI_SUPPORT)
+ virtual float scale(int n) {
+ return scale_of_screen[n];
+ }
+ virtual void scale(int n, float f) {
+ scale_of_screen[n] = f;
}
#endif
- virtual float scale(int n) {return scale_of_screen[n];}
- virtual void scale(int n, float f) { scale_of_screen[n] = f;}
virtual float desktop_scale_factor();
};
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
index 236a33288..5951ba193 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
@@ -100,7 +100,7 @@ BOOL Fl_WinAPI_Screen_Driver::screen_cb(HMONITOR mon, HDC, LPRECT r)
screens[num_screens] = mi.rcMonitor;
// If we also want to record the work area, we would also store mi.rcWork at this point
work_area[num_screens] = mi.rcWork;
- scale_of_screen[num_screens] = 1;
+//extern FILE*LOG;fprintf(LOG,"screen_cb ns=%d\n",num_screens);fflush(LOG);
/*fl_alert("screen %d %d,%d,%d,%d work %d,%d,%d,%d",num_screens,
screens[num_screens].left,screens[num_screens].right,screens[num_screens].top,screens[num_screens].bottom,
work_area[num_screens].left,work_area[num_screens].right,work_area[num_screens].top,work_area[num_screens].bottom);
@@ -141,6 +141,9 @@ void Fl_WinAPI_Screen_Driver::init()
// NOTE: num_screens is incremented in screen_cb so we must first reset it here...
num_screens = 0;
fl_edm(0, 0, screen_cb, (LPARAM)this);
+#ifdef FLTK_HIDPI_SUPPORT
+ init_screen_scale_factors();
+#endif
return;
}
}
@@ -157,6 +160,11 @@ void Fl_WinAPI_Screen_Driver::init()
}
+float Fl_WinAPI_Screen_Driver::desktop_scale_factor() {
+ return 0; //indicates each screen has already been assigned its scale factor value
+}
+
+
void Fl_WinAPI_Screen_Driver::screen_work_area(int &X, int &Y, int &W, int &H, int n)
{
if (num_screens < 0) init();
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
index 7f548c58b..29b20aefc 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
@@ -71,12 +71,17 @@ public:
static inline Fl_WinAPI_Window_Driver* driver(Fl_Window *w) {return (Fl_WinAPI_Window_Driver*)w->driver();}
HDC private_dc; // used for OpenGL
RECT border_width_title_bar_height(int &bx, int &by, int &bt);
- virtual void screen_num(int n) { screen_num_ = n; }
+ virtual void screen_num(int n);
virtual int screen_num();
struct icon_data *icon_;
HCURSOR cursor;
int custom_cursor;
+ struct type_for_resize_window_between_screens {
+ int screen;
+ bool busy;
+ };
+ static type_for_resize_window_between_screens data_for_resize_window_between_screens_;
void set_minmax(LPMINMAXINFO minmax);
int fake_X_wm(int &X, int &Y, int &bt,int &bx,int &by);
void make_fullscreen(int X, int Y, int W, int H);
@@ -117,6 +122,7 @@ public:
virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right);
virtual int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y,
void (*draw_area)(void*, int,int,int,int), void* data);
+ static void resize_after_screen_change(void *data);
};
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index 079ca743d..a5621de6a 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -68,6 +68,13 @@ int Fl_WinAPI_Window_Driver::screen_num() {
return screen_num_ >= 0 ? screen_num_ : 0;
}
+//FILE*LOG=fopen("log.log","w");
+
+void Fl_WinAPI_Window_Driver::screen_num(int n) {
+//fprintf(LOG, "screen_num setter old=%d new=%d\n",screen_num_, n);fflush(LOG);
+ screen_num_ = n;
+}
+
RECT // frame of the decorated window in screen coordinates
Fl_WinAPI_Window_Driver::border_width_title_bar_height(
@@ -669,6 +676,19 @@ int Fl_WinAPI_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h,
return 0;
}
+Fl_WinAPI_Window_Driver::type_for_resize_window_between_screens Fl_WinAPI_Window_Driver::data_for_resize_window_between_screens_ = {0, false};
+
+void Fl_WinAPI_Window_Driver::resize_after_screen_change(void *data) {
+ Fl_Window *win = (Fl_Window*)data;
+ RECT r;
+ GetClientRect(fl_xid(win), &r);
+ float old_f = float(r.right)/win->w();
+ int ns = data_for_resize_window_between_screens_.screen;
+ win->driver()->resize_after_scale_change(ns, old_f, Fl::screen_driver()->scale(ns));
+ win->wait_for_expose();
+ data_for_resize_window_between_screens_.busy = false;
+}
+
//
// End of "$Id$".
//