mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
ModifierKeys: Avoid direct access to currentModifiers when reading but not writing
This commit is contained in:
parent
0a71227126
commit
5d7208bb54
11 changed files with 64 additions and 64 deletions
|
|
@ -2952,7 +2952,7 @@ bool Component::isMouseOverOrDragging (bool includeChildren) const
|
|||
|
||||
bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() noexcept
|
||||
{
|
||||
return ModifierKeys::currentModifiers.isAnyMouseButtonDown();
|
||||
return ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown();
|
||||
}
|
||||
|
||||
Point<int> Component::getMouseXYRelative() const
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
ModifierKeys getCurrentModifiers() const noexcept
|
||||
{
|
||||
return ModifierKeys::currentModifiers
|
||||
return ModifierKeys::getCurrentModifiers()
|
||||
.withoutMouseButtons()
|
||||
.withFlags (buttonState.getRawFlags());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ bool KeyPress::operator!= (int otherKeyCode) const noexcept { return ! o
|
|||
bool KeyPress::isCurrentlyDown() const
|
||||
{
|
||||
return isKeyCurrentlyDown (keyCode)
|
||||
&& (ModifierKeys::currentModifiers.getRawFlags() & ModifierKeys::allKeyboardModifiers)
|
||||
&& (ModifierKeys::getCurrentModifiers().getRawFlags() & ModifierKeys::allKeyboardModifiers)
|
||||
== (mods.getRawFlags() & ModifierKeys::allKeyboardModifiers);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1381,7 +1381,7 @@ private:
|
|||
}
|
||||
|
||||
bool mouseWasOver = false;
|
||||
bool mouseUpCanTrigger = ! ModifierKeys::currentModifiers.isAnyMouseButtonDown();
|
||||
bool mouseUpCanTrigger = ! ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown();
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MenuWindow)
|
||||
};
|
||||
|
|
@ -1469,7 +1469,7 @@ private:
|
|||
const bool wasDown, const bool overScrollArea, const bool isOverAny)
|
||||
{
|
||||
isDown = window.mouseHasBeenOver()
|
||||
&& (ModifierKeys::currentModifiers.isAnyMouseButtonDown()
|
||||
&& (ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown()
|
||||
|| ComponentPeer::getCurrentModifiersRealtime().isAnyMouseButtonDown());
|
||||
|
||||
const auto reallyContained = window.reallyContains (localMousePos, true);
|
||||
|
|
|
|||
|
|
@ -731,13 +731,13 @@ public:
|
|||
if (! Process::isForegroundProcess())
|
||||
Process::makeForegroundProcess();
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withFlags (getModifierForButtonNumber ([ev buttonNumber]));
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withFlags (getModifierForButtonNumber ([ev buttonNumber]));
|
||||
sendMouseEvent (ev);
|
||||
}
|
||||
|
||||
void redirectMouseUp (NSEvent* ev)
|
||||
{
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutFlags (getModifierForButtonNumber ([ev buttonNumber]));
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutFlags (getModifierForButtonNumber ([ev buttonNumber]));
|
||||
sendMouseEvent (ev);
|
||||
showArrowCursorIfNeeded();
|
||||
}
|
||||
|
|
@ -750,13 +750,13 @@ public:
|
|||
if (draggingActive)
|
||||
return;
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withFlags (getModifierForButtonNumber ([ev buttonNumber]));
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withFlags (getModifierForButtonNumber ([ev buttonNumber]));
|
||||
sendMouseEvent (ev);
|
||||
}
|
||||
|
||||
void redirectMouseMove (NSEvent* ev)
|
||||
{
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons();
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons();
|
||||
|
||||
NSPoint windowPos = [ev locationInWindow];
|
||||
NSPoint screenPos = [[ev window] convertRectToScreen: NSMakeRect (windowPos.x, windowPos.y, 1.0f, 1.0f)].origin;
|
||||
|
|
@ -768,7 +768,7 @@ public:
|
|||
}
|
||||
else
|
||||
// moved into another window which overlaps this one, so trigger an exit
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::mouse, MouseInputSource::offscreenMousePos, ModifierKeys::currentModifiers,
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::mouse, MouseInputSource::offscreenMousePos, ModifierKeys::getCurrentModifiers(),
|
||||
getMousePressure (ev), MouseInputSource::defaultOrientation, getMouseTime (ev));
|
||||
|
||||
showArrowCursorIfNeeded();
|
||||
|
|
@ -1347,7 +1347,7 @@ public:
|
|||
if ((flags & NSEventModifierFlagOption) != 0) m |= ModifierKeys::altModifier;
|
||||
if ((flags & NSEventModifierFlagCommand) != 0) m |= ModifierKeys::commandModifier;
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withOnlyMouseButtons().withFlags (m);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withOnlyMouseButtons().withFlags (m);
|
||||
}
|
||||
|
||||
static void updateKeysDown (NSEvent* ev, bool isKeyDown)
|
||||
|
|
|
|||
|
|
@ -951,7 +951,7 @@ static void updateModifiers (const UIKeyModifierFlags flags)
|
|||
| convert (UIKeyModifierCommand, ModifierKeys::commandModifier)
|
||||
| convert (UIKeyModifierNumericPad, 0); // numpad modifier currently not implemented
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withOnlyMouseButtons().withFlags (juceFlags);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withOnlyMouseButtons().withFlags (juceFlags);
|
||||
}
|
||||
|
||||
API_AVAILABLE (ios(13.4))
|
||||
|
|
@ -2071,7 +2071,7 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, MouseEventFlags mouseEv
|
|||
auto time = getMouseTime (event);
|
||||
auto touchIndex = currentTouches.getIndexOfTouch (this, touch);
|
||||
|
||||
auto modsToSend = ModifierKeys::currentModifiers;
|
||||
auto modsToSend = ModifierKeys::getCurrentModifiers();
|
||||
|
||||
auto isUp = [] (MouseEventFlags m)
|
||||
{
|
||||
|
|
@ -2083,8 +2083,8 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, MouseEventFlags mouseEv
|
|||
if ([touch phase] != UITouchPhaseBegan)
|
||||
continue;
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
modsToSend = ModifierKeys::currentModifiers;
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
modsToSend = ModifierKeys::getCurrentModifiers();
|
||||
|
||||
// this forces a mouse-enter/up event, in case for some reason we didn't get a mouse-up before.
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, pos, modsToSend.withoutMouseButtons(),
|
||||
|
|
@ -2108,7 +2108,7 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, MouseEventFlags mouseEv
|
|||
if (mouseEventFlags == MouseEventFlags::upAndCancel)
|
||||
{
|
||||
currentTouches.clearTouch (touchIndex);
|
||||
modsToSend = ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons();
|
||||
modsToSend = ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons();
|
||||
}
|
||||
|
||||
// NB: some devices return 0 or 1.0 if pressure is unknown, so we'll clip our value to a believable range:
|
||||
|
|
@ -2139,7 +2139,7 @@ void UIViewComponentPeer::onHover (UIHoverGestureRecognizer* gesture)
|
|||
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch,
|
||||
pos,
|
||||
ModifierKeys::currentModifiers,
|
||||
ModifierKeys::getCurrentModifiers(),
|
||||
MouseInputSource::defaultPressure, MouseInputSource::defaultOrientation,
|
||||
UIViewComponentPeer::getMouseTime ([[NSProcessInfo processInfo] systemUptime]),
|
||||
{});
|
||||
|
|
|
|||
|
|
@ -1968,7 +1968,7 @@ public:
|
|||
keyMods = (keyMods & ~ModifierKeys::ctrlModifier) | ModifierKeys::altModifier;
|
||||
}
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withOnlyMouseButtons().withFlags (keyMods);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withOnlyMouseButtons().withFlags (keyMods);
|
||||
}
|
||||
|
||||
static void updateModifiersFromWParam (const WPARAM wParam)
|
||||
|
|
@ -1978,7 +1978,7 @@ public:
|
|||
if (wParam & MK_RBUTTON) mouseMods |= ModifierKeys::rightButtonModifier;
|
||||
if (wParam & MK_MBUTTON) mouseMods |= ModifierKeys::middleButtonModifier;
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons().withFlags (mouseMods);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons().withFlags (mouseMods);
|
||||
updateKeyModifiers();
|
||||
}
|
||||
|
||||
|
|
@ -2712,7 +2712,7 @@ private:
|
|||
return result;
|
||||
}
|
||||
|
||||
ModifierKeys modsToSend (ModifierKeys::currentModifiers);
|
||||
auto modsToSend = ModifierKeys::getCurrentModifiers();
|
||||
|
||||
// this will be handled by WM_TOUCH
|
||||
if (isTouchEvent() || areOtherTouchSourcesActive())
|
||||
|
|
@ -2784,7 +2784,7 @@ private:
|
|||
|
||||
void releaseCaptureIfNecessary() const
|
||||
{
|
||||
if (! ModifierKeys::currentModifiers.isAnyMouseButtonDown() && hwnd == GetCapture())
|
||||
if (! ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown() && hwnd == GetCapture())
|
||||
ReleaseCapture();
|
||||
}
|
||||
|
||||
|
|
@ -2974,12 +2974,12 @@ private:
|
|||
const auto pos = globalToLocal (convertPhysicalScreenPointToLogical (D2DUtilities::toPoint ({ roundToInt (touch.x / 100.0f),
|
||||
roundToInt (touch.y / 100.0f) }), hwnd).toFloat());
|
||||
const auto pressure = touchPressure;
|
||||
auto modsToSend = ModifierKeys::currentModifiers;
|
||||
auto modsToSend = ModifierKeys::getCurrentModifiers();
|
||||
|
||||
if (isDown)
|
||||
{
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
modsToSend = ModifierKeys::currentModifiers;
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
modsToSend = ModifierKeys::getCurrentModifiers();
|
||||
|
||||
// this forces a mouse-enter/up event, in case for some reason we didn't get a mouse-up before.
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, pos, modsToSend.withoutMouseButtons(),
|
||||
|
|
@ -2999,7 +2999,7 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
modsToSend = ModifierKeys::currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
modsToSend = ModifierKeys::getCurrentModifiers().withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
}
|
||||
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, pos, modsToSend,
|
||||
|
|
@ -3010,7 +3010,7 @@ private:
|
|||
|
||||
if (isUp)
|
||||
{
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, MouseInputSource::offscreenMousePos, ModifierKeys::currentModifiers.withoutMouseButtons(),
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, MouseInputSource::offscreenMousePos, ModifierKeys::getCurrentModifiers().withoutMouseButtons(),
|
||||
pressure, orientation, time, {}, touchIndex);
|
||||
|
||||
if (! isValidPeer (this))
|
||||
|
|
@ -3019,7 +3019,7 @@ private:
|
|||
if (isCancel)
|
||||
{
|
||||
currentTouches.clear();
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons();
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3094,9 +3094,9 @@ private:
|
|||
auto pInfoFlags = penInfo.pointerInfo.pointerFlags;
|
||||
|
||||
if ((pInfoFlags & POINTER_FLAG_FIRSTBUTTON) != 0)
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
else if ((pInfoFlags & POINTER_FLAG_SECONDBUTTON) != 0)
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::rightButtonModifier);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons().withFlags (ModifierKeys::rightButtonModifier);
|
||||
|
||||
if (isDown)
|
||||
{
|
||||
|
|
@ -3112,7 +3112,7 @@ private:
|
|||
else if (isUp || ! (pInfoFlags & POINTER_FLAG_INCONTACT))
|
||||
{
|
||||
modsToSend = modsToSend.withoutMouseButtons();
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons();
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons();
|
||||
}
|
||||
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::pen, pos, modsToSend, pressure,
|
||||
|
|
@ -3123,7 +3123,7 @@ private:
|
|||
|
||||
if (isUp)
|
||||
{
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::pen, MouseInputSource::offscreenMousePos, ModifierKeys::currentModifiers,
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::pen, MouseInputSource::offscreenMousePos, ModifierKeys::getCurrentModifiers(),
|
||||
pressure, MouseInputSource::defaultOrientation, time, penDetails);
|
||||
|
||||
if (! isValidPeer (this))
|
||||
|
|
@ -3302,7 +3302,7 @@ private:
|
|||
key = (int) keyChar;
|
||||
|
||||
// avoid sending junk text characters for some control-key combinations
|
||||
if (textChar < ' ' && ModifierKeys::currentModifiers.testFlags (ModifierKeys::ctrlModifier | ModifierKeys::altModifier))
|
||||
if (textChar < ' ' && ModifierKeys::getCurrentModifiers().testFlags (ModifierKeys::ctrlModifier | ModifierKeys::altModifier))
|
||||
textChar = 0;
|
||||
}
|
||||
|
||||
|
|
@ -3748,9 +3748,9 @@ private:
|
|||
if (isKeyDown (VK_RBUTTON)) mouseMods |= ModifierKeys::rightButtonModifier;
|
||||
if (isKeyDown (VK_MBUTTON)) mouseMods |= ModifierKeys::middleButtonModifier;
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons().withFlags (mouseMods);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons().withFlags (mouseMods);
|
||||
|
||||
return ModifierKeys::currentModifiers;
|
||||
return ModifierKeys::getCurrentModifiers();
|
||||
}
|
||||
|
||||
std::optional<LRESULT> onNcLButtonDown (WPARAM wParam, LPARAM lParam)
|
||||
|
|
|
|||
|
|
@ -437,11 +437,11 @@ namespace Keys
|
|||
{
|
||||
if (modifierKeysAreStale)
|
||||
{
|
||||
const auto oldMods = ModifierKeys::currentModifiers;
|
||||
const auto oldMods = ModifierKeys::getCurrentModifiers();
|
||||
XWindowSystem::getInstance()->getNativeRealtimeModifiers();
|
||||
ModifierKeys::currentModifiers = oldMods.withoutMouseButtons()
|
||||
.withFlags (ModifierKeys::currentModifiers.withOnlyMouseButtons()
|
||||
.getRawFlags());
|
||||
.withFlags (ModifierKeys::getCurrentModifiers().withOnlyMouseButtons()
|
||||
.getRawFlags());
|
||||
modifierKeysAreStale = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -539,7 +539,7 @@ static void updateKeyModifiers (int status) noexcept
|
|||
if ((status & ControlMask) != 0) keyMods |= ModifierKeys::ctrlModifier;
|
||||
if ((status & Keys::AltMask) != 0) keyMods |= ModifierKeys::altModifier;
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withOnlyMouseButtons().withFlags (keyMods);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withOnlyMouseButtons().withFlags (keyMods);
|
||||
|
||||
Keys::numLock = ((status & Keys::NumLockMask) != 0);
|
||||
Keys::capsLock = ((status & LockMask) != 0);
|
||||
|
|
@ -581,8 +581,8 @@ static bool updateKeyModifiersFromSym (KeySym sym, bool press) noexcept
|
|||
break;
|
||||
}
|
||||
|
||||
ModifierKeys::currentModifiers = press ? ModifierKeys::currentModifiers.withFlags (modifier)
|
||||
: ModifierKeys::currentModifiers.withoutFlags (modifier);
|
||||
ModifierKeys::currentModifiers = press ? ModifierKeys::getCurrentModifiers().withFlags (modifier)
|
||||
: ModifierKeys::getCurrentModifiers().withoutFlags (modifier);
|
||||
|
||||
return isModifier;
|
||||
}
|
||||
|
|
@ -2531,10 +2531,10 @@ ModifierKeys XWindowSystem::getNativeRealtimeModifiers() const
|
|||
((mask & ControlMask) != 0 ? keyboardMods : keyboardClearMods) |= ModifierKeys::ctrlModifier;
|
||||
}
|
||||
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons()
|
||||
.withFlags (mouseMods)
|
||||
.withoutFlags (keyboardClearMods)
|
||||
.withFlags (keyboardMods);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutMouseButtons()
|
||||
.withFlags (mouseMods)
|
||||
.withoutFlags (keyboardClearMods)
|
||||
.withFlags (keyboardMods);
|
||||
|
||||
// We are keeping track of the state of modifier keys and mouse buttons with the assumption that
|
||||
// for every mouse down we are going to receive a mouse up etc.
|
||||
|
|
@ -2548,7 +2548,7 @@ ModifierKeys XWindowSystem::getNativeRealtimeModifiers() const
|
|||
// receives an event again.
|
||||
Keys::modifierKeysAreStale = true;
|
||||
|
||||
return ModifierKeys::currentModifiers;
|
||||
return ModifierKeys::getCurrentModifiers();
|
||||
}
|
||||
|
||||
static bool hasWorkAreaData (const XWindowSystemUtilities::GetXProperty& prop)
|
||||
|
|
@ -3425,7 +3425,7 @@ void XWindowSystem::handleWindowMessage (LinuxComponentPeer* peer, XEvent& event
|
|||
|
||||
void XWindowSystem::handleKeyPressEvent (LinuxComponentPeer* peer, XKeyEvent& keyEvent) const
|
||||
{
|
||||
auto oldMods = ModifierKeys::currentModifiers;
|
||||
auto oldMods = ModifierKeys::getCurrentModifiers();
|
||||
Keys::refreshStaleModifierKeys();
|
||||
|
||||
char utf8 [64] = { 0 };
|
||||
|
|
@ -3450,7 +3450,7 @@ void XWindowSystem::handleKeyPressEvent (LinuxComponentPeer* peer, XKeyEvent& ke
|
|||
|
||||
if (keyCode < 0x20)
|
||||
keyCode = (int) X11Symbols::getInstance()->xkbKeycodeToKeysym (display, (::KeyCode) keyEvent.keycode, 0,
|
||||
ModifierKeys::currentModifiers.isShiftDown() ? 1 : 0);
|
||||
ModifierKeys::getCurrentModifiers().isShiftDown() ? 1 : 0);
|
||||
|
||||
keyDownChange = (sym != NoSymbol) && ! updateKeyModifiersFromSym (sym, true);
|
||||
}
|
||||
|
|
@ -3534,7 +3534,7 @@ void XWindowSystem::handleKeyPressEvent (LinuxComponentPeer* peer, XKeyEvent& ke
|
|||
if (utf8[0] != 0 || ((sym & 0xff00) == 0 && sym >= 8))
|
||||
keyPressed = true;
|
||||
|
||||
if (oldMods != ModifierKeys::currentModifiers)
|
||||
if (oldMods != ModifierKeys::getCurrentModifiers())
|
||||
peer->handleModifierKeysChange();
|
||||
|
||||
if (keyDownChange)
|
||||
|
|
@ -3572,10 +3572,10 @@ void XWindowSystem::handleKeyReleaseEvent (LinuxComponentPeer* peer, const XKeyE
|
|||
sym = X11Symbols::getInstance()->xkbKeycodeToKeysym (display, (::KeyCode) keyEvent.keycode, 0, 0);
|
||||
}
|
||||
|
||||
auto oldMods = ModifierKeys::currentModifiers;
|
||||
auto oldMods = ModifierKeys::getCurrentModifiers();
|
||||
auto keyDownChange = (sym != NoSymbol) && ! updateKeyModifiersFromSym (sym, false);
|
||||
|
||||
if (oldMods != ModifierKeys::currentModifiers)
|
||||
if (oldMods != ModifierKeys::getCurrentModifiers())
|
||||
peer->handleModifierKeysChange();
|
||||
|
||||
if (keyDownChange)
|
||||
|
|
@ -3598,10 +3598,10 @@ void XWindowSystem::handleWheelEvent (LinuxComponentPeer* peer, const XButtonPre
|
|||
|
||||
void XWindowSystem::handleButtonPressEvent (LinuxComponentPeer* peer, const XButtonPressedEvent& buttonPressEvent, int buttonModifierFlag) const
|
||||
{
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withFlags (buttonModifierFlag);
|
||||
ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withFlags (buttonModifierFlag);
|
||||
peer->toFront (true);
|
||||
peer->handleMouseEvent (MouseInputSource::InputSourceType::mouse, getLogicalMousePos (buttonPressEvent, peer->getPlatformScaleFactor()),
|
||||
ModifierKeys::currentModifiers, MouseInputSource::defaultPressure,
|
||||
ModifierKeys::getCurrentModifiers(), MouseInputSource::defaultPressure,
|
||||
MouseInputSource::defaultOrientation, getEventTime (buttonPressEvent), {});
|
||||
}
|
||||
|
||||
|
|
@ -3638,9 +3638,9 @@ void XWindowSystem::handleButtonReleaseEvent (LinuxComponentPeer* peer, const XB
|
|||
{
|
||||
switch (pointerMap[mapIndex])
|
||||
{
|
||||
case Keys::LeftButton: ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutFlags (ModifierKeys::leftButtonModifier); break;
|
||||
case Keys::RightButton: ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutFlags (ModifierKeys::rightButtonModifier); break;
|
||||
case Keys::MiddleButton: ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutFlags (ModifierKeys::middleButtonModifier); break;
|
||||
case Keys::LeftButton: ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutFlags (ModifierKeys::leftButtonModifier); break;
|
||||
case Keys::RightButton: ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutFlags (ModifierKeys::rightButtonModifier); break;
|
||||
case Keys::MiddleButton: ModifierKeys::currentModifiers = ModifierKeys::getCurrentModifiers().withoutFlags (ModifierKeys::middleButtonModifier); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
|
@ -3651,7 +3651,7 @@ void XWindowSystem::handleButtonReleaseEvent (LinuxComponentPeer* peer, const XB
|
|||
dragState.handleExternalDragButtonReleaseEvent();
|
||||
|
||||
peer->handleMouseEvent (MouseInputSource::InputSourceType::mouse, getLogicalMousePos (buttonRelEvent, peer->getPlatformScaleFactor()),
|
||||
ModifierKeys::currentModifiers, MouseInputSource::defaultPressure, MouseInputSource::defaultOrientation, getEventTime (buttonRelEvent));
|
||||
ModifierKeys::getCurrentModifiers(), MouseInputSource::defaultPressure, MouseInputSource::defaultOrientation, getEventTime (buttonRelEvent));
|
||||
}
|
||||
|
||||
void XWindowSystem::handleMotionNotifyEvent (LinuxComponentPeer* peer, const XPointerMovedEvent& movedEvent) const
|
||||
|
|
@ -3665,7 +3665,7 @@ void XWindowSystem::handleMotionNotifyEvent (LinuxComponentPeer* peer, const XPo
|
|||
dragState.handleExternalDragMotionNotify();
|
||||
|
||||
peer->handleMouseEvent (MouseInputSource::InputSourceType::mouse, getLogicalMousePos (movedEvent, peer->getPlatformScaleFactor()),
|
||||
ModifierKeys::currentModifiers, MouseInputSource::defaultPressure,
|
||||
ModifierKeys::getCurrentModifiers(), MouseInputSource::defaultPressure,
|
||||
MouseInputSource::defaultOrientation, getEventTime (movedEvent));
|
||||
}
|
||||
|
||||
|
|
@ -3674,11 +3674,11 @@ void XWindowSystem::handleEnterNotifyEvent (LinuxComponentPeer* peer, const XEnt
|
|||
if (peer->getParentWindow() != 0)
|
||||
peer->updateWindowBounds();
|
||||
|
||||
if (! ModifierKeys::currentModifiers.isAnyMouseButtonDown())
|
||||
if (! ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown())
|
||||
{
|
||||
updateKeyModifiers ((int) enterEvent.state);
|
||||
peer->handleMouseEvent (MouseInputSource::InputSourceType::mouse, getLogicalMousePos (enterEvent, peer->getPlatformScaleFactor()),
|
||||
ModifierKeys::currentModifiers, MouseInputSource::defaultPressure,
|
||||
ModifierKeys::getCurrentModifiers(), MouseInputSource::defaultPressure,
|
||||
MouseInputSource::defaultOrientation, getEventTime (enterEvent));
|
||||
}
|
||||
}
|
||||
|
|
@ -3688,12 +3688,12 @@ void XWindowSystem::handleLeaveNotifyEvent (LinuxComponentPeer* peer, const XLea
|
|||
// Suppress the normal leave if we've got a pointer grab, or if
|
||||
// it's a bogus one caused by clicking a mouse button when running
|
||||
// in a Window manager
|
||||
if (((! ModifierKeys::currentModifiers.isAnyMouseButtonDown()) && leaveEvent.mode == NotifyNormal)
|
||||
if (((! ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown()) && leaveEvent.mode == NotifyNormal)
|
||||
|| leaveEvent.mode == NotifyUngrab)
|
||||
{
|
||||
updateKeyModifiers ((int) leaveEvent.state);
|
||||
peer->handleMouseEvent (MouseInputSource::InputSourceType::mouse, getLogicalMousePos (leaveEvent, peer->getPlatformScaleFactor()),
|
||||
ModifierKeys::currentModifiers, MouseInputSource::defaultPressure,
|
||||
ModifierKeys::getCurrentModifiers(), MouseInputSource::defaultPressure,
|
||||
MouseInputSource::defaultOrientation, getEventTime (leaveEvent));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1952,7 +1952,7 @@ bool TextEditor::keyStateChanged (const bool isKeyDown)
|
|||
return false;
|
||||
|
||||
// (overridden to avoid forwarding key events to the parent)
|
||||
return ! ModifierKeys::currentModifiers.isCommandDown();
|
||||
return ! ModifierKeys::getCurrentModifiers().isCommandDown();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ Component* ComponentPeer::getTargetForKeyPress()
|
|||
bool ComponentPeer::handleKeyPress (const int keyCode, const juce_wchar textCharacter)
|
||||
{
|
||||
return handleKeyPress (KeyPress (keyCode,
|
||||
ModifierKeys::currentModifiers.withoutMouseButtons(),
|
||||
ModifierKeys::getCurrentModifiers().withoutMouseButtons(),
|
||||
textCharacter));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ void TooltipWindow::displayTipInternal (Point<int> screenPos, const String& tip,
|
|||
String TooltipWindow::getTipFor (Component& c)
|
||||
{
|
||||
if (detail::WindowingHelpers::isForegroundOrEmbeddedProcess (&c)
|
||||
&& ! ModifierKeys::currentModifiers.isAnyMouseButtonDown())
|
||||
&& ! ModifierKeys::getCurrentModifiers().isAnyMouseButtonDown())
|
||||
{
|
||||
if (auto* ttc = dynamic_cast<TooltipClient*> (&c))
|
||||
if (! c.isCurrentlyBlockedByAnotherModalComponent())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue