summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-03-01 08:09:00 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-03-01 08:09:00 +0000
commitf4c77d966b0b5340d60c4632fce5b28e8f13162a (patch)
tree56530e8ee1fd82d1c888dce900025e66d6f56140
parentcdf1d8ab3ad037be3b42804c1c3bf5e7ac47b733 (diff)
downloadcontrol-center-f4c77d966b0b5340d60c4632fce5b28e8f13162a.tar
control-center-f4c77d966b0b5340d60c4632fce5b28e8f13162a.tar.gz
control-center-f4c77d966b0b5340d60c4632fce5b28e8f13162a.tar.bz2
control-center-f4c77d966b0b5340d60c4632fce5b28e8f13162a.tar.xz
control-center-f4c77d966b0b5340d60c4632fce5b28e8f13162a.zip
lighter cpu usage on wait_area: compute images once per animation
-rwxr-xr-xcontrol-center19
1 files changed, 12 insertions, 7 deletions
diff --git a/control-center b/control-center
index a2e5ac60..4598748d 100755
--- a/control-center
+++ b/control-center
@@ -523,7 +523,8 @@ gtkadd($window_global,
map { gtkset_border_width($_, 3) }
gtksignal_connect(my $cancel = Gtk2::Button->new(N("Cancel")),
clicked => sub {
- Glib::Source->remove($timeout) if $timeout; kill_children();
+ stop_wait_area();
+ kill_children();
child_just_exited();
}),
gtksignal_connect(my $previous = Gtk2::Button->new(N("Previous")),
@@ -674,13 +675,19 @@ foreach (keys %check_boxes) {
# "wait while launching a program" area :
-my ($run_pixbuf, $run_counter, $run_counter_add);
+my ($run_pixbuf, $run_counter, $run_counter_add, %run_pixbufs);
+
+sub stop_wait_area() {
+ $wait_darea->hide;
+ Glib::Source->remove($timeout) if $timeout;
+ undef %run_pixbufs;
+}
$wait_darea->signal_connect(expose_event => sub {
return if !$wait_darea->realized;
return unless $run_pixbuf; # some people got an expose event before we start an embedded tool
$wait_darea->{layout} ||= $wait_darea->create_pango_layout(N("Loading... Please wait"));
- my $pixbuf = render_alpha($run_pixbuf, $run_counter);
+ my $pixbuf = $run_pixbufs{$run_counter} ||= render_alpha($run_pixbuf, $run_counter);
my $size = $wait_darea->allocation;
my ($d_width, $d_height) = ($size->width, $size->height);
my ($window, $gc, $width, $height) = ($wait_darea->window, $wait_darea->style->fg_gc('normal'), $pixbuf->get_width, $pixbuf->get_height);
@@ -757,7 +764,7 @@ sub child_just_exited() {
$notebook->show;
}
- Glib::Source->remove($timeout) if $timeout;
+ stop_wait_area();
}
sub hide_socket_and_clean() {
@@ -778,9 +785,8 @@ sub create_hidden_socket {
# signal emitted when embedded apps begin to draw:
$emb_socket->signal_connect('plug-added' => sub {
$banner->show;
- Glib::Source->remove($timeout) if $timeout;
+ stop_wait_area();
$left_locked = 0;
- $wait_darea->hide;
show_hide_previous(0);
$buttons->hide;
return if !$emb_socket;
@@ -791,7 +797,6 @@ sub create_hidden_socket {
});
$emb_box->set_focus_child($emb_socket);
$emb_socket->hide;
- $wait_darea->hide;
}