Floor dimension computations (mul/div). (#6264)

* floor most every dimension computations involving MUL or DIV
Should avoid passing nonsensical floating point coordinates/dimensions
to the UI code.

* Update base

* https://github.com/koreader/koreader-base/pull/1113
* https://github.com/koreader/koreader-base/pull/1114
* https://github.com/koreader/koreader-base/pull/1115

* Bump android-luajit-launcher

https://github.com/koreader/android-luajit-launcher/pull/230
https://github.com/koreader/android-luajit-launcher/pull/231
reviewable/pr6266/r1
NiLuJe 4 years ago committed by GitHub
parent 19b15462b2
commit 1f994f8ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 7b5568a3c44179fbcedafa22ee03701171539727 Subproject commit 3c3b7ca24bb7ac56a0b03d61a1e791edd377b088

@ -130,8 +130,8 @@ function DropBox:config(item, callback)
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
input_type = "text", input_type = "text",
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)

@ -146,8 +146,8 @@ function Ftp:config(item, callback)
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
input_type = "text", input_type = "text",
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)

@ -139,8 +139,8 @@ The start folder is appended to the server path.]])
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
input_type = "text", input_type = "text",
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)

@ -114,7 +114,7 @@ function FileSearcher:onShowFileSearch(search_path)
self.search_dialog = InputDialog:new{ self.search_dialog = InputDialog:new{
title = _("Search for books by filename"), title = _("Search for books by filename"),
input = self.search_value, input = self.search_value,
width = Screen:getWidth() * 0.9, width = math.floor(Screen:getWidth() * 0.9),
buttons = { buttons = {
{ {
{ {

@ -143,7 +143,7 @@ function FileManagerMenu:setUpdateItemTable()
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local curr_items = G_reader_settings:readSetting("items_per_page") or 14 local curr_items = G_reader_settings:readSetting("items_per_page") or 14
local items = SpinWidget:new{ local items = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = curr_items, value = curr_items,
value_min = 6, value_min = 6,
value_max = 24, value_max = 24,
@ -166,7 +166,7 @@ function FileManagerMenu:setUpdateItemTable()
local default_font_size = math.floor(24 - ((curr_items - 6)/ 18) * 10 ) local default_font_size = math.floor(24 - ((curr_items - 6)/ 18) * 10 )
local curr_font_size = G_reader_settings:readSetting("items_font_size") or default_font_size local curr_font_size = G_reader_settings:readSetting("items_font_size") or default_font_size
local items_font = SpinWidget:new{ local items_font = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = curr_font_size, value = curr_font_size,
value_min = 10, value_min = 10,
value_max = 72, value_max = 72,

@ -206,8 +206,8 @@ function Search:ShowSearch()
}, },
}, },
}, },
width = Screen:getWidth() * 0.8, width = math.floor(Screen:getWidth() * 0.8),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.search_dialog) UIManager:show(self.search_dialog)
self.search_dialog:onShowKeyboard() self.search_dialog:onShowKeyboard()

@ -157,7 +157,7 @@ function SetDefaults:init()
}, },
}, },
input_type = setting_type, input_type = setting_type,
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
} }
UIManager:show(self.set_dialog) UIManager:show(self.set_dialog)
self.set_dialog:onShowKeyboard() self.set_dialog:onShowKeyboard()
@ -208,8 +208,8 @@ function SetDefaults:init()
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.set_dialog) UIManager:show(self.set_dialog)
self.set_dialog:onShowKeyboard() self.set_dialog:onShowKeyboard()
@ -247,7 +247,7 @@ function SetDefaults:init()
}, },
}, },
input_type = setting_type, input_type = setting_type,
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
} }
UIManager:show(self.set_dialog) UIManager:show(self.set_dialog)
self.set_dialog:onShowKeyboard() self.set_dialog:onShowKeyboard()

@ -42,15 +42,15 @@ function PageCropDialog:init()
show_parent = self, show_parent = self,
} }
local ok_container = RightContainer:new{ local ok_container = RightContainer:new{
dimen = Geom:new{ w = Screen:getWidth()*0.33, h = Screen:getHeight()/12}, dimen = Geom:new{ w = math.floor(Screen:getWidth()*0.33), h = math.floor(Screen:getHeight()/12)},
ok_button, ok_button,
} }
local cancel_container = LeftContainer:new{ local cancel_container = LeftContainer:new{
dimen = Geom:new{ w = Screen:getWidth()*0.33, h = Screen:getHeight()/12}, dimen = Geom:new{ w = math.floor(Screen:getWidth()*0.33), h = math.floor(Screen:getHeight()/12)},
cancel_button, cancel_button,
} }
table.insert(horizontal_group, ok_container) table.insert(horizontal_group, ok_container)
table.insert(horizontal_group, HorizontalSpan:new{ width = Screen:getWidth()*0.34}) table.insert(horizontal_group, HorizontalSpan:new{ width = math.floor(Screen:getWidth()*0.34)})
table.insert(horizontal_group, cancel_container) table.insert(horizontal_group, cancel_container)
self[2] = FrameContainer:new{ self[2] = FrameContainer:new{
horizontal_group, horizontal_group,

@ -79,7 +79,7 @@ function ReaderDeviceStatus:addToMainMenu(menu_items)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local curr_items = G_reader_settings:readSetting("low_battery_threshold") or 20 local curr_items = G_reader_settings:readSetting("low_battery_threshold") or 20
local battery_spin = SpinWidget:new { local battery_spin = SpinWidget:new {
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = curr_items, value = curr_items,
value_min = 5, value_min = 5,
value_max = 90, value_max = 90,

@ -308,7 +308,7 @@ If you'd like to change the order in which dictionaries are queried (and their r
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local font_size = G_reader_settings:readSetting("dict_font_size") or 20 local font_size = G_reader_settings:readSetting("dict_font_size") or 20
local items_font = SpinWidget:new{ local items_font = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = font_size, value = font_size,
value_min = 8, value_min = 8,
value_max = 32, value_max = 32,

@ -897,7 +897,7 @@ function ReaderFooter:addToMainMenu(menu_items)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local font_size = self.settings.text_font_size local font_size = self.settings.text_font_size
local items_font = SpinWidget:new{ local items_font = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = font_size, value = font_size,
value_min = 8, value_min = 8,
value_max = 36, value_max = 36,
@ -951,7 +951,7 @@ function ReaderFooter:addToMainMenu(menu_items)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local container_height = self.settings.container_height local container_height = self.settings.container_height
local items_font = SpinWidget:new{ local items_font = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = container_height, value = container_height,
value_min = 7, value_min = 7,
value_max = 98, value_max = 98,
@ -978,7 +978,7 @@ function ReaderFooter:addToMainMenu(menu_items)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local container_bottom_padding = self.settings.container_bottom_padding local container_bottom_padding = self.settings.container_bottom_padding
local items_font = SpinWidget:new{ local items_font = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = container_bottom_padding, value = container_bottom_padding,
value_min = 0, value_min = 0,
value_max = 49, value_max = 49,
@ -1007,7 +1007,7 @@ function ReaderFooter:addToMainMenu(menu_items)
callback = function(touchmenu_instance) callback = function(touchmenu_instance)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local items = SpinWidget:new{ local items = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = self.settings.book_title_max_width_pct, value = self.settings.book_title_max_width_pct,
value_min = 10, value_min = 10,
value_step = 5, value_step = 5,
@ -1033,7 +1033,7 @@ function ReaderFooter:addToMainMenu(menu_items)
callback = function(touchmenu_instance) callback = function(touchmenu_instance)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local items = SpinWidget:new{ local items = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = self.settings.book_chapter_max_width_pct, value = self.settings.book_chapter_max_width_pct,
value_min = 10, value_min = 10,
value_step = 5, value_step = 5,
@ -1409,7 +1409,7 @@ function ReaderFooter:addToMainMenu(menu_items)
end end
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local items = SpinWidget:new{ local items = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = value, value = value,
value_min = value_min, value_min = value_min,
value_step = 1, value_step = 1,
@ -1585,7 +1585,7 @@ function ReaderFooter:addToMainMenu(menu_items)
callback = function(touchmenu_instance) callback = function(touchmenu_instance)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local items = SpinWidget:new{ local items = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = self.settings.progress_bar_min_width_pct, value = self.settings.progress_bar_min_width_pct,
value_min = 5, value_min = 5,
value_step = 5, value_step = 5,

@ -489,7 +489,7 @@ function ReaderGesture:addToMainMenu(menu_items)
Set double tap interval in milliseconds. Set double tap interval in milliseconds.
The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds). The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds).
Default value: %1]]), GestureDetector.DOUBLE_TAP_INTERVAL/1000), Default value: %1]]), GestureDetector.DOUBLE_TAP_INTERVAL/1000),
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = GestureDetector:getInterval("ges_double_tap_interval")/1000, value = GestureDetector:getInterval("ges_double_tap_interval")/1000,
value_min = 100, value_min = 100,
value_max = 2000, value_max = 2000,
@ -516,7 +516,7 @@ Default value: %1]]), GestureDetector.DOUBLE_TAP_INTERVAL/1000),
Set two finger tap duration in milliseconds. Set two finger tap duration in milliseconds.
The duration value can range from 100 (0.1 seconds) to 2000 (2 seconds). The duration value can range from 100 (0.1 seconds) to 2000 (2 seconds).
Default value: %1]]), GestureDetector.TWO_FINGER_TAP_DURATION/1000), Default value: %1]]), GestureDetector.TWO_FINGER_TAP_DURATION/1000),
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = GestureDetector:getInterval("ges_two_finger_tap_duration")/1000, value = GestureDetector:getInterval("ges_two_finger_tap_duration")/1000,
value_min = 100, value_min = 100,
value_max = 2000, value_max = 2000,
@ -543,7 +543,7 @@ Default value: %1]]), GestureDetector.TWO_FINGER_TAP_DURATION/1000),
Set hold interval in milliseconds. Set hold interval in milliseconds.
The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds). The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds).
Default value: %1]]), GestureDetector.HOLD_INTERVAL/1000), Default value: %1]]), GestureDetector.HOLD_INTERVAL/1000),
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = GestureDetector:getInterval("ges_hold_interval")/1000, value = GestureDetector:getInterval("ges_hold_interval")/1000,
value_min = 100, value_min = 100,
value_max = 2000, value_max = 2000,
@ -570,7 +570,7 @@ Default value: %1]]), GestureDetector.HOLD_INTERVAL/1000),
Set pan delay interval in milliseconds. Set pan delay interval in milliseconds.
The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds). The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds).
Default value: %1]]), GestureDetector.PAN_DELAYED_INTERVAL/1000), Default value: %1]]), GestureDetector.PAN_DELAYED_INTERVAL/1000),
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = GestureDetector:getInterval("ges_pan_delayed_interval")/1000, value = GestureDetector:getInterval("ges_pan_delayed_interval")/1000,
value_min = 100, value_min = 100,
value_max = 2000, value_max = 2000,
@ -597,7 +597,7 @@ Default value: %1]]), GestureDetector.PAN_DELAYED_INTERVAL/1000),
Set swipe interval in milliseconds. Set swipe interval in milliseconds.
The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds). The interval value can range from 100 (0.1 seconds) to 2000 (2 seconds).
Default value: %1]]), GestureDetector.SWIPE_INTERVAL/1000), Default value: %1]]), GestureDetector.SWIPE_INTERVAL/1000),
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = GestureDetector:getInterval("ges_swipe_interval")/1000, value = GestureDetector:getInterval("ges_swipe_interval")/1000,
value_min = 100, value_min = 100,
value_max = 2000, value_max = 2000,

@ -250,7 +250,7 @@ From the footnote popup, you can jump to the footnote location in the book by sw
callback = function() callback = function()
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
UIManager:show(SpinWidget:new{ UIManager:show(SpinWidget:new{
width = Screen:getWidth() * 0.75, width = math.floor(Screen:getWidth() * 0.75),
value = G_reader_settings:readSetting("footnote_popup_relative_font_size") or -2, value = G_reader_settings:readSetting("footnote_popup_relative_font_size") or -2,
value_min = -10, value_min = -10,
value_max = 5, value_max = 5,

@ -392,7 +392,7 @@ function ReaderPageMap:addToMainMenu(menu_items)
callback = function(touchmenu_instance) callback = function(touchmenu_instance)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local spin_w = SpinWidget:new{ local spin_w = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = self.label_font_size, value = self.label_font_size,
value_min = 8, value_min = 8,
value_max = 20, value_max = 20,

@ -453,7 +453,7 @@ You can set how many lines are shown.]])
callback = function(touchmenu_instance) callback = function(touchmenu_instance)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
UIManager:show(SpinWidget:new{ UIManager:show(SpinWidget:new{
width = Screen:getWidth() * 0.75, width = math.floor(Screen:getWidth() * 0.75),
value = G_reader_settings:readSetting("copt_overlap_lines") or 1, value = G_reader_settings:readSetting("copt_overlap_lines") or 1,
value_min = 1, value_min = 1,
value_max = 10, value_max = 10,

@ -412,7 +412,7 @@ When the book's language tag is not among our presets, no specific features will
right_default = alg_right_hyphen_min, right_default = alg_right_hyphen_min,
-- let room on the widget sides so we can see -- let room on the widget sides so we can see
-- the hyphenation changes happening -- the hyphenation changes happening
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
default_values = true, default_values = true,
default_text = _("Use language defaults"), default_text = _("Use language defaults"),
title_text = _("Hyphenation limits"), title_text = _("Hyphenation limits"),

@ -37,12 +37,12 @@ function SkimToWidget:init()
self.screen_width = Screen:getWidth() self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight() self.screen_height = Screen:getHeight()
self.span = math.ceil(self.screen_height * 0.01) self.span = math.ceil(self.screen_height * 0.01)
self.width = self.screen_width * 0.95 self.width = math.floor(self.screen_width * 0.95)
self.button_bordersize = Size.border.button self.button_bordersize = Size.border.button
-- the buttons need some kind of separation but maybe I should just implement -- the buttons need some kind of separation but maybe I should just implement
-- margin_left and margin_right… -- margin_left and margin_right…
self.button_margin = self.button_bordersize self.button_margin = self.button_bordersize
self.button_width = self.screen_width * 0.16 - (2*self.button_margin) self.button_width = math.floor(self.screen_width * 0.16) - (2*self.button_margin)
if Device:hasKeys() then if Device:hasKeys() then
self.key_events = { self.key_events = {
Close = { {"Back"}, doc = "close skimto page" } Close = { {"Back"}, doc = "close skimto page" }
@ -93,12 +93,12 @@ function SkimToWidget:init()
text = dialog_title, text = dialog_title,
face = self.title_face, face = self.title_face,
bold = true, bold = true,
max_width = self.screen_width * 0.95, max_width = math.floor(self.screen_width * 0.95),
}, },
} }
self.progress_bar = ProgressWidget:new{ self.progress_bar = ProgressWidget:new{
width = self.screen_width * 0.9, width = math.floor(self.screen_width * 0.9),
height = Size.item.height_big, height = Size.item.height_big,
percentage = self.curr_page / self.page_count, percentage = self.curr_page / self.page_count,
ticks = self.ticks_candidates, ticks = self.ticks_candidates,
@ -181,7 +181,7 @@ function SkimToWidget:init()
radius = 0, radius = 0,
padding = 0, padding = 0,
enabled = true, enabled = true,
width = self.screen_width * 0.2 - (2*self.button_margin), width = math.floor(self.screen_width * 0.2) - (2*self.button_margin),
show_parent = self, show_parent = self,
callback = function() callback = function()
self.callback_switch_to_goto() self.callback_switch_to_goto()
@ -268,7 +268,7 @@ function SkimToWidget:init()
end, end,
} }
local horizontal_span_up = HorizontalSpan:new{ width = self.screen_width * 0.2 } local horizontal_span_up = HorizontalSpan:new{ width = math.floor(self.screen_width * 0.2) }
local button_table_up = HorizontalGroup:new{ local button_table_up = HorizontalGroup:new{
align = "center", align = "center",
button_chapter_prev, button_chapter_prev,

@ -19,7 +19,7 @@ end
local function spinWidgetSetRefresh(touchmenu_instance, refresh_rate_num) local function spinWidgetSetRefresh(touchmenu_instance, refresh_rate_num)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local items = SpinWidget:new{ local items = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = custom(refresh_rate_num), value = custom(refresh_rate_num),
value_min = 0, value_min = 0,
value_max = 200, value_max = 200,

@ -24,7 +24,7 @@ local function spinWidgetSetDPI(touchmenu_instance)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
local items = SpinWidget:new{ local items = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = custom() or dpi(), value = custom() or dpi(),
value_min = 90, value_min = 90,
value_max = 900, value_max = 900,

@ -280,7 +280,7 @@ end
function BookStatusWidget:genBookInfoGroup() function BookStatusWidget:genBookInfoGroup()
local screen_width = Screen:getWidth() local screen_width = Screen:getWidth()
local split_span_width = screen_width * 0.05 local split_span_width = math.floor(screen_width * 0.05)
local img_width, img_height local img_width, img_height
if Screen:getScreenMode() == "landscape" then if Screen:getScreenMode() == "landscape" then
@ -330,7 +330,7 @@ function BookStatusWidget:genBookInfoGroup()
-- progress bar -- progress bar
local read_percentage = self.view.state.page / self.total_pages local read_percentage = self.view.state.page / self.total_pages
local progress_bar = ProgressWidget:new{ local progress_bar = ProgressWidget:new{
width = width * 0.7, width = math.floor(width * 0.7),
height = Screen:scaleBySize(10), height = Screen:scaleBySize(10),
percentage = read_percentage, percentage = read_percentage,
ticks = nil, ticks = nil,
@ -478,7 +478,7 @@ function BookStatusWidget:genSummaryGroup(width)
text = self.summary.note, text = self.summary.note,
face = self.medium_font_face, face = self.medium_font_face,
width = width - self.padding * 3, width = width - self.padding * 3,
height = height * 0.75, height = math.floor(height * 0.75),
scroll = true, scroll = true,
bordersize = Size.border.default, bordersize = Size.border.default,
focused = false, focused = false,
@ -547,7 +547,7 @@ function BookStatusWidget:generateSwitchGroup(width)
end end
local switch = ToggleSwitch:new{ local switch = ToggleSwitch:new{
width = width * 0.6, width = math.floor(width * 0.6),
default_value = config.default_value, default_value = config.default_value,
name = config.name, name = config.name,
name_text = config.name_text, name_text = config.name_text,

@ -43,7 +43,7 @@ function ButtonDialog:init()
alpha = self.alpha, alpha = self.alpha,
FrameContainer:new{ FrameContainer:new{
ButtonTable:new{ ButtonTable:new{
width = Screen:getWidth()*0.9, width = math.floor(Screen:getWidth() * 0.9),
buttons = self.buttons, buttons = self.buttons,
show_parent = self, show_parent = self,
}, },

@ -65,14 +65,14 @@ function ButtonDialogTitle:init()
bordersize = 0, bordersize = 0,
TextBoxWidget:new{ TextBoxWidget:new{
text = self.title, text = self.title,
width = Screen:getWidth() * 0.8 , width = math.floor(Screen:getWidth() * 0.8),
face = self.use_info_style and self.info_face or self.title_face, face = self.use_info_style and self.info_face or self.title_face,
alignment = self.title_align or "left", alignment = self.title_align or "left",
}, },
}, },
VerticalSpan:new{ width = Size.span.vertical_default }, VerticalSpan:new{ width = Size.span.vertical_default },
ButtonTable:new{ ButtonTable:new{
width = Screen:getWidth() * 0.9, width = math.floor(Screen:getWidth() * 0.9),
buttons = self.buttons, buttons = self.buttons,
zero_sep = true, zero_sep = true,
show_parent = self, show_parent = self,

@ -1103,7 +1103,7 @@ function ConfigDialog:onConfigMoreChoose(values, name, event, args, name_text, d
-- (No support for value_table - add it if needed) -- (No support for value_table - add it if needed)
local curr_values = self.configurable[name] local curr_values = self.configurable[name]
widget = DoubleSpinWidget:new{ widget = DoubleSpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
left_text = more_options_param.left_text, left_text = more_options_param.left_text,
right_text = more_options_param.right_text, right_text = more_options_param.right_text,
left_value = curr_values[1], left_value = curr_values[1],
@ -1181,7 +1181,7 @@ function ConfigDialog:onConfigMoreChoose(values, name, event, args, name_text, d
end end
end end
widget = SpinWidget:new{ widget = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = curr_items, value = curr_items,
value_index = value_index, value_index = value_index,
value_table = more_options_param.value_table, value_table = more_options_param.value_table,

@ -37,7 +37,7 @@ function DateWidget:init()
self.light_bar = {} self.light_bar = {}
self.screen_width = Screen:getWidth() self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight() self.screen_height = Screen:getHeight()
self.width = self.screen_width * 0.95 self.width = math.floor(self.screen_width * 0.95)
if Device:hasKeys() then if Device:hasKeys() then
self.key_events = { self.key_events = {
Close = { {"Back"}, doc = "close date widget" } Close = { {"Back"}, doc = "close date widget" }
@ -62,7 +62,7 @@ end
function DateWidget:update() function DateWidget:update()
local year_widget = NumberPickerWidget:new{ local year_widget = NumberPickerWidget:new{
show_parent = self, show_parent = self,
width = self.screen_width * 0.2, width = math.floor(self.screen_width * 0.2),
value = self.year, value = self.year,
value_min = 2017, value_min = 2017,
value_max = 2037, value_max = 2037,
@ -71,7 +71,7 @@ function DateWidget:update()
} }
local month_widget = NumberPickerWidget:new{ local month_widget = NumberPickerWidget:new{
show_parent = self, show_parent = self,
width = self.screen_width * 0.2, width = math.floor(self.screen_width * 0.2),
value = self.month, value = self.month,
value_min = 1, value_min = 1,
value_max = 12, value_max = 12,
@ -80,7 +80,7 @@ function DateWidget:update()
} }
local day_widget = NumberPickerWidget:new{ local day_widget = NumberPickerWidget:new{
show_parent = self, show_parent = self,
width = self.screen_width * 0.2, width = math.floor(self.screen_width * 0.2),
value = self.day, value = self.day,
value_min = 1, value_min = 1,
value_max = 31, value_max = 31,
@ -94,7 +94,7 @@ function DateWidget:update()
alignment = "center", alignment = "center",
face = self.title_face, face = self.title_face,
bold = true, bold = true,
width = self.screen_width * 0.1, width = math.floor(self.screen_width * 0.1),
} }
local date_group = HorizontalGroup:new{ local date_group = HorizontalGroup:new{
align = "center", align = "center",
@ -113,7 +113,7 @@ function DateWidget:update()
text = self.title_text, text = self.title_text,
face = self.title_face, face = self.title_face,
bold = true, bold = true,
width = self.screen_width * 0.95, width = math.floor(self.screen_width * 0.95),
}, },
} }
local date_line = LineWidget:new{ local date_line = LineWidget:new{
@ -172,8 +172,8 @@ function DateWidget:update()
date_line, date_line,
CenterContainer:new{ CenterContainer:new{
dimen = Geom:new{ dimen = Geom:new{
w = self.screen_width * 0.95, w = math.floor(self.screen_width * 0.95),
h = date_group:getSize().h * 1.2, h = math.floor(date_group:getSize().h * 1.2),
}, },
date_group date_group
}, },

@ -247,7 +247,7 @@ function DictQuickLookup:update()
self.align = "bottom" self.align = "bottom"
end end
end end
self.height = math.min(self.region.h*0.7, Screen:getHeight()*0.5) self.height = math.floor(math.min(self.region.h*0.7, Screen:getHeight()*0.5))
end end
-- dictionary title -- dictionary title
local close_button = CloseButton:new{ window = self, padding_top = self.title_margin, } local close_button = CloseButton:new{ window = self, padding_top = self.title_margin, }
@ -310,7 +310,7 @@ function DictQuickLookup:update()
css = self:getHtmlDictionaryCss(), css = self:getHtmlDictionaryCss(),
default_font_size = Screen:scaleBySize(G_reader_settings:readSetting("dict_font_size") or 20), default_font_size = Screen:scaleBySize(G_reader_settings:readSetting("dict_font_size") or 20),
width = self.width, width = self.width,
height = self.is_fullpage and self.height*0.75 or self.height*0.7, height = self.is_fullpage and math.floor(self.height*0.75) or math.floor(self.height*0.7),
dialog = self, dialog = self,
html_link_tapped_callback = function(link) html_link_tapped_callback = function(link)
self.html_dictionary_link_tapped_callback(self.dictionary, link) self.html_dictionary_link_tapped_callback(self.dictionary, link)
@ -322,7 +322,7 @@ function DictQuickLookup:update()
face = self.content_face, face = self.content_face,
width = self.width, width = self.width,
-- get a bit more height for definition as wiki has one less button raw -- get a bit more height for definition as wiki has one less button raw
height = self.is_fullpage and self.height*0.75 or self.height*0.7, height = self.is_fullpage and math.floor(self.height*0.75) or math.floor(self.height*0.7),
dialog = self, dialog = self,
-- allow for disabling justification -- allow for disabling justification
justified = G_reader_settings:nilOrTrue("dict_justify"), justified = G_reader_settings:nilOrTrue("dict_justify"),

@ -54,8 +54,8 @@ function DoubleSpinWidget:init()
self.medium_font_face = Font:getFace("ffont") self.medium_font_face = Font:getFace("ffont")
self.screen_width = Screen:getWidth() self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight() self.screen_height = Screen:getHeight()
self.width = self.width or self.screen_width * 0.8 self.width = self.width or math.floor(self.screen_width * 0.8)
self.picker_width = self.screen_width * 0.25 self.picker_width = math.floor(self.screen_width * 0.25)
if Device:hasKeys() then if Device:hasKeys() then
self.key_events = { self.key_events = {
Close = { {"Back"}, doc = "close time widget" } Close = { {"Back"}, doc = "close time widget" }
@ -174,7 +174,7 @@ function DoubleSpinWidget:update()
TextBoxWidget:new{ TextBoxWidget:new{
text = self.info_text or "", text = self.info_text or "",
face = Font:getFace("x_smallinfofont"), face = Font:getFace("x_smallinfofont"),
width = self.width * 0.9, width = math.floor(self.width * 0.9),
} }
} }
local buttons = { local buttons = {

@ -291,7 +291,7 @@ function FootnoteWidget:init()
local added_bottom_pad = 0 local added_bottom_pad = 0
-- See if needed: -- See if needed:
-- Add a bit to bottom padding, as getSinglePageHeight() cut can be rough -- Add a bit to bottom padding, as getSinglePageHeight() cut can be rough
-- added_bottom_pad = font_size * 0.2 -- added_bottom_pad = math.floor(font_size * 0.2)
local reduced_height = single_page_height + top_border_size + padding_top + padding_bottom + added_bottom_pad local reduced_height = single_page_height + top_border_size + padding_top + padding_bottom + added_bottom_pad
vgroup = CenterContainer:new{ vgroup = CenterContainer:new{
dimen = Geom:new{ dimen = Geom:new{

@ -46,7 +46,7 @@ function FrontLightWidget:init()
self.screen_width = Screen:getWidth() self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight() self.screen_height = Screen:getHeight()
self.span = math.ceil(self.screen_height * 0.01) self.span = math.ceil(self.screen_height * 0.01)
self.width = self.screen_width * 0.95 self.width = math.floor(self.screen_width * 0.95)
self.powerd = Device:getPowerDevice() self.powerd = Device:getPowerDevice()
self.fl_min = self.powerd.fl_min self.fl_min = self.powerd.fl_min
self.fl_max = self.powerd.fl_max self.fl_max = self.powerd.fl_max
@ -155,7 +155,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
end end
self.fl_group = ProgressWidget:new{ self.fl_group = ProgressWidget:new{
width = self.screen_width * 0.9, width = math.floor(self.screen_width * 0.9),
height = Size.item.height_big, height = Size.item.height_big,
percentage = self.fl_cur / self.fl_max, percentage = self.fl_cur / self.fl_max,
ticks = ticks, ticks = ticks,
@ -167,14 +167,14 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
face = self.medium_font_face, face = self.medium_font_face,
bold = true, bold = true,
alignment = "center", alignment = "center",
width = self.screen_width * 0.95 width = math.floor(self.screen_width * 0.95),
} }
local button_minus = Button:new{ local button_minus = Button:new{
text = "-1", text = "-1",
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = enable_button_minus and not self.light_fallback, enabled = enable_button_minus and not self.light_fallback,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
show_parent = self, show_parent = self,
callback = function() self:setProgress(self.fl_cur - 1, step) end, callback = function() self:setProgress(self.fl_cur - 1, step) end,
} }
@ -183,7 +183,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = enable_button_plus and not self.light_fallback, enabled = enable_button_plus and not self.light_fallback,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
show_parent = self, show_parent = self,
callback = function() self:setProgress(self.fl_cur + 1, step) end, callback = function() self:setProgress(self.fl_cur + 1, step) end,
} }
@ -191,14 +191,14 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
text = self.fl_cur, text = self.fl_cur,
face = self.medium_font_face, face = self.medium_font_face,
alignment = "center", alignment = "center",
width = self.screen_width * 0.95 - 1.275 * button_minus.width - 1.275 * button_plus.width, width = math.floor(self.screen_width * 0.95 - 1.275 * button_minus.width - 1.275 * button_plus.width),
} }
local button_min = Button:new{ local button_min = Button:new{
text = _("Min"), text = _("Min"),
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = not self.light_fallback, enabled = not self.light_fallback,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
show_parent = self, show_parent = self,
callback = function() self:setProgress(self.fl_min+1, step) end, -- min is 1 (use toggle for 0) callback = function() self:setProgress(self.fl_min+1, step) end, -- min is 1 (use toggle for 0)
} }
@ -207,7 +207,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = not self.light_fallback, enabled = not self.light_fallback,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
show_parent = self, show_parent = self,
callback = function() self:setProgress(self.fl_max, step) end, callback = function() self:setProgress(self.fl_max, step) end,
} }
@ -216,14 +216,14 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = not self.light_fallback, enabled = not self.light_fallback,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
show_parent = self, show_parent = self,
callback = function() callback = function()
self:setProgress(self.fl_min, step) self:setProgress(self.fl_min, step)
end, end,
} }
local empty_space = HorizontalSpan:new{ local empty_space = HorizontalSpan:new{
width = (self.screen_width * 0.95 - 1.2 * button_minus.width - 1.2 * button_plus.width - 1.2 * button_toggle.width) / 2, width = math.floor((self.screen_width * 0.95 - 1.2 * button_minus.width - 1.2 * button_plus.width - 1.2 * button_toggle.width) / 2),
} }
local button_table_up = HorizontalGroup:new{ local button_table_up = HorizontalGroup:new{
align = "center", align = "center",
@ -280,7 +280,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth)
text = _("Configure"), text = _("Configure"),
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
enabled = not self.nl_configure_open, enabled = not self.nl_configure_open,
show_parent = self, show_parent = self,
callback = function() callback = function()
@ -357,14 +357,14 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
face = self.medium_font_face, face = self.medium_font_face,
bold = true, bold = true,
alignment = "center", alignment = "center",
width = self.screen_width * 0.95 width = math.floor(self.screen_width * 0.95),
} }
local button_minus = Button:new{ local button_minus = Button:new{
text = "-" .. (1 * self.nl_scale), text = "-" .. (1 * self.nl_scale),
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = enable_button_minus, enabled = enable_button_minus,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
show_parent = self, show_parent = self,
callback = function() self:setProgress(self.fl_cur, step, (num_warmth - (1 * self.nl_scale))) end, callback = function() self:setProgress(self.fl_cur, step, (num_warmth - (1 * self.nl_scale))) end,
} }
@ -373,7 +373,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = enable_button_plus, enabled = enable_button_plus,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
show_parent = self, show_parent = self,
callback = function() self:setProgress(self.fl_cur, step, (num_warmth + (1 * self.nl_scale))) end, callback = function() self:setProgress(self.fl_cur, step, (num_warmth + (1 * self.nl_scale))) end,
} }
@ -381,14 +381,14 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
text = num_warmth, text = num_warmth,
face = self.medium_font_face, face = self.medium_font_face,
alignment = "center", alignment = "center",
width = self.screen_width * 0.95 - 1.275 * button_minus.width - 1.275 * button_plus.width, width = math.floor(self.screen_width * 0.95 - 1.275 * button_minus.width - 1.275 * button_plus.width),
} }
local button_min = Button:new{ local button_min = Button:new{
text = _("Min"), text = _("Min"),
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = not self.powerd.auto_warmth, enabled = not self.powerd.auto_warmth,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
show_parent = self, show_parent = self,
callback = function() self:setProgress(self.fl_cur, step, self.nl_min) end, callback = function() self:setProgress(self.fl_cur, step, self.nl_min) end,
} }
@ -397,12 +397,12 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = not self.powerd.auto_warmth, enabled = not self.powerd.auto_warmth,
width = self.screen_width * 0.20, width = math.floor(self.screen_width * 0.2),
show_parent = self, show_parent = self,
callback = function() self:setProgress(self.fl_cur, step, (self.nl_max * self.nl_scale)) end, callback = function() self:setProgress(self.fl_cur, step, (self.nl_max * self.nl_scale)) end,
} }
local empty_space = HorizontalSpan:new{ local empty_space = HorizontalSpan:new{
width = (self.screen_width * 0.95 - 1.2 * button_minus.width - 1.2 * button_plus.width) / 2, width = math.floor((self.screen_width * 0.95 - 1.2 * button_minus.width - 1.2 * button_plus.width) / 2),
} }
local button_table_up = HorizontalGroup:new{ local button_table_up = HorizontalGroup:new{
align = "center", align = "center",
@ -437,7 +437,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
alignment = "right", alignment = "right",
fgcolor = self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or fgcolor = self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or
Blitbuffer.COLOR_DARK_GRAY, Blitbuffer.COLOR_DARK_GRAY,
width = self.screen_width * 0.3 width = math.floor(self.screen_width * 0.3),
} }
local text_hour = TextBoxWidget:new{ local text_hour = TextBoxWidget:new{
text = " " .. math.floor(self.powerd.max_warmth_hour) .. ":" .. text = " " .. math.floor(self.powerd.max_warmth_hour) .. ":" ..
@ -446,14 +446,14 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
alignment = "center", alignment = "center",
fgcolor =self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or fgcolor =self.powerd.auto_warmth and Blitbuffer.COLOR_BLACK or
Blitbuffer.COLOR_DARK_GRAY, Blitbuffer.COLOR_DARK_GRAY,
width = self.screen_width * 0.15 width = math.floor(self.screen_width * 0.15),
} }
local button_minus_one_hour = Button:new{ local button_minus_one_hour = Button:new{
text = "", text = "",
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = self.powerd.auto_warmth, enabled = self.powerd.auto_warmth,
width = self.screen_width * 0.1, width = math.floor(self.screen_width * 0.1),
show_parent = self, show_parent = self,
callback = function() callback = function()
self.powerd.max_warmth_hour = self.powerd.max_warmth_hour =
@ -473,7 +473,7 @@ function FrontLightWidget:addWarmthWidgets(num_warmth, step, vertical_group)
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
enabled = self.powerd.auto_warmth, enabled = self.powerd.auto_warmth,
width = self.screen_width * 0.1, width = math.floor(self.screen_width * 0.1),
show_parent = self, show_parent = self,
callback = function() callback = function()
self.powerd.max_warmth_hour = self.powerd.max_warmth_hour =
@ -542,14 +542,14 @@ function FrontLightWidget:update()
text = _("Frontlight"), text = _("Frontlight"),
face = self.title_face, face = self.title_face,
bold = true, bold = true,
width = self.screen_width * 0.95, width = math.floor(self.screen_width * 0.95),
}, },
} }
local light_level = FrameContainer:new{ local light_level = FrameContainer:new{
padding = Size.padding.button, padding = Size.padding.button,
margin = Size.margin.small, margin = Size.margin.small,
bordersize = 0, bordersize = 0,
self:generateProgressGroup(self.screen_width * 0.95, self.screen_height * 0.20, self:generateProgressGroup(math.floor(self.screen_width * 0.95), math.floor(self.screen_height * 0.2),
self.fl_cur, self.one_step) self.fl_cur, self.one_step)
} }
local light_line = LineWidget:new{ local light_line = LineWidget:new{

@ -207,12 +207,12 @@ function InputDialog:init()
self.width = Screen:getWidth() - 2*self.border_size self.width = Screen:getWidth() - 2*self.border_size
self.covers_fullscreen = true -- hint for UIManager:_repaint() self.covers_fullscreen = true -- hint for UIManager:_repaint()
else else
self.width = self.width or Screen:getWidth() * 0.8 self.width = self.width or math.floor(Screen:getWidth() * 0.8)
end end
if self.condensed then if self.condensed then
self.text_width = self.width - 2*(self.border_size + self.input_padding + self.input_margin) self.text_width = self.width - 2*(self.border_size + self.input_padding + self.input_margin)
else else
self.text_width = self.text_width or self.width * 0.9 self.text_width = self.text_width or math.floor(self.width * 0.9)
end end
if self.readonly then -- hide keyboard if we can't edit if self.readonly then -- hide keyboard if we can't edit
self.keyboard_hidden = true self.keyboard_hidden = true

@ -25,7 +25,7 @@ local KeyboardLayoutDialog = InputContainer:new{
is_always_active = true, is_always_active = true,
title = _("Keyboard layout"), title = _("Keyboard layout"),
modal = true, modal = true,
width = Screen:getWidth() * 0.8, width = math.floor(Screen:getWidth() * 0.8),
face = Font:getFace("cfont", 22), face = Font:getFace("cfont", 22),
title_face = Font:getFace("x_smalltfont"), title_face = Font:getFace("x_smalltfont"),
title_padding = Size.padding.default, title_padding = Size.padding.default,
@ -86,7 +86,7 @@ function KeyboardLayoutDialog:init()
self.radio_button_table = RadioButtonTable:new{ self.radio_button_table = RadioButtonTable:new{
radio_buttons = radio_buttons, radio_buttons = radio_buttons,
width = self.width * 0.9, width = math.floor(self.width * 0.9),
focused = true, focused = true,
scroll = false, scroll = false,
parent = self, parent = self,

@ -28,7 +28,7 @@ function LoginDialog:init()
text = self.username, text = self.username,
hint = self.username_hint, hint = self.username_hint,
face = self.input_face, face = self.input_face,
width = self.width * 0.9, width = math.floor(self.width * 0.9),
focused = true, focused = true,
scroll = false, scroll = false,
parent = self, parent = self,
@ -38,7 +38,7 @@ function LoginDialog:init()
text = self.password, text = self.password,
hint = self.password_hint, hint = self.password_hint,
face = self.input_face, face = self.input_face,
width = self.width * 0.9, width = math.floor(self.width * 0.9),
text_type = "password", text_type = "password",
focused = false, focused = false,
scroll = false, scroll = false,

@ -42,7 +42,7 @@ function MultiInputDialog:init()
input_type = field.input_type or "string", input_type = field.input_type or "string",
text_type = field.text_type, text_type = field.text_type,
face = self.input_face, face = self.input_face,
width = self.width * 0.9, width = math.floor(self.width * 0.9),
focused = k == 1 and true or false, focused = k == 1 and true or false,
scroll = false, scroll = false,
parent = self, parent = self,
@ -68,7 +68,7 @@ function MultiInputDialog:init()
TextBoxWidget:new{ TextBoxWidget:new{
text = field.description, text = field.description,
face = Font:getFace("x_smallinfofont"), face = Font:getFace("x_smallinfofont"),
width = self.width * 0.9, width = math.floor(self.width * 0.9),
} }
} }
table.insert(VerticalGroupData, CenterContainer:new{ table.insert(VerticalGroupData, CenterContainer:new{

@ -46,7 +46,7 @@ function NaturalLightWidget:init()
self.screen_width = Screen:getWidth() self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight() self.screen_height = Screen:getHeight()
self.span = math.ceil(self.screen_height * 0.01) self.span = math.ceil(self.screen_height * 0.01)
self.width = self.screen_width*0.95 self.width = math.floor(self.screen_width * 0.95)
self.button_width = 0.08 * self.width self.button_width = 0.08 * self.width
self.textbox_width = 0.1 * self.width self.textbox_width = 0.1 * self.width
self.text_width = 0.2 * self.width self.text_width = 0.2 * self.width
@ -149,15 +149,15 @@ function NaturalLightWidget:createFrame()
text = _("Natural light configuration"), text = _("Natural light configuration"),
face = self.title_face, face = self.title_face,
bold = true, bold = true,
width = self.screen_width * 0.95, width = math.floor(self.screen_width * 0.95),
}, },
} }
local main_content = FrameContainer:new{ local main_content = FrameContainer:new{
padding = Size.padding.button, padding = Size.padding.button,
margin = Size.margin.small, margin = Size.margin.small,
bordersize = 0, bordersize = 0,
self:createMainContent(self.screen_width * 0.95, self:createMainContent(math.floor(self.screen_width * 0.95),
self.screen_height * 0.201) math.floor(self.screen_height * 0.2))
} }
local nl_line = LineWidget:new{ local nl_line = LineWidget:new{
dimen = Geom:new{ dimen = Geom:new{
@ -272,7 +272,7 @@ function NaturalLightWidget:createMainContent(width, height)
text = "Restore Defaults", text = "Restore Defaults",
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
width = self.width * 0.35, width = math.floor(self.width * 0.35),
show_parent = self, show_parent = self,
callback = function() callback = function()
self:setAllValues({white_gain = 25, self:setAllValues({white_gain = 25,
@ -288,7 +288,7 @@ function NaturalLightWidget:createMainContent(width, height)
text = "Cancel", text = "Cancel",
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
width = self.width * 0.2, width = math.floor(self.width * 0.2),
show_parent = self, show_parent = self,
callback = function() callback = function()
self:setAllValues(self.old_values) self:setAllValues(self.old_values)
@ -299,7 +299,7 @@ function NaturalLightWidget:createMainContent(width, height)
text = "Save", text = "Save",
margin = Size.margin.small, margin = Size.margin.small,
radius = 0, radius = 0,
width = self.width * 0.2, width = math.floor(self.width * 0.2),
show_parent = self, show_parent = self,
callback = function() callback = function()
G_reader_settings:saveSetting("natural_light_config", G_reader_settings:saveSetting("natural_light_config",

@ -56,7 +56,7 @@ function NumberPickerWidget:init()
self.screen_width = Screen:getWidth() self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight() self.screen_height = Screen:getHeight()
if self.width == nil then if self.width == nil then
self.width = self.screen_width * 0.2 self.width = math.floor(self.screen_width * 0.2)
end end
if self.value_table then if self.value_table then
self.value_index = self.value_index or 1 self.value_index = self.value_index or 1
@ -116,7 +116,7 @@ function NumberPickerWidget:paintWidget()
} }
local empty_space = VerticalSpan:new{ local empty_space = VerticalSpan:new{
width = self.screen_height * 0.01 width = math.ceil(self.screen_height * 0.01)
} }
local value = self.value local value = self.value
if not self.value_table then if not self.value_table then

@ -195,8 +195,8 @@ function OPDSBrowser:addNewCatalog()
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.add_server_dialog) UIManager:show(self.add_server_dialog)
self.add_server_dialog:onShowKeyboard() self.add_server_dialog:onShowKeyboard()
@ -245,8 +245,8 @@ function OPDSBrowser:editCalibreServer()
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.add_server_dialog) UIManager:show(self.add_server_dialog)
self.add_server_dialog:onShowKeyboard() self.add_server_dialog:onShowKeyboard()
@ -792,8 +792,8 @@ function OPDSBrowser:editOPDSServer(item)
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
} }
UIManager:show(self.edit_server_dialog) UIManager:show(self.edit_server_dialog)
self.edit_server_dialog:onShowKeyboard() self.edit_server_dialog:onShowKeyboard()

@ -28,7 +28,7 @@ function OpenWithDialog:init()
self.radio_button_table = RadioButtonTable:new{ self.radio_button_table = RadioButtonTable:new{
radio_buttons = self.radio_buttons, radio_buttons = self.radio_buttons,
width = self.width * 0.9, width = math.floor(self.width * 0.9),
focused = true, focused = true,
scroll = false, scroll = false,
parent = self, parent = self,
@ -45,8 +45,8 @@ function OpenWithDialog:init()
end end
end, end,
width = self.width * 0.9, width = math.floor(self.width * 0.9),
max_width = self.width * 0.9 - 2*Size.border.window, max_width = math.floor(self.width * 0.9 - 2 * Size.border.window),
height = self.height, height = self.height,
face = self.face, face = self.face,
@ -55,7 +55,7 @@ function OpenWithDialog:init()
self._always_file_toggle = LeftContainer:new{ self._always_file_toggle = LeftContainer:new{
bordersize = 0, bordersize = 0,
dimen = Geom:new{ dimen = Geom:new{
w = self.width * 0.9, w = math.floor(self.width * 0.9),
h = self._check_file_button:getSize().h, h = self._check_file_button:getSize().h,
}, },
self._check_file_button, self._check_file_button,
@ -71,8 +71,8 @@ function OpenWithDialog:init()
end end
end, end,
width = self.width * 0.9, width = math.floor(self.width * 0.9),
max_width = self.width * 0.9 - 2*Size.border.window, max_width = math.floor(self.width * 0.9 - 2 * Size.border.window),
height = self.height, height = self.height,
face = self.face, face = self.face,
@ -81,7 +81,7 @@ function OpenWithDialog:init()
self._always_global_toggle = LeftContainer:new{ self._always_global_toggle = LeftContainer:new{
bordersize = 0, bordersize = 0,
dimen = Geom:new{ dimen = Geom:new{
w = self.width * 0.9, w = math.floor(self.width * 0.9),
h = self._check_global_button:getSize().h, h = self._check_global_button:getSize().h,
}, },
self._check_global_button, self._check_global_button,
@ -115,7 +115,7 @@ function OpenWithDialog:init()
LineWidget:new{ LineWidget:new{
background = Blitbuffer.COLOR_DARK_GRAY, background = Blitbuffer.COLOR_DARK_GRAY,
dimen = Geom:new{ dimen = Geom:new{
w = self.width * 0.9, w = math.floor(self.width * 0.9),
h = Size.line.medium, h = Size.line.medium,
} }
}, },

@ -280,7 +280,7 @@ function SortWidget:init()
width = self.width_widget * 22 / 100, width = self.width_widget * 22 / 100,
} }
local button_vertical_line = LineWidget:new{ local button_vertical_line = LineWidget:new{
dimen = Geom:new{ w = Size.line.thick, h = self.item_height * 1.25 }, dimen = Geom:new{ w = Size.line.thick, h = math.floor(self.item_height * 1.25) },
background = Blitbuffer.COLOR_DARK_GRAY, background = Blitbuffer.COLOR_DARK_GRAY,
style = "solid", style = "solid",
} }

@ -26,7 +26,7 @@ local SpinWidget = InputContainer:new{
title_text = "", title_text = "",
title_face = Font:getFace("x_smalltfont"), title_face = Font:getFace("x_smalltfont"),
info_text = nil, info_text = nil,
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight(), height = Screen:getHeight(),
value_table = nil, value_table = nil,
value_index = nil, value_index = nil,
@ -80,7 +80,7 @@ function SpinWidget:update()
local picker_update_callback = function() end local picker_update_callback = function() end
local value_widget = NumberPickerWidget:new{ local value_widget = NumberPickerWidget:new{
show_parent = self, show_parent = self,
width = self.screen_width * 0.2, width = math.floor(self.screen_width * 0.2),
value = self.value, value = self.value,
value_table = self.value_table, value_table = self.value_table,
value_index = self.value_index, value_index = self.value_index,
@ -199,14 +199,14 @@ function SpinWidget:update()
TextBoxWidget:new{ TextBoxWidget:new{
text = self.info_text, text = self.info_text,
face = Font:getFace("x_smallinfofont"), face = Font:getFace("x_smallinfofont"),
width = self.width * 0.9, width = math.floor(self.width * 0.9),
} }
}) })
end end
table.insert(vgroup, CenterContainer:new{ table.insert(vgroup, CenterContainer:new{
dimen = Geom:new{ dimen = Geom:new{
w = self.width, w = self.width,
h = value_group:getSize().h + self.screen_height * 0.1, h = value_group:getSize().h + math.floor(self.screen_height * 0.1),
}, },
value_group value_group
}) })

@ -37,7 +37,7 @@ function TimeWidget:init()
self.light_bar = {} self.light_bar = {}
self.screen_width = Screen:getWidth() self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight() self.screen_height = Screen:getHeight()
self.width = self.screen_width * 0.95 self.width = math.floor(self.screen_width * 0.95)
if Device:hasKeys() then if Device:hasKeys() then
self.key_events = { self.key_events = {
Close = { {"Back"}, doc = "close time widget" } Close = { {"Back"}, doc = "close time widget" }
@ -62,7 +62,7 @@ end
function TimeWidget:update() function TimeWidget:update()
local hour_widget = NumberPickerWidget:new{ local hour_widget = NumberPickerWidget:new{
show_parent = self, show_parent = self,
width = self.screen_width * 0.2, width = math.floor(self.screen_width * 0.2),
value = self.hour, value = self.hour,
value_min = 0, value_min = 0,
value_max = self.hour_max, value_max = self.hour_max,
@ -71,7 +71,7 @@ function TimeWidget:update()
} }
local min_widget = NumberPickerWidget:new{ local min_widget = NumberPickerWidget:new{
show_parent = self, show_parent = self,
width = self.screen_width * 0.2, width = math.floor(self.screen_width * 0.2),
value = self.min, value = self.min,
value_min = 0, value_min = 0,
value_max = 59, value_max = 59,
@ -83,7 +83,7 @@ function TimeWidget:update()
alignment = "center", alignment = "center",
face = self.title_face, face = self.title_face,
bold = true, bold = true,
width = self.screen_width * 0.2, width = math.floor(self.screen_width * 0.2),
} }
local time_group = HorizontalGroup:new{ local time_group = HorizontalGroup:new{
align = "center", align = "center",
@ -101,7 +101,7 @@ function TimeWidget:update()
text = self.title_text, text = self.title_text,
face = self.title_face, face = self.title_face,
bold = true, bold = true,
max_width = self.screen_width * 0.95 - closebutton:getSize().w, max_width = math.floor(self.screen_width * 0.95) - closebutton:getSize().w,
}, },
} }
local time_line = LineWidget:new{ local time_line = LineWidget:new{
@ -158,8 +158,8 @@ function TimeWidget:update()
time_line, time_line,
CenterContainer:new{ CenterContainer:new{
dimen = Geom:new{ dimen = Geom:new{
w = self.screen_width * 0.95, w = math.floor(self.screen_width * 0.95),
h = time_group:getSize().h * 1.2, h = math.floor(time_group:getSize().h * 1.2),
}, },
time_group time_group
}, },

@ -484,8 +484,8 @@ function TouchMenu:init()
local up_button = IconButton:new{ local up_button = IconButton:new{
icon_file = "resources/icons/appbar.chevron.up.png", icon_file = "resources/icons/appbar.chevron.up.png",
show_parent = self.show_parent, show_parent = self.show_parent,
padding_left = footer_width*0.33*0.1, padding_left = math.floor(footer_width*0.33*0.1),
padding_right = footer_width*0.33*0.1, padding_right = math.floor(footer_width*0.33*0.1),
callback = function() callback = function()
self:backToUpperMenu() self:backToUpperMenu()
end, end,
@ -493,15 +493,15 @@ function TouchMenu:init()
local footer_height = up_button:getSize().h + Size.line.thick local footer_height = up_button:getSize().h + Size.line.thick
self.footer = HorizontalGroup:new{ self.footer = HorizontalGroup:new{
LeftContainer:new{ LeftContainer:new{
dimen = Geom:new{ w = footer_width*0.33, h = footer_height}, dimen = Geom:new{ w = math.floor(footer_width*0.33), h = footer_height},
up_button, up_button,
}, },
CenterContainer:new{ CenterContainer:new{
dimen = Geom:new{ w = footer_width*0.33, h = footer_height}, dimen = Geom:new{ w = math.floor(footer_width*0.33), h = footer_height},
self.page_info, self.page_info,
}, },
RightContainer:new{ RightContainer:new{
dimen = Geom:new{ w = footer_width*0.33, h = footer_height}, dimen = Geom:new{ w = math.floor(footer_width*0.33), h = footer_height},
self.device_info, self.device_info,
} }
} }

@ -536,8 +536,8 @@ function Wikipedia:addImages(page, lang, more_images, image_size_factor, hi_imag
local height = wimage.height or 100 local height = wimage.height or 100
-- Give a little boost in size to thin images -- Give a little boost in size to thin images
if width < height / 2 or height < width / 2 then if width < height / 2 or height < width / 2 then
width = width * 1.3 width = math.floor(width * 1.3)
height = height * 1.3 height = math.floor(height * 1.3)
end end
width = math.ceil(width * image_size_factor) width = math.ceil(width * image_size_factor)
height = math.ceil(height * image_size_factor) height = math.ceil(height * image_size_factor)

@ -1 +1 @@
Subproject commit 5cd2962aae063b3d522196244a997e56f4d958ec Subproject commit 8cb68727e2b723759c468f25472191e3415676ec

@ -141,7 +141,7 @@ function AutoSuspend:addToMainMenu(menu_items)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local curr_items = G_reader_settings:readSetting("auto_suspend_timeout_seconds") or 60*60 local curr_items = G_reader_settings:readSetting("auto_suspend_timeout_seconds") or 60*60
local autosuspend_spin = SpinWidget:new { local autosuspend_spin = SpinWidget:new {
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = curr_items / 60, value = curr_items / 60,
value_min = 5, value_min = 5,
value_max = 240, value_max = 240,
@ -173,7 +173,7 @@ function AutoSuspend:addToMainMenu(menu_items)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local curr_items = self.autoshutdown_timeout_seconds local curr_items = self.autoshutdown_timeout_seconds
local autosuspend_spin = SpinWidget:new { local autosuspend_spin = SpinWidget:new {
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = curr_items / 60 / 60, value = curr_items / 60 / 60,
-- About a minute, good for testing and battery life fanatics. -- About a minute, good for testing and battery life fanatics.
-- Just high enough to avoid an instant shutdown death scenario. -- Just high enough to avoid an instant shutdown death scenario.

@ -120,7 +120,7 @@ function AutoTurn:addToMainMenu(menu_items)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local curr_items = G_reader_settings:readSetting("autoturn_timeout_seconds") or 30 local curr_items = G_reader_settings:readSetting("autoturn_timeout_seconds") or 30
local autoturn_spin = SpinWidget:new { local autoturn_spin = SpinWidget:new {
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = curr_items, value = curr_items,
value_min = 0, value_min = 0,
value_max = 240, value_max = 240,
@ -151,7 +151,7 @@ function AutoTurn:addToMainMenu(menu_items)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local curr_items = G_reader_settings:readSetting("autoturn_distance") or 1 local curr_items = G_reader_settings:readSetting("autoturn_distance") or 1
local autoturn_spin = SpinWidget:new { local autoturn_spin = SpinWidget:new {
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = curr_items, value = curr_items,
value_min = -20, value_min = -20,
value_max = 20, value_max = 20,

@ -422,7 +422,7 @@ function CoverBrowser:addToMainMenu(menu_items)
-- value of 10 if it hasn't. -- value of 10 if it hasn't.
local curr_items = BookInfoManager:getSetting("files_per_page") or 10 local curr_items = BookInfoManager:getSetting("files_per_page") or 10
local items = SpinWidget:new{ local items = SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = curr_items, value = curr_items,
value_min = 4, value_min = 4,
value_max = 20, value_max = 20,

@ -377,8 +377,8 @@ function EvernoteExporter:login()
}, },
}, },
}, },
width = Screen:getWidth() * 0.8, width = math.floor(Screen:getWidth() * 0.8),
height = Screen:getHeight() * 0.4, height = math.floor(Screen:getHeight() * 0.4),
} }
UIManager:show(self.login_dialog) UIManager:show(self.login_dialog)

@ -97,7 +97,7 @@ function GoodreadsBook:genHeader(title)
end end
function GoodreadsBook:genBookInfoGroup() function GoodreadsBook:genBookInfoGroup()
local split_span_width = self.screen_width * 0.05 local split_span_width = math.floor(self.screen_width * 0.05)
local img_width, img_height local img_width, img_height
if Screen:getScreenMode() == "landscape" then if Screen:getScreenMode() == "landscape" then
img_width = Screen:scaleBySize(132) img_width = Screen:scaleBySize(132)
@ -133,7 +133,7 @@ function GoodreadsBook:genBookInfoGroup()
} }
) )
--span --span
local span_author = VerticalSpan:new{ width = height * 0.1 } local span_author = VerticalSpan:new{ width = math.floor(height * 0.1) }
table.insert(book_meta_info_group, table.insert(book_meta_info_group,
CenterContainer:new{ CenterContainer:new{
dimen = Geom:new{ w = width, h = Screen:scaleBySize(10) }, dimen = Geom:new{ w = width, h = Screen:scaleBySize(10) },
@ -218,7 +218,7 @@ function GoodreadsBook:genBookInfoGroup()
book_meta_info_group, book_meta_info_group,
}) })
return CenterContainer:new{ return CenterContainer:new{
dimen = Geom:new{ w = self.screen_width, h = self.screen_height * 0.35 }, dimen = Geom:new{ w = self.screen_width, h = math.floor(self.screen_height * 0.35) },
book_info_group, book_info_group,
} }
end end
@ -244,13 +244,13 @@ function GoodreadsBook:bookReview()
ScrollHtmlWidget:new{ ScrollHtmlWidget:new{
html_body = self.dates.description, html_body = self.dates.description,
css = css, css = css,
width = self.screen_width * 0.9, width = math.floor(self.screen_width * 0.9),
height = self.screen_height * 0.48, height = math.floor(self.screen_height * 0.48),
dialog = self, dialog = self,
} }
} }
return CenterContainer:new{ return CenterContainer:new{
dimen = Geom:new{ w = self.screen_width, h = self.screen_height * 0.50 }, dimen = Geom:new{ w = self.screen_width, h = math.floor(self.screen_height * 0.5) },
book_meta_info_group, book_meta_info_group,
} }
end end

@ -146,8 +146,8 @@ How to generate a key and a secret key:
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
input_type = "text", input_type = "text",
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)

@ -361,8 +361,8 @@ function KOSync:login()
}, },
}, },
}, },
width = Screen:getWidth() * 0.8, width = math.floor(Screen:getWidth() * 0.8),
height = Screen:getHeight() * 0.4, height = math.floor(Screen:getHeight() * 0.4),
} }
UIManager:show(self.login_dialog) UIManager:show(self.login_dialog)

@ -52,8 +52,8 @@ function PerceptionExpander:createUI(readSettings)
self.screen_width = Screen:getWidth() self.screen_width = Screen:getWidth()
local screen_height = Screen:getHeight() local screen_height = Screen:getHeight()
local line_height = screen_height * 0.9 local line_height = math.floor(screen_height * 0.9)
local line_top_position = screen_height * 0.05 local line_top_position = math.floor(screen_height * 0.05)
self.last_screen_mode = Screen:getScreenMode() self.last_screen_mode = Screen:getScreenMode()
if self.last_screen_mode == "landscape" then if self.last_screen_mode == "landscape" then
@ -152,8 +152,8 @@ function PerceptionExpander:showSettingsDialog()
}, },
}, },
}, },
width = Screen:getWidth() * 0.8, width = math.floor(Screen:getWidth() * 0.8),
height = Screen:getHeight() * 0.3, height = math.floor(Screen:getHeight() * 0.3),
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)
self.settings_dialog:onShowKeyboard() self.settings_dialog:onShowKeyboard()

@ -789,7 +789,7 @@ The max value ensures a page you stay on for a long time (because you fell aslee
callback = function(touchmenu_instance) callback = function(touchmenu_instance)
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
UIManager:show(SpinWidget:new{ UIManager:show(SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = self.calendar_nb_book_spans, value = self.calendar_nb_book_spans,
value_min = 1, value_min = 1,
value_max = 5, value_max = 5,

@ -47,7 +47,7 @@ function ReaderProgress:init()
self.large_font_face = Font:getFace("largeffont") self.large_font_face = Font:getFace("largeffont")
self.screen_width = Screen:getWidth() self.screen_width = Screen:getWidth()
self.screen_height = Screen:getHeight() self.screen_height = Screen:getHeight()
if Screen:getWidth() < Screen:getHeight() then if self.screen_width < self.screen_height then
self.header_span = 25 self.header_span = 25
self.stats_span = 20 self.stats_span = 20
else else
@ -256,7 +256,7 @@ function ReaderProgress:genWeekStats(stats_day)
LeftContainer:new{ LeftContainer:new{
dimen = Geom:new{ w = self.screen_width , h = height / 3 }, dimen = Geom:new{ w = self.screen_width , h = height / 3 },
ProgressWidget:new{ ProgressWidget:new{
width = (self.screen_width * 0.005) + (self.screen_width * 0.9 * select_day_time / max_week_time), width = math.floor((self.screen_width * 0.005) + (self.screen_width * 0.9 * select_day_time / max_week_time)),
height = Screen:scaleBySize(14), height = Screen:scaleBySize(14),
percentage = 1.0, percentage = 1.0,
ticks = nil, ticks = nil,
@ -272,7 +272,7 @@ function ReaderProgress:genWeekStats(stats_day)
end --for i=1 end --for i=1
table.insert(statistics_container, statistics_group) table.insert(statistics_container, statistics_group)
return CenterContainer:new{ return CenterContainer:new{
dimen = Geom:new{ w = self.screen_width * 1.1 , h = self.screen_height * 0.50 }, dimen = Geom:new{ w = math.floor(self.screen_width * 1.1), h = math.floor(self.screen_height * 0.5) },
statistics_container, statistics_container,
} }
end end
@ -365,7 +365,7 @@ function ReaderProgress:genSummaryDay(width)
table.insert(statistics_group, span_group) table.insert(statistics_group, span_group)
table.insert(statistics_container, statistics_group) table.insert(statistics_container, statistics_group)
return CenterContainer:new{ return CenterContainer:new{
dimen = Geom:new{ w = self.screen_width , h = self.screen_height * 0.13 }, dimen = Geom:new{ w = self.screen_width , h = math.floor(self.screen_height * 0.13) },
statistics_container, statistics_container,
} }
end end
@ -490,7 +490,7 @@ function ReaderProgress:genSummaryWeek(width)
table.insert(statistics_group, data_group) table.insert(statistics_group, data_group)
table.insert(statistics_container, statistics_group) table.insert(statistics_container, statistics_group)
return CenterContainer:new{ return CenterContainer:new{
dimen = Geom:new{ w = self.screen_width , h = self.screen_height * 0.10 }, dimen = Geom:new{ w = self.screen_width , h = math.floor(self.screen_height * 0.10) },
statistics_container, statistics_container,
} }
end end

@ -26,7 +26,7 @@ function Terminal:start()
title = _("Enter a command and press \"Execute\""), title = _("Enter a command and press \"Execute\""),
input = self.command, input = self.command,
para_direction_rtl = false, -- force LTR para_direction_rtl = false, -- force LTR
text_height = Screen:getHeight() * 0.4, text_height = math.floor(Screen:getHeight() * 0.4),
input_type = "string", input_type = "string",
buttons = {{{ buttons = {{{
text = _("Cancel"), text = _("Cancel"),

@ -95,7 +95,7 @@ function TextEditor:getSubMenuItems()
local SpinWidget = require("ui/widget/spinwidget") local SpinWidget = require("ui/widget/spinwidget")
local font_size = self.font_size local font_size = self.font_size
UIManager:show(SpinWidget:new{ UIManager:show(SpinWidget:new{
width = Screen:getWidth() * 0.6, width = math.floor(Screen:getWidth() * 0.6),
value = font_size, value = font_size,
value_min = 8, value_min = 8,
value_max = 26, value_max = 26,

@ -936,8 +936,8 @@ Restart KOReader after editing the config file.]]), BD.dirpath(DataStorage:getSe
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
input_type = "string", input_type = "string",
} }
UIManager:show(self.settings_dialog) UIManager:show(self.settings_dialog)
@ -976,8 +976,8 @@ function Wallabag:editClientSettings()
}, },
}, },
}, },
width = Screen:getWidth() * 0.95, width = math.floor(Screen:getWidth() * 0.95),
height = Screen:getHeight() * 0.2, height = math.floor(Screen:getHeight() * 0.2),
input_type = "string", input_type = "string",
} }
UIManager:show(self.client_settings_dialog) UIManager:show(self.client_settings_dialog)

@ -36,7 +36,7 @@ describe("InputContainer widget", function()
assert.is.same("bar", ic._ordered_touch_zones[2].def.id) assert.is.same("bar", ic._ordered_touch_zones[2].def.id)
assert.is.same("tap", ic._ordered_touch_zones[2].gs_range.ges) assert.is.same("tap", ic._ordered_touch_zones[2].gs_range.ges)
assert.is.same(0, ic._ordered_touch_zones[2].gs_range.range.x) assert.is.same(0, ic._ordered_touch_zones[2].gs_range.range.x)
assert.is.same(screen_height * 0.1, ic._ordered_touch_zones[2].gs_range.range.y) assert.is.same(math.floor(screen_height * 0.1), ic._ordered_touch_zones[2].gs_range.range.y)
assert.is.same(screen_width / 2, ic._ordered_touch_zones[2].gs_range.range.w) assert.is.same(screen_width / 2, ic._ordered_touch_zones[2].gs_range.range.w)
assert.is.same(screen_height, ic._ordered_touch_zones[2].gs_range.range.h) assert.is.same(screen_height, ic._ordered_touch_zones[2].gs_range.range.h)
end) end)

Loading…
Cancel
Save