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

228 commits

Author SHA1 Message Date
reuk
6ff5e57b62
Component: Add overload for setTopRightPosition(Point<int>) 2025-02-11 18:11:12 +00:00
reuk
95610e6c5e
Component: Add more stringent checks for deleted components when handling mouse events 2025-02-06 18:22:32 +00:00
reuk
b292ba215a
Component: Ensure global mouse listeners are notified on mouse up
Previously, listeners would sometimes fail to receive mouse up events
blocked by modal components
2024-10-20 22:59:39 +01:00
reuk
f5f758c032 Partially revert "ComponentPeer: Add isShowing() member, which more closely matches expected behaviour of Component::isShowing"
This partially reverts commit 555b667d22.

Using ComponentPeer::isShowing instead of ComponentPeer::isMinimised
inside Component::isShowing can cause problems when displaying OpenGL
components.

Specifically, OpenGL components use a ComponentMovementWatcher to
determine when they should be attached/detached from the parent window.
The ComponentMovementWatcher updates whenever a component visibility
change event is emitted, which happens in two cases:
- Component::setVisible is called on the OpenGL component or an ancestor
- ComponentPeer::handleMovedOrResized is called in response to a
  minimisation state change

When handling either of these events, the ComponentMovementWatcher will
call Component::isShowing to determine whether or not the component is
really showing.

The problem is that the result of ComponentPeer::isShowing may change
independently of changes to the Component visiblity state or
ComponentPeer minimisation state, so the ComponentPeerWatcher might not
notify its listeners when a component is really shown/hidden.

One potential workaround would be for the ComponentPeer to send
notifications when the showing state of the window changes, so that the
ComponentMovementWatcher can forward those notifications. The main
problem with this approach is that on Windows, the window doesn't seem
to receive a message on hide/show, and it's not clear whether there
exists some other approach to detect a hide/show event.

If there were some event we could listen for on Windows, then we could
call Component::sendVisibilityChangeMessage in response to this event
and things would *likely* work at that point, but this may still have
unintended side-effect. As a result, I think the best approach to
restore the old behaviour is to revert the change to
Component::isShowing. The implementations of ComponentPeer::isShowing
have been left in place so that users can do still query the real
visibility state of native windows if necessary.
2024-09-30 19:50:37 +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
attila
5ce2fc388e Fix C++23 compilation 2024-08-15 11:15:15 +02:00
reuk
225f1526ee
Component: Avoid creating ModalComponentManager unnecessarily 2024-06-20 17:52:23 +01:00
reuk
d7788100d5
ModalComponentManager: Remove friendship with Component
This change makes it slightly easier to audit invariants of
ModalComponentManager, as we can now be certain that only member
functions of ModalComponentManager can access its data members.
2024-05-31 11:43:28 +01:00
reuk
631b2ea2ba
Component: Cache effect images internally to Component, to avoid hash collisions in the ImageCache 2024-05-20 12:49:54 +01:00
reuk
19061e6d17
Direct2D: Add initial support 2024-04-18 14:16:02 +01:00
reuk
4533077b75
LookAndFeel: Allow specifying a default typeface metrics kind to use 2024-04-18 14:16:00 +01:00
Tom Poole
94d98a2b10 Update licensing information 2024-04-16 11:39:35 +01:00
attila
7650c85ba5 Avoid focus changes due to mouse clicks for Components with setMouseClickGrabsKeyboardFocus (false)
Even if this focus change is being propagated up by a child Component.
2024-01-02 15:10:02 +01:00
Anthony Nicholls
c5fbeb859d Component: Improve the accuracy of the relative mouse position 2023-10-31 12:47:39 +00:00
Tom Poole
6bf9bb9a2e Add final specifiers in implementation files 2023-10-10 16:12:38 +01:00
Tom Poole
4153d59e39 Formatting 2023-10-02 15:42:20 +01:00
attila
7657efd227 WebBrowserComponent: Windows: Add accessibility integration 2023-06-08 16:07:11 +00:00
Anthony Nicholls
cff722a4af GUI Basics: Refactor juce_gui_basics file structure
- Created a new detail namespace
- Moved shared module implementation details into the detail namespace
- Split dependencies so source files only rely on details in the detail namespace
- Removed all code from the juce_gui_basics.cpp file
2023-03-16 08:53:12 +00:00
attila
49cc7a0e09 Component: Fix potential bad access during mouse double click 2022-12-23 13:09:36 +00:00
reuk
2e16de3501
Component: Avoid mouseListener use-after-free when deleting components in mouse callbacks 2022-12-14 11:12:31 +00:00
attila
c1f3d30679 Component::MouseListenerList: Fix bad access 2022-11-07 13:08:19 +01:00
Fabian Renn-Giles
f2de0f12b0 GUI: Ensured that mouse listeners are still called even if the originating component is deleted in response to such an event 2022-11-02 22:52:49 +00:00
reuk
697643c0b6
Component: Add an assertion to check that the component remains alive when entering modal state 2022-11-02 11:35:51 +00:00
reuk
2b1745272e
Android: Fix a couple of accessibility-related crashes
These crashes could be seen in the DemoRunner when selecting items in
nested PopupMenu windows.
2022-06-13 15:29:56 +01:00
attila
5d5610286f Component: Use the rounded integer mouse position when evaluating hitTest
This commit reverts a small part of
4ca923a34b.
2022-06-10 20:38:37 +02: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
attila
2c2c21ebc9 Linux: Fix sporadic positioning error after window creation 2022-05-19 12:06:28 +02:00
Tom Poole
2ec861d99e Update licensing banners to JUCE 7 2022-05-16 17:55:48 +01:00
Tom Poole
dea3fe60e4 Update copyright banners 2022-04-04 12:36:32 +01:00
attila
55b00fc846 Component: Fix mouseEnter and mouseExit positions when blocked by modal 2022-03-23 18:40:47 +00:00
Tom Poole
87a4ab4a78 Disable the effect of setPaintingIsUnclipped on components with children 2022-03-17 22:06:04 +00:00
Tom Poole
9ccfea9001 Component: Make getApproximateScaleFactorForComponent take a const argument 2022-03-04 10:25:51 +00:00
reuk
eb6e579f0a
ComponentPeer: Correctly scale drag and drop coordinates to account for global scale 2022-02-23 10:56:12 +00:00
reuk
e1a7fe671a
Component: Make wheel/magnify behaviour more intuitive for disabled components
The previous implementation would pass the mouse wheel event up to the
component's parent, as long as the parent was enabled. This meant that a
wheel event on the innermost component of a hierarchy such as
"[[disabled] enabled]" would send the event to the parent, but a wheel
event on the innermost component of a hierarchy such as
"[[[disabled] disabled] enabled]" would 'eat' the event and prevent it
from propagating.

After this change, unhandled mouse wheel events will always be passed to
the nearest enabled parent. This behaviour is more consistent and
intuitive.
2022-02-23 10:56:10 +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
reuk
ca4bdb6b3a
Component: Avoid calling member functions on objects destroyed when exiting modal state 2021-11-24 16:20:37 +00:00
reuk
eca02270ee
Component: Add Point<float> overloads for some common functions 2021-10-27 16:33:37 +01:00
reuk
4ca923a34b
NSViewComponentPeer: Allow mouse events to reach unfocused windows
This change allows mouse events (including enter and exit events) to
reach unfocused views on macOS. This matches the behaviour of unfocused
windows on Linux and Windows, where components paint in their "hovered"
states even when the application window is in the background.

As a byproduct of using tracking areas on macOS, we can remove the fake
mouse move generator.
2021-10-27 16:33:37 +01:00
reuk
f85ede6b47
Component: Ensure that mouseEnter and mouseExit calls are balanced when entering/leaving modal state 2021-10-26 16:52:15 +01:00
ed
3fac215534 Component: Give away keyboard focus when disabled 2021-10-08 17:19:04 +01:00
ed
a852f4f45f Component: Only pass mouse wheel and magnify events up to enabled parents 2021-10-08 17:19:04 +01:00
ed
46a4dc95a1 Accessibility: Fix potential infinite recursive component keyboard focus loop 2021-09-29 11:46:10 +01:00
ed
8d6ba3b54e Accessibility: Use AccessibilityRole::ignored for UI elements that should not be accessible to screen readers but have accessible children 2021-09-07 11:23:17 +01:00
ed
59333870f5 Accessibility: Disable accessibility of child components when calling Component::setAccessible (false); 2021-09-02 08:35:14 +01:00
ed
a2f7aaab2f Accessibility: Don't create AccessibilityHandler for Components without a native window handle 2021-07-28 11:44:28 +01:00
ed
a5c3b81f82 Use C++14 lambda capture initialisers for initialising deletion checkers 2021-07-12 11:58:29 +01:00
ed
e119178b5b Check BailOutChecker before sending accessibility moved/resized event in Component::sendMovedResizedMessages() 2021-07-01 16:23:48 +01:00
ed
d1b669e6ae Accessibility: Added InternalAccessibilityEvent::elementMovedOrResized 2021-06-16 17:22:35 +01:00
reuk
5db072b483 Component: Avoid calling native APIs from background threads
When rendering with OpenGL, the paint function is called from a
background thread. If we call `isMouseOver` from the paint function, we
may end up calling native functions via the ComponentPeer, which causes
threading warnings on macOS.
2021-06-16 11:35:25 +01:00
ed
550127945d Added floating-point implementations for some Component hit-testing methods to improve reliability when dealing with scaled Components 2021-06-08 14:14:22 +01:00