LMMS
Loading...
Searching...
No Matches
juce_MouseInputSource.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
30{
31public:
35
36 //==============================================================================
38 {
39 return buttonState.isAnyMouseButtonDown();
40 }
41
46
48 {
49 return ModifierKeys::currentModifiers.withoutMouseButtons().withFlags (buttonState.getRawFlags());
50 }
51
53 {
55 lastPeer = nullptr;
56
57 return lastPeer;
58 }
59
61 {
62 if (auto* peer = getPeer())
63 {
64 auto relativePos = ScalingHelpers::unscaledScreenPosToScaled (peer->getComponent(),
65 peer->globalToLocal (screenPos));
66 auto& comp = peer->getComponent();
67
68 // (the contains() call is needed to test for overlapping desktop windows)
69 if (comp.contains (relativePos))
70 return comp.getComponentAt (relativePos);
71 }
72
73 return nullptr;
74 }
75
77 {
78 // This needs to return the live position if possible, but it mustn't update the lastScreenPos
79 // value, because that can cause continuity problems.
81 }
82
88
93
94 //==============================================================================
95 #if JUCE_DUMP_MOUSE_EVENTS
96 #define JUCE_MOUSE_EVENT_DBG(desc, screenPos) DBG ("Mouse " << desc << " #" << index \
97 << ": " << ScalingHelpers::screenPosToLocalPos (comp, screenPos).toString() \
98 << " - Comp: " << String::toHexString ((pointer_sized_int) &comp));
99 #else
100 #define JUCE_MOUSE_EVENT_DBG(desc, screenPos)
101 #endif
102
103 void sendMouseEnter (Component& comp, const PointerState& pointerState, Time time)
104 {
105 JUCE_MOUSE_EVENT_DBG ("enter", pointerState.position)
106 comp.internalMouseEnter (MouseInputSource (this), ScalingHelpers::screenPosToLocalPos (comp, pointerState.position), time);
107 }
108
109 void sendMouseExit (Component& comp, const PointerState& pointerState, Time time)
110 {
111 JUCE_MOUSE_EVENT_DBG ("exit", pointerState.position)
112 comp.internalMouseExit (MouseInputSource (this), ScalingHelpers::screenPosToLocalPos (comp, pointerState.position), time);
113 }
114
115 void sendMouseMove (Component& comp, const PointerState& pointerState, Time time)
116 {
117 JUCE_MOUSE_EVENT_DBG ("move", pointerState.position)
118 comp.internalMouseMove (MouseInputSource (this), ScalingHelpers::screenPosToLocalPos (comp, pointerState.position), time);
119 }
120
121 void sendMouseDown (Component& comp, const PointerState& pointerState, Time time)
122 {
123 JUCE_MOUSE_EVENT_DBG ("down", pointerState.position)
124 comp.internalMouseDown (MouseInputSource (this),
125 pointerState.withPosition (ScalingHelpers::screenPosToLocalPos (comp, pointerState.position)),
126 time);
127 }
128
129 void sendMouseDrag (Component& comp, const PointerState& pointerState, Time time)
130 {
131 JUCE_MOUSE_EVENT_DBG ("drag", pointerState.position)
132 comp.internalMouseDrag (MouseInputSource (this),
133 pointerState.withPosition (ScalingHelpers::screenPosToLocalPos (comp, pointerState.position)),
134 time);
135 }
136
137 void sendMouseUp (Component& comp, const PointerState& pointerState, Time time, ModifierKeys oldMods)
138 {
139 JUCE_MOUSE_EVENT_DBG ("up", pointerState.position)
140 comp.internalMouseUp (MouseInputSource (this),
141 pointerState.withPosition (ScalingHelpers::screenPosToLocalPos (comp, pointerState.position)),
142 time,
143 oldMods);
144 }
145
146 void sendMouseWheel (Component& comp, Point<float> screenPos, Time time, const MouseWheelDetails& wheel)
147 {
148 JUCE_MOUSE_EVENT_DBG ("wheel", screenPos)
149 comp.internalMouseWheel (MouseInputSource (this), ScalingHelpers::screenPosToLocalPos (comp, screenPos), time, wheel);
150 }
151
152 void sendMagnifyGesture (Component& comp, Point<float> screenPos, Time time, float amount)
153 {
154 JUCE_MOUSE_EVENT_DBG ("magnify", screenPos)
155 comp.internalMagnifyGesture (MouseInputSource (this), ScalingHelpers::screenPosToLocalPos (comp, screenPos), time, amount);
156 }
157
158 //==============================================================================
159 // (returns true if the button change caused a modal event loop)
160 bool setButtons (const PointerState& pointerState, Time time, ModifierKeys newButtonState)
161 {
162 if (buttonState == newButtonState)
163 return false;
164
165 // (avoid sending a spurious mouse-drag when we receive a mouse-up)
166 if (! (isDragging() && ! newButtonState.isAnyMouseButtonDown()))
167 setPointerState (pointerState, time, false);
168
169 // (ignore secondary clicks when there's already a button down)
170 if (buttonState.isAnyMouseButtonDown() == newButtonState.isAnyMouseButtonDown())
171 {
172 buttonState = newButtonState;
173 return false;
174 }
175
176 auto lastCounter = mouseEventCounter;
177
178 if (buttonState.isAnyMouseButtonDown())
179 {
180 if (auto* current = getComponentUnderMouse())
181 {
182 auto oldMods = getCurrentModifiers();
183 buttonState = newButtonState; // must change this before calling sendMouseUp, in case it runs a modal loop
184
185 sendMouseUp (*current, pointerState.withPositionOffset (unboundedMouseOffset), time, oldMods);
186
187 if (lastCounter != mouseEventCounter)
188 return true; // if a modal loop happened, then newButtonState is no longer valid.
189 }
190
191 enableUnboundedMouseMovement (false, false);
192 }
193
194 buttonState = newButtonState;
195
196 if (buttonState.isAnyMouseButtonDown())
197 {
198 Desktop::getInstance().incrementMouseClickCounter();
199
200 if (auto* current = getComponentUnderMouse())
201 {
202 registerMouseDown (pointerState.position, time, *current, buttonState,
204 sendMouseDown (*current, pointerState, time);
205 }
206 }
207
208 return lastCounter != mouseEventCounter;
209 }
210
211 void setComponentUnderMouse (Component* newComponent, const PointerState& pointerState, Time time)
212 {
213 auto* current = getComponentUnderMouse();
214
215 if (newComponent != current)
216 {
217 WeakReference<Component> safeNewComp (newComponent);
218 auto originalButtonState = buttonState;
219
220 if (current != nullptr)
221 {
222 WeakReference<Component> safeOldComp (current);
223 setButtons (pointerState, time, ModifierKeys());
224
225 if (auto oldComp = safeOldComp.get())
226 {
227 componentUnderMouse = safeNewComp;
228 sendMouseExit (*oldComp, pointerState, time);
229 }
230
231 buttonState = originalButtonState;
232 }
233
234 componentUnderMouse = safeNewComp.get();
235 current = safeNewComp.get();
236
237 if (current != nullptr)
238 sendMouseEnter (*current, pointerState, time);
239
240 revealCursor (false);
241 setButtons (pointerState, time, originalButtonState);
242 }
243 }
244
245 void setPeer (ComponentPeer& newPeer, const PointerState& pointerState, Time time)
246 {
247 if (&newPeer != lastPeer)
248 {
249 setComponentUnderMouse (nullptr, pointerState, time);
250 lastPeer = &newPeer;
251 setComponentUnderMouse (findComponentAt (pointerState.position), pointerState, time);
252 }
253 }
254
255 void setPointerState (const PointerState& newPointerState, Time time, bool forceUpdate)
256 {
257 const auto& newScreenPos = newPointerState.position;
258
259 if (! isDragging())
260 setComponentUnderMouse (findComponentAt (newScreenPos), newPointerState, time);
261
262 if ((newPointerState != lastPointerState) || forceUpdate)
263 {
265
266 if (newPointerState.position != MouseInputSource::offscreenMousePos)
267 lastPointerState = newPointerState;
268
269 if (auto* current = getComponentUnderMouse())
270 {
271 if (isDragging())
272 {
273 registerMouseDrag (newScreenPos);
274 sendMouseDrag (*current, newPointerState.withPositionOffset (unboundedMouseOffset), time);
275
277 handleUnboundedDrag (*current);
278 }
279 else
280 {
281 sendMouseMove (*current, newPointerState, time);
282 }
283 }
284
285 revealCursor (false);
286 }
287 }
288
289 //==============================================================================
290 void handleEvent (ComponentPeer& newPeer, Point<float> positionWithinPeer, Time time,
291 const ModifierKeys newMods, float newPressure, float newOrientation, PenDetails pen)
292 {
293 lastTime = time;
295 const auto pointerState = PointerState().withPosition (newPeer.localToGlobal (positionWithinPeer))
296 .withPressure (newPressure)
297 .withOrientation (newOrientation)
299 .withTiltX (pen.tiltX)
300 .withTiltY (pen.tiltY);
301
302 if (isDragging() && newMods.isAnyMouseButtonDown())
303 {
304 setPointerState (pointerState, time, false);
305 }
306 else
307 {
308 setPeer (newPeer, pointerState, time);
309
310 if (auto* peer = getPeer())
311 {
312 if (setButtons (pointerState, time, newMods))
313 return; // some modal events have been dispatched, so the current event is now out-of-date
314
315 peer = getPeer();
316
317 if (peer != nullptr)
318 setPointerState (pointerState, time, false);
319 }
320 }
321 }
322
324 Time time, Point<float>& screenPos)
325 {
326 lastTime = time;
328
329 screenPos = peer.localToGlobal (positionWithinPeer);
330 const auto pointerState = lastPointerState.withPosition (screenPos);
331 setPeer (peer, pointerState, time);
332 setPointerState (pointerState, time, false);
334
335 return getComponentUnderMouse();
336 }
337
338 void handleWheel (ComponentPeer& peer, Point<float> positionWithinPeer,
339 Time time, const MouseWheelDetails& wheel)
340 {
341 Desktop::getInstance().incrementMouseWheelCounter();
342 Point<float> screenPos;
343
344 // This will make sure that when the wheel spins in its inertial phase, any events
345 // continue to be sent to the last component that the mouse was over when it was being
346 // actively controlled by the user. This avoids confusion when scrolling through nested
347 // scrollable components.
348 if (lastNonInertialWheelTarget == nullptr || ! wheel.isInertial)
349 lastNonInertialWheelTarget = getTargetForGesture (peer, positionWithinPeer, time, screenPos);
350 else
351 screenPos = peer.localToGlobal (positionWithinPeer);
352
353 if (auto target = lastNonInertialWheelTarget.get())
354 sendMouseWheel (*target, screenPos, time, wheel);
355 }
356
357 void handleMagnifyGesture (ComponentPeer& peer, Point<float> positionWithinPeer,
358 Time time, const float scaleFactor)
359 {
360 Point<float> screenPos;
361
362 if (auto* current = getTargetForGesture (peer, positionWithinPeer, time, screenPos))
363 sendMagnifyGesture (*current, screenPos, time, scaleFactor);
364 }
365
366 //==============================================================================
369
371 {
372 int numClicks = 1;
373
374 if (! isLongPressOrDrag())
375 {
376 for (int i = 1; i < numElementsInArray (mouseDowns); ++i)
377 {
378 if (mouseDowns[0].canBePartOfMultipleClickWith (mouseDowns[i], MouseEvent::getDoubleClickTimeout() * jmin (i, 2)))
379 ++numClicks;
380 else
381 break;
382 }
383 }
384
385 return numClicks;
386 }
387
392
397
398 // Deprecated method
403
404 //==============================================================================
406 {
408 }
409
414
415 //==============================================================================
416 void enableUnboundedMouseMovement (bool enable, bool keepCursorVisibleUntilOffscreen)
417 {
418 enable = enable && isDragging();
419 isCursorVisibleUntilOffscreen = keepCursorVisibleUntilOffscreen;
420
421 if (enable != isUnboundedMouseModeOn)
422 {
423 if ((! enable) && ((! isCursorVisibleUntilOffscreen) || ! unboundedMouseOffset.isOrigin()))
424 {
425 // when released, return the mouse to within the component's bounds
426 if (auto* current = getComponentUnderMouse())
427 setScreenPosition (current->getScreenBounds().toFloat()
428 .getConstrainedPoint (ScalingHelpers::unscaledScreenPosToScaled (lastPointerState.position)));
429 }
430
431 isUnboundedMouseModeOn = enable;
433
434 revealCursor (true);
435 }
436 }
437
439 {
440 auto componentScreenBounds = ScalingHelpers::scaledScreenPosToUnscaled (current.getParentMonitorArea().reduced (2, 2).toFloat());
441
442 if (! componentScreenBounds.contains (lastPointerState.position))
443 {
444 auto componentCentre = current.getScreenBounds().toFloat().getCentre();
446 setScreenPosition (componentCentre);
447 }
449 && (! unboundedMouseOffset.isOrigin())
450 && componentScreenBounds.contains (lastPointerState.position + unboundedMouseOffset))
451 {
454 }
455 }
456
457 //==============================================================================
458 void showMouseCursor (MouseCursor cursor, bool forcedUpdate)
459 {
461 {
462 cursor = MouseCursor::NoCursor;
463 forcedUpdate = true;
464 }
465
466 if (forcedUpdate || cursor.getHandle() != currentCursorHandle)
467 {
469 cursor.showInWindow (getPeer());
470 }
471 }
472
474 {
476 }
477
478 void revealCursor (bool forcedUpdate)
479 {
481
482 if (auto* current = getComponentUnderMouse())
483 mc = current->getLookAndFeel().getMouseCursorFor (*current);
484
485 showMouseCursor (mc, forcedUpdate);
486 }
487
488 //==============================================================================
489 const int index;
491 Point<float> unboundedMouseOffset; // NB: these are unscaled coords
494
496
497private:
500
501 void* currentCursorHandle = nullptr;
503
505 {
506 RecentMouseDown() = default;
507
512 bool isTouch = false;
513
514 bool canBePartOfMultipleClickWith (const RecentMouseDown& other, int maxTimeBetweenMs) const noexcept
515 {
516 return time - other.time < RelativeTime::milliseconds (maxTimeBetweenMs)
517 && std::abs (position.x - other.position.x) < (float) getPositionToleranceForInputType()
518 && std::abs (position.y - other.position.y) < (float) getPositionToleranceForInputType()
519 && buttons == other.buttons
520 && peerID == other.peerID;
521 }
522
524 };
525
528 bool movedSignificantly = false;
529
530 void registerMouseDown (Point<float> screenPos, Time time, Component& component,
531 const ModifierKeys modifiers, bool isTouchSource) noexcept
532 {
533 for (int i = numElementsInArray (mouseDowns); --i > 0;)
534 mouseDowns[i] = mouseDowns[i - 1];
535
536 mouseDowns[0].position = screenPos;
537 mouseDowns[0].time = time;
538 mouseDowns[0].buttons = modifiers.withOnlyMouseButtons();
539 mouseDowns[0].isTouch = isTouchSource;
540
541 if (auto* peer = component.getPeer())
542 mouseDowns[0].peerID = peer->getUniqueID();
543 else
544 mouseDowns[0].peerID = 0;
545
546 movedSignificantly = false;
548 }
549
550 void registerMouseDrag (Point<float> screenPos) noexcept
551 {
552 movedSignificantly = movedSignificantly || mouseDowns[0].position.getDistanceFrom (screenPos) >= 4;
553 }
554
556};
557
558//==============================================================================
562
563MouseInputSource& MouseInputSource::operator= (const MouseInputSource& other) noexcept
564{
565 pimpl = other.pimpl;
566 return *this;
567}
568
576bool MouseInputSource::isDragging() const noexcept { return pimpl->isDragging(); }
580float MouseInputSource::getCurrentPressure() const noexcept { return pimpl->lastPointerState.pressure; }
581bool MouseInputSource::isPressureValid() const noexcept { return pimpl->lastPointerState.isPressureValid(); }
582float MouseInputSource::getCurrentOrientation() const noexcept { return pimpl->lastPointerState.orientation; }
583bool MouseInputSource::isOrientationValid() const noexcept { return pimpl->lastPointerState.isOrientationValid(); }
584float MouseInputSource::getCurrentRotation() const noexcept { return pimpl->lastPointerState.rotation; }
585bool MouseInputSource::isRotationValid() const noexcept { return pimpl->lastPointerState.isRotationValid(); }
586float MouseInputSource::getCurrentTilt (bool tiltX) const noexcept { return tiltX ? pimpl->lastPointerState.tiltX : pimpl->lastPointerState.tiltY; }
587bool MouseInputSource::isTiltValid (bool isX) const noexcept { return pimpl->lastPointerState.isTiltValid (isX); }
588Component* MouseInputSource::getComponentUnderMouse() const { return pimpl->getComponentUnderMouse(); }
589void MouseInputSource::triggerFakeMove() const { pimpl->triggerFakeMove(); }
590int MouseInputSource::getNumberOfMultipleClicks() const noexcept { return pimpl->getNumberOfMultipleClicks(); }
593bool MouseInputSource::isLongPressOrDrag() const noexcept { return pimpl->isLongPressOrDrag(); }
594bool MouseInputSource::hasMovedSignificantlySincePressed() const noexcept { return pimpl->hasMovedSignificantlySincePressed(); }
596void MouseInputSource::enableUnboundedMouseMovement (bool isEnabled, bool keepCursorVisibleUntilOffscreen) const
597 { pimpl->enableUnboundedMouseMovement (isEnabled, keepCursorVisibleUntilOffscreen); }
598bool MouseInputSource::isUnboundedMouseMovementEnabled() const { return pimpl->isUnboundedMouseModeOn; }
600void MouseInputSource::showMouseCursor (const MouseCursor& cursor) { pimpl->showMouseCursor (cursor, false); }
601void MouseInputSource::hideCursor() { pimpl->hideCursor(); }
602void MouseInputSource::revealCursor() { pimpl->revealCursor (false); }
603void MouseInputSource::forceMouseCursorUpdate() { pimpl->revealCursor (true); }
605
607 float pressure, float orientation, const PenDetails& penDetails)
608{
609 pimpl->handleEvent (peer, pos, Time (time), mods.withOnlyMouseButtons(), pressure, orientation, penDetails);
610}
611
613{
614 pimpl->handleWheel (peer, pos, Time (time), wheel);
615}
616
618{
619 pimpl->handleMagnifyGesture (peer, pos, Time (time), scaleFactor);
620}
621
622const float MouseInputSource::invalidPressure = 0.0f;
623const float MouseInputSource::invalidOrientation = 0.0f;
624const float MouseInputSource::invalidRotation = 0.0f;
625
626const float MouseInputSource::invalidTiltX = 0.0f;
627const float MouseInputSource::invalidTiltY = 0.0f;
628
630
631// Deprecated method
632bool MouseInputSource::hasMouseMovedSignificantlySincePressed() const noexcept { return pimpl->hasMouseMovedSignificantlySincePressed(); }
633
634//==============================================================================
636{
638 {
639 #if JUCE_ANDROID || JUCE_IOS
640 auto mainMouseInputType = MouseInputSource::InputSourceType::touch;
641 #else
642 auto mainMouseInputType = MouseInputSource::InputSourceType::mouse;
643 #endif
644
645 addSource (0, mainMouseInputType);
646 }
647
648 bool addSource();
649 bool canUseTouch();
650
652 {
653 auto* s = new MouseInputSourceInternal (index, type);
654 sources.add (s);
656
657 return &sourceArray.getReference (sourceArray.size() - 1);
658 }
659
660 MouseInputSource* getMouseSource (int index) noexcept
661 {
662 return isPositiveAndBelow (index, sourceArray.size()) ? &sourceArray.getReference (index)
663 : nullptr;
664 }
665
667 {
669 {
670 for (auto& m : sourceArray)
671 if (type == m.getType())
672 return &m;
673
674 addSource (0, type);
675 }
677 {
678 jassert (0 <= touchIndex && touchIndex < 100); // sanity-check on number of fingers
679
680 for (auto& m : sourceArray)
681 if (type == m.getType() && touchIndex == m.getIndex())
682 return &m;
683
684 if (canUseTouch())
685 return addSource (touchIndex, type);
686 }
687
688 return nullptr;
689 }
690
692 {
693 int num = 0;
694
695 for (auto* s : sources)
696 if (s->isDragging())
697 ++num;
698
699 return num;
700 }
701
703 {
704 int num = 0;
705
706 for (auto& s : sourceArray)
707 {
708 if (s.isDragging())
709 {
710 if (index == num)
711 return &s;
712
713 ++num;
714 }
715 }
716
717 return nullptr;
718 }
719
720 void beginDragAutoRepeat (int interval)
721 {
722 if (interval > 0)
723 {
724 if (getTimerInterval() != interval)
725 startTimer (interval);
726 }
727 else
728 {
729 stopTimer();
730 }
731 }
732
733 void timerCallback() override
734 {
735 bool anyDragging = false;
736
737 for (auto* s : sources)
738 {
739 // NB: when doing auto-repeat, we need to force an update of the current position and button state,
740 // because on some OSes the queue can get overloaded with messages so that mouse-events don't get through..
741 if (s->isDragging() && ComponentPeer::getCurrentModifiersRealtime().isAnyMouseButtonDown())
742 {
743 s->lastPointerState.position = s->getRawScreenPosition();
744 s->triggerFakeMove();
745 anyDragging = true;
746 }
747 }
748
749 if (! anyDragging)
750 stopTimer();
751 }
752
755};
756
757} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
Definition juce_Array.h:56
void triggerAsyncUpdate()
Definition juce_AsyncUpdater.cpp:62
void cancelPendingUpdate() noexcept
Definition juce_AsyncUpdater.cpp:74
AsyncUpdater()
Definition juce_AsyncUpdater.cpp:44
Definition juce_Component.h:36
Rectangle< int > getScreenBounds() const
Definition juce_Component.cpp:1134
Rectangle< int > getParentMonitorArea() const
Definition juce_Component.cpp:1126
Definition juce_ComponentPeer.h:44
static ModifierKeys getCurrentModifiersRealtime() noexcept
Definition juce_ComponentPeer.cpp:596
virtual Point< float > localToGlobal(Point< float > relativePosition)=0
static bool isValidPeer(const ComponentPeer *peer) noexcept
Definition juce_ComponentPeer.cpp:70
static Desktop &JUCE_CALLTYPE getInstance()
Definition juce_Desktop.cpp:50
Definition juce_ModifierKeys.h:41
static ModifierKeys currentModifiers
Definition juce_ModifierKeys.h:189
bool isAnyMouseButtonDown() const noexcept
Definition juce_ModifierKeys.h:93
JUCE_NODISCARD ModifierKeys withOnlyMouseButtons() const noexcept
Definition juce_ModifierKeys.h:166
Definition juce_MouseCursor.h:39
void showInWindow(ComponentPeer *) const
Definition juce_MouseCursor.cpp:148
@ NoCursor
Definition juce_MouseCursor.h:47
@ NormalCursor
Definition juce_MouseCursor.h:48
PlatformSpecificHandle * getHandle() const noexcept
Definition juce_MouseCursor.cpp:143
static int getDoubleClickTimeout() noexcept
Definition juce_MouseEvent.cpp:135
Definition juce_MouseInputSource.h:52
bool isPressureValid() const noexcept
Definition juce_MouseInputSource.cpp:581
void triggerFakeMove() const
Definition juce_MouseInputSource.cpp:589
MouseInputSource::InputSourceType getType() const noexcept
Definition juce_MouseInputSource.cpp:569
Point< float > getScreenPosition() const noexcept
Definition juce_MouseInputSource.cpp:577
static const float invalidRotation
Definition juce_MouseInputSource.h:261
bool isTiltValid(bool tiltX) const noexcept
Definition juce_MouseInputSource.cpp:587
void enableUnboundedMouseMovement(bool isEnabled, bool keepCursorVisibleUntilOffscreen=false) const
Definition juce_MouseInputSource.cpp:596
bool hasMouseWheel() const noexcept
Definition juce_MouseInputSource.cpp:574
Point< float > getRawScreenPosition() const noexcept
Definition juce_MouseInputSource.cpp:578
static void setRawMousePosition(Point< float >)
Definition juce_linux_Windowing.cpp:700
bool isRotationValid() const noexcept
Definition juce_MouseInputSource.cpp:585
void revealCursor()
Definition juce_MouseInputSource.cpp:602
float getCurrentTilt(bool tiltX) const noexcept
Definition juce_MouseInputSource.cpp:586
int getIndex() const noexcept
Definition juce_MouseInputSource.cpp:575
bool hasMouseMovedSignificantlySincePressed() const noexcept
Definition juce_MouseInputSource.cpp:632
void setScreenPosition(Point< float > newPosition)
Definition juce_MouseInputSource.cpp:604
static constexpr float defaultRotation
Definition juce_MouseInputSource.h:233
void handleMagnifyGesture(ComponentPeer &, Point< float >, int64 time, float scaleFactor)
Definition juce_MouseInputSource.cpp:617
static const float invalidTiltX
Definition juce_MouseInputSource.h:269
bool isTouch() const noexcept
Definition juce_MouseInputSource.cpp:571
static const float invalidTiltY
Definition juce_MouseInputSource.h:271
bool hasMouseCursor() const noexcept
Definition juce_MouseInputSource.cpp:599
void handleEvent(ComponentPeer &, Point< float >, int64 time, ModifierKeys, float, float, const PenDetails &)
Definition juce_MouseInputSource.cpp:606
int getNumberOfMultipleClicks() const noexcept
Definition juce_MouseInputSource.cpp:590
bool isPen() const noexcept
Definition juce_MouseInputSource.cpp:572
ModifierKeys getCurrentModifiers() const noexcept
Definition juce_MouseInputSource.cpp:579
void forceMouseCursorUpdate()
Definition juce_MouseInputSource.cpp:603
Time getLastMouseDownTime() const noexcept
Definition juce_MouseInputSource.cpp:591
void hideCursor()
Definition juce_MouseInputSource.cpp:601
InputSourceType
Definition juce_MouseInputSource.h:56
@ pen
Definition juce_MouseInputSource.h:59
@ mouse
Definition juce_MouseInputSource.h:57
@ touch
Definition juce_MouseInputSource.h:58
bool isDragging() const noexcept
Definition juce_MouseInputSource.cpp:576
bool isMouse() const noexcept
Definition juce_MouseInputSource.cpp:570
Component * getComponentUnderMouse() const
Definition juce_MouseInputSource.cpp:588
float getCurrentRotation() const noexcept
Definition juce_MouseInputSource.cpp:584
bool canDoUnboundedMovement() const noexcept
Definition juce_MouseInputSource.cpp:595
void handleWheel(ComponentPeer &, Point< float >, int64 time, const MouseWheelDetails &)
Definition juce_MouseInputSource.cpp:612
~MouseInputSource() noexcept
Definition juce_MouseInputSource.cpp:561
void showMouseCursor(const MouseCursor &cursor)
Definition juce_MouseInputSource.cpp:600
static const float invalidPressure
Definition juce_MouseInputSource.h:245
MouseInputSourceInternal * pimpl
Definition juce_MouseInputSource.h:292
bool hasMovedSignificantlySincePressed() const noexcept
Definition juce_MouseInputSource.cpp:594
static Point< float > getCurrentRawMousePosition()
Definition juce_linux_Windowing.cpp:695
friend class MouseInputSourceInternal
Definition juce_MouseInputSource.h:291
bool isLongPressOrDrag() const noexcept
Definition juce_MouseInputSource.cpp:593
Point< float > getLastMouseDownPosition() const noexcept
Definition juce_MouseInputSource.cpp:592
static const float invalidOrientation
Definition juce_MouseInputSource.h:253
MouseInputSource(const MouseInputSource &) noexcept
Definition juce_MouseInputSource.cpp:560
friend class ComponentPeer
Definition juce_MouseInputSource.h:289
float getCurrentOrientation() const noexcept
Definition juce_MouseInputSource.cpp:582
bool canHover() const noexcept
Definition juce_MouseInputSource.cpp:573
bool isUnboundedMouseMovementEnabled() const
Definition juce_MouseInputSource.cpp:598
float getCurrentPressure() const noexcept
Definition juce_MouseInputSource.cpp:580
static const Point< float > offscreenMousePos
Definition juce_MouseInputSource.h:276
bool isOrientationValid() const noexcept
Definition juce_MouseInputSource.cpp:583
Definition juce_MouseInputSource.cpp:30
void * currentCursorHandle
Definition juce_MouseInputSource.cpp:501
void enableUnboundedMouseMovement(bool enable, bool keepCursorVisibleUntilOffscreen)
Definition juce_MouseInputSource.cpp:416
void sendMouseUp(Component &comp, const PointerState &pointerState, Time time, ModifierKeys oldMods)
Definition juce_MouseInputSource.cpp:137
void handleEvent(ComponentPeer &newPeer, Point< float > positionWithinPeer, Time time, const ModifierKeys newMods, float newPressure, float newOrientation, PenDetails pen)
Definition juce_MouseInputSource.cpp:290
Point< float > getLastMouseDownPosition() const noexcept
Definition juce_MouseInputSource.cpp:368
ModifierKeys buttonState
Definition juce_MouseInputSource.cpp:493
void handleMagnifyGesture(ComponentPeer &peer, Point< float > positionWithinPeer, Time time, const float scaleFactor)
Definition juce_MouseInputSource.cpp:357
Point< float > unboundedMouseOffset
Definition juce_MouseInputSource.cpp:491
void triggerFakeMove()
Definition juce_MouseInputSource.cpp:405
void sendMouseDown(Component &comp, const PointerState &pointerState, Time time)
Definition juce_MouseInputSource.cpp:121
void handleAsyncUpdate() override
Definition juce_MouseInputSource.cpp:410
const MouseInputSource::InputSourceType inputType
Definition juce_MouseInputSource.cpp:490
Time lastTime
Definition juce_MouseInputSource.cpp:527
const int index
Definition juce_MouseInputSource.cpp:489
Point< float > getScreenPosition() const noexcept
Definition juce_MouseInputSource.cpp:76
bool isCursorVisibleUntilOffscreen
Definition juce_MouseInputSource.cpp:495
int getNumberOfMultipleClicks() const noexcept
Definition juce_MouseInputSource.cpp:370
bool isLongPressOrDrag() const noexcept
Definition juce_MouseInputSource.cpp:388
void sendMouseWheel(Component &comp, Point< float > screenPos, Time time, const MouseWheelDetails &wheel)
Definition juce_MouseInputSource.cpp:146
bool hasMouseMovedSignificantlySincePressed() const noexcept
Definition juce_MouseInputSource.cpp:399
void setPeer(ComponentPeer &newPeer, const PointerState &pointerState, Time time)
Definition juce_MouseInputSource.cpp:245
bool isUnboundedMouseModeOn
Definition juce_MouseInputSource.cpp:495
void registerMouseDrag(Point< float > screenPos) noexcept
Definition juce_MouseInputSource.cpp:550
MouseInputSourceInternal(int i, MouseInputSource::InputSourceType type)
Definition juce_MouseInputSource.cpp:32
ComponentPeer * lastPeer
Definition juce_MouseInputSource.cpp:499
Component * getComponentUnderMouse() const noexcept
Definition juce_MouseInputSource.cpp:42
void setScreenPosition(Point< float > p)
Definition juce_MouseInputSource.cpp:89
int mouseEventCounter
Definition juce_MouseInputSource.cpp:502
void hideCursor()
Definition juce_MouseInputSource.cpp:473
void sendMouseMove(Component &comp, const PointerState &pointerState, Time time)
Definition juce_MouseInputSource.cpp:115
void sendMouseEnter(Component &comp, const PointerState &pointerState, Time time)
Definition juce_MouseInputSource.cpp:103
WeakReference< Component > componentUnderMouse
Definition juce_MouseInputSource.cpp:498
Point< float > getRawScreenPosition() const noexcept
Definition juce_MouseInputSource.cpp:83
PointerState lastPointerState
Definition juce_MouseInputSource.cpp:492
ModifierKeys getCurrentModifiers() const noexcept
Definition juce_MouseInputSource.cpp:47
Time getLastMouseDownTime() const noexcept
Definition juce_MouseInputSource.cpp:367
void sendMouseDrag(Component &comp, const PointerState &pointerState, Time time)
Definition juce_MouseInputSource.cpp:129
void handleUnboundedDrag(Component &current)
Definition juce_MouseInputSource.cpp:438
bool setButtons(const PointerState &pointerState, Time time, ModifierKeys newButtonState)
Definition juce_MouseInputSource.cpp:160
bool movedSignificantly
Definition juce_MouseInputSource.cpp:528
void sendMouseExit(Component &comp, const PointerState &pointerState, Time time)
Definition juce_MouseInputSource.cpp:109
void showMouseCursor(MouseCursor cursor, bool forcedUpdate)
Definition juce_MouseInputSource.cpp:458
void registerMouseDown(Point< float > screenPos, Time time, Component &component, const ModifierKeys modifiers, bool isTouchSource) noexcept
Definition juce_MouseInputSource.cpp:530
ComponentPeer * getPeer() noexcept
Definition juce_MouseInputSource.cpp:52
Component * getTargetForGesture(ComponentPeer &peer, Point< float > positionWithinPeer, Time time, Point< float > &screenPos)
Definition juce_MouseInputSource.cpp:323
Component * findComponentAt(Point< float > screenPos)
Definition juce_MouseInputSource.cpp:60
RecentMouseDown mouseDowns[4]
Definition juce_MouseInputSource.cpp:526
void sendMagnifyGesture(Component &comp, Point< float > screenPos, Time time, float amount)
Definition juce_MouseInputSource.cpp:152
void revealCursor(bool forcedUpdate)
Definition juce_MouseInputSource.cpp:478
void handleWheel(ComponentPeer &peer, Point< float > positionWithinPeer, Time time, const MouseWheelDetails &wheel)
Definition juce_MouseInputSource.cpp:338
WeakReference< Component > lastNonInertialWheelTarget
Definition juce_MouseInputSource.cpp:498
bool isDragging() const noexcept
Definition juce_MouseInputSource.cpp:37
void setPointerState(const PointerState &newPointerState, Time time, bool forceUpdate)
Definition juce_MouseInputSource.cpp:255
bool hasMovedSignificantlySincePressed() const noexcept
Definition juce_MouseInputSource.cpp:393
void setComponentUnderMouse(Component *newComponent, const PointerState &pointerState, Time time)
Definition juce_MouseInputSource.cpp:211
Definition juce_OwnedArray.h:51
Definition juce_Point.h:42
Definition juce_PointerState.h:32
JUCE_NODISCARD PointerState withOrientation(float x) const noexcept
Definition juce_PointerState.h:47
JUCE_NODISCARD PointerState withTiltY(float x) const noexcept
Definition juce_PointerState.h:50
JUCE_NODISCARD PointerState withTiltX(float x) const noexcept
Definition juce_PointerState.h:49
JUCE_NODISCARD PointerState withPositionOffset(Point< float > x) const noexcept
Definition juce_PointerState.h:44
Point< float > position
Definition juce_PointerState.h:52
JUCE_NODISCARD PointerState withRotation(float x) const noexcept
Definition juce_PointerState.h:48
JUCE_NODISCARD PointerState withPressure(float x) const noexcept
Definition juce_PointerState.h:46
JUCE_NODISCARD PointerState withPosition(Point< float > x) const noexcept
Definition juce_PointerState.h:45
Point< ValueType > getCentre() const noexcept
Definition juce_Rectangle.h:151
Rectangle< float > toFloat() const noexcept
Definition juce_Rectangle.h:873
Rectangle reduced(ValueType deltaX, ValueType deltaY) const noexcept
Definition juce_Rectangle.h:485
static RelativeTime milliseconds(int milliseconds) noexcept
Definition juce_RelativeTime.cpp:31
Definition juce_Time.h:37
static Time JUCE_CALLTYPE getCurrentTime() noexcept
Definition juce_Time.cpp:233
void stopTimer() noexcept
Definition juce_Timer.cpp:357
int getTimerInterval() const noexcept
Definition juce_Timer.h:116
Timer() noexcept
Definition juce_Timer.cpp:316
void startTimer(int intervalInMilliseconds) noexcept
Definition juce_Timer.cpp:332
Definition juce_WeakReference.h:78
ObjectType * get() const noexcept
Definition juce_WeakReference.h:102
unsigned * m
Definition inflate.c:1559
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
#define JUCE_MOUSE_EVENT_DBG(desc, screenPos)
Definition juce_MouseInputSource.cpp:100
#define jassert(expression)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
static int JUCE_CDECL comp(const void *a, const void *b)
Definition lsp.c:298
Definition carla_juce.cpp:31
constexpr Type jmin(Type a, Type b)
Definition juce_MathsFunctions.h:106
unsigned int uint32
Definition juce_MathsFunctions.h:45
constexpr Type jmax(Type a, Type b)
Definition juce_MathsFunctions.h:94
long long int64
Definition juce_MathsFunctions.h:54
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Definition juce_MathsFunctions.h:279
constexpr int numElementsInArray(Type(&)[N]) noexcept
Definition juce_MathsFunctions.h:344
Definition juce_MouseInputSource.cpp:636
MouseInputSource * addSource(int index, MouseInputSource::InputSourceType type)
Definition juce_MouseInputSource.cpp:651
MouseInputSource * getMouseSource(int index) noexcept
Definition juce_MouseInputSource.cpp:660
void timerCallback() override
Definition juce_MouseInputSource.cpp:733
OwnedArray< MouseInputSourceInternal > sources
Definition juce_MouseInputSource.cpp:753
MouseInputSource * getDraggingMouseSource(int index) noexcept
Definition juce_MouseInputSource.cpp:702
MouseInputSource * getOrCreateMouseInputSource(MouseInputSource::InputSourceType type, int touchIndex=0)
Definition juce_MouseInputSource.cpp:666
bool canUseTouch()
Definition juce_linux_Windowing.cpp:690
bool addSource()
Definition juce_linux_Windowing.cpp:679
int getNumDraggingMouseSources() const noexcept
Definition juce_MouseInputSource.cpp:691
Array< MouseInputSource > sourceArray
Definition juce_MouseInputSource.cpp:754
SourceList()
Definition juce_MouseInputSource.cpp:637
void beginDragAutoRepeat(int interval)
Definition juce_MouseInputSource.cpp:720
Definition juce_MouseInputSource.cpp:505
bool isTouch
Definition juce_MouseInputSource.cpp:512
Point< float > position
Definition juce_MouseInputSource.cpp:508
Time time
Definition juce_MouseInputSource.cpp:509
int getPositionToleranceForInputType() const noexcept
Definition juce_MouseInputSource.cpp:523
bool canBePartOfMultipleClickWith(const RecentMouseDown &other, int maxTimeBetweenMs) const noexcept
Definition juce_MouseInputSource.cpp:514
ModifierKeys buttons
Definition juce_MouseInputSource.cpp:510
uint32 peerID
Definition juce_MouseInputSource.cpp:511
Definition juce_MouseEvent.h:392
bool isInertial
Definition juce_MouseEvent.h:422
Definition juce_MouseEvent.h:434
float tiltX
Definition juce_MouseEvent.h:445
float tiltY
Definition juce_MouseEvent.h:451
static PointOrRect scaledScreenPosToUnscaled(float scale, PointOrRect pos) noexcept
Definition juce_Component.cpp:207
static Point< float > screenPosToLocalPos(Component &comp, Point< float > pos)
Definition juce_Component.cpp:279
static PointOrRect unscaledScreenPosToScaled(float scale, PointOrRect pos) noexcept
Definition juce_Component.cpp:201
uch * p
Definition crypt.c:594
#define const
Definition zconf.h:137