Sections

 Who's Online 55 user(s) are online (38 user(s) are browsing Forums) Members: 0 Guests: 55 more...

 Headlines libharfbuzz.lha - development/library/graphics Apr 20, 2024 libpng.lha - development/library/graphics Apr 20, 2024 libsdl2_ttf.lha - development/library/graphics Apr 20, 2024 libz.lha - development/library/misc Apr 20, 2024 amiarcadia.lha - emulation/gamesystem Apr 20, 2024 doomrpg.lha - game/board Apr 20, 2024 amidisas.tar.bz2 - development/utility Apr 16, 2024 wildmidi.lha - audio/play Apr 15, 2024 liba52.lha - development/library/audio Apr 14, 2024 libcurl.lha - development/library/misc Apr 14, 2024

# Lame intuition/reaction based questions

 Register To Post

Lame intuition/reaction based questions
@All

Can anybody explain plz, why when i do this:

``` //     struct IBox box;     GetWindowAttr( w, WA_WindowBox, &box, sizeof( box ) );                 DebugPrintF("Before : Left = %d  Top = %d  Width = %d Height = %d\n", box.Left, box.Top, box.Width, box.Height);              SetWindowAttr( w, WA_Height, (APTR)(LONG)100, sizeof(LONG));     GetWindowAttr( w, WA_WindowBox, &box, sizeof( box ) );     DebugPrintF("After : Left = %d  Top = %d  Width = %d Height = %d\n", box.Left, box.Top, box.Width, box.Height); ```

While i do change the size of window actually, the latest GetWindowAttr() do not reflect the changes i do, and printf for me the same values (while, i can see the size of window changes).

Re: Lame intuition/reaction based questions
@kas1e
A lot of intuition, not only BOOPSI gadgets/images/etc., is done asynchronously, not directly executing the code in the task calling some intuition functions but sending messages to it's input.device task which (later) does the actual work.
Simple functions like IIntuition->GetWindowAttr() may be executed immediately in the task using them, but functions doing more complex things like changing the size of a window with IIntuition->SetWindowAttr() may be forwarded to the input.device task.

Re: Lame intuition/reaction based questions
@joerg
Added simple IDOS->Delay(1); did the trick indeed ! Isn't there some "safe" and fast way to do that (as Delays are suck hard of course).

I mean, not adding some "microseonds" of wait (which probably will be different on different hardware), but some kind of safe API maybe calling after SetAttr ?

Another question (if you doesn't mind): Is there a safe way how to extend the wb window in terms of gadgets : i.e. i want to shift down to 24 pixels a top gadget "name","type" and "data" of the already opened window, insert in this new place my new gadget, and refresh the window, so it will looks as i need (preferable for users to not notice how those changes to the window applied).

Currently, the new gadget i add by patching just overwrite the window's content on top. I am thinking that probabaly i need to read whole window gadgets by getattr(), relayout them, and upload them back via setattr() together with my new ones.

Edited by kas1e on 2023/11/21 6:50:44
Edited by kas1e on 2023/11/21 6:52:30
Re: Lame intuition/reaction based questions
Ordinarily, waiting for IDCMP_NEWSIZE would be the "safe" way to know the resize has been completed and the new size values present in the window struct. I'm not sure if that's easy to detect though when you don't own the window yourself.

Re: Lame intuition/reaction based questions
@All
Is there any correct way to know the full path of the opened workbench window ? So far all i find is *Title string in the window's structure , but i am sure there should be something better to get this information from a workbench window ?

Re: Lame intuition/reaction based questions
@kas1e

Don't think there is.
Maybe insde wb_lib or whoever do such task to open wb drawers/windows uses a "own" struct with some data and one is STRPTR for fullpath.
something like

struct wbdata_t {
APTR window;
...
STRPTR win_path;
};

Re: Lame intuition/reaction based questions
There's no way that I know of using the standard API. I used the ARexx interface to get the name of the currently active window, and then checked to make sure the dimensions matched the window struct of the current window from Intuition so I could be reasonably sure it was the same window. This isn't bullet-proof of course...

Re: Lame intuition/reaction based questions
@Javier
Quote:

Maybe insde wb_lib or whoever do such task to open wb drawers/windows uses a "own" struct with some data and one is STRPTR for fullpath.

Question is where is it :)

Quote:

I used the ARexx interface to get the name of the currently active window,

As one more idea .. but not very "system" ones imho :) Anwyay, thanks for idea.. But why you need to check dimensions ? Just for sake of double-checking ?

@All
When we click on icon, it involves surely some more functions and not only "openwindowtaglist()", but maybe something else which did containt "full path" in structs ? It should be somewhere all in all..

Re: Lame intuition/reaction based questions
@kas1e

Does DrawerGenie get such path too? Then you can look in its sources how.

You posted that DG does "SetMethod()" in these functions:
/*
SetMethod():
OpenWindowTagList()
CloseWindow()
SetWindowTitles()
RemoveAppWindow()
RemoveAppWindowDropZone()
LockLayerInfo()
*/
Maybe one of Add#? or Set#? is getting such stringpath, can you check what they do?

I "added" CloseWindow() on my buggy version.

Re: Lame intuition/reaction based questions
@Javier
Quote:

Does DrawerGenie get such path too? Then you can look in its sources how.

DrawerGeniue written by Daedalus on BlitzBasic, he already answer in the previous post how he do it :) (arexx interface)

Quote:

You posted that DG does "SetMethod()" in these functions:

It wasn't about DG, but about Dopus5 :) Its list of patched functions for Dopus5 when it's in workbench replacement mode. Yeah, will check, maybe it will bring some idea as well

Re: Lame intuition/reaction based questions
@kas1e:

have a look at workbench.library/WhichWorkbenchObject
with the tag WBOBJA_DrawerPath

Re: Lame intuition/reaction based questions
@kas1eQuote:
kas1e wrote:
As one more idea .. but not very "system" ones imho :) Anwyay, thanks for idea..

I agree. I just couldn't find another way to access that information.

Quote:
But why you need to check dimensions ? Just for sake of double-checking ?

Yeah, it's a sanity check, just in case the Intuition current window and ARexx current window somehow aren't the same window.

Re: Lame intuition/reaction based questions
@Daedalus

<offtopic>
BTW when do you plan another codign stream?
</offtopic>

Re: Lame intuition/reaction based questions
@Ami603
Quote:

have a look at workbench.library/WhichWorkbenchObject
with the tag WBOBJA_DrawerPath

Wow, thanks! Seems to be what i need !:

``` screen = IIntuition->LockPubScreen(NULL); ....         IWorkbench->WhichWorkbenchObject(NULL,screen->MouseX,screen->MouseY,                                     WBOBJA_FullPath,&path,                                     WBOBJA_FullPathSize,1024,                                     WBOBJA_DrawerPath,&dpath,                                     WBOBJA_DrawerPathSize,1024,                                     TAG_DONE);                           IExec->DebugPrintF("path = %s\n",path);         IExec->DebugPrintF("dpath = %s\n",dpath); .... ```

Through found some moment : when one window opens on top of the previous ones, and the mouse cursors are over both of them, then i have empty string returned. While i were expected to get it from the active window.. But maybe there another flag for ?

Edited by kas1e on 2023/11/24 3:13:40
Edited by kas1e on 2023/11/24 3:19:19
Re: Lame intuition/reaction based questions
@Ami603Quote:
Ami603 wrote:@kas1e:

have a look at workbench.library/WhichWorkbenchObject
with the tag WBOBJA_DrawerPath

Oh, cool - that's a new addition for OS4. It would be most helpful in OS3.

@jabiruloQuote:
jabirulo wrote:@Daedalus

<offtopic>
BTW when do you plan another codign stream?
</offtopic>

:) Whenever I have some time. I'm pretty busy at the moment but I'll get back to it soon...

Re: Lame intuition/reaction based questions
@kas1e
Quote:
Through found some moment : when one window opens on top of the previous ones, and the mouse cursors are over both of them, then i have empty string returned. While i were expected to get it from the active window.. But maybe there another flag for ?
If you pass the pointer of the active window instead of NULL, and change the mouse x/y to be relative to the top/left of that window instead of the screen, you should get what you want.

Re: Lame intuition/reaction based questions
@All
Is there a way to check if a clicked icon is one sitting on the desktop (i.e., main root icon), or not ?

Re: Lame intuition/reaction based questions
@kas1e

Doesn't WBOBJA_FullPath tag get what you want?

Or maybe WBOBJA_Type.

 Register To Post

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