After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 701578 - Timer for chess does not stop in certain situations
Timer for chess does not stop in certain situations
Status: RESOLVED FIXED
Product: gnome-chess
Classification: Applications
Component: General
3.8.x
Other Linux
: High normal
: ---
Assigned To: Michael Catanzaro
gnome-chess-maint
Depends on:
Blocks:
 
 
Reported: 2013-06-04 08:45 UTC by Erwan
Modified: 2013-10-09 13:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch for pause button functionality (8.52 KB, patch)
2013-07-15 11:45 UTC, pnmanolova
reviewed Details | Review
Patch with requested changes (9.49 KB, patch)
2013-07-31 11:02 UTC, pnmanolova
none Details | Review
Same patch, fixing whitespace errors (9.79 KB, patch)
2013-08-01 00:00 UTC, Michael Catanzaro
committed Details | Review
pause_button should always be a Gtk.ToolButton (861 bytes, patch)
2013-08-01 03:39 UTC, Michael Catanzaro
committed Details | Review
Flip pause/fullscreen buttons, remove pause label (3.33 KB, patch)
2013-08-01 03:39 UTC, Michael Catanzaro
committed Details | Review
Pause button should be insensitive in untimed games (783 bytes, patch)
2013-08-01 03:39 UTC, Michael Catanzaro
committed Details | Review
Don't change UI when focus lost (3.35 KB, patch)
2013-08-01 03:39 UTC, Michael Catanzaro
rejected Details | Review
Don't change UI when focus lost (3.36 KB, patch)
2013-08-01 13:55 UTC, Michael Catanzaro
committed Details | Review
Make ChessClock class harder to misuse (9.47 KB, patch)
2013-08-01 16:14 UTC, Michael Catanzaro
committed Details | Review

Description Erwan 2013-06-04 08:45:41 UTC
User can notice that the when playing a timed Chess game, the timer does not stop in certain key events :

    pressing new game does not stop the counter when the "Save this game before..." is present on screen
    Going into settings does not pause the game so user cannot make any modifications to the setup
    If player lost a game, the computer timer continues to count, upon reaching zero the dialogue chances from "check mate" to "opponent has run out of time"

Steps :

1. Boot 
2. Open Chess
3. Go to settings - preferences and select Game Duration : One minute
4. Click close and start a new game
5. Press on Game - new game notice timer does not stop
6. Go to settings - preferences notice game does not stop
7. Lose the game in less than 60 seconds, when the "check mate" dialogue is open wait 60 seconds for the computer timer to run out and observe that it changes from from "check mate" to "opponent has run out of time".


Timer never pauses
Comment 1 Michael Catanzaro 2013-06-04 21:38:18 UTC
(In reply to comment #0)
> User can notice that the when playing a timed Chess game, the timer does not
> stop in certain key events :
> 
>     pressing new game does not stop the counter when the "Save this game
> before..." is present on screen
>     Going into settings does not pause the game so user cannot make any
> modifications to the setup

Indeed.  Opening any dialog ought to pause the game.  (It'd also be good to have a "pause game" button which stops the timers and hides the board until the game is resumed.)

>     If player lost a game, the computer timer continues to count, upon reaching
> zero the dialogue chances from "check mate" to "opponent has run out of time"

This one should already be fixed (it'll show up in 3.8.3).
Comment 2 Adam Dingle 2013-07-09 01:47:29 UTC
+1 for the "pause game" button Michael suggested.
Comment 3 pnmanolova 2013-07-15 11:45:16 UTC
Created attachment 249181 [details] [review]
Proposed patch for pause button functionality

I've proposed a patch for the pause game button functionality
Comment 4 Michael Catanzaro 2013-07-15 17:59:54 UTC
Review of attachment 249181 [details] [review]:

Thanks for the patch!  It looks mostly good; a few minor issues need cleaned up though:

* The indentation is inconsistent; it should be four spaces with no tabs, braces on new lines and on the outside
* Can you make pausing the game desensitize the move selection combo box at the bottom of the screen?  Clicking on that currently unpauses the game unexpectedly.
* stash_button_sesnsitivity () is misspelled
* Trivial: I'd prefer you make a little private struct to hold the sensitivities of the buttons, or else use an enum for indexing.  Rather than just manually associating e.g. "first_move_button" with index 3.
* In chess_clock_toggle_paused you need to make sure the ChessClock is not null (as it will be in untimed games) before using it.  That's causing critical warnings.

Optional: For bonus points, shroud the pieces when paused, just like GNOME Mines.
Comment 5 pnmanolova 2013-07-31 11:02:19 UTC
Created attachment 250534 [details] [review]
Patch with requested changes
Comment 6 pnmanolova 2013-07-31 11:03:36 UTC
(In reply to comment #4)
> Review of attachment 249181 [details] [review]:
> 
> Thanks for the patch!  It looks mostly good; a few minor issues need cleaned up
> though:
> 
> * The indentation is inconsistent; it should be four spaces with no tabs,
> braces on new lines and on the outside
> * Can you make pausing the game desensitize the move selection combo box at the
> bottom of the screen?  Clicking on that currently unpauses the game
> unexpectedly.
> * stash_button_sesnsitivity () is misspelled
> * Trivial: I'd prefer you make a little private struct to hold the
> sensitivities of the buttons, or else use an enum for indexing.  Rather than
> just manually associating e.g. "first_move_button" with index 3.
> * In chess_clock_toggle_paused you need to make sure the ChessClock is not null
> (as it will be in untimed games) before using it.  That's causing critical
> warnings.
> 
> Optional: For bonus points, shroud the pieces when paused, just like GNOME
> Mines.

Thanks for the review! I've re-uploaded the patch with requested changes.
Comment 7 Michael Catanzaro 2013-08-01 00:00:56 UTC
Created attachment 250567 [details] [review]
Same patch, fixing whitespace errors

This is the same as your patch, but with trailing whitespace and hard tabs removed.
Comment 8 Michael Catanzaro 2013-08-01 03:39:51 UTC
Created attachment 250577 [details] [review]
pause_button should always be a Gtk.ToolButton
Comment 9 Michael Catanzaro 2013-08-01 03:39:55 UTC
Created attachment 250578 [details] [review]
Flip pause/fullscreen buttons, remove pause label
Comment 10 Michael Catanzaro 2013-08-01 03:39:57 UTC
Created attachment 250579 [details] [review]
Pause button should be insensitive in untimed games
Comment 11 Michael Catanzaro 2013-08-01 03:39:59 UTC
Created attachment 250580 [details] [review]
Don't change UI when focus lost

Just stop counting down
Comment 12 Michael Catanzaro 2013-08-01 03:53:22 UTC
Review of attachment 250580 [details] [review]:

FYI this last patch isn't quite ready yet (probably I shouldn't have uploaded it at all) since losing focus when paused leads to a double-pause and get everything stuck insensitive.  (An easy fix.)  I've also seen a double-unpause, though I'm not sure how I managed that....
Comment 13 Michael Catanzaro 2013-08-01 13:55:12 UTC
Created attachment 250622 [details] [review]
Don't change UI when focus lost

Just stop counting down
Comment 14 Michael Catanzaro 2013-08-01 16:14:58 UTC
Created attachment 250640 [details] [review]
Make ChessClock class harder to misuse

This class has never really been safe.  Pay off some technical debt.
Comment 15 Michael Catanzaro 2013-08-01 16:17:34 UTC
Plamena, do you want to check out this patch series and see if everything is working as you expect?

Thanks for your help; this should be ready to go into 3.9.90.
Comment 16 pnmanolova 2013-08-02 12:27:56 UTC
Thank you for your review and your additional patches! I've tested them and everything works as it should, so I think they are good to land.
Comment 17 Michael Catanzaro 2013-08-02 13:24:00 UTC
Excellent.  This fix (and the new pause feature) will show up in v3.9.90.  Thanks again for the patch!

Attachment 250577 [details] pushed as c6154e8 - pause_button should always be a Gtk.ToolButton
Attachment 250578 [details] pushed as 46c62fa - Flip pause/fullscreen buttons, remove pause label
Attachment 250579 [details] pushed as 882e93d - Pause button should be insensitive in untimed games
Attachment 250622 [details] pushed as b30e47a - Don't change UI when focus lost
Attachment 250640 [details] pushed as 8ee7af6 - Make ChessClock class harder to misuse
Comment 18 Philippe "RzR" Coval 2013-10-09 12:20:00 UTC
If it matters, it would help to also backport them to gnome-3-8 branch too

But I fear they cant be applied without adaptation...
Comment 19 Michael Catanzaro 2013-10-09 13:42:18 UTC
Adding a new feature (pause) is not allowed by GNOME in stable releases, sorry.