Skip to content

Correct Frontlight status on suspend when screensaver mode is 'Leave …#5928

Merged
Frenzie merged 4 commits intokoreader:masterfrom
clarkspark:screensaver_landscape
Mar 8, 2020
Merged

Correct Frontlight status on suspend when screensaver mode is 'Leave …#5928
Frenzie merged 4 commits intokoreader:masterfrom
clarkspark:screensaver_landscape

Conversation

@clarkspark
Copy link
Copy Markdown
Contributor

@clarkspark clarkspark commented Mar 7, 2020

Address #5920 to correct Frontlight status on suspend when screensaver mode is 'Leave screen as it is' in landscape mode.


This change is Reviewable

@NiLuJe
Copy link
Copy Markdown
Member

NiLuJe commented Mar 7, 2020

I'd add a ref to your own issue in the comment above that already does the same for #4098, but that's just me ;).

@clarkspark
Copy link
Copy Markdown
Contributor Author

Sorry I'm not too familiar with the workings of github, I thought adding the #5290 would do that. Or do you mean adding a short synopsis of the issue here?

@NiLuJe
Copy link
Copy Markdown
Member

NiLuJe commented Mar 7, 2020

No, I meant in the actual code ;).

@NiLuJe
Copy link
Copy Markdown
Member

NiLuJe commented Mar 7, 2020

👍, lgtm, thanks ;).

@clarkspark
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback, and the great software.

if G_reader_settings:readSetting("screensaver_type") ~= "message" then
-- ... except when we just show an InfoMessage or when the screensaver
-- is disabled, as it plays badly with Landscape mode (c.f., #4098 and #5290)
if (G_reader_settings:readSetting("screensaver_type") ~= "message" and G_reader_settings:readSetting("screensaver_type") ~= "disable") then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No real need for parens, as it's a single and.
(When I see parens, I expect more twisted conditions - my expectations would be deceived here :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove the parens. Are overly-long lines frowned upon? Like maybe instead break the if across two lines, in which case I'd need the parens, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, 145 chars long is a bit too long (120 is ok) - so you can split it on 2 lines.
And still no need for parens :) look a few lines below for a multilines and and around to get a feel for the Lua style and simple needs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also do

local screensaver_type = G_reader_etc_long_long()
if screensaver_type ~= blah and screensaver_type ~= blahblah then -- much shorter and more legible

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Frenzie: not a big deal I can make that change but if its alright I'd prefer just to keep it consistent with with the code around it (~12 lines below with the multi-line if using the same function)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite possibly because it's from me (I like long lines & parentheses, and I cannot lie 🎵).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with shorter lines for the whole if branch (even for un-effected code), let me know if that's OK.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Frenzie: I went with a variable to replace the long function name. Thanks for the feedback.

@Frenzie Frenzie added this to the 2020.03 milestone Mar 7, 2020
@Frenzie Frenzie merged commit 1d58eb8 into koreader:master Mar 8, 2020
mwoz123 pushed a commit to mwoz123/koreader that referenced this pull request Mar 29, 2020
NiLuJe added a commit to NiLuJe/koreader that referenced this pull request Aug 15, 2024
Link to the right issue ;).
Typo dates back to the original commit, way back in koreader#5928
NiLuJe added a commit that referenced this pull request Aug 17, 2024
Link to the right issue ;).
Typo dates back to the original commit, way back in #5928
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants