Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
191 user(s) are online (144 user(s) are browsing Forums)

Members: 0
Guests: 191

more...

Headlines

 
  Register To Post  

Finding arexx port of window at pos x,y
Supreme Council
Supreme Council


See User information
I'm thinking about ways to implement drag&drop into the Filer.

Let's say that I have a set of x,y coordinates on the screen.

- Can I find out which top most window is located at that position?

- Can I find the arexx port for the application owning that window?


Not looking to find maybes or try this'. I need to know if this can be done and exactly how.

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: Finding arexx port of window at pos x,y
Not too shy to talk
Not too shy to talk


See User information
@orgin

Quote:
- Can I find out which top most window is located at that position?


Yes. You can examine the layers (I think there is even a function which returns the topmost layer at an x/y position) and then check which rastport the layer belongs to and which window the rastport belongs to.


Quote:
- Can I find the arexx port for the application owning that window?


No. You cannot even find out the application. You can only guess that if the window has an IDCMP port that the mp_SigTask points to the application's task and then find out the name of the appl through the task name (if run from Workbench) or the CLI command name (if run from Shell).

Then you could try to guess the ARexx port name by using a task name / port name cross reference list.

Bye,
Thomas

Go to top
Re: Finding arexx port of window at pos x,y
Just can't stay away
Just can't stay away


See User information
@orgin

Quote:

- Can I find out which top most window is located at that position?


#include <intuition/intuition.h>
#include <proto/intuition.h>
#include <stdio.h>

struct Window *FindWindowUnderMouse() {
    
struct Screen *screen = ((struct IntuitionBase *)IntuitionBase)->FirstScreen;
    
int32 mouse_x screen->MouseX;
    
int32 mouse_y screen->MouseY;
    
struct Window *window;
    for (
window screen->FirstWindowwindowwindow window->NextWindow) {
        if (
mouse_x >= window->LeftEdge && mouse_x < (window->LeftEdge window->Width) &&
            
mouse_y >= window->TopEdge && mouse_y < (window->TopEdge window->Height))
        {
            return 
window;
        }
    }
    return 
NULL;
}


int main () {
    
struct Window *window;
    
uint32 lock;
    
    
lock LockIBase(0);
    
window FindWindowUnderMouse();
    
/* do what you want to do with the window pointer here */
    
UnlockIBase(lock);
    
    
printf("Window under mouse pointer: %08lx\n", (long)window);
    return 
0;
}

Go to top
Re: Finding arexx port of window at pos x,y
Supreme Council
Supreme Council


See User information
@all

Thanks to the both of you.

I've managed to get hold of the correct window.

Anyone ever tried creating AppMessages manually and sending them to window->UserPort?

I can't manage to get it to work :/

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: Finding arexx port of window at pos x,y
Not too shy to talk
Not too shy to talk


See User information
Quote:
for (window = screen->FirstWindow; window; window = window->NextWindow)


This does not work in all cases. Windows are not strictly ordered front to back, depending on WFLG_BACKDROP. I had to learn this lesson for LimpidClock. The only way to really get the right window is using layers and then get the window which belongs to the layer.


Quote:
Anyone ever tried creating AppMessages manually and sending them to window->UserPort?


Funnny idea. Why should an IDCMP port can do anything with AppMessages ? AppMessages have to be sent to the port which was supplied to the CreateAppWindow call. This is usually not the window's IDCMP port.

Go to top
Re: Finding arexx port of window at pos x,y
Not too shy to talk
Not too shy to talk


See User information
@orgin

Quote:

orgin wrote:
I'm thinking about ways to implement drag&drop into the Filer.
...


so you don't think (or actually know) that dnd is part of the next os4 update? i remember it has been told that some reaction classes will be updated?

regards...

Go to top
Re: Finding arexx port of window at pos x,y
Supreme Council
Supreme Council


See User information
Seems it's not possible to get hold or other programs' AppPort :(

The library method for doing it isn't appliable for OM_GET, and if I try it anyway I get the same port address for all windows and applications so I guess it's not returning a usefull value.

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top

  Register To Post

 




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




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project