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.
This commit is contained in:
ManoloFLTK
2025-12-13 16:57:28 +01:00
parent 73556ca5fb
commit 6bd4f3f9d7
+3 -1
View File
@@ -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);