Go Back   Angband Forums > Angband > Development

Thread Tools Display Modes
Old September 10, 2019, 13:19   #1
Narvius's Avatar
Join Date: Dec 2007
Location: Poland, Katowice
Age: 30
Posts: 589
Narvius is on a distinguished road
Bug report: (Win) If taskbar is on the left, PositionX setting is stored incorrectly

As the title says.

I open my Angband.ini and PositionX is set to "-76". (Seems to be the exact width of my taskbar.) Manually edit to 0. Open Angband. Close. Reload file. It's -76 again.


(1) Same thing happens to PositionY if taskbar is at the top (the value is -30, matching the height of the taskbar).
(2) Likely source is a difference of how coordinates are read for actual use, and for storage in the settings file.
(3) The exact call is "GetWindowPlacement", main-win.c:692. The documentation for WINDOWPLACEMENT, the struct used in GetWindowPlacement, mentions this exact problem.


The game uses actual screen coordinates, except for when finding coordinates to store in settings, where it uses "workspace coordinates" (which adjust for presence of taskbars). This leads to "drift" when loading and saving these screen settings.

This is not a problem if the taskbar is on the bottom or right side, the former of which is the default case.

Suggested fix

Adjust the offending part in "save_prefs_aux" (main-win.c:692) to not use GetWindowPlacement, but the actual coordinates (...whatever that means.)

I don't have the Angband codebase know-how (or comfort in using C) to do this, otherwise I'd just implement it and submit a PR, sorry
If you can convincingly pretend you're crazy, you probably are.
Narvius is offline   Reply With Quote
Old May 21, 2020, 03:36   #2
Vanilla maintainer
Nick's Avatar
Join Date: Apr 2007
Location: Canberra, Australia
Age: 57
Posts: 9,481
Donated: $60
Nick will become famous soon enoughNick will become famous soon enough
Thanks for the detailed bug report and suggested fix; it set me on the right track.

The eventual answer was still to use GetWindowPlacement, but then to use SetWindowPlacement instead of SetWindowPos when re-openeing the game. I have tested this, and it works; the bug will be fixed in the next nightly build (and hence in 4.2.1).
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
uh ... bug report? Sky Vanilla 10 March 24, 2020 20:51
[BUG] [SANGBAND 1.0.2] [Win10] Game crashes when entering Left Panel screen Bucolic Verdancy Variants 0 November 2, 2018 06:37
[3.5-dev] BASIC_COLORS incorrectly incremented PowerWyrm Vanilla 1 April 25, 2013 13:33
Bug report v4 9feb8de jevansau v4 5 February 22, 2012 20:51
Bug report: shopkeeper greetings Derakon Development 4 June 19, 2011 18:43

All times are GMT +1. The time now is 06:58.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.