Re: Resizing the mainwindow and displaying SVG's



zentara wrote:
Hi,
I've been playing around with the recently announced
Gnome2::Rsvg module, and tried to make a script that
would automatically resize the svg after the mainwindow
is resized.

I've come up with the following script, which I need to
somehow speed up. The script works, but it seems to hesitate
as the configure event goes through each of it's calls
as the window is resized with a corner drag.

Is there some way, to detect when the resize has finished?
So that I can only do the reloading of the svg after the
corner-drag has ended?
I don't know about detecting when a resize operation has completed, but you can do something like:

Detect when a resize happens. Check the status of a 'queued-resize' flag. If it exists, continue. If it doesn't exist, then queue your resizing code ( ie set up a timer event ... Glib::Timeout->add() ) a fraction of a second into the future ( you'll have to play with the exact timing to suit the speed of your PC ), and also set your 'queued-resize' flag. Then when your resizing code runs, remove the timer and reset the flag. The idea is that you don't resize the svg for every single 'step' of resizing the parent window.

You can also make sure your rendering setup is as fast as possible. The latest versions of gtk+ ( ie 2.8 and greater ) use cairo to do their rendering, which in turn uses the XRENDER extension. If you're using a Radeon video card, you can try out EXA in the latest xorg, which accelerates XRENDER considerably ( for some Radeons anyway ). If you're using an nVidia, then I think any recent proprietary nVidia driver will accelerate XRENDER for you.

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au



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