mirror of
https://github.com/fjvallarino/monomer.git
synced 2024-09-20 08:17:37 +03:00
Avoid excessive delay on window resize
This commit is contained in:
parent
5fcb4b7a35
commit
8819aaebe3
@ -97,7 +97,7 @@ handleAppEvent model evt = case evt of
|
||||
_ -> []
|
||||
|
||||
buildUI :: App -> WidgetInstance App AppEvent
|
||||
buildUI model = trace "Creating UI" widgetWindow where
|
||||
buildUI model = trace "Creating UI" widgetTree where
|
||||
widgetWindow = vstack [
|
||||
hstack [
|
||||
label "Title: ",
|
||||
|
@ -172,7 +172,7 @@ mainLoop window renderer loopArgs = do
|
||||
let mouseEntered = isMouseEntered eventsPayload
|
||||
let mousePixelRate = if not useHiDPI then devicePixelRate else 1
|
||||
let baseSystemEvents = convertEvents mousePixelRate mousePos eventsPayload
|
||||
let newSecond = _mlFrameStartTs + ts > 1000
|
||||
let newSecond = _mlFrameAccumTs > 1000
|
||||
|
||||
inputStatus <- updateInputStatus baseSystemEvents
|
||||
|
||||
@ -193,8 +193,8 @@ mainLoop window renderer loopArgs = do
|
||||
_weInTopLayer = const True
|
||||
}
|
||||
|
||||
--when newSecond $
|
||||
-- liftIO . putStrLn $ "Frames: " ++ (show frames)
|
||||
when newSecond $
|
||||
liftIO . putStrLn $ "Frames: " ++ show _mlFrameCount
|
||||
|
||||
sysEvents <- preProcessEvents wenv _mlWidgetRoot baseSystemEvents
|
||||
isMouseFocused <- fmap isJust (use pathPressed)
|
||||
@ -220,9 +220,10 @@ mainLoop window renderer loopArgs = do
|
||||
endTicks <- fmap fromIntegral SDL.ticks
|
||||
|
||||
let fps = 30
|
||||
let frameLength = 0.9 * 1000000 / fps
|
||||
let frameLength = 1000000 / fps
|
||||
let newTs = fromIntegral $ endTicks - startTicks
|
||||
let nextFrameDelay = round . abs $ (frameLength - newTs * 1000)
|
||||
let tempDelay = abs (frameLength - newTs * 1000)
|
||||
let nextFrameDelay = round $ min frameLength tempDelay
|
||||
let newLoopArgs = loopArgs {
|
||||
_mlAppStartTs = _mlAppStartTs + ts,
|
||||
_mlFrameStartTs = startTicks,
|
||||
|
12
tasks.md
12
tasks.md
@ -271,6 +271,10 @@
|
||||
- Add Bold/Italic support (instead of different Font for each case)
|
||||
- Button should change color when clicked/actioned
|
||||
- Check label with flexHeight (multilabel was not showing first line if it did not fit)
|
||||
- Handle window title, maximize, etc
|
||||
- Also handle as requests?
|
||||
- Provide a way of exiting application/close window handler
|
||||
- Think about label size (fixed by default? lower factor)
|
||||
|
||||
- Pending
|
||||
- Add testing
|
||||
@ -289,11 +293,8 @@
|
||||
- Add Maps on Theme to handle user widget settings
|
||||
|
||||
Maybe postponed after release?
|
||||
- Avoid excessive delay on window resize
|
||||
- Check 1px difference on right side of labels/buttons (probably already fixed)
|
||||
- Handle window title, maximize, etc
|
||||
- Also handle as requests?
|
||||
- Provide a way of exiting application/close window handler
|
||||
- Think about label size (fixed by default? lower factor)
|
||||
- VStack should set itself to a fixed size if all children are fixed
|
||||
- ZStack should set _weIsTopLayer based on used space
|
||||
- Restore focus to previous widget when zstack changes (dialog situation)
|
||||
@ -326,6 +327,9 @@ Maybe postponed after release?
|
||||
- Add new request types (drag started, drag stopped, drag cancelled)
|
||||
- Add new events (drag hover)
|
||||
- SDL supports Drag and Drop integration with OS
|
||||
- Improve window resize situation
|
||||
- SDL does not send resize until operation has finished, making content look ugly because it's not updated
|
||||
- Check SDL_SetEventFilter trick instead of normal polling (https://wiki.libsdl.org/SDL_SetEventFilter)
|
||||
- Should StyleState be a phantom type?
|
||||
- A branch was created and got it working
|
||||
- Getting the types working for meant extending that idea to Widget was logical
|
||||
|
Loading…
Reference in New Issue
Block a user