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/Makefile.config | 2 +- perl-install/install_steps_gtk.pm | 4 +--- perl-install/ugtk2.pm | 25 +++++++++++++++++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config index 2dd49d9db..082e21b79 100644 --- a/perl-install/Makefile.config +++ b/perl-install/Makefile.config @@ -24,7 +24,7 @@ STAGE2 = $(ROOTDEST)/Mandrake/base/mdkinst_stage2 BASE = $(ROOTDEST)/Mandrake/base DESTREP4PMS = $(DEST)$(REP4PMS) PERL = perl -LOCALFILES = $(patsubst %, ../tools/%,ddcprobe/ddcxinfos aewm-drakx/aewm-drakx serial_probe/serial_probe xhost+) +LOCALFILES = $(patsubst %, ../tools/%,ddcprobe/ddcxinfos serial_probe/serial_probe xhost+) DIRS = c Newt resize_fat #po CFLAGS = -Wall override CFLAGS += -pipe diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 9c5b01ac6..d38476972 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -65,9 +65,7 @@ sub new($$) { sleep 1; log::l("Server died"), return 0 if !$ok; if (c::Xtest($wanted_DISPLAY)) { - if (-x '/usr/bin/aewm-drakx') { - fork() || exec("aewm-drakx") || c::_exit(0); - } + $ugtk2::force_focus = 1; return 1; } } 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