Skip to content

Commit

Permalink
Do a quick pass over widget's self.dimen
Browse files Browse the repository at this point in the history
Doesn't appear to be any rhyme or reason re: init vs. paintTo, wheee!

Anyway, fill the Geom tables we create to make sure we won't need to
grow it later while I'm there.
  • Loading branch information
NiLuJe committed Oct 5, 2022
1 parent 5904b6c commit 4dca3ce
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 9 deletions.
4 changes: 3 additions & 1 deletion frontend/ui/widget/bookmapwidget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ end

function BookMapRow:init()
local _mirroredUI = BD.mirroredUILayout()
self.dimen = Geom:new{ w = self.width, h = self.height }
self.dimen = Geom:new{ x = 0, y = 0, w = self.width, h = self.height }

-- Keep one span_height under baseline (frame bottom border) for indicators (current page, bookmarks)
self.pages_frame_height = self.height - self.span_height
Expand Down Expand Up @@ -539,6 +539,8 @@ function BookMapWidget:init()

-- Compute non-settings-dependant sizes and options
self.dimen = Geom:new{
x = 0,
y = 0,
w = Screen:getWidth(),
h = Screen:getHeight(),
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/ui/widget/container/movablecontainer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function MovableContainer:paintTo(bb, x, y)

local content_size = self[1]:getSize()
if not self.dimen then
self.dimen = Geom:new{w = content_size.w, h = content_size.h}
self.dimen = Geom:new{x = 0, y = 0, w = content_size.w, h = content_size.h}
end

self._orig_x = x
Expand Down
4 changes: 3 additions & 1 deletion frontend/ui/widget/keyvaluepage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ local KeyValueItem = InputContainer:extend{
}

function KeyValueItem:init()
self.dimen = Geom:new{ w = self.width, h = self.height }
self.dimen = Geom:new{ x = 0, y = 0, w = self.width, h = self.height }

-- self.value may contain some control characters (\n \t...) that would
-- be rendered as a square. Replace them with a shorter and nicer '|'.
Expand Down Expand Up @@ -288,6 +288,8 @@ local KeyValuePage = FocusManager:extend{

function KeyValuePage:init()
self.dimen = Geom:new{
x = 0,
y = 0,
w = self.width or Screen:getWidth(),
h = self.height or Screen:getHeight(),
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/ui/widget/listview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function ListView:init()
if #self.items <= 0 then return end

self.show_page = 1
self.dimen = Geom:new{w = self.width, h = self.height}
self.dimen = Geom:new{x = 0, y = 0, w = self.width, h = self.height}

if Device:isTouchDevice() then
self.ges_events.Swipe = {
Expand Down
2 changes: 1 addition & 1 deletion frontend/ui/widget/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ function Menu:init()
self.show_parent = self.show_parent or self
self.item_table = self.item_table or {}
self.item_table_stack = {}
self.dimen = Geom:new{ w = self.width, h = self.height or Screen:getHeight() }
self.dimen = Geom:new{ x = 0, y = 0, w = self.width, h = self.height or Screen:getHeight() }
if self.dimen.h > Screen:getHeight() or self.dimen.h == nil then
self.dimen.h = Screen:getHeight()
end
Expand Down
2 changes: 1 addition & 1 deletion frontend/ui/widget/networksetting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ local NetworkItem = InputContainer:extend{
}

function NetworkItem:init()
self.dimen = Geom:new{w = self.width, h = self.height}
self.dimen = Geom:new{x = 0, y = 0, w = self.width, h = self.height}
if not self.info.ssid then
self.info.ssid = "[hidden]"
end
Expand Down
4 changes: 3 additions & 1 deletion frontend/ui/widget/physicalkeyboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ function PhysicalNumericKey:init()
},
}
self.dimen = Geom:new{
x = 0,
y = 0,
w = self.width,
h = self.height,
}
Expand All @@ -85,7 +87,7 @@ function PhysicalKeyboard:init()
KeyPress = { { all_keys }, }
}

self.dimen = Geom:new{ w = 0, h = 0 }
self.dimen = Geom:new{ x = 0, y = 0, w = 0, h = 0 }

self:setType(self.inputbox.input_type)
end
Expand Down
4 changes: 3 additions & 1 deletion frontend/ui/widget/sortwidget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local SortItemWidget = InputContainer:extend{
}

function SortItemWidget:init()
self.dimen = Geom:new{w = self.width, h = self.height}
self.dimen = Geom:new{x = 0, y = 0, w = self.width, h = self.height}
self.ges_events.Tap = {
GestureRange:new{
ges = "tap",
Expand Down Expand Up @@ -135,6 +135,8 @@ function SortWidget:init()
self.orig_item_table = nil

self.dimen = Geom:new{
x = 0,
y = 0,
w = self.width or Screen:getWidth(),
h = self.height or Screen:getHeight(),
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/ui/widget/titlebar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ function TitleBar:init()
end

self.dimen = Geom:new{
x = 0,
y = 0,
w = self.width,
h = self.titlebar_height, -- buttons can overflow this
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/ui/widget/touchmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ function TouchMenuBar:init()
self.bar_sep
},
}
self.dimen = Geom:new{ w = self.width, h = self.height }
self.dimen = Geom:new{ x = 0, y = 0, w = self.width, h = self.height }
end

function TouchMenuBar:switchToTab(index)
Expand Down

0 comments on commit 4dca3ce

Please sign in to comment.