[Kde-games-devel] does this solve the multiple resizing bug foryou?

Wolfgang Rohdewald wolfgang at rohdewald.de
Wed May 6 23:45:00 CEST 2009


On Mittwoch, 6. Mai 2009, Casper van Donderen wrote:
> Is this not a bit odd? Is there nothing to communicate with plasma to return the size of the plasma panel(s) because what happens if I use the gnome way of both a top & a bottom panel. Does it still work?

I copied the wrong version, this is better.

        available = KApplication.kApplication().desktop().availableGeometry()
        if self.ignoreResizing == 1: # at startup
# here, event.size(), self.geometry() and self.frameGeometry() are all identical,
# see explanation below
            if available.width() <= event.size().width() \
            or available.height() <= event.size().height():
                self.ignoreResizing += 1

availableGeometry() is the screen minus all side panels, I tested with 1-4 panels,
one per side. The values are always correct. The documentation says this is portable:
http://doc.trolltech.com/4.5/qdesktopwidget.html#availableGeometry

BUT: the main window gets its decoration (border, window title) only AFTER
the QGraphicsView is resized for the first time. This shows in event.size(),
geometry() and frameGeometry() being identical for the main window in the above
comparison. Maybe if the program took more time to start, the decoration might
be there first but that never happened in my tests with kmj.

So if the main window is just a little bit smaller than full screen in either
direction, the above test will not trigger and we have one resizing too much.
But I hope this is rare - normally I suppose the main window will rather be
maximized by the user. Also this will not repeat as long as the plasma panels
are not repositioned because the size will will be stored as maximized
in config/kmjrc.

So IMHO this can really only happen if 

1. size kmj such that it is not maximized but has almost that size. For testing,
I edited the values in kmjrc, group [MainWindow]

2. add plasma side panels

3. start kmj: one resize too much

4. end kmj: the window will be saved as being maximized

5. start kmj: everything is OK again, only one resize

this also explains why a maximized window always has one more resize: The first
one is for the window without decorators - after they get added, the window must
be made smaller.

In conclusion, we do not need to ask plasma or whatever window manager is running
for the side panel sizes, but we could ask it how much space the window borders
will take. I don't know such a function - and it should also work with MAC OS
and Windows. Maybe ask KWin via DBus but I don't know how.

-- 
Wolfgang


More information about the kde-games-devel mailing list