mrichards42 / xword

Cross-platform crossword solving
https://mrichards42.github.io/xword/
GNU General Public License v3.0
42 stars 13 forks source link

Feature request: Blur (or something) when timer is paused and/or focus is lost #196

Open WyrdByWord opened 1 year ago

WyrdByWord commented 1 year ago

Different sites and such handle this in different ways, but it would be great if there was an option to have the current puzzle blurred out, or otherwise obscured, when the timer is paused or the window focus is lost. Thanks for your consideration!

fncll commented 1 year ago

This already happens with change of focus, but I agree that having an option to invoke the same thing when the timer is paused would be useful.

mrichards42 commented 1 year ago

Yep, this happens if the window loses focus or is minimized. Making this happen when the timer is paused seems like a reasonable request to me, though we'd probably want to make it an option. Either way most of the complicated logic already exists: XGridCtrl::SetPaused makes the grid render a "(Paused)" message, so we'd just need to tie that to the timer instead of the focus state.

I haven't had a ton of time recently to focus on adding features, but it would likely look like this if someone is excited to pick this up:

  1. Add the setting -- that's a bool on MyFrame, plus UI via wxFormBuilder in src/dialogs/
  2. Change the MyFrame::ToggleTimer method to call XGridCtrl::SetPaused if the above setting is in effect
  3. Change the MyFrame::OnTimerNotify method to check the above setting in addition to the app focus state to determine if the grid should be paused or not.

Here's a PR with a good example of what it looks like to add a setting: https://github.com/mrichards42/xword/pull/64/files (note that all the changes to *.fbp files are ui edits using wxFormBuilder, not something you're supposed to edit by hand)

jpd236 commented 1 year ago

One thing to think about here - the timer automatically pauses when the puzzle is done (and/or a solver would likely stop the timer upon full completion of the grid). You might not want to hide the grid in that situation - when every square is filled, or something similar? - to avoid interfering with that scenario.