From b90a8c0290b372790636d7f1d4b306c7af39834d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 11 Jan 2005 09:17:47 +0000 Subject: - $current_window can be local to ugtk2, so do it that way - create force_keyboard_focus() --- perl-install/ugtk2.pm | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'perl-install') diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index 9677246fe..7d16fb08f 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -964,10 +964,7 @@ sub _create_window { }); if ($no_Window_Manager) { - #- force keyboard focus instead of mouse focus - (my $previous_current_window, $ugtk2::current_window) = ($ugtk2::current_window, $w); - $w->signal_connect(expose_event => \&_XSetInputFocus); - $w->signal_connect(destroy => sub { $ugtk2::current_window = $previous_current_window }); + force_keyboard_focus($w); } if ($::isInstall) { @@ -992,16 +989,26 @@ sub _create_window { $w; } -sub _XSetInputFocus { +my $current_window; +sub force_keyboard_focus { my ($w) = @_; - if ($ugtk2::current_window == $w) { - $w->window->XSetInputFocus; - } else { - log::l("not XSetInputFocus since already done and not on top"); + + sub _XSetInputFocus { + my ($w) = @_; + if ($current_window == $w) { + $w->window->XSetInputFocus; + } else { + log::l("not XSetInputFocus since already done and not on top"); + } + 0; } - 0; -} + #- force keyboard focus instead of mouse focus + my $previous_current_window = $current_window; + $current_window = $w; + $w->signal_connect(expose_event => \&_XSetInputFocus); + $w->signal_connect(destroy => sub { $current_window = $previous_current_window }); +} # -=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=--- # ask -- cgit v1.2.1