consolidate full refresh logic in widgets.Panel

develop
Myk Taylor 2022-12-30 20:44:15 -08:00
parent 88dcdfd158
commit 33787473f0
No known key found for this signature in database
3 changed files with 5 additions and 12 deletions

@ -2366,12 +2366,6 @@ Supported callbacks and fields are:
In order to make a dialog where portions of the parent viewscreen are still In order to make a dialog where portions of the parent viewscreen are still
visible in the background, call ``screen:renderParent()``. 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()`` * ``function screen:onIdle()``
Called every frame when the screen is on top of the stack. Called every frame when the screen is on top of the stack.

@ -597,7 +597,6 @@ end
Screen = defclass(Screen, View) Screen = defclass(Screen, View)
Screen.text_input_mode = false Screen.text_input_mode = false
Screen.request_full_screen_refresh = false
function Screen:postinit() function Screen:postinit()
self:onResize(dscreen.getWindowSize()) self:onResize(dscreen.getWindowSize())
@ -623,10 +622,6 @@ function Screen:renderParent()
else else
dscreen.clear() dscreen.clear()
end end
if Screen.request_full_screen_refresh then
df.global.gps.force_full_display_count = 1
Screen.request_full_screen_refresh = false
end
end end
function Screen:sendInputToParent(...) function Screen:sendInputToParent(...)

@ -442,7 +442,7 @@ end
-- adding gaps between widgets according to self.autoarrange_gap. -- adding gaps between widgets according to self.autoarrange_gap.
function Panel:postUpdateLayout() function Panel:postUpdateLayout()
-- don't leave artifacts behind on the parent screen when we move -- don't leave artifacts behind on the parent screen when we move
gui.Screen.request_full_screen_refresh = true self.request_full_screen_refresh = true
if not self.autoarrange_subviews then return end if not self.autoarrange_subviews then return end
@ -464,6 +464,10 @@ end
function Panel:onRenderFrame(dc, rect) function Panel:onRenderFrame(dc, rect)
Panel.super.onRenderFrame(self, dc, rect) Panel.super.onRenderFrame(self, dc, rect)
if self.request_full_screen_refresh then
df.global.gps.force_full_display_count = 1
self.request_full_screen_refresh = false
end
if not self.frame_style then return end if not self.frame_style then return end
gui.paint_frame(dc, rect, self.frame_style, self.frame_title) gui.paint_frame(dc, rect, self.frame_style, self.frame_title)
if self.kbd_get_pos then if self.kbd_get_pos then