On Thursday 26 January 2006 16:17, Granger, Michael C CIV wrote:
> Hi, I'm trying to find out if I can change the default behavior of the
> maximize button for a KMainWindow. I've googled and searched archives, but
> haven't found the solution.

KWin's current interpretation of "maximized" is "geometry exactly matches

> I have a toolbar at the top of my desktop which I don't want to be covered
> when I maximize my application. I would like the maximize button to make
> the application fill the rest of the screen, just not the toolbar.
> I have tried to use QWidget::setMaximumHeight() and QWidget
> ::setMaximumSize(), but if I use these commands, the maximize button just
> disappears from the system menu.

If a window's maximum size is smaller than the size of the workarea, then
indeed the window cannot be resized to be maximized. And, even if KWin tried
to resize the window to its maximum size in such case, you'd still have no
guarantee it'd place it where you want.

> I know this should be possible because the system taskbar has an option
> under "Hiding" that says "Allow other windows to cover the panel" and if I
> maximize when this option is checked, the app resizes and covers the
> taskbar. If the option is not selected, the app will resize slightly
> smaller, so that it doesn't cover the taskbar. I just have yet to figure
> out how this works.

Kicker, besides being a dock window (KWin::setType() + NET:ock), also does
or doesn't set its strut (KWin::setStrut()) which makes it reserve a certain
area at some screen edge. KWin sees struts of all windows and makes workarea
to be the screen area minus place takes by struts.

> I'm also not sure if this is something I have to do inside my app or if
> this is something that I have to do with KWin.

Since this has to do with managing windows, I guess it should be done in the
window manager, hence the name. Since I assume that toolbar you're talking
about is just a normal torn-off toolbar of some application, this should even
be the Kicker case, and you're probably talking about
http://bugs.kde.org/show_bug.cgi?id=26425 . If implemented, KWin could have
an option to automatically snap a torn-off toolbar of the active application
to some edge and it'd work for all apps, not inconsistently just yours.

If you'd be willing to give it a try, just say so and I'll give you some
hints. It would be a bit more complicated than just putting a call to
resize() at some point but it should be limited to the parts of KWin which
are no rocket science.

Lubos Lunak
KDE developer
SuSE CR, s.r.o. e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27 tel: +420 2 9654 2373
190 00 Praha 9 fax: +420 2 9654 2374
Czech Republic http://www.suse.cz/

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<