From abbe4a3de13983cbcab7c62f08457fccd6aa9bee Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 8 Sep 2003 12:36:10 +0000 Subject: fixing keyboard focus during install: - removed aewm-drakx which doesn't work nicely - fix @interactive::objects handling (don't push non pop_it windows, ensure destroyed windows are removed) - ensure XSetInputFocus is called on $::WizardWindow --- perl-install/ugtk2.pm | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'perl-install/ugtk2.pm') diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index 4f434ce52..24d0f2210 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -806,9 +806,6 @@ sub new { my $o = bless { %opts }, $type; $o->_create_window($title); while (my $e = shift @tempory::objects) { $e->destroy } - push @interactive::objects, $o if !$opts{no_interactive_objects}; - $o->{rwindow}->set_modal(1) if ($grab || $o->{grab} || $o->{modal}) && !$::isInstall; - $o->{rwindow}->set_transient_for($o->{transient}) if $o->{transient}; $o->{pop_it} ||= $pop_it || $::WizardTable && do { my @l = $::WizardTable->get_children; @@ -816,6 +813,12 @@ sub new { any { $_->visible } @l; }; + if ($o->{pop_it}) { + push @interactive::objects, $o if !$opts{no_interactive_objects}; + $o->{rwindow}->set_modal(1) if ($grab || $o->{grab} || $o->{modal}) && !$::isInstall; + $o->{rwindow}->set_transient_for($o->{transient}) if $o->{transient}; + } + if ($::isWizard && !$o->{pop_it}) { $o->{isWizard} = 1; $o->{window} = Gtk2::VBox->new(0,0); @@ -824,6 +827,8 @@ sub new { if (!defined($::WizardWindow)) { $::WizardWindow = Gtk2::Window->new('toplevel'); $::WizardWindow->signal_connect(delete_event => sub { die 'wizcancel' }); + $::WizardWindow->signal_connect(expose_event => \&_XSetInputFocus) if $force_focus || $o->{force_focus}; + $::WizardTable = Gtk2::Table->new(2, 2, 0); $::WizardWindow->add(gtkadd(gtkset_shadow_type(Gtk2::Frame->new, 'out'), $::WizardTable)); @@ -916,6 +921,7 @@ sub show($) { sub destroy($) { my ($o) = @_; $o->{rwindow}->destroy if !$o->{destroyed}; + @interactive::objects = grep { $o != $_ } @interactive::objects; gtkset_mousecursor_wait(); flush(); } @@ -945,7 +951,7 @@ sub _create_window($$) { $w->set_name("Title"); $w->set_title($title); - $w->signal_connect(expose_event => sub { eval { $interactive::objects[-1]{rwindow} == $w and $w->window->XSetInputFocus } }) if $force_focus || $o->{force_focus}; + $w->signal_connect(expose_event => \&_XSetInputFocus) if $force_focus || $o->{force_focus}; $w->signal_connect(delete_event => sub { if ($::isWizard) { $w->destroy; die 'wizcancel' } else { Gtk2->main_quit } }); $w->set_uposition(@{$force_position || $o->{force_position}}) if $force_position || $o->{force_position}; @@ -975,6 +981,17 @@ sub _create_window($$) { $o->{rwindow} = $w; } +sub _XSetInputFocus { + my ($w) = @_; + log::l("_XSetInputFocus"); + if (!@interactive::objects || $interactive::objects[-1]{rwindow} == $w) { + $w->window->XSetInputFocus; + } else { + log::l("not XSetInputFocus since already done and not on top"); + } + 0; +} + # -=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=---=-=--- # ask -- cgit v1.2.1