summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcontrol-center41
1 files changed, 20 insertions, 21 deletions
diff --git a/control-center b/control-center
index 25fe83b0..5f3fe22b 100755
--- a/control-center
+++ b/control-center
@@ -41,12 +41,14 @@ my ($bindir, $sbindir, $xbindir) = ("/usr/bin", "/usr/sbin", "/usr/X11R6/bin");
my $mcc_dir = "/usr/share/mcc";
my $themes_dir = "$mcc_dir/themes/";
+my (%tool_pids, %tool_feedback);
my ($version, $conffile, $class_install) = ("9.2", "/etc/mcc.conf", "/etc/sysconfig/system");
+my ($default_heigth, $default_width) = (523, 720);
+
require_root_capability(); # just to get root capabilities
-my ($default_heigth, $default_width) = (523, 720);
#-------------------------------------------------------------
# read configuration, set themes, ...
@@ -588,7 +590,7 @@ my (undef, $nodename, $release, undef, $machine) = POSIX::uname();
# left icons :
my @darea_left_list;
-my ($cursor_hand, $cursor_normal) = (Gtk2::Gdk::Cursor->new('hand2'), Gtk2::Gdk::Cursor->new('left-ptr'));
+my ($hand_cursor, $normal_cursor, $wait_cursor) = map { Gtk2::Gdk::Cursor->new($_) } qw(hand2 left-ptr watch);
my $left_back_pixbuf = rtl_gtkcreate_pixbuf('mcc-left-back');
my ($back_width, $back_height) = ($left_back_pixbuf->get_width, $left_back_pixbuf->get_height);
@@ -605,7 +607,7 @@ my @colors = (gtkcolor(0, 0, 0), gtkcolor(0xAA, 0xAA, 0xFF), gtkcolor(0, 0, 0))
my $spacing = 25;
my ($lspacing, $left_txt_offset, $icon_offset);
-my $hand_cursor = sub { $_[0]->window->set_cursor($cursor_hand) };
+my $set_hand_cursor = sub { $_[0]->window->set_cursor($hand_cursor) };
# Create left icons
foreach (@tree) {
@@ -679,7 +681,7 @@ foreach (@tree) {
$old_state[$my_index] = $curr_state;
$darea_left->window->draw_drawable($darea_left->style->bg_gc('normal'), $dbl_area_left[$curr_state], $x, $y, $x, $y, $width, $height);
});
- $darea_left->signal_connect(realize => $hand_cursor);
+ $darea_left->signal_connect(realize => $set_hand_cursor);
$darea_left->signal_connect(enter_notify_event => sub {
return if $old_state[$my_index] == -1 || $curr_state[$my_index] != 0;
$curr_state[$my_index] = 1;
@@ -701,12 +703,12 @@ foreach (@tree) {
# deselect previously selected darea
if ($index_sav != -1) {
$curr_state[$index_sav] = 0;
- $hand_cursor->($darea_left_list[$index_sav]);
+ $set_hand_cursor->($darea_left_list[$index_sav]);
$darea_left_list[$index_sav]->queue_draw;
}
$index_sav = $my_index;
$curr_state[$my_index] = 2;
- $darea_left->window->set_cursor($cursor_normal);
+ $darea_left->window->set_cursor($normal_cursor);
$darea_left->queue_draw;
set_page($my_index+1);
});
@@ -742,8 +744,9 @@ foreach (@tree) {
$tv->set_events([]);
$event_box->set_events([ 'enter_notify_mask', 'leave_notify_mask', 'button_press_mask', 'button_release_mask' ]);
# FIXME: do ->set_pixbuf() on {enter,leave}_events
- $event_box->signal_connect(realize => $hand_cursor);
- $event_box->signal_connect(button_release_event => sub { compute_exec_string($tag, @{$exec_hash->{$label}}) });
+ $event_box->signal_connect(realize => $set_hand_cursor);
+ $tool_feedback{$label} = sub { $event_box->window->set_cursor($normal_cursor) };
+ $event_box->signal_connect(button_release_event => sub { compute_exec_string($label, $event_box, $tag, @{$exec_hash->{$label}}) });
# FIXME : resize sig: ->foreach; set_size_request
gtkset_size_request($event_box, 50, -1);
@@ -886,7 +889,8 @@ sub fork_ {
}
sub compute_exec_string {
- my ($icon, $log_exp, $exec_, $gtkplug, undef, $alternate) = @_; #($_[0], @{$_[1]});
+ my ($label, $box, $icon, $log_exp, $exec_, $gtkplug, undef, $alternate) = @_; #($_[0], @{$_[1]});
+ return if $tool_pids{$label};
my $exec = ref($exec_) ? $exec_->[0] : $exec_;
if (! -x first(split /\s+/, $exec)) {
splash_warning(N("cannot fork and exec \"%s\" since it is not executable", $exec));
@@ -908,7 +912,7 @@ sub compute_exec_string {
$run_counter_add = -10;
$timeout = Glib::Timeout->add(70, sub { $run_darea->queue_draw; 1 });
$left_locked = 1;
- fork_($exec);
+ $tool_pids{$label} = fork_($exec);
} else { # gtkplug == 0
$emb_box->grab_focus;
$emb_socket->grab_focus;
@@ -922,20 +926,11 @@ sub compute_exec_string {
# fix #3415 when $gtkplug eq -1
my $old = $option_values{embedded};
$option_values{embedded} = 0;
- fork_($gtkplug == 0 ? $exec_->[0] : $alternate || $exec);
+ $tool_pids{$label} = fork_($gtkplug == 0 ? $exec_->[0] : $alternate || $exec);
$option_values{embedded} = $old;
}
-#FIXME
-# if ($option_values{embedded} && $gtkplug != -1) {
-# foreach (@darea_left_list) {
-# $_->->window->set_cursor($cursor_hand);
-# if ($_->{state} != 0) {
-# $_->{state} = 0;
-# $_->->draw(undef);
-# }
-# }
-# }
start_logdrake();
+ $box->window->set_cursor($wait_cursor);
$w_exp->hide if $embedded && $exec =~ /^drakfont|logdrake|mousedrake/;
}
@@ -1007,6 +1002,10 @@ sub sig_child() {
my $child_pid;
do {
$child_pid = waitpid(-1, POSIX::WNOHANG);
+ if (my $tool = find { $tool_pids{$_} eq $child_pid } keys %tool_pids) {
+ $tool_feedback{$tool}->();
+ delete $tool_pids{$tool};
+ }
undef $pid_exp if $pid_exp eq $child_pid;
} while $child_pid > 0;
# child unexpectedly died (cleanup since child_just_exited won't be called by plug-removed since plug never was added)