diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-10-30 17:32:57 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-10-30 17:32:57 +0100 |
| commit | 3c03aecc3c664a8b174dc863c6692aaf4a27b2f3 (patch) | |
| tree | 4bee0643d6c2c99577b7548488d03b6193963d3f /src/Fl_win32.cxx | |
| parent | 56cf5684dc3ae06dd77a5f8f0143dc368de76746 (diff) | |
Fix Windows: fullscreen doesn't always pick the correct display (#1097)
Diffstat (limited to 'src/Fl_win32.cxx')
| -rw-r--r-- | src/Fl_win32.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 7bb7b6938..b87b05548 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1699,7 +1699,16 @@ content key keyboard layout Fl_WinAPI_Screen_Driver *sd = (Fl_WinAPI_Screen_Driver *)Fl::screen_driver(); Fl_WinAPI_Window_Driver *wd = Fl_WinAPI_Window_Driver::driver(window); int olds = wd->screen_num(); - int news = sd->screen_num_unscaled(nx + int(window->w() * scale / 2), ny + int(window->h() * scale / 2)); + // Issue #1097: when a fullscreen window is restored to its size, it receives first a WM_MOVE + // and then a WM_SIZE, so it still has its fullscreen size at the WM_MOVE event, which defeats + // using window->w()|h() to compute the center of the (small) window. We detect this situation + // with condition: !window->fullscreen_active() && *wd->no_fullscreen_w() + // and use *wd->no_fullscreen_w()|h() instead of window->w()|h(). + int trueW = window->w(), trueH = window->h(); + if (!window->fullscreen_active() && *wd->no_fullscreen_w()) { + trueW = *wd->no_fullscreen_w(); trueH = *wd->no_fullscreen_h(); + } + int news = sd->screen_num_unscaled(nx + int(trueW * scale / 2), ny + int(trueH * scale / 2)); if (news == -1) news = olds; float s = sd->scale(news); |
