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
➜ Bug reports
➜ OnPluginGetFocus, OnPluginLoseFocus behaving oddly
OnPluginGetFocus, OnPluginLoseFocus behaving oddly
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Sat 12 Jan 2008 07:06 PM (UTC) |
Message
| Simply put, they don't always trigger. Worse of all, they hardly trigger, except for the strange occasions where it goes LoseFocus\nGetFocus.
I have a simple Lua plugin, with stuff as follows:
function OnPluginGetFocus()
world.Note("I haz focus.")
HaveFocus = true
end
function OnPluginLoseFocus()
world.Note("I no haz focus.")
HaveFocus = false
end
One particular bit of output is that I got the 'I no haz focus' message a few times in a row.
Usually I have my world-window maximized, essentially only seeing one world. The strange behaviour appears both when switching between applications (clicks or Alt+Tab make no difference), but also when I put my world windows on 'floating windows' and switching inbetween the worlds like that, no matter whether I click or Ctrl+Tab.
And.. oi, I finally found the difference all the way into writing this post. If I click on the OUTPUT area, it works fine. It works horribly when clicking the INPUT area. Other areas only work when focus wasn't in the INPUT area when losing the focus originally.
Could this be fixed? | Top |
|
Posted by
| Shaun Biggs
USA (644 posts) Bio
|
Date
| Reply #1 on Sat 12 Jan 2008 07:23 PM (UTC) |
Message
| I know a few of those issues are from how Windows itself handles telling a program if it has Focus or not. I noticed this a while ago when I was poking around with wxWidget's focus tools, and tried it with a few other libraries. It's mostly just spotty for telling the program that it's lost focus, as you mentioned.
Granted, I might have done something to horribly screw up my tests, so don't go around thinking I'm the "Voice of Truth" here or anything. |
It is much easier to fight for one's ideals than to live up to them. | Top |
|
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #2 on Sat 12 Jan 2008 07:57 PM (UTC) |
Message
| It's nice to know there is something similar.
Perhaps there could be a GetInfo() call added that does a hard check using the appropriate Windows API to see if MUSHclient has focus, and one to see if the current world is the one with the focus? I don't mind changing from a push strategy to a pulling one. :) | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 13 Jan 2008 05:30 AM (UTC) |
Message
| My preliminary analysis of the code is that there is a bug in the way the plugin callback is called. It seems that it might not be called if the focus is on the command window (or vice-versa).
It might be interesting to run your test with the *world* got-focus/lost-focus callbacks giving a note, as well as the plugin ones, and seeing if they differ. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #4 on Sun 13 Jan 2008 02:59 PM (UTC) |
Message
| I just did your test, Nick, and it seems there is no such bug there. I can click both input and output area, other parts of the window, both in the case of switching to other applications and to another world.
So I assume it is some kind of bug with the way plugins are handled in this case. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #5 on Sun 13 Jan 2008 07:03 PM (UTC) |
Message
| I think then that I must have overlooked one place when adding the plugin handler. In the meantime you could use the world handler (the one that works) to generate an event that plugins detect (eg. BroadcastPlugin). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #6 on Sun 13 Jan 2008 07:59 PM (UTC) |
Message
| I'll dutifully wait for the next version. I hate hacks and clumsy workarounds (effective as they might be!) but that is entirely a mental tick in my persona. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #7 on Fri 22 Feb 2008 01:35 AM (UTC) |
Message
| Version 4.22, available now, should correct those problems. |
- 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.
19,654 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top