void SSlider::OnFocusLost(const FFocusEvent& InFocusEvent) { if (bControllerInputCaptured) { // Commit and reset state CommitValue(ValueAttribute.Get()); ResetControllerState(); } }
FReply SSlider::OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if (this->HasMouseCapture() && !IsLocked()) { SetCursor((Orientation == Orient_Horizontal) ? EMouseCursor::ResizeLeftRight : EMouseCursor::ResizeUpDown); CommitValue(PositionToValue(MyGeometry, MouseEvent.GetLastScreenSpacePosition())); // Release capture for controller/keyboard when switching to mouse ResetControllerState(); return FReply::Handled(); } return FReply::Unhandled(); }
FReply SSlider::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if ((MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) && HasMouseCapture()) { SetCursor(EMouseCursor::Default); OnMouseCaptureEnd.ExecuteIfBound(); // Release capture for controller/keyboard when switching to mouse. ResetControllerState(); return FReply::Handled().ReleaseMouseCapture(); } return FReply::Unhandled(); }
FReply SSlider::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if ((MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) && !IsLocked()) { OnMouseCaptureBegin.ExecuteIfBound(); CommitValue(PositionToValue(MyGeometry, MouseEvent.GetLastScreenSpacePosition())); // Release capture for controller/keyboard when switching to mouse. ResetControllerState(); return FReply::Handled().CaptureMouse(SharedThis(this)); } return FReply::Unhandled(); }
unsigned long CLASS::maxCapabilityForDomainState(IOPMPowerFlags domainState) { #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090 || defined(REHABMAN_UNIVERSAL_BUILD) uint8_t port, portLimit; uint32_t portSC; #endif unsigned long state = super::maxCapabilityForDomainState(domainState); if (!CHECK_FOR_MAVERICKS) return state; #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090 || defined(REHABMAN_UNIVERSAL_BUILD) if (_wakingFromHibernation) return state; if (!(_errataBits & kErrataIntelLynxPoint)) return state; if (_myPowerState != kUSBPowerStateSleep) return state; if (state < kUSBPowerStateLowPower) return state; /* * Note: This check neutralizes the code below because PM backbone calls this method *before* * powering the parent IOPCIDevice on when coming back from Sleep to On. */ if (!_v3ExpansionData || !READ_V3EXPANSION(_parentDeviceON)) return state; port = READ_V3EXPANSION(_rootHubPortsSSStartRange) - 1U; portLimit = port + READ_V3EXPANSION(_rootHubNumPortsSS); for (; port < portLimit; ++port) { portSC = Read32Reg(&_pXHCIOperationalRegisters->prs[port].PortSC); if (m_invalid_regspace) return state; if (!(portSC & XHCI_PS_WRC)) return state; } IOLog("XHCI: All ports have WRC bit set - reseting all of USB\n"); /* * Note: Tested and this code causes ejection messages on connected drives. */ ResetControllerState(); EnableAllEndpoints(true); state = kUSBPowerStateOff; _wakingFromHibernation = true; #endif return state; }
FReply SSlider::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) { FReply Reply = FReply::Unhandled(); const FKey KeyPressed = InKeyEvent.GetKey(); if (IsInteractable()) { // The controller's bottom face button must be pressed once to begin manipulating the slider's value. // Navigation away from the widget is prevented until the button has been pressed again or focus is lost. // The value can be manipulated by using the game pad's directional arrows ( relative to slider orientation ). if (KeyPressed == EKeys::Enter || KeyPressed == EKeys::SpaceBar || KeyPressed == EKeys::Gamepad_FaceButton_Bottom) { if (bControllerInputCaptured == false) { // Begin capturing controller input and allow user to modify the slider's value. bControllerInputCaptured = true; OnControllerCaptureBegin.ExecuteIfBound(); Reply = FReply::Handled(); } else { ResetControllerState(); Reply = FReply::Handled(); } } if (bControllerInputCaptured) { float NewValue = ValueAttribute.Get(); if (Orientation == EOrientation::Orient_Horizontal) { if (KeyPressed == EKeys::Left || KeyPressed == EKeys::Gamepad_DPad_Left || KeyPressed == EKeys::Gamepad_LeftStick_Left) { NewValue -= StepSize.Get(); } else if (KeyPressed == EKeys::Right || KeyPressed == EKeys::Gamepad_DPad_Right || KeyPressed == EKeys::Gamepad_LeftStick_Right) { NewValue += StepSize.Get(); } } else { if (KeyPressed == EKeys::Down || KeyPressed == EKeys::Gamepad_DPad_Down || KeyPressed == EKeys::Gamepad_LeftStick_Down) { NewValue -= StepSize.Get(); } else if (KeyPressed == EKeys::Up || KeyPressed == EKeys::Gamepad_DPad_Up || KeyPressed == EKeys::Gamepad_LeftStick_Up) { NewValue += StepSize.Get(); } } CommitValue(FMath::Clamp(NewValue, 0.0f, 1.0f)); Reply = FReply::Handled(); } else { Reply = SLeafWidget::OnKeyDown(MyGeometry, InKeyEvent); } } else { Reply = SLeafWidget::OnKeyDown(MyGeometry, InKeyEvent); } return Reply; }