summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpnfisher <pnfisher>1999-09-14 23:06:13 +0000
committerpnfisher <pnfisher>1999-09-14 23:06:13 +0000
commite04755cef3b4db0e4f18d7fe717ef5c64279bd2d (patch)
tree77da23e156c92780b1c3d1a92685f4aa9f596202
parent6bdce0874f2e08d5fe2ae2f3e04a5223ee5dbd1e (diff)
downloadanaconda-e04755cef3b4db0e4f18d7fe717ef5c64279bd2d.tar.gz
anaconda-e04755cef3b4db0e4f18d7fe717ef5c64279bd2d.tar.xz
anaconda-e04755cef3b4db0e4f18d7fe717ef5c64279bd2d.zip
Write out keyboard section.
-rw-r--r--xf86config.py99
-rw-r--r--xkb.c11
-rw-r--r--xkb.py9
3 files changed, 66 insertions, 53 deletions
diff --git a/xf86config.py b/xf86config.py
index b149085d0..50e82e60e 100644
--- a/xf86config.py
+++ b/xf86config.py
@@ -7,6 +7,7 @@ import iutil
import kudzu
import time
import os
+import _xkb
def _(x):
return x
@@ -28,6 +29,18 @@ class XF86Config:
self.skip = 0
self.modes = { "8" : ["640x480"] }
self.device = None
+ self.keyModel = None
+ self.keyLayout = None
+ self.keyVariant = None
+ self.keyOptions = None
+ rules = _xkb.get_rulesbase ()
+ self.keyRules = rules[string.rfind (rules, "/")+1:]
+
+ def setKeyboard (self, model, layout, variant, options):
+ self.keyModel = model
+ self.keyLayout = layout
+ self.keyVariant = variant
+ self.keyOptions = options
def setMouse(self, mouse):
if mouse:
@@ -212,7 +225,7 @@ class XF86Config:
def write (self, path):
config = open (path, 'w')
config.write (self.preludeSection ())
- config.write (self.inputSection ())
+ config.write (self.keyboardSection ())
config.write (self.mouseSection ())
config.write (self.monitorSection ())
config.write (self.deviceSection ())
@@ -235,7 +248,7 @@ EndSection
Section "ServerFlags"
EndSection
""")
- config.write (self.inputSection ())
+ config.write (self.keyboardSection ())
config.write (
"""
Section "Pointer"
@@ -327,7 +340,36 @@ Section "ServerFlags"
EndSection
"""
- def inputSection (self):
+ def mouseSection (self):
+ return """
+# **********************************************************************
+# Pointer section
+# **********************************************************************
+
+Section "Pointer"
+ Protocol "%(mouseProto)s"
+ Device "/dev/mouse"
+
+# When using XQUEUE, comment out the above two lines, and uncomment
+# the following line.
+# Protocol "Xqueue"
+
+# Baudrate and SampleRate are only for some Logitech mice
+# BaudRate 9600
+# SampleRate 150
+
+# Emulate3Buttons is an option for 2-button Microsoft mice
+# Emulate3Timeout is the timeout in milliseconds (default is 50ms)
+ Emulate3Buttons
+ Emulate3Timeout 50
+
+# ChordMiddle is an option for some 3-button Logitech mice
+# ChordMiddle
+
+EndSection
+""" % self.mouse
+
+ def keyboardSection (self):
return """
# **********************************************************************
# Keyboard section
@@ -379,51 +421,14 @@ Section "Keyboard"
XkbOptions "ctrl:nocaps"
# These are the default XKB settings for XFree86
-# XkbRules "xfree86"
-# XkbModel "pc101"
-# XkbLayout "us"
-# XkbVariant ""
-# XkbOptions ""
-
- XkbKeycodes "xfree86"
- XkbTypes "default"
- XkbCompat "default"
- XkbSymbols "us(pc101)"
- XkbGeometry "pc"
- XkbRules "xfree86"
- XkbModel "pc101"
- XkbLayout "us"
+ XkbRules "%s"
+ XkbModel "%s"
+ XkbLayout "%s"
+ XkbVariant "%s"
+ XkbOptions "%s"
EndSection
-"""
-
- def mouseSection (self):
- return """
-# **********************************************************************
-# Pointer section
-# **********************************************************************
-
-Section "Pointer"
- Protocol "%(mouseProto)s"
- Device "/dev/mouse"
-
-# When using XQUEUE, comment out the above two lines, and uncomment
-# the following line.
-# Protocol "Xqueue"
+""" % (self.keyRules, self.keyModel, self.keyLayout, self.keyVariant, self.keyOptions)
-# Baudrate and SampleRate are only for some Logitech mice
-# BaudRate 9600
-# SampleRate 150
-
-# Emulate3Buttons is an option for 2-button Microsoft mice
-# Emulate3Timeout is the timeout in milliseconds (default is 50ms)
- Emulate3Buttons
- Emulate3Timeout 50
-
-# ChordMiddle is an option for some 3-button Logitech mice
-# ChordMiddle
-
-EndSection
-""" % self.mouse
def monitorSection (self):
info = {}
@@ -776,7 +781,7 @@ if __name__ == "__main__":
# x.probe ()
sys.exit (0)
print x.preludeSection ()
- print x.inputSection ()
+ print x.keyboardSection ()
print x.mouseSection ()
print x.monitorSection ()
print x.deviceSection ()
diff --git a/xkb.c b/xkb.c
index 3ecc8b5f7..9271f7bef 100644
--- a/xkb.c
+++ b/xkb.c
@@ -18,11 +18,14 @@ static XkbRF_RulesPtr rules;
PyObject *list_rules ();
PyObject *set_rule (PyObject *, PyObject *);
+PyObject * py_get_rulesbase ();
+
char * get_rulesbase ();
static PyMethodDef _xkbMethods[] = {
{ "list_rules", list_rules, 1 },
- { "set_rule", set_rule, 1},
+ { "set_rule", set_rule, 1 },
+ { "get_rulesbase", py_get_rulesbase, 1 },
{ NULL, NULL }
};
@@ -41,6 +44,12 @@ get_rulesbase ()
return rulesbase;
}
+
+PyObject *
+py_get_rulesbase ()
+{
+ return Py_BuildValue ("s", get_rulesbase ());
+}
void
init_xkb ()
diff --git a/xkb.py b/xkb.py
index 902e13a5d..88e5bde0e 100644
--- a/xkb.py
+++ b/xkb.py
@@ -4,7 +4,7 @@ import string
class XKB:
def __init__ (self):
- self.rules = _xkb.list_rules ()
+ self.rules = _xkb.list_rules ()
def getRules (self):
return self.rules
@@ -33,7 +33,6 @@ class XKB:
return _xkb.set_rule (model, layout, variant, options)
-
-
-
-
+ def getRulesBase (self):
+ return _xkb.get_rulesbase ()
+