[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  Window Positions wrong with Aero-Snap

Window Positions wrong with Aero-Snap

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Steve   (3 posts)  [Biography] bio
Date Thu 28 Aug 2014 02:33 AM (UTC)
Message
GetMainWindowPosition/GetWorldWindowPosition report the window sizes incorrectly when using the 'Aero Snap' windows feature.

Steps to reproduce:
1 - Set the window and world window to some size.
2 - Use GetMainWindowPosition/GetWorldWindowPosition and notice that the sizes are reported correctly.
3 - Use 'Aero-Snap' (windowsKey+arrowKey) to snap the window to one side of the screen (MUSHClient will take up exactly half of the monitor).
4 - Use GetMainWindowPosition/GetWorldWindowPosition and notice that the sizes are still reported as the old sizes.

MUSHClient version 4.84, Windows 7 64-bit.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 28 Aug 2014 05:09 AM (UTC)
Message
Some investigating reveals that the problem is (probably) that the GetWindowPlacement function which I am using to find the window's position (placement) appears to remember the original position before using Aero Snap. Presumably this is so it can snap back later.

Now one suggested solution is to use GetWindowRect instead, which reports the current rectangle. So far, so good. That works (not that I have tested yet on Windows 7, I am still using XP).

However there is an issue if you minimize the window. Check these figures out, using the amended code:

Normal:


"top"=59
"height"=991
"left"=152
"width"=1345


Minimized:


"top"=-32000
"height"=31
"left"=-32000
"width"=160


The claimed sizes when minimized are wrong (or different, anyway). With the original code it "remembers" the size so it would report the same size whether minimized or not.

Now I don't know for sure if that would bother you, or indeed other scripters who may be relying on the current behaviour.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Steve   (3 posts)  [Biography] bio
Date Reply #2 on Thu 28 Aug 2014 05:20 AM (UTC)

Amended on Thu 28 Aug 2014 06:29 AM (UTC) by Steve

Message
Reported sizes when minimized are irrelevant in my case, but it is a good point that the change could affect others who rely on the current behavior. This isn't really a big deal to me, but a solution would be nice. I don't know how you feel about polluting up the API with a workaround function like "GetMainWindowPositionAero" or something to that effect. Maybe an additional function parameter that has a default value on the existing function.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 28 Aug 2014 05:27 AM (UTC)
Message
Well how about this? I am happier to make a change if its impact will be minimal (and there are possibly scripts around that use the current code, for whom the authors have gone dormant).

Let's assume you are using Lua. With Lua you can have optional arguments. We could pass down an argument which, if true, reports the "real" position and if false (the default) has the existing behaviour.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Steve   (3 posts)  [Biography] bio
Date Reply #4 on Thu 28 Aug 2014 06:30 AM (UTC)
Message
I am indeed using Lua and would be ok with your proposal.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Thu 28 Aug 2014 09:12 PM (UTC)

Amended on Thu 28 Aug 2014 11:33 PM (UTC) by Nick Gammon

Message
Modified in version 4.95.

https://github.com/nickgammon/mushclient/commit/4eb9166

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Sat 18 Oct 2014 05:23 AM (UTC)
Message
Version 4.95 now available.

http://www.gammon.com.au/forum/?id=12633

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,251 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]