Bug 332656 - Kmahjongg can't be paused
Summary: Kmahjongg can't be paused
Status: RESOLVED FIXED
Alias: None
Product: kmahjongg
Classification: Applications
Component: general (show other bugs)
Version: 0.8
Platform: unspecified Linux
: NOR grave
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-26 22:18 UTC by Richard Llom
Modified: 2016-01-04 00:22 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Don't unpause already paused game on minimize (1.16 KB, patch)
2014-12-24 00:02 UTC, Jan-Peter Nilsson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Llom 2014-03-26 22:18:13 UTC
The pause feature of Kmahjongg is somewhat broken:

A)
1. pause & minimize Kmj
2. wait some seconds
3. restore Kmj
-> Kmj is still paused, but time is increased (<- error)

B)
1. maximize Kmj
2. minimize & wait some seconds
3. restore Kmj
-> Kmj is paused, no timer increased
4. minimize Kmj (it is still paused) & wait some seconds
5. restore Kmj
-> Kmj is unpaused and timer continued while minimized. (<- error)
Comment 1 Jan-Peter Nilsson 2014-08-03 14:13:10 UTC
A is side effect of pause on minimize.
Since pause toggles between pause/unpause and the game is already paused, the pause triggered by the minimize will unpause the game and the pause triggered by restoring the window pauses the game.

With B we have a similar story, except that it also shows a problem in the conditions for unpausing on restore:
1. Sets window state to maximized
2. Minimize pauses the game, this sets the window sate to minimized and maximized
3. Restore checks if the previous window state was minimized
It was not, it was minimized and maximized, so no unpause it triggered.
4. Second minimize unpauses the game
5. Same as 4

So in summary I believe we have three problems here:
1. Minimizing while paused will unpause the game
2. Unpausing the game on restore of the window does not work if the window is maximized
3. Restoring the window will unpause the game even if it was manually paused before minimizing (assuming 1 is fixed).
Comment 2 Albert Astals Cid 2014-12-14 18:03:18 UTC
Git commit a1f8504f95140bdf082f6c8a948c78dd37de1b17 by Albert Astals Cid, on behalf of Jan-Peter Nilsson.
Committed on 14/12/2014 at 18:02.
Pushed by aacid into branch 'Applications/14.12'.

Make unpause on restore work for maximized window

For a maximied window the oldState will also contain Qt::WindowMaximized
so we need to filter out just the bit flag we are interested in.

As there is several problems described in bug 332656 this is just a partial correction.

M  +4    -3    kmahjongg.cpp

http://commits.kde.org/kmahjongg/a1f8504f95140bdf082f6c8a948c78dd37de1b17
Comment 3 Jan-Peter Nilsson 2014-12-24 00:02:59 UTC
Created attachment 90111 [details]
Don't unpause already paused game on minimize
Comment 4 Frederik Schwarzer 2016-01-04 00:22:00 UTC
This code has been refactored. Some branches are merged into master now and the curent behaviour is:
- pause the game on minimise
- unpause on window restore
- if the user paused the game manually, do not unpause on windopw restore

Please test master version and reopen if you think this issue has not been handled properly.