[DictQuickLookup] enable full-screen mode for open dictionary window#13862
Conversation
poire-z
left a comment
There was a problem hiding this comment.
Not sure I like the playing with temporary state and restoring - and the way it is done with a module variable, but if there's no other simpler way, ok.
| local modifier = Device:hasScreenKB() and "ScreenKB" or "Shift" | ||
| self.key_events.ChangeToPrevDict = { { modifier, Input.group.PgBack } } | ||
| self.key_events.ChangeToNextDict = { { modifier, Input.group.PgFwd } } | ||
| self.key_events.SetTemporaryFullScreenMode = { { modifier, "Home" } } |
There was a problem hiding this comment.
You got a big home !
(Glad to see the Home button not taking you home :))
There was a problem hiding this comment.
well, we're not using home, we are using screenkb + home
| -- We want to remember the current dict_index (e.g. 5/7), so that it can be restored later. | ||
| DictQuickLookup.temp_fullscreen_request = { dict_index = self.dict_index, } | ||
| -- This setting will be reverted upon closing the new instance. Note that any would be child windows will also open in fullscreen mode. | ||
| G_reader_settings:makeTrue("dict_largewindow") |
There was a problem hiding this comment.
A bit dirty to play with temporary toggling a user setting. Any other way ?
(So, you're still using a small window ?)
There was a problem hiding this comment.
I did think it wasn't ideal. But I couldn't come up with an idea that was as "clean" as this.
I use the patched window, thank you very much, I wanted to make it more dramatic here as the patch probably has a user base of 1 (2?)
There was a problem hiding this comment.
There is also adding a full-screen = true to temp-fullscreen-request and using that instead of G-setts
| -- This setting will be reverted upon closing the new instance. Note that any would be child windows will also open in fullscreen mode. | ||
| G_reader_settings:makeTrue("dict_largewindow") | ||
|
|
||
| local ui_ref = self.ui or UIManager |
There was a problem hiding this comment.
You could call it just local ui = (every object is a ref).
| local ui = self.ui or UIManager | ||
| -- Re-trigger the lookup, and close this instance _after_ the new one is created. | ||
| if self.is_wiki then | ||
| ui_ref:handleEvent(Event:new("LookupWikipedia", self.word, self.is_sane_word, self.word_boxes, false, self.lang, function() self:onClose(true) end)) | ||
| ui:handleEvent(Event:new("LookupWikipedia", self.word, self.is_sane_word, self.word_boxes, false, self.lang, function() self:onClose(true) end)) | ||
| else | ||
| ui_ref:handleEvent(Event:new("LookupWord", self.word, true, self.word_boxes, self.highlight, nil, function() self:onClose(true) end)) | ||
| ui:handleEvent(Event:new("LookupWord", self.word, true, self.word_boxes, self.highlight, nil, function() self:onClose(true) end)) |
There was a problem hiding this comment.
Btw, I'm not sure calling UIManager:handleEvent (the module itself) will work.
If there's no self.ui (and you can't find a use case where there is none), just do nothing / return if there is none.
There was a problem hiding this comment.
and you can't find a use case where there is none
Well in that case is not needed then, i was being cautious in case FM would ever say, nope not having it.
|
(Also, you wrote everything with the word "temp fullscreen", while it is actually just "temp large window".) |
|
Wondering if @poire-z is upset or something ;) |
|
No, still just busy. |
|
Maybe "maximized" would be a better term. |
|
But this PR just temporarily enable the existing "large window" display, it does not need a new word :) |
…early beter but whatever
| -- We want to remember the current dict_index (e.g. 5/7), so that it can be restored later. | ||
| DictQuickLookup.temp_large_window_request = { | ||
| dict_index = self.dict_index, | ||
| full_screen = true, -- note: any would-be child window will also open in fullscreen mode. |
There was a problem hiding this comment.
Does this one needs to be named full_screen, althought being part of a table named temp_large_window_request ?
There was a problem hiding this comment.
you are something else ;)
|
kindle added a similar feature to this one in 5.18.6, not claiming or suggesting this PR was their inspiration, but it looks a bit sus ;) their implementation is a bit rubbish though. |
we've all been there, you look up a word definition only to realise is long AF and you ponder, why isn't there an easy way to go full screen mode here? well worry not past me... here it is.
what's new
temp_fullscreen_requestand a private property_is_temporary_fullscreen_modeto manage the temporary fullscreen state.spread) and a key binding (screenkb/shift + home ) to trigger the temporary fullscreen mode.initmethod to check fortemp_fullscreen_requestand set the appropriate dictionary and fullscreen mode state during initialisation.setTemporaryFullScreenModeandonSetTemporaryFullScreenModemethods to handle the logic for enabling fullscreen mode, including re-triggering lookups and managing thewindow_list.onClosemethod to revert the fullscreen mode setting when the widget is closed.screen recording
This change is