ShowWindow() - bug?

This forum is for general developer support questions.
Post Reply
whose
Posts: 92
Joined: Sun Sep 04, 2011 3:11 pm

ShowWindow() - bug?

Post by whose »

I'm working on WinZoom, with permission of the author, to get an OS4 native version of this commodity. It sports some "snap" function to "snap" windows to the title bar. The snapping using HideWindow() works ok. Just the "unsnapping", using ShowWindow(), doesn't make any window visible.

I made some tests with debug output, giving the coordinates/sizes of the window to unsnap, and they seemed to be ok. So I used ShowLayer() with the window's layer as parameter, and voilá, the window appears. It seems that ShowWindow() doesnt make the window layers, hidden by HideWindow(), visible again. Is this a bug?

The documentation says, that ShowWindow() expects some second parameter giving a pointer to the "other" window, which seems to be used as reference for layer placing. It didn't work for any real window pointer I gave to it (returned FALSE), BUT it works for a NULL pointer! Why is this? Is it safe to give a NULL pointer?
User avatar
gazelle
Posts: 102
Joined: Sun Mar 04, 2012 12:49 pm
Location: Frohnleiten, Austria

Re: ShowWindow() - bug?

Post by gazelle »

whose wrote:..., BUT it works for a NULL pointer! Why is this? Is it safe to give a NULL pointer?

Code: Select all

/* from intuition/intuition.h */
/*
 * Special codes for ShowWindow() and WA_InFrontOf:
 * Give this as target window where to move your window to.
 */

#define WINDOW_BACKMOST  ((struct Window *)0)
#define WINDOW_FRONTMOST ((struct Window *)1)
Looks like NULL would be equal to WINDOW_BACKMOST.

Why it doesn't work for real windows I can't say. You did use a real window pointer and not an reaction window object pointer?
whose
Posts: 92
Joined: Sun Sep 04, 2011 3:11 pm

Re: ShowWindow() - bug?

Post by whose »

You´re right, NULL equals to WINDOW_BACKMOST...

Yes, I used several "real Window" pointers (IntuitionBase->ActiveWindow, Screen->FirstWindow, known program windows), but those have no effect at all, ShowWindow() gives FALSE all the time.

I learned that ShowLayer() does the same job, if I use the WLayer pointer. Remarkably, ALL layers are visible after this. In OS3 times, I would need to do ShowLayer() on BorderLayer etc. to make the whole WIndow visible again.

Maybe this is why ShowWindow() doesn´t work at all? Never tested, because ShowLayer() does the same job? ;-)
whose
Posts: 92
Joined: Sun Sep 04, 2011 3:11 pm

Re: ShowWindow() - bug?

Post by whose »

*bump*

No OS developer here who could say something about ShowWindow() and the strange behaviour? I would really like to produce clean code, in a way that it uses symmetric system calls instead of one Window related and one doing (yet unknown) things on one or more Layer structures...
bubbob42
Posts: 5
Joined: Wed Jul 23, 2014 7:27 pm

Re: ShowWindow() - bug?

Post by bubbob42 »

We'd really like to get WinZoom (I'm the original author) ported properly - who is responsible for Intuition stuff in OS4?
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: ShowWindow() - bug?

Post by salass00 »

@whose

If you can post some code that doesn't work for you that is using ShowWindow() that I can use for testing then I can look into this.
whose
Posts: 92
Joined: Sun Sep 04, 2011 3:11 pm

Re: ShowWindow() - bug?

Post by whose »

Hi salass00,

I will prepare some example code which is hiding it´s own window (and tries to ShowWindow() it again), as the code of our question is a bit too complex to post it here as a working example. Might last two or three days, until I get to it, but I will post it ;-) Thank you very much in advance!
Post Reply