Re: Getting window size (correctly)



geometry is a *requested* size -- you want an allocation, which is the
resulting size.

You probably *also* want to run this after an expose_event -- when the
app first starts up it isn't going to have a real allocation yet, and
the allocations all (well mostly) change on a window resize...

To avoid the mysterious [2,3], I now use:

        my ($alloc_x, $alloc_y, $alloc_w, $alloc_h) = @{$w->allocation};

though you can be less verbose about it in context.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]