summaryrefslogtreecommitdiff
path: root/src/Fl_win32.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2025-12-13 16:57:28 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2025-12-13 16:58:06 +0100
commit6bd4f3f9d78be69cb6fce3e9d7f757789f246a39 (patch)
tree14daf61b14c89ad65db11bb24fde5f549bd50f93 /src/Fl_win32.cxx
parent73556ca5fb09f81c47b9f93d3f3a5253a0fb1b75 (diff)
Windows: Fix "If app appears on non-active screen …, window resizes" (#259)
The fix puts the first window an app creates on the screen containing the mouse, because the present window creation code needs to know on what screen a created window is going to appear before creating it.
Diffstat (limited to 'src/Fl_win32.cxx')
-rw-r--r--src/Fl_win32.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index d31568778..da0e20895 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -2190,9 +2190,11 @@ void Fl_WinAPI_Window_Driver::makeWindow() {
Fl_Window *hint = Fl::first_window();
if (hint) {
nscreen = Fl_Window_Driver::driver(hint->top_window())->screen_num();
- } else {
+ } else if (Fl::screen_driver()->screen_count() > 1 ) {
int mx, my;
nscreen = Fl::screen_driver()->get_mouse(mx, my);
+ float s = Fl::screen_driver()->scale(nscreen);
+ w->position(mx/s, my/s); // put the new window on same screen as mouse
}
}
Fl_Window_Driver::driver(w)->screen_num(nscreen);