summaryrefslogtreecommitdiffstats
path: root/mouse.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2000-04-27 15:39:02 +0000
committerMatt Wilson <msw@redhat.com>2000-04-27 15:39:02 +0000
commit7fb1679581871ed83bac3cbcddcc46aa162dc5c4 (patch)
tree8caeb16188f142ed8948b6f24fc09b0d9352d6eb /mouse.py
parent58fbf93ed369ca8cf76f712db9f10a90c36d6e0c (diff)
downloadanaconda-7fb1679581871ed83bac3cbcddcc46aa162dc5c4.tar.gz
anaconda-7fb1679581871ed83bac3cbcddcc46aa162dc5c4.tar.xz
anaconda-7fb1679581871ed83bac3cbcddcc46aa162dc5c4.zip
second pass at XFree86 4.0 support
Diffstat (limited to 'mouse.py')
-rw-r--r--mouse.py129
1 files changed, 92 insertions, 37 deletions
diff --git a/mouse.py b/mouse.py
index 94ed8e3fa..a0986fe78 100644
--- a/mouse.py
+++ b/mouse.py
@@ -1,6 +1,5 @@
import kudzu
from simpleconfig import SimpleConfigFile
-from snack import *
import os
class Mouse (SimpleConfigFile):
@@ -68,46 +67,39 @@ class Mouse (SimpleConfigFile):
}
# XXX fixme - externalize
- def __init__ (self, xmouseType = None, mouseType = None):
+ def __init__ (self):
self.info = {}
self.device = None
+ self.emulate = 0
+ self.set ("None - None")
- if (xmouseType):
- (proto, emulate, device) = xmouseType
- mouseType = None
- mice = self.mice.keys()
- mice.sort()
- for desc in mice:
- (gpm, x11, dev, em) = self.mice[desc]
-# print "trying %s: '%s', '%s'" % (desc, x11, proto)
- if (x11 == proto and emulate == em):
- if (desc[:7] == "Generic" or desc[:3] == "Sun"):
- mouseType = (desc, emulate, device)
- break
- self.device = device
- if not mouseType:
- raise KeyError, "unknown X11 mouse type %s" % proto
-
- if (mouseType):
- if (len(mouseType) == 3):
- apply(self.set, mouseType)
- else:
- list = kudzu.probe(kudzu.CLASS_MOUSE, kudzu.BUS_UNSPEC,
- kudzu.PROBE_ONE)
- if (list):
- (device, module, desc) = list[0]
-
- if device == "sunmouse":
- self.set("Sun - Mouse", 0)
- elif device == "psaux":
- self.set("Generic - 3 Button Mouse (PS/2)", 0)
- else:
- self.set("Generic - 2 Button Mouse (serial)", 1)
-
- self.device = device
- else:
- self.set("Generic - 2 Button Mouse (serial)", 1, 'ttyS0')
+ def probe (self):
+ list = kudzu.probe(kudzu.CLASS_MOUSE, kudzu.BUS_UNSPEC,
+ kudzu.PROBE_ONE)
+ if (list):
+ (device, module, desc) = list[0]
+ if device == 'psaux':
+ # kickstart some ps/2 mice. Blame the kernel
+ try:
+ f = open ('/dev/psaux')
+ f.write ('1')
+ f.close
+ except:
+ pass
+
+ if device == "sunmouse":
+ self.set("Sun - Mouse", 0)
+ elif device == "psaux":
+ self.set("Generic - 3 Button Mouse (PS/2)", 0)
+ else:
+ self.set("Generic - 2 Button Mouse (serial)", 1)
+ self.device = device
+ return 1
+ else:
+ self.set("None - None")
+ return 0
+
def available (self):
return self.mice
@@ -146,3 +138,66 @@ class Mouse (SimpleConfigFile):
self.emu = em
if not self.device and thedev: self.device = thedev
if not self.device: self.device = dev
+
+ def setXProtocol (self):
+ import xmouse
+ try:
+ curmouse = xmouse.get()
+ except RuntimeError:
+ # ignore errors when switching mice
+ return None
+ curmouse[0] = "/dev/" + self.device
+ # XXX
+ # IntelliMouse requires a full mouse reinit - X does not
+ # handle this properly from the mouse extention at this time
+ # so leave it alone
+ if (not self.info["XMOUSETYPE"] == "IMPS/2"
+ and not self.info["XMOUSETYPE"] == "IntelliMouse"
+ and not self.info["XMOUSETYPE"] == "None"):
+ curmouse[1] = self.info["XMOUSETYPE"]
+
+ curmouse[6] = self.emulate
+ print curmouse
+ try:
+ apply (xmouse.set, curmouse)
+ except RuntimeError:
+ pass
+ except TypeError:
+ pass
+
+# if (xmouseType):
+# (proto, emulate, device) = xmouseType
+# mouseType = None
+# mice = self.mice.keys()
+# mice.sort()
+# for desc in mice:
+# (gpm, x11, dev, em) = self.mice[desc]
+# # print "trying %s: '%s', '%s'" % (desc, x11, proto)
+# if (x11 == proto and emulate == em):
+# if (desc[:7] == "Generic" or desc[:3] == "Sun"):
+# mouseType = (desc, emulate, device)
+# break
+# self.device = device
+# if not mouseType:
+# raise KeyError, "unknown X11 mouse type %s" % proto
+
+# if (mouseType):
+# if (len(mouseType) == 3):
+# apply(self.set, mouseType)
+# else:
+# list = kudzu.probe(kudzu.CLASS_MOUSE, kudzu.BUS_UNSPEC,
+# kudzu.PROBE_ONE)
+# if (list):
+# (device, module, desc) = list[0]
+
+# if device == "sunmouse":
+# self.set("Sun - Mouse", 0)
+# elif device == "psaux":
+# self.set("Generic - 3 Button Mouse (PS/2)", 0)
+# else:
+# self.set("Generic - 2 Button Mouse (serial)", 1)
+
+# self.device = device
+# else:
+# self.set("Generic - 2 Button Mouse (serial)", 1, 'ttyS0')
+