Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
115 user(s) are online (95 user(s) are browsing Forums)

Members: 0
Guests: 115

more...

Support us!

Headlines

 
  Register To Post  

Window under mouse?
Just can't stay away
Just can't stay away


See User information
Is there a nice system compliant way of telling which window is currently under the mouse pointer?

Go to top
Re: Window under mouse?
Amigans Defender
Amigans Defender


See User information
Yes You need something like this:

struct Window *ami_window_at_pointer(void)
{
     
struct Layer *layer;
     
     
LockLayerInfo(&scrn->LayerInfo);
     
     
layer WhichLayer(&scrn->LayerInfoscrn->MouseXscrn->MouseY);
     
     
UnlockLayerInfo(&scrn->LayerInfo);
     
     if(
layer) return layer->Window;
        else return 
NULL;
}


Go to top
Re: Window under mouse?
Just can't stay away
Just can't stay away


See User information
@chris

You my savior !

This is really neat when doing drag'n'drop stuff.

Go to top
Re: Window under mouse?
Home away from home
Home away from home


See User information
@alfkil

I see you post many different questions here. Mind telling me what you're trying to make?

X5000
Go to top
Re: Window under mouse?
Just can't stay away
Just can't stay away


See User information
@antique

See qt post

Go to top
Re: Window under mouse?
Just popping in
Just popping in


See User information
@Chris

Maybe a stupid question, but do I need to know on which screen the mousepointer is?

Or what is "scrn"?

Ciao, Alfred

Go to top
Re: Window under mouse?
Amigans Defender
Amigans Defender


See User information
scrn is the screen pointer (struct Screen *)
Sorry, should have said that, was a copy'n'paste from NS source code.

Go to top
Re: Window under mouse?
Just popping in
Just popping in


See User information
@Chris

So, how do I get the SCREEN where the mousepointer is?

I mean, this is AmigaOS, not Windows

Ciao, Alfred

Go to top
Re: Window under mouse?
Amigans Defender
Amigans Defender


See User information
@serpi

I don't know. Presumably there is another Layer_Info structure somewhere which holds the screens.

My code only works across one screen, it would be useful to find which screen the pointer is over in order to support drags across screens, I agree!

Go to top
Re: Window under mouse?
Just popping in
Just popping in


See User information
AFAIK the only screen the mousepointer can be _seen_ over is the frontmost one And there is no concept like "inactive screen" in Intuition so far.

Im not on my Amiga right now, but AFAIR this information can be found in IntuitionBase structure, some structure member called FirstScreen or similar. There is a member for the active window (the one holding the input focus, not necessarily located on the frontmost screen, btw.), too, IIRC.

Oh, and dont forget to lock IntuitionBase first!

Edit: Uh oh, Im not right with my first sentence. There are indeed more screens possible. One has to calculate the screen offset into this! This means, if there occurs screen dragging, the screen the mouse is over could be one that is seen in the "background"! One has to check, if one of the possible screens (there is a list of all screens opened atm. one traverses locked IntuitionBase, dont know its name atm.) has its bounds hit by the mouse pointer "hot spot" in order to get the right screen the mouse is over. The bounds result from all screen´s offset differences. E.g. frontmost screens offset is 20, screen behind has offset 0, so the background screen´s bounds are 20 x screen width (roughly. There is more information in Intuition includes).


Edited by whose on 2011/4/18 18:54:25
Go to top
Re: Window under mouse?
Just popping in
Just popping in


See User information
@serpi

IntuitionBase->ActiveScreen

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 3 ( 0 members and 3 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project