diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-12-15 08:17:50 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-12-15 08:17:50 +0100 |
| commit | e33130d2042bdfc5e83e97204abd25f050c3429c (patch) | |
| tree | 3b5e50a189832a10fc8d9aa109e7d519c7100821 | |
| parent | e5b8b6e2fe83385d0f05289e7cef32e07409f8ad (diff) | |
Windows: Fix "If app appears on non-active screen …, window resizes"- cont'd (#259)
| -rw-r--r-- | src/Fl_win32.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index da0e20895..8d6417fea 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -2191,10 +2191,13 @@ void Fl_WinAPI_Window_Driver::makeWindow() { if (hint) { nscreen = Fl_Window_Driver::driver(hint->top_window())->screen_num(); } else if (Fl::screen_driver()->screen_count() > 1 ) { - int mx, my; + // put the new window on same screen as mouse + int mx, my, X, Y, W, H; 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::screen_xywh(X, Y, W, H, nscreen); + if (mx + w->w() >= X + W) mx = X + W - w->w(); + if (my + w->h() >= H + H) my = Y + H - w->h(); + w->position(mx, my); } } Fl_Window_Driver::driver(w)->screen_num(nscreen); |
