diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-12-13 16:57:28 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-12-13 16:58:06 +0100 |
| commit | 6bd4f3f9d78be69cb6fce3e9d7f757789f246a39 (patch) | |
| tree | 14daf61b14c89ad65db11bb24fde5f549bd50f93 | |
| parent | 73556ca5fb09f81c47b9f93d3f3a5253a0fb1b75 (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.
| -rw-r--r-- | src/Fl_win32.cxx | 4 |
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); |
