1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00
Commit graph

122 commits

Author SHA1 Message Date
reuk
258203706c
Direct2D: Use WM_PAINT and vblank callbacks to drive painting 2025-12-17 18:05:46 +00:00
reuk
22ae5baa42
Direct2D: Remove SwapChainThread completely
D2D repaints are always driven by a vblank timer, and D2D presentation
can't happen any faster than the vblank callbacks, so I think it's safe
to remove the swapchain machinery and to rely entirely on the vblank
callbacks instead.
2025-12-17 18:05:46 +00:00
reuk
65206568c4
HWNDComponentPeer: Remove dispatchDeferredRepaints() 2025-12-17 17:44:17 +00:00
reuk
b4c28db765
ComponentPeer: Add method for overriding native scale factor 2025-12-16 12:23:58 +00:00
reuk
254e03a435
Windows: Use ComSmartPtr to manage FileDropTarget 2025-12-16 12:03:35 +00:00
reuk
57c739c444
Windows: Remove isStandaloneApp checks 2025-12-16 12:03:35 +00:00
reuk
3f13cdb314
HWNDComponentPeer: Add setBoundsPhysical() method to set window size in physical pixels 2025-12-16 12:03:35 +00:00
reuk
82cc2ab282
Windows: Fix target version preprocessor definition
This now matches the definition in juce_BasicNativeHeaders.h
2025-12-16 12:03:35 +00:00
reuk
1237b34c84
Windowing: Avoid dynamically loading GetSystemMetricsForDpi, which is always present on Windows 10 2025-12-16 12:03:35 +00:00
reuk
5048d359e5
Windowing: Avoid dynamically loading EnableNonClientDpiScaling, which is always present on Windows 10 2025-12-16 12:03:35 +00:00
reuk
e2a1af48e5
Windowing: Avoid dynamically loading GetWindowDpiAwarenessContext, which is always present on Windows 10 2025-12-16 12:03:35 +00:00
reuk
f34de2438c
Windowing: Avoid dynamically loading GetAwarenessFromDpiAwarenessContext, which is always present on Windows 10 2025-12-16 12:03:35 +00:00
reuk
ad95f9d88c
Windowing: Avoid dynamically loading GetThreadDpiAwarnessContext, which is always present on Windows 10 2025-12-16 12:03:34 +00:00
reuk
016cf341bf
Windowing: Avoid dynamically loading SetThreadDpiAwarenessContext, which is always present on Windows 10 2025-12-16 12:03:34 +00:00
reuk
2591068b61
Windowing: Avoid dynamically loading GetProcessDpiAwareness, which is always present on Windows 8.1 2025-12-16 12:03:34 +00:00
reuk
f1d215f014
Windowing: Avoid dynamically loading SetProcessDpiAwareness, which is always present on Windows 8.1 2025-12-16 12:03:34 +00:00
reuk
09ae83a367
Windowing: Avoid dynamically loading SetProcessDpiAwarenessContext, which is always present on Windows 10 2025-12-16 12:03:34 +00:00
reuk
63410e78e7
Windowing: Avoid dynamically loading GetDpiForMonitor, which is always present on Windows 8.1 2025-12-16 12:03:34 +00:00
reuk
b4749b1f86
Windowing: Avoid dynamically loading SetProcessDPIAware, which is always present on Vista 2025-12-16 12:03:34 +00:00
reuk
2261575b00
Windowing: Avoid dynamically loading GetDpiForWindow, which is always present on Windows 10 2025-12-16 12:03:34 +00:00
reuk
83e5264c86
Formatting: Remove double-dots from comments and other strings 2025-11-18 15:47:42 +00:00
reuk
82dc6d1c7e
Windows: Fix a bug where windows with non-native titlebars could be maximised to the wrong size
This issue presented after the following sequence of steps:

- Display a window with a non-native titlebar
- Maximise it
- Click the taskbar icon to minimise it
- Click the taskbar icon again to maximise it

After being maximised for the second time, the window bounds were too
large for the display. This is because the check in WM_NCCALCSIZE was
failing to determine the target monitor for the window, and therefore
failing to adjust the new area appropriately. We now determine the
target monitor based on the proposed new bounds of the new window,
rather than the current bounds of the window, which may not be
meaningful if the window is minimised.
2025-11-17 19:33:54 +00:00
Anthony Nicholls
88af872d4d AUv3: Fix an issue in detecting the available screen user area
On at least iOS 26 using a temporary window frame is unreliable. This
change tries to use an existing window for any non-standalone app. It
also updates the details on any changes, such as when the device
orientation changes.
2025-10-10 18:07:52 +01:00
Oli
d390db8eef
Windows: Implement support for extra mouse buttons 2025-08-13 15:38:14 +01:00
reuk
be489028dc
Windows: Ensure modifier keys are left in a consistent state after a nonclient button press 2025-07-09 11:28:03 +01:00
reuk
803ab31d21
Windows: Fix bug where stale mouse button state could get sent to windows after a window move
handlePositionChanged() is called when the window changes z-order, which
may cause a new mouse event to be synthesised if the mouse is over the
window after the z-order is updated. In this situation, we may not have
received a mouse up/down/move event to update the current modifier
flags, so we need to update them ourselves.
2025-07-09 11:28:03 +01:00
reuk
a2b2813b93
Windows: Update window style flags when toggling kiosk mode
This is a different approach to the change introduced in
04f87320d5.

Instead of completely recreating the window, we now just update the
window's style flags. This should ensure that window and component focus
are preserved.
2025-06-30 16:33:43 +01:00
reuk
04f87320d5
Windows: Recreate peer if window styles need to change as a result of entering/leaving kiosk mode
This follows on from the work in
3e70c37ce3.

The previous patch had the intended effect as long as the peer was
recreated after entering kiosk mode. However, for windows initially
created with non-native titlebars, attempting to disable the titlebar
would have no effect.

We now check whether the native style flags would need to change as a
result of changing kiosk mode, and recreate the peer if necessary.
2025-06-23 20:33:42 +01:00
reuk
85a17809ab
Windows: Use isKioskMode() getter where appropriate in peer 2025-06-23 20:23:09 +01:00
reuk
2d243486c9
Windows: Fix bug where mouse events would not reach background windows blocked by modal windows 2025-06-19 18:12:33 +01:00
reuk
8d935b25b2
Windows: Disable edge-resizer cursors for kiosk-mode windows 2025-06-19 14:45:31 +01:00
reuk
3e70c37ce3
Windows: Disable window decorations for kiosk-mode windows
This fixes an issue where kiosk-mode windows would incorrectly receive
rounded corners and a 1px transparent border.
2025-06-19 14:45:31 +01:00
reuk
aa9b352483
Windows: Use ScopedValueSetter to make function implementation more concise 2025-06-19 14:45:31 +01:00
reuk
9b9b98bc8f
Windows: Make static data members inline 2025-06-19 14:45:30 +01:00
reuk
6bc274286f
Windows: Fix mouse state tracking when mouse leaves window
467f20a7a1 introduced a change to start processing WM_NCMOUSELEAVE
messages as mouse-exit events. This behaviour is not quite correct,
because NCMOUSELEAVE may be triggered when moving the cursor from the
nonclient area to the client area, in which case the mouse is still over
the window.

We now check whether the mouse is really over the window inside
doMouseExit(), and continue to track it if necessary.
2025-06-19 14:45:30 +01:00
reuk
5d7208bb54
ModifierKeys: Avoid direct access to currentModifiers when reading but not writing 2025-06-19 14:42:49 +01:00
Oli
44d304b468 Direct2D: Use PostMessage for swapchain events
Co-authored-by: Matt Gonzalez <matt@echoaudio.com>
2025-04-24 13:58:24 +01:00
Oli
f75fb7f452 Windows: Use SoftwareImageType for Icon conversions
Co-authored-by: Matt Gonzalez <matt@echoaudio.com>
2025-04-24 13:58:23 +01:00
reuk
183c327e75
Windowing: Fix mouse position in client area for maximised windows with non-native titlebar
The incorrect mouse coordinates could be observed by hovering over
widgets such as buttons in a maximised window using a non-native
titlebar.
2025-01-29 11:00:44 +00:00
reuk
336dcfc08c Direct2DImage: Update interface to accept a Device instead of a DeviceContext 2024-12-13 14:43:06 +00:00
reuk
dcca72484f Image: Update return type of getPixelData to avoid dangling pointers 2024-12-13 14:42:26 +00:00
reuk
80bb7b0861 ScopedThreadDPIAwarenessSetter: Make moveable 2024-12-13 14:42:26 +00:00
reuk
051e701780 Windowing: Update mousewheel handler on Windows to always process messages in the context of the peer receiving the event 2024-12-03 14:26:21 +00:00
reuk
cfee7cfc93
Windows: Fix bug where IME displayed at incorrect location on scaled displays 2024-12-02 17:20:43 +00:00
reuk
038b0d6c9e
Windows: Fix bug where IME failed to display on Windows 11 2024-12-02 17:20:42 +00:00
reuk
2fcf9ebf38
Windowing: Fix issue where components dragged between monitors with different scalings could detach from the mouse
This bug could be observed by running the WidgetsDemo Drag+Drop pane on
Windows 10, and dragging an item between two displays at different scale
factors.

This is issue is a regression introduced in
9817a2bb66. The regression was caused by
the change in mouse position calculation. The incorrect version switched
to using ClientToScreen, but the correct version used
getPointFromLocalLParam.

The function getPointFromLocalLParam was replaced by clientLParamToPoint
in 24ab3cb6a3, and is restored by this
commit.
2024-12-02 17:20:42 +00:00
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
reuk
81a95abb3c
Windowing: Use local coordinate space of component in call to findControlAtPoint 2024-12-02 17:20:42 +00:00
reuk
90d9f573c2
Windowing: Avoid using bogus window-border sizes when computing constrained window sizes
Previously, for windows with a native titlebar and a constrainer, the
window could be restored at the wrong size. This happened because
findPhysicalBorderSize() may return nonsensical values when called
during a SC_RESTORE, which in turn produces an unexpected window size
when adding the bogus border size to the constrained client area size.

We now avoid trying to constrain the window if we're unable to determine
the correct border size. I think this is only likely to happen during
SC_RESTORE, in which case the system should have a pretty good idea of
where the window should go, and constraining should not be necessary.
2024-12-02 17:20:42 +00:00
reuk
543ae06632
Windowing: Fix issue where edge resizers could incorrectly be displayed for non-resizable windows
The buggy behaviour could be seen in a blank GUI app project by setting
a native titlebar and calling setResizable (false, false). The resulting
window would still display a resize cursor when hovering the window
border.
2024-12-02 17:20:42 +00:00