From e33130d2042bdfc5e83e97204abd25f050c3429c Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 15 Dec 2025 08:17:50 +0100 Subject: =?UTF-8?q?Windows:=20Fix=20"If=20app=20appears=20on=20non-active?= =?UTF-8?q?=20screen=20=E2=80=A6,=20window=20resizes"-=20cont'd=20(#259)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Fl_win32.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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); -- cgit v1.2.3