Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ change to how movewindow saves x,y position

change to how movewindow saves x,y position

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


Posted by Fiendish   USA  (2,558 posts)  Bio   Global Moderator
Date Mon 27 Aug 2012 12:30 AM (UTC)

Amended on Mon 27 Aug 2012 12:34 AM (UTC) by Fiendish

Message
I ran into a glitch saving/restoring movewindow position when multiple plugins allowed dragging of a single shared miniwindow. Surely there are other ways of handling this situation across the plugins themselves, but the simplest solution seems to be the following change to movewindow.lua, where the actual miniwindow position is saved instead of the imagined position which is in this case not always correct (if the window doesn't exist, nothing is written to those variables).


@@ -392,9 +392,13 @@
     return
   end -- no such window
   
-  -- remember where the window was 
-  SetVariable ("mw_" .. win .. "_windowx",      mwi.window_left)
-  SetVariable ("mw_" .. win .. "_windowy",      mwi.window_top)
+  -- remember where the window was
+  if WindowInfo(win, 10) then
+    SetVariable ("mw_" .. win .. "_windowx",    WindowInfo(win, 10))
+  end
+  if WindowInfo(win, 11) then
+    SetVariable ("mw_" .. win .. "_windowy",    WindowInfo(win, 11))
+  end
   SetVariable ("mw_" .. win .. "_windowmode",   mwi.window_mode)
   SetVariable ("mw_" .. win .. "_windowflags",  mwi.window_flags)


I'm guessing only one if check is actually necessary, but wasn't willing to risk it without going and looking at the MUSHclient code, which I haven't done.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 27 Aug 2012 06:33 AM (UTC)
Message
Does that work properly in your testing? I suppose it does or you wouldn't suggest it, but just checking.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,558 posts)  Bio   Global Moderator
Date Reply #2 on Mon 27 Aug 2012 10:56 PM (UTC)

Amended on Mon 27 Aug 2012 10:57 PM (UTC) by Fiendish

Message
It solved my 2-plugins-1-window issue, of course, and I have not noticed any problems yet in limited testing. I speculate that the only noticable behavior change that this could cause is that a miniwindow cannot save last position state post-deletion. I think that's probably a silly thing to want to do anyway.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 28 Aug 2012 12:42 AM (UTC)
Message
What if we leave in those two line you deleted? Then the fallback is the current behaviour.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,558 posts)  Bio   Global Moderator
Date Reply #4 on Tue 28 Aug 2012 01:41 AM (UTC)

Amended on Tue 28 Aug 2012 01:48 AM (UTC) by Fiendish

Message
Hmm. I consider it undesirable to ever use window_left/window_top for saving, but sidestepping the situation of calling movewindow.save_state while the window's existence is in flux is trivial. So sure.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 28 Aug 2012 05:11 AM (UTC)
Message
Added to version 4.82:

https://github.com/nickgammon/mushclient/commit/46cef19a76

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


20,760 views.

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

Go to topic:           Search the forum


[Go to top] top

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