mirror of
https://github.com/fjvallarino/monomer.git
synced 2024-09-21 00:38:01 +03:00
Rename variables
This commit is contained in:
parent
9e3339f80e
commit
2c9c6888de
@ -53,18 +53,18 @@ createEventContext wenv latestPressed activeOverlay currentTarget systemEvent wi
|
||||
pathEvent = Just
|
||||
findStartPath = fromMaybe rootPath activeOverlay
|
||||
pathFromPoint point = _widgetFind (_instanceWidget widgetRoot) wenv findStartPath point widgetRoot
|
||||
pointEvent point = pathFromPoint point <|> activeOverlay <|> latestPressed
|
||||
pointEvent point = latestPressed <|> pathFromPoint point <|> activeOverlay
|
||||
|
||||
handleSystemEvents :: (MonomerM s m) => Renderer m -> WidgetEnv s e -> [SystemEvent] -> WidgetInstance s e -> m (HandlerStep s e)
|
||||
handleSystemEvents renderer wenv systemEvents widgetRoot = foldM reducer (wenv, Seq.empty, widgetRoot) systemEvents where
|
||||
reducer (currWctx, currEvents, currWidgetRoot) systemEvent = do
|
||||
currentFocus <- use focused
|
||||
|
||||
(wenv2, evts2, wroot2) <- handleSystemEvent renderer currWctx systemEvent currentFocus currentFocus currWidgetRoot
|
||||
(wenv2, evts2, wroot2) <- handleSystemEvent renderer currWctx systemEvent currentFocus currWidgetRoot
|
||||
return (wenv2, currEvents >< evts2, wroot2)
|
||||
|
||||
handleSystemEvent :: (MonomerM s m) => Renderer m -> WidgetEnv s e -> SystemEvent -> Path -> Path -> WidgetInstance s e -> m (HandlerStep s e)
|
||||
handleSystemEvent renderer wenv systemEvent currentFocus currentTarget widgetRoot = do
|
||||
handleSystemEvent :: (MonomerM s m) => Renderer m -> WidgetEnv s e -> SystemEvent -> Path -> WidgetInstance s e -> m (HandlerStep s e)
|
||||
handleSystemEvent renderer wenv systemEvent currentTarget widgetRoot = do
|
||||
latestPressed <- use latestPressed
|
||||
activeOverlay <- use activeOverlay
|
||||
|
||||
@ -106,13 +106,13 @@ handleFocusChange :: (MonomerM s m) => Renderer m -> SystemEvent -> Bool -> Hand
|
||||
handleFocusChange renderer systemEvent stopProcessing (wenv, events, widgetRoot)
|
||||
| focusChangeRequested = do
|
||||
oldFocus <- use focused
|
||||
(newWenv, newEvents1, newRoot1) <- handleSystemEvent renderer wenv Blur oldFocus oldFocus widgetRoot
|
||||
(newWenv1, newEvents1, newRoot1) <- handleSystemEvent renderer wenv Blur oldFocus widgetRoot
|
||||
|
||||
let newFocus = findNextFocusable newWenv oldFocus widgetRoot
|
||||
let tempWenv = newWenv {
|
||||
let newFocus = findNextFocusable newWenv1 oldFocus widgetRoot
|
||||
let tempWenv = newWenv1 {
|
||||
_weFocusedPath = newFocus
|
||||
}
|
||||
(newWenv2, newEvents2, newRoot2) <- handleSystemEvent renderer tempWenv Focus newFocus newFocus newRoot1
|
||||
(newWenv2, newEvents2, newRoot2) <- handleSystemEvent renderer tempWenv Focus newFocus newRoot1
|
||||
focused .= newFocus
|
||||
|
||||
return (newWenv2, events >< newEvents1 >< newEvents2, widgetRoot)
|
||||
@ -151,7 +151,7 @@ handleClipboardGet renderer reqs previousStep = do
|
||||
foldM (reducer contents) previousStep reqs
|
||||
where
|
||||
reducer contents (wenv, events, widgetRoot) (GetClipboard path) = do
|
||||
(newWenv2, newEvents2, newRoot2) <- handleSystemEvent renderer wenv (Clipboard contents) (_weFocusedPath wenv) path widgetRoot
|
||||
(newWenv2, newEvents2, newRoot2) <- handleSystemEvent renderer wenv (Clipboard contents) path widgetRoot
|
||||
|
||||
return (newWenv2, events >< newEvents2, newRoot2)
|
||||
reducer contents previousStep _ = return previousStep
|
||||
|
@ -125,9 +125,9 @@ mergeChildren wenv oldFull@(oldChild :<| oldChildren) (newChild :<| newChildren)
|
||||
|
||||
-- | Find next focusable item
|
||||
containerNextFocusable :: WidgetEnv s e -> Path -> WidgetInstance s e -> Maybe Path
|
||||
containerNextFocusable wenv focused widgetInstance = nextFocus where
|
||||
containerNextFocusable wenv startFrom widgetInstance = nextFocus where
|
||||
children = _instanceChildren widgetInstance
|
||||
filterChildren child = isTargetBeforeCurrent focused child && not (isTargetReached focused child)
|
||||
filterChildren child = isTargetBeforeCurrent startFrom child && not (isTargetReached startFrom child)
|
||||
indexes = Seq.fromList [0..length children]
|
||||
maybeFocused = fmap getFocused (Seq.filter filterChildren children)
|
||||
focusedPaths = fromJust <$> Seq.filter isJust maybeFocused
|
||||
@ -135,7 +135,7 @@ containerNextFocusable wenv focused widgetInstance = nextFocus where
|
||||
isFocusable child = _instanceFocusable child && _instanceEnabled child
|
||||
getFocused child
|
||||
| isFocusable child = Just (_instancePath child)
|
||||
| otherwise = _widgetNextFocusable (_instanceWidget child) wenv focused child
|
||||
| otherwise = _widgetNextFocusable (_instanceWidget child) wenv startFrom child
|
||||
|
||||
-- | Find instance matching point
|
||||
containerFind :: WidgetEnv s e -> Path -> Point -> WidgetInstance s e -> Maybe Path
|
||||
|
@ -48,7 +48,7 @@ widgetMerge mergeHandler wenv oldInstance newInstance = result where
|
||||
result = mergeHandler wenv oldState newInstance
|
||||
|
||||
defaultNextFocusable :: WidgetEnv s e -> Path -> WidgetInstance s e -> Maybe Path
|
||||
defaultNextFocusable wenv focused widgetInstance = Nothing
|
||||
defaultNextFocusable wenv startFrom widgetInstance = Nothing
|
||||
|
||||
defaultFind :: WidgetEnv s e -> Path -> Point -> WidgetInstance s e -> Maybe Path
|
||||
defaultFind wenv path point widgetInstance = Just $ _instancePath widgetInstance
|
||||
|
@ -129,13 +129,13 @@ compositeMerge comp state wenv oldComposite newComposite = result where
|
||||
result = processWidgetResult comp newState wenv newComposite widgetResult
|
||||
|
||||
compositeNextFocusable :: Composite s e ep -> CompositeState s e -> WidgetEnv sp ep -> Path -> WidgetInstance sp ep -> Maybe Path
|
||||
compositeNextFocusable comp state wenv focused widgetComposite = nextFocus where
|
||||
compositeNextFocusable comp state wenv startFrom widgetComposite = nextFocus where
|
||||
CompositeState{..} = state
|
||||
widget = _instanceWidget _compositeRoot
|
||||
cwenv = convertWidgetEnv wenv _compositeGlobalKeys _compositeModel
|
||||
isEnabled = _instanceEnabled _compositeRoot
|
||||
nextFocus
|
||||
| isEnabled = _widgetNextFocusable widget cwenv focused _compositeRoot
|
||||
| isEnabled = _widgetNextFocusable widget cwenv startFrom _compositeRoot
|
||||
| otherwise = Nothing
|
||||
|
||||
compositeFind :: CompositeState s e -> WidgetEnv sp ep -> Path -> Point -> WidgetInstance sp ep -> Maybe Path
|
||||
|
Loading…
Reference in New Issue
Block a user