summaryrefslogtreecommitdiff
path: root/src/drivers/WinAPI
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-01-04 16:45:11 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-01-04 16:45:11 +0100
commit46e681561241d0a123dfc08c234745c40c4a262a (patch)
tree96e7f272127d5ba050222832f0fb5cc950c2f3a3 /src/drivers/WinAPI
parent0e570fb6729ff6b97249256c2c9d5f3aa58c7bb4 (diff)
Windows: improve moving window across screens having distinct scale factors.
Diffstat (limited to 'src/drivers/WinAPI')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx13
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H16
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx12
3 files changed, 23 insertions, 18 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
index 375408496..8e199b09c 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
@@ -454,6 +454,19 @@ void Fl_WinAPI_Gl_Window_Driver::switch_back() {
}
+class Fl_WinAPI_Gl_Plugin : public Fl_WinAPI_Plugin {
+public:
+ Fl_WinAPI_Gl_Plugin() : Fl_WinAPI_Plugin(name()) { }
+ const char *name() override { return "gl.winapi.fltk.org"; }
+ void invalidate(Fl_Window *w) override {
+ w->as_gl_window()->valid(0);
+ }
+};
+
+
+static Fl_WinAPI_Gl_Plugin Gl_Invalidate_Plugin;
+
+
FL_EXPORT HGLRC fl_win32_glcontext(GLContext rc) { return (HGLRC)rc; }
#endif // HAVE_GL
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
index 7d208e429..3cf26b67c 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
@@ -23,6 +23,7 @@
#ifndef FL_WINAPI_WINDOW_DRIVER_H
#define FL_WINAPI_WINDOW_DRIVER_H
+#include <FL/Fl_Plugin.H>
#include "../../Fl_Window_Driver.H"
#include <windows.h>
@@ -71,11 +72,6 @@ public:
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, DWORD style = 0, DWORD styleEx = 0);
void make_fullscreen(int X, int Y, int W, int H);
@@ -120,7 +116,15 @@ public:
void capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left, Fl_RGB_Image*& bottom, Fl_RGB_Image*& right) FL_OVERRIDE;
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) FL_OVERRIDE;
- static void resize_after_screen_change(void *data);
+};
+
+
+class Fl_WinAPI_Plugin : public Fl_Plugin {
+public:
+ Fl_WinAPI_Plugin(const char *pluginName) : Fl_Plugin(klass(), pluginName) { }
+ virtual const char *klass() { return "winapi.fltk.org"; }
+ virtual const char *name() = 0;
+ virtual void invalidate(Fl_Window*) = 0;
};
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index b2735b711..4b27753bf 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -50,7 +50,6 @@ Fl_WinAPI_Window_Driver::Fl_WinAPI_Window_Driver(Fl_Window *win)
Fl_WinAPI_Window_Driver::~Fl_WinAPI_Window_Driver()
{
- Fl::remove_timeout(resize_after_screen_change, pWindow);
if (shape_data_) {
delete shape_data_->effective_bitmap_;
delete shape_data_;
@@ -716,17 +715,6 @@ 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;
- Fl_Window_Driver::driver(win)->resize_after_scale_change(ns, old_f, Fl::screen_driver()->scale(ns));
- data_for_resize_window_between_screens_.busy = false;
-}
const Fl_Image* Fl_WinAPI_Window_Driver::shape() {
return shape_data_ ? shape_data_->shape_ : NULL;