diff options
-rw-r--r-- | perl-install/mouse.pm | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index d29fc5394..ed166a48f 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -347,7 +347,7 @@ sub set_xfree_conf { my @mice = map { { Protocol => $_->{XMOUSETYPE}, - Device => "/dev/$_->{device}", + Device => "/dev/mouse", if_($_->{nbuttons} > 3, ZAxisMapping => [ $_->{nbuttons} > 5 ? '6 7' : '4 5' ]), if_($_->{nbuttons} < 3, Emulate3Buttons => undef, Emulate3Timeout => 50), if_($_->{EMULATEWHEEL}, Emulate3Buttons => undef, Emulate3Timeout => 50, EmulateWheel => undef, EmulateWheelButton => 2), @@ -412,6 +412,23 @@ sub write_conf { $xfree_conf->write; } +sub change_mouse_live { + my ($mouse, $old) = @_; + + my $xId = xmouse2xId($mouse->{XMOUSETYPE}); + $old->{device} ne $mouse->{device} || $xId != xmouse2xId($old->{XMOUSETYPE}) or return; + + log::l("telling X server to use another mouse ($mouse->{XMOUSETYPE}, $xId)"); + 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); + } + 1; +} + sub test_mouse_install { my ($mouse, $x_protocol_changed) = @_; require ugtk2; |