From 2746a6460465e06de266196f4e090ab2d327743c Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 6 Feb 2004 17:20:07 +0000 Subject: - add change_mouse_live() - use /dev/mouse in XF86Config to allow changing protocol in standalone --- perl-install/mouse.pm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'perl-install/mouse.pm') 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; -- cgit v1.2.1