1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-14 00:14:18 +00:00
Commit graph

83 commits

Author SHA1 Message Date
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
reuk
24ab3cb6a3
Windows: Fix mouse position reporting for maximised windows with non-native titlebars
Previously, windows with non-native titlebars but with native shadows
would misreport mouse-down and mouse-up positions when maximised.
2024-11-05 13:28:10 +00:00
attila
d9a3efd3cb ComponentPeer::VBlankListener: Add timestamp parameter to the vblank callback 2024-10-25 15:44:34 +02:00
reuk
80ac9a78a0
Singleton: Add new macros to simplify singleton creation
The INLINE macros allow singletons to be declared and defined in one
line, without requiring a separate JUCE_IMPLEMENT_SINGLETON statement.
2024-10-16 10:36:52 +01:00
reuk
c7f7a7c1bb
Direct2D: Remove setResizing and getResizing members from renderer
We instead query from the renderer whether the current render size has
changed since the last frame, and repaint the entire window if so.
2024-10-07 11:50:26 +01:00
reuk
fdf74a7477
Windowing: Reinstate old WindowFromPoint behaviour in ComponentPeer::contains
This reverts 515e9b9f89.

In order to avoid recursive calls through WM_NCHITTEST, we remove calls
to Component::contains in DocumentWindow::findControlAtPoint.
2024-10-02 11:35:39 +01:00
reuk
102ef24061
Direct2D: Avoid unnecessarily reallocating window buffers during window move 2024-10-02 11:35:37 +01:00
reuk
c02ec2e3d5 DocumentWindow: Ensure button callbacks are called on Windows 2024-09-30 20:12:51 +01:00
reuk
555b667d22
ComponentPeer: Add isShowing() member, which more closely matches expected behaviour of Component::isShowing 2024-09-18 15:44:05 +01:00
reuk
589d9940ed
Direct2D: Add support for bitmaps spanning multiple texture pages 2024-09-18 15:44:04 +01:00
reuk
8754d87900 Windows: Fix build warnings when JUCE_DISABLE_ASSERTIONS is set 2024-09-13 13:57:10 +01:00
reuk
faf6d9976a
Windows: Fix WM_NCCALCSIZE behaviour for frameless windows on multiple display systems
Previously, maximising a frameless window on a secondary display could
result in the window's coordinates being computed incorrectly, leading
to graphical glitches.
2024-09-05 12:16:39 +01:00
reuk
11821d88a4
Windows: Avoid attempting to dismiss modals during minimise/restore 2024-09-05 12:11:30 +01:00
reuk
0ed2ae64fa
Windows: Fix issue where windows with titlebars reported the wrong transparency kind 2024-08-23 16:12:29 +01:00
reuk
340f531c71
Direct2D: Reinstate support for transparent windows 2024-08-22 20:19:49 +01:00
reuk
6f2293d91b
Windows: Fix conversion of WindowsBitmapImages to SoftwareBitmapImages 2024-08-22 18:18:17 +01:00
reuk
b7db89cb8e
Windows: Fix capture of software-rendered windows with per-pixel alpha 2024-08-22 18:18:17 +01:00
reuk
348d638581
Direct2D: Temporarily disable window transparency for D2D windows 2024-08-22 18:18:17 +01:00
reuk
2a108ca582
Direct2D: Rename GDIContext and D2DContext 2024-08-22 18:18:16 +01:00
reuk
831c5142a4
Windows: Refactor WindowsBitmapData to expose updateLayeredWindow 2024-08-22 18:18:16 +01:00
reuk
328ad60d9e
Windows: Move definition of GDI window snapshot function 2024-08-22 18:18:16 +01:00
reuk
b90498d79b
Windows: Always use WS_POPUP style for windows without a native titlebar or shadow
If we don't do this, the top corners of the window may have unwanted
clipping applied, making the corners appear rounded.
2024-08-22 18:18:16 +01:00
reuk
afaf97fe16
Windows: Update minimise and maximise window flags
The docs for WS_MINIMIZEBOX and WS_MAXIMIZEBOX specify that WS_SYSMENU must be specified.
The docs for WS_SYSMENU specify that WS_CAPTION must be specified.
2024-08-22 18:18:16 +01:00
reuk
e9f2a94d62
Windows: Use new client rect helper in implementation of getScreenPosition() 2024-08-22 18:18:16 +01:00
reuk
4a76872f54
Windows: Add helper to find client rect in screen coordinates 2024-08-22 18:18:16 +01:00
reuk
570fd4b65c
Direct2D: Track UpdateRegions in D2DContext rather than the Direct2DHwndContext 2024-08-22 18:18:15 +01:00
reuk
19aade443a
Windows: Fix bug where plugins with additional top-level windows could fail to repaint after changing the display config 2024-08-22 18:18:14 +01:00
reuk
77bf765fcf
Windows: Avoid sending mousewheel events to obscured windows 2024-08-22 17:35:18 +01:00
attila
9ad70308a8 Replace usage of deprecated type std::aligned_storage_t 2024-08-15 11:15:15 +02:00
reuk
a891f0054c
Windows: Allow constrained resize for windows that are not marked as resizable 2024-07-31 19:36:52 +01:00
reuk
0ffe5948a5
Windows: Fix issue where maximised windows with non-native titlebars could slightly exceed the screen bounds
When handling WM_NCCALCSIZE, we reduce the size of the client area when
the window is maximised. If we don't do this, then the client area
matches the top-level window area, which is larger than the display's
safe area. As a result, the window appears too large, and the edges are
obscured under the edges of the display.

After reducing the client area in WM_NCCALCSIZE, the client area is no
longer equal to the top-level window area, so getBounds() must be
updated to return the window's *client* area rather than the top-level
window area.
2024-07-31 19:36:52 +01:00
reuk
63eb8c5692
Windows: Remove unused functions 2024-07-31 19:36:52 +01:00
reuk
d7bfecae28
Windows: Avoid changing window size after display settings change
Previously, a 'system info' change could cause the window size to
change, which was unexpected.
2024-07-31 19:36:51 +01:00
reuk
4c5c336e65
Windowing: Re-enable rounded corners on Windows 11 2024-07-29 16:12:00 +01:00
reuk
9817a2bb66
Windowing: Allow window to keep repainting when mouse is held in caption area 2024-07-29 16:12:00 +01:00
reuk
ce7bafcfcb
Windowing: Reduce size of RenderContext interface 2024-07-29 16:12:00 +01:00
reuk
14f3751a06
Windowing: Fix issues with window border rendering/positioning 2024-07-29 16:12:00 +01:00
reuk
a43a69241c
Windowing: Ensure modifier key state is updated after clicking on window caption
Without this change, the mouse state was not always updated after
releasing the mouse, leaving the current modifier keys with the
left-mouse-button bit set. This was particularly evident in standalone
plugins, where clicking the 'options' button in the titlebar, then
immediately clicking the titlebar could "stick" the window to the mouse,
making it impossible to interact with the window normally.
2024-07-29 16:11:59 +01:00
reuk
664bc242b2
Windowing: Only begin mouse tracking for movement in the client area 2024-07-29 16:11:59 +01:00
reuk
eca3e074e5
Windowing: Respect modal state and enablement for native titlebar buttons 2024-07-29 16:11:59 +01:00