summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/install_steps_gtk.pm22
-rw-r--r--perl-install/mouse.pm13
2 files changed, 21 insertions, 14 deletions
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index 583fb8a47..ebb849d39 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -163,15 +163,21 @@ sub selectMouse {
local $ugtk2::grab = 1; #- unsure a crazy mouse don't go wild clicking everywhere
while (1) {
- log::l("telling X server to use another mouse");
- eval { modules::load('serial') } if $mouse->{device} =~ /ttyS/;
-
- if (!$::testing) {
- devices::make($mouse->{device});
- symlinkf($mouse->{device}, "/dev/mouse");
- c::setMouseLive($ENV{DISPLAY}, mouse::xmouse2xId($mouse->{XMOUSETYPE}), $mouse->{nbuttons} < 3);
+ my $xId = mouse::xmouse2xId($mouse->{XMOUSETYPE});
+ my $x_protocol_changed = $old{device} ne $mouse->{device} || $xId != mouse::xmouse2xId($old{XMOUSETYPE});
+ if ($x_protocol_changed) {
+ log::l("telling X server to use another mouse");
+ eval { modules::load('serial') } if $mouse->{device} =~ /ttyS/;
+
+ if (!$::testing) {
+ devices::make($mouse->{device});
+ symlinkf($mouse->{device}, "/dev/mouse");
+ c::setMouseLive($ENV{DISPLAY}, $xId, $mouse->{nbuttons} < 3);
+ }
}
- mouse::test_mouse_install($mouse) and return;
+ mouse::test_mouse_install($mouse, $x_protocol_changed) and return;
+
+ %old = %$mouse;
$o->SUPER::selectMouse(1);
$mouse = $o->{mouse};
}
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm
index 6db3de123..c650d4d23 100644
--- a/perl-install/mouse.pm
+++ b/perl-install/mouse.pm
@@ -405,7 +405,7 @@ sub write_conf {
}
sub test_mouse_install {
- my ($mouse) = @_;
+ my ($mouse, $x_protocol_changed) = @_;
require ugtk2;
ugtk2->import(qw(:wrappers :create));
my $w = ugtk2->new('', disallow_big_help => 1);
@@ -418,7 +418,7 @@ sub test_mouse_install {
gtkset_sensitive(create_okcancel($w, undef, undef, 'edge'), 1)
),
);
- test_mouse($mouse, $w, $darea, $width, $height);
+ test_mouse($mouse, $w, $darea, $width, $height, $x_protocol_changed);
$w->sync; # HACK
Gtk2::Gdk->pointer_grab($vbox_grab->window, 1, 'pointer_motion_mask', $vbox_grab->window, undef, 0);
$w->main;
@@ -438,7 +438,7 @@ sub test_mouse_standalone {
}
sub test_mouse {
- my ($mouse, $_w, $darea, $width, $height) = @_;
+ my ($mouse, $_w, $darea, $width, $height, $x_protocol_changed) = @_;
# $darea->realize; IS IT REALLY NEEDED? generates a Gtk-CRITICAL when run..
require ugtk2;
@@ -469,10 +469,11 @@ sub test_mouse {
$drawarea = sub {
$draw_pixbuf->($image, 0, 0, 210, 350);
if ($::isInstall) {
- my $bad_mouse = member($mouse->{XMOUSETYPE}, 'IMPS/2', 'ExplorerPS/2');
$draw_text->(N("Please test the mouse"), $height - 120);
- $draw_text->(N("To activate the mouse,"), $height - 105) if $bad_mouse;
- $draw_text->(N("MOVE YOUR WHEEL!"), $height - 90) if $bad_mouse;
+ if ($x_protocol_changed && $mouse->{nbuttons} > 3 && member($mouse->{XMOUSETYPE}, 'IMPS/2', 'ExplorerPS/2')) {
+ $draw_text->(N("To activate the mouse,"), $height - 105);
+ $draw_text->(N("MOVE YOUR WHEEL!"), $height - 90);
+ }
}
};