Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
83 user(s) are online (19 user(s) are browsing Forums)

Members: 1
Guests: 82

rwo, more...

Support us!

Headlines

 
  Register To Post  

[Solved] Active screen
Supreme Council
Supreme Council


See User information
Is there any way to determine which screen is active at the moment?

Trying to figure out on which screen a mouse click was made.

Edit: I just noticed that struct IntuitionBase contains struct Screen*ActiveScreen. Is it legal in os4 to peek the struct IntuitionBase directly?


Edited by orgin on 2009/5/8 14:23:24
Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: Active screen
Not too shy to talk
Not too shy to talk


See User information
@orgin

AFAIK IntuitionBase->ActiveScreen is the only way to know. There is also FrontScreen (from memory!). I don't think actually using these fields is recommended, but i don't know any other way..

Go to top
Re: Active screen
Just popping in
Just popping in


See User information
@orgin

No problem with this if you LockIBase() / UnLockIBase().

Go to top
Re: Active screen
Quite a regular
Quite a regular


See User information
@xeron

> AFAIK IntuitionBase->ActiveScreen is the only way...

How do you get around the following error message.

'struct Library' has no member named 'ActiveScreen'



Bill.

Go to top
Re: Active screen
Supreme Council
Supreme Council


See User information
@BillE

You need to typecast:

struct Screen *active;
     
BPTR lock IIntuition->LockIBase(0);
     
active = ((struct IntuitionBase *)IntuitionBase)->ActiveScreen;
     
IIntuition->UnlockIBase(lock);

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: [Solved] Active screen
Supreme Council
Supreme Council


See User information
@all

Set to solved, though I didn't get a conclusive answer if it's okey to peek the structure directly.

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: [Solved] Active screen
Just popping in
Just popping in


See User information
@orgin

From intuition autodoc, intuition.library/LockIBase

Quote:

[...]
Grabs Intuition internal semaphore so that caller may examine
IntuitionBase safely. This function is not a magic "fix all my
race conditions" panacea.
The idea here is that you can get the locks Intuition needs before
such IntuitionBase fields as ActiveWindow and FirstScreen are
changed, or linked lists of windows and screens are changed.

[...]


Go to top
Re: [Solved] Active screen
Supreme Council
Supreme Council


See User information
@centaurz

Which isn't conclusive to me. But it's moot anyway, I need to do it and now it's done.

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: [Solved] Active screen
Just popping in
Just popping in


See User information
@orgin

What do you mean by "not conclusive" ?

Go to top
Re: Active screen
Quite a regular
Quite a regular


See User information
@orgin


Quote:

orgin wrote:
@BillE

You need to typecast:

active = ((struct IntuitionBase *)IntuitionBase)->ActiveScreen;


Thanks for that. It is more or less what I tried, but I was missing the outer set of brackets. It works now


Bill

Go to top
Re: Active screen
Not too shy to talk
Not too shy to talk


See User information
@orgin

Thanks for the code. I didnt know this existed.. so I've used it in my Alt Tab Switcher program. Uploaded to os4depot.net already. :)

From the readme:
Thanks to Orgin and Xeron on www.amigans.net for providing code for detecting
the active screen!

Changes
-------
v1.9
- Previously, opening the Alt Tab Switcher window would jump to the screen
where it was last closed. So if you used the switcher to switch to Screen A,
then used RAmiga+M to get to Screen B, pressing Alt+Tab again would make
Screen A appear and the AltTabSwitcher GUI would appear on that screen.
This has now been fixed!
AltTabSwitcher will now always appear on the CURRENT screen.

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-2024 The XOOPS Project