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, 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.
 Entire forum ➜ MUSHclient ➜ Miniwindows ➜ 1x1 hotspots

1x1 hotspots

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


Pages: 1  2  3 

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #30 on Tue 22 Dec 2009 08:32 PM (UTC)

Amended on Tue 22 Dec 2009 08:40 PM (UTC) by Twisol

Message
On the SetCursor thing, brilliant, I was going to ask if you could do exactly that at some future point. :) The use I was thinking of, though, was that you'd control the cursor you draw per-window, though - i.e. just blitting your own graphic to the mouse position on your window - not actually changing the mouse for the whole output window. (A simpler way to do that would be for a variant of SetCursor where you supply the name of a miniwindow or some such thing.)

Nick Gammon said:
Well, given that you seem to want cursor movements only for a particular hotpost, why is that? I assumed from your earlier posts that you were trying to detect movements in general, and then farm them out to a particular "control" or whatever it is.

Yes, I will have a single pixel-sensitive hotspot overlaying the whole window, specific to my framework. It would handle events and pass things along to Hotspot objects owned by individual widget controls.

Nick Gammon said:
I mean, if there is an OK button, why is it exciting to know the mouse has moved around inside it?

It's not. If you didn't want to use my framework, for example, a pixel-sensitive hotspot could be placed alongside normal hotspots, allowing you to use normal hotspots for buttons and the like, while using the sensitive hotspot for more interesting interaction.

The only reason my framework requires a pixel-precision hotspot to cover the whole window is precisely because it's a framework. It can't assume the locations and sizes and uses of the hotspots it will own, which is the point of the Hotspot objects I've created. It makes it easier for users to manage the interactivity of their widgets, without compromising how the view is drawn or acted upon.

EDIT: Not the only reason, but a big one. The other is the issue of applying hotspot changes to the visible window.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #31 on Tue 22 Dec 2009 08:33 PM (UTC)
Message
Nick Gammon said:

Twisol said:

(b) the framework write one itself, thus rendering it wholly unavailable to the user if they want to do anything different with it.


Why? They can't "do anything" with it. It just tells them where the mouse is. All plugins will get it.


Well yes, that's the big issue I mentioned in the very next paragraph.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,061 posts)  Bio   Forum Administrator
Date Reply #32 on Tue 22 Dec 2009 09:03 PM (UTC)
Message
Twisol said:

Yes, I will have a single pixel-sensitive hotspot overlaying the whole window, specific to my framework. It would handle events and pass things along to Hotspot objects owned by individual widget controls.


You are going to have to spell out for me the difference between a plugin callback that gets mouse movements for the whole window, and a "pixel-sensitive hotspot overlaying the whole window" which gives you mouse movements. Sounds the same to me. Is there a terminology confusion here?

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,061 posts)  Bio   Forum Administrator
Date Reply #33 on Tue 22 Dec 2009 09:13 PM (UTC)
Message
Twisol said:

Doing it this way would require not only that code be written to discern which hotspot to execute, but also which -window- to check in the first place! Further, it's wholly decoupled from the miniwindow system, which is really the only place this would make any sense. Finally, because there is no sense of 'which window is being moused over', you could have two windows on top of eachother, both created in separate plugins, both moused over at some point, and both of them doing something in response to the mouseover, even though only one is on top. This wholly breaks expected behavior, and is the largest issue with this approach.


I thought having a single point of reference would help, particularly as you seem to be developing a framework system. All you have to do is do what MUSHclient does itself anyway:


  • Iterate through the windows (WindowList gives you that) - in reverse order, so the topmost one is considered first.

  • Check the x/y coordinates to be within the miniwindow location (up to 4 integer compares)

  • If not, move onto the next one

  • If so, stop processing more windows (so you don't get an underneath one too), and then repeat the process for hotspots inside that miniwindow if required to identify a hotspot.



Twisol said:

I would honestly like to know why you're averse to adding a flag to WindowAddHotspot. Is there an issue with it I'm unaware of?


It seemed a more generic solution, somehow.


I still don't fully get why your framework can't just get the mouseover calls for individual hotspots anyway, without going down to the pixel level.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #34 on Tue 22 Dec 2009 09:28 PM (UTC)

Amended on Tue 22 Dec 2009 09:31 PM (UTC) by Twisol

Message
Nick Gammon said:
You are going to have to spell out for me the difference between a plugin callback that gets mouse movements for the whole window, and a "pixel-sensitive hotspot overlaying the whole window" which gives you mouse movements. Sounds the same to me. Is there a terminology confusion here?

I meant that it covers the whole miniwindow. Your callback would be called on every mouse movement whether or not there's a window there; see my response to the next quote below.

Nick Gammon said:
I thought having a single point of reference would help, particularly as you seem to be developing a framework system. All you have to do is do what MUSHclient does itself anyway:

*Iterate through the windows (WindowList gives you that) - in reverse order, so the topmost one is considered first.

*Check the x/y coordinates to be within the miniwindow location (up to 4 integer compares)

*If not, move onto the next one

*If so, stop processing more windows (so you don't get an underneath one too), and then repeat the process for hotspots inside that miniwindow if required to identify a hotspot.

One point to make against doing it myself is that MUSHclient already does it for me. As you said, MUSHclient goes to great lengths to hide these details. (For the record, I don't count pixel-sensitive mousemoves to be an incredibly harsh detail to expose.)

Another issue is that this OnPlugin* callback will be called on every mouse movement within the output area. That means that not only do I have to do work that MUSHclient already does on its own, I also have to do it even when there might not be a window beneath the cursor. This is something MUSHclient does anyways, to pass normal mouseover events, which means we're doing the same work twice.

Lastly, unfortunately the "single frame of reference" doesn't really work out here. The framework is window-based, not plugin-based or output-window-based. Every view has its own state, though it might share descendants with other views. It is -much much much- easier to start with the view than the output window.

Nick Gammon said:
It seemed a more generic solution, somehow.


I still don't fully get why your framework can't just get the mouseover calls for individual hotspots anyway, without going down to the pixel level.


What do you mean by a "more generic solution"?

Here is how my framework works. There is one view, into which all widget canvases are compiled to get the visual elements you see. ('widgets' aren't miniwindows themselves, they are images blitted onto their parent, drawn on hidden canvas miniwindows that are never seen directly). Each widget can add their own logical hotspots, that is, Hotspot objects that are pure data. Hotspot objects have no physical presence on the view window, because it is much easier to manage them separately, and it makes it possible to resize, move, and change the behavior of them very easily.

The view, the physical area on-screen that you see, is sensitive to every movement of the mouse. It catches all events, figures out what hotspots are involved, and passes them along. It also will (not done yet) track the currently moused-over hotspot, firing a cancelmouseover when the mouse leaves its region. Because of the nature of the abstraction layer, Hotspots can be freely moved and resized (i.e. their internal rects changed) without any repercussions.

It is incredibly difficult (bordering on impossible) to literally give each Hotspot its own MUSH hotspot on the view, not least because there can be multiple views that happen to show the same widget, and it would be chaos to figure out what changes go to what view. (If you wonder when this would ever happen, it would be more likely to occur during widget composition, when you're viewing two separate widgets that happen to have the same one as a descendant further down)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,061 posts)  Bio   Forum Administrator
Date Reply #35 on Tue 22 Dec 2009 10:25 PM (UTC)
Message
Twisol said:

Anyways, what do you think about the initial idea, adding a flag for WindowAddHotspot to allow hotspots to pick up on pixel-sensitive movement?

...

It is incredibly difficult (bordering on impossible) to literally give each Hotspot its own MUSH hotspot on the view, not least because there can be multiple views that happen to show the same widget, and it would be chaos to figure out what changes go to what view.


OK, if I went along with this, you want a flag added to WindowAddHotspot to track mouse movements inside hotspots, but you are not using MUSHclient hotspots?

If you have a "full-window" hotspot, and it is high up the testing order then it hides the lower hotspots.

So I don't see how this works.

I have amended the earlier change to the OnPluginMouseMoved callback to change the 3rd argument to "miniwindow ID".

Now, you know immediately which miniwindow the mouse is over, without mucking around checking coordinates. And, if it is over none, you can quickly exit, eg.


function OnPluginMouseMoved (x, y, mw)

  -- ignore if not on miniwindow
  if mw == "" then return end 

  -- process miniwindow "mw" here ...

end -- function OnPluginMouseMoved


Now, given the miniwindow ID, you can check for some movement over the "logical hotspots" you describe.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #36 on Tue 22 Dec 2009 10:29 PM (UTC)

Amended on Tue 22 Dec 2009 10:33 PM (UTC) by Twisol

Message
Nick Gammon said:
OK, if I went along with this, you want a flag added to WindowAddHotspot to track mouse movements inside hotspots, but you are not using MUSHclient hotspots?

If you have a "full-window" hotspot, and it is high up the testing order then it hides the lower hotspots.

So I don't see how this works.

No, no, there's only one real hotspot altogether. All of the others are virtual hotspots, they're not added with WindowAddHotspot at all. There's only one MUSHclient hotspot, and that's the full-window hotspot.

It's not just my framework that would use these kinds of hotspots. My framework only uses one hotspot, but non-framework miniwindows could still use these hotspots (non-full-window) for their own purposes.

Nick Gammon said:
I have amended the earlier change to the OnPluginMouseMoved callback to change the 3rd argument to "miniwindow ID".

Now, you know immediately which miniwindow the mouse is over, without mucking around checking coordinates. And, if it is over none, you can quickly exit

This is feeling exceedingly hacky by now, when the exact same functionality is already given by the mousemove hotspot event. By this point I'd almost rather use the 55,016 layer of 1x1 hotspots >_>

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,061 posts)  Bio   Forum Administrator
Date Reply #37 on Tue 22 Dec 2009 11:02 PM (UTC)
Message
Well in the interests of keeping plugin developers happy, I have done what you suggested. There is now a flag (1) in the WindowAddHotspot function, which causes mouseover events to be reported for all mouse movements, not just the first.

So you know which is which, the flags parameter passed to the mouseover function will have the 0x80 bit set for subsequent calls, so you can tell the difference between the first call and other calls.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #38 on Tue 22 Dec 2009 11:05 PM (UTC)
Message
Thanks! I really appreciate it.

It seems like I'm asking for/about a lot lately. I'm sorry if it's annoying or an inconvenience - and oftentimes you really do suggest better alternatives - but it's just because I want to help keep this client great. >_> So yeah, apologies just in case.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #39 on Tue 22 Dec 2009 11:08 PM (UTC)

Amended on Tue 22 Dec 2009 11:16 PM (UTC) by Twisol

Message
By the way, I have a minor idea for you, relating to your previous SetCursor change. Since you can now pass -1 to SetCursor, what about passing -1 to WindowAddHotspot for the Cursor parameter?

EDIT: And when is OnPluginMouseMove executed? Is it before or after hotspot handlers have been executed? If after, and if SetCursor is called in OnPluginMouseMove, it would be very difficult for miniwindows to draw their own cursors.

Just something that occured to me while mulling over the new changes.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,061 posts)  Bio   Forum Administrator
Date Reply #40 on Tue 22 Dec 2009 11:28 PM (UTC)
Message
Yeah, why not? I have changed hotspots to allow for a cursor of -1.

OnPluginMouseMove is executed early, before any hotspot handlers.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #41 on Tue 22 Dec 2009 11:28 PM (UTC)
Message
Great, thanks! ^_^

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #42 on Wed 23 Dec 2009 07:10 AM (UTC)
Message
I am liking the idea of what this can become, something like a visual inventory even, that could show bags of all kinds, and then when an item is dragged it could effectively send the remove command, and the the put command when it is dropped on another bag.

This has other merits, such as for those that are staff on MUSHes, it could be a visual job control, so you could alter the buckets of jobs, double click on a bucket to expand it, and then display its contained jobs, then double click on a job to view it. Or perhaps even on a BBOARD for posts.

I cannot wait to see the amazing things this can be used to make.

-Onoitsu2
Top

Posted by KaVir   Germany  (117 posts)  Bio
Date Reply #43 on Thu 24 Jun 2010 02:10 PM (UTC)
Message
D'oh, I'd just written up a lengthy post asking if it was possible to do something along these lines, and only noticed this post when I did a final check to make sure it hadn't already been covered.

This is great stuff, though. Combined with a graphical map, it would allow Twisol-style virtual hotspots shaped exactly to fit the monster and object icons, overcoming the problem of transparent pixels blocking overlapping rectangles. Hover over the monster or object to view its stats, click to attack or pick up.

I'm still not quite sure how the custom cursors would work though. Supposing I want the cursor to be a boot when hovering over the map, replaced with a sword when hovering over a monster and a glove when hovering over an object...how exactly would that be done? I'd pass -1 to SetCursor() and then what? Would it just be a small miniwindow containing an image displayed relative to WindowInfo 17 and 18?
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #44 on Thu 24 Jun 2010 05:40 PM (UTC)
Message
KaVir said:
I'm still not quite sure how the custom cursors would work though. Supposing I want the cursor to be a boot when hovering over the map, replaced with a sword when hovering over a monster and a glove when hovering over an object...how exactly would that be done? I'd pass -1 to SetCursor() and then what? Would it just be a small miniwindow containing an image displayed relative to WindowInfo 17 and 18?


Yep, that's pretty much exactly it.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
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.


96,634 views.

This is page 3, subject is 3 pages long:  [Previous page]  1  2  3 

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.