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

327 commits

Author SHA1 Message Date
reuk
2f0a0e9387 Windows: Fix nullptr dereference when reopening plugin windows
On Windows, when opening a plugin editor, destroying the plugin
instance, and then creating a new instance and opening its editor, the
plugin would crash because the VBlankDispatcher singleton could not be
recreated.
2022-06-24 18:37:26 +01:00
reuk
cce38de6cf
Windows: Fix virtual keyboard hide/show on Windows 11
This change fixes an issue where the touch keyboard failed to show when
selecting a TextEditor.

On the current versions of Windows 10 and 11, the undocumented
ITipInvocation workaround no longer seems to be required, so it has been
removed.

The isTabletModeActivatedForWindow function is no longer needed, and has
been removed. This function also appears to return inconsistent results:
the window may be in 'desktop mode', but devices with touchscreens
should still display the keyboard when selecting a TextEditor by touch.
2022-06-09 16:55:19 +01:00
reuk
140f8fedb1
TextEditor: Add option to dismiss the virtual keyboard on touches outside
Previously, individual components had to ask the peer to hide and show
the keyboard, by calling textInputRequired() and
dismissPendingTextInput() respectively. When an onscreen keyboard (OSK)
was required, most Peer implementation would directly hide/show the OSK
inside these function. However, the iOS ComponentPeer implementation
instead listened to the application's global keyboard focus, and only
opened the OSK when the focused component was also a TextInputTarget
with active input.

The iOS scheme seems like a better design, as it enforces that the OSK
hiding and showing is synced with the keyboard focus of the application.
In the other implementations, it was possible for a Component to call
textInputRequired even when it didn't have the keyboard focus, putting
the application into an inconsistent state. The iOS scheme also makes
the TextInputTarget interface more useful, as it enforces that the OSK
will only display for components that implement TextInputTarget, and
return true from isTextInputActive().

This patch changes all Peer implementations to match the iOS
implementation, improving consistency. Each time the global keyboard
focus changes, refreshTextInputTarget is called automatically, and the
OSK is shown if the focused component is a TextInputTarget that returns
true from isTextInputActive, and hidden otherwise. Components can also
call refreshTextInputTarget manually. This should be done whenever the
component updates the return value of isTextInputActive(). Effectively,
the Peer is now responsible for keeping track of the focused
TextInputTarget, rather than allowing individual components to hide and
show the OSK at will.

Additionally, this patch adds an option to the TextEditor to
automatically dismiss the OSK when the mouse is clicked outside of the
editor. This should improve user experience on mobile platforms, where
touches on sibling components may cause a TextEditor to gain keyboard
focus and unnecessarily display the OSK.
2022-06-09 16:55:19 +01:00
Tom Poole
2ec861d99e Update licensing banners to JUCE 7 2022-05-16 17:55:48 +01:00
Tom Poole
05a42424f9 Windows: Consolidate graphics invalidation regions
Regions marked as dirty by repaint calls are now queued up and
dispatched when the corresponding physical display device is
refreshed
2022-05-16 16:37:31 +01:00
attila
627afffeb4 Android: Fix dismissing screen keyboard when interacting with TextEditor 2022-04-27 18:49:44 +02:00
reuk
de1e387a7a
Windows: Initialise variable 2022-04-22 14:18:51 +01:00
reuk
c30b3a1a31
Plugin Hosting: Take custom scaling into account when computing editor sizes 2022-04-22 14:18:49 +01:00
reuk
19ddbe2368
Warnings: Fix missing-prototypes warnings 2022-04-22 14:18:48 +01:00
Tom Poole
dea3fe60e4 Update copyright banners 2022-04-04 12:36:32 +01:00
reuk
eb6e579f0a
ComponentPeer: Correctly scale drag and drop coordinates to account for global scale 2022-02-23 10:56:12 +00:00
reuk
c9997bd613
Windows: Correctly dispose of hook
This fixes an issue where REAPER was unable to completely unload VST3
plugins.
2022-02-23 10:56:11 +00:00
reuk
0223e44ae7
Image: Keep track of contiguous buffer size to avoid heap buffer overflows
In CoreGraphicsPixelData::createImage, image data was copied from a
BitmapData created from the Image passed into the function.

The BitmapData instance didn't keep track of the size of the buffer it
pointed to, so the buffer size was computed by multiplying the
BitmapData height by its line stride. However, if the BitmapData pointed
to a subsection of an image, the `data` pointer might be offset from
the allocated region, and `data + lineStride * height` would point past
the end of the allocated region. Trying to read/copy this range would
cause a heap buffer overflow at the end of the range.

This change adjusts BitmapData so that it keeps track of the size of the
allocated region. Taking a subsection of an image should subtract the
data pointer offset from the size of the allocated region.
2022-02-23 10:56:09 +00:00
reuk
e4a7978621
Windowing: Output error text when window creation fails 2022-02-18 16:43:25 +00:00
Attila Szarvas
101a886821 MouseInputSource: Eliminate superfluous drag events caused by pressure change
The bug was triggered on Monterey where a pressure of 1 is reported
while a mouse button is being held down. This caused an extra drag
event being triggered between mouse down and up events, even if no
movement occurred.
2022-02-15 10:53:32 +00:00
attila
a7811661c5 Linux: Fix restoreWindowFromStateString() when the peer already exists 2022-02-02 19:53:31 +01:00
reuk
e210b295ce
Windows: Fix issue where windows could be given incorrect size for their current scale
This issue affected windows with JUCE titlebars. When dragging the
window back and forth between two displays with different DPI settings,
the window could sometimes end up with the wrong size.

It looks like setting new window bounds inside the WM_WINDOWPOSCHANGED
message was occasionally causing the system to lose track of the correct
scale for the window.

As a byproduct of this change, JUCE should no longer receive reentrant
calls to handleDPIChanging.
2022-01-27 18:43:21 +00:00
ed
461192b355 Add FocusOutline class for indicating Component keyboard focus 2022-01-20 15:46:53 +00:00
reuk
640194c878
MinGW: Improve compatibility
With this patch applied, the DemoRunner should build under MinGW, and be
(nearly) feature-complete compared to the MSVC build.

Specifically, when building with MinGW:
- Adds support for accessibility
- Fixes build issues in the juce_video module
- Fixes a link issue in the VST3 wrapper when VST3_CAN_REPLACE_VST2 is
  defined
- Adds support for the new-style native FileChooser
- Tidies up some other low-severity warnings

Known issues:
- Direct2D rendering is still not supported when building with MinGW due
  to ABI compatibilities.
2022-01-17 10:58:18 +00:00
reuk
f429647ae9
MinGW: Add uuid definitions for MinGW-w64 2022-01-17 10:58:17 +00:00
attila
1fc0de32c8 Windows: Ensure that NativeMessageBox stays in front of its owner 2022-01-12 15:55:23 +00:00
reuk
82df66100c
MouseCursor: Allow arbitrarily-sized cursors on Windows 2022-01-10 22:15:21 +00:00
ed
1744008413 Windows: Don't send modal input attempts to windows that are explicitly ignoring them 2021-12-14 11:45:47 +00:00
ed
fc0f6b1f2f Tidy up 2021-12-02 09:24:55 +00:00
reuk
03428561ed
ScaledImage: Use in a few more places 2021-12-01 15:44:07 +00:00
reuk
c17aec47ac
Windows: Allow maximized windows to resize to fill the screen, even when a constrainer is applied
This mirrors the behaviour on Linux, where maximizing a window always
fills the screen, even if a constrainer is active.

If you don't want to allow your component to fill the screen, disable
the maximize button in the window's titlebar when creating the window
(i.e. ensure DocumentWindow::maximiseButton is not set in the required
buttons).
2021-11-24 16:20:36 +00:00
reuk
cb7d9ec1db
Windows: Take custom scale into account when scaling cursors 2021-11-24 16:20:36 +00:00
reuk
cdbefa3b51
Windows: Ensure that new windows are brought to the front after creation 2021-10-27 16:33:37 +01:00
reuk
fe4515adb6
MouseCursor: Refactor platform-specific MouseCursor internals
This new factoring is a bit more typesafe, as it avoids casting
internals to void*.

It also allows cursors to scale appropriately on high resolution
displays on Windows.
2021-10-27 16:33:37 +01:00
reuk
25c9841131
Windows: Tidy up cursor creation function 2021-10-26 16:52:15 +01:00
reuk
b465f60851
HWNDComponentPeer: Dismiss temporary modal windows when a window loses focus 2021-10-26 16:52:15 +01:00
reuk
6ae1137d91
MinGW: Fix Windows build 2021-10-25 09:51:21 +01:00
reuk
2c90261bd4
Windows: Fix missing field initialiser 2021-10-14 12:40:25 +01:00
ed
428260a6fd Whitespace 2021-10-14 12:31:17 +01:00
reuk
72f3a15616
HWNDComponentPeer: Avoid auto-scaling child hwnds
The scaling machinery in the component peer was causing problems for
hosted plugin views. Scaling the plugin view size requires close
collaboration between the plugin and the host, and it's important for
the host to have exact control over the size of the plugin's view. The
removed code in the HWNDComponentPeer was modifying the sizes of
embedded plugin windows, which would often leave them at an incorrect
size.

The faulty behaviour was especially noticable with plugins that do not
support DPI-aware behaviour. I tested with the following plugins (VST2 +
VST3), which should all now display correctly in the AudioPluginHost,
and assume the correct size when opened on hi-res displays, or dragged
between displays with different scale factors:
- Plogue AlterEgo
- U-He Hive 2
- FabFilter Pro-C
- Native Instruments Supercharger
- Surge
2021-09-30 14:19:26 +01:00
reuk
7cd04f7d74
Windowing: Refactor DPI-related function loading 2021-09-30 14:19:26 +01:00
ed
3d282c1078 Desktop: Deprecate isOSXDarkModeActive() and add isDarkModeActive() for other platforms 2021-09-29 17:40:58 +01:00
reuk
4e694c96b3
ScopedDPIAwarenessDisabler: Move to juce_gui_basics 2021-09-28 11:31:50 +01:00
reuk
8b45ff83e2
Windowing: Ignore suggested window sizes for windows that should not be DPI aware 2021-09-28 11:31:50 +01:00
reuk
31500551e1
Move declaration of createSnapshotOfNativeWindow to module header 2021-09-28 11:31:49 +01:00
reuk
6c59a31456
Win32 Windowing: Fix uninitialised data members warning 2021-09-28 11:31:49 +01:00
ed
baa1bbafdf Windows: Fall back to old-style modal dialog when showing native message box modally since TaskDialog does not support fully modal dialogs 2021-09-02 12:33:59 +01:00
ed
f5eee033ba NativeMessageBox: Return correctly mapped value when shown modally 2021-09-02 08:35:14 +01:00
reuk
087cda7e1f
HWNDComponentPeer: Fix reentrancy bug in DPICHANGED handler
Sometimes, changing the bounds of the window inside the DPICHANGED
handler can cause further DPI change events to be processed. Previously,
the scaleFactor set by the "inner" events was also being used when
notifying listeners about the "outer" events, leading to graphical
glitches.

An effect of the bug was that VST2 views in the AudioPluginHost would
occasionally render with an incorrect size and position after dragging
them between displays with different scale factors.

With this change in place, we only notify listeners and update window
bounds once there are no DPI changes in progress.
2021-07-30 09:20:11 +01:00
reuk
20c23700e5 MinGW: Fix some build issues for 32-bit platforms 2021-07-28 19:28:34 +01:00
ed
551d7b9c5b Add MessageBoxOptions class for specifying a set of AlertWindow and NativeMessageBox options
- Add AlertWindow::show() and showAsync() methods that take a MessageBoxOptions argument
  - Add NativeMessageBox::show() and showAsync() methods that take a MessageBoxOptions argument
  - Update the DialogsDemo to demonstrate the new methods
  - Deprecate AlertWindow::showNativeDialogBox() in favour of the NativeMessageBox methods
  - Pass button strings specified in MesssageBoxOptions to native dialog boxes correctly
  - Use modern TaskDialog on Windows for the native dialog box where available
2021-07-21 16:34:12 +01:00
ed
d5175b6e23 Windows: Use ScopedThreadDPIAwarenessSetter in keyboard hooks to set correct thread DPI awareness 2021-06-10 18:14:50 +01:00
reuk
1ee106d730
PopupMenu: Avoid dismissing PopupMenus in bridged plugin editors
When bridging 32-bit/64-bit plugins on Windows, the plugin is hosted in
an auxilliary process, and the plugin's editor is embedded into an HWND
owned by a different process (the plugin host).

Previously, the `isForegroundProcess` check would fail for bridged
plugins, because the foreground window may belong to the DAW, rather
than to the auxilliary hosting process.

This patch adds an additional check, to find whether the same process
owns both the foreground window, and the window which embeds the
PopupMenu's target component. In this case, we avoid immediately
dismissing the PopupMenu.
2021-06-08 14:57:42 +01:00
reuk
7ac6911ccc
Windows: Fix clang/gnu compiler warnings 2021-06-03 17:30:44 +01:00
reuk
31a7c62baf
Windows: Fix and suppress some analysis warnings
This fixes warnings that are emitted when building with the `-analyze`
flag enabled.
2021-05-26 15:34:26 +01:00