1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00
JUCE/modules/juce_gui_basics/native
reuk c24d1a17a7
Windowing: Avoid changing window bounds in WM_WINDOWPOSCHANGING
This change intends to address a bug observed only on Windows 10 with a
display scale factor of 125%.

When the native titlebar is enabled, and the window's border-resizer is
used to resize the window slowly the with mouse, the client area of the
window may move to the wrong location, or be drawn with some areas
obscured/clipped. This is especially observable when resizing the
WidgetsDemo to its smallest size, and then dragging the right border a
single pixel to the right. On my computer, this consistently causes the
client area to display at the wrong location.

I haven't been able to find any obvious bug in JUCE that might cause
this behaviour. In particular, it seems that the window begins
displaying incorrectly *before* the window ever actually resizes.

During the resize, the system sends events (WM_SIZING and
WM_WINDOWPOSCHANGING) to the window, and according to the documentation,
the window may modify the message parameters in order to constrain the
new window size. When running on a scaled display, JUCE attempts to map
the logical client area size to a sensible size in physical pixels, and
uses the sizing messages to enforce this size requirement.

In the case of the broken window rendering, the system requests a new
window size, which JUCE rejects. The window's display state doesn't
change, so the swap chain does not resize, and the swap chain does not
present. Put another way, the broken rendering happens *independently*
of JUCE modifying the swap chain in any way. Therefore, I believe that the
bug is introduced elsewhere, potentially by Windows itself.

I also checked to see whether the issue could be caused by mishandling
of the NCCALCSIZE message, which is normally used to configure the
relative positions of the client and nonclient areas. However, in the
buggy case, NCCALCSIZE is not sent until *after* the first 'broken'
frame is painted - and even then, the implementation immediately falls
back to DefWindowProc.

Given that the issue appears to be a bug in Windows, the proposed change
is a workaround, rather than a true fix. It appears as though the
problem goes away when WM_WINDOWPOSCHANGING does not modify the
requested bounds. Therefore, for windows with native titlebars, we rely
on the constraints to be applied in WM_SIZING only, when sizing the
window in a sizemove gesture.
2024-12-02 17:20:42 +00:00
..
accessibility Singleton: Add new macros to simplify singleton creation 2024-10-16 10:36:52 +01:00
java/app/com/rmsl/juce Update licensing information 2024-04-16 11:39:35 +01:00
javaopt/app/com/rmsl/juce Update licensing information 2024-04-16 11:39:35 +01:00
juce_CGMetalLayerRenderer_mac.h Update licensing information 2024-04-16 11:39:35 +01:00
juce_ContentSharer_android.cpp ContentSharer: Use SEND instead of SEND_MULTIPLE when sharing individual files 2024-09-30 20:12:51 +01:00
juce_ContentSharer_ios.cpp Update licensing information 2024-04-16 11:39:35 +01:00
juce_DragAndDrop_linux.cpp Update licensing information 2024-04-16 11:39:35 +01:00
juce_DragAndDrop_windows.cpp Singleton: Add new macros to simplify singleton creation 2024-10-16 10:36:52 +01:00
juce_FileChooser_android.cpp Platform: Remove compatibility checks for Android 20 and earlier 2024-07-03 13:45:37 +01:00
juce_FileChooser_ios.mm FileChooser: Fix deprecation warnings for iOS 14 2024-10-29 19:46:34 +00:00
juce_FileChooser_linux.cpp Update licensing information 2024-04-16 11:39:35 +01:00
juce_FileChooser_mac.mm Deprecations: Add ignore deprecation warning macros 2024-11-27 11:07:04 +00:00
juce_FileChooser_windows.cpp Versioning: Add the JUCE version number to any internally created threads 2024-09-26 08:10:56 +00:00
juce_MainMenu_mac.mm Singleton: Add new macros to simplify singleton creation 2024-10-16 10:36:52 +01:00
juce_MouseCursor_mac.mm MouseCursor: Fix argument order in call to dictionaryWithObjectsAndKeys 2024-04-16 21:07:44 +01:00
juce_MultiTouchMapper.h Update licensing information 2024-04-16 11:39:35 +01:00
juce_NativeMessageBox_android.cpp Update licensing information 2024-04-16 11:39:35 +01:00
juce_NativeMessageBox_ios.mm Update licensing information 2024-04-16 11:39:35 +01:00
juce_NativeMessageBox_linux.cpp MessageBox: Avoid potential divide-by-zero for boxes with no buttons 2024-10-20 22:59:39 +01:00
juce_NativeMessageBox_mac.mm Platform: Remove compatibility checks for macOS 10.9 2024-07-02 18:06:27 +01:00
juce_NativeMessageBox_windows.cpp NativeMessageBox: Fix string pointer use-after-free 2024-09-05 12:21:02 +01:00
juce_NativeModalWrapperComponent_ios.h Update licensing information 2024-04-16 11:39:35 +01:00
juce_NSViewComponentPeer_mac.mm NSViewComponentPeer: Guard API availability 2024-12-02 15:20:49 +00:00
juce_PerScreenDisplayLinks_mac.h Deprecations: Add ignore deprecation warning macros 2024-11-27 11:07:04 +00:00
juce_ScopedDPIAwarenessDisabler.cpp Update licensing information 2024-04-16 11:39:35 +01:00
juce_ScopedDPIAwarenessDisabler.h Update licensing information 2024-04-16 11:39:35 +01:00
juce_ScopedThreadDPIAwarenessSetter_windows.h Update licensing information 2024-04-16 11:39:35 +01:00
juce_ScopedWindowAssociation_linux.h Update licensing information 2024-04-16 11:39:35 +01:00
juce_UIViewComponentPeer_ios.mm Fix unused variable warnings 2024-12-02 14:44:24 +00:00
juce_VBlank_windows.cpp ComponentPeer::VBlankListener: Add timestamp parameter to the vblank callback 2024-10-25 15:44:34 +02:00
juce_Windowing_android.cpp ComponentPeer::VBlankListener: Add timestamp parameter to the vblank callback 2024-10-25 15:44:34 +02:00
juce_Windowing_ios.mm ObjCHelpers: Add new macros to help with version checking 2024-10-29 19:46:35 +00:00
juce_Windowing_linux.cpp ComponentPeer::VBlankListener: Add timestamp parameter to the vblank callback 2024-10-25 15:44:34 +02:00
juce_Windowing_mac.mm Deprecations: Add ignore deprecation warning macros 2024-11-27 11:07:04 +00:00
juce_Windowing_windows.cpp Windowing: Avoid changing window bounds in WM_WINDOWPOSCHANGING 2024-12-02 17:20:42 +00:00
juce_WindowsHooks_windows.cpp Windows: Remove mousewheel hook 2024-08-22 17:35:18 +01:00
juce_WindowsHooks_windows.h Update licensing information 2024-04-16 11:39:35 +01:00
juce_WindowUtils_android.cpp Update licensing information 2024-04-16 11:39:35 +01:00
juce_WindowUtils_ios.mm Update licensing information 2024-04-16 11:39:35 +01:00
juce_WindowUtils_linux.cpp Update licensing information 2024-04-16 11:39:35 +01:00
juce_WindowUtils_mac.mm Update licensing information 2024-04-16 11:39:35 +01:00
juce_WindowUtils_windows.cpp Update licensing information 2024-04-16 11:39:35 +01:00
juce_XSymbols_linux.cpp Singleton: Add new macros to simplify singleton creation 2024-10-16 10:36:52 +01:00
juce_XSymbols_linux.h Singleton: Add new macros to simplify singleton creation 2024-10-16 10:36:52 +01:00
juce_XWindowSystem_linux.cpp Linux: Prevent stale ConfigureNotify events from overwriting the current window position 2024-10-24 13:10:14 +02:00
juce_XWindowSystem_linux.h Singleton: Add new macros to simplify singleton creation 2024-10-16 10:36:52 +01:00