2 * Copyright (c) 1998 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote
14 * products derived from this software without specific prior written
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHRO AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHRO OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * $FreeBSD: src/release/sysinstall/mouse.c,v 1.7.2.1 2000/07/14 07:51:47 jhb Exp $
30 * $DragonFly: src/release/sysinstall/Attic/mouse.c,v 1.2 2003/06/17 04:27:21 dillon Exp $
33 #include "sysinstall.h"
37 mousedTest(dialogMenuItem *self)
44 type = variable_get(VAR_MOUSED_TYPE);
45 port = variable_get(VAR_MOUSED_PORT);
46 flags = variable_get(VAR_MOUSED_FLAGS);
47 if ((type == NULL) || (port == NULL)
48 || (strlen(type) <= 0) || (strlen(port) <= 0)
49 || (strcmp(type, "NO") == 0)) {
50 msgConfirm("Please select a mouse protocol and a port first.");
54 msgNotify("Trying to start the mouse daemon...");
55 if (file_readable("/var/run/moused.pid"))
56 vsystem("kill `cat /var/run/moused.pid`");
57 systemExecute("vidcontrol -m on");
59 vsystem("moused -t %s -p %s %s", type, port, flags);
61 vsystem("moused -t %s -p %s", type, port);
63 ret = msgYesNo("Now move the mouse and see if it works.\n"
64 "(Note that buttons don't have any effect for now.)\n\n"
65 " Is the mouse cursor moving?\n");
66 systemExecute("vidcontrol -m off");
68 if (file_readable("/var/run/moused.pid"))
69 vsystem("kill `cat /var/run/moused.pid`");
70 variable_set2(VAR_MOUSED, "NO", 1);
72 variable_set2(VAR_MOUSED, "YES", 1);
73 vsystem("ln -fs /dev/sysmouse /dev/mouse"); /* backwards compat */
76 return DITEM_SUCCESS | DITEM_RESTORE;
80 mousedDisable(dialogMenuItem *self)
82 if (file_readable("/var/run/moused.pid"))
83 vsystem("kill `cat /var/run/moused.pid`");
84 variable_set2(VAR_MOUSED, "NO", 1);
85 variable_set2(VAR_MOUSED_TYPE, "NO", 1);
86 variable_unset(VAR_MOUSED_PORT);
87 variable_unset(VAR_MOUSED_FLAGS);
88 msgConfirm("The mouse daemon is disabled.");
93 setMouseFlags(dialogMenuItem *self)
96 ret = variable_get_value(VAR_MOUSED_FLAGS,
97 "Please Specify the mouse daemon flags. If you would like to\n"
98 "emulate 3 buttons, use -3 here.\n", 1)
99 ? DITEM_SUCCESS : DITEM_FAILURE;
100 if (ret != DITEM_SUCCESS)
101 variable_unset(VAR_MOUSED_FLAGS);