Haiku Stack & Tile API - what about applications stacking themselves?

Hi, I’ve recently discovered the unique feature of Haiku which is Stack & Tile. I find it most useful when programming as I can merge all Paladin windows into one as on this screenshot:


In my opinion we should add API, that would add possibility for developers to use this feature from the application side.
This could be used in Paladin so for example, when choosing “MainWindow.cpp” from main Paladin window, it would automatically merge Pe with main window. If errors were generated when compiling, Paladin would stick the “Error and warnings” window to the bottom.
The second use of this API would be in web browser. I think that this one is obvious: when opening new tab, browser would actually create a new window and stack it with the original one, so it would look like this:

This API could also give developers an option to specify if user can close the window, detach it or how windows would behave on resizing.

How hard would be implementing something like this in Haiku?
And finally, what do you think about it? Would you use this API when programming?

The idea of an S&T API has been around about as long as the feature itself. See ticket #7868.
But so have been various tickets dealing with bugs and enhancements in that area… :slight_smile:

Why isn’t there an official API yet? I don’t know. Maybe creating a good API is hard and the devs decided to do it after the R1 release. Which got delayed and delayed, and here we are.

There is, however, a bit of private API you can have a look at or use as starting point to experiment with and improve upon. Just be aware that it’s private and not stable!

As an example, you can check out the Netsurf browser from HaikuDepot, which already uses stacking for its windows.

Actual API meant for use by applications: http://cgit.haiku-os.org/haiku/tree/headers/private/interface/WindowStack.h
What humdinger linked is the internal message names used to implement it, which you shouldn’t need to mess with.

I didn’t expect that :smile:! Anyway, I am beginning developer, so I don’t know even how to use private headers…
I will try to play with this API and maybe I will be able to do something useful with it.

See also this thread: Is Stack & Tile scriptable?

You just

#include "WindowStack.h"

and then create a BWindowStack from one of your BWindows:

BWindowStack* stack = new BWindowStack(myWindow);

Then you can add and remove other windows from the stack:

stack->AddWindow(anotherWindow);
stack->RemoveWindow(anotherWindow).

You may need to link with -lshared.

1 Like

Would be fine to get some one to add this as function into yab :slight_smile:

1 Like

What’s a little funny is that MSFT have just decided to add this functionality in Windows 10!

I’ve used tabs for quite a long time in Finder on Mac, so I guess now it’s MS Explorer’s time :wink: