Merge pull request #2535 from myk002/myk_smart_refresh

only do a full refresh when needed
develop
Myk 2022-12-30 22:36:42 -08:00 committed by GitHub
commit a7dd14d699
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

@ -2363,7 +2363,14 @@ Supported callbacks and fields are:
where the above painting functions work correctly.
If omitted, the screen is cleared; otherwise it should do that itself.
In order to make a see-through dialog, call ``self._native.parent:render()``.
In order to make a dialog where portions of the parent viewscreen are still
visible in the background, call ``screen:renderParent()``.
If artifacts are left on the parent even after this function is called, such
as when the window is dragged or is resized, any code can set
``gui.Screen.request_full_screen_refresh`` to ``true``. Then when
``screen.renderParent()`` is next called, it will do a full flush of the
graphics and clear the screen of artifacts.
* ``function screen:onIdle()``

@ -597,6 +597,7 @@ end
Screen = defclass(Screen, View)
Screen.text_input_mode = false
Screen.request_full_screen_refresh = false
function Screen:postinit()
self:onResize(dscreen.getWindowSize())
@ -622,7 +623,10 @@ function Screen:renderParent()
else
dscreen.clear()
end
if Screen.request_full_screen_refresh then
df.global.gps.force_full_display_count = 1
Screen.request_full_screen_refresh = false
end
end
function Screen:sendInputToParent(...)
@ -657,6 +661,8 @@ function Screen:dismiss()
if self._native then
dscreen.dismiss(self)
end
-- don't leave artifacts behind on the parent screen when we disappear
Screen.request_full_screen_refresh = true
end
function Screen:onDismiss()

@ -442,6 +442,9 @@ end
-- if self.autoarrange_subviews is true, lay out visible subviews vertically,
-- adding gaps between widgets according to self.autoarrange_gap.
function Panel:postUpdateLayout()
-- don't leave artifacts behind on the parent screen when we move
gui.Screen.request_full_screen_refresh = true
if not self.autoarrange_subviews then return end
local gap = self.autoarrange_gap