summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--GL/glx/indirect_dispatch_swap.c2
-rw-r--r--GL/glx/indirect_reqsize.c2
-rw-r--r--GL/glx/indirect_util.c2
-rw-r--r--Makefile.am8
-rw-r--r--Xi/chgdctl.c146
-rw-r--r--Xi/chgkbd.c102
-rw-r--r--Xi/chgkbd.h5
-rw-r--r--Xi/chgptr.c132
-rw-r--r--Xi/chgptr.h5
-rw-r--r--Xi/exevents.c53
-rw-r--r--Xi/exglobals.h7
-rw-r--r--Xi/extinit.c46
-rw-r--r--Xi/getdctl.c128
-rw-r--r--Xi/getdctl.h18
-rw-r--r--Xi/listdev.c15
-rw-r--r--Xi/selectev.c54
-rw-r--r--Xi/stubs.c99
-rw-r--r--config/Makefile.am10
-rw-r--r--config/config.c349
-rw-r--r--config/dbus-api35
-rw-r--r--config/xorg-server.conf13
-rw-r--r--configure.ac334
-rw-r--r--dix/Makefile.am21
-rw-r--r--dix/Xserver-dtrace.h.in100
-rw-r--r--dix/Xserver.d59
-rw-r--r--dix/devices.c949
-rw-r--r--dix/dispatch.c123
-rw-r--r--dix/dixfonts.c65
-rw-r--r--dix/events.c89
-rw-r--r--dix/extension.c14
-rw-r--r--dix/getevents.c781
-rw-r--r--dix/main.c23
-rw-r--r--dix/resource.c56
-rw-r--r--doc/c-extensions32
-rw-r--r--fb/fbpict.c15
-rw-r--r--fb/fbpict.h47
-rw-r--r--hw/darwin/darwinKeyboard.c2
-rw-r--r--hw/dmx/dmxinput.c2
-rw-r--r--hw/kdrive/Makefile.am14
-rw-r--r--hw/kdrive/ati/Makefile.am10
-rw-r--r--hw/kdrive/ati/ati_stub.c10
-rw-r--r--hw/kdrive/chips/Makefile.am4
-rw-r--r--hw/kdrive/chips/chipsstub.c3
-rw-r--r--hw/kdrive/ephyr/Makefile.am5
-rw-r--r--hw/kdrive/ephyr/ephyr.c145
-rw-r--r--hw/kdrive/ephyr/ephyr.h9
-rw-r--r--hw/kdrive/ephyr/ephyrinit.c19
-rw-r--r--hw/kdrive/ephyr/hostx.c34
-rw-r--r--hw/kdrive/ephyr/hostx.h17
-rw-r--r--hw/kdrive/ephyr/os.c30
-rw-r--r--hw/kdrive/epson/Makefile.am2
-rw-r--r--hw/kdrive/epson/epson13806stub.c6
-rw-r--r--hw/kdrive/fake/Makefile.am9
-rw-r--r--hw/kdrive/fake/fake.c6
-rw-r--r--hw/kdrive/fake/fake.h4
-rw-r--r--hw/kdrive/fake/fakeinit.c17
-rw-r--r--hw/kdrive/fake/kbd.c48
-rw-r--r--hw/kdrive/fake/mouse.c26
-rw-r--r--hw/kdrive/fbdev/Makefile.am11
-rw-r--r--hw/kdrive/fbdev/fbdev.c6
-rw-r--r--hw/kdrive/fbdev/fbinit.c14
-rw-r--r--hw/kdrive/i810/Makefile.am2
-rw-r--r--hw/kdrive/i810/i810stub.c3
-rw-r--r--hw/kdrive/igs/igsstub.c3
-rw-r--r--hw/kdrive/itsy/kbd.c51
-rw-r--r--hw/kdrive/itsy/ts.c7
-rw-r--r--hw/kdrive/linux/Makefile.am13
-rw-r--r--hw/kdrive/linux/bus.c75
-rw-r--r--hw/kdrive/linux/evdev.c384
-rw-r--r--hw/kdrive/linux/keyboard.c487
-rw-r--r--hw/kdrive/linux/linux.c52
-rw-r--r--hw/kdrive/linux/mouse.c236
-rw-r--r--hw/kdrive/linux/ms.c61
-rw-r--r--hw/kdrive/linux/ps2.c84
-rw-r--r--hw/kdrive/linux/ts.c140
-rw-r--r--hw/kdrive/linux/tslib.c353
-rw-r--r--hw/kdrive/mach64/Makefile.am6
-rw-r--r--hw/kdrive/mach64/mach64stub.c3
-rw-r--r--hw/kdrive/mga/Makefile.am11
-rw-r--r--hw/kdrive/mga/mgastub.c3
-rw-r--r--hw/kdrive/neomagic/Makefile.am6
-rw-r--r--hw/kdrive/neomagic/neomagic.h8
-rw-r--r--hw/kdrive/neomagic/neomagicstub.c6
-rw-r--r--hw/kdrive/nvidia/Makefile.am8
-rw-r--r--hw/kdrive/nvidia/nvidiastub.c3
-rw-r--r--hw/kdrive/pcmcia/pcmciastub.c3
-rw-r--r--hw/kdrive/pm2/Makefile.am5
-rw-r--r--hw/kdrive/pm2/pm2stub.c3
-rw-r--r--hw/kdrive/r128/Makefile.am5
-rw-r--r--hw/kdrive/r128/r128stub.c3
-rw-r--r--hw/kdrive/savage/s3stub.c8
-rw-r--r--hw/kdrive/sdl/Makefile.am5
-rw-r--r--hw/kdrive/sis300/Makefile.am6
-rw-r--r--hw/kdrive/sis300/sis_stub.c3
-rw-r--r--hw/kdrive/sis530/sisstub.c3
-rw-r--r--hw/kdrive/smi/Makefile.am6
-rw-r--r--hw/kdrive/smi/smistub.c3
-rw-r--r--hw/kdrive/src/Makefile.am3
-rw-r--r--hw/kdrive/src/kdrive.c190
-rw-r--r--hw/kdrive/src/kdrive.h252
-rw-r--r--hw/kdrive/src/kinfo.c85
-rw-r--r--hw/kdrive/src/kinput.c1847
-rw-r--r--hw/kdrive/src/kkeymap.c66
-rw-r--r--hw/kdrive/src/kloadmap.c1
-rw-r--r--hw/kdrive/trident/tridentstub.c3
-rw-r--r--hw/kdrive/trio/s3stub.c3
-rw-r--r--hw/kdrive/vesa/Makefile.am4
-rw-r--r--hw/kdrive/vesa/vesa.c8
-rw-r--r--hw/kdrive/vesa/vesainit.c11
-rw-r--r--hw/kdrive/via/Makefile.am9
-rw-r--r--hw/kdrive/via/viastub.c3
-rw-r--r--hw/kdrive/vxworks/vxkbd.c4
-rw-r--r--hw/kdrive/vxworks/vxworks.c33
-rw-r--r--hw/vfb/InitInput.c13
-rw-r--r--hw/xfree86/Makefile.am9
-rw-r--r--hw/xfree86/common/Makefile.am12
-rw-r--r--hw/xfree86/common/vesamodes6
-rw-r--r--hw/xfree86/common/xf86Config.c348
-rw-r--r--hw/xfree86/common/xf86Configure.c6
-rw-r--r--hw/xfree86/common/xf86Cursor.c9
-rw-r--r--hw/xfree86/common/xf86DGA.c48
-rw-r--r--hw/xfree86/common/xf86Debug.c2
-rw-r--r--hw/xfree86/common/xf86Events.c796
-rw-r--r--hw/xfree86/common/xf86Globals.c39
-rw-r--r--hw/xfree86/common/xf86Helper.c28
-rw-r--r--hw/xfree86/common/xf86InPriv.h3
-rw-r--r--hw/xfree86/common/xf86Init.c118
-rw-r--r--hw/xfree86/common/xf86Io.c470
-rw-r--r--hw/xfree86/common/xf86Kbd.c394
-rw-r--r--hw/xfree86/common/xf86KbdBSD.c1265
-rw-r--r--hw/xfree86/common/xf86KbdLnx.c650
-rw-r--r--hw/xfree86/common/xf86KbdMach.c316
-rw-r--r--hw/xfree86/common/xf86MiscExt.c78
-rw-r--r--hw/xfree86/common/xf86Module.h2
-rw-r--r--hw/xfree86/common/xf86Option.c4
-rw-r--r--hw/xfree86/common/xf86Priv.h17
-rw-r--r--hw/xfree86/common/xf86Privstr.h49
-rw-r--r--hw/xfree86/common/xf86Versions.c3
-rw-r--r--hw/xfree86/common/xf86Xinput.c1421
-rw-r--r--hw/xfree86/common/xf86Xinput.h41
-rw-r--r--hw/xfree86/common/xf86pciBus.c6
-rw-r--r--hw/xfree86/int10/Makefile.am11
-rw-r--r--hw/xfree86/int10/helper_exec.c13
-rw-r--r--hw/xfree86/loader/misym.c2
-rw-r--r--hw/xfree86/loader/xf86sym.c11
-rw-r--r--hw/xfree86/os-support/Makefile.am5
-rw-r--r--hw/xfree86/os-support/bsd/Makefile.am7
-rw-r--r--hw/xfree86/os-support/bsd/bsd_KbdMap.c1087
-rw-r--r--hw/xfree86/os-support/bsd/bsd_bell.c81
-rw-r--r--hw/xfree86/os-support/bsd/bsd_io.c293
-rw-r--r--hw/xfree86/os-support/bsd/bsd_kbd.c572
-rw-r--r--hw/xfree86/os-support/bsd/bsd_kbd.h4
-rw-r--r--hw/xfree86/os-support/bus/Pci.c8
-rw-r--r--hw/xfree86/os-support/bus/Pci.h4
-rw-r--r--hw/xfree86/os-support/bus/altixPCI.c9
-rw-r--r--hw/xfree86/os-support/bus/linuxPci.c221
-rw-r--r--hw/xfree86/os-support/bus/xf86Pci.h1
-rw-r--r--hw/xfree86/os-support/hurd/Makefile.am4
-rw-r--r--hw/xfree86/os-support/hurd/hurd_bell.c35
-rw-r--r--hw/xfree86/os-support/hurd/hurd_mouse.c80
-rw-r--r--hw/xfree86/os-support/linux/Makefile.am29
-rw-r--r--hw/xfree86/os-support/linux/lnx_KbdMap.c606
-rw-r--r--hw/xfree86/os-support/linux/lnx_bell.c43
-rw-r--r--hw/xfree86/os-support/linux/lnx_io.c246
-rw-r--r--hw/xfree86/os-support/linux/lnx_kbd.c530
-rw-r--r--hw/xfree86/os-support/linux/lnx_kbd.h4
-rw-r--r--hw/xfree86/os-support/linux/lnx_pci.c80
-rw-r--r--hw/xfree86/os-support/lynxos/Makefile.am1
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_io.c165
-rw-r--r--hw/xfree86/os-support/misc/Makefile.am14
-rw-r--r--hw/xfree86/os-support/sco/Makefile.am4
-rw-r--r--hw/xfree86/os-support/sco/sco_KbdMap.c304
-rw-r--r--hw/xfree86/os-support/sco/sco_io.c268
-rw-r--r--hw/xfree86/os-support/sco/sco_kbd.c530
-rw-r--r--hw/xfree86/os-support/sco/sco_kbd.h20
-rw-r--r--hw/xfree86/os-support/shared/at_scancode.c131
-rw-r--r--hw/xfree86/os-support/shared/kbd.c38
-rw-r--r--hw/xfree86/os-support/shared/std_kbdEv.c49
-rw-r--r--hw/xfree86/os-support/shared/sysv_kbd.c105
-rw-r--r--hw/xfree86/os-support/solaris/Makefile.am8
-rw-r--r--hw/xfree86/os-support/solaris/sun_bell.c185
-rw-r--r--hw/xfree86/os-support/solaris/sun_init.c31
-rw-r--r--hw/xfree86/os-support/solaris/sun_io.c159
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbd.c660
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbd.h72
-rw-r--r--hw/xfree86/os-support/solaris/sun_kbdEv.c854
-rw-r--r--hw/xfree86/os-support/sysv/Makefile.am2
-rw-r--r--hw/xfree86/os-support/sysv/sysv_io.c77
-rw-r--r--hw/xfree86/os-support/sysv/sysv_mouse.c3
-rw-r--r--hw/xfree86/os-support/sysv/xqueue.c536
-rw-r--r--hw/xfree86/os-support/sysv/xqueue.h12
-rw-r--r--hw/xfree86/os-support/usl/Makefile.am8
-rw-r--r--hw/xfree86/os-support/usl/usl_KbdMap.c304
-rw-r--r--hw/xfree86/os-support/usl/usl_io.c171
-rw-r--r--hw/xfree86/os-support/usl/usl_kbd.c455
-rw-r--r--hw/xfree86/os-support/usl/usl_kbd.h14
-rw-r--r--hw/xfree86/os-support/usl/usl_mouse.c7
-rw-r--r--hw/xfree86/os-support/usl/usl_xqueue.c360
-rw-r--r--hw/xfree86/os-support/usl/usl_xqueue.h9
-rw-r--r--hw/xfree86/os-support/xf86OSKbd.h132
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h9
-rw-r--r--hw/xfree86/os-support/xf86_OSproc.h19
-rw-r--r--hw/xfree86/parser/Input.c5
-rw-r--r--hw/xfree86/parser/Keyboard.c308
-rw-r--r--hw/xfree86/parser/Makefile.am1
-rw-r--r--hw/xfree86/parser/configProcs.h2
-rw-r--r--hw/xfree86/parser/read.c7
-rw-r--r--hw/xfree86/utils/xorgcfg/interface.c3
-rw-r--r--hw/xfree86/utils/xorgcfg/keyboard-cfg.c7
-rw-r--r--hw/xfree86/utils/xorgcfg/mouse-cfg.c3
-rw-r--r--hw/xfree86/utils/xorgcfg/text-mode.c14
-rw-r--r--hw/xfree86/utils/xorgconfig/xorgconfig.c21
-rw-r--r--hw/xfree86/xorgconf.cpp14
-rw-r--r--hw/xgl/egl/module/xeglmodule.c2
-rw-r--r--hw/xgl/egl/xegl.c2
-rw-r--r--hw/xgl/egl/xegl.h2
-rw-r--r--hw/xgl/egl/xeglinit.c2
-rw-r--r--hw/xgl/glx/module/xglxmodule.c2
-rw-r--r--hw/xgl/glx/xglx.c2
-rw-r--r--hw/xgl/glx/xglx.h2
-rw-r--r--hw/xgl/glx/xglxinit.c2
-rw-r--r--hw/xgl/xglinit.c2
-rw-r--r--hw/xnest/Args.c15
-rw-r--r--hw/xnest/Events.c65
-rw-r--r--hw/xnest/Init.c9
-rw-r--r--hw/xnest/Keyboard.c8
-rw-r--r--hw/xnest/Pointer.c4
-rw-r--r--hw/xprint/ddxInit.c6
-rw-r--r--hw/xwin/InitInput.c2
-rw-r--r--include/Makefile.am1
-rw-r--r--include/XIstubs.h12
-rw-r--r--include/config.h31
-rw-r--r--include/dix-config.h.in18
-rw-r--r--include/exevents.h13
-rw-r--r--include/extinit.h6
-rw-r--r--include/input.h88
-rw-r--r--include/inputstr.h73
-rw-r--r--include/kdrive-config.h.in6
-rw-r--r--include/os.h10
-rw-r--r--mi/mi.h4
-rw-r--r--mi/mieq.c201
-rw-r--r--mi/miinitext.c4
-rw-r--r--mi/mipointer.c198
-rw-r--r--mi/mipointer.h67
-rw-r--r--mi/mipointrst.h10
-rw-r--r--os/Makefile.am38
-rw-r--r--os/WaitFor.c20
-rw-r--r--os/connection.c91
-rw-r--r--os/utils.c4
-rw-r--r--xkb/XKBAlloc.c5
-rw-r--r--xkb/ddxBeep.c32
-rw-r--r--xkb/ddxLoad.c24
-rw-r--r--xkb/xkb.c500
-rw-r--r--xkb/xkb.h5
-rw-r--r--xkb/xkbAccessX.c10
-rw-r--r--xkb/xkbLEDs.c24
-rw-r--r--xkb/xkbUtils.c1154
258 files changed, 9386 insertions, 18603 deletions
diff --git a/.gitignore b/.gitignore
index 4118cd001..62b5fd6b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -267,3 +267,4 @@ mfb/mfbteblack.c
mfb/mfbtewhite.c
mfb/mfbtileC.c
mfb/mfbtileG.c
+.*.swp
diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c
index 9c58ef1cd..1d45676b3 100644
--- a/GL/glx/indirect_dispatch_swap.c
+++ b/GL/glx/indirect_dispatch_swap.c
@@ -28,7 +28,7 @@
#include <X11/Xmd.h>
#include <GL/gl.h>
#include <GL/glxproto.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
diff --git a/GL/glx/indirect_reqsize.c b/GL/glx/indirect_reqsize.c
index 3906bd11d..1c332da79 100644
--- a/GL/glx/indirect_reqsize.c
+++ b/GL/glx/indirect_reqsize.c
@@ -31,7 +31,7 @@
#include "indirect_size.h"
#include "indirect_reqsize.h"
-#if defined(linux)
+#if defined(__linux__) || defined(__GNU__)
# include <byteswap.h>
# define SWAP_32(v) do { (v) = bswap_32(v); } while(0)
#else
diff --git a/GL/glx/indirect_util.c b/GL/glx/indirect_util.c
index 93f1484d7..2d64f3399 100644
--- a/GL/glx/indirect_util.c
+++ b/GL/glx/indirect_util.c
@@ -28,7 +28,7 @@
#include <X11/Xmd.h>
#include <GL/gl.h>
#include <GL/glxproto.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__GNU__)
#include <byteswap.h>
#elif defined(__OpenBSD__)
#include <sys/endian.h>
diff --git a/Makefile.am b/Makefile.am
index c425cc6bb..f35539e49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,10 +26,6 @@ if GLX
GLX_DIR=GL
endif
-if XINPUT
-XINPUT_DIR=Xi
-endif
-
if DBE
DBE_DIR=dbe
endif
@@ -45,7 +41,7 @@ SUBDIRS = \
os \
randr \
render \
- $(XINPUT_DIR) \
+ Xi \
xkb \
$(DBE_DIR) \
$(MFB_DIR) \
@@ -59,6 +55,7 @@ SUBDIRS = \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
exa \
+ config \
hw
aclocaldir = $(datadir)/aclocal
@@ -94,6 +91,7 @@ DIST_SUBDIRS = \
composite \
GL \
exa \
+ config \
hw
# gross hack
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index d507513a9..badd93822 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -66,6 +66,7 @@ SOFTWARE.
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h"
+#include "exevents.h"
#include "chgdctl.h"
@@ -98,12 +99,17 @@ int
ProcXChangeDeviceControl(ClientPtr client)
{
unsigned len;
- int i, status;
+ int i, status, ret = BadValue;
DeviceIntPtr dev;
xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep;
AxisInfoPtr a;
CARD32 *resolution;
+ xDeviceAbsCalibCtl *calib;
+ xDeviceAbsAreaCtl *area;
+ xDeviceCoreCtl *c;
+ xDeviceEnableCtl *e;
+ devicePresenceNotify dpn;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@@ -111,9 +117,8 @@ ProcXChangeDeviceControl(ClientPtr client)
len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadDevice);
- return Success;
+ ret = BadDevice;
+ goto out;
}
rep.repType = X_Reply;
@@ -126,25 +131,22 @@ ProcXChangeDeviceControl(ClientPtr client)
r = (xDeviceResolutionCtl *) & stuff[1];
if ((len < (sizeof(xDeviceResolutionCtl) >> 2)) ||
(len != (sizeof(xDeviceResolutionCtl) >> 2) + r->num_valuators)) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl,
- 0, BadLength);
- return Success;
+ ret = BadLength;
+ goto out;
}
if (!dev->valuator) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
+ goto out;
}
if ((dev->grab) && !SameClient(dev->grab, client)) {
rep.status = AlreadyGrabbed;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
- return Success;
+ ret = Success;
+ goto out;
}
resolution = (CARD32 *) (r + 1);
if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadValue);
- return Success;
+ ret = BadValue;
+ goto out;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
if (status == Success) {
@@ -158,21 +160,119 @@ ProcXChangeDeviceControl(ClientPtr client)
}
for (i = 0; i < r->num_valuators; i++)
(a++)->resolution = *resolution++;
+
+ ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
- return Success;
+ ret = Success;
} else {
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
- BadMatch);
- return Success;
+ ret = BadMatch;
}
break;
+ case DEVICE_ABS_CALIB:
+ calib = (xDeviceAbsCalibCtl *)&stuff[1];
+
+ if (calib->button_threshold < 0 || calib->button_threshold > 255) {
+ ret = BadValue;
+ goto out;
+ }
+
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) calib);
+
+ if (status == Success) {
+ dev->absolute->min_x = calib->min_x;
+ dev->absolute->max_x = calib->max_x;
+ dev->absolute->min_y = calib->min_y;
+ dev->absolute->max_y = calib->max_y;
+ dev->absolute->flip_x = calib->flip_x;
+ dev->absolute->flip_y = calib->flip_y;
+ dev->absolute->rotation = calib->rotation;
+ dev->absolute->button_threshold = calib->button_threshold;
+ ret = Success;
+ } else if (status == DeviceBusy || status == BadValue) {
+ rep.status = status;
+ ret = Success;
+ } else {
+ ret = BadMatch;
+ }
+
+ break;
+ case DEVICE_ABS_AREA:
+ area = (xDeviceAbsAreaCtl *)&stuff[1];
+
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) area);
+
+ if (status == Success) {
+ dev->absolute->offset_x = area->offset_x;
+ dev->absolute->offset_y = area->offset_y;
+ dev->absolute->width = area->width;
+ dev->absolute->height = area->height;
+ dev->absolute->screen = area->screen;
+ dev->absolute->following = area->following;
+ ret = Success;
+ } else if (status == DeviceBusy || status == BadValue) {
+ rep.status = status;
+ ret = Success;
+ } else {
+ ret = Success;
+ }
+
+ break;
+ case DEVICE_CORE:
+ c = (xDeviceCoreCtl *)&stuff[1];
+
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) c);
+
+ if (status == Success) {
+ dev->coreEvents = c->status;
+ ret = Success;
+ } else if (status == DeviceBusy) {
+ rep.status = DeviceBusy;
+ ret = Success;
+ } else {
+ ret = BadMatch;
+ }
+
+ break;
+ case DEVICE_ENABLE:
+ e = (xDeviceEnableCtl *)&stuff[1];
+
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
+
+ if (status == Success) {
+ if (e->enable)
+ EnableDevice(dev);
+ else
+ DisableDevice(dev);
+ ret = Success;
+ } else if (status == DeviceBusy) {
+ rep.status = DeviceBusy;
+ ret = Success;
+ } else {
+ ret = BadMatch;
+ }
+
+ break;
default:
- SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue);
- return Success;
+ ret = BadValue;
}
- WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
+
+out:
+ if (ret == Success) {
+ dpn.type = DevicePresenceNotify;
+ dpn.time = currentTime.milliseconds;
+ dpn.devchange = 1;
+ dpn.deviceid = dev->id;
+ dpn.control = stuff->control;
+ SendEventToAllWindows(dev, DevicePresenceNotifyMask,
+ (xEvent *) &dpn, 1);
+
+ WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
+ }
+ else {
+ SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret);
+ }
+
return Success;
}
diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c
index 289bd85af..8134b4060 100644
--- a/Xi/chgkbd.c
+++ b/Xi/chgkbd.c
@@ -64,7 +64,6 @@ SOFTWARE.
#include "XIstubs.h"
#include "globals.h"
#include "extnsionst.h"
-#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@@ -99,107 +98,10 @@ SProcXChangeKeyboardDevice(register ClientPtr client)
int
ProcXChangeKeyboardDevice(register ClientPtr client)
{
- int i;
- DeviceIntPtr xkbd = inputInfo.keyboard;
- DeviceIntPtr dev;
- FocusClassPtr xf = xkbd->focus;
- FocusClassPtr df;
- KeyClassPtr k;
- xChangeKeyboardDeviceReply rep;
- changeDeviceNotify ev;
-
REQUEST(xChangeKeyboardDeviceReq);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
- rep.repType = X_Reply;
- rep.RepType = X_ChangeKeyboardDevice;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadDevice);
- return Success;
- }
-
- k = dev->key;
- if (k == NULL) {
- rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadMatch);
- return Success;
- }
-
- if (((dev->grab) && !SameClient(dev->grab, client)) ||
- ((xkbd->grab) && !SameClient(xkbd->grab, client)))
- rep.status = AlreadyGrabbed;
- else if ((dev->sync.frozen &&
- dev->sync.other && !SameClient(dev->sync.other, client)) ||
- (xkbd->sync.frozen &&
- xkbd->sync.other && !SameClient(xkbd->sync.other, client)))
- rep.status = GrabFrozen;
- else {
- if (ChangeKeyboardDevice(xkbd, dev) != Success) {
- SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
- BadDevice);
- return Success;
- }
- if (!dev->focus)
- InitFocusClassDeviceStruct(dev);
- if (!dev->kbdfeed)
- InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr) NoopDDA,
- (KbdCtrlProcPtr) NoopDDA);
- df = dev->focus;
- df->win = xf->win;
- df->revert = xf->revert;
- df->time = xf->time;
- df->traceGood = xf->traceGood;
- if (df->traceSize != xf->traceSize) {
- Must_have_memory = TRUE; /* XXX */
- df->trace = (WindowPtr *) xrealloc(df->trace,
- xf->traceSize *
- sizeof(WindowPtr));
- Must_have_memory = FALSE; /* XXX */
- }
- df->traceSize = xf->traceSize;
- for (i = 0; i < df->traceSize; i++)
- df->trace[i] = xf->trace[i];
- RegisterOtherDevice(xkbd);
- RegisterKeyboardDevice(dev);
-
- ev.type = ChangeDeviceNotify;
- ev.deviceid = stuff->deviceid;
- ev.time = currentTime.milliseconds;
- ev.request = NewKeyboard;
-
- SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
- SendMappingNotify(MappingKeyboard, k->curKeySyms.minKeyCode,
- k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode +
- 1, client);
-
- rep.status = 0;
- }
-
- WriteReplyToClient(client, sizeof(xChangeKeyboardDeviceReply), &rep);
+ SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
+ BadDevice);
return Success;
}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XChangeKeyboardDevice
- * function, if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXChangeKeyboardDevice(ClientPtr client, int size,
- xChangeKeyboardDeviceReply * rep)
-{
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
diff --git a/Xi/chgkbd.h b/Xi/chgkbd.h
index 7a883b7f0..5f9922336 100644
--- a/Xi/chgkbd.h
+++ b/Xi/chgkbd.h
@@ -36,9 +36,4 @@ int SProcXChangeKeyboardDevice(ClientPtr /* client */
int ProcXChangeKeyboardDevice(ClientPtr /* client */
);
-void SRepXChangeKeyboardDevice(ClientPtr /* client */ ,
- int /* size */ ,
- xChangeKeyboardDeviceReply * /* rep */
- );
-
#endif /* CHGKBD_H */
diff --git a/Xi/chgptr.c b/Xi/chgptr.c
index f6f4b8bff..22c8a5f5e 100644
--- a/Xi/chgptr.c
+++ b/Xi/chgptr.c
@@ -101,138 +101,10 @@ SProcXChangePointerDevice(register ClientPtr client)
int
ProcXChangePointerDevice(register ClientPtr client)
{
- DeviceIntPtr xptr = inputInfo.pointer;
- DeviceIntPtr dev;
- ValuatorClassPtr v;
- xChangePointerDeviceReply rep;
- changeDeviceNotify ev;
-
REQUEST(xChangePointerDeviceReq);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
- rep.repType = X_Reply;
- rep.RepType = X_ChangePointerDevice;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
- BadDevice);
- return Success;
- }
-
- v = dev->valuator;
- if (v == NULL || v->numAxes < 2 ||
- stuff->xaxis >= v->numAxes || stuff->yaxis >= v->numAxes) {
- rep.status = -1;
- SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch);
- return Success;
- }
-
- if (((dev->grab) && !SameClient(dev->grab, client)) ||
- ((xptr->grab) && !SameClient(xptr->grab, client)))
- rep.status = AlreadyGrabbed;
- else if ((dev->sync.frozen &&
- dev->sync.other && !SameClient(dev->sync.other, client)) ||
- (xptr->sync.frozen &&
- xptr->sync.other && !SameClient(xptr->sync.other, client)))
- rep.status = GrabFrozen;
- else {
- if (ChangePointerDevice(xptr, dev, stuff->xaxis, stuff->yaxis) !=
- Success) {
- SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
- BadDevice);
- return Success;
- }
- if (dev->focus)
- DeleteFocusClassDeviceStruct(dev);
- if (!dev->button)
- InitButtonClassDeviceStruct(dev, 0, NULL);
- if (!dev->ptrfeed)
- InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr) NoopDDA);
- RegisterOtherDevice(xptr);
- RegisterPointerDevice(dev);
-
- ev.type = ChangeDeviceNotify;
- ev.deviceid = stuff->deviceid;
- ev.time = currentTime.milliseconds;
- ev.request = NewPointer;
-
- SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
- SendMappingNotify(MappingPointer, 0, 0, client);
-
- rep.status = 0;
- }
-
- WriteReplyToClient(client, sizeof(xChangePointerDeviceReply), &rep);
+ SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
+ BadDevice);
return Success;
}
-
-void
-DeleteFocusClassDeviceStruct(DeviceIntPtr dev)
-{
- xfree(dev->focus->trace);
- xfree(dev->focus);
- dev->focus = NULL;
-}
-
-/***********************************************************************
- *
- * Send an event to interested clients in all windows on all screens.
- *
- */
-
-void
-SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
-{
- int i;
- WindowPtr pWin, p1;
-
- for (i = 0; i < screenInfo.numScreens; i++) {
- pWin = WindowTable[i];
- (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
- p1 = pWin->firstChild;
- FindInterestedChildren(dev, p1, mask, ev, count);
- }
-}
-
-/***********************************************************************
- *
- * Walk through the window tree, finding all clients that want to know
- * about the ChangeDeviceNotify Event.
- *
- */
-
-void
-FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
- xEvent * ev, int count)
-{
- WindowPtr p2;
-
- while (p1) {
- p2 = p1->firstChild;
- (void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id);
- FindInterestedChildren(dev, p2, mask, ev, count);
- p1 = p1->nextSib;
- }
-}
-
-/***********************************************************************
- *
- * This procedure writes the reply for the XChangePointerDevice
- * function, if the client and server have a different byte ordering.
- *
- */
-
-void
-SRepXChangePointerDevice(ClientPtr client, int size,
- xChangePointerDeviceReply * rep)
-{
- register char n;
-
- swaps(&rep->sequenceNumber, n);
- swapl(&rep->length, n);
- WriteToClient(client, size, (char *)rep);
-}
diff --git a/Xi/chgptr.h b/Xi/chgptr.h
index aeda822aa..fb3b5cc39 100644
--- a/Xi/chgptr.h
+++ b/Xi/chgptr.h
@@ -53,9 +53,4 @@ void FindInterestedChildren( /* FIXME: could be static? */
int /* count */
);
-void SRepXChangePointerDevice(ClientPtr /* client */ ,
- int /* size */ ,
- xChangePointerDeviceReply * /* rep */
- );
-
#endif /* CHGPTR_H */
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 2932ab2d2..92a5f0599 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -71,8 +71,7 @@ SOFTWARE.
#include "exglobals.h"
#include "dixevents.h" /* DeliverFocusedEvent */
#include "dixgrabs.h" /* CreateGrab() */
-
-#include "chgptr.h"
+#include "scrnintstr.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
#define AllModifiersMask ( \
@@ -302,7 +301,12 @@ _X_EXPORT void
InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
int resolution, int min_res, int max_res)
{
- register AxisInfoPtr ax = dev->valuator->axes + axnum;
+ register AxisInfoPtr ax;
+
+ if (!dev || !dev->valuator)
+ return;
+
+ ax = dev->valuator->axes + axnum;
ax->min_value = minval;
ax->max_value = maxval;
@@ -898,7 +902,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen,
return MappingBusy;
} else {
for (i = 0; i < inputMapLen; i++) {
- if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr) dev)) {
+ if (inputMap[i] && !LegalModifier(inputMap[i], dev)) {
return MappingFailed;
}
}
@@ -1209,3 +1213,44 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents)
else
return FALSE;
}
+
+/***********************************************************************
+ *
+ * Walk through the window tree, finding all clients that want to know
+ * about the Event.
+ *
+ */
+
+void
+FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
+ xEvent * ev, int count)
+{
+ WindowPtr p2;
+
+ while (p1) {
+ p2 = p1->firstChild;
+ (void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id);
+ FindInterestedChildren(dev, p2, mask, ev, count);
+ p1 = p1->nextSib;
+ }
+}
+
+/***********************************************************************
+ *
+ * Send an event to interested clients in all windows on all screens.
+ *
+ */
+
+void
+SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
+{
+ int i;
+ WindowPtr pWin, p1;
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pWin = WindowTable[i];
+ (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
+ p1 = pWin->firstChild;
+ FindInterestedChildren(dev, p1, mask, ev, count);
+ }
+}
diff --git a/Xi/exglobals.h b/Xi/exglobals.h
index c64b84875..3afd1bb9e 100644
--- a/Xi/exglobals.h
+++ b/Xi/exglobals.h
@@ -51,6 +51,7 @@ extern Mask DeviceMappingNotifyMask;
extern Mask DeviceOwnerGrabButtonMask;
extern Mask DeviceButtonGrabMask;
extern Mask DeviceButtonMotionMask;
+extern Mask DevicePresenceNotifyMask;
extern Mask PropagateMask[];
extern int DeviceValuator;
@@ -68,12 +69,8 @@ extern int DeviceKeyStateNotify;
extern int DeviceButtonStateNotify;
extern int DeviceMappingNotify;
extern int ChangeDeviceNotify;
+extern int DevicePresenceNotify;
extern int RT_INPUTCLIENT;
-#if 0
-/* FIXME: in dix */
-extern InputInfo inputInfo;
-#endif
-
#endif /* EXGLOBALS_H */
diff --git a/Xi/extinit.c b/Xi/extinit.c
index f3aabe3a7..454883762 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -166,6 +166,7 @@ Mask DeviceMappingNotifyMask;
Mask DeviceOwnerGrabButtonMask;
Mask DeviceButtonGrabMask;
Mask DeviceButtonMotionMask;
+Mask DevicePresenceNotifyMask;
int DeviceValuator;
int DeviceKeyPress;
@@ -182,6 +183,7 @@ int DeviceKeyStateNotify;
int DeviceButtonStateNotify;
int DeviceMappingNotify;
int ChangeDeviceNotify;
+int DevicePresenceNotify;
int RT_INPUTCLIENT;
@@ -202,8 +204,8 @@ Mask PropagateMask[MAX_DEVICES];
*/
static XExtensionVersion thisversion = { XI_Present,
- XI_Add_XChangeDeviceControl_Major,
- XI_Add_XChangeDeviceControl_Minor
+ XI_Add_DevicePresenceNotify_Major,
+ XI_Add_DevicePresenceNotify_Minor
};
/**********************************************************************
@@ -463,12 +465,6 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
else if (rep->RepType == X_GetDeviceMotionEvents)
SRepXGetDeviceMotionEvents(client, len,
(xGetDeviceMotionEventsReply *) rep);
- else if (rep->RepType == X_ChangeKeyboardDevice)
- SRepXChangeKeyboardDevice(client, len,
- (xChangeKeyboardDeviceReply *) rep);
- else if (rep->RepType == X_ChangePointerDevice)
- SRepXChangePointerDevice(client, len,
- (xChangePointerDeviceReply *) rep);
else if (rep->RepType == X_GrabDevice)
SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
else if (rep->RepType == X_GetDeviceFocus)
@@ -648,6 +644,17 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
swapl(&to->time, n);
}
+void
+SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
+{
+ register char n;
+
+ *to = *from;
+ swaps(&to->sequenceNumber,n);
+ swapl(&to->time, n);
+ swaps(&to->control, n);
+}
+
/************************************************************************
*
* This function sets up extension event types and masks.
@@ -674,6 +681,7 @@ FixExtensionEvents(ExtensionEntry * extEntry)
ChangeDeviceNotify = DeviceMappingNotify + 1;
DeviceKeyStateNotify = ChangeDeviceNotify + 1;
DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
+ DevicePresenceNotify = DeviceButtonStateNotify + 1;
event_base[KeyClass] = DeviceKeyPress;
event_base[ButtonClass] = DeviceButtonPress;
@@ -746,6 +754,9 @@ FixExtensionEvents(ExtensionEntry * extEntry)
DeviceOwnerGrabButtonMask = GetNextExtEventMask();
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
+
+ DevicePresenceNotifyMask = GetNextExtEventMask();
+ SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
SetEventInfo(0, _noExtensionEvent);
}
@@ -786,6 +797,7 @@ RestoreExtensionEvents(void)
ChangeDeviceNotify = 12;
DeviceKeyStateNotify = 13;
DeviceButtonStateNotify = 13;
+ DevicePresenceNotify = 14;
BadDevice = 0;
BadEvent = 1;
@@ -823,6 +835,7 @@ IResetProc(ExtensionEntry * unused)
EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
EventSwapVector[DeviceMappingNotify] = NotImplemented;
EventSwapVector[ChangeDeviceNotify] = NotImplemented;
+ EventSwapVector[DevicePresenceNotify] = NotImplemented;
RestoreExtensionEvents();
}
@@ -857,9 +870,7 @@ MakeDeviceTypeAtoms(void)
}
/**************************************************************************
- *
* Return a DeviceIntPtr corresponding to a specified device id.
- * This will not return the pointer or keyboard, or devices that are not on.
*
*/
@@ -869,13 +880,16 @@ LookupDeviceIntRec(CARD8 id)
DeviceIntPtr dev;
for (dev = inputInfo.devices; dev; dev = dev->next) {
- if (dev->id == id) {
- if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id)
- return (NULL);
- return (dev);
- }
+ if (dev->id == id)
+ return dev;
}
- return (NULL);
+
+ for (dev = inputInfo.off_devices; dev; dev = dev->next) {
+ if (dev->id == id)
+ return dev;
+ }
+
+ return NULL;
}
/**************************************************************************
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index c2b69fd71..d738ef83b 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -124,6 +124,30 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
+ case DEVICE_ABS_CALIB:
+ if (!dev->absolute) {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ total_length = sizeof(xDeviceAbsCalibCtl);
+ break;
+ case DEVICE_ABS_AREA:
+ if (!dev->absolute) {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ total_length = sizeof(xDeviceAbsAreaCtl);
+ break;
+ case DEVICE_CORE:
+ total_length = sizeof(xDeviceCoreCtl);
+ break;
+ case DEVICE_ENABLE:
+ total_length = sizeof(xDeviceEnableCtl);
+ break;
default:
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
return Success;
@@ -140,6 +164,18 @@ ProcXGetDeviceControl(ClientPtr client)
case DEVICE_RESOLUTION:
CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
break;
+ case DEVICE_ABS_CALIB:
+ CopySwapDeviceAbsCalib(client, dev->absolute, buf);
+ break;
+ case DEVICE_ABS_AREA:
+ CopySwapDeviceAbsArea(client, dev->absolute, buf);
+ break;
+ case DEVICE_CORE:
+ CopySwapDeviceCore(client, dev, buf);
+ break;
+ case DEVICE_ENABLE:
+ CopySwapDeviceEnable(client, dev, buf);
+ break;
default:
break;
}
@@ -189,6 +225,98 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
}
}
+void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
+ char *buf)
+{
+ register char n;
+ xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf;
+
+ calib->control = DEVICE_ABS_CALIB;
+ calib->length = sizeof(calib);
+ calib->min_x = dts->min_x;
+ calib->max_x = dts->max_x;
+ calib->min_y = dts->min_y;
+ calib->max_y = dts->max_y;
+ calib->flip_x = dts->flip_x;
+ calib->flip_y = dts->flip_y;
+ calib->rotation = dts->rotation;
+ calib->button_threshold = dts->button_threshold;
+
+ if (client->swapped) {
+ swaps(&calib->control, n);
+ swaps(&calib->length, n);
+ swapl(&calib->min_x, n);
+ swapl(&calib->max_x, n);
+ swapl(&calib->min_y, n);
+ swapl(&calib->max_y, n);
+ swapl(&calib->flip_x, n);
+ swapl(&calib->flip_y, n);
+ swapl(&calib->rotation, n);
+ swapl(&calib->button_threshold, n);
+ }
+}
+
+void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
+ char *buf)
+{
+ register char n;
+ xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf;
+
+ area->control = DEVICE_ABS_AREA;
+ area->length = sizeof(area);
+ area->offset_x = dts->offset_x;
+ area->offset_y = dts->offset_y;
+ area->width = dts->width;
+ area->height = dts->height;
+ area->screen = dts->screen;
+ area->following = dts->following;
+
+ if (client->swapped) {
+ swaps(&area->control, n);
+ swaps(&area->length, n);
+ swapl(&area->offset_x, n);
+ swapl(&area->offset_y, n);
+ swapl(&area->width, n);
+ swapl(&area->height, n);
+ swapl(&area->screen, n);
+ swapl(&area->following, n);
+ }
+}
+
+void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
+{
+ register char n;
+ xDeviceCoreState *c = (xDeviceCoreState *) buf;
+
+ c->control = DEVICE_CORE;
+ c->length = sizeof(c);
+ c->status = dev->coreEvents;
+ c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
+
+ if (client->swapped) {
+ swaps(&c->control, n);
+ swaps(&c->length, n);
+ swaps(&c->status, n);
+ }
+}
+
+void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
+{
+ register char n;
+ xDeviceEnableState *e = (xDeviceEnableState *) buf;
+
+ e->control = DEVICE_ENABLE;
+ e->length = sizeof(e);
+ e->enable = dev->enabled;
+
+ if (client->swapped) {
+ swaps(&e->control, n);
+ swaps(&e->length, n);
+ swaps(&e->enable, n);
+ }
+}
+
+
/***********************************************************************
*
* This procedure writes the reply for the xGetDeviceControl function,
diff --git a/Xi/getdctl.h b/Xi/getdctl.h
index c7cfb19d2..36868d8be 100644
--- a/Xi/getdctl.h
+++ b/Xi/getdctl.h
@@ -42,6 +42,24 @@ void CopySwapDeviceResolution(ClientPtr /* client */ ,
int /* length */
);
+void CopySwapDeviceAbsCalib (ClientPtr client,
+ AbsoluteClassPtr dts,
+ char *buf);
+
+void CopySwapDeviceAbsArea (ClientPtr client,
+ AbsoluteClassPtr dts,
+ char *buf);
+
+void CopySwapDeviceCore(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ char * /* buf */
+ );
+
+void CopySwapDeviceEnable(ClientPtr /* client */ ,
+ DeviceIntPtr /* dev */ ,
+ char * /* buf */
+ );
+
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */
diff --git a/Xi/listdev.c b/Xi/listdev.c
index 13e5ca729..02d55ad4c 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -96,7 +96,7 @@ int
ProcXListInputDevices(register ClientPtr client)
{
xListInputDevicesReply rep;
- int numdevs;
+ int numdevs = 0;
int namesize = 1; /* need 1 extra byte for strcpy */
int size = 0;
int total_length;
@@ -115,12 +115,15 @@ ProcXListInputDevices(register ClientPtr client)
rep.sequenceNumber = client->sequence;
AddOtherInputDevices();
- numdevs = inputInfo.numDevices;
- for (d = inputInfo.devices; d; d = d->next)
+ for (d = inputInfo.devices; d; d = d->next) {
SizeDeviceInfo(d, &namesize, &size);
- for (d = inputInfo.off_devices; d; d = d->next)
+ numdevs++;
+ }
+ for (d = inputInfo.off_devices; d; d = d->next) {
SizeDeviceInfo(d, &namesize, &size);
+ numdevs++;
+ }
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
devbuf = (char *)xalloc(total_length);
@@ -241,6 +244,10 @@ CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes,
dev->use = IsXKeyboard;
else if (d == inputInfo.pointer)
dev->use = IsXPointer;
+ else if (d->key && d->kbdfeed)
+ dev->use = IsXExtensionKeyboard;
+ else if (d->valuator && d->button)
+ dev->use = IsXExtensionPointer;
else
dev->use = IsXExtensionDevice;
if (client->swapped) {
diff --git a/Xi/selectev.c b/Xi/selectev.c
index 3483804b1..7d3ef9d48 100644
--- a/Xi/selectev.c
+++ b/Xi/selectev.c
@@ -74,6 +74,53 @@ SOFTWARE.
extern Mask ExtExclusiveMasks[];
extern Mask ExtValidMasks[];
+static int
+HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
+ XEventClass *cls, CARD16 *count)
+{
+ int i, j;
+ Mask mask;
+
+ /* We use the device ID 256 to select events that aren't bound to
+ * any device. For now we only handle the device presence event,
+ * but this could be extended to other events that aren't bound to
+ * a device.
+ *
+ * In order not to break in CreateMaskFromList() we remove the
+ * entries with device ID 256 from the XEventClass array.
+ */
+
+ mask = 0;
+ for (i = 0, j = 0; i < *count; i++) {
+ if (cls[i] >> 8 != 256) {
+ cls[j] = cls[i];
+ j++;
+ continue;
+ }
+
+ switch (cls[i] & 0xff) {
+ case _devicePresence:
+ mask |= DevicePresenceNotifyMask;
+ break;
+ }
+ }
+
+ *count = j;
+
+ if (mask == 0)
+ return Success;
+
+ /* We always only use mksidx = 0 for events not bound to
+ * devices */
+
+ if (AddExtensionClient (win, client, mask, 0) != Success)
+ return BadAlloc;
+
+ RecalculateDeviceDeliverableEvents(win);
+
+ return Success;
+}
+
/***********************************************************************
*
* Handle requests from clients with a different byte order.
@@ -131,6 +178,13 @@ ProcXSelectExtensionEvent(register ClientPtr client)
return Success;
}
+ if (HandleDevicePresenceMask(client, pWin, (XEventClass *) & stuff[1],
+ &stuff->count) != Success) {
+ SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
+ BadAlloc);
+ return Success;
+ }
+
if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL,
X_SelectExtensionEvent)) != Success)
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 6b9e682b9..e2ed1ceff 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -68,86 +68,6 @@ SOFTWARE.
/***********************************************************************
*
- * Caller: ProcXChangeKeyboardDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the keyboard device.
- *
- * The X keyboard device has a FocusRec. If the device that has been
- * made into the new X keyboard did not have a FocusRec,
- * ProcXChangeKeyboardDevice will allocate one for it.
- *
- * If you do not want clients to be able to focus the old X keyboard
- * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
- *
- * If you support input devices with keys that you do not want to be
- * used as the X keyboard, you need to check for them here and return
- * a BadDevice error.
- *
- * The default implementation is to do nothing (assume you do want
- * clients to be able to focus the old X keyboard). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int
-ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev)
-{
- /***********************************************************************
- DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
- **********************************************************************/
- return BadMatch;
-}
-
-/***********************************************************************
- *
- * Caller: ProcXChangePointerDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the pointer device.
- *
- * The X pointer device does not have a FocusRec. If the device that
- * has been made into the new X pointer had a FocusRec,
- * ProcXChangePointerDevice will free it.
- *
- * If you want clients to be able to focus the old pointer device that
- * has now become accessible through the input extension, you need to
- * add a FocusRec to it here.
- *
- * The XChangePointerDevice protocol request also allows the client
- * to choose which axes of the new pointer device are used to move
- * the X cursor in the X- and Y- directions. If the axes are different
- * than the default ones, you need to keep track of that here.
- *
- * If you support input devices with valuators that you do not want to be
- * used as the X pointer, you need to check for them here and return a
- * BadDevice error.
- *
- * The default implementation is to do nothing (assume you don't want
- * clients to be able to focus the old X pointer). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int
-ChangePointerDevice(DeviceIntPtr old_dev,
- DeviceIntPtr new_dev, unsigned char x, unsigned char y)
-{
- /***********************************************************************
- InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
-
- x_axis = x; * keep track of new x-axis*
- y_axis = y; * keep track of new y-axis*
- if (x_axis != 0 || y_axis != 1)
- axes_changed = TRUE; * remember axes have changed*
- else
- axes_changed = FALSE;
- *************************************************************************/
- return BadMatch;
-}
-
-/***********************************************************************
- *
* Caller: ProcXCloseDevice
*
* Take care of implementation-dependent details of closing a device.
@@ -287,7 +207,26 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev,
switch (control->control) {
case DEVICE_RESOLUTION:
return (BadMatch);
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return (BadMatch);
+ case DEVICE_CORE:
+ return (BadMatch);
default:
return (BadMatch);
}
}
+
+
+/****************************************************************************
+ *
+ * Caller: configAddDevice (and others)
+ *
+ * Add a new device with the specified options.
+ *
+ */
+int
+NewInputDeviceRequest(InputOption *options)
+{
+ return BadValue;
+}
diff --git a/config/Makefile.am b/config/Makefile.am
new file mode 100644
index 000000000..1cc9109db
--- /dev/null
+++ b/config/Makefile.am
@@ -0,0 +1,10 @@
+AM_CFLAGS = @DIX_CFLAGS@
+
+dbusconfigdir = $(sysconfdir)/dbus-1/system.d
+dbusconfig_DATA = xorg-server.conf
+
+lib_LIBRARIES = libconfig.a
+
+libconfig_a_SOURCES = config.c
+
+EXTRA_DIST = xorg-server.conf
diff --git a/config/config.c b/config/config.c
new file mode 100644
index 000000000..5b0d90d74
--- /dev/null
+++ b/config/config.c
@@ -0,0 +1,349 @@
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders and/or authors
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. The copyright holders
+ * and/or authors make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS AND/OR AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR AUTHORS BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef HAVE_DBUS
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus.h>
+#include <string.h>
+
+#include <X11/X.h>
+
+#include "opaque.h" /* for 'display': there has to be a better way */
+ /* the above comment lies. there is no better way. */
+#include "input.h"
+#include "inputstr.h"
+#include "config.h"
+#include "os.h"
+
+#define MATCH_RULE "type='method_call',interface='org.x.config.input'"
+
+#define MALFORMED_MSG "[config] malformed message, dropping"
+#define MALFORMED_MESSAGE() { DebugF(MALFORMED_MSG "\n"); \
+ ret = BadValue; \
+ goto unwind; }
+#define MALFORMED_MESSAGE_ERROR() { DebugF(MALFORMED_MSG ": %s, %s", \
+ error->name, error->message); \
+ ret = BadValue; \
+ goto unwind; }
+
+static DBusConnection *configConnection = NULL;
+static int configfd = -1;
+static char busobject[32] = { 0 };
+static char busname[64] = { 0 };
+
+void
+configDispatch()
+{
+ if (!configConnection)
+ return;
+
+ dbus_connection_read_write_dispatch(configConnection, 0);
+}
+
+static int
+configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
+{
+ DBusMessageIter subiter;
+ InputOption *tmpo = NULL, *options = NULL;
+ char *tmp = NULL;
+ int ret = BadMatch;
+
+ DebugF("[config] adding device\n");
+
+ /* signature should be [ss][ss]... */
+ options = (InputOption *) xcalloc(sizeof(InputOption), 1);
+ if (!options) {
+ ErrorF("[config] couldn't allocate option\n");
+ return BadAlloc;
+ }
+
+ options->key = xstrdup("_source");
+ options->value = xstrdup("client/dbus");
+
+ while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) {
+ tmpo = (InputOption *) xcalloc(sizeof(InputOption), 1);
+ if (!tmpo) {
+ ErrorF("[config] couldn't allocate option\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+
+ dbus_message_iter_recurse(iter, &subiter);
+
+ if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
+ MALFORMED_MESSAGE();
+
+ dbus_message_iter_get_basic(&subiter, &tmp);
+ if (!tmp)
+ MALFORMED_MESSAGE();
+ if (tmp[0] == '_') {
+ ErrorF("[config] attempted subterfuge: option name %s given\n",
+ tmp);
+ MALFORMED_MESSAGE();
+ }
+ tmpo->key = xstrdup(tmp);
+ if (!tmpo->key) {
+ ErrorF("[config] couldn't duplicate key!\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+
+ if (!dbus_message_iter_has_next(&subiter))
+ MALFORMED_MESSAGE();
+ dbus_message_iter_next(&subiter);
+ if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
+ MALFORMED_MESSAGE();
+
+ dbus_message_iter_get_basic(&subiter, &tmp);
+ if (!tmp)
+ MALFORMED_MESSAGE();
+ tmpo->value = xstrdup(tmp);
+ if (!tmpo->value) {
+ ErrorF("[config] couldn't duplicate option!\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+
+ tmpo->next = options;
+ options = tmpo;
+ dbus_message_iter_next(iter);
+ }
+
+ ret = NewInputDeviceRequest(options);
+ if (ret != Success)
+ DebugF("[config] NewInputDeviceRequest failed\n");
+
+ return ret;
+
+unwind:
+ if (tmpo->key)
+ xfree(tmpo->key);
+ if (tmpo->value)
+ xfree(tmpo->value);
+ if (tmpo)
+ xfree(tmpo);
+
+ while (options) {
+ tmpo = options;
+ options = options->next;
+ if (tmpo->key)
+ xfree(tmpo->key);
+ if (tmpo->value)
+ xfree(tmpo->value);
+ xfree(tmpo);
+ }
+
+ return ret;
+}
+
+static int
+configRemoveDevice(DBusMessage *message, DBusMessageIter *iter,
+ DBusError *error)
+{
+ int deviceid = -1;
+ int ret = BadMatch;
+ DeviceIntPtr pDev = NULL;
+
+ if (!dbus_message_get_args(message, error, DBUS_TYPE_INT32,
+ &deviceid, DBUS_TYPE_INVALID)) {
+ MALFORMED_MESSAGE_ERROR();
+ }
+
+ if (deviceid < 0 || !(pDev = LookupDeviceIntRec(deviceid))) {
+ DebugF("[config] bogus device id %d given\n", deviceid);
+ ret = BadMatch;
+ goto unwind;
+ }
+
+ DebugF("[config] removing device %s (id %d)\n", pDev->name, deviceid);
+
+ /* Call PIE here so we don't try to dereference a device that's
+ * already been removed. */
+ OsBlockSignals();
+ ProcessInputEvents();
+ RemoveDevice(pDev);
+ OsReleaseSignals();
+
+ return Success;
+
+unwind:
+ return ret;
+}
+
+static DBusHandlerResult
+configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
+{
+ DBusMessageIter iter;
+ DBusError error;
+ DBusMessage *reply;
+ DBusConnection *bus = closure;
+ int ret = BadDrawable; /* nonsensical value */
+
+ dbus_error_init(&error);
+
+ if (strcmp(dbus_message_get_interface(message),
+ "org.x.config.input") == 0) {
+ if (!dbus_message_iter_init(message, &iter)) {
+ ErrorF("[config] failed to init iterator\n");
+ dbus_error_free(&error);
+ return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */
+ }
+
+ if (strcmp(dbus_message_get_member(message), "add") == 0)
+ ret = configAddDevice(message, &iter, &error);
+ else if (strcmp(dbus_message_get_member(message), "remove") == 0)
+ ret = configRemoveDevice(message, &iter, &error);
+ }
+
+ if (ret != BadDrawable && ret != BadAlloc) {
+ reply = dbus_message_new_method_return(message);
+ dbus_message_iter_init_append(reply, &iter);
+
+ if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret)) {
+ ErrorF("[config] couldn't append to iterator\n");
+ dbus_error_free(&error);
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ if (!dbus_connection_send(bus, reply, NULL))
+ ErrorF("[config] failed to send reply\n");
+ dbus_connection_flush(bus);
+
+ dbus_message_unref(reply);
+ }
+
+ dbus_error_free(&error);
+
+ if (ret == BadAlloc)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ else if (ret == BadDrawable)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ else
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+void
+configInitialise()
+{
+ DBusConnection *bus = NULL;
+ DBusError error;
+ DBusObjectPathVTable vtable = { .message_function = configMessage };
+
+ configConnection = NULL;
+
+ dbus_error_init(&error);
+ bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
+ if (!bus || dbus_error_is_set(&error)) {
+ dbus_error_free(&error);
+ FatalError("[dbus] some kind of error occurred: %s (%s)\n", error.name,
+ error.message);
+ return;
+ }
+
+ if (!dbus_connection_get_unix_fd(bus, &configfd)) {
+ dbus_connection_unref(bus);
+ configfd = -1;
+ FatalError("[dbus] couldn't get fd for bus\n");
+ return;
+ }
+
+ snprintf(busname, sizeof(busname), "org.x.config.display%d", atoi(display));
+ if (!dbus_bus_request_name(bus, busname, 0, &error) ||
+ dbus_error_is_set(&error)) {
+ dbus_error_free(&error);
+ dbus_connection_unref(bus);
+ configfd = -1;
+ FatalError("[dbus] couldn't take over org.x.config: %s (%s)\n",
+ error.name, error.message);
+ return;
+ }
+
+ /* blocks until we get a reply. */
+ dbus_bus_add_match(bus, MATCH_RULE, &error);
+ if (dbus_error_is_set(&error)) {
+ dbus_error_free(&error);
+ dbus_bus_release_name(bus, busname, &error);
+ dbus_connection_unref(bus);
+ configfd = -1;
+ FatalError("[dbus] couldn't match X.Org rule: %s (%s)\n", error.name,
+ error.message);
+ return;
+ }
+
+ snprintf(busobject, sizeof(busobject), "/org/x/config/%d", atoi(display));
+ if (!dbus_connection_register_object_path(bus, busobject, &vtable, bus)) {
+ configfd = -1;
+ dbus_bus_release_name(bus, busname, &error);
+ dbus_bus_remove_match(bus, MATCH_RULE, &error);
+ dbus_connection_unref(bus);
+ FatalError("[dbus] couldn't register object path\n");
+ return;
+ }
+
+ DebugF("[dbus] registered object path %s\n", busobject);
+
+ dbus_error_free(&error);
+ configConnection = bus;
+ AddGeneralSocket(configfd);
+}
+
+void
+configFini()
+{
+ DBusError error;
+
+ if (configConnection) {
+ dbus_error_init(&error);
+ dbus_connection_unregister_object_path(configConnection, busobject);
+ dbus_bus_remove_match(configConnection, MATCH_RULE, &error);
+ dbus_bus_release_name(configConnection, busname, &error);
+ dbus_connection_unref(configConnection);
+ RemoveGeneralSocket(configfd);
+ configConnection = NULL;
+ configfd = -1;
+ dbus_error_free(&error);
+ }
+}
+
+#else /* !HAVE_DBUS */
+
+void
+configDispatch()
+{
+}
+
+void
+configInitialise()
+{
+}
+
+void
+configFini()
+{
+}
+
+#endif /* HAVE_DBUS */
diff --git a/config/dbus-api b/config/dbus-api
new file mode 100644
index 000000000..53bb3e45d
--- /dev/null
+++ b/config/dbus-api
@@ -0,0 +1,35 @@
+D-BUS Configuration API v0.1
+----------------------------
+
+The X server will register the bus name org.x.config.displayN, and the
+object /org/x/config/N, where N is the display number.
+
+Currently only hotplugging of input devices is supported.
+
+org.x.config.input:
+ org.x.config.input.add:
+ Takes an argument of key/value option pairs in arrays, e.g.:
+ [ss][ss][ss][ss]
+ is the signature for four options. These options will be passed
+ to the input driver as with any others.
+ Option names beginning with _ are not allowed; they are reserved
+ for internal use.
+
+ Returns one int32, which is an X Status, as defined in X.h. If
+ everything is successful, Success will be returned. BadMatch will
+ be returned if the options given do not match any device. BadValue
+ is returned for a malformed message.
+
+ Notably, BadAlloc is never returned: the server internally signals
+ to D-BUS that the attempt failed for lack of memory.
+
+ The return does not notify the client of which devices were created
+ or modified as a result of this request: clients are encouraged to
+ listen for the XInput DevicePresenceNotify event to monitor changes
+ in the device list.
+
+ org.x.config.input.remove:
+ Takes one int32 argument, which is the device ID to remove, i.e.:
+ i
+ is the signature.
+ Same return values as org.x.config.input.add.
diff --git a/config/xorg-server.conf b/config/xorg-server.conf
new file mode 100644
index 000000000..47a9a7824
--- /dev/null
+++ b/config/xorg-server.conf
@@ -0,0 +1,13 @@
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy context="default">
+ <allow own="org.x.config.display0"/>
+ <allow send_destination="org.x.config.display0"/>
+ <allow send_interface="org.x.config.display0"/>
+ <allow own="org.x.config.display1"/>
+ <allow send_destination="org.x.config.display1"/>
+ <allow send_interface="org.x.config.display1"/>
+ </policy>
+</busconfig>
diff --git a/configure.ac b/configure.ac
index cb194aee6..b75caf780 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
dnl This is the not the Xorg version number, it's the server version number.
dnl Yes, that's weird.
-AC_INIT([xorg-server], 1.1.99.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.2.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
@@ -66,6 +66,26 @@ AC_PROG_YACC
AC_SYS_LARGEFILE
XORG_PROG_RAWCPP
+dnl Check for dtrace program (needed to build Xserver dtrace probes)
+AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
+ [Enable dtrace probes (default: enabled if dtrace found)]),
+ [WDTRACE=$withval], [WDTRACE=auto])
+if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
+ AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
+ if test "x$DTRACE" = "xnot_found" ; then
+ if test "x$WDTRACE" = "xyes" ; then
+ AC_MSG_FAILURE([dtrace requested but not found])
+ fi
+ WDTRACE="no"
+ fi
+fi
+if test "x$WDTRACE" != "xno" ; then
+ AC_DEFINE(XSERVER_DTRACE, 1,
+ [Define to 1 if the DTrace Xserver provider probes should be built in.])
+fi
+AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
+AC_DEFINE_DIR(XERRORDB_PATH, libdir/XErrorDB, [Path to XErrorDB file])
+
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
@@ -396,6 +416,12 @@ AC_ARG_ENABLE(install-libxf86config,
[Install libxf86config (default: disabled)]),
[INSTALL_LIBXF86CONFIG=$enableval],
[INSTALL_LIBXF86CONFIG=no])
+AC_ARG_ENABLE(builtin-fonts, AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: use external)]),
+ [BUILTIN_FONTS=$enableval],
+ [BUILTIN_FONTS=no])
+AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]),
+ [NULL_ROOT_CURSOR=$enableval],
+ [NULL_ROOT_CURSOR=no])
dnl Extensions.
AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
@@ -405,7 +431,7 @@ AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap ext
AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
-AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: enabled)]), [DGA=$enableval], [DGA=yes])
+AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
@@ -414,8 +440,8 @@ AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerate
AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: disabled)]), [GLX_USE_TLS=$enableval], [GLX_USE_TLS=no])
AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
-AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: enabled)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=yes])
-AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: enabled)]), [XF86MISC=$enableval], [XF86MISC=yes])
+AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
+AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto])
AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=$XACE])
AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: enabled)]), [APPGROUP=$enableval], [APPGROUP=$XCSECURITY])
@@ -429,7 +455,7 @@ AC_ARG_ENABLE(fontcache, AS_HELP_STRING([--enable-fontcache], [Build FontCa
AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: enabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=yes])
AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
-AC_ARG_ENABLE(xinput, AS_HELP_STRING([--disable-xinput], [Build XInput Extension (default: enabled)]), [XINPUT=$enableval], [XINPUT=yes])
+AC_ARG_ENABLE(dbus, AS_HELP_STRING([--disable-dbus], [Build D-BUS support (default: auto)]), [DBUS=$enableval], [DBUS=auto])
AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
dnl DDXes.
@@ -446,6 +472,9 @@ dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
AC_ARG_ENABLE(xsdl, AS_HELP_STRING([--enable-xsdl], [Build the kdrive Xsdl server (default: auto)]), [XSDL=$enableval], [XSDL=auto])
+AC_ARG_ENABLE(xfake, AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
+AC_ARG_ENABLE(xfbdev, AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
+AC_ARG_ENABLE(kdrive-vesa, AS_HELP_STRING([--enable-kdrive-vesa], [Build the kdrive VESA-based servers (default: auto)]), [KDRIVEVESA=$enableval], [KDRIVEVESA=auto])
dnl xprint
AC_ARG_ENABLE(freetype, AS_HELP_STRING([ --enable-freetype], [Build Xprint FreeType backend (default: yes)]), [XP_USE_FREETYPE=$enableval],[XP_USE_FREETYPE=no])
AC_ARG_WITH(freetype-config, AS_HELP_STRING([ --with-freetype-config=PROG], [Use FreeType configuration program PROG (default: auto)]), freetype_config=$withval, freetype_config=auto)
@@ -517,9 +546,21 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al.
-REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans xf86miscproto xf86vidmodeproto xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto xf86dgaproto [kbproto >= 1.0.3]"
+REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc"
+if test "x$DBUS" = xauto; then
+ PKG_CHECK_MODULES(DBUS, dbus-1, [DBUS=yes], [DBUS=no])
+fi
+if test "x$DBUS" = xyes; then
+ PKG_CHECK_MODULES(DBUS, dbus-1)
+ AC_DEFINE(HAVE_DBUS, 1, [Have D-BUS support])
+ REQUIRED_MODULES="$REQUIRED_MODULES dbus-1"
+ REQUIRED_LIBS="$REQUIRED_LIBS dbus-1"
+fi
+CONFIG_LIB='$(top_builddir)/config/libconfig.a'
+AM_CONDITIONAL(DBUS, [test "x$DBUS" = xyes])
+
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then
AC_DEFINE(XV, 1, [Support Xv extension])
@@ -534,10 +575,6 @@ if test "x$XVMC" = xyes; then
AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
fi
-AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
-if test "x$DGA" = xyes; then
- AC_DEFINE(DGA, 1, [Support DGA extension])
-fi
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
@@ -701,14 +738,6 @@ if test "x$DPMSExtension" = xyes; then
AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
fi
-if test "x$XF86VIDMODE" = xyes; then
- AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
-fi
-
-if test "x$XF86MISC" = xyes; then
- AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
-fi
-
if test "x$XPRINT" = xauto; then
PKG_CHECK_MODULES([XPRINTPROTO], [printproto], [XPRINT=yes], [XPRINT=no])
fi
@@ -718,6 +747,11 @@ if test "x$XPRINT" = xyes; then
REQUIRED_MODULES="$REQUIRED_MODULES printproto"
fi
+if test "x$BUILTIN_FONTS" = xyes; then
+ AC_DEFINE(BUILTIN_FONTS, 1, [Use only built-in fonts])
+ AC_DEFINE(NOFONTSERVERACCESS, 1, [Avoid using a font server])
+fi
+
if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateproto"
@@ -748,12 +782,9 @@ if test "$COMPOSITE" = yes; then
fi
MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
-AM_CONDITIONAL(XINPUT, [test "x$XINPUT" = xyes])
-if test "x$XINPUT" = xyes; then
- AC_DEFINE(XINPUT, 1, [Support X Input extension])
- XI_LIB='$(top_builddir)/Xi/libXi.la'
- XI_INC='-I$(top_srcdir)/Xi'
-fi
+AC_DEFINE(XINPUT, 1, [Support X Input extension])
+XI_LIB='$(top_builddir)/Xi/libXi.la'
+XI_INC='-I$(top_srcdir)/Xi'
AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
@@ -769,6 +800,10 @@ XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
[Do not have `strcasecmp'.]))
+if test "x$NULL_ROOT_CURSOR" = xyes; then
+ AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
+fi
+
PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
if test "x$have_libxdmcp" = xyes; then
AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
@@ -845,11 +880,13 @@ AC_DEFINE(DDXOSINIT, 1, [Use OsVendorInit])
AC_DEFINE(SERVER_LOCK, 1, [Use a lock to prevent multiple servers on a display])
AC_DEFINE(SMART_SCHEDULE, 1, [Include time-based scheduler])
AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
-AM_CONDITIONAL(DEBUG, test "x$DEBUGGING" = xyes)
-if ! test "x$DEBUGGING" = xyes; then
- AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
+if test "x$DEBUGGING" = xyes; then
+ AC_DEFINE(DEBUG, 1, [Enable debugging code])
+else
+ AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
fi
+AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
AC_DEFINE(USE_RGB_TXT, 1, [Use rgb.txt directly])
AC_DEFINE(MITMISC, 1, [Support MIT Misc extension])
@@ -859,8 +896,13 @@ AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
AC_DEFINE(PIXPRIV, 1, [Support pixmap privates])
-DIX_LIB='$(top_builddir)/dix/libdix.la'
-OS_LIB='$(top_builddir)/os/libos.la'
+if test "x$WDTRACE" != "xno" ; then
+ DIX_LIB='$(top_builddir)/dix/dix.O'
+ OS_LIB='$(top_builddir)/os/os.O'
+else
+ DIX_LIB='$(top_builddir)/dix/libdix.la'
+ OS_LIB='$(top_builddir)/os/libos.la'
+fi
CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
MI_LIB='$(top_builddir)/mi/libmi.la'
MINIMI_LIB='$(top_builddir)/mi/libminimi.la'
@@ -877,9 +919,32 @@ PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}"
-XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm"
+XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
AC_SUBST([SYS_LIBS])
+# The Xorg binary needs to export symbols so that they can be used from modules
+# Some platforms require extra flags to do this. gcc should set these flags
+# when -rdynamic is passed to it, other compilers/linkers may need to be added
+# here.
+if test "x$GCC" = "xyes"; then
+ GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
+ GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
+ GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
+ GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
+ if test "x$WERROR" = "xyes"; then
+ GCC_WARNINGS="${GCC_WARNINGS} -Werror"
+ fi
+ XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"
+
+ LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
+fi
+case $host_os in
+ openbsd*)
+ LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
+ ;;
+esac
+AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
+
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
[have_clock_gettime=no])])
@@ -888,9 +953,9 @@ AC_MSG_CHECKING([for a useful monotonic clock ...])
if ! test "x$have_clock_gettime" = xno; then
if ! test "x$have_clock_gettime" = xyes; then
- LIBS="$have_clock_gettime"
+ CLOCK_LIBS="$have_clock_gettime"
else
- LIBS=""
+ CLOCK_LIBS=""
fi
AC_RUN_IFELSE([
@@ -915,7 +980,8 @@ AC_MSG_RESULT([$MONOTONIC_CLOCK])
if test "x$MONOTONIC_CLOCK" = xyes; then
AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
- XSERVER_LIBS="$XSERVER_LIBS $LIBS"
+ XSERVER_LIBS="$XSERVER_LIBS $CLOCK_LIBS"
+ LIBS="$LIBS $CLOCK_LIBS"
fi
dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
@@ -993,7 +1059,7 @@ AC_MSG_RESULT([$XVFB])
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
if test "x$XVFB" = xyes; then
- XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XVFB_LIBS])
fi
@@ -1009,7 +1075,7 @@ AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
if test "x$XNEST" = xyes; then
- XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
+ XNEST_LIBS="$XSERVER_LIBS $FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XNEST_LIBS])
fi
@@ -1080,7 +1146,7 @@ if test "x$XGLX" = xyes; then
fi
# XORG_CORE_LIBS is needed even if you're not building the Xorg DDX
-XORG_CORE_LIBS="$DIX_LIB"
+XORG_CORE_LIBS="$DIX_LIB $CONFIG_LIB"
AC_SUBST([XORG_CORE_LIBS])
xorg_bus_linuxpci=no
@@ -1098,6 +1164,37 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
XORG_LIBS="$COMPOSITE_LIB $MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $OS_LIB"
+ if test "x$DGA" = xauto; then
+ PKG_CHECK_MODULES(DGA, xf86dgaproto, [DGA=yes], [DGA=no])
+ fi
+ if test "x$DGA" = xyes; then
+ XORG_MODULES="$XORG_MODULES xf86dgaproto"
+ AC_DEFINE(DGA, 1, [Support DGA extension])
+ AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
+ fi
+
+ if test "x$XF86MISC" = xauto; then
+ PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
+ fi
+ if test "x$XF86MISC" = xyes; then
+ XORG_MODULES="$XORG_MODULES xf86miscproto"
+ AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
+ fi
+
+ if test "x$XF86VIDMODE" = xauto; then
+ PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
+ fi
+ if test "x$XF86VIDMODE" = xyes; then
+ XORG_MODULES="$XORG_MODULES xf86vidmodeproto"
+ AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
+ fi
+
+ if test -n "$XORG_MODULES"; then
+ PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
+ XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
+ XORG_LIBS="$XORG_LIBS $XORG_MODULES_LIBS"
+ fi
+
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
@@ -1110,7 +1207,6 @@ dnl has it in libc), or if libdl is needed to get it.
fi
XORG_OS="linux"
XORG_OS_SUBDIR="linux"
- XORG_OS_KBD="Lnx"
xorg_bus_linuxpci="yes"
linux_acpi="no"
case $host_cpu in
@@ -1129,30 +1225,10 @@ dnl has it in libc), or if libdl is needed to get it.
*)
;;
esac
-
- # check whether struct kbd_repeat has the 'period' field.
- # on kernels < 2.5.42 it's called 'rate' instead.
- AC_TRY_COMPILE([
-#include <linux/kd.h>
-#ifdef __sparc__
-#include <asm/param.h>
-#include <asm/kbio.h>
-#endif
-],[
-int main () {
- struct kbd_repeat k;
- k.period = 0;
- return 0;
-}],
- [period_field="period"],
- [period_field="rate"])
- AC_DEFINE_UNQUOTED(LNX_KBD_PERIOD_NAME, [$period_field],
- [Name of the period field in struct kbd_repeat])
;;
freebsd* | kfreebsd*-gnu)
XORG_OS="freebsd"
XORG_OS_SUBDIR="bsd"
- XORG_OS_KBD="BSD"
case $host_cpu in
i*86)
;;
@@ -1164,7 +1240,6 @@ int main () {
netbsd*)
XORG_OS="netbsd"
XORG_OS_SUBDIR="bsd"
- XORG_OS_KBD="BSD"
case $host_cpu in
i*86|amd64*|x86_64*|ia64*)
;;
@@ -1176,7 +1251,6 @@ int main () {
openbsd*)
XORG_OS="openbsd"
XORG_OS_SUBDIR="bsd"
- XORG_OS_KBD="BSD"
case $host_cpu in
i*86|amd64*|x86_64*|ia64*)
;;
@@ -1283,7 +1357,6 @@ int main () {
AC_SUBST([XORG_INCS])
AC_SUBST([XORG_OS])
AC_SUBST([XORG_OS_SUBDIR])
- AC_SUBST([XORG_OS_KBD])
dnl only used in hw/xfree86/scanpci, TTBOMK
AC_PATH_PROG(PERL, perl, no)
@@ -1293,28 +1366,7 @@ int main () {
fi
AC_SUBST(PERL)
- # The Xorg binary needs to export symbols so that they can be used from modules
- # Some platforms require extra flags to do this. gcc should set these flags
- # when -rdynamic is passed to it, other compilers/linkers may need to be added
- # here.
- if test "x$GCC" = "xyes"; then
- GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
- GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
- GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
- GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
- if test "x$WERROR" = "xyes"; then
- GCC_WARNINGS="${GCC_WARNINGS} -Werror"
- fi
- XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"
- LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
- fi
- case $host_os in
- openbsd*)
- LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
- ;;
- esac
AC_SUBST([XORG_CFLAGS])
- AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
dnl these only go in xorg-config.h
XF86CONFIGFILE="xorg.conf"
@@ -1363,6 +1415,7 @@ AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
AM_CONDITIONAL(MFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(CFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(AFB, [test "x$XORG" = xyes])
+AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
dnl Xprint DDX
@@ -1372,7 +1425,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
- XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB"
+ XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS])
@@ -1501,16 +1554,59 @@ if test "$KDRIVE" = yes; then
AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx])
AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
- if test "$ac_cv_header_sys_vm86_h" = yes; then
+ if test "$ac_cv_header_sys_vm86_h" = yes && test "x$KDRIVEVESA" = xauto; then
+ KDRIVEVESA=yes
+ fi
+
+ if test "x$KDRIVEVESA" = xyes; then
+ KDRIVEFBDEVLIB=yes
AC_DEFINE(KDRIVEVESA, 1, [Build VESA-based kdrive servers])
fi
AC_CHECK_HEADERS([linux/fb.h])
- if test "$ac_cv_header_linux_fb_h" = yes; then
+ if test "$ac_cv_header_linux_fb_h" = yes && test "x$XFBDEV" = xauto; then
+ XFBDEV=yes
+ fi
+
+ if test "x$XFBDEV" = xyes; then
+ KDRIVEFBDEVLIB=yes
AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server])
fi
# tslib...
+ AC_CHECK_LIB(ts, ts_open, [HAVE_TSLIB="yes"])
+ if test "x$TSLIB" = xauto && test "x$HAVE_TSLIB" = xyes; then
+ TSLIB=yes
+ fi
+
+ if test "x$TSLIB" = xyes; then
+ if ! test "x$HAVE_TSLIB" = xyes; then
+ AC_MSG_ERROR([tslib must be installed to build the tslib input driver.])
+ fi
+ TSLIB_LIBS="-lts"
+ AC_DEFINE(TSLIB, 1, [Have tslib support])
+ fi
+
+ if test x"$ac_cv_header_SDL_SDL_h" = xyes && test "x$XSDL" = xauto; then
+ XSDL=yes
+ fi
+
+ if test x"$XSDL" = xyes; then
+ # PKG_CHECK_MODULES(XSDL_EXTRA, Xfont xau $XDMCP_MODULES)
+ AC_DEFINE(XSDLSERVER,1,[Build Xsdl server])
+ XSDL_LIBS="`sdl-config --libs` $XSERVER_LIBS"
+ XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS"
+ fi
+
+ PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
+ if test "x$XEPHYR" = xauto; then
+ XEPHYR=$xephyr
+ fi
+
+ # Xephyr needs nanosleep() which is in librt on Solaris
+ AC_CHECK_FUNC([nanosleep], [],
+ AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
+ XEPHYR_LIBS="$XEPHYR_LIBS $XSERVER_LIBS"
if test "x$TSLIB" = xyes; then
PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
if test "x$HAVE_TSLIB" = xno; then
@@ -1532,55 +1628,57 @@ if test "$KDRIVE" = yes; then
# $MIEXT_SHADOW_LIB $XPSTUBS_LIB"
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
- KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.a'
+ case $host_os in
+ *linux*)
+ KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.a'
+ KDRIVELINUX=yes
+ ;;
+ esac
KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.a'
- KDRIVE_LIBS="$DIX_LIB $KDRIVE_LIB $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB $TSLIB_LIBS"
+ KDRIVE_LIBS="$XSERVERLIBS_LIBS $DIX_LIB $CONFIG_LIB $KDRIVE_LIB $TSLIB_LIBS $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB"
# check if we can build Xephyr
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
-
+ XEPHYR_LIBS="$XEPHYR_LIBS $XSERVER_LIBS"
+
+ # Xephyr needs nanosleep() which is in librt on Solaris
+ AC_CHECK_FUNC([nanosleep], [],
+ AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
+
# check for SDL SDK
AC_CHECK_HEADERS([SDL/SDL.h])
if test "x$XSDL" = xauto; then
XSDL="$ac_cv_header_SDL_SDL_h"
fi
-fi
-AC_SUBST(KDRIVE_INCS)
-AC_SUBST(KDRIVE_PURE_INCS)
-AC_SUBST(KDRIVE_CFLAGS)
-AC_SUBST(KDRIVE_PURE_LIBS)
-AC_SUBST(KDRIVE_LIBS)
+
+ AC_SUBST([XEPHYR_LIBS])
+ AC_SUBST([XEPHYR_INCS])
+ AC_SUBST([XSDL_LIBS])
+ AC_SUBST([XSDL_INCS])
+fi
+AC_SUBST([KDRIVE_INCS])
+AC_SUBST([KDRIVE_PURE_INCS])
+AC_SUBST([KDRIVE_CFLAGS])
+AC_SUBST([KDRIVE_PURE_LIBS])
+AC_SUBST([KDRIVE_LIBS])
+AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
AM_CONDITIONAL(H3600_TS, false)
+AM_CONDITIONAL(KDRIVEVESA, [test "x$KDRIVEVESA" = xyes])
+AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
+AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes])
+AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
+AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
+AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
AM_CONDITIONAL(KDRIVEVESA, [test x"$ac_cv_header_sys_vm86_h" = xyes])
AM_CONDITIONAL(KDRIVEFBDEV, [test x"$ac_cv_header_linux_fb_h" = xyes])
-# Xephyr needs nanosleep() which is in librt on Solaris
-AC_CHECK_FUNC([nanosleep], [],
- AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
-
-AM_CONDITIONAL(XEPHYR, [test x"$xephyr" = xyes])
-XEPHYR_LIBS="$XEPHYR_LIBS $XSERVER_LIBS"
-AC_SUBST([XEPHYR_LIBS])
-AC_SUBST([XEPHYR_INCS])
-
-if test x"$XSDL" = xyes; then
- AC_DEFINE(XSDLSERVER,,[Build Xsdl server])
- XSDL_LIBS="`sdl-config --libs` $XSERVER_LIBS"
- XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS"
-fi
-AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes])
-AC_SUBST([XSDL_LIBS])
-AC_SUBST([XSDL_INCS])
-
-
dnl these only go in xkb-config.h (which is shared by the Xorg and Xnest servers)
AC_DEFINE(__XKBDEFRULES__, "xorg", [Default XKB rules])
AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
AC_DEFINE_DIR(XKB_BIN_DIRECTORY, bindir, [Path to XKB bin dir])
# Make sure XKM_OUTPUT_DIR is an absolute path
-
XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
if [[ x$XKBOUTPUT_FIRSTCHAR != x/ ]] ; then
@@ -1598,7 +1696,6 @@ AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
AC_SUBST(XKB_COMPILED_DIR)
dnl and the rest of these are generic, so they're in config.h
-AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
AC_DEFINE(XResExtension, 1, [Build XRes extension])
dnl CYGWIN does not define fd_set if _POSIX_SOURCE is defined
@@ -1619,9 +1716,11 @@ esac
AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
dnl xorgconfig CLI configuration utility
-PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile x11])
-AC_SUBST(XORGCONFIG_DEP_CFLAGS)
-AC_SUBST(XORGCONFIG_DEP_LIBS)
+if test "x$XORG" = xyes; then
+ PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile x11])
+ AC_SUBST(XORGCONFIG_DEP_CFLAGS)
+ AC_SUBST(XORGCONFIG_DEP_LIBS)
+fi
dnl xorgcfg GUI configuration utility
AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg],
@@ -1711,6 +1810,7 @@ XTrap/Makefile
mfb/Makefile
cfb/Makefile
cfb32/Makefile
+config/Makefile
mi/Makefile
miext/Makefile
miext/damage/Makefile
diff --git a/dix/Makefile.am b/dix/Makefile.am
index d26d9ea7a..d0d6e8785 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -17,6 +17,7 @@ libdix_la_SOURCES = \
extension.c \
ffs.c \
gc.c \
+ getevents.c \
globals.c \
glyphcurs.c \
grabs.c \
@@ -37,4 +38,22 @@ libxpstubs_la_SOURCES = \
INCLUDES = -I$(top_srcdir)/Xprint
-EXTRA_DIST = buildatoms BuiltInAtoms CHANGES
+EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in
+
+if XSERVER_DTRACE
+# Generate dtrace header file for C sources to include
+BUILT_SOURCES = Xserver-dtrace.h
+
+Xserver-dtrace.h: $(srcdir)/Xserver.d
+ $(DTRACE) -C -h -o $@ -s $(srcdir)/Xserver.d \
+ || cp Xserver-dtrace.h.in $@
+
+# Generate dtrace object code for probes in libdix
+dtrace-dix.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS)
+ $(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o
+
+noinst_LIBRARIES = dix.O
+
+dix.O: dtrace-dix.o $(am_libdix_la_OBJECTS)
+ ld -r -o $@ .libs/*.o
+endif
diff --git a/dix/Xserver-dtrace.h.in b/dix/Xserver-dtrace.h.in
new file mode 100644
index 000000000..26a8b4099
--- /dev/null
+++ b/dix/Xserver-dtrace.h.in
@@ -0,0 +1,100 @@
+/* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+/*
+ * Generated by dtrace(1M), and then modified for backwards compatibility
+ * with older versions of dtrace. Used if dtrace -h fails.
+ * (Since _ENABLED support was added after dtrace -h, this assumes if
+ * dtrace -h fails, _ENABLED will too.)
+ */
+
+#ifndef _XSERVER_DTRACE_H
+#define _XSERVER_DTRACE_H
+
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if _DTRACE_VERSION
+
+#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___client__auth(arg0, arg1, arg2, arg3)
+#define XSERVER_CLIENT_CONNECT(arg0, arg1) \
+ __dtrace_Xserver___client__connect(arg0, arg1)
+#define XSERVER_CLIENT_DISCONNECT(arg0) \
+ __dtrace_Xserver___client__disconnect(arg0)
+#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4) \
+ __dtrace_Xserver___request__done(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4) \
+ __dtrace_Xserver___request__start(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___resource__alloc(arg0, arg1, arg2, arg3)
+#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3) \
+ __dtrace_Xserver___resource__free(arg0, arg1, arg2, arg3)
+#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
+ __dtrace_Xserver___send__event(arg0, arg1, arg2)
+
+
+extern void __dtrace_Xserver___client__auth(int, string, pid_t, zoneid_t);
+extern void __dtrace_Xserver___client__connect(int, int);
+extern void __dtrace_Xserver___client__disconnect(int);
+extern void __dtrace_Xserver___request__done(string, uint8_t, uint32_t, int, int);
+extern void __dtrace_Xserver___request__start(string, uint8_t, uint16_t, int, void *);
+extern void __dtrace_Xserver___resource__alloc(uint32_t, uint32_t, void *, string);
+extern void __dtrace_Xserver___resource__free(uint32_t, uint32_t, void *, string);
+extern void __dtrace_Xserver___send__event(int, uint8_t, void *);
+
+#else
+
+#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3)
+#define XSERVER_CLIENT_CONNECT(arg0, arg1)
+#define XSERVER_CLIENT_DISCONNECT(arg0)
+#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4)
+#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3)
+#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3)
+#define XSERVER_SEND_EVENT(arg0, arg1, arg2)
+
+#endif
+
+#define XSERVER_CLIENT_AUTH_ENABLED() (1)
+#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
+#define XSERVER_CLIENT_DISCONNECT_ENABLED() (1)
+#define XSERVER_REQUEST_DONE_ENABLED() (1)
+#define XSERVER_REQUEST_START_ENABLED() (1)
+#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
+#define XSERVER_RESOURCE_FREE_ENABLED() (1)
+#define XSERVER_SEND_EVENT_ENABLED() (1)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XSERVER_DTRACE_H */
diff --git a/dix/Xserver.d b/dix/Xserver.d
new file mode 100644
index 000000000..e4c9b8320
--- /dev/null
+++ b/dix/Xserver.d
@@ -0,0 +1,59 @@
+/* Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+/*
+ * Xserver dtrace provider definition
+ */
+
+#include <sys/types.h>
+
+provider Xserver {
+ /* reqType, data, length, client id, request buffer */
+ probe request__start(string, uint8_t, uint16_t, int, void *);
+ /* reqType, data, sequence, client id, result */
+ probe request__done(string, uint8_t, uint32_t, int, int);
+ /* client id, client fd */
+ probe client__connect(int, int);
+ /* client id, client address, client pid, client zone id */
+ probe client__auth(int, string, pid_t, zoneid_t);
+ /* client id */
+ probe client__disconnect(int);
+ /* resource id, resource type, value, resource type name */
+ probe resource__alloc(uint32_t, uint32_t, void *, string);
+ /* resource id, resource type, value, resource type name */
+ probe resource__free(uint32_t, uint32_t, void *, string);
+ /* client id, event type, event* */
+ probe send__event(int, uint8_t, void *);
+};
+
+#pragma D attributes Unstable/Unstable/Common provider Xserver provider
+#pragma D attributes Private/Private/Unknown provider Xserver module
+#pragma D attributes Private/Private/Unknown provider Xserver function
+#pragma D attributes Unstable/Unstable/Common provider Xserver name
+#pragma D attributes Unstable/Unstable/Common provider Xserver args
+
diff --git a/dix/devices.c b/dix/devices.c
index 607510203..aa0486219 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -77,14 +77,20 @@ SOFTWARE.
#include "swaprep.h"
#include "dixevents.h"
+#include <X11/extensions/XIproto.h>
+#include "exglobals.h"
+#include "exevents.h"
+
+int CoreDevicePrivatesIndex = 0, CoreDevicePrivatesGeneration = -1;
+
DeviceIntPtr
AddInputDevice(DeviceProc deviceProc, Bool autoStart)
{
- register DeviceIntPtr dev;
+ register DeviceIntPtr dev, *prev; /* not a typo */
if (inputInfo.numDevices >= MAX_DEVICES)
return (DeviceIntPtr)NULL;
- dev = (DeviceIntPtr) xalloc(sizeof(DeviceIntRec));
+ dev = (DeviceIntPtr) xcalloc(sizeof(DeviceIntRec), 1);
if (!dev)
return (DeviceIntPtr)NULL;
dev->name = (char *)NULL;
@@ -110,20 +116,28 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart)
dev->button = (ButtonClassPtr)NULL;
dev->focus = (FocusClassPtr)NULL;
dev->proximity = (ProximityClassPtr)NULL;
+ dev->absolute = (AbsoluteClassPtr)NULL;
dev->kbdfeed = (KbdFeedbackPtr)NULL;
dev->ptrfeed = (PtrFeedbackPtr)NULL;
dev->intfeed = (IntegerFeedbackPtr)NULL;
dev->stringfeed = (StringFeedbackPtr)NULL;
dev->bell = (BellFeedbackPtr)NULL;
dev->leds = (LedFeedbackPtr)NULL;
- dev->next = inputInfo.off_devices;
#ifdef XKB
- dev->xkb_interest= NULL;
+ dev->xkb_interest = NULL;
#endif
dev->nPrivates = 0;
dev->devPrivates = NULL;
dev->unwrapProc = NULL;
- inputInfo.off_devices = dev;
+ dev->coreEvents = TRUE;
+ dev->inited = FALSE;
+ dev->enabled = FALSE;
+
+ for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next)
+ ;
+ *prev = dev;
+ dev->next = NULL;
+
return dev;
}
@@ -131,17 +145,25 @@ Bool
EnableDevice(register DeviceIntPtr dev)
{
register DeviceIntPtr *prev;
+ int ret;
for (prev = &inputInfo.off_devices;
*prev && (*prev != dev);
prev = &(*prev)->next)
;
if ((*prev != dev) || !dev->inited ||
- ((*dev->deviceProc)(dev, DEVICE_ON) != Success))
+ ((ret = (*dev->deviceProc)(dev, DEVICE_ON)) != Success)) {
+ ErrorF("couldn't enable device %d\n", dev->id);
return FALSE;
+ }
+ dev->enabled = TRUE;
*prev = dev->next;
- dev->next = inputInfo.devices;
- inputInfo.devices = dev;
+
+ for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next)
+ ;
+ *prev = dev;
+ dev->next = NULL;
+
return TRUE;
}
@@ -157,6 +179,7 @@ DisableDevice(register DeviceIntPtr dev)
if (*prev != dev)
return FALSE;
(void)(*dev->deviceProc)(dev, DEVICE_OFF);
+ dev->enabled = FALSE;
*prev = dev->next;
dev->next = inputInfo.off_devices;
inputInfo.off_devices = dev;
@@ -164,14 +187,204 @@ DisableDevice(register DeviceIntPtr dev)
}
int
+ActivateDevice(DeviceIntPtr dev)
+{
+ int ret = Success;
+ devicePresenceNotify ev;
+ DeviceIntRec dummyDev;
+
+ if (!dev || !dev->deviceProc)
+ return BadImplementation;
+
+ ret = (*dev->deviceProc) (dev, DEVICE_INIT);
+ dev->inited = (ret == Success);
+
+ ev.type = DevicePresenceNotify;
+ ev.time = currentTime.milliseconds;
+ ev.devchange = 0;
+ ev.deviceid = 0;
+ dummyDev.id = 0;
+ SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
+ (xEvent *) &ev, 1);
+
+ return ret;
+}
+
+static void
+CoreKeyboardBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
+{
+ KeybdCtrl *ctrl = arg;
+
+ DDXRingBell(volume, ctrl->bell_pitch, ctrl->bell_duration);
+}
+
+static void
+CoreKeyboardCtl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
+{
+ return;
+}
+
+static int
+CoreKeyboardProc(DeviceIntPtr pDev, int what)
+{
+ CARD8 *modMap;
+ KeySymsRec keySyms;
+#ifdef XKB
+ XkbComponentNamesRec names;
+#endif
+
+ switch (what) {
+ case DEVICE_INIT:
+ keySyms.minKeyCode = 8;
+ keySyms.maxKeyCode = 255;
+ keySyms.mapWidth = 4;
+ keySyms.map = (KeySym *)xcalloc(sizeof(KeySym),
+ (keySyms.maxKeyCode -
+ keySyms.minKeyCode) *
+ keySyms.mapWidth);
+ if (!keySyms.map) {
+ ErrorF("Couldn't allocate core keymap\n");
+ return BadAlloc;
+ }
+
+ modMap = (CARD8 *)xalloc(MAP_LENGTH);
+ if (!modMap) {
+ ErrorF("Couldn't allocate core modifier map\n");
+ return BadAlloc;
+ }
+ bzero((char *)modMap, MAP_LENGTH);
+
+#ifdef XKB
+ if (!noXkbExtension) {
+ bzero(&names, sizeof(names));
+ XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
+ XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, modMap,
+ CoreKeyboardBell, CoreKeyboardCtl);
+ }
+ else
+#endif
+ {
+ /* FIXME Our keymap here isn't exactly useful. */
+ InitKeyboardDeviceStruct((DevicePtr)pDev, &keySyms, modMap,
+ CoreKeyboardBell, CoreKeyboardCtl);
+ }
+
+ xfree(keySyms.map);
+ xfree(modMap);
+
+ break;
+
+ case DEVICE_CLOSE:
+ pDev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
+ break;
+
+ default:
+ break;
+ }
+ return Success;
+}
+
+static int
+CorePointerProc(DeviceIntPtr pDev, int what)
+{
+ BYTE map[33];
+ int i = 0;
+
+ switch (what) {
+ case DEVICE_INIT:
+ for (i = 1; i <= 32; i++)
+ map[i] = i;
+ InitPointerDeviceStruct((DevicePtr)pDev, map, 32,
+ GetMotionHistory, (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), 2);
+ pDev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
+ pDev->valuator->lastx = pDev->valuator->axisVal[0];
+ pDev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
+ pDev->valuator->lasty = pDev->valuator->axisVal[1];
+ break;
+
+ case DEVICE_CLOSE:
+ pDev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
+ break;
+
+ default:
+ break;
+ }
+
+ return Success;
+}
+
+void
+InitCoreDevices()
+{
+ register DeviceIntPtr dev;
+
+ if (CoreDevicePrivatesGeneration != serverGeneration) {
+ CoreDevicePrivatesIndex = AllocateDevicePrivateIndex();
+ CoreDevicePrivatesGeneration = serverGeneration;
+ }
+
+ if (!inputInfo.keyboard) {
+ dev = AddInputDevice(CoreKeyboardProc, TRUE);
+ if (!dev)
+ FatalError("Failed to allocate core keyboard");
+ dev->name = strdup("Virtual core keyboard");
+#ifdef XKB
+ dev->public.processInputProc = CoreProcessKeyboardEvent;
+ dev->public.realInputProc = CoreProcessKeyboardEvent;
+ if (!noXkbExtension)
+ XkbSetExtension(dev, ProcessKeyboardEvent);
+#else
+ dev->public.processInputProc = ProcessKeyboardEvent;
+ dev->public.realInputProc = ProcessKeyboardEvent;
+#endif
+ dev->ActivateGrab = ActivateKeyboardGrab;
+ dev->DeactivateGrab = DeactivateKeyboardGrab;
+ dev->coreEvents = FALSE;
+ if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
+ FatalError("Couldn't allocate keyboard devPrivates\n");
+ dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
+ (void)ActivateDevice(dev);
+ inputInfo.keyboard = dev;
+ }
+
+ if (!inputInfo.pointer) {
+ dev = AddInputDevice(CorePointerProc, TRUE);
+ if (!dev)
+ FatalError("Failed to allocate core pointer");
+ dev->name = strdup("Virtual core pointer");
+#ifdef XKB
+ dev->public.processInputProc = CoreProcessPointerEvent;
+ dev->public.realInputProc = CoreProcessPointerEvent;
+ if (!noXkbExtension)
+ XkbSetExtension(dev, ProcessPointerEvent);
+#else
+ dev->public.processInputProc = ProcessPointerEvent;
+ dev->public.realInputProc = ProcessPointerEvent;
+#endif
+ dev->ActivateGrab = ActivatePointerGrab;
+ dev->DeactivateGrab = DeactivatePointerGrab;
+ dev->coreEvents = FALSE;
+ if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex))
+ FatalError("Couldn't allocate pointer devPrivates\n");
+ dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL;
+ (void)ActivateDevice(dev);
+ inputInfo.pointer = dev;
+ }
+}
+
+int
InitAndStartDevices()
{
register DeviceIntPtr dev, next;
- for (dev = inputInfo.off_devices; dev; dev = dev->next)
- dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
+ for (dev = inputInfo.off_devices; dev; dev = dev->next) {
+ DebugF("(dix) initialising device %d\n", dev->id);
+ ActivateDevice(dev);
+ }
for (dev = inputInfo.off_devices; dev; dev = next)
{
+ DebugF("(dix) enabling device %d\n", dev->id);
next = dev->next;
if (dev->inited && dev->startup)
(void)EnableDevice(dev);
@@ -179,7 +392,6 @@ InitAndStartDevices()
for (dev = inputInfo.devices;
dev && (dev != inputInfo.keyboard);
dev = dev->next)
- ;
if (!dev || (dev != inputInfo.keyboard)) {
ErrorF("No core keyboard\n");
return BadImplementation;
@@ -207,9 +419,10 @@ CloseDevice(register DeviceIntPtr dev)
if (dev->inited)
(void)(*dev->deviceProc)(dev, DEVICE_CLOSE);
+
xfree(dev->name);
- if (dev->key)
- {
+
+ if (dev->key) {
#ifdef XKB
if (dev->key->xkbInfo)
XkbFreeInfo(dev->key->xkbInfo);
@@ -218,20 +431,27 @@ CloseDevice(register DeviceIntPtr dev)
xfree(dev->key->modifierKeyMap);
xfree(dev->key);
}
- xfree(dev->valuator);
+
+ if (dev->valuator)
+ xfree(dev->valuator);
+
+ if (dev->button) {
#ifdef XKB
- if ((dev->button)&&(dev->button->xkb_acts))
- xfree(dev->button->xkb_acts);
+ if (dev->button->xkb_acts)
+ xfree(dev->button->xkb_acts);
#endif
- xfree(dev->button);
- if (dev->focus)
- {
+ xfree(dev->button);
+ }
+
+ if (dev->focus) {
xfree(dev->focus->trace);
xfree(dev->focus);
}
- xfree(dev->proximity);
- for (k=dev->kbdfeed; k; k=knext)
- {
+
+ if (dev->proximity)
+ xfree(dev->proximity);
+
+ for (k = dev->kbdfeed; k; k = knext) {
knext = k->next;
#ifdef XKB
if (k->xkb_sli)
@@ -239,30 +459,30 @@ CloseDevice(register DeviceIntPtr dev)
#endif
xfree(k);
}
- for (p=dev->ptrfeed; p; p=pnext)
- {
+
+ for (p = dev->ptrfeed; p; p = pnext) {
pnext = p->next;
xfree(p);
}
- for (i=dev->intfeed; i; i=inext)
- {
+
+ for (i = dev->intfeed; i; i = inext) {
inext = i->next;
xfree(i);
}
- for (s=dev->stringfeed; s; s=snext)
- {
+
+ for (s = dev->stringfeed; s; s = snext) {
snext = s->next;
xfree(s->ctrl.symbols_supported);
xfree(s->ctrl.symbols_displayed);
xfree(s);
}
- for (b=dev->bell; b; b=bnext)
- {
+
+ for (b = dev->bell; b; b = bnext) {
bnext = b->next;
xfree(b);
}
- for (l=dev->leds; l; l=lnext)
- {
+
+ for (l = dev->leds; l; l = lnext) {
lnext = l->next;
#ifdef XKB
if (l->xkb_sli)
@@ -270,11 +490,12 @@ CloseDevice(register DeviceIntPtr dev)
#endif
xfree(l);
}
+
#ifdef XKB
- while (dev->xkb_interest) {
+ while (dev->xkb_interest)
XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
- }
#endif
+
xfree(dev->sync.event);
xfree(dev);
}
@@ -300,48 +521,60 @@ CloseDownDevices()
inputInfo.pointer = NULL;
}
-void
-RemoveDevice(register DeviceIntPtr dev)
+int
+RemoveDevice(DeviceIntPtr dev)
{
- register DeviceIntPtr prev,tmp,next;
+ DeviceIntPtr prev,tmp,next;
+ int ret = BadMatch;
+ devicePresenceNotify ev;
+ DeviceIntRec dummyDev;
+
+ DebugF("(dix) removing device %d\n", dev->id);
- prev= NULL;
- for (tmp= inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
+ if (!dev || dev == inputInfo.keyboard || dev == inputInfo.pointer)
+ return BadImplementation;
+
+ prev = NULL;
+ for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
next = tmp->next;
- if (tmp==dev) {
+ if (tmp == dev) {
CloseDevice(tmp);
+
if (prev==NULL)
inputInfo.devices = next;
else
prev->next = next;
- inputInfo.numDevices--;
- if (inputInfo.keyboard == tmp)
- inputInfo.keyboard = NULL;
- else if (inputInfo.pointer == tmp)
- inputInfo.pointer = NULL;
- return;
+
+ ret = Success;
}
}
- prev= NULL;
- for (tmp= inputInfo.off_devices; tmp; (prev = tmp), (tmp = next)) {
+ prev = NULL;
+ for (tmp = inputInfo.off_devices; tmp; (prev = tmp), (tmp = next)) {
next = tmp->next;
- if (tmp==dev) {
+ if (tmp == dev) {
CloseDevice(tmp);
- if (prev==NULL)
+
+ if (prev == NULL)
inputInfo.off_devices = next;
else
prev->next = next;
- inputInfo.numDevices--;
- if (inputInfo.keyboard == tmp)
- inputInfo.keyboard = NULL;
- else if (inputInfo.pointer == tmp)
- inputInfo.pointer = NULL;
- return;
+
+ ret = Success;
}
}
- ErrorF("Internal Error! Attempt to remove a non-existent device\n");
- return;
+
+ if (ret == Success) {
+ ev.type = DevicePresenceNotify;
+ ev.time = currentTime.milliseconds;
+ ev.devchange = 0;
+ ev.deviceid = 0;
+ dummyDev.id = 0;
+ SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
+ (xEvent *) &ev, 1);
+ }
+
+ return ret;
}
int
@@ -353,47 +586,13 @@ NumMotionEvents()
void
RegisterPointerDevice(DeviceIntPtr device)
{
- inputInfo.pointer = device;
-#ifdef XKB
- device->public.processInputProc = CoreProcessPointerEvent;
- device->public.realInputProc = CoreProcessPointerEvent;
- if (!noXkbExtension)
- XkbSetExtension(device,ProcessPointerEvent);
-#else
- device->public.processInputProc = ProcessPointerEvent;
- device->public.realInputProc = ProcessPointerEvent;
-#endif
- device->ActivateGrab = ActivatePointerGrab;
- device->DeactivateGrab = DeactivatePointerGrab;
- if (!device->name)
- {
- char *p = "pointer";
- device->name = (char *)xalloc(strlen(p) + 1);
- strcpy(device->name, p);
- }
+ RegisterOtherDevice(device);
}
void
RegisterKeyboardDevice(DeviceIntPtr device)
{
- inputInfo.keyboard = device;
-#ifdef XKB
- device->public.processInputProc = CoreProcessKeyboardEvent;
- device->public.realInputProc = CoreProcessKeyboardEvent;
- if (!noXkbExtension)
- XkbSetExtension(device,ProcessKeyboardEvent);
-#else
- device->public.processInputProc = ProcessKeyboardEvent;
- device->public.realInputProc = ProcessKeyboardEvent;
-#endif
- device->ActivateGrab = ActivateKeyboardGrab;
- device->DeactivateGrab = DeactivateKeyboardGrab;
- if (!device->name)
- {
- char *k = "keyboard";
- device->name = (char *)xalloc(strlen(k) + 1);
- strcpy(device->name, k);
- }
+ RegisterOtherDevice(device);
}
_X_EXPORT DevicePtr
@@ -438,8 +637,8 @@ SetKeySymsMap(register KeySymsPtr dst, register KeySymsPtr src)
{
int i, j;
int rowDif = src->minKeyCode - dst->minKeyCode;
- /* if keysym map size changes, grow map first */
+ /* if keysym map size changes, grow map first */
if (src->mapWidth < dst->mapWidth)
{
for (i = src->minKeyCode; i <= src->maxKeyCode; i++)
@@ -529,7 +728,7 @@ InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers
{
int i;
register KeyClassPtr keyc;
-
+
keyc = (KeyClassPtr)xalloc(sizeof(KeyClassRec));
if (!keyc)
return FALSE;
@@ -594,21 +793,70 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
int i;
register ValuatorClassPtr valc;
+ if (!dev)
+ return FALSE;
+
valc = (ValuatorClassPtr)xalloc(sizeof(ValuatorClassRec) +
numAxes * sizeof(AxisInfo) +
numAxes * sizeof(unsigned int));
if (!valc)
return FALSE;
+
+ valc->motion = NULL;
+ valc->first_motion = 0;
+ valc->last_motion = 0;
valc->GetMotionProc = motionProc;
+
valc->numMotionEvents = numMotionEvents;
valc->motionHintWindow = NullWindow;
valc->numAxes = numAxes;
valc->mode = mode;
valc->axes = (AxisInfoPtr)(valc + 1);
valc->axisVal = (int *)(valc->axes + numAxes);
- for (i=0; i<numAxes; i++)
- valc->axisVal[i]=0;
+ valc->lastx = 0;
+ valc->lasty = 0;
+ valc->dxremaind = 0;
+ valc->dyremaind = 0;
dev->valuator = valc;
+
+ /* biggest hack ever. */
+ if (motionProc == GetMotionHistory)
+ AllocateMotionHistory(dev);
+
+ for (i=0; i<numAxes; i++) {
+ InitValuatorAxisStruct(dev, i, 0, -1, 0, 0, 0);
+ valc->axisVal[i]=0;
+ }
+ return TRUE;
+}
+
+_X_EXPORT Bool
+InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
+{
+ register AbsoluteClassPtr abs;
+
+ abs = (AbsoluteClassPtr)xalloc(sizeof(AbsoluteClassRec));
+ if (!abs)
+ return FALSE;
+
+ /* we don't do anything sensible with these, but should */
+ abs->min_x = -1;
+ abs->min_y = -1;
+ abs->max_x = -1;
+ abs->max_y = -1;
+ abs->flip_x = 0;
+ abs->flip_y = 0;
+ abs->rotation = 0;
+ abs->button_threshold = 0;
+
+ abs->offset_x = 0;
+ abs->offset_y = 0;
+ abs->width = -1;
+ abs->height = -1;
+ abs->following = 0;
+
+ dev->absolute = abs;
+
return TRUE;
}
@@ -795,12 +1043,13 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
_X_EXPORT Bool
InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons,
ValuatorMotionProcPtr motionProc,
- PtrCtrlProcPtr controlProc, int numMotionEvents)
+ PtrCtrlProcPtr controlProc, int numMotionEvents,
+ int numAxes)
{
DeviceIntPtr dev = (DeviceIntPtr)device;
return(InitButtonClassDeviceStruct(dev, numButtons, map) &&
- InitValuatorClassDeviceStruct(dev, 2, motionProc,
+ InitValuatorClassDeviceStruct(dev, numAxes, motionProc,
numMotionEvents, 0) &&
InitPtrFeedbackClassDeviceStruct(dev, controlProc));
}
@@ -909,112 +1158,101 @@ AllModifierKeysAreUp(dev, map1, per1, map2, per2)
return TRUE;
}
+static int
+DoSetModifierMapping(ClientPtr client, KeyCode *inputMap,
+ int numKeyPerModifier)
+{
+ DeviceIntPtr pDev = NULL;
+ int i = 0, inputMapLen = numKeyPerModifier * 8;
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ for (i = 0; i < inputMapLen; i++) {
+ /* Check that all the new modifiers fall within the advertised
+ * keycode range, and are okay with the DDX. */
+ if (inputMap[i] && ((inputMap[i] < pDev->key->curKeySyms.minKeyCode ||
+ inputMap[i] > pDev->key->curKeySyms.maxKeyCode) ||
+ !LegalModifier(inputMap[i], pDev))) {
+ client->errorValue = inputMap[i];
+ return BadValue;
+ }
+ }
+
+#ifdef XACE
+ if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE))
+ return BadAccess;
+#endif
+
+ /* None of the modifiers (old or new) may be down while we change
+ * the map. */
+ if (!AllModifierKeysAreUp(pDev, pDev->key->modifierKeyMap,
+ pDev->key->maxKeysPerModifier,
+ inputMap, numKeyPerModifier) ||
+ !AllModifierKeysAreUp(pDev, inputMap, numKeyPerModifier,
+ pDev->key->modifierKeyMap,
+ pDev->key->maxKeysPerModifier)) {
+ return MappingBusy;
+ }
+ }
+ }
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ bzero(pDev->key->modifierMap, MAP_LENGTH);
+
+ /* Annoyingly, we lack a modifierKeyMap size, so we have to just free
+ * and re-alloc it every time. */
+ if (pDev->key->modifierKeyMap)
+ xfree(pDev->key->modifierKeyMap);
+
+ if (inputMapLen) {
+ pDev->key->modifierKeyMap = (KeyCode *) xalloc(inputMapLen);
+ if (!pDev->key->modifierKeyMap)
+ return BadAlloc;
+
+ memcpy(pDev->key->modifierKeyMap, inputMap, inputMapLen);
+ pDev->key->maxKeysPerModifier = numKeyPerModifier;
+
+ for (i = 0; i < inputMapLen; i++) {
+ if (inputMap[i]) {
+ pDev->key->modifierMap[inputMap[i]] |=
+ (1 << (((unsigned int)i) / numKeyPerModifier));
+ }
+ }
+ }
+ else {
+ pDev->key->modifierKeyMap = NULL;
+ }
+ }
+ }
+
+ return Success;
+}
+
int
ProcSetModifierMapping(ClientPtr client)
{
xSetModifierMappingReply rep;
REQUEST(xSetModifierMappingReq);
- KeyCode *inputMap;
- int inputMapLen;
- register int i;
- DeviceIntPtr keybd = inputInfo.keyboard;
- register KeyClassPtr keyc = keybd->key;
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
- if (client->req_len != ((stuff->numKeyPerModifier<<1) +
- (sizeof (xSetModifierMappingReq)>>2)))
+ if (client->req_len != ((stuff->numKeyPerModifier << 1) +
+ (sizeof (xSetModifierMappingReq) >> 2)))
return BadLength;
- inputMapLen = 8*stuff->numKeyPerModifier;
- inputMap = (KeyCode *)&stuff[1];
-
- /*
- * Now enforce the restriction that "all of the non-zero keycodes must be
- * in the range specified by min-keycode and max-keycode in the
- * connection setup (else a Value error)"
- */
- i = inputMapLen;
- while (i--)
- {
- if (inputMap[i]
- && (inputMap[i] < keyc->curKeySyms.minKeyCode
- || inputMap[i] > keyc->curKeySyms.maxKeyCode))
- {
- client->errorValue = inputMap[i];
- return BadValue;
- }
- }
-
-#ifdef XACE
- if (!XaceHook(XACE_DEVICE_ACCESS, client, keybd, TRUE))
- return BadAccess;
-#endif
-
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.success = MappingSuccess;
-
- /*
- * Now enforce the restriction that none of the old or new
- * modifier keys may be down while we change the mapping, and
- * that the DDX layer likes the choice.
- */
- if (!AllModifierKeysAreUp(keybd, keyc->modifierKeyMap,
- (int)keyc->maxKeysPerModifier,
- inputMap, (int)stuff->numKeyPerModifier)
- ||
- !AllModifierKeysAreUp(keybd, inputMap, (int)stuff->numKeyPerModifier,
- keyc->modifierKeyMap,
- (int)keyc->maxKeysPerModifier))
- {
- rep.success = MappingBusy;
- }
- else
- {
- for (i = 0; i < inputMapLen; i++)
- {
- if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr)keybd))
- {
- rep.success = MappingFailed;
- break;
- }
- }
- }
-
- if (rep.success == MappingSuccess)
- {
- KeyCode *map;
- /*
- * Now build the keyboard's modifier bitmap from the
- * list of keycodes.
- */
- map = (KeyCode *)xalloc(inputMapLen);
- if (!map && inputMapLen)
- return BadAlloc;
- if (keyc->modifierKeyMap)
- xfree(keyc->modifierKeyMap);
- keyc->modifierKeyMap = map;
- memmove((char *)map, (char *)inputMap, inputMapLen);
-
- keyc->maxKeysPerModifier = stuff->numKeyPerModifier;
- for (i = 0; i < MAP_LENGTH; i++)
- keyc->modifierMap[i] = 0;
- for (i = 0; i < inputMapLen; i++)
- {
- if (inputMap[i])
- keyc->modifierMap[inputMap[i]] |=
- (1<<(((unsigned int)i)/keyc->maxKeysPerModifier));
- }
- }
- if (rep.success == MappingSuccess)
- SendMappingNotify(MappingModifier, 0, 0, client);
+ rep.success = DoSetModifierMapping(client, (KeyCode *)&stuff[1],
+ stuff->numKeyPerModifier);
+ /* FIXME: Send mapping notifies for all the extended devices as well. */
+ SendMappingNotify(MappingModifier, 0, 0, client);
WriteReplyToClient(client, sizeof(xSetModifierMappingReply), &rep);
-
- return(client->noClientException);
+ return client->noClientException;
}
int
@@ -1044,39 +1282,80 @@ ProcChangeKeyboardMapping(ClientPtr client)
REQUEST(xChangeKeyboardMappingReq);
unsigned len;
KeySymsRec keysyms;
- register KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
+ KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
+ DeviceIntPtr pDev = NULL;
REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
len = client->req_len - (sizeof(xChangeKeyboardMappingReq) >> 2);
if (len != (stuff->keyCodes * stuff->keySymsPerKeyCode))
return BadLength;
+
if ((stuff->firstKeyCode < curKeySyms->minKeyCode) ||
- (stuff->firstKeyCode > curKeySyms->maxKeyCode))
- {
+ (stuff->firstKeyCode > curKeySyms->maxKeyCode)) {
client->errorValue = stuff->firstKeyCode;
return BadValue;
+
}
- if ( ((unsigned)(stuff->firstKeyCode + stuff->keyCodes - 1) >
- curKeySyms->maxKeyCode) ||
- (stuff->keySymsPerKeyCode == 0))
- {
+ if (((unsigned)(stuff->firstKeyCode + stuff->keyCodes - 1) >
+ curKeySyms->maxKeyCode) || (stuff->keySymsPerKeyCode == 0)) {
client->errorValue = stuff->keySymsPerKeyCode;
return BadValue;
}
+
#ifdef XACE
- if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
- return BadAccess;
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE))
+ return BadAccess;
+ }
+ }
#endif
+
keysyms.minKeyCode = stuff->firstKeyCode;
keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1;
keysyms.mapWidth = stuff->keySymsPerKeyCode;
keysyms.map = (KeySym *)&stuff[1];
- if (!SetKeySymsMap(curKeySyms, &keysyms))
- return BadAlloc;
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
+ if (!SetKeySymsMap(&pDev->key->curKeySyms, &keysyms))
+ return BadAlloc;
+ }
+ }
+
+ /* FIXME: Send mapping notifies for all the extended devices as well. */
SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes,
- client);
+ client);
return client->noClientException;
+}
+static int
+DoSetPointerMapping(DeviceIntPtr device, BYTE *map, int n)
+{
+ int i = 0;
+ DeviceIntPtr dev = NULL;
+
+ if (!device || !device->button)
+ return BadDevice;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
+ for (i = 0; i < n; i++) {
+ if ((device->button->map[i + 1] != map[i]) &&
+ BitIsOn(device->button->down, i + 1)) {
+ return MappingBusy;
+ }
+ }
+ }
+ }
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
+ for (i = 0; i < n; i++)
+ dev->button->map[i + 1] = map[i];
+ }
+ }
+
+ return Success;
}
int
@@ -1084,9 +1363,8 @@ ProcSetPointerMapping(ClientPtr client)
{
REQUEST(xSetPointerMappingReq);
BYTE *map;
+ int ret;
xSetPointerMappingReply rep;
- register unsigned int i;
- DeviceIntPtr mouse = inputInfo.pointer;
REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq);
if (client->req_len != (sizeof(xSetPointerMappingReq)+stuff->nElts+3) >> 2)
@@ -1096,23 +1374,24 @@ ProcSetPointerMapping(ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.success = MappingSuccess;
map = (BYTE *)&stuff[1];
- if (stuff->nElts != mouse->button->numButtons)
- {
+
+ /* So we're bounded here by the number of core buttons. This check
+ * probably wants disabling through XFixes. */
+ if (stuff->nElts != inputInfo.pointer->button->numButtons) {
client->errorValue = stuff->nElts;
return BadValue;
}
if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue))
return BadValue;
- for (i=0; i < stuff->nElts; i++)
- if ((mouse->button->map[i + 1] != map[i]) &&
- BitIsOn(mouse->button->down, i + 1))
- {
- rep.success = MappingBusy;
- WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
- return Success;
- }
- for (i = 0; i < stuff->nElts; i++)
- mouse->button->map[i + 1] = map[i];
+
+ ret = DoSetPointerMapping(inputInfo.pointer, map, stuff->nElts);
+ if (ret != Success) {
+ rep.success = ret;
+ WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
+ return Success;
+ }
+
+ /* FIXME: Send mapping notifies for all the extended devices as well. */
SendMappingNotify(MappingPointer, 0, 0, client);
WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
return Success;
@@ -1128,14 +1407,12 @@ ProcGetKeyboardMapping(ClientPtr client)
REQUEST_SIZE_MATCH(xGetKeyboardMappingReq);
if ((stuff->firstKeyCode < curKeySyms->minKeyCode) ||
- (stuff->firstKeyCode > curKeySyms->maxKeyCode))
- {
+ (stuff->firstKeyCode > curKeySyms->maxKeyCode)) {
client->errorValue = stuff->firstKeyCode;
return BadValue;
}
if (stuff->firstKeyCode + stuff->count >
- (unsigned)(curKeySyms->maxKeyCode + 1))
- {
+ (unsigned)(curKeySyms->maxKeyCode + 1)) {
client->errorValue = stuff->count;
return BadValue;
}
@@ -1192,43 +1469,30 @@ Ones(unsigned long mask) /* HACKMEM 169 */
return (((y + (y >> 3)) & 030707070707) % 077);
}
-int
-ProcChangeKeyboardControl (ClientPtr client)
+static int
+DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist,
+ BITS32 vmask)
{
#define DO_ALL (-1)
KeybdCtrl ctrl;
- DeviceIntPtr keybd = inputInfo.keyboard;
- XID *vlist;
int t;
int led = DO_ALL;
int key = DO_ALL;
- BITS32 vmask, index2;
- int mask, i;
- REQUEST(xChangeKeyboardControlReq);
+ BITS32 index2;
+ int mask = vmask, i;
- REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
- vmask = stuff->mask;
- if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
- return BadLength;
-#ifdef XACE
- if (!XaceHook(XACE_DEVICE_ACCESS, client, keybd, TRUE))
- return BadAccess;
-#endif
- vlist = (XID *)&stuff[1]; /* first word of values */
ctrl = keybd->kbdfeed->ctrl;
- while (vmask)
- {
+ while (vmask) {
index2 = (BITS32) lowbit (vmask);
vmask &= ~index2;
- switch (index2)
- {
+ switch (index2) {
case KBKeyClickPercent:
t = (INT8)*vlist;
vlist++;
- if (t == -1)
+ if (t == -1) {
t = defaultKeyboardControl.click;
- else if (t < 0 || t > 100)
- {
+ }
+ else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
@@ -1237,10 +1501,10 @@ ProcChangeKeyboardControl (ClientPtr client)
case KBBellPercent:
t = (INT8)*vlist;
vlist++;
- if (t == -1)
+ if (t == -1) {
t = defaultKeyboardControl.bell;
- else if (t < 0 || t > 100)
- {
+ }
+ else if (t < 0 || t > 100) {
client->errorValue = t;
return BadValue;
}
@@ -1249,10 +1513,10 @@ ProcChangeKeyboardControl (ClientPtr client)
case KBBellPitch:
t = (INT16)*vlist;
vlist++;
- if (t == -1)
+ if (t == -1) {
t = defaultKeyboardControl.bell_pitch;
- else if (t < 0)
- {
+ }
+ else if (t < 0) {
client->errorValue = t;
return BadValue;
}
@@ -1263,8 +1527,7 @@ ProcChangeKeyboardControl (ClientPtr client)
vlist++;
if (t == -1)
t = defaultKeyboardControl.bell_duration;
- else if (t < 0)
- {
+ else if (t < 0) {
client->errorValue = t;
return BadValue;
}
@@ -1273,56 +1536,51 @@ ProcChangeKeyboardControl (ClientPtr client)
case KBLed:
led = (CARD8)*vlist;
vlist++;
- if (led < 1 || led > 32)
- {
+ if (led < 1 || led > 32) {
client->errorValue = led;
return BadValue;
}
- if (!(stuff->mask & KBLedMode))
+ if (!(mask & KBLedMode))
return BadMatch;
break;
case KBLedMode:
t = (CARD8)*vlist;
vlist++;
- if (t == LedModeOff)
- {
+ if (t == LedModeOff) {
if (led == DO_ALL)
ctrl.leds = 0x0;
else
ctrl.leds &= ~(((Leds)(1)) << (led - 1));
}
- else if (t == LedModeOn)
- {
+ else if (t == LedModeOn) {
if (led == DO_ALL)
ctrl.leds = ~0L;
else
ctrl.leds |= (((Leds)(1)) << (led - 1));
}
- else
- {
+ else {
client->errorValue = t;
return BadValue;
}
#ifdef XKB
- if (!noXkbExtension) {
- XkbEventCauseRec cause;
- XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client);
- XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))),
+ if (!noXkbExtension) {
+ XkbEventCauseRec cause;
+ XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client);
+ XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))),
ctrl.leds, &cause);
- ctrl.leds = keybd->kbdfeed->ctrl.leds;
- }
+ ctrl.leds = keybd->kbdfeed->ctrl.leds;
+ }
#endif
break;
case KBKey:
key = (KeyCode)*vlist;
vlist++;
if ((KeyCode)key < inputInfo.keyboard->key->curKeySyms.minKeyCode ||
- (KeyCode)key > inputInfo.keyboard->key->curKeySyms.maxKeyCode)
- {
+ (KeyCode)key > inputInfo.keyboard->key->curKeySyms.maxKeyCode) {
client->errorValue = key;
return BadValue;
}
- if (!(stuff->mask & KBAutoRepeatMode))
+ if (!(mask & KBAutoRepeatMode))
return BadMatch;
break;
case KBAutoRepeatMode:
@@ -1331,25 +1589,22 @@ ProcChangeKeyboardControl (ClientPtr client)
t = (CARD8)*vlist;
vlist++;
#ifdef XKB
- if (!noXkbExtension && key != DO_ALL)
- XkbDisableComputedAutoRepeats(keybd,key);
+ if (!noXkbExtension && key != DO_ALL)
+ XkbDisableComputedAutoRepeats(keybd,key);
#endif
- if (t == AutoRepeatModeOff)
- {
+ if (t == AutoRepeatModeOff) {
if (key == DO_ALL)
ctrl.autoRepeat = FALSE;
else
ctrl.autoRepeats[i] &= ~mask;
}
- else if (t == AutoRepeatModeOn)
- {
+ else if (t == AutoRepeatModeOn) {
if (key == DO_ALL)
ctrl.autoRepeat = TRUE;
else
ctrl.autoRepeats[i] |= mask;
}
- else if (t == AutoRepeatModeDefault)
- {
+ else if (t == AutoRepeatModeDefault) {
if (key == DO_ALL)
ctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
else
@@ -1357,32 +1612,72 @@ ProcChangeKeyboardControl (ClientPtr client)
(ctrl.autoRepeats[i] & ~mask) |
(defaultKeyboardControl.autoRepeats[i] & mask);
}
- else
- {
+ else {
client->errorValue = t;
return BadValue;
}
break;
default:
- client->errorValue = stuff->mask;
+ client->errorValue = mask;
return BadValue;
}
}
keybd->kbdfeed->ctrl = ctrl;
+
#ifdef XKB
/* The XKB RepeatKeys control and core protocol global autorepeat */
/* value are linked */
- if (!noXkbExtension) {
- XkbSetRepeatKeys(keybd,key,keybd->kbdfeed->ctrl.autoRepeat);
- }
+ if (!noXkbExtension)
+ XkbSetRepeatKeys(keybd, key, keybd->kbdfeed->ctrl.autoRepeat);
else
#endif
- (*keybd->kbdfeed->CtrlProc)(keybd, &keybd->kbdfeed->ctrl);
+ (*keybd->kbdfeed->CtrlProc)(keybd, &keybd->kbdfeed->ctrl);
+
return Success;
+
#undef DO_ALL
}
int
+ProcChangeKeyboardControl (ClientPtr client)
+{
+ XID *vlist;
+ BITS32 vmask;
+ int ret = Success, error = Success;
+ DeviceIntPtr pDev = NULL;
+ REQUEST(xChangeKeyboardControlReq);
+
+ REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
+
+ vmask = stuff->mask;
+ vlist = (XID *)&stuff[1];
+
+ if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
+ return BadLength;
+
+#ifdef XACE
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
+ pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+ if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE))
+ return BadAccess;
+ }
+ }
+#endif
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
+ if ((pDev->coreEvents || pDev == inputInfo.keyboard) &&
+ pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
+ ret = DoChangeKeyboardControl(client, pDev, vlist, vmask);
+ if (ret != Success)
+ error = ret;
+ }
+ }
+
+ return error;
+}
+
+int
ProcGetKeyboardControl (ClientPtr client)
{
int i;
@@ -1413,24 +1708,35 @@ ProcBell(ClientPtr client)
int newpercent;
REQUEST(xBellReq);
REQUEST_SIZE_MATCH(xBellReq);
- if (stuff->percent < -100 || stuff->percent > 100)
- {
+
+ if (!keybd->kbdfeed->BellProc)
+ return BadDevice;
+
+ if (stuff->percent < -100 || stuff->percent > 100) {
client->errorValue = stuff->percent;
return BadValue;
}
+
newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0)
newpercent = base + newpercent;
else
newpercent = base - newpercent + stuff->percent;
+
+ for (keybd = inputInfo.devices; keybd; keybd = keybd->next) {
+ if ((keybd->coreEvents || keybd == inputInfo.keyboard) &&
+ keybd->kbdfeed && keybd->kbdfeed->BellProc) {
#ifdef XKB
- if (!noXkbExtension)
- XkbHandleBell(FALSE,FALSE, keybd, newpercent, &keybd->kbdfeed->ctrl, 0,
- None, NULL, client);
- else
+ if (!noXkbExtension)
+ XkbHandleBell(FALSE, FALSE, keybd, newpercent,
+ &keybd->kbdfeed->ctrl, 0, None, NULL, client);
+ else
#endif
- (*keybd->kbdfeed->BellProc)(newpercent, keybd,
- (pointer) &keybd->kbdfeed->ctrl, 0);
+ (*keybd->kbdfeed->BellProc)(newpercent, keybd,
+ &keybd->kbdfeed->ctrl, 0);
+ }
+ }
+
return Success;
}
@@ -1442,49 +1748,64 @@ ProcChangePointerControl(ClientPtr client)
REQUEST(xChangePointerControlReq);
REQUEST_SIZE_MATCH(xChangePointerControlReq);
+
+ if (!mouse->ptrfeed->CtrlProc)
+ return BadDevice;
+
ctrl = mouse->ptrfeed->ctrl;
- if ((stuff->doAccel != xTrue) && (stuff->doAccel != xFalse))
- {
+ if ((stuff->doAccel != xTrue) && (stuff->doAccel != xFalse)) {
client->errorValue = stuff->doAccel;
return(BadValue);
}
- if ((stuff->doThresh != xTrue) && (stuff->doThresh != xFalse))
- {
+ if ((stuff->doThresh != xTrue) && (stuff->doThresh != xFalse)) {
client->errorValue = stuff->doThresh;
return(BadValue);
}
- if (stuff->doAccel)
- {
- if (stuff->accelNum == -1)
+ if (stuff->doAccel) {
+ if (stuff->accelNum == -1) {
ctrl.num = defaultPointerControl.num;
- else if (stuff->accelNum < 0)
- {
+ }
+ else if (stuff->accelNum < 0) {
client->errorValue = stuff->accelNum;
return BadValue;
}
- else ctrl.num = stuff->accelNum;
- if (stuff->accelDenum == -1)
+ else {
+ ctrl.num = stuff->accelNum;
+ }
+
+ if (stuff->accelDenum == -1) {
ctrl.den = defaultPointerControl.den;
- else if (stuff->accelDenum <= 0)
- {
+ }
+ else if (stuff->accelDenum <= 0) {
client->errorValue = stuff->accelDenum;
return BadValue;
}
- else ctrl.den = stuff->accelDenum;
+ else {
+ ctrl.den = stuff->accelDenum;
+ }
}
- if (stuff->doThresh)
- {
- if (stuff->threshold == -1)
+ if (stuff->doThresh) {
+ if (stuff->threshold == -1) {
ctrl.threshold = defaultPointerControl.threshold;
- else if (stuff->threshold < 0)
- {
+ }
+ else if (stuff->threshold < 0) {
client->errorValue = stuff->threshold;
return BadValue;
}
- else ctrl.threshold = stuff->threshold;
+ else {
+ ctrl.threshold = stuff->threshold;
+ }
}
- mouse->ptrfeed->ctrl = ctrl;
- (*mouse->ptrfeed->CtrlProc)(mouse, &mouse->ptrfeed->ctrl);
+
+
+ for (mouse = inputInfo.devices; mouse; mouse = mouse->next) {
+ if ((mouse->coreEvents || mouse == inputInfo.pointer) &&
+ mouse->ptrfeed && mouse->ptrfeed->CtrlProc) {
+ mouse->ptrfeed->ctrl = ctrl;
+ (*mouse->ptrfeed->CtrlProc)(mouse, &mouse->ptrfeed->ctrl);
+ }
+ }
+
return Success;
}
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 7c4d539fa..2e7fa79ab 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -74,6 +74,36 @@ Equipment Corporation.
******************************************************************/
+/* XSERVER_DTRACE additions:
+ * Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -100,6 +130,7 @@ int ProcInitialConnection();
#include "dispatch.h"
#include "swaprep.h"
#include "swapreq.h"
+#include "config.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@@ -118,6 +149,17 @@ int ProcInitialConnection();
#include <X11/extensions/XKBsrv.h>
#endif
+#ifdef XSERVER_DTRACE
+#include <sys/types.h>
+typedef const char *string;
+#include "Xserver-dtrace.h"
+
+char *RequestNames[256];
+static void LoadRequestNames(void);
+static void FreeRequestNames(void);
+#define GetRequestName(i) (RequestNames[i])
+#endif
+
#define mskcnt ((MAXCLIENTS + 31) / 32)
#define BITMASK(i) (1U << ((i) & 31))
#define MASKIDX(i) ((i) >> 5)
@@ -372,6 +414,10 @@ Dispatch(void)
if (!clientReady)
return;
+#ifdef XSERVER_DTRACE
+ LoadRequestNames();
+#endif
+
while (!dispatchException)
{
if (*icheck[0] != *icheck[1])
@@ -382,6 +428,9 @@ Dispatch(void)
nready = WaitForSomething(clientReady);
+ /* this is an enormous hack and NEEDS TO GO AWAY. */
+ configDispatch();
+
#ifdef SMART_SCHEDULE
if (nready && !SmartScheduleDisable)
{
@@ -448,6 +497,11 @@ Dispatch(void)
client->requestLog[client->requestLogIndex] = MAJOROP;
client->requestLogIndex++;
#endif
+#ifdef XSERVER_DTRACE
+ XSERVER_REQUEST_START(GetRequestName(MAJOROP), MAJOROP,
+ ((xReq *)client->requestBuffer)->length,
+ client->index, client->requestBuffer);
+#endif
if (result > (maxBigRequestSize << 2))
result = BadLength;
else
@@ -460,7 +514,11 @@ Dispatch(void)
#else
result = (* client->requestVector[MAJOROP])(client);
#endif /* XACE */
-
+#ifdef XSERVER_DTRACE
+ XSERVER_REQUEST_DONE(GetRequestName(MAJOROP), MAJOROP,
+ client->sequence, client->index, result);
+#endif
+
if (result != Success)
{
if (client->noClientException != Success)
@@ -491,6 +549,9 @@ Dispatch(void)
KillAllClients();
DEALLOCATE_LOCAL(clientReady);
dispatchException &= ~DE_RESET;
+#ifdef XSERVER_DTRACE
+ FreeRequestNames();
+#endif
}
#undef MAJOROP
@@ -3565,6 +3626,9 @@ CloseDownClient(register ClientPtr client)
CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
}
FreeClientResources(client);
+#ifdef XSERVER_DTRACE
+ XSERVER_CLIENT_DISCONNECT(client->index);
+#endif
if (client->index < nextFreeClientID)
nextFreeClientID = client->index;
clients[client->index] = NullClient;
@@ -3991,3 +4055,60 @@ MarkClientException(ClientPtr client)
{
client->noClientException = -1;
}
+
+#ifdef XSERVER_DTRACE
+#include <ctype.h>
+
+/* Load table of request names for dtrace probes */
+static void LoadRequestNames(void)
+{
+ int i;
+ FILE *xedb;
+ extern void LoadExtensionNames(char **RequestNames);
+
+ bzero(RequestNames, 256 * sizeof(char *));
+
+ xedb = fopen(XERRORDB_PATH, "r");
+ if (xedb != NULL) {
+ char buf[256];
+ while (fgets(buf, sizeof(buf), xedb)) {
+ if ((strncmp("XRequest.", buf, 9) == 0) && (isdigit(buf[9]))) {
+ char *name;
+ i = strtol(buf + 9, &name, 10);
+ if (RequestNames[i] == 0) {
+ char *end = strchr(name, '\n');
+ if (end) { *end = '\0'; }
+ RequestNames[i] = strdup(name + 1);
+ }
+ }
+ }
+ fclose(xedb);
+ }
+
+ LoadExtensionNames(RequestNames);
+
+ for (i = 0; i < 256; i++) {
+ if (RequestNames[i] == 0) {
+#define RN_SIZE 12 /* "Request#' + up to 3 digits + \0 */
+ RequestNames[i] = xalloc(RN_SIZE);
+ if (RequestNames[i]) {
+ snprintf(RequestNames[i], RN_SIZE, "Request#%d", i);
+ }
+ }
+ /* fprintf(stderr, "%d: %s\n", i, RequestNames[i]); */
+ }
+}
+
+static void FreeRequestNames(void)
+{
+ int i;
+
+ for (i = 0; i < 256; i++) {
+ if (RequestNames[i] != 0) {
+ free(RequestNames[i]);
+ RequestNames[i] = 0;
+ }
+ }
+}
+
+#endif
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index f10011e4b..7e2ed5058 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -155,11 +155,6 @@ QueueFontWakeup(FontPathElementPtr fpe)
for (i = 0; i < num_slept_fpes; i++) {
if (slept_fpes[i] == fpe) {
-
-#ifdef DEBUG
- fprintf(stderr, "re-queueing fpe wakeup\n");
-#endif
-
return;
}
}
@@ -1886,7 +1881,7 @@ InitFonts ()
{
patternCache = MakeFontPatternCache();
-#ifndef KDRIVESERVER
+#ifndef BUILTIN_FONTS
if (screenInfo.numScreens > screenInfo.numVideoScreens) {
PrinterFontRegisterFpeFunctions();
FontFileCheckRegisterFpeFunctions();
@@ -1894,10 +1889,11 @@ InitFonts ()
} else
#endif
{
-#ifdef KDRIVESERVER
- BuiltinRegisterFpeFunctions();
-#endif
+#ifdef BUILTIN_FONTS
+ BuiltinRegisterFpeFunctions();
+#else
FontFileRegisterFpeFunctions();
+#endif
#ifndef NOFONTSERVERACCESS
fs_register_fpe_functions();
#endif
@@ -2059,11 +2055,6 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
fs_handlers_installed = 0;
}
if (fs_handlers_installed == 0) {
-
-#ifdef DEBUG
- fprintf(stderr, "adding FS b & w handlers\n");
-#endif
-
if (!RegisterBlockAndWakeupHandlers(block_handler,
FontWakeup, (pointer) 0))
return AllocError;
@@ -2079,55 +2070,9 @@ remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, Bo
if (all) {
/* remove the handlers if no one else is using them */
if (--fs_handlers_installed == 0) {
-
-#ifdef DEBUG
- fprintf(stderr, "removing FS b & w handlers\n");
-#endif
-
RemoveBlockAndWakeupHandlers(block_handler, FontWakeup,
(pointer) 0);
}
}
RemoveFontWakeup(fpe);
}
-
-#ifdef DEBUG
-#define GLWIDTHBYTESPADDED(bits,nbytes) \
- ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \
- :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \
- :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \
- :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \
- : 0)
-
-#define GLYPH_SIZE(ch, nbytes) \
- GLWIDTHBYTESPADDED((ch)->metrics.rightSideBearing - \
- (ch)->metrics.leftSideBearing, (nbytes))
-void
-dump_char_ascii(CharInfoPtr cip)
-{
- int r,
- l;
- int bpr;
- int byte;
- static unsigned maskTab[] = {
- (1 << 7), (1 << 6), (1 << 5), (1 << 4),
- (1 << 3), (1 << 2), (1 << 1), (1 << 0),
- };
-
- bpr = GLYPH_SIZE(cip, 4);
- for (r = 0; r < (cip->metrics.ascent + cip->metrics.descent); r++) {
- pointer row = (pointer) cip->bits + r * bpr;
-
- byte = 0;
- for (l = 0; l <= (cip->metrics.rightSideBearing -
- cip->metrics.leftSideBearing); l++) {
- if (maskTab[l & 7] & row[l >> 3])
- putchar('X');
- else
- putchar('.');
- }
- putchar('\n');
- }
-}
-
-#endif
diff --git a/dix/events.c b/dix/events.c
index c57a30ed8..3b1a0aaf4 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -113,6 +113,7 @@ of the copyright holder.
#endif
#include <X11/X.h>
+#include <X11/keysym.h>
#include "misc.h"
#include "resource.h"
#define NEED_EVENTS
@@ -131,6 +132,7 @@ of the copyright holder.
#include "globals.h"
#ifdef XKB
+#include <X11/extensions/XKBproto.h>
#include <X11/extensions/XKBsrv.h>
extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
#endif
@@ -139,6 +141,12 @@ extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
#include "xace.h"
#endif
+#ifdef XSERVER_DTRACE
+#include <sys/types.h>
+typedef const char *string;
+#include "Xserver-dtrace.h"
+#endif
+
#ifdef XEVIE
extern WindowPtr *WindowTable;
extern int xevieFlag;
@@ -154,7 +162,9 @@ xEvent *xeviexE;
#endif
#include <X11/extensions/XIproto.h>
+#include "exglobals.h"
#include "exevents.h"
+#include "exglobals.h"
#include "extnsionst.h"
#include "dixevents.h"
@@ -206,9 +216,6 @@ _X_EXPORT CallbackListPtr DeviceEventCallback;
Mask DontPropagateMasks[DNPMCOUNT];
static int DontPropagateRefCnts[DNPMCOUNT];
-#ifdef DEBUG
-static debug_events = 0;
-#endif
_X_EXPORT InputInfo inputInfo;
static struct {
@@ -319,11 +326,16 @@ static CARD8 criticalEvents[32] =
};
#ifdef PANORAMIX
-
static void ConfineToShape(RegionPtr shape, int *px, int *py);
-static void SyntheticMotion(int x, int y);
+extern void PostSyntheticMotion(int x, int y, int screenNum, int time);
static void PostNewCursor(void);
+#define SyntheticMotion(x, y) \
+ PostSyntheticMotion(x, y, sprite.screen->myNum, \
+ syncEvents.playingEvents ? \
+ syncEvents.time.milliseconds : \
+ currentTime.milliseconds);
+
static Bool
XineramaSetCursorPosition(
int x,
@@ -666,30 +678,6 @@ SetCriticalEvent(int event)
criticalEvents[event >> 3] |= 1 << (event & 7);
}
-static void
-SyntheticMotion(int x, int y)
-{
- xEvent xE;
-
-#ifdef PANORAMIX
- /* Translate back to the sprite screen since processInputProc
- will translate from sprite screen to screen 0 upon reentry
- to the DIX layer */
- if(!noPanoramiXExtension) {
- x += panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x;
- y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y;
- }
-#endif
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
- if (syncEvents.playingEvents)
- xE.u.keyButtonPointer.time = syncEvents.time.milliseconds;
- else
- xE.u.keyButtonPointer.time = currentTime.milliseconds;
- xE.u.u.type = MotionNotify;
- (*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
-}
-
#ifdef SHAPE
static void
ConfineToShape(RegionPtr shape, int *px, int *py)
@@ -1531,9 +1519,8 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
int i;
int type;
-#ifdef DEBUG
- if (debug_events) ErrorF(
- "Event([%d, %d], mask=0x%x), client=%d",
+#ifdef DEBUG_EVENTS
+ ErrorF("Event([%d, %d], mask=0x%x), client=%d",
pEvents->u.u.type, pEvents->u.u.detail, mask, client->index);
#endif
if ((client) && (client != serverClient) && (!client->clientGone) &&
@@ -1549,9 +1536,9 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
if (WID(inputInfo.pointer->valuator->motionHintWindow) ==
pEvents->u.keyButtonPointer.event)
{
-#ifdef DEBUG
- if (debug_events) ErrorF("\n");
- fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n");
+#ifdef DEBUG_EVENTS
+ ErrorF("\n");
+ ErrorF("motionHintWindow == keyButtonPointer.event\n");
#endif
return 1; /* don't send, but pretend we did */
}
@@ -1589,15 +1576,15 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
}
WriteEventsToClient(client, count, pEvents);
-#ifdef DEBUG
- if (debug_events) ErrorF( " delivered\n");
+#ifdef DEBUG_EVENTS
+ ErrorF( " delivered\n");
#endif
return 1;
}
else
{
-#ifdef DEBUG
- if (debug_events) ErrorF("\n");
+#ifdef DEBUG_EVENTS
+ ErrorF("\n");
#endif
return 0;
}
@@ -2776,13 +2763,6 @@ drawable.id:0;
}
#endif
-#ifdef DEBUG
- if ((xkbDebugFlags&0x4)&&
- ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
- ErrorF("CoreProcessKbdEvent: Key %d %s\n",key,
- (xE->u.u.type==KeyPress?"down":"up"));
- }
-#endif
switch (xE->u.u.type)
{
case KeyPress:
@@ -2867,13 +2847,12 @@ FixKeyState (register xEvent *xE, register DeviceIntPtr keybd)
key = xE->u.u.detail;
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
-#ifdef DEBUG
- if ((xkbDebugFlags&0x4)&&
- ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
- ErrorF("FixKeyState: Key %d %s\n",key,
+
+ if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
+ DebugF("FixKeyState: Key %d %s\n",key,
(xE->u.u.type==KeyPress?"down":"up"));
}
-#endif
+
switch (xE->u.u.type)
{
case KeyPress:
@@ -4580,6 +4559,14 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
eventinfo.count = count;
CallCallbacks(&EventCallback, (pointer)&eventinfo);
}
+#ifdef XSERVER_DTRACE
+ if (XSERVER_SEND_EVENT_ENABLED()) {
+ for (i = 0; i < count; i++)
+ {
+ XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]);
+ }
+ }
+#endif
if(pClient->swapped)
{
for(i = 0; i < count; i++)
diff --git a/dix/extension.c b/dix/extension.c
index f58c73138..fe779b2be 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -482,3 +482,17 @@ RegisterScreenProc(char *name, ScreenPtr pScreen, ExtensionLookupProc proc)
}
return TRUE;
}
+
+#ifdef XSERVER_DTRACE
+void LoadExtensionNames(char **RequestNames) {
+ int i;
+
+ for (i=0; i<NumExtensions; i++) {
+ int r = extensions[i]->base;
+
+ if (RequestNames[r] == NULL) {
+ RequestNames[r] = strdup(extensions[i]->name);
+ }
+ }
+}
+#endif
diff --git a/dix/getevents.c b/dix/getevents.c
new file mode 100644
index 000000000..b19a73fa6
--- /dev/null
+++ b/dix/getevents.c
@@ -0,0 +1,781 @@
+/*
+ * Copyright © 2006 Nokia Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that this copyright notice and this permission notice appear in
+ * supporting electronic documentation.
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR AUTHORS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/keysym.h>
+#include "misc.h"
+#include "resource.h"
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include <X11/Xproto.h>
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "cursorstr.h"
+
+#include "dixstruct.h"
+#include "globals.h"
+
+#include "mipointer.h"
+
+#ifdef XKB
+#include <X11/extensions/XKBproto.h>
+#include <X11/extensions/XKBsrv.h>
+extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
+#endif
+
+#ifdef XACE
+#include "xace.h"
+#endif
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "exglobals.h"
+#include "exevents.h"
+#include "exglobals.h"
+#include "extnsionst.h"
+
+/* Maximum number of valuators, divided by six, rounded up. */
+#define MAX_VALUATOR_EVENTS 6
+
+/* Number of motion history events to store. */
+#define MOTION_HISTORY_SIZE 256
+
+/**
+ * Returns the maximum number of events GetKeyboardEvents,
+ * GetKeyboardValuatorEvents, and GetPointerEvents will ever return.
+ *
+ * Should be used in DIX as:
+ * xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ */
+_X_EXPORT int
+GetMaximumEventsNum() {
+ /* Two base events -- core and device, plus valuator events. Multiply
+ * by two if we're doing key repeats. */
+ int ret = 2 + MAX_VALUATOR_EVENTS;
+
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ ret *= 2;
+
+ return ret;
+}
+
+/**
+ * Convenience wrapper around GetKeyboardValuatorEvents, that takes no
+ * valuators.
+ */
+_X_EXPORT int
+GetKeyboardEvents(xEvent *events, DeviceIntPtr pDev, int type, int key_code) {
+ return GetKeyboardValuatorEvents(events, pDev, type, key_code, 0, 0, NULL);
+}
+
+/**
+ * Returns a set of keyboard events for KeyPress/KeyRelease, optionally
+ * also with valuator events. Handles Xi and XKB.
+ *
+ * events is not NULL-terminated; the return value is the number of events.
+ * The DDX is responsible for allocating the event structure in the first
+ * place via GetMaximumEventsNum(), and for freeing it.
+ *
+ * This function does not change the core keymap to that of the device;
+ * that is done by SwitchCoreKeyboard, which is called from
+ * mieqProcessInputEvents. If replacing function, take care to call
+ * SetCoreKeyboard before processInputProc, so keymaps are altered to suit.
+ *
+ * Note that this function recurses! If called for non-XKB, a repeating
+ * key press will trigger a matching KeyRelease, as well as the
+ * KeyPresses.
+ */
+_X_EXPORT int
+GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
+ int key_code, int first_valuator,
+ int num_valuators, int *valuators) {
+ int numEvents = 0, i = 0;
+ CARD32 ms = 0;
+ int final_valuator = first_valuator + num_valuators;
+ KeySym sym = pDev->key->curKeySyms.map[key_code *
+ pDev->key->curKeySyms.mapWidth];
+ deviceKeyButtonPointer *kbp = NULL;
+ deviceValuator *xv = NULL;
+
+ if (!events)
+ return 0;
+
+ if (type != KeyPress && type != KeyRelease)
+ return 0;
+
+ if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
+ (pDev->coreEvents && !inputInfo.keyboard->key))
+ return 0;
+
+ if (pDev->coreEvents)
+ numEvents = 2;
+ else
+ numEvents = 1;
+
+ if (num_valuators) {
+ if ((num_valuators / 6) + 1 > MAX_VALUATOR_EVENTS)
+ num_valuators = MAX_VALUATOR_EVENTS;
+ numEvents += (num_valuators / 6) + 1;
+ }
+
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+ switch (sym) {
+ case XK_Num_Lock:
+ case XK_Caps_Lock:
+ case XK_Scroll_Lock:
+ case XK_Shift_Lock:
+ if (type == KeyRelease)
+ return 0;
+ else if (type == KeyPress &&
+ (pDev->key->down[key_code >> 3] & (key_code & 7)) & 1)
+ type = KeyRelease;
+ }
+ }
+
+ /* Handle core repeating, via press/release/press/release.
+ * FIXME: In theory, if you're repeating with two keyboards,
+ * you could get unbalanced events here. */
+ if (type == KeyPress &&
+ (((pDev->key->down[key_code >> 3] & (key_code & 7))) & 1)) {
+ if (!pDev->kbdfeed->ctrl.autoRepeat ||
+ pDev->key->modifierMap[key_code] ||
+ !(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3]
+ & (1 << (key_code & 7))))
+ return 0;
+
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+ numEvents += GetKeyboardValuatorEvents(events, pDev,
+ KeyRelease, key_code,
+ first_valuator, num_valuators,
+ valuators);
+ events += numEvents;
+ }
+ }
+
+ ms = GetTimeInMillis();
+
+ kbp = (deviceKeyButtonPointer *) events;
+ kbp->time = ms;
+ kbp->deviceid = pDev->id;
+ if (type == KeyPress)
+ kbp->type = DeviceKeyPress;
+ else if (type == KeyRelease)
+ kbp->type = DeviceKeyRelease;
+
+ if (num_valuators) {
+ kbp->deviceid |= MORE_EVENTS;
+ for (i = first_valuator; i < final_valuator; i += 6) {
+ xv = (deviceValuator *) ++events;
+ xv->type = DeviceValuator;
+ xv->first_valuator = i;
+ xv->num_valuators = num_valuators;
+ xv->deviceid = kbp->deviceid;
+ switch (num_valuators - first_valuator) {
+ case 6:
+ xv->valuator5 = valuators[i+5];
+ case 5:
+ xv->valuator4 = valuators[i+4];
+ case 4:
+ xv->valuator3 = valuators[i+3];
+ case 3:
+ xv->valuator2 = valuators[i+2];
+ case 2:
+ xv->valuator1 = valuators[i+1];
+ case 1:
+ xv->valuator0 = valuators[i];
+ }
+ }
+ }
+
+ if (pDev->coreEvents) {
+ events++;
+ events->u.keyButtonPointer.time = ms;
+ events->u.u.type = type;
+ events->u.u.detail = key_code;
+ }
+
+ return numEvents;
+}
+
+/* Originally a part of xf86PostMotionEvent; modifies valuators
+ * in-place. */
+static void
+acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators,
+ int *valuators)
+{
+ float mult = 0.0;
+ int dx = 0, dy = 0;
+ int *px = NULL, *py = NULL;
+
+ if (!num_valuators || !valuators)
+ return;
+
+ if (first_valuator == 0) {
+ dx = valuators[0];
+ px = &valuators[0];
+ }
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
+ dy = valuators[1 - first_valuator];
+ py = &valuators[1 - first_valuator];
+ }
+
+ if (!dx && !dy)
+ return;
+
+ if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
+ /* modeled from xf86Events.c */
+ if (pDev->ptrfeed->ctrl.threshold) {
+ if ((abs(dx) + abs(dy)) >= pDev->ptrfeed->ctrl.threshold) {
+ pDev->valuator->dxremaind = ((float)dx *
+ (float)(pDev->ptrfeed->ctrl.num)) /
+ (float)(pDev->ptrfeed->ctrl.den) +
+ pDev->valuator->dxremaind;
+ if (px) {
+ *px = (int)pDev->valuator->dxremaind;
+ pDev->valuator->dxremaind = pDev->valuator->dxremaind -
+ (float)(*px);
+ }
+
+ pDev->valuator->dyremaind = ((float)dy *
+ (float)(pDev->ptrfeed->ctrl.num)) /
+ (float)(pDev->ptrfeed->ctrl.den) +
+ pDev->valuator->dyremaind;
+ if (py) {
+ *py = (int)pDev->valuator->dyremaind;
+ pDev->valuator->dyremaind = pDev->valuator->dyremaind -
+ (float)(*py);
+ }
+ }
+ }
+ else {
+ mult = pow((float)(dx * dx + dy * dy),
+ ((float)(pDev->ptrfeed->ctrl.num) /
+ (float)(pDev->ptrfeed->ctrl.den) - 1.0) /
+ 2.0) / 2.0;
+ if (dx) {
+ pDev->valuator->dxremaind = mult * (float)dx +
+ pDev->valuator->dxremaind;
+ *px = (int)pDev->valuator->dxremaind;
+ pDev->valuator->dxremaind = pDev->valuator->dxremaind -
+ (float)(*px);
+ }
+ if (dy) {
+ pDev->valuator->dyremaind = mult * (float)dy +
+ pDev->valuator->dyremaind;
+ *py = (int)pDev->valuator->dyremaind;
+ pDev->valuator->dyremaind = pDev->valuator->dyremaind -
+ (float)(*py);
+ }
+ }
+ }
+}
+
+/**
+ * Clip an axis to its bounds.
+ */
+static void
+clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
+{
+ AxisInfoPtr axes = pDev->valuator->axes + axisNum;
+
+ if (*val < axes->min_value)
+ *val = axes->min_value;
+ if (axes->max_value >= 0 && *val > axes->max_value)
+ *val = axes->max_value;
+}
+
+/**
+ * Compare the list of valuators against the limits for each axis, and clip
+ * them to those bounds.
+ */
+static void
+clipValuators(DeviceIntPtr pDev, int first_valuator, int num_valuators,
+ int *valuators)
+{
+ AxisInfoPtr axes = pDev->valuator->axes + first_valuator;
+ int i;
+
+ for (i = 0; i < num_valuators; i++, axes++)
+ clipAxis(pDev, i + first_valuator, &(valuators[i]));
+}
+
+/**
+ * Fills events with valuator events for pDev, as given by the other
+ * parameters.
+ */
+static xEvent *
+getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator,
+ int num_valuators, int *valuators) {
+ deviceValuator *xv = (deviceValuator *) events;
+ int i = 0, final_valuator = first_valuator + num_valuators;
+
+ for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) {
+ xv->type = DeviceValuator;
+ xv->first_valuator = i;
+ xv->num_valuators = num_valuators;
+ xv->deviceid = pDev->id;
+ switch (final_valuator - i) {
+ case 6:
+ xv->valuator5 = valuators[i + 5];
+ case 5:
+ xv->valuator4 = valuators[i + 4];
+ case 4:
+ xv->valuator3 = valuators[i + 3];
+ case 3:
+ xv->valuator2 = valuators[i + 2];
+ case 2:
+ xv->valuator1 = valuators[i + 1];
+ case 1:
+ xv->valuator0 = valuators[i];
+ }
+
+ if (i + 6 < final_valuator)
+ xv->deviceid |= MORE_EVENTS;
+ }
+
+ return events;
+}
+
+/**
+ * Pick some arbitrary size for Xi motion history.
+ */
+_X_EXPORT int
+GetMotionHistorySize()
+{
+ return MOTION_HISTORY_SIZE;
+}
+
+/**
+ * Allocate the motion history buffer.
+ */
+_X_EXPORT void
+AllocateMotionHistory(DeviceIntPtr pDev)
+{
+ if (pDev->valuator->motion)
+ xfree(pDev->valuator->motion);
+
+ if (pDev->valuator->numMotionEvents < 1)
+ return;
+
+ pDev->valuator->motion = xalloc(((sizeof(INT32) * pDev->valuator->numAxes) +
+ sizeof(Time)) *
+ pDev->valuator->numMotionEvents);
+ pDev->valuator->first_motion = 0;
+ pDev->valuator->last_motion = 0;
+}
+
+/**
+ * Dump the motion history between start and stop into the supplied buffer.
+ * Only records the event for a given screen in theory, but in practice, we
+ * sort of ignore this.
+ */
+_X_EXPORT int
+GetMotionHistory(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
+ unsigned long stop, ScreenPtr pScreen)
+{
+ int i = 0, ret = 0;
+ /* The size of a single motion event. */
+ int size = (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
+ Time current;
+ char *ibuff = NULL, *obuff = (char *) buff;
+
+ if (!pDev->valuator || !pDev->valuator->numMotionEvents)
+ return 0;
+
+ for (i = pDev->valuator->first_motion;
+ i != pDev->valuator->last_motion;
+ i = (i + 1) % pDev->valuator->numMotionEvents) {
+ /* We index the input buffer by which element we're accessing, which
+ * is not monotonic, and the output buffer by how many events we've
+ * written so far. */
+ ibuff = (char *) pDev->valuator->motion + (i * size);
+ memcpy(&current, ibuff, sizeof(Time));
+
+ if (current > stop) {
+ return ret;
+ }
+ else if (current >= start) {
+ memcpy(obuff, ibuff, size);
+ obuff += size;
+ ret++;
+ }
+ }
+
+ return ret;
+}
+
+/**
+ * Update the motion history for a specific device, with the list of
+ * valuators.
+ */
+static void
+updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, int first_valuator,
+ int num_valuators, int *valuators)
+{
+ char *buff = (char *) pDev->valuator->motion;
+
+ if (!pDev->valuator->numMotionEvents)
+ return;
+
+ buff += ((sizeof(INT32) * pDev->valuator->numAxes) + sizeof(CARD32)) *
+ pDev->valuator->last_motion;
+ memcpy(buff, &ms, sizeof(Time));
+
+ buff += sizeof(Time);
+ bzero(buff, sizeof(INT32) * pDev->valuator->numAxes);
+
+ buff += sizeof(INT32) * first_valuator;
+ memcpy(buff, valuators, sizeof(INT32) * num_valuators);
+
+ pDev->valuator->last_motion = (pDev->valuator->last_motion + 1) %
+ pDev->valuator->numMotionEvents;
+
+ /* If we're wrapping around, just keep the circular buffer going. */
+ if (pDev->valuator->first_motion == pDev->valuator->last_motion)
+ pDev->valuator->first_motion = (pDev->valuator->first_motion + 1) %
+ pDev->valuator->numMotionEvents;
+
+ return;
+}
+
+/**
+ * Generate a series of xEvents (returned in xE) representing pointer
+ * motion, or button presses. Xi and XKB-aware.
+ *
+ * events is not NULL-terminated; the return value is the number of events.
+ * The DDX is responsible for allocating the event structure in the first
+ * place via GetMaximumEventsNum(), and for freeing it.
+ */
+_X_EXPORT int
+GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
+ int flags, int first_valuator, int num_valuators,
+ int *valuators) {
+ int num_events = 0, final_valuator = 0;
+ CARD32 ms = 0;
+ deviceKeyButtonPointer *kbp = NULL;
+ Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
+ DeviceIntPtr cp = inputInfo.pointer;
+ int x = 0, y = 0;
+
+ /* Sanity checks. */
+ if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
+ return 0;
+
+ if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
+ return 0;
+
+ if (pDev->coreEvents)
+ num_events = 2;
+ else
+ num_events = 1;
+
+ /* Do we need to send a DeviceValuator event? */
+ if ((num_valuators + first_valuator) > 2 && sendValuators) {
+ if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
+ num_valuators = MAX_VALUATOR_EVENTS * 6;
+ num_events += ((num_valuators - 1) / 6) + 1;
+ }
+ else if (type == MotionNotify && num_valuators <= 0) {
+ return 0;
+ }
+
+ final_valuator = num_valuators + first_valuator;
+
+ /* You fail. */
+ if (first_valuator < 0 || final_valuator > pDev->valuator->numAxes)
+ return 0;
+
+ ms = GetTimeInMillis();
+
+ kbp = (deviceKeyButtonPointer *) events;
+ kbp->time = ms;
+ kbp->deviceid = pDev->id;
+
+ if (flags & POINTER_ABSOLUTE) {
+ if (num_valuators >= 1 && first_valuator == 0) {
+ x = valuators[0];
+ }
+ else {
+ if (pDev->coreEvents)
+ x = cp->valuator->lastx;
+ else
+ x = pDev->valuator->lastx;
+ }
+
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
+ y = valuators[1 - first_valuator];
+ }
+ else {
+ if (pDev->coreEvents)
+ x = cp->valuator->lasty;
+ else
+ y = pDev->valuator->lasty;
+ }
+ }
+ else {
+ if (flags & POINTER_ACCELERATE)
+ acceleratePointer(pDev, first_valuator, num_valuators,
+ valuators);
+
+ if (pDev->coreEvents) {
+ if (first_valuator == 0 && num_valuators >= 1)
+ x = cp->valuator->lastx + valuators[0];
+ else
+ x = cp->valuator->lastx;
+
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+ y = cp->valuator->lasty + valuators[1 - first_valuator];
+ else
+ y = cp->valuator->lasty;
+ }
+ else {
+ if (first_valuator == 0 && num_valuators >= 1)
+ x = pDev->valuator->lastx + valuators[0];
+ else
+ x = pDev->valuator->lastx;
+
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+ y = pDev->valuator->lasty + valuators[1 - first_valuator];
+ else
+ y = pDev->valuator->lasty;
+ }
+ }
+
+ /* Clip both x and y to the defined limits (usually co-ord space limit). */
+ clipAxis(pDev, 0, &x);
+ clipAxis(pDev, 1, &y);
+
+ /* This takes care of crossing screens for us, as well as clipping
+ * to the current screen. Right now, we only have one history buffer,
+ * so we don't set this for both the device and core.*/
+ miPointerSetPosition(pDev, &x, &y, ms);
+
+ /* Drop x and y back into the valuators list, if they were originally
+ * present. */
+ if (first_valuator == 0 && num_valuators >= 1)
+ valuators[0] = x;
+ if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
+ valuators[1 - first_valuator] = y;
+
+ updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
+
+ if (pDev->coreEvents) {
+ cp->valuator->lastx = x;
+ cp->valuator->lasty = y;
+ }
+ pDev->valuator->lastx = x;
+ pDev->valuator->lasty = y;
+
+ if (type == MotionNotify) {
+ kbp->type = DeviceMotionNotify;
+ }
+ else {
+ if (type == ButtonPress)
+ kbp->type = DeviceButtonPress;
+ else if (type == ButtonRelease)
+ kbp->type = DeviceButtonRelease;
+ kbp->detail = pDev->button->map[buttons];
+ }
+
+ kbp->root_x = x;
+ kbp->root_y = y;
+
+ events++;
+ if (final_valuator > 2 && sendValuators) {
+ kbp->deviceid |= MORE_EVENTS;
+ clipValuators(pDev, first_valuator, num_valuators, valuators);
+ events = getValuatorEvents(events, pDev, first_valuator,
+ num_valuators, valuators);
+ }
+
+ if (pDev->coreEvents) {
+ events->u.u.type = type;
+ events->u.keyButtonPointer.time = ms;
+ events->u.keyButtonPointer.rootX = x;
+ events->u.keyButtonPointer.rootY = y;
+
+ if (type == ButtonPress || type == ButtonRelease) {
+ /* We hijack SetPointerMapping to work on all core-sending
+ * devices, so we use the device-specific map here instead of
+ * the core one. */
+ events->u.u.detail = pDev->button->map[buttons];
+ }
+ else {
+ events->u.u.detail = 0;
+ }
+ }
+
+ return num_events;
+}
+
+/**
+ * Post ProximityIn/ProximityOut events, accompanied by valuators.
+ *
+ * events is not NULL-terminated; the return value is the number of events.
+ * The DDX is responsible for allocating the event structure in the first
+ * place via GetMaximumEventsNum(), and for freeing it.
+ */
+_X_EXPORT int
+GetProximityEvents(xEvent *events, DeviceIntPtr pDev, int type,
+ int first_valuator, int num_valuators, int *valuators)
+{
+ int num_events = 0;
+ deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) events;
+
+ /* Sanity checks. */
+ if (type != ProximityIn && type != ProximityOut)
+ return 0;
+
+ if (!pDev->valuator)
+ return 0;
+
+ /* Do we need to send a DeviceValuator event? */
+ if ((pDev->valuator->mode & 1) == Relative)
+ num_valuators = 0;
+
+ if (num_valuators) {
+ if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
+ num_valuators = MAX_VALUATOR_EVENTS * 6;
+ num_events += ((num_valuators - 1) / 6) + 1;
+ }
+
+ /* You fail. */
+ if (first_valuator < 0 ||
+ (num_valuators + first_valuator) > pDev->valuator->numAxes)
+ return 0;
+
+ kbp->type = type;
+ kbp->deviceid = pDev->id;
+ kbp->detail = 0;
+ kbp->time = GetTimeInMillis();
+
+ if (num_valuators) {
+ kbp->deviceid |= MORE_EVENTS;
+ events++;
+ events = getValuatorEvents(events, pDev, first_valuator,
+ num_valuators, valuators);
+ }
+
+ return num_events;
+}
+
+/**
+ * Note that pDev was the last device to send a core event. This function
+ * copies the complete keymap from the originating device to the core
+ * device, and makes sure the appropriate notifications are generated.
+ *
+ * Call this just before processInputProc.
+ */
+_X_EXPORT void
+SwitchCoreKeyboard(DeviceIntPtr pDev)
+{
+ KeyClassPtr ckeyc = inputInfo.keyboard->key;
+
+ if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) {
+ memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
+ if (ckeyc->modifierKeyMap)
+ xfree(ckeyc->modifierKeyMap);
+ ckeyc->modifierKeyMap = xalloc(8 * pDev->key->maxKeysPerModifier);
+ memcpy(ckeyc->modifierKeyMap, pDev->key->modifierKeyMap,
+ (8 * pDev->key->maxKeysPerModifier));
+
+ ckeyc->maxKeysPerModifier = pDev->key->maxKeysPerModifier;
+ ckeyc->curKeySyms.minKeyCode = pDev->key->curKeySyms.minKeyCode;
+ ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
+ SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
+
+#ifdef XKB
+ if (!noXkbExtension && pDev->key->xkbInfo && pDev->key->xkbInfo->desc) {
+ if (!XkbCopyKeymap(pDev->key->xkbInfo->desc, ckeyc->xkbInfo->desc,
+ True))
+ FatalError("Couldn't pivot keymap from device to core!\n");
+ }
+#endif
+
+ SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode,
+ (ckeyc->curKeySyms.maxKeyCode -
+ ckeyc->curKeySyms.minKeyCode),
+ serverClient);
+ inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
+ }
+}
+
+/**
+ * Note that pDev was the last function to send a core pointer event.
+ * Currently a no-op.
+ *
+ * Call this just before processInputProc.
+ */
+_X_EXPORT void
+SwitchCorePointer(DeviceIntPtr pDev)
+{
+ if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev)
+ inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
+}
+
+
+/**
+ * Synthesize a single motion event for the core pointer.
+ *
+ * Used in cursor functions, e.g. when cursor confinement changes, and we need
+ * to shift the pointer to get it inside the new bounds.
+ */
+void
+PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
+{
+ xEvent xE;
+
+#ifdef PANORAMIX
+ /* Translate back to the sprite screen since processInputProc
+ will translate from sprite screen to screen 0 upon reentry
+ to the DIX layer. */
+ if (!noPanoramiXExtension) {
+ x += panoramiXdataPtr[0].x - panoramiXdataPtr[screenNum].x;
+ y += panoramiXdataPtr[0].y - panoramiXdataPtr[screenNum].y;
+ }
+#endif
+
+ memset(&xE, 0, sizeof(xEvent));
+ xE.u.u.type = MotionNotify;
+ xE.u.keyButtonPointer.rootX = x;
+ xE.u.keyButtonPointer.rootY = y;
+
+ (*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
+}
diff --git a/dix/main.c b/dix/main.c
index f3cde189c..81350cc21 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -98,6 +98,7 @@ Equipment Corporation.
#include <X11/fonts/font.h>
#include "opaque.h"
#include "servermd.h"
+#include "config.h"
#include "site.h"
#include "dixfont.h"
#include "extnsionst.h"
@@ -248,6 +249,7 @@ main(int argc, char *argv[], char *envp[])
int i, j, k, error;
char *xauthfile;
HWEventQueueType alwaysCheckForInput[2];
+ CursorMetricRec cm;
display = "0";
@@ -308,6 +310,7 @@ main(int argc, char *argv[], char *envp[])
DPMSPowerLevel = 0;
#endif
InitBlockAndWakeupHandlers();
+ configInitialise();
/* Perform any operating system dependent initializations you'd like */
OsInit();
if(serverGeneration == 1)
@@ -394,23 +397,40 @@ main(int argc, char *argv[], char *envp[])
if (!CreateRootWindow(pScreen))
FatalError("failed to create root window");
}
+ InitCoreDevices();
InitInput(argc, argv);
if (InitAndStartDevices() != Success)
FatalError("failed to initialize core devices");
InitFonts();
+#ifdef BUILTIN_FONTS
+ defaultFontPath = "built-ins";
+#else
if (loadableFonts) {
SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error);
- } else {
+ } else
+#endif
+ {
if (SetDefaultFontPath(defaultFontPath) != Success)
ErrorF("failed to set default font path '%s'",
defaultFontPath);
}
if (!SetDefaultFont(defaultTextFont))
FatalError("could not open default font '%s'", defaultTextFont);
+#ifdef NULL_ROOT_CURSOR
+ cm.width = 0;
+ cm.height = 0;
+ cm.xhot = 0;
+ cm.yhot = 0;
+
+ if (!(rootCursor = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0)))
+ FatalError("could not create empty root cursor");
+ AddResource(FakeClientID(0), RT_CURSOR, (pointer)rootCursor);
+#else
if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0)))
FatalError("could not open default cursor font '%s'",
defaultCursorFont);
+#endif
#ifdef DPMSExtension
/* check all screens, looking for DPMS Capabilities */
DPMSCapableFlag = DPMSSupported();
@@ -461,6 +481,7 @@ main(int argc, char *argv[], char *envp[])
FreeAllResources();
#endif
+ configFini();
CloseDownDevices();
for (i = screenInfo.numScreens - 1; i >= 0; i--)
{
diff --git a/dix/resource.c b/dix/resource.c
index b2d01c8f3..efb759e75 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -72,6 +72,34 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
+/* XSERVER_DTRACE additions:
+ * Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
/* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */
@@ -125,6 +153,14 @@ Equipment Corporation.
#endif
#include <assert.h>
+#ifdef XSERVER_DTRACE
+#include <sys/types.h>
+typedef const char *string;
+#include "Xserver-dtrace.h"
+
+#define TypeNameString(t) NameForAtom(ResourceNames[t & TypeMask])
+#endif
+
static void RebuildTable(
int /*client*/
);
@@ -429,6 +465,9 @@ AddResource(XID id, RESTYPE type, pointer value)
register ClientResourceRec *rrec;
register ResourcePtr res, *head;
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
+#endif
client = CLIENT_ID(id);
rrec = &clientTable[client];
if (!rrec->buckets)
@@ -528,6 +567,11 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
if (res->id == id)
{
RESTYPE rtype = res->type;
+
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_FREE(res->id, res->type,
+ res->value, TypeNameString(res->type));
+#endif
*prev = res->next;
elements = --*eltptr;
if (rtype & RC_CACHED)
@@ -569,6 +613,10 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
{
if (res->id == id && res->type == type)
{
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_FREE(res->id, res->type,
+ res->value, TypeNameString(res->type));
+#endif
*prev = res->next;
if (type & RC_CACHED)
FlushClientCaches(res->id);
@@ -731,6 +779,10 @@ FreeClientNeverRetainResources(ClientPtr client)
RESTYPE rtype = this->type;
if (rtype & RC_NEVERRETAIN)
{
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_FREE(this->id, this->type,
+ this->value, TypeNameString(this->type));
+#endif
*prev = this->next;
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
@@ -777,6 +829,10 @@ FreeClientResources(ClientPtr client)
for (this = *head; this; this = *head)
{
RESTYPE rtype = this->type;
+#ifdef XSERVER_DTRACE
+ XSERVER_RESOURCE_FREE(this->id, this->type,
+ this->value, TypeNameString(this->type));
+#endif
*head = this->next;
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
diff --git a/doc/c-extensions b/doc/c-extensions
new file mode 100644
index 000000000..db2ba7d77
--- /dev/null
+++ b/doc/c-extensions
@@ -0,0 +1,32 @@
+Use of extensions throughout the X server tree
+----------------------------------------------
+
+Optional extensions:
+The server will still build if your toolchain does not support these
+extensions, although the results may not be optimal.
+
+ * _X_SENTINEL(x): member x of the passed structure must be NULL, e.g.:
+ void parseOptions(Option *options _X_SENTINEL(0));
+ parseOptions("foo", "bar", NULL); /* this is OK */
+ parseOptions("foo", "bar", "baz"); /* this is not */
+ This definition comes from Xfuncproto.h in the core
+ protocol headers.
+ * _X_ATTRIBUTE_PRINTF(x, y): This function has printf-like semantics;
+ check the format string when built with
+ -Wformat (gcc) or similar.
+ * _X_EXPORT: this function should appear in symbol tables.
+ * _X_HIDDEN: this function should not appear in the _dynamic_ symbol
+ table.
+ * _X_INTERNAL: like _X_HIDDEN, but attempt to ensure that this function
+ is never called from another module.
+ * _X_INLINE: inline this functon if possible (generally obeyed unless
+ disabling optimisations).
+ * _X_DEPRECATED: warn on use of this function.
+
+Mandatory extensions:
+The server will not build if your toolchain does not support these extensions.
+
+ * named initialisers: explicitly initialising structure members, e.g.:
+ struct foo bar = { .baz = quux, .brian = "dog" };
+ * variadic macros: macros with a variable number of arguments, e.g.:
+ #define DebugF(x, ...) /**/
diff --git a/fb/fbpict.c b/fb/fbpict.c
index d839994ae..28503c0cf 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -930,9 +930,8 @@ fbComposite (CARD8 op,
case PictOpOver:
if (pMask)
{
- if (srcRepeat &&
- pSrc->pDrawable->width == 1 &&
- pSrc->pDrawable->height == 1)
+ if (fbCanGetSolid(pSrc) &&
+ !maskRepeat)
{
srcRepeat = FALSE;
if (PICT_FORMAT_COLOR(pSrc->format)) {
@@ -1044,7 +1043,7 @@ fbComposite (CARD8 op,
{
if (pSrc->pDrawable == pMask->pDrawable &&
xSrc == xMask && ySrc == yMask &&
- !pMask->componentAlpha)
+ !pMask->componentAlpha && !maskRepeat)
{
/* source == mask: non-premultiplied data */
switch (pSrc->format) {
@@ -1108,9 +1107,7 @@ fbComposite (CARD8 op,
else
{
/* non-repeating source, repeating mask => translucent window */
- if (maskRepeat &&
- pMask->pDrawable->width == 1 &&
- pMask->pDrawable->height == 1)
+ if (fbCanGetSolid(pMask))
{
if (pSrc->format == PICT_x8r8g8b8 &&
pDst->format == PICT_x8r8g8b8 &&
@@ -1127,9 +1124,7 @@ fbComposite (CARD8 op,
}
else /* no mask */
{
- if (srcRepeat &&
- pSrc->pDrawable->width == 1 &&
- pSrc->pDrawable->height == 1)
+ if (fbCanGetSolid(pSrc))
{
/* no mask and repeating source */
switch (pSrc->format) {
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 19d555781..5cdde9ef5 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -30,6 +30,13 @@
#include "renderedge.h"
+
+#if defined(__GNUC__)
+#define INLINE __inline__
+#else
+#define INLINE
+#endif
+
#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
#define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b))
@@ -67,6 +74,40 @@
#define Green(x) (((x) >> 8) & 0xff)
#define Blue(x) ((x) & 0xff)
+/**
+ * Returns TRUE if the fbComposeGetSolid can be used to get a single solid
+ * color representing every source sampling location of the picture.
+ */
+static INLINE Bool
+fbCanGetSolid(PicturePtr pict)
+{
+ if (pict->pDrawable == NULL ||
+ pict->pDrawable->width != 1 ||
+ pict->pDrawable->height != 1)
+ {
+ return FALSE;
+ }
+ if (pict->repeat != RepeatNormal)
+ return FALSE;
+
+ switch (pict->format) {
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ case PICT_a8b8g8r8:
+ case PICT_x8b8g8r8:
+ case PICT_r8g8b8:
+ case PICT_b8g8r8:
+ case PICT_r5g6b5:
+ case PICT_b5g6r5:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+#define fbCanGetSolid(pict) \
+(pict->pDrawable != NULL && pict->pDrawable->width == 1 && pict->pDrawable->height == 1)
+
#define fbComposeGetSolid(pict, bits, fmt) { \
FbBits *__bits__; \
FbStride __stride__; \
@@ -322,12 +363,6 @@
#define FASTCALL
#endif
-#if defined(__GNUC__)
-#define INLINE __inline__
-#else
-#define INLINE
-#endif
-
typedef struct _FbComposeData {
CARD8 op;
PicturePtr src;
diff --git a/hw/darwin/darwinKeyboard.c b/hw/darwin/darwinKeyboard.c
index c148d96ce..1cc49fe8e 100644
--- a/hw/darwin/darwinKeyboard.c
+++ b/hw/darwin/darwinKeyboard.c
@@ -1020,7 +1020,7 @@ int DarwinModifierStringToNXKey(const char *str)
* This allows the ddx layer to prevent some keys from being remapped
* as modifier keys.
*/
-Bool LegalModifier(unsigned int key, DevicePtr pDev)
+Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return 1;
}
diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c
index 7c376dee4..37f458356 100644
--- a/hw/dmx/dmxinput.c
+++ b/hw/dmx/dmxinput.c
@@ -53,7 +53,7 @@
/** Returns TRUE if the key is a valid modifier. For PC-class
* keyboards, all keys can be used as modifiers, so return TRUE
* always. */
-Bool LegalModifier(unsigned int key, DevicePtr pDev)
+Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
diff --git a/hw/kdrive/Makefile.am b/hw/kdrive/Makefile.am
index c8832ebac..e07804948 100644
--- a/hw/kdrive/Makefile.am
+++ b/hw/kdrive/Makefile.am
@@ -3,10 +3,14 @@ VESA_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
smi via
endif
-if KDRIVEFBDEV
+if BUILD_KDRIVEFBDEVLIB
FBDEV_SUBDIRS = fbdev
endif
+if XFAKESERVER
+XFAKE_SUBDIRS = fake
+endif
+
if XSDLSERVER
XSDL_SUBDIRS = sdl
endif
@@ -15,14 +19,18 @@ if XEPHYR
XEPHYR_SUBDIRS = ephyr
endif
+if KDRIVELINUX
+LINUX_SUBDIRS = linux
+endif
+
SUBDIRS = \
src \
- linux \
+ $(LINUX_SUBDIRS) \
$(XSDL_SUBDIRS) \
$(FBDEV_SUBDIRS) \
$(VESA_SUBDIRS) \
$(XEPHYR_SUBDIRS) \
- fake
+ $(XFAKE_SUBDIRS)
DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
smi via fbdev sdl ephyr src linux fake sis300
diff --git a/hw/kdrive/ati/Makefile.am b/hw/kdrive/ati/Makefile.am
index 3732d7d72..76635fb52 100644
--- a/hw/kdrive/ati/Makefile.am
+++ b/hw/kdrive/ati/Makefile.am
@@ -61,12 +61,4 @@ ATI_LIBS = \
Xati_LDADD = \
$(ATI_LIBS) \
@KDRIVE_LIBS@ \
- @XSERVER_LIBS@
-
-
-Xati_DEPENDENCIES = \
- libati.a \
- $(FBDEV_LIBS) \
- $(VESA_LIBS) \
- $(DRI_LIBS)
-
+ @XSERVER_LIBS@
diff --git a/hw/kdrive/ati/ati_stub.c b/hw/kdrive/ati/ati_stub.c
index 01ebc3139..d0bc4ca6b 100644
--- a/hw/kdrive/ati/ati_stub.c
+++ b/hw/kdrive/ati/ati_stub.c
@@ -53,7 +53,15 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput(int argc, char **argv)
{
- KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdKeyboardInfo *ki = NULL;
+
+ KdAddPointerDriver(&LinuxMouseDriver);
+ ki = KdNewKeyboard();
+ if (ki) {
+ ki->driver = &LinuxKeyboardDriver;
+ KdAddKeyboard(ki);
+ }
+ KdInitInput();
}
void
diff --git a/hw/kdrive/chips/Makefile.am b/hw/kdrive/chips/Makefile.am
index 80fb2ddea..2f8a88da0 100644
--- a/hw/kdrive/chips/Makefile.am
+++ b/hw/kdrive/chips/Makefile.am
@@ -24,7 +24,3 @@ Xchips_LDADD = \
$(CHIPS_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
-
-Xchips_DEPENDENCIES = \
- libchips.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a
diff --git a/hw/kdrive/chips/chipsstub.c b/hw/kdrive/chips/chipsstub.c
index 3499a4874..7fec1c77d 100644
--- a/hw/kdrive/chips/chipsstub.c
+++ b/hw/kdrive/chips/chipsstub.c
@@ -48,7 +48,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 8f51bbe08..c201fe9d6 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -28,9 +28,4 @@ Xephyr_LDADD = \
libxephyr-hostx.a \
../../../exa/libexa.la \
@KDRIVE_LIBS@ \
- @KDRIVE_LIBS@ \
@XEPHYR_LIBS@
-
-Xephyr_DEPENDENCIES = \
- libxephyr.a \
- libxephyr-hostx.a
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index fbb16a465..7db8675d8 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -36,10 +36,16 @@
#include "inputstr.h"
extern int KdTsPhyScreen;
-extern DeviceIntPtr pKdKeyboard;
+KdKeyboardInfo *ephyrKbd;
+KdPointerInfo *ephyrMouse;
+EphyrKeySyms ephyrKeySyms;
static int mouseState = 0;
+typedef struct _EphyrInputPrivate {
+ Bool enabled;
+} EphyrKbdPrivate, EphyrPointerPrivate;
+
Bool EphyrWantGrayScale = 0;
Bool
@@ -206,15 +212,14 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
{
EphyrScrPriv *scrpriv = screen->driver;
EphyrPriv *priv = screen->card->driver;
- KdMouseMatrix m;
+ KdPointerMatrix m;
int buffer_height;
EPHYR_DBG(" screen->width: %d, screen->height: %d",
screen->width, screen->height);
- KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
-
- KdSetMouseMatrix (&m);
+ KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
+ KdSetPointerMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
@@ -719,8 +724,9 @@ ephyrUpdateModifierState(unsigned int state)
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
- if (*kptr & bit)
- KdEnqueueKeyboardEvent(key, TRUE); /* release */
+ if (*kptr & bit && ephyrKbd &&
+ ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); /* release */
if (--count == 0)
break;
@@ -732,7 +738,9 @@ ephyrUpdateModifierState(unsigned int state)
for (key = 0; key < MAP_LENGTH; key++)
if (keyc->modifierMap[key] & mask)
{
- KdEnqueueKeyboardEvent(key, FALSE); /* press */
+ if (keyc->modifierMap[key] & mask && ephyrKbd &&
+ ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); /* press */
break;
}
}
@@ -748,31 +756,47 @@ ephyrPoll(void)
switch (ev.type)
{
case EPHYR_EV_MOUSE_MOTION:
- KdEnqueueMouseEvent(kdMouseInfo, mouseState,
- ev.data.mouse_motion.x,
- ev.data.mouse_motion.y);
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
+ continue;
+ KdEnqueuePointerEvent(ephyrMouse, mouseState,
+ ev.data.mouse_motion.x,
+ ev.data.mouse_motion.y,
+ 0);
break;
case EPHYR_EV_MOUSE_PRESS:
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
+ continue;
ephyrUpdateModifierState(ev.key_state);
mouseState |= ev.data.mouse_down.button_num;
- KdEnqueueMouseEvent(kdMouseInfo, mouseState|KD_MOUSE_DELTA, 0, 0);
+ KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
break;
case EPHYR_EV_MOUSE_RELEASE:
+ if (!ephyrMouse ||
+ !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
+ continue;
ephyrUpdateModifierState(ev.key_state);
mouseState &= ~ev.data.mouse_up.button_num;
- KdEnqueueMouseEvent(kdMouseInfo, mouseState|KD_MOUSE_DELTA, 0, 0);
+ KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
break;
case EPHYR_EV_KEY_PRESS:
+ if (!ephyrKbd ||
+ !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ continue;
ephyrUpdateModifierState(ev.key_state);
- KdEnqueueKeyboardEvent (ev.data.key_down.scancode, FALSE);
+ KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_down.scancode, FALSE);
break;
case EPHYR_EV_KEY_RELEASE:
+ if (!ephyrKbd ||
+ !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
+ continue;
ephyrUpdateModifierState(ev.key_state);
- KdEnqueueKeyboardEvent (ev.data.key_up.scancode, TRUE);
+ KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
break;
default:
@@ -833,59 +857,112 @@ ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
/* Mouse calls */
-static Bool
-MouseInit (void)
+static Status
+MouseInit (KdPointerInfo *pi)
+{
+ pi->driverPrivate = (EphyrPointerPrivate *)
+ xcalloc(sizeof(EphyrPointerPrivate), 1);
+ ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
+ pi->nAxes = 3;
+ pi->nButtons = 32;
+ pi->name = KdSaveString("Xephyr virtual mouse");
+ ephyrMouse = pi;
+ return Success;
+}
+
+static Status
+MouseEnable (KdPointerInfo *pi)
{
- return TRUE;
+ ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE;
+ return Success;
+}
+
+static void
+MouseDisable (KdPointerInfo *pi)
+{
+ ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
+ return;
}
static void
-MouseFini (void)
+MouseFini (KdPointerInfo *pi)
{
- ;
+ ephyrMouse = NULL;
+ return;
}
-KdMouseFuncs EphyrMouseFuncs = {
+KdPointerDriver EphyrMouseDriver = {
+ "ephyr",
MouseInit,
+ MouseEnable,
+ MouseDisable,
MouseFini,
+ NULL,
};
/* Keyboard */
-static void
-EphyrKeyboardLoad (void)
+static Status
+EphyrKeyboardInit (KdKeyboardInfo *ki)
{
- EPHYR_DBG("mark");
-
+ ki->driverPrivate = (EphyrKbdPrivate *)
+ xcalloc(sizeof(EphyrKbdPrivate), 1);
hostx_load_keymap();
+ if (!ephyrKeySyms.map) {
+ ErrorF("Couldn't load keymap from host\n");
+ return BadAlloc;
+ }
+ ki->keySyms.minKeyCode = ephyrKeySyms.minKeyCode;
+ ki->keySyms.maxKeyCode = ephyrKeySyms.maxKeyCode;
+ ki->minScanCode = ki->keySyms.minKeyCode;
+ ki->maxScanCode = ki->keySyms.maxKeyCode;
+ ki->keySyms.mapWidth = ephyrKeySyms.mapWidth;
+ ki->keySyms.map = ephyrKeySyms.map;
+ ki->name = KdSaveString("Xephyr virtual keyboard");
+ ephyrKbd = ki;
+ return Success;
+}
+
+static Status
+EphyrKeyboardEnable (KdKeyboardInfo *ki)
+{
+ ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = TRUE;
+
+ return Success;
}
-static int
-EphyrKeyboardInit (void)
+static void
+EphyrKeyboardDisable (KdKeyboardInfo *ki)
{
- return 0;
+ ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = FALSE;
}
static void
-EphyrKeyboardFini (void)
+EphyrKeyboardFini (KdKeyboardInfo *ki)
{
+ /* not xfree: we call malloc from hostx.c. */
+ free(ki->keySyms.map);
+ ephyrKbd = NULL;
+ return;
}
static void
-EphyrKeyboardLeds (int leds)
+EphyrKeyboardLeds (KdKeyboardInfo *ki, int leds)
{
}
static void
-EphyrKeyboardBell (int volume, int frequency, int duration)
+EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
{
}
-KdKeyboardFuncs EphyrKeyboardFuncs = {
- EphyrKeyboardLoad,
+KdKeyboardDriver EphyrKeyboardDriver = {
+ "ephyr",
EphyrKeyboardInit,
+ EphyrKeyboardEnable,
EphyrKeyboardLeds,
EphyrKeyboardBell,
+ EphyrKeyboardDisable,
EphyrKeyboardFini,
- 0,
+ NULL,
};
diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index 707cb0168..f49d920d1 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -31,7 +31,6 @@
#include "os.h" /* for OsSignal() */
#include "kdrive.h"
-#include "kkeymap.h"
#include "hostx.h"
#include "exa.h"
@@ -68,7 +67,9 @@ typedef struct _ephyrScrPriv {
EphyrFakexaPriv *fakexa;
} EphyrScrPriv;
-extern KdCardFuncs ephyrFuncs;
+extern KdCardFuncs ephyrFuncs;
+extern KdKeyboardInfo *ephyrKbd;
+extern KdPointerInfo *ephyrMouse;
Bool
ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);
@@ -167,9 +168,9 @@ ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
void
ephyrUpdateModifierState(unsigned int state);
-extern KdMouseFuncs EphyrMouseFuncs;
+extern KdPointerDriver EphyrMouseDriver;
-extern KdKeyboardFuncs EphyrKeyboardFuncs;
+extern KdKeyboardDriver EphyrKeyboardDriver;
extern KdOsFuncs EphyrOsFuncs;
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 1aa608e93..a77b87e5e 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -51,7 +51,24 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&EphyrMouseFuncs, &EphyrKeyboardFuncs);
+ KdKeyboardInfo *ki;
+ KdPointerInfo *pi;
+
+ ki = KdNewKeyboard();
+ if (!ki)
+ FatalError("Couldn't create Xephyr keyboard\n");
+ ki->driver = &EphyrKeyboardDriver;
+ KdAddKeyboardDriver(&EphyrKeyboardDriver);
+ KdAddKeyboard(ki);
+
+ pi = KdNewPointer();
+ if (!pi)
+ FatalError("Couldn't create Xephyr pointer\n");
+ pi->driver = &EphyrMouseDriver;
+ KdAddPointerDriver(&EphyrMouseDriver);
+ KdAddPointer(pi);
+
+ KdInitInput();
}
void
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index d0a2f2f95..573f77489 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -77,14 +77,8 @@ static EphyrHostXVars HostX = { "?", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static int HostXWantDamageDebug = 0;
-extern KeySym EphyrKeymap[];
-
-extern KeySym kdKeymap[];
-extern int kdMinScanCode;
-extern int kdMaxScanCode;
-extern int kdMinKeyCode;
-extern int kdMaxKeyCode;
-extern int kdKeymapWidth;
+extern EphyrKeySyms ephyrKeySyms;
+
extern int monitorResolution;
static void
@@ -403,9 +397,9 @@ hostx_get_bpp(void)
}
void
-hostx_get_visual_masks (unsigned long *rmsk,
- unsigned long *gmsk,
- unsigned long *bmsk)
+hostx_get_visual_masks (CARD32 *rmsk,
+ CARD32 *gmsk,
+ CARD32 *bmsk)
{
if (host_depth_matches_server())
{
@@ -683,19 +677,21 @@ hostx_load_keymap(void)
*/
width = (host_width > 4) ? 4 : host_width;
+ ephyrKeySyms.map = (KeySym *)calloc(sizeof(KeySym),
+ (max_keycode - min_keycode + 1) *
+ width);
+ if (!ephyrKeySyms.map)
+ return;
+
for (i=0; i<(max_keycode - min_keycode+1); i++)
for (j=0; j<width; j++)
- kdKeymap[ (i*width)+j ] = keymap[ (i*host_width) + j ];
+ ephyrKeySyms.map[(i*width)+j] = keymap[(i*host_width) + j];
EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
- /* all kdrive vars - see kkeymap.c */
-
- kdMinScanCode = min_keycode;
- kdMaxScanCode = max_keycode;
- kdMinKeyCode = min_keycode;
- kdMaxKeyCode = max_keycode;
- kdKeymapWidth = width;
+ ephyrKeySyms.minKeyCode = min_keycode;
+ ephyrKeySyms.maxKeyCode = max_keycode;
+ ephyrKeySyms.mapWidth = width;
XFree(keymap);
}
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index d3f6da3d3..4e3c6af33 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -26,6 +26,9 @@
#ifndef _XLIBS_STUFF_H_
#define _XLIBS_STUFF_H_
+#include <X11/X.h>
+#include <X11/Xmd.h>
+
#define EPHYR_WANT_DEBUG 0
#if (EPHYR_WANT_DEBUG)
@@ -48,6 +51,14 @@ typedef enum EphyrHostXEventType
}
EphyrHostXEventType;
+/* I can't believe it's not a KeySymsRec. */
+typedef struct {
+ int minKeyCode;
+ int maxKeyCode;
+ int mapWidth;
+ KeySym *map;
+} EphyrKeySyms;
+
struct EphyrHostXEvent
{
EphyrHostXEventType type;
@@ -126,9 +137,9 @@ int
hostx_get_bpp(void);
void
-hostx_get_visual_masks (unsigned long *rmsk,
- unsigned long *gmsk,
- unsigned long *bmsk);
+hostx_get_visual_masks (CARD32 *rmsk,
+ CARD32 *gmsk,
+ CARD32 *bmsk);
void
hostx_set_cmap_entry(unsigned char idx,
unsigned char r,
diff --git a/hw/kdrive/ephyr/os.c b/hw/kdrive/ephyr/os.c
index ead15868b..1a42495f3 100644
--- a/hw/kdrive/ephyr/os.c
+++ b/hw/kdrive/ephyr/os.c
@@ -34,34 +34,8 @@ EphyrInit (void)
return hostx_init();
}
-static void
-EphyrEnable (void)
-{
- EPHYR_DBG("mark");
-}
-
-static Bool
-EphyrSpecialKey (KeySym sym)
-{
- return FALSE;
-}
-
-static void
-EphyrDisable (void)
-{
-}
-
-static void
-EphyrFini (void)
-{
-}
-
KdOsFuncs EphyrOsFuncs = {
- EphyrInit,
- EphyrEnable,
- EphyrSpecialKey,
- EphyrDisable,
- EphyrFini,
- ephyrPoll
+ .Init = EphyrInit,
+ .pollEvents = ephyrPoll,
};
diff --git a/hw/kdrive/epson/Makefile.am b/hw/kdrive/epson/Makefile.am
index 665d13651..a5bc70b02 100644
--- a/hw/kdrive/epson/Makefile.am
+++ b/hw/kdrive/epson/Makefile.am
@@ -24,5 +24,3 @@ Xepson_LDADD = \
$(EPSON_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
-
-Xepson_DEPENDENCIES = libepson.a
diff --git a/hw/kdrive/epson/epson13806stub.c b/hw/kdrive/epson/epson13806stub.c
index 125d90289..7981782ed 100644
--- a/hw/kdrive/epson/epson13806stub.c
+++ b/hw/kdrive/epson/epson13806stub.c
@@ -53,10 +53,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#ifdef TOUCHSCREEN
- KdAddMouseDriver (&TsFuncs);
-#endif
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
int
diff --git a/hw/kdrive/fake/Makefile.am b/hw/kdrive/fake/Makefile.am
index 3a53e3dbb..d7ebfc243 100644
--- a/hw/kdrive/fake/Makefile.am
+++ b/hw/kdrive/fake/Makefile.am
@@ -6,10 +6,6 @@ noinst_LIBRARIES = libfake.a
bin_PROGRAMS = Xfake
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
libfake_a_SOURCES = \
fake.c \
kbd.c \
@@ -23,9 +19,4 @@ Xfake_SOURCES = \
Xfake_LDADD = \
libfake.a \
@KDRIVE_LIBS@ \
- @KDRIVE_LIBS@ \
- $(TSLIB_FLAG) \
@XSERVER_LIBS@
-
-Xfake_DEPENDENCIES = \
- libfake.a
diff --git a/hw/kdrive/fake/fake.c b/hw/kdrive/fake/fake.c
index d56512b3f..ca515f9b6 100644
--- a/hw/kdrive/fake/fake.c
+++ b/hw/kdrive/fake/fake.c
@@ -158,7 +158,7 @@ Bool
fakeMapFramebuffer (KdScreenInfo *screen)
{
FakeScrPriv *scrpriv = screen->driver;
- KdMouseMatrix m;
+ KdPointerMatrix m;
FakePriv *priv = screen->card->driver;
if (scrpriv->randr != RR_Rotate_0)
@@ -166,9 +166,9 @@ fakeMapFramebuffer (KdScreenInfo *screen)
else
scrpriv->shadow = FALSE;
- KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
+ KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
- KdSetMouseMatrix (&m);
+ KdSetPointerMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
if (priv->base)
diff --git a/hw/kdrive/fake/fake.h b/hw/kdrive/fake/fake.h
index 4d90d3169..f7c8c3431 100644
--- a/hw/kdrive/fake/fake.h
+++ b/hw/kdrive/fake/fake.h
@@ -130,9 +130,9 @@ fakeRandRInit (ScreenPtr pScreen);
#endif
-extern KdMouseFuncs FakeMouseFuncs;
+extern KdPointerDriver FakePointerDriver;
-extern KdKeyboardFuncs FakeKeyboardFuncs;
+extern KdKeyboardDriver FakeKeyboardDriver;
extern KdOsFuncs FakeOsFuncs;
diff --git a/hw/kdrive/fake/fakeinit.c b/hw/kdrive/fake/fakeinit.c
index c5ee4bc3f..dd88bc5a7 100644
--- a/hw/kdrive/fake/fakeinit.c
+++ b/hw/kdrive/fake/fakeinit.c
@@ -44,7 +44,22 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&FakeMouseFuncs, &FakeKeyboardFuncs);
+ KdPointerInfo *pi;
+ KdKeyboardInfo *ki;
+
+ pi = KdNewPointer ();
+ if (!pi)
+ return;
+ pi->driver = &FakePointerDriver;
+ KdAddPointer(pi);
+
+ ki = KdNewKeyboard ();
+ if (!ki)
+ return;
+ ki->driver = &FakeKeyboardDriver;
+ KdAddKeyboard(ki);
+
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/fake/kbd.c b/hw/kdrive/fake/kbd.c
index 9cf4de060..db224c995 100644
--- a/hw/kdrive/fake/kbd.c
+++ b/hw/kdrive/fake/kbd.c
@@ -27,7 +27,6 @@
#include <kdrive-config.h>
#endif
#include "fake.h"
-#include "kkeymap.h"
#include <X11/keysym.h>
#define FAKE_WIDTH 2
@@ -155,41 +154,58 @@ KeySym FakeKeymap[] = {
/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
};
-static void
-FakeKeyboardLoad (void)
+static Status
+FakeKeyboardInit (KdKeyboardInfo *ki)
+{
+ ki->keySyms.minKeyCode = 1;
+ ki->keySyms.maxKeyCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
+ ki->keySyms.mapWidth = FAKE_WIDTH;
+ if (ki->keySyms.map)
+ xfree(ki->keySyms.map);
+ ki->keySyms.map = (KeySym *)xalloc(sizeof(FakeKeymap));
+ if (!ki->keySyms.map)
+ return BadAlloc;
+ memcpy (ki->keySyms.map, FakeKeymap, sizeof (FakeKeymap));
+
+ return Success;
+}
+
+static Status
+FakeKeyboardEnable (KdKeyboardInfo *ki)
{
- kdMinScanCode = 1;
- kdKeymapWidth = FAKE_WIDTH;
- kdMaxScanCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
- memcpy (kdKeymap, FakeKeymap, sizeof (FakeKeymap));
+ return Success;
}
-static int
-FakeKeyboardInit (void)
+static void
+FakeKeyboardDisable (KdKeyboardInfo *ki)
{
- return 0;
+ return;
}
static void
-FakeKeyboardFini (void)
+FakeKeyboardFini (KdKeyboardInfo *ki)
{
+ xfree(ki->keySyms.map);
+ ki->keySyms.map = NULL;
}
static void
-FakeKeyboardLeds (int leds)
+FakeKeyboardLeds (KdKeyboardInfo *ki, int leds)
{
}
static void
-FakeKeyboardBell (int volume, int frequency, int duration)
+FakeKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
{
}
-KdKeyboardFuncs FakeKeyboardFuncs = {
- FakeKeyboardLoad,
+KdKeyboardDriver FakeKeyboardDriver = {
+ "fake",
FakeKeyboardInit,
+ FakeKeyboardEnable,
FakeKeyboardLeds,
FakeKeyboardBell,
+ FakeKeyboardDisable,
FakeKeyboardFini,
- 0,
+ NULL,
};
diff --git a/hw/kdrive/fake/mouse.c b/hw/kdrive/fake/mouse.c
index 714a45123..beb6ff524 100644
--- a/hw/kdrive/fake/mouse.c
+++ b/hw/kdrive/fake/mouse.c
@@ -35,19 +35,35 @@
#include "scrnintstr.h"
#include "kdrive.h"
-static Bool
-MouseInit (void)
+static Status
+MouseInit (KdPointerInfo *pi)
{
- return TRUE;
+ return Success;
+}
+
+static Status
+MouseEnable (KdPointerInfo *pi)
+{
+ return Success;
+}
+
+static void
+MouseDisable (KdPointerInfo *pi)
+{
+ return;
}
static void
-MouseFini (void)
+MouseFini (KdPointerInfo *pi)
{
+ return;
}
-KdMouseFuncs FakeMouseFuncs = {
+KdPointerDriver FakePointerDriver = {
+ "fake",
MouseInit,
+ MouseEnable,
+ MouseDisable,
MouseFini,
};
diff --git a/hw/kdrive/fbdev/Makefile.am b/hw/kdrive/fbdev/Makefile.am
index 3a8c65bbb..cb7180184 100644
--- a/hw/kdrive/fbdev/Makefile.am
+++ b/hw/kdrive/fbdev/Makefile.am
@@ -4,19 +4,18 @@ INCLUDES = \
noinst_LIBRARIES = libfbdev.a
-bin_PROGRAMS = Xfbdev
-
libfbdev_a_SOURCES = \
fbdev.c \
fbdev.h
+if KDRIVEFBDEV
+bin_PROGRAMS = Xfbdev
+
Xfbdev_SOURCES = \
fbinit.c
Xfbdev_LDADD = \
libfbdev.a \
@KDRIVE_LIBS@ \
- @XSERVER_LIBS@
-
-Xfbdev_DEPENDENCIES = \
- libfbdev.a
+ @XSERVER_LIBS@
+endif
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index 20bf75800..598d0ceaf 100644
--- a/hw/kdrive/fbdev/fbdev.c
+++ b/hw/kdrive/fbdev/fbdev.c
@@ -331,7 +331,7 @@ Bool
fbdevMapFramebuffer (KdScreenInfo *screen)
{
FbdevScrPriv *scrpriv = screen->driver;
- KdMouseMatrix m;
+ KdPointerMatrix m;
FbdevPriv *priv = screen->card->driver;
if (scrpriv->randr != RR_Rotate_0)
@@ -339,9 +339,9 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
else
scrpriv->shadow = FALSE;
- KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
+ KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
- KdSetMouseMatrix (&m);
+ KdSetPointerMatrix (&m);
screen->width = priv->var.xres;
screen->height = priv->var.yres;
diff --git a/hw/kdrive/fbdev/fbinit.c b/hw/kdrive/fbdev/fbinit.c
index ee373276b..3b78c9735 100644
--- a/hw/kdrive/fbdev/fbinit.c
+++ b/hw/kdrive/fbdev/fbinit.c
@@ -45,10 +45,18 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#ifdef TOUCHSCREEN
- KdAddMouseDriver (&TsFuncs);
+ KdKeyboardInfo *ki;
+
+ KdAddKeyboardDriver (&LinuxKeyboardDriver);
+ KdAddPointerDriver (&LinuxMouseDriver);
+#ifdef TSLIB
+ KdAddPointerDriver (&TsDriver);
#endif
+
+ ki = KdParseKeyboard ("keybd");
+ KdAddKeyboard(ki);
+
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/i810/Makefile.am b/hw/kdrive/i810/Makefile.am
index 808d8f70b..503958571 100644
--- a/hw/kdrive/i810/Makefile.am
+++ b/hw/kdrive/i810/Makefile.am
@@ -27,5 +27,3 @@ Xi810_LDADD = \
$(I810_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
-
-Xi810_DEPENDENCIES = libi810.a
diff --git a/hw/kdrive/i810/i810stub.c b/hw/kdrive/i810/i810stub.c
index c195947c9..364d16bfe 100644
--- a/hw/kdrive/i810/i810stub.c
+++ b/hw/kdrive/i810/i810stub.c
@@ -73,7 +73,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/igs/igsstub.c b/hw/kdrive/igs/igsstub.c
index b0ce151f0..39c6fd4ed 100644
--- a/hw/kdrive/igs/igsstub.c
+++ b/hw/kdrive/igs/igsstub.c
@@ -56,7 +56,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/itsy/kbd.c b/hw/kdrive/itsy/kbd.c
index 76062c5a8..beb4685d4 100644
--- a/hw/kdrive/itsy/kbd.c
+++ b/hw/kdrive/itsy/kbd.c
@@ -27,7 +27,6 @@
#include <kdrive-config.h>
#endif
#include "itsy.h"
-#include "kkeymap.h"
#include <X11/keysym.h>
#include <linux/itsy_buttons.h>
@@ -167,28 +166,44 @@ ItsyKeyboardLoad (void)
{
KeySym *k;
- itsyButtonState = 0;
- kdMinScanCode = 1;
- kdKeymapWidth = ITSY_WIDTH;
- kdMaxScanCode = (sizeof (ItsyKeymap) / sizeof (ItsyKeymap[0])) / ITSY_WIDTH;
- memcpy (kdKeymap, ItsyKeymap, sizeof (ItsyKeymap));
}
-int
-ItsyKeyboardInit (void)
+static Status
+ItsyKeyboardInit (KdKeyboardInfo *ki)
{
- int butPort;
+ if (!ki)
+ return BadImplementation;
+
+ ki->driverPrivate = open ("/dev/buttons", 0);
- butPort = open ("/dev/buttons", 0);
- fprintf (stderr, "butPort %d\n", butPort);
- return butPort;
+ itsyButtonState = 0;
+ ki->keySyms.minKeyCode = 1;
+ ki->keySyms.maxKeyCode = (sizeof (ItsyKeymap) / sizeof (ItsyKeymap[0])) / ITSY_WIDTH;
+ ki->minScanCode = ki->keySyms.minKeyCode;
+ ki->maxScanCode = ki->keySyms.maxKeyCode;
+ ki->keySyms.mapWidth = ITSY_WIDTH;
+
+ if (ki->keySyms.map)
+ xfree(ki->keySyms.map);
+ ki->keySyms.map = xalloc(sizeof(ItsyKeymap));
+ if (!ki->keySyms.map)
+ return BadAlloc;
+ memcpy (kdKeymap, ItsyKeymap, sizeof (ItsyKeymap));
+
+ return Success;
}
-void
-ItsyKeyboardFini (int fd)
+static void
+ItsyKeyboardDisable (KdKeybdInfo *ki)
{
if (fd >= 0)
- close (fd);
+ close ((int)ki->driverPrivate);
+}
+
+static void
+ItsyKeyboardFini (KdKeybdInfo *ki)
+{
+ return;
}
void
@@ -227,11 +242,13 @@ ItsyKeyboardBell (int volume, int frequency, int duration)
}
KdKeyboardFuncs itsyKeyboardFuncs = {
- ItsyKeyboardLoad,
+ "itsy",
ItsyKeyboardInit,
+ ItsyKeyboardEnable,
ItsyKeyboardRead,
ItsyKeyboardLeds,
ItsyKeyboardBell,
+ ItsyKeyboardDisable
ItsyKeyboardFini,
- 0,
+ NULL,
};
diff --git a/hw/kdrive/itsy/ts.c b/hw/kdrive/itsy/ts.c
index c773c0e4f..180d1fd12 100644
--- a/hw/kdrive/itsy/ts.c
+++ b/hw/kdrive/itsy/ts.c
@@ -63,7 +63,7 @@ itsyTsReadBytes (int fd, char *buf, int len, int min)
}
void
-itsyTsRead (int tsPort)
+itsyTsRead (KdPointerInfo *pi, int tsPort)
{
ts_event event;
long buf[3];
@@ -89,7 +89,7 @@ itsyTsRead (int tsPort)
x = 0;
y = 0;
}
- KdEnqueueMouseEvent (flags, x, y);
+ KdEnqueuePointerEvent (pi, flags, x, y, 0);
}
}
@@ -204,7 +204,8 @@ itsyTsFini (int tsPort)
close (tsPort);
}
-KdMouseFuncs itsyTsMouseFuncs = {
+KdPointerDriver itsyTsMouseDriver = {
+ "itsyts",
itsyTsInit,
itsyTsRead,
itsyTsFini
diff --git a/hw/kdrive/linux/Makefile.am b/hw/kdrive/linux/Makefile.am
index 29959df00..e13d08312 100644
--- a/hw/kdrive/linux/Makefile.am
+++ b/hw/kdrive/linux/Makefile.am
@@ -32,16 +32,3 @@ liblinux_a_SOURCES = \
$(KDRIVE_HW_SOURCES) \
$(TSLIB_C) \
$(TS_C)
-
-liblinux_a_DEPENDENCIES = \
- agp.c \
- bus.c \
- keyboard.c \
- linux.c \
- mouse.c \
- evdev.c \
- ms.c \
- ps2.c \
- $(TSLIB_C) \
- $(TS_C)
-
diff --git a/hw/kdrive/linux/bus.c b/hw/kdrive/linux/bus.c
index be61f891a..8cf5f901f 100644
--- a/hw/kdrive/linux/bus.c
+++ b/hw/kdrive/linux/bus.c
@@ -55,7 +55,7 @@ BusRead (int adbPort, void *closure)
flags |= KD_BUTTON_2;
if ((buf[0] & 1) == 0)
flags |= KD_BUTTON_3;
- KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
+ KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
}
}
@@ -66,36 +66,71 @@ char *BusNames[] = {
#define NUM_BUS_NAMES (sizeof (BusNames) / sizeof (BusNames[0]))
-int BusInputType;
+static int
+BusInit (KdPointerInfo *pi)
+{
+ int i, fd = 0;
+
+ if (!pi->path || (strcmp(pi->path, "auto") == 0))
+ {
+ for (i = 0; i < NUM_BUS_NAMES; i++)
+ {
+ if ((fd = open (BusNames[i], 0)) > 0)
+ {
+ close(fd);
+ if (pi->path)
+ xfree(pi->path);
+ pi->path = KdSaveString(BusNames[i]);
+ return Success;
+ }
+ }
+ }
+ else
+ {
+ if ((fd = open(pi->path, 0)) > 0)
+ {
+ close(fd);
+ return Success;
+ }
+ }
+
+ return !Success;
+}
static int
-BusInit (void)
+BusEnable (KdPointerInfo *pi)
{
- int i;
- int busPort;
- int n = 0;
+ int fd = open(pi->path, 0);
- if (!BusInputType)
- BusInputType = KdAllocInputType ();
-
- for (i = 0; i < NUM_BUS_NAMES; i++)
+ if (fd > 0)
+ {
+ KdRegisterFd(fd, BusRead, pi);
+ pi->driverPrivate = (void *)fd;
+ return Success;
+ }
+ else
{
- busPort = open (BusNames[i], 0);
- {
- KdRegisterFd (BusInputType, busPort, BusRead, 0);
- n++;
- }
+ return !Success;
}
- return n;
}
static void
-BusFini (void)
+BusDisable (KdPointerInfo *pi)
+{
+ KdUnregisterFd(pi, (int)pi->driverPrivate, TRUE);
+}
+
+static void
+BusFini (KdPointerInfo *pi)
{
- KdUnregisterFds (BusInputType, TRUE);
+ return;
}
-KdMouseFuncs BusMouseFuncs = {
+KdPointerDriver BusMouseDriver = {
+ "bus",
BusInit,
- BusFini
+ BusEnable,
+ BusDisable,
+ BusFini,
+ NULL
};
diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c
index d83b13a6e..6c08cfa62 100644
--- a/hw/kdrive/linux/evdev.c
+++ b/hw/kdrive/linux/evdev.c
@@ -43,98 +43,100 @@
#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y))
#define OFF(x) ((x)%BITS_PER_LONG)
#define LONG(x) ((x)/BITS_PER_LONG)
-#define BIT(x) (1 << OFF(x))
+#define BIT(x) (1 << OFF(x))
#define SETBIT(x,y) ((x)[LONG(y)] |= BIT(y))
#define CLRBIT(x,y) ((x)[LONG(y)] &= ~BIT(y))
#define ASSIGNBIT(x,y,z) ((x)[LONG(y)] = ((x)[LONG(y)] & ~BIT(y)) | (z << OFF(y)))
typedef struct _kevdevMouse {
/* current device state */
- int rel[REL_MAX + 1];
- int abs[ABS_MAX + 1];
- int prevabs[ABS_MAX + 1];
- long key[NBITS(KEY_MAX + 1)];
+ int rel[REL_MAX + 1];
+ int abs[ABS_MAX + 1];
+ int prevabs[ABS_MAX + 1];
+ long key[NBITS(KEY_MAX + 1)];
/* supported device info */
- long relbits[NBITS(REL_MAX + 1)];
- long absbits[NBITS(ABS_MAX + 1)];
- long keybits[NBITS(KEY_MAX + 1)];
+ long relbits[NBITS(REL_MAX + 1)];
+ long absbits[NBITS(ABS_MAX + 1)];
+ long keybits[NBITS(KEY_MAX + 1)];
struct input_absinfo absinfo[ABS_MAX + 1];
- int max_rel;
- int max_abs;
+ int max_rel;
+ int max_abs;
+
+ int fd;
} Kevdev;
static void
-EvdevMotion (KdMouseInfo *mi)
+EvdevMotion (KdPointerInfo *pi)
{
- Kevdev *ke = mi->driver;
- int i;
+ Kevdev *ke = pi->driverPrivate;
+ int i;
for (i = 0; i <= ke->max_rel; i++)
- if (ke->rel[i])
- {
- int a;
- ErrorF ("rel");
- for (a = 0; a <= ke->max_rel; a++)
- {
- if (ISBITSET (ke->relbits, a))
- ErrorF (" %d=%d", a, ke->rel[a]);
- ke->rel[a] = 0;
- }
- ErrorF ("\n");
- break;
- }
+ if (ke->rel[i])
+ {
+ int a;
+ ErrorF ("rel");
+ for (a = 0; a <= ke->max_rel; a++)
+ {
+ if (ISBITSET (ke->relbits, a))
+ ErrorF (" %d=%d", a, ke->rel[a]);
+ ke->rel[a] = 0;
+ }
+ ErrorF ("\n");
+ break;
+ }
for (i = 0; i < ke->max_abs; i++)
- if (ke->abs[i] != ke->prevabs[i])
- {
- int a;
- ErrorF ("abs");
- for (a = 0; a <= ke->max_abs; a++)
- {
- if (ISBITSET (ke->absbits, a))
- ErrorF (" %d=%d", a, ke->abs[a]);
- ke->prevabs[a] = ke->abs[a];
- }
- ErrorF ("\n");
- break;
- }
+ if (ke->abs[i] != ke->prevabs[i])
+ {
+ int a;
+ ErrorF ("abs");
+ for (a = 0; a <= ke->max_abs; a++)
+ {
+ if (ISBITSET (ke->absbits, a))
+ ErrorF (" %d=%d", a, ke->abs[a]);
+ ke->prevabs[a] = ke->abs[a];
+ }
+ ErrorF ("\n");
+ break;
+ }
}
static void
EvdevRead (int evdevPort, void *closure)
{
- KdMouseInfo *mi = closure;
- Kevdev *ke = mi->driver;
- int i;
- struct input_event events[NUM_EVENTS];
- int n;
+ KdPointerInfo *pi = closure;
+ Kevdev *ke = pi->driverPrivate;
+ int i;
+ struct input_event events[NUM_EVENTS];
+ int n;
n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
if (n <= 0)
- return;
+ return;
n /= sizeof (struct input_event);
for (i = 0; i < n; i++)
{
- switch (events[i].type) {
- case EV_SYN:
- break;
- case EV_KEY:
- EvdevMotion (mi);
- ASSIGNBIT(ke->key,events[i].code, events[i].value);
- if (events[i].code < 0x100)
- ErrorF ("key %d %d\n", events[i].code, events[i].value);
- else
- ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
- break;
- case EV_REL:
- ke->rel[events[i].code] += events[i].value;
- break;
- case EV_ABS:
- ke->abs[events[i].code] = events[i].value;
- break;
- }
+ switch (events[i].type) {
+ case EV_SYN:
+ break;
+ case EV_KEY:
+ EvdevMotion (pi);
+ ASSIGNBIT(ke->key,events[i].code, events[i].value);
+ if (events[i].code < 0x100)
+ ErrorF ("key %d %d\n", events[i].code, events[i].value);
+ else
+ ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
+ break;
+ case EV_REL:
+ ke->rel[events[i].code] += events[i].value;
+ break;
+ case EV_ABS:
+ ke->abs[events[i].code] = events[i].value;
+ break;
+ }
}
- EvdevMotion (mi);
+ EvdevMotion (pi);
}
int EvdevInputType;
@@ -148,143 +150,153 @@ char *kdefaultEvdev[] = {
#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
-static Bool
-EvdevInit (void)
+static Status
+EvdevInit (KdPointerInfo *pi)
{
- int i;
- int fd;
- KdMouseInfo *mi, *next;
- int n = 0;
- char *prot;
+ int i;
+ int fd;
+ int n = 0;
+ char *prot;
+
+ if (!pi->path) {
+ for (i = 0; i < NUM_DEFAULT_EVDEV; i++) {
+ fd = open (kdefaultEvdev[i], 2);
+ if (fd >= 0) {
+ pi->path = KdSaveString (kdefaultEvdev[i]);
+ break;
+ }
+ }
+ }
+ else {
+ fd = open (pi->path, 2);
+ if (fd < 0) {
+ ErrorF("Failed to open evdev device %s\n", pi->path);
+ return BadMatch;
+ }
+ }
+
+ return Success;
+}
- if (!EvdevInputType)
- EvdevInputType = KdAllocInputType ();
+static Status
+EvdevEnable (KdPointerInfo *pi)
+{
+ int fd;
- for (mi = kdMouseInfo; mi; mi = next)
+ if (!pi || !pi->path)
+ return BadImplementation;
+
+ fd = open(pi->path, 2);
+ if (fd < 0)
+ return BadMatch;
+
+ unsigned long ev[NBITS(EV_MAX)];
+ Kevdev *ke;
+
+ if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
+ {
+ perror ("EVIOCGBIT 0");
+ close (fd);
+ return BadMatch;
+ }
+ ke = xalloc (sizeof (Kevdev));
+ if (!ke)
+ {
+ close (fd);
+ return BadAlloc;
+ }
+ memset (ke, '\0', sizeof (Kevdev));
+ if (ISBITSET (ev, EV_KEY))
{
- next = mi->next;
- prot = mi->prot;
- if (mi->inputType)
- continue;
- if (!mi->name)
- {
- for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
- {
- fd = open (kdefaultEvdev[i], 2);
- if (fd >= 0)
- {
- mi->name = KdSaveString (kdefaultEvdev[i]);
- break;
- }
- }
- }
- else
- fd = open (mi->name, 2);
-
- if (fd >= 0)
- {
- unsigned long ev[NBITS(EV_MAX)];
- Kevdev *ke;
-
- if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
- {
- perror ("EVIOCGBIT 0");
- close (fd);
- continue;
- }
- ke = xalloc (sizeof (Kevdev));
- if (!ke)
- {
- close (fd);
- continue;
- }
- memset (ke, '\0', sizeof (Kevdev));
- if (ISBITSET (ev, EV_KEY))
- {
- if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
- ke->keybits) < 0)
- {
- perror ("EVIOCGBIT EV_KEY");
- xfree (ke);
- close (fd);
- continue;
- }
- }
- if (ISBITSET (ev, EV_REL))
- {
- if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
- ke->relbits) < 0)
- {
- perror ("EVIOCGBIT EV_REL");
- xfree (ke);
- close (fd);
- continue;
- }
- for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
- if (ISBITSET(ke->relbits, ke->max_rel))
- break;
- }
- if (ISBITSET (ev, EV_ABS))
- {
- int i;
+ if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
+ ke->keybits) < 0)
+ {
+ perror ("EVIOCGBIT EV_KEY");
+ xfree (ke);
+ close (fd);
+ return BadMatch;
+ }
+ }
+ if (ISBITSET (ev, EV_REL))
+ {
+ if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
+ ke->relbits) < 0)
+ {
+ perror ("EVIOCGBIT EV_REL");
+ xfree (ke);
+ close (fd);
+ return BadMatch;
+ }
+ for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
+ if (ISBITSET(ke->relbits, ke->max_rel))
+ break;
+ }
+ if (ISBITSET (ev, EV_ABS))
+ {
+ int i;
- if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
- ke->absbits) < 0)
- {
- perror ("EVIOCGBIT EV_ABS");
- xfree (ke);
- close (fd);
- continue;
- }
- for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
- if (ISBITSET(ke->absbits, ke->max_abs))
- break;
- for (i = 0; i <= ke->max_abs; i++)
- {
- if (ISBITSET (ke->absbits, i))
- if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
- {
- perror ("EVIOCGABS");
- break;
- }
- ke->prevabs[i] = ABS_UNSET;
- }
- if (i <= ke->max_abs)
- {
- xfree (ke);
- close (fd);
- continue;
- }
- }
- mi->driver = ke;
- mi->inputType = EvdevInputType;
- if (KdRegisterFd (EvdevInputType, fd, EvdevRead, (void *) mi))
- n++;
- }
+ if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
+ ke->absbits) < 0)
+ {
+ perror ("EVIOCGBIT EV_ABS");
+ xfree (ke);
+ close (fd);
+ return BadMatch;
+ }
+ for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
+ if (ISBITSET(ke->absbits, ke->max_abs))
+ break;
+ for (i = 0; i <= ke->max_abs; i++)
+ {
+ if (ISBITSET (ke->absbits, i))
+ if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
+ {
+ perror ("EVIOCGABS");
+ break;
+ }
+ ke->prevabs[i] = ABS_UNSET;
+ }
+ if (i <= ke->max_abs)
+ {
+ xfree (ke);
+ close (fd);
+ return BadValue;
+ }
+ }
+ if (!KdRegisterFd (fd, EvdevRead, pi)) {
+ xfree (ke);
+ close (fd);
+ return BadAlloc;
}
- return TRUE;
+ pi->driverPrivate = ke;
+ return Success;
}
static void
-EvdevFini (void)
+EvdevDisable (KdPointerInfo *pi)
{
- KdMouseInfo *mi;
+ Kevdev *ke;
- KdUnregisterFds (EvdevInputType, TRUE);
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->inputType == EvdevInputType)
- {
- xfree (mi->driver);
- mi->driver = 0;
- mi->inputType = 0;
- }
- }
+ if (!pi || !pi->driverPrivate)
+ return;
+
+ KdUnregisterFd (pi, ke->fd, TRUE);
+ xfree (ke);
+ pi->driverPrivate = 0;
+}
+
+static void
+EvdevFini (KdPointerInfo *pi)
+{
}
-KdMouseFuncs LinuxEvdevMouseFuncs = {
+KdPointerDriver LinuxEvdevMouseDriver = {
+ "evdev",
EvdevInit,
+ EvdevEnable,
+ EvdevDisable,
EvdevFini,
+ NULL,
};
#if 0
diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
index cfafbb38f..b7571f66e 100644
--- a/hw/kdrive/linux/keyboard.c
+++ b/hw/kdrive/linux/keyboard.c
@@ -2,31 +2,40 @@
* $RCSId: xc/programs/Xserver/hw/kdrive/linux/keyboard.c,v 1.10 2001/11/08 10:26:24 keithp Exp $
*
* Copyright © 1999 Keith Packard
+ * XKB integration © 2006 Nokia Corporation, author: Tomas Frydrych <tf@o-hand.com>
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
+ * LinuxKeyboardRead() XKB code based on xf86KbdLnx.c:
+ * Copyright © 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ * Copyright © 1994-2001 by The XFree86 Project, Inc.
*
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "kdrive.h"
-#include "kkeymap.h"
#include <linux/keyboard.h>
#include <linux/kd.h>
#define XK_PUBLISHING
@@ -34,7 +43,7 @@
#include <termios.h>
#include <sys/ioctl.h>
-extern int LinuxConsoleFd;
+extern int LinuxConsoleFd;
static const KeySym linux_to_x[256] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
@@ -103,7 +112,108 @@ static const KeySym linux_to_x[256] = {
XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
};
-static unsigned char tbl[KD_MAX_WIDTH] =
+#ifdef XKB
+/*
+ * Getting a keycode from scancode
+ *
+ * With XKB
+ * --------
+ *
+ * We have to enqueue keyboard events using standard X keycodes which correspond
+ * to AT scancode + 8; this means that we need to translate the Linux scancode
+ * provided by the kernel to an AT scancode -- this translation is not linear
+ * and requires that we use a LUT.
+ *
+ *
+ * Without XKB
+ * -----------
+ *
+ * We can use custom keycodes, which makes things simpler; we define our custom
+ * keycodes as Linux scancodes + KD_KEY_OFFSET
+*/
+
+/*
+ This LUT translates AT scancodes into Linux ones -- the keymap we create
+ for the core X keyboard protocol has to be AT-scancode based so that it
+ corresponds to the Xkb keymap.
+*/
+static unsigned char at2lnx[] =
+{
+ 0x0, /* no valid scancode */
+ 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
+ 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
+ 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
+ 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
+ 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
+ 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
+ 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
+ 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
+ 0x11, /* KEY_W */ 0x12, /* KEY_E */
+ 0x13, /* KEY_R */ 0x14, /* KEY_T */
+ 0x15, /* KEY_Y */ 0x16, /* KEY_U */
+ 0x17, /* KEY_I */ 0x18, /* KEY_O */
+ 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
+ 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
+ 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
+ 0x1f, /* KEY_S */ 0x20, /* KEY_D */
+ 0x21, /* KEY_F */ 0x22, /* KEY_G */
+ 0x23, /* KEY_H */ 0x24, /* KEY_J */
+ 0x25, /* KEY_K */ 0x26, /* KEY_L */
+ 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
+ 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
+ 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
+ 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
+ 0x2f, /* KEY_V */ 0x30, /* KEY_B */
+ 0x31, /* KEY_N */ 0x32, /* KEY_M */
+ 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
+ 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
+ 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
+ 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
+ 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
+ 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
+ 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
+ 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
+ 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
+ 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
+ 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
+ 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
+ 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
+ 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
+ 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
+ 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
+ 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
+ 0x00, /* 0x55 */ 0x56, /* KEY_Less */
+ 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
+ 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
+ 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
+ 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
+ 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
+ 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
+ 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
+ 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
+ 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
+ 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
+ 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
+ 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
+ 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
+ 0x00, /* 0x71 */ 0x00, /* 0x72 */
+ 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
+ 0x00, /* 0x75 */ 0x00, /* 0x76 */
+ 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
+ 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
+ 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
+ 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
+ 0x00, /* 0x7f */
+};
+
+#define NUM_AT_KEYS (sizeof(at2lnx)/sizeof(at2lnx[0]))
+#define LNX_KEY_INDEX(n) n < NUM_AT_KEYS ? at2lnx[n] : 0
+
+#else /* not XKB */
+#define LNX_KEY_INDEX(n) n
+#endif
+
+static unsigned char tbl[KD_MAX_WIDTH] =
{
0,
1 << KG_SHIFT,
@@ -112,24 +222,31 @@ static unsigned char tbl[KD_MAX_WIDTH] =
};
static void
-readKernelMapping(void)
+readKernelMapping(KdKeyboardInfo *ki)
{
KeySym *k;
int i, j;
struct kbentry kbe;
int minKeyCode, maxKeyCode;
int row;
+ int fd;
+
+ if (!ki)
+ return;
+ fd = LinuxConsoleFd;
+
minKeyCode = NR_KEYS;
maxKeyCode = 0;
row = 0;
+ ki->keySyms.mapWidth = KD_MAX_WIDTH;
for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i)
{
- kbe.kb_index = i;
+ kbe.kb_index = LNX_KEY_INDEX(i);
- k = kdKeymap + row * KD_MAX_WIDTH;
+ k = ki->keySyms.map + row * ki->keySyms.mapWidth;
- for (j = 0; j < KD_MAX_WIDTH; ++j)
+ for (j = 0; j < ki->keySyms.mapWidth; ++j)
{
unsigned short kval;
@@ -137,7 +254,7 @@ readKernelMapping(void)
kbe.kb_table = tbl[j];
kbe.kb_value = 0;
- if (ioctl(LinuxConsoleFd, KDGKBENT, &kbe))
+ if (ioctl(fd, KDGKBENT, &kbe))
continue;
kval = KVAL(kbe.kb_value);
@@ -362,7 +479,7 @@ readKernelMapping(void)
if (minKeyCode == NR_KEYS)
continue;
-
+
if (k[3] == k[2]) k[3] = NoSymbol;
if (k[2] == k[1]) k[2] = NoSymbol;
if (k[1] == k[0]) k[1] = NoSymbol;
@@ -370,28 +487,223 @@ readKernelMapping(void)
if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] =NoSymbol;
row++;
}
- kdMinScanCode = minKeyCode;
- kdMaxScanCode = maxKeyCode;
+ ki->minScanCode = minKeyCode;
+ ki->maxScanCode = maxKeyCode;
}
-static void
-LinuxKeyboardLoad (void)
-{
- readKernelMapping ();
-}
+#ifdef XKB
+
+/*
+ * We need these to handle extended scancodes correctly (I could just use the
+ * numbers below, but this makes the code more readable
+ */
+
+/* The prefix codes */
+#define KEY_Prefix0 /* special 0x60 */ 96
+#define KEY_Prefix1 /* special 0x61 */ 97
+
+/* The raw scancodes */
+#define KEY_Enter /* Enter 0x1c */ 28
+#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
+#define KEY_Slash /* / (Slash) ? 0x35 */ 53
+#define KEY_KP_Multiply /* * 0x37 */ 55
+#define KEY_Alt /* Alt(left) 0x38 */ 56
+#define KEY_F3 /* F3 0x3d */ 61
+#define KEY_F4 /* F4 0x3e */ 62
+#define KEY_F5 /* F5 0x3f */ 63
+#define KEY_F6 /* F6 0x40 */ 64
+#define KEY_F7 /* F7 0x41 */ 65
+#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
+#define KEY_KP_7 /* 7 Home 0x47 */ 71
+#define KEY_KP_8 /* 8 Up 0x48 */ 72
+#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
+#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
+#define KEY_KP_4 /* 4 Left 0x4b */ 75
+#define KEY_KP_5 /* 5 0x4c */ 76
+#define KEY_KP_6 /* 6 Right 0x4d */ 77
+#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
+#define KEY_KP_1 /* 1 End 0x4f */ 79
+#define KEY_KP_2 /* 2 Down 0x50 */ 80
+#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
+#define KEY_KP_0 /* 0 Insert 0x52 */ 82
+#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
+#define KEY_Home /* Home 0x59 */ 89
+#define KEY_Up /* Up 0x5a */ 90
+#define KEY_PgUp /* PgUp 0x5b */ 91
+#define KEY_Left /* Left 0x5c */ 92
+#define KEY_Begin /* Begin 0x5d */ 93
+#define KEY_Right /* Right 0x5e */ 94
+#define KEY_End /* End 0x5f */ 95
+#define KEY_Down /* Down 0x60 */ 96
+#define KEY_PgDown /* PgDown 0x61 */ 97
+#define KEY_Insert /* Insert 0x62 */ 98
+#define KEY_Delete /* Delete 0x63 */ 99
+#define KEY_KP_Enter /* Enter 0x64 */ 100
+#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
+#define KEY_Pause /* Pause 0x66 */ 102
+#define KEY_Print /* Print 0x67 */ 103
+#define KEY_KP_Divide /* Divide 0x68 */ 104
+#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
+#define KEY_Break /* Break 0x6a */ 106
+#define KEY_LMeta /* Left Meta 0x6b */ 107
+#define KEY_RMeta /* Right Meta 0x6c */ 108
+#define KEY_Menu /* Menu 0x6d */ 109
+#define KEY_F13 /* F13 0x6e */ 110
+#define KEY_F14 /* F14 0x6f */ 111
+#define KEY_F15 /* F15 0x70 */ 112
+#define KEY_F16 /* F16 0x71 */ 113
+#define KEY_F17 /* F17 0x72 */ 114
+#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
+
+#endif /* XKB */
+
static void
LinuxKeyboardRead (int fd, void *closure)
{
unsigned char buf[256], *b;
int n;
+ unsigned char prefix = 0, scancode = 0;
- while ((n = read (fd, buf, sizeof (buf))) > 0)
- {
+ while ((n = read (fd, buf, sizeof (buf))) > 0) {
b = buf;
- while (n--)
- {
- KdEnqueueKeyboardEvent (b[0] & 0x7f, b[0] & 0x80);
+ while (n--) {
+#ifdef XKB
+ if (!noXkbExtension) {
+ /*
+ * With xkb we use RAW mode for reading the console, which allows us
+ * process extended scancodes.
+ *
+ * See if this is a prefix extending the following keycode
+ */
+ if (!prefix && ((b[0] & 0x7f) == KEY_Prefix0))
+ {
+ prefix = KEY_Prefix0;
+#ifdef DEBUG
+ ErrorF("Prefix0");
+#endif
+ /* swallow this up */
+ b++;
+ continue;
+ }
+ else if (!prefix && ((b[0] & 0x7f) == KEY_Prefix1))
+ {
+ prefix = KEY_Prefix1;
+ ErrorF("Prefix1");
+ /* swallow this up */
+ b++;
+ continue;
+ }
+ scancode = b[0] & 0x7f;
+
+ switch (prefix) {
+ /* from xf86Events.c */
+ case KEY_Prefix0:
+ {
+#ifdef DEBUG
+ ErrorF("Prefix0 scancode: 0x%02x\n", scancode);
+#endif
+ switch (scancode) {
+ case KEY_KP_7:
+ scancode = KEY_Home; break; /* curs home */
+ case KEY_KP_8:
+ scancode = KEY_Up; break; /* curs up */
+ case KEY_KP_9:
+ scancode = KEY_PgUp; break; /* curs pgup */
+ case KEY_KP_4:
+ scancode = KEY_Left; break; /* curs left */
+ case KEY_KP_5:
+ scancode = KEY_Begin; break; /* curs begin */
+ case KEY_KP_6:
+ scancode = KEY_Right; break; /* curs right */
+ case KEY_KP_1:
+ scancode = KEY_End; break; /* curs end */
+ case KEY_KP_2:
+ scancode = KEY_Down; break; /* curs down */
+ case KEY_KP_3:
+ scancode = KEY_PgDown; break; /* curs pgdown */
+ case KEY_KP_0:
+ scancode = KEY_Insert; break; /* curs insert */
+ case KEY_KP_Decimal:
+ scancode = KEY_Delete; break; /* curs delete */
+ case KEY_Enter:
+ scancode = KEY_KP_Enter; break; /* keypad enter */
+ case KEY_LCtrl:
+ scancode = KEY_RCtrl; break; /* right ctrl */
+ case KEY_KP_Multiply:
+ scancode = KEY_Print; break; /* print */
+ case KEY_Slash:
+ scancode = KEY_KP_Divide; break; /* keyp divide */
+ case KEY_Alt:
+ scancode = KEY_AltLang; break; /* right alt */
+ case KEY_ScrollLock:
+ scancode = KEY_Break; break; /* curs break */
+ case 0x5b:
+ scancode = KEY_LMeta; break;
+ case 0x5c:
+ scancode = KEY_RMeta; break;
+ case 0x5d:
+ scancode = KEY_Menu; break;
+ case KEY_F3:
+ scancode = KEY_F13; break;
+ case KEY_F4:
+ scancode = KEY_F14; break;
+ case KEY_F5:
+ scancode = KEY_F15; break;
+ case KEY_F6:
+ scancode = KEY_F16; break;
+ case KEY_F7:
+ scancode = KEY_F17; break;
+ case KEY_KP_Plus:
+ scancode = KEY_KP_DEC; break;
+ /* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) */
+ case 0x2A:
+ case 0x36:
+ b++;
+ prefix = 0;
+ continue;
+ default:
+#ifdef DEBUG
+ ErrorF("Unreported Prefix0 scancode: 0x%02x\n",
+ scancode);
+#endif
+ /*
+ * "Internet" keyboards are generating lots of new
+ * codes. Let them pass. There is little consistency
+ * between them, so don't bother with symbolic names at
+ * this level.
+ */
+ scancode += 0x78;
+ }
+ break;
+ }
+
+ case KEY_Prefix1:
+ {
+ /* we do no handle these */
+#ifdef DEBUG
+ ErrorF("Prefix1 scancode: 0x%02x\n", scancode);
+#endif
+ b++;
+ prefix = 0;
+ continue;
+ }
+
+ default: /* should not happen*/
+ case 0: /* do nothing */
+#ifdef DEBUG
+ ErrorF("Plain scancode: 0x%02x\n", scancode);
+#endif
+ ;
+ }
+
+ prefix = 0;
+ }
+ /* without xkb we use mediumraw mode -- enqueue the scancode as is */
+ else
+#endif
+ scancode = b[0] & 0x7f;
+ KdEnqueueKeyboardEvent (closure, scancode, b[0] & 0x80);
b++;
}
}
@@ -399,19 +711,30 @@ LinuxKeyboardRead (int fd, void *closure)
static int LinuxKbdTrans;
static struct termios LinuxTermios;
-static int LinuxKbdType;
-static int
-LinuxKeyboardEnable (int fd, void *closure)
+static Status
+LinuxKeyboardEnable (KdKeyboardInfo *ki)
{
struct termios nTty;
unsigned char buf[256];
int n;
+ int fd;
+
+ if (!ki)
+ return !Success;
+
+ fd = LinuxConsoleFd;
+ ki->driverPrivate = (void *) fd;
ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
tcgetattr (fd, &LinuxTermios);
-
- ioctl(fd, KDSKBMODE, K_MEDIUMRAW);
+#ifdef XKB
+ if (!noXkbExtension)
+ ioctl(fd, KDSKBMODE, K_RAW);
+ else
+#else
+ ioctl(fd, KDSKBMODE, K_MEDIUMRAW);
+#endif
nTty = LinuxTermios;
nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
nTty.c_oflag = 0;
@@ -422,66 +745,64 @@ LinuxKeyboardEnable (int fd, void *closure)
cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600);
tcsetattr(fd, TCSANOW, &nTty);
+ /* Our kernel cleverly ignores O_NONBLOCK. Sigh. */
+#if 0
/*
* Flush any pending keystrokes
*/
while ((n = read (fd, buf, sizeof (buf))) > 0)
;
- return fd;
+#endif
+ KdRegisterFd (fd, LinuxKeyboardRead, ki);
+ return Success;
}
static void
-LinuxKeyboardDisable (int fd, void *closure)
+LinuxKeyboardDisable (KdKeyboardInfo *ki)
{
- ioctl(LinuxConsoleFd, KDSKBMODE, LinuxKbdTrans);
- tcsetattr(LinuxConsoleFd, TCSANOW, &LinuxTermios);
-}
+ int fd;
+
+ if (!ki)
+ return;
-static int
-LinuxKeyboardInit (void)
-{
- if (!LinuxKbdType)
- LinuxKbdType = KdAllocInputType ();
-
- KdRegisterFd (LinuxKbdType, LinuxConsoleFd, LinuxKeyboardRead, 0);
- LinuxKeyboardEnable (LinuxConsoleFd, 0);
- KdRegisterFdEnableDisable (LinuxConsoleFd,
- LinuxKeyboardEnable,
- LinuxKeyboardDisable);
- return 1;
-}
+ fd = (int) ki->driverPrivate;
-static void
-LinuxKeyboardFini (void)
-{
- LinuxKeyboardDisable (LinuxConsoleFd, 0);
- KdUnregisterFds (LinuxKbdType, FALSE);
+ KdUnregisterFd(ki, fd, FALSE);
+ ioctl(fd, KDSKBMODE, LinuxKbdTrans);
+ tcsetattr(fd, TCSANOW, &LinuxTermios);
}
-static void
-LinuxKeyboardLeds (int leds)
+static Status
+LinuxKeyboardInit (KdKeyboardInfo *ki)
{
- ioctl (LinuxConsoleFd, KDSETLED, leds & 7);
+ if (!ki)
+ return !Success;
+
+ if (ki->path)
+ xfree(ki->path);
+ ki->path = KdSaveString("console");
+ if (ki->name)
+ xfree(ki->name);
+ ki->name = KdSaveString("Linux console keyboard");
+
+ readKernelMapping (ki);
+
+ return Success;
}
static void
-LinuxKeyboardBell (int volume, int pitch, int duration)
+LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
{
- if (volume && pitch)
- {
- ioctl(LinuxConsoleFd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration *
- volume / 50) << 16));
+ if (!ki)
+ return;
- }
+ ioctl ((int)ki->driverPrivate, KDSETLED, leds & 7);
}
-KdKeyboardFuncs LinuxKeyboardFuncs = {
- LinuxKeyboardLoad,
- LinuxKeyboardInit,
- LinuxKeyboardLeds,
- LinuxKeyboardBell,
- LinuxKeyboardFini,
- 3,
+KdKeyboardDriver LinuxKeyboardDriver = {
+ "keyboard",
+ .Init = LinuxKeyboardInit,
+ .Enable = LinuxKeyboardEnable,
+ .Leds = LinuxKeyboardLeds,
+ .Disable = LinuxKeyboardDisable,
};
diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c
index be11ec539..c1fe185bd 100644
--- a/hw/kdrive/linux/linux.c
+++ b/hw/kdrive/linux/linux.c
@@ -373,26 +373,6 @@ LinuxEnable (void)
enabled = TRUE;
}
-static Bool
-LinuxSpecialKey (KeySym sym)
-{
- struct vt_stat vts;
- int con;
-
- if (XK_F1 <= sym && sym <= XK_F12)
- {
- con = sym - XK_F1 + 1;
- memset (&vts, '\0', sizeof (vts)); /* valgrind */
- ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
- if (con != vts.v_active && (vts.v_state & (1 << con)))
- {
- ioctl (LinuxConsoleFd, VT_ACTIVATE, con);
- return TRUE;
- }
- }
- return FALSE;
-}
-
static void
LinuxDisable (void)
{
@@ -456,6 +436,7 @@ LinuxFini (void)
}
}
close(LinuxConsoleFd); /* make the vt-manager happy */
+ LinuxConsoleFd = -1;
fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0);
if (fd >= 0)
{
@@ -468,13 +449,32 @@ LinuxFini (void)
return;
}
+void
+KdOsAddInputDrivers ()
+{
+ KdAddPointerDriver(&LinuxMouseDriver);
+ KdAddPointerDriver(&MsMouseDriver);
+ KdAddPointerDriver(&Ps2MouseDriver);
+#ifdef TSLIB
+ KdAddPointerDriver(&TsDriver);
+#endif
+ KdAddKeyboardDriver(&LinuxKeyboardDriver);
+}
+
+static void
+LinuxBell(int volume, int pitch, int duration)
+{
+ if (volume && pitch)
+ ioctl(LinuxConsoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration * volume / 50) << 16));
+}
+
KdOsFuncs LinuxFuncs = {
- LinuxInit,
- LinuxEnable,
- LinuxSpecialKey,
- LinuxDisable,
- LinuxFini,
- 0
+ .Init = LinuxInit,
+ .Enable = LinuxEnable,
+ .Disable = LinuxDisable,
+ .Fini = LinuxFini,
+ .Bell = LinuxBell,
};
void
diff --git a/hw/kdrive/linux/mouse.c b/hw/kdrive/linux/mouse.c
index 5fe997864..77ec3b37b 100644
--- a/hw/kdrive/linux/mouse.c
+++ b/hw/kdrive/linux/mouse.c
@@ -206,10 +206,10 @@ MouseWriteBytes (int fd, unsigned char *c, int n, int timeout)
typedef struct _kmouseProt {
char *name;
- Bool (*Complete) (KdMouseInfo *mi, unsigned char *ev, int ne);
- int (*Valid) (KdMouseInfo *mi, unsigned char *ev, int ne);
- Bool (*Parse) (KdMouseInfo *mi, unsigned char *ev, int ne);
- Bool (*Init) (KdMouseInfo *mi);
+ Bool (*Complete) (KdPointerInfo *pi, unsigned char *ev, int ne);
+ int (*Valid) (KdPointerInfo *pi, unsigned char *ev, int ne);
+ Bool (*Parse) (KdPointerInfo *pi, unsigned char *ev, int ne);
+ Bool (*Init) (KdPointerInfo *pi);
unsigned char headerMask, headerValid;
unsigned char dataMask, dataValid;
Bool tty;
@@ -238,9 +238,9 @@ typedef struct _kmouse {
unsigned long state; /* private per protocol, init to prot->state */
} Kmouse;
-static int mouseValid (KdMouseInfo *mi, unsigned char *ev, int ne)
+static int mouseValid (KdPointerInfo *pi, unsigned char *ev, int ne)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
const KmouseProt *prot = km->prot;
int i;
@@ -255,24 +255,24 @@ static int mouseValid (KdMouseInfo *mi, unsigned char *ev, int ne)
return 0;
}
-static Bool threeComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
+static Bool threeComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
{
return ne == 3;
}
-static Bool fourComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
+static Bool fourComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
{
return ne == 4;
}
-static Bool fiveComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
+static Bool fiveComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
{
return ne == 5;
}
-static Bool MouseReasonable (KdMouseInfo *mi, unsigned long flags, int dx, int dy)
+static Bool MouseReasonable (KdPointerInfo *pi, unsigned long flags, int dx, int dy)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
if (km->stage == MouseWorking)
return TRUE;
@@ -296,9 +296,9 @@ static Bool MouseReasonable (KdMouseInfo *mi, unsigned long flags, int dx, int d
/*
* Standard PS/2 mouse protocol
*/
-static Bool ps2Parse (KdMouseInfo *mi, unsigned char *ev, int ne)
+static Bool ps2Parse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
int dx, dy, dz;
unsigned long flags;
unsigned long flagsrelease = 0;
@@ -333,21 +333,21 @@ static Bool ps2Parse (KdMouseInfo *mi, unsigned char *ev, int ne)
if (ev[0] & 0x20)
dy -= 256;
dy = -dy;
- if (!MouseReasonable (mi, flags, dx, dy))
+ if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
{
- KdEnqueueMouseEvent (mi, flags, dx, dy);
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
if (flagsrelease)
{
flags &= ~flagsrelease;
- KdEnqueueMouseEvent (mi, flags, dx, dy);
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
}
}
return TRUE;
}
-static Bool ps2Init (KdMouseInfo *mi);
+static Bool ps2Init (KdPointerInfo *pi);
static const KmouseProt ps2Prot = {
"ps/2",
@@ -450,9 +450,9 @@ static unsigned char intelli_init[] = {
#define NINIT_INTELLI 3
static int
-ps2SkipInit (KdMouseInfo *mi, int ninit, Bool ret_next)
+ps2SkipInit (KdPointerInfo *pi, int ninit, Bool ret_next)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
int c = -1;
int skipping;
Bool waiting;
@@ -481,9 +481,9 @@ ps2SkipInit (KdMouseInfo *mi, int ninit, Bool ret_next)
}
static Bool
-ps2Init (KdMouseInfo *mi)
+ps2Init (KdPointerInfo *pi)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
int skipping;
Bool waiting;
int id;
@@ -499,7 +499,7 @@ ps2Init (KdMouseInfo *mi)
return FALSE;
skipping = 0;
waiting = FALSE;
- id = ps2SkipInit (mi, 0, TRUE);
+ id = ps2SkipInit (pi, 0, TRUE);
switch (id) {
case 3:
init = wheel_3button_init;
@@ -524,13 +524,13 @@ ps2Init (KdMouseInfo *mi)
* initialization string. Make sure any partial event is
* skipped
*/
- (void) ps2SkipInit (mi, ninit, FALSE);
+ (void) ps2SkipInit (pi, ninit, FALSE);
return TRUE;
}
-static Bool busParse (KdMouseInfo *mi, unsigned char *ev, int ne)
+static Bool busParse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
int dx, dy;
unsigned long flags;
@@ -543,10 +543,10 @@ static Bool busParse (KdMouseInfo *mi, unsigned char *ev, int ne)
flags |= KD_BUTTON_2;
if ((ev[0] & 1) == 0)
flags |= KD_BUTTON_3;
- if (!MouseReasonable (mi, flags, dx, dy))
+ if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
- KdEnqueueMouseEvent (mi, flags, dx, dy);
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
return TRUE;
}
@@ -561,9 +561,9 @@ static const KmouseProt busProt = {
* Standard MS serial protocol, three bytes
*/
-static Bool msParse (KdMouseInfo *mi, unsigned char *ev, int ne)
+static Bool msParse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
int dx, dy;
unsigned long flags;
@@ -576,10 +576,10 @@ static Bool msParse (KdMouseInfo *mi, unsigned char *ev, int ne)
dx = (signed char)(((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
dy = (signed char)(((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
- if (!MouseReasonable (mi, flags, dx, dy))
+ if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
- KdEnqueueMouseEvent (mi, flags, dx, dy);
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
return TRUE;
}
@@ -600,9 +600,9 @@ static const KmouseProt msProt = {
* first byte of a synchronized protocol stream and see if it's got
* any bits turned on that can't occur in that fourth byte
*/
-static Bool logiComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
+static Bool logiComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
if ((ev[0] & 0x40) == 0x40)
return ne == 3;
@@ -611,9 +611,9 @@ static Bool logiComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
return FALSE;
}
-static int logiValid (KdMouseInfo *mi, unsigned char *ev, int ne)
+static int logiValid (KdPointerInfo *pi, unsigned char *ev, int ne)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
const KmouseProt *prot = km->prot;
int i;
@@ -632,9 +632,9 @@ static int logiValid (KdMouseInfo *mi, unsigned char *ev, int ne)
return 0;
}
-static Bool logiParse (KdMouseInfo *mi, unsigned char *ev, int ne)
+static Bool logiParse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
int dx, dy;
unsigned long flags;
@@ -660,10 +660,10 @@ static Bool logiParse (KdMouseInfo *mi, unsigned char *ev, int ne)
flags |= km->state & (KD_BUTTON_1|KD_BUTTON_3);
}
- if (!MouseReasonable (mi, flags, dx, dy))
+ if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
- KdEnqueueMouseEvent (mi, flags, dx, dy);
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
return TRUE;
}
@@ -682,9 +682,9 @@ static const KmouseProt logiProt = {
/*
* Mouse systems protocol, 5 bytes
*/
-static Bool mscParse (KdMouseInfo *mi, unsigned char *ev, int ne)
+static Bool mscParse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
- Kmouse *km = mi->driver;
+ Kmouse *km = pi->driverPrivate;
int dx, dy;
unsigned long flags;
@@ -699,10 +699,10 @@ static Bool mscParse (KdMouseInfo *mi, unsigned char *ev, int ne)
dx = (signed char)(ev[1]) + (signed char)(ev[3]);
dy = - ((signed char)(ev[2]) + (signed char)(ev[4]));
- if (!MouseReasonable (mi, flags, dx, dy))
+ if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
- KdEnqueueMouseEvent (mi, flags, dx, dy);
+ KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
return TRUE;
}
@@ -810,8 +810,8 @@ MouseNextProtocol (Kmouse *km)
static void
MouseRead (int mousePort, void *closure)
{
- KdMouseInfo *mi = closure;
- Kmouse *km = mi->driver;
+ KdPointerInfo *pi = closure;
+ Kmouse *km = pi->driverPrivate;
unsigned char event[MAX_MOUSE];
int ne;
int c;
@@ -835,7 +835,7 @@ MouseRead (int mousePort, void *closure)
break;
}
event[ne++] = c;
- i = (*km->prot->Valid) (mi, event, ne);
+ i = (*km->prot->Valid) (pi, event, ne);
if (i != 0)
{
#ifdef DEBUG
@@ -867,9 +867,9 @@ MouseRead (int mousePort, void *closure)
}
else
{
- if ((*km->prot->Complete) (mi, event, ne))
+ if ((*km->prot->Complete) (pi, event, ne))
{
- if ((*km->prot->Parse) (mi, event, ne))
+ if ((*km->prot->Parse) (pi, event, ne))
{
switch (km->stage)
{
@@ -896,7 +896,7 @@ MouseRead (int mousePort, void *closure)
km->invalid = 0;
km->tested = 0;
km->valid = 0;
- if (km->prot->Init && !(*km->prot->Init) (mi))
+ if (km->prot->Init && !(*km->prot->Init) (pi))
km->stage = MouseBroken;
}
break;
@@ -923,9 +923,9 @@ MouseRead (int mousePort, void *closure)
int MouseInputType;
char *kdefaultMouse[] = {
+ "/dev/input/mice",
"/dev/mouse",
"/dev/psaux",
- "/dev/input/mice",
"/dev/adbmouse",
"/dev/ttyS0",
"/dev/ttyS1",
@@ -933,81 +933,97 @@ char *kdefaultMouse[] = {
#define NUM_DEFAULT_MOUSE (sizeof (kdefaultMouse) / sizeof (kdefaultMouse[0]))
-static Bool
-MouseInit (void)
+static Status
+MouseInit (KdPointerInfo *pi)
{
int i;
int fd;
Kmouse *km;
- KdMouseInfo *mi, *next;
- int n = 0;
- char *prot;
- if (!MouseInputType)
- MouseInputType = KdAllocInputType ();
-
- for (mi = kdMouseInfo; mi; mi = next)
- {
- next = mi->next;
- prot = mi->prot;
- if (mi->inputType)
- continue;
- if (!mi->name)
- {
- for (i = 0; i < NUM_DEFAULT_MOUSE; i++)
- {
- fd = open (kdefaultMouse[i], 2);
- if (fd >= 0)
- {
- mi->name = KdSaveString (kdefaultMouse[i]);
- break;
- }
- }
- }
- else
- fd = open (mi->name, 2);
+ if (!pi)
+ return BadImplementation;
+
+ if (!pi->path || strcmp(pi->path, "auto") == 0) {
+ for (i = 0; i < NUM_DEFAULT_MOUSE; i++) {
+ fd = open (kdefaultMouse[i], 2);
+ if (fd >= 0) {
+ pi->path = KdSaveString (kdefaultMouse[i]);
+ break;
+ }
+ }
+ }
+ else {
+ fd = open (pi->path, 2);
+ }
- if (fd >= 0)
- {
- km = (Kmouse *) xalloc (sizeof (Kmouse));
- if (km)
- {
- km->iob.fd = fd;
- km->iob.avail = km->iob.used = 0;
- km->prot = 0;
- km->i_prot = 0;
- km->tty = isatty (fd);
- mi->driver = km;
- mi->inputType = MouseInputType;
- MouseFirstProtocol (km, mi->prot);
- if (KdRegisterFd (MouseInputType, fd, MouseRead, (void *) mi))
- n++;
- }
- else
- close (fd);
- }
+ if (fd < 0)
+ return BadMatch;
+
+ close(fd);
+
+ km = (Kmouse *) xalloc (sizeof (Kmouse));
+ if (km) {
+ km->iob.avail = km->iob.used = 0;
+ MouseFirstProtocol(km, "exps/2");
+ km->i_prot = 0;
+ km->tty = isatty (fd);
+ km->iob.fd = -1;
+ pi->driverPrivate = km;
}
- return TRUE;
+ else {
+ close (fd);
+ return BadAlloc;
+ }
+
+ return Success;
}
-static void
-MouseFini (void)
+static Status
+MouseEnable (KdPointerInfo *pi)
{
- KdMouseInfo *mi;
+ Kmouse *km;
+
+ if (!pi || !pi->driverPrivate || !pi->path)
+ return BadImplementation;
- KdUnregisterFds (MouseInputType, TRUE);
- for (mi = kdMouseInfo; mi; mi = mi->next)
+ km = pi->driverPrivate;
+
+ km->iob.fd = open(pi->path, 2);
+ if (km->iob.fd < 0)
+ return BadMatch;
+
+ if (!KdRegisterFd (km->iob.fd, MouseRead, pi))
{
- if (mi->inputType == MouseInputType)
- {
- xfree (mi->driver);
- mi->driver = 0;
- mi->inputType = 0;
- }
+ close(km->iob.fd);
+ return BadAlloc;
}
+
+ return Success;
+}
+
+static void
+MouseDisable (KdPointerInfo *pi)
+{
+ Kmouse *km;
+ if (!pi || !pi->driverPrivate)
+ return;
+
+ km = pi->driverPrivate;
+ KdUnregisterFd (pi, km->iob.fd, TRUE);
+}
+
+static void
+MouseFini (KdPointerInfo *pi)
+{
+ xfree (pi->driverPrivate);
+ pi->driverPrivate = NULL;
}
-KdMouseFuncs LinuxMouseFuncs = {
+KdPointerDriver LinuxMouseDriver = {
+ "mouse",
MouseInit,
+ MouseEnable,
+ MouseDisable,
MouseFini,
+ NULL,
};
diff --git a/hw/kdrive/linux/ms.c b/hw/kdrive/linux/ms.c
index 7f046bdc3..e62cebc39 100644
--- a/hw/kdrive/linux/ms.c
+++ b/hw/kdrive/linux/ms.c
@@ -90,41 +90,50 @@ MsRead (int port, void *closure)
dy = (char)(((b[0] & 0x0C) << 4) | (b[2] & 0x3F));
n -= 3;
b += 3;
- KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
+ KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
}
}
}
-int MsInputType;
+static Status
+MsInit (KdPointerInfo *pi)
+{
+ if (!pi)
+ return BadImplementation;
+
+ if (!pi->path || strcmp(pi->path, "auto"))
+ pi->path = KdSaveString("/dev/mouse");
+ if (!pi->name)
+ pi->name = KdSaveString("Microsoft protocol mouse");
+
+ return Success;
+}
-static int
-MsInit (void)
+static Status
+MsEnable (KdPointerInfo *pi)
{
int port;
- char *device = "/dev/mouse";
struct termios t;
int ret;
- if (!MsInputType)
- MsInputType = KdAllocInputType ();
- port = open (device, O_RDWR | O_NONBLOCK);
+ port = open (pi->path, O_RDWR | O_NONBLOCK);
if(port < 0) {
- ErrorF("Couldn't open %s (%d)\n", device, (int)errno);
+ ErrorF("Couldn't open %s (%d)\n", pi->path, (int)errno);
return 0;
} else if (port == 0) {
ErrorF("Opening %s returned 0! Please complain to Keith.\n",
- device);
+ pi->path);
goto bail;
}
if(!isatty(port)) {
- ErrorF("%s is not a tty\n", device);
+ ErrorF("%s is not a tty\n", pi->path);
goto bail;
}
ret = tcgetattr(port, &t);
if(ret < 0) {
- ErrorF("Couldn't tcgetattr(%s): %d\n", device, errno);
+ ErrorF("Couldn't tcgetattr(%s): %d\n", pi->path, errno);
goto bail;
}
t.c_iflag &= ~ (IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
@@ -140,24 +149,36 @@ MsInit (void)
t.c_cc[VTIME] = 0;
ret = tcsetattr(port, TCSANOW, &t);
if(ret < 0) {
- ErrorF("Couldn't tcsetattr(%s): %d\n", device, errno);
+ ErrorF("Couldn't tcsetattr(%s): %d\n", pi->path, errno);
goto bail;
}
- if (KdRegisterFd (MsInputType, port, MsRead, (void *) 0))
- return 1;
+ if (KdRegisterFd (port, MsRead, pi))
+ return TRUE;
+ pi->driverPrivate = (void *)port;
+
+ return Success;
bail:
close(port);
- return 0;
+ return BadMatch;
+}
+
+static void
+MsDisable (KdPointerInfo *pi)
+{
+ KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
}
static void
-MsFini (void)
+MsFini (KdPointerInfo *pi)
{
- KdUnregisterFds (MsInputType, TRUE);
}
-KdMouseFuncs MsMouseFuncs = {
+KdPointerDriver MsMouseDriver = {
+ "ms",
MsInit,
- MsFini
+ MsEnable,
+ MsDisable,
+ MsFini,
+ NULL,
};
diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c
index b59dbfac7..5d523a210 100644
--- a/hw/kdrive/linux/ps2.c
+++ b/hw/kdrive/linux/ps2.c
@@ -112,42 +112,78 @@ Ps2Read (int ps2Port, void *closure)
dy = -dy;
n -= 3;
b += 3;
- KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
+ KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
}
}
}
-int Ps2InputType;
-
-static int
-Ps2Init (void)
+static Status
+Ps2Init (KdPointerInfo *pi)
{
- int i;
- int ps2Port;
- int n;
-
- if (!Ps2InputType)
- Ps2InputType = KdAllocInputType ();
- n = 0;
- for (i = 0; i < NUM_PS2_NAMES; i++)
- {
- ps2Port = open (Ps2Names[i], 0);
- if (ps2Port >= 0)
- {
- if (KdRegisterFd (Ps2InputType, ps2Port, Ps2Read, (void *) i))
- n++;
+ int ps2Port, i;
+
+ if (!pi->path) {
+ for (i = 0; i < NUM_PS2_NAMES; i++) {
+ ps2Port = open (Ps2Names[i], 0);
+ if (ps2Port >= 0) {
+ pi->path = KdSaveString (Ps2Names[i]);
+ break;
+ }
}
}
- return n;
+ else {
+ ps2Port = open (pi->path, 0);
+ }
+
+ if (ps2Port < 0)
+ return BadMatch;
+
+ close(ps2Port);
+ if (!pi->name)
+ pi->name = KdSaveString ("PS/2 Mouse");
+
+ return Success;
+}
+
+static Status
+Ps2Enable (KdPointerInfo *pi)
+{
+ int fd;
+
+ if (!pi)
+ return BadImplementation;
+
+ fd = open (pi->path, 0);
+ if (fd < 0)
+ return BadMatch;
+
+ if (!KdRegisterFd (fd, Ps2Read, pi)) {
+ close(fd);
+ return BadAlloc;
+ }
+
+ pi->driverPrivate = (void *)fd;
+
+ return Success;
+}
+
+
+static void
+Ps2Disable (KdPointerInfo *pi)
+{
+ KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
}
static void
-Ps2Fini (void)
+Ps2Fini (KdPointerInfo *pi)
{
- KdUnregisterFds (Ps2InputType, TRUE);
}
-KdMouseFuncs Ps2MouseFuncs = {
+KdPointerDriver Ps2MouseDriver = {
+ "ps2",
Ps2Init,
- Ps2Fini
+ Ps2Enable,
+ Ps2Disable,
+ Ps2Fini,
+ NULL,
};
diff --git a/hw/kdrive/linux/ts.c b/hw/kdrive/linux/ts.c
index 70c736117..701fdc891 100644
--- a/hw/kdrive/linux/ts.c
+++ b/hw/kdrive/linux/ts.c
@@ -75,7 +75,7 @@ TsReadBytes (int fd, char *buf, int len, int min)
static void
TsRead (int tsPort, void *closure)
{
- KdMouseInfo *mi = closure;
+ KdPointerInfo *pi = closure;
TS_EVENT event;
int n;
long x, y;
@@ -117,7 +117,7 @@ TsRead (int tsPort, void *closure)
lastx = 0;
lasty = 0;
}
- KdEnqueueMouseEvent (mi, flags, x, y);
+ KdEnqueuePointerEvent (pi, flags, x, y, 0);
}
}
@@ -129,95 +129,83 @@ char *TsNames[] = {
#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0]))
-int TsInputType;
-
-static int
-TsEnable (int fd, void *closure)
-{
- KdMouseInfo *mi = (KdMouseInfo *)closure;
-
- return open (mi->name, 0);
-}
-
-static void
-TsDisable (int fd, void *closure)
-{
- close (fd);
-}
-
-static int
-TsInit (void)
+static Status
+TsInit (KdPointerInfo *pi)
{
int i;
int fd;
- KdMouseInfo *mi, *next;
int n = 0;
- if (!TsInputType)
- TsInputType = KdAllocInputType ();
-
- for (mi = kdMouseInfo; mi; mi = next)
- {
- next = mi->next;
- if (mi->inputType)
- continue;
- if (!mi->name)
- {
- for (i = 0; i < NUM_TS_NAMES; i++)
- {
- fd = open (TsNames[i], 0);
- if (fd >= 0)
- {
- mi->name = KdSaveString (TsNames[i]);
- break;
- }
- }
- }
- else
- fd = open (mi->name, 0);
- if (fd >= 0)
- {
- struct h3600_ts_calibration cal;
- /*
- * Check to see if this is a touch screen
- */
- if (ioctl (fd, TS_GET_CAL, &cal) != -1)
- {
- mi->driver = (void *) fd;
- mi->inputType = TsInputType;
- if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi))
- {
- /* Set callbacks for vt switches etc */
- KdRegisterFdEnableDisable (fd, TsEnable, TsDisable);
-
- n++;
- }
- }
- else
- close (fd);
+ if (!pi->path || strcmp(pi->path, "auto") == 0) {
+ for (i = 0; i < NUM_TS_NAMES; i++) {
+ fd = open (TsNames[i], 0);
+ if (fd >= 0) {
+ pi->path = KdSaveString (TsNames[i]);
+ break;
+ }
}
}
+ else {
+ fd = open (pi->path, 0);
+ }
+
+ if (fd < 0) {
+ ErrorF("TsInit: Couldn't open %s\n", pi->path);
+ return BadMatch;
+ }
+ close(fd);
+
+ pi->name = KdSaveString("H3600 Touchscreen");
- return 0;
+ return Success;
}
-static void
-TsFini (void)
+static Status
+TsEnable (KdPointerInfo *pi)
{
- KdMouseInfo *mi;
+ int fd;
- KdUnregisterFds (TsInputType, TRUE);
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->inputType == TsInputType)
- {
- mi->driver = 0;
- mi->inputType = 0;
+ if (!pi || !pi->path)
+ return BadImplementation;
+
+ fd = open(pi->path, 0);
+
+ if (fd < 0) {
+ ErrorF("TsInit: Couldn't open %s\n", pi->path);
+ return BadMatch;
+ }
+
+ struct h3600_ts_calibration cal;
+ /*
+ * Check to see if this is a touch screen
+ */
+ if (ioctl (fd, TS_GET_CAL, &cal) != -1) {
+ mi->driverPrivate = (void *) fd;
+ if (!KdRegisterFd (fd, TsRead, (void *) mi)) {
+ close(fd);
+ return BadAlloc;
}
}
+ else {
+ ErrorF("TsEnable: %s is not a touchscreen\n", pi->path);
+ close (fd);
+ return BadMatch;
+ }
+
+ return Success;
+}
+
+static void
+TsFini (KdPointerInfo *pi)
+{
+ KdUnregisterFds (pi, (int)pi->driverPrivate, TRUE);
+ mi->driverPrivate = NULL;
}
-KdMouseFuncs TsFuncs = {
+KdPointerDriver TsDriver = {
TsInit,
- TsFini
+ TsEnable,
+ TsDisable,
+ TsFini,
+ NULL,
};
diff --git a/hw/kdrive/linux/tslib.c b/hw/kdrive/linux/tslib.c
index c4caff922..44b4b5413 100644
--- a/hw/kdrive/linux/tslib.c
+++ b/hw/kdrive/linux/tslib.c
@@ -1,6 +1,6 @@
/*
- * $RCSId: xc/programs/Xserver/hw/kdrive/linux/tslib.c,v 1.1 2002/11/01 22:27:49 keithp Exp $
- * TSLIB based touchscreen driver for TinyX
+ * TSLIB based touchscreen driver for KDrive
+ * Porting to new input API and event queueing by Daniel Stone.
* Derived from ts.c by Keith Packard
* Derived from ps2.c by Jim Gettys
*
@@ -8,66 +8,33 @@
* Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 MontaVista Software Inc.
* Copyright © 2005 OpenedHand Ltd.
+ * Copyright © 2006 Nokia Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard or Compaq not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard and Compaq makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
+ * documentation, and that the name of the authors and/or copyright holders
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. The authors and/or
+ * copyright holders make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
*
- * KEITH PACKARD AND COMPAQ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Michael Taht or MontaVista not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Michael Taht and Montavista make no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * MICHAEL TAHT AND MONTAVISTA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL EITHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Matthew Allum or OpenedHand not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Matthew Allum and OpenedHand make no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * MATTHEW ALLUM AND OPENEDHAND DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL EITHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * THE AUTHORS AND/OR COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL THE AUTHORS AND/OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifdef HAVE_CONFIG_H
+#ifdef HAVE_KDRIVE_CONFIG_H
#include <kdrive-config.h>
#endif
+
#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
@@ -77,186 +44,158 @@
#include "kdrive.h"
#include <sys/ioctl.h>
#include <tslib.h>
-
-static struct tsdev *tsDev = NULL;
-
-static char *TsNames[] = {
- NULL, /* set via TSLIB_TSDEVICE */
- "/dev/ts",
- "/dev/touchscreen/0",
+#include <dirent.h>
+#include <linux/input.h>
+
+struct TslibPrivate {
+ int fd;
+ int lastx, lasty;
+ struct tsdev *tsDev;
+ void (*raw_event_hook)(int x, int y, int pressure, void *closure);
+ void *raw_event_closure;
+ int phys_screen;
};
-#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0]))
-
-/* For XCalibrate extension */
-void (*tslib_raw_event_hook)(int x, int y, int pressure, void *closure);
-void *tslib_raw_event_closure;
-
-int TsInputType = 0;
-int KdTsPhyScreen = 0; /* XXX Togo .. */
static void
-TsRead (int tsPort, void *closure)
+TsRead (int fd, void *closure)
{
- KdMouseInfo *mi = closure;
- struct ts_sample event;
- long x, y;
- unsigned long flags;
-
- if (tslib_raw_event_hook)
- {
- /* XCalibrate Ext */
- if (ts_read_raw(tsDev, &event, 1) == 1)
- {
- tslib_raw_event_hook (event.x,
- event.y,
- event.pressure,
- tslib_raw_event_closure);
- }
- return;
- }
+ KdPointerInfo *pi = closure;
+ struct TslibPrivate *private = pi->driverPrivate;
+ struct ts_sample event;
+ long x = 0, y = 0;
+ unsigned long flags;
+
+ if (private->raw_event_hook) {
+ while (ts_read_raw(private->tsDev, &event, 1) == 1)
+ private->raw_event_hook (event.x, event.y, event.pressure,
+ private->raw_event_closure);
+ return;
+ }
- while (ts_read(tsDev, &event, 1) == 1)
- {
- flags = (event.pressure) ? KD_BUTTON_1 : 0;
- x = event.x;
- y = event.y;
-
- KdEnqueueMouseEvent (mi, flags, x, y);
- }
+ while (ts_read(private->tsDev, &event, 1) == 1) {
+ if (event.pressure) {
+ if (event.pressure > pi->dixdev->absolute->button_threshold)
+ flags = KD_BUTTON_8;
+ else
+ flags = KD_BUTTON_1;
+
+ /*
+ * Here we test for the touch screen driver actually being on the
+ * touch screen, if it is we send absolute coordinates. If not,
+ * then we send delta's so that we can track the entire vga screen.
+ */
+ if (KdCurScreen == private->phys_screen) {
+ x = event.x;
+ y = event.y;
+ } else {
+ flags |= KD_MOUSE_DELTA;
+ if ((private->lastx == 0) || (private->lasty == 0)) {
+ x = event.x;
+ y = event.y;
+ } else {
+ x = event.x - private->lastx;
+ y = event.y - private->lasty;
+ }
+ }
+ private->lastx = x;
+ private->lasty = y;
+ } else {
+ flags = 0;
+ x = private->lastx;
+ y = private->lasty;
+ }
+
+ KdEnqueuePointerEvent (pi, flags, x, y, event.pressure);
+ }
}
-static int
-TsLibOpen(char *dev)
+static Status
+TslibEnable (KdPointerInfo *pi)
{
- if(!(tsDev = ts_open(dev, 0)))
- return -1;
-
- if (ts_config(tsDev))
- return -1;
+ struct TslibPrivate *private = pi->driverPrivate;
+
+ private->holdThumbEvents = 1;
+ private->raw_event_hook = NULL;
+ private->raw_event_closure = NULL;
+ private->tsDev = ts_open(pi->path, 0);
+ private->fd = ts_fd(private->tsDev);
+ if (!private->tsDev || ts_config(private->tsDev) || private->fd < 0) {
+ ErrorF("[tslib/TslibEnable] failed to open %s\n", pi->path);
+ if (private->fd > 0);
+ close(private->fd);
+ return BadAlloc;
+ }
+ if (pi->dixdev && pi->dixdev->absolute &&
+ pi->dixdev->absolute->button_threshold == 0)
+ pi->dixdev->absolute->button_threshold = 115;
- return ts_fd(tsDev);
+ KdRegisterFd(private->fd, TsRead, pi);
+
+ return Success;
}
-static int
-TslibEnable (int not_needed_fd, void *closure)
-{
- KdMouseInfo *mi = closure;
- int fd = 0;
-
- if ((fd = TsLibOpen(mi->name)) == -1)
- ErrorF ("Unable to re-enable TSLib ( on %s )", mi->name);
-
- return fd;
-}
static void
-TslibDisable (int fd, void *closure)
+TslibDisable (KdPointerInfo *pi)
{
- if (tsDev)
- ts_close(tsDev);
- tsDev = NULL;
-}
+ struct TslibPrivate *private = pi->driverPrivate;
-static int
-TslibInit (void)
-{
- int i, j = 0;
- KdMouseInfo *mi, *next;
- int fd = 0;
- int req_type;
-
- if (!TsInputType)
- {
- TsInputType = KdAllocInputType ();
- KdParseMouse(0); /* allocate safe slot in kdMouseInfo */
- req_type = 0;
- }
- else req_type = TsInputType; /* is being re-inited */
-
- for (mi = kdMouseInfo; mi; mi = next)
- {
- next = mi->next;
-
- /* find a usuable slot */
- if (mi->inputType != req_type)
- continue;
-
- /* Check for tslib env var device setting */
- if ((TsNames[0] = getenv("TSLIB_TSDEVICE")) == NULL)
- j++;
-
- if (!mi->name)
- {
- for (i = j; i < NUM_TS_NAMES; i++)
- {
- fd = TsLibOpen(TsNames[i]);
-
- if (fd >= 0)
- {
- mi->name = KdSaveString (TsNames[i]);
- break;
- }
- }
- }
- else
- fd = TsLibOpen(mi->name);
-
- if (fd >= 0 && tsDev != NULL)
- {
- mi->driver = (void *) fd;
- mi->inputType = TsInputType;
-
- KdRegisterFd (TsInputType, fd, TsRead, (void *) mi);
-
- /* Set callbacks for vt switches etc */
- KdRegisterFdEnableDisable (fd, TslibEnable, TslibDisable);
-
- return TRUE;
- }
+ if (private->fd) {
+ KdUnregisterFd(pi, private->fd);
+ close(private->fd);
}
-
- ErrorF ("Failed to open TSLib device, tried ");
- for (i = j; i < NUM_TS_NAMES; i++)
- ErrorF ("%s ", TsNames[i]);
- ErrorF (".\n");
- if (!TsNames[0])
- ErrorF ("Try setting TSLIB_TSDEVICE to valid /dev entry?\n");
-
- if (fd > 0)
- close(fd);
-
- return FALSE;
+ if (private->tsDev)
+ ts_close(private->tsDev);
+ private->fd = 0;
+ private->tsDev = NULL;
}
-static void
-TslibFini (void)
+
+static Status
+TslibInit (KdPointerInfo *pi)
{
- KdMouseInfo *mi;
+ int fd = 0, i = 0;
+ char devpath[PATH_MAX], devname[TS_NAME_SIZE];
+ DIR *inputdir = NULL;
+ struct dirent *inputent = NULL;
+ struct tsdev *tsDev = NULL;
+ struct TslibPrivate *private = NULL;
+
+ if (!pi || !pi->dixdev)
+ return !Success;
+
+ pi->driverPrivate = (struct TslibPrivate *)
+ xcalloc(sizeof(struct TslibPrivate), 1);
+ if (!pi->driverPrivate)
+ return !Success;
+
+ private = pi->driverPrivate;
+ /* hacktastic */
+ private->phys_screen = 0;
+ pi->nAxes = 3;
+ pi->name = KdSaveString("Touchscreen");
+ pi->inputClass = KD_TOUCHSCREEN;
+
+ return Success;
+}
- KdUnregisterFds (TsInputType, TRUE);
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- if (mi->inputType == TsInputType)
- {
- if(mi->driver)
- {
- ts_close(tsDev);
- tsDev = NULL;
- }
- mi->driver = 0;
- /* If below is set to 0, then MouseInit() will trash it,
- * setting to 'mouse type' ( via server reset). Therefore
- * Leave it alone and work around in TslibInit() ( see
- * req_type ).
- */
- /* mi->inputType = 0; */
- }
+static void
+TslibFini (KdPointerInfo *pi)
+{
+ if (pi->driverPrivate) {
+ xfree(pi->driverPrivate);
+ pi->driverPrivate = NULL;
}
}
-KdMouseFuncs TsFuncs = {
+
+KdPointerDriver TsDriver = {
+ "tslib",
TslibInit,
- TslibFini
+ TslibEnable,
+ TslibDisable,
+ TslibFini,
+ NULL,
};
diff --git a/hw/kdrive/mach64/Makefile.am b/hw/kdrive/mach64/Makefile.am
index e924aef71..67712e262 100644
--- a/hw/kdrive/mach64/Makefile.am
+++ b/hw/kdrive/mach64/Makefile.am
@@ -30,8 +30,4 @@ MACH64_LIBS = \
Xmach64_LDADD = \
$(MACH64_LIBS) \
@KDRIVE_LIBS@ \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
-
-
-Xmach64_DEPENDENCIES = $(MACH64_LIBS)
+ @XSERVER_LIBS@
diff --git a/hw/kdrive/mach64/mach64stub.c b/hw/kdrive/mach64/mach64stub.c
index 60808c26d..f3fef3c12 100644
--- a/hw/kdrive/mach64/mach64stub.c
+++ b/hw/kdrive/mach64/mach64stub.c
@@ -56,7 +56,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/mga/Makefile.am b/hw/kdrive/mga/Makefile.am
index d8ebae920..ee0798915 100644
--- a/hw/kdrive/mga/Makefile.am
+++ b/hw/kdrive/mga/Makefile.am
@@ -7,10 +7,6 @@ bin_PROGRAMS = Xmga
noinst_LIBRARIES = libmga.a
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
libmga_a_SOURCES = \
mgadraw.c \
g400_composite.c \
@@ -29,9 +25,4 @@ MGA_LIBS = \
Xmga_LDADD = \
$(MGA_LIBS) \
@KDRIVE_LIBS@ \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
-
-Xmga_DEPENDENCIES = \
- libmga.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a
+ @XSERVER_LIBS@
diff --git a/hw/kdrive/mga/mgastub.c b/hw/kdrive/mga/mgastub.c
index ebb40fd19..5afbf7fcc 100644
--- a/hw/kdrive/mga/mgastub.c
+++ b/hw/kdrive/mga/mgastub.c
@@ -45,7 +45,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/neomagic/Makefile.am b/hw/kdrive/neomagic/Makefile.am
index 9f8e02919..9a1af990c 100644
--- a/hw/kdrive/neomagic/Makefile.am
+++ b/hw/kdrive/neomagic/Makefile.am
@@ -38,9 +38,3 @@ Xneomagic_LDADD = \
$(NEOMAGIC_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
-
-
-Xneomagic_DEPENDENCIES = \
- libneomagic.a \
- ${FBDEV_LIBS} \
- ${VESA_LIBS}
diff --git a/hw/kdrive/neomagic/neomagic.h b/hw/kdrive/neomagic/neomagic.h
index b91e81e8a..9b100051b 100644
--- a/hw/kdrive/neomagic/neomagic.h
+++ b/hw/kdrive/neomagic/neomagic.h
@@ -26,14 +26,10 @@
#include <backend.h>
#include "kxv.h"
#include "klinux.h"
+#include "vesa.h"
-#define DEBUG
-#ifdef DEBUG
-#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a)
-#else
-#define DBGOUT(fmt,a...)
-#endif
+#define DBGOUT DebugF
#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
diff --git a/hw/kdrive/neomagic/neomagicstub.c b/hw/kdrive/neomagic/neomagicstub.c
index 308f4a2c1..c7ec83b44 100644
--- a/hw/kdrive/neomagic/neomagicstub.c
+++ b/hw/kdrive/neomagic/neomagicstub.c
@@ -51,10 +51,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#ifdef TOUCHSCREEN
- KdAddMouseDriver (&TsFuncs);
-#endif
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/nvidia/Makefile.am b/hw/kdrive/nvidia/Makefile.am
index d7b26cfa1..67eff6961 100644
--- a/hw/kdrive/nvidia/Makefile.am
+++ b/hw/kdrive/nvidia/Makefile.am
@@ -7,10 +7,6 @@ bin_PROGRAMS = Xnvidia
noinst_LIBRARIES = libnvidia.a
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
# nvidiavideo.c
libnvidia_a_SOURCES = \
@@ -31,7 +27,3 @@ Xnvidia_LDADD = \
$(NVIDIA_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
-
-Xnvidia_DEPENDENCIES = \
- libnvidia.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a
diff --git a/hw/kdrive/nvidia/nvidiastub.c b/hw/kdrive/nvidia/nvidiastub.c
index ea2dd0f38..230941958 100644
--- a/hw/kdrive/nvidia/nvidiastub.c
+++ b/hw/kdrive/nvidia/nvidiastub.c
@@ -45,7 +45,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/pcmcia/pcmciastub.c b/hw/kdrive/pcmcia/pcmciastub.c
index c509553ce..a56d2cbe2 100644
--- a/hw/kdrive/pcmcia/pcmciastub.c
+++ b/hw/kdrive/pcmcia/pcmciastub.c
@@ -45,7 +45,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
extern pcmciaDisplayModeRec pcmciaDefaultModes[];
diff --git a/hw/kdrive/pm2/Makefile.am b/hw/kdrive/pm2/Makefile.am
index 24ef15042..a7b0f0088 100644
--- a/hw/kdrive/pm2/Makefile.am
+++ b/hw/kdrive/pm2/Makefile.am
@@ -25,8 +25,3 @@ Xpm2_LDADD = \
$(PM2_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
-
-
-Xpm2_DEPENDENCIES = \
- libpm2.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a
diff --git a/hw/kdrive/pm2/pm2stub.c b/hw/kdrive/pm2/pm2stub.c
index fe469515b..1f824b347 100644
--- a/hw/kdrive/pm2/pm2stub.c
+++ b/hw/kdrive/pm2/pm2stub.c
@@ -32,7 +32,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/r128/Makefile.am b/hw/kdrive/r128/Makefile.am
index da42af95f..eab80cce0 100644
--- a/hw/kdrive/r128/Makefile.am
+++ b/hw/kdrive/r128/Makefile.am
@@ -24,8 +24,3 @@ Xr128_LDADD = \
$(R128_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
-
-
-Xr128_DEPENDENCIES = \
- libr128.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a
diff --git a/hw/kdrive/r128/r128stub.c b/hw/kdrive/r128/r128stub.c
index 221648d9c..dbf3c0e82 100644
--- a/hw/kdrive/r128/r128stub.c
+++ b/hw/kdrive/r128/r128stub.c
@@ -48,7 +48,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/savage/s3stub.c b/hw/kdrive/savage/s3stub.c
index 41553e6e3..776f8dad2 100644
--- a/hw/kdrive/savage/s3stub.c
+++ b/hw/kdrive/savage/s3stub.c
@@ -60,12 +60,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
-#ifdef VXWORKS
- KdInitInput (&VxWorksMouseFuncs, &VxWorksKeyboardFuncs);
-#endif
-#ifdef linux
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
-#endif
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
extern int s3CpuTimeout;
diff --git a/hw/kdrive/sdl/Makefile.am b/hw/kdrive/sdl/Makefile.am
index cc3873ca8..f5abb86e8 100644
--- a/hw/kdrive/sdl/Makefile.am
+++ b/hw/kdrive/sdl/Makefile.am
@@ -5,14 +5,9 @@ INCLUDES = \
bin_PROGRAMS = Xsdl
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
Xsdl_SOURCES = sdl.c
Xsdl_LDADD = @KDRIVE_PURE_LIBS@ \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
- $(TSLIB_FLAG) \
@XSDL_LIBS@
diff --git a/hw/kdrive/sis300/Makefile.am b/hw/kdrive/sis300/Makefile.am
index 6a6e0bf80..98020745c 100644
--- a/hw/kdrive/sis300/Makefile.am
+++ b/hw/kdrive/sis300/Makefile.am
@@ -17,10 +17,6 @@ INCLUDES = \
bin_PROGRAMS = Xsis
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
noinst_LIBRARIES = libsis.a
libsis_a_SOURCES = \
@@ -42,5 +38,3 @@ Xsis_LDADD = \
$(SIS_LIBS) \
@KDRIVE_LIBS@ \
$(TSLIB_FLAG)
-
-Xsis_DEPENDENCIES = $(SIS_LIBS)
diff --git a/hw/kdrive/sis300/sis_stub.c b/hw/kdrive/sis300/sis_stub.c
index 7f2e48251..8a4c06c6c 100644
--- a/hw/kdrive/sis300/sis_stub.c
+++ b/hw/kdrive/sis300/sis_stub.c
@@ -53,7 +53,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput(int argc, char **argv)
{
- KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers();
+ KdInitInput();
}
void
diff --git a/hw/kdrive/sis530/sisstub.c b/hw/kdrive/sis530/sisstub.c
index a377dd518..2375f651b 100644
--- a/hw/kdrive/sis530/sisstub.c
+++ b/hw/kdrive/sis530/sisstub.c
@@ -53,7 +53,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/smi/Makefile.am b/hw/kdrive/smi/Makefile.am
index 86a9ea947..0fd9729fc 100644
--- a/hw/kdrive/smi/Makefile.am
+++ b/hw/kdrive/smi/Makefile.am
@@ -29,9 +29,3 @@ Xsmi_LDADD = \
$(SMI_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
-
-
-Xsmi_DEPENDENCIES = \
- libsmi.a \
- $(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a
diff --git a/hw/kdrive/smi/smistub.c b/hw/kdrive/smi/smistub.c
index e0f33fe6f..1db6708f2 100644
--- a/hw/kdrive/smi/smistub.c
+++ b/hw/kdrive/smi/smistub.c
@@ -47,7 +47,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am
index 53d50950d..20fae554a 100644
--- a/hw/kdrive/src/Makefile.am
+++ b/hw/kdrive/src/Makefile.am
@@ -24,7 +24,7 @@ libkdrive_a_SOURCES = \
kdrive.h \
kinfo.c \
kinput.c \
- kkeymap.h \
+ kkeymap.c \
kmap.c \
kmode.c \
knoop.c \
@@ -37,5 +37,4 @@ libkdrive_a_SOURCES = \
$(top_srcdir)/mi/miinitext.c
libkdrivestubs_a_SOURCES = \
- $(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/fb/fbcmap.c
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 52e56e90b..b6ac0b0cf 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -43,6 +43,12 @@
#include "dpmsproc.h"
#endif
+#ifdef HAVE_EXECINFO_H
+#include <execinfo.h>
+#endif
+
+#include <signal.h>
+
typedef struct _kdDepths {
CARD8 depth;
CARD8 bpp;
@@ -60,6 +66,8 @@ KdDepths kdDepths[] = {
#define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
+#define KD_DEFAULT_BUTTONS 5
+
int kdScreenPrivateIndex;
unsigned long kdGeneration;
@@ -76,6 +84,8 @@ Bool kdSwitchPending;
char *kdSwitchCmd;
DDXPointRec kdOrigin;
+static Bool kdCaughtSignal = FALSE;
+
/*
* Carry arguments from InitOutput through driver initialization
* to KdScreenInit
@@ -271,7 +281,7 @@ KdSuspend (void)
for (screen = card->screenList; screen; screen = screen->next)
if (screen->mynum == card->selected && screen->pScreen)
KdDisableScreen (screen->pScreen);
- if (card->driver)
+ if (card->driver && card->cfuncs->restore)
(*card->cfuncs->restore) (card);
}
KdDisableInput ();
@@ -285,7 +295,8 @@ KdDisableScreens (void)
KdSuspend ();
if (kdEnabled)
{
- (*kdOsFuncs->Disable) ();
+ if (kdOsFuncs->Disable)
+ (*kdOsFuncs->Disable) ();
kdEnabled = FALSE;
}
}
@@ -343,7 +354,8 @@ KdEnableScreens (void)
if (!kdEnabled)
{
kdEnabled = TRUE;
- (*kdOsFuncs->Enable) ();
+ if (kdOsFuncs->Enable)
+ (*kdOsFuncs->Enable) ();
}
KdResume ();
}
@@ -363,11 +375,15 @@ AbortDDX(void)
KdDisableScreens ();
if (kdOsFuncs)
{
- if (kdEnabled)
+ if (kdEnabled && kdOsFuncs->Disable)
(*kdOsFuncs->Disable) ();
- (*kdOsFuncs->Fini) ();
+ if (kdOsFuncs->Fini)
+ (*kdOsFuncs->Fini) ();
KdDoSwitchCmd ("stop");
}
+
+ if (kdCaughtSignal)
+ abort();
}
void
@@ -379,7 +395,7 @@ ddxGiveUp ()
Bool kdDumbDriver;
Bool kdSoftCursor;
-static char *
+char *
KdParseFindNext (char *cur, char *delim, char *save, char *last)
{
while (*cur && !strchr (delim, *cur))
@@ -560,97 +576,6 @@ KdSaveString (char *str)
return n;
}
-/*
- * Parse mouse information. Syntax:
- *
- * <device>,<nbutton>,<protocol>{,<option>}...
- *
- * options: {nmo} pointer mapping (e.g. {321})
- * 2button emulate middle button
- * 3button dont emulate middle button
- */
-
-void
-KdParseMouse (char *arg)
-{
- char save[1024];
- char delim;
- KdMouseInfo *mi;
- int i;
-
- mi = KdMouseInfoAdd ();
- if (!mi)
- return;
- mi->name = 0;
- mi->prot = 0;
- mi->emulateMiddleButton = kdEmulateMiddleButton;
- mi->transformCoordinates = !kdRawPointerCoordinates;
- mi->nbutton = 3;
- for (i = 0; i < KD_MAX_BUTTON; i++)
- mi->map[i] = i + 1;
-
- if (!arg)
- return;
- if (strlen (arg) >= sizeof (save))
- return;
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- return;
- mi->name = KdSaveString (save);
- if (delim != ',')
- return;
-
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (!save[0])
- return;
-
- if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
- {
- mi->nbutton = save[0] - '0';
- if (mi->nbutton > KD_MAX_BUTTON)
- {
- UseMsg ();
- return;
- }
- }
-
- if (!delim != ',')
- return;
-
- arg = KdParseFindNext (arg, ",", save, &delim);
-
- if (save[0])
- mi->prot = KdSaveString (save);
-
- while (delim == ',')
- {
- arg = KdParseFindNext (arg, ",", save, &delim);
- if (save[0] == '{')
- {
- char *s = save + 1;
- i = 0;
- while (*s && *s != '}')
- {
- if ('1' <= *s && *s <= '0' + mi->nbutton)
- mi->map[i] = *s - '0';
- else
- UseMsg ();
- s++;
- }
- }
- else if (!strcmp (save, "2button"))
- mi->emulateMiddleButton = TRUE;
- else if (!strcmp (save, "3button"))
- mi->emulateMiddleButton = FALSE;
- else if (!strcmp (save, "rawcoord"))
- mi->transformCoordinates = FALSE;
- else if (!strcmp (save, "transform"))
- mi->transformCoordinates = TRUE;
- else
- UseMsg ();
- }
-}
-
void
KdParseRgba (char *rgba)
{
@@ -736,6 +661,11 @@ KdProcessArgument (int argc, char **argv, int i)
kdDontZap = TRUE;
return 1;
}
+ if (!strcmp (argv[i], "-nozap"))
+ {
+ kdDontZap = TRUE;
+ return 1;
+ }
if (!strcmp (argv[i], "-3button"))
{
kdEmulateMiddleButton = FALSE;
@@ -785,14 +715,6 @@ KdProcessArgument (int argc, char **argv, int i)
UseMsg ();
return 2;
}
- if (!strcmp (argv[i], "-mouse"))
- {
- if ((i+1) < argc)
- KdParseMouse (argv[i+1]);
- else
- UseMsg ();
- return 2;
- }
if (!strcmp (argv[i], "-rgba"))
{
if ((i+1) < argc)
@@ -814,6 +736,20 @@ KdProcessArgument (int argc, char **argv, int i)
{
return 1;
}
+ if (!strcmp (argv[i], "-mouse") ||
+ !strcmp (argv[i], "-pointer")) {
+ if (i + 1 >= argc)
+ UseMsg();
+ KdAddConfigPointer(argv[i + 1]);
+ return 2;
+ }
+ if (!strcmp (argv[i], "-keybd")) {
+ if (i + 1 >= argc)
+ UseMsg();
+ KdAddConfigKeyboard(argv[i + 1]);
+ return 2;
+ }
+
#ifdef PSEUDO8
return p8ProcessArgument (argc, argv, i);
#else
@@ -835,7 +771,8 @@ KdOsInit (KdOsFuncs *pOsFuncs)
if (serverGeneration == 1)
{
KdDoSwitchCmd ("start");
- (*pOsFuncs->Init) ();
+ if (pOsFuncs->Init)
+ (*pOsFuncs->Init) ();
}
}
}
@@ -1420,6 +1357,39 @@ KdDepthToFb (ScreenPtr pScreen, int depth)
#endif
+#ifdef HAVE_BACKTRACE
+/* shamelessly ripped from xf86Events.c */
+void
+KdBacktrace (int signum)
+{
+ void *array[32]; /* more than 32 and you have bigger problems */
+ size_t size, i;
+ char **strings;
+
+ signal(signum, SIG_IGN);
+
+ size = backtrace (array, 32);
+ fprintf (stderr, "\nBacktrace (%d deep):\n", size);
+ strings = backtrace_symbols (array, size);
+ for (i = 0; i < size; i++)
+ fprintf (stderr, "%d: %s\n", i, strings[i]);
+ free (strings);
+
+ kdCaughtSignal = TRUE;
+ if (signum == SIGSEGV)
+ FatalError("Segmentation fault caught\n");
+ else if (signum > 0)
+ FatalError("Signal %d caught\n", signum);
+}
+#else
+void
+KdBacktrace (int signum)
+{
+ kdCaughtSignal = TRUE;
+ FatalError("Segmentation fault caught\n");
+}
+#endif
+
void
KdInitOutput (ScreenInfo *pScreenInfo,
int argc,
@@ -1427,6 +1397,12 @@ KdInitOutput (ScreenInfo *pScreenInfo,
{
KdCardInfo *card;
KdScreenInfo *screen;
+
+#ifdef COMPOSITE
+ /* kind of a hack: we want Composite enabled, but it's disabled per
+ * default. */
+ noCompositeExtension = FALSE;
+#endif
if (!kdCardInfo)
{
@@ -1464,6 +1440,8 @@ KdInitOutput (ScreenInfo *pScreenInfo,
for (card = kdCardInfo; card; card = card->next)
for (screen = card->screenList; screen; screen = screen->next)
KdAddScreen (pScreenInfo, screen, argc, argv);
+
+ signal(SIGSEGV, KdBacktrace);
}
#ifdef DPMSExtension
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index c371263d3..ced48d7a8 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -47,6 +47,10 @@
#include "shadow.h"
#include "randrstr.h"
+#ifdef XKB
+#include <X11/extensions/XKBstr.h>
+#endif
+
extern WindowPtr *WindowTable;
#define KD_DPMS_NORMAL 0
@@ -63,6 +67,8 @@ extern WindowPtr *WindowTable;
#define KD_MAX_CARD_ADDRESS 8
#endif
+#define Status int
+
/*
* Configuration information per video card
*/
@@ -215,7 +221,7 @@ typedef struct {
#endif
} KdPrivScreenRec, *KdPrivScreenPtr;
-typedef enum _kdMouseState {
+typedef enum _kdPointerState {
start,
button_1_pend,
button_1_down,
@@ -226,51 +232,135 @@ typedef enum _kdMouseState {
synth_2_down_3,
synth_2_down_1,
num_input_states
-} KdMouseState;
-
-#define KD_MAX_BUTTON 7
-
-typedef struct _KdMouseInfo {
- struct _KdMouseInfo *next;
- void *driver;
- void *closure;
- char *name;
- char *prot;
- char map[KD_MAX_BUTTON];
- int nbutton;
- Bool emulateMiddleButton;
- unsigned long emulationTimeout;
- Bool timeoutPending;
- KdMouseState mouseState;
- Bool eventHeld;
- xEvent heldEvent;
- unsigned char buttonState;
- int emulationDx, emulationDy;
- int inputType;
- Bool transformCoordinates;
-} KdMouseInfo;
-
-extern KdMouseInfo *kdMouseInfo;
+} KdPointerState;
+
+#define KD_MAX_BUTTON 32
+
+#define KD_KEYBOARD 1
+#define KD_MOUSE 2
+#define KD_TOUCHSCREEN 3
+
+typedef struct _KdPointerInfo KdPointerInfo;
+
+typedef struct _KdPointerDriver {
+ char *name;
+ Status (*Init) (KdPointerInfo *);
+ Status (*Enable) (KdPointerInfo *);
+ void (*Disable) (KdPointerInfo *);
+ void (*Fini) (KdPointerInfo *);
+ struct _KdPointerDriver *next;
+} KdPointerDriver;
+
+struct _KdPointerInfo {
+ DeviceIntPtr dixdev;
+ char *name;
+ char *path;
+ InputOption *options;
+ int inputClass;
+
+ CARD8 map[KD_MAX_BUTTON + 1];
+ int nButtons;
+ int nAxes;
+
+ Bool emulateMiddleButton;
+ unsigned long emulationTimeout;
+ int emulationDx, emulationDy;
+
+ Bool timeoutPending;
+ KdPointerState mouseState;
+ Bool eventHeld;
+ struct {
+ int type;
+ int x;
+ int y;
+ int z;
+ int flags;
+ int absrel;
+ } heldEvent;
+ unsigned char buttonState;
+ Bool transformCoordinates;
+ int pressureThreshold;
+
+ KdPointerDriver *driver;
+ void *driverPrivate;
+
+ struct _KdPointerInfo *next;
+};
extern int KdCurScreen;
-KdMouseInfo *KdMouseInfoAdd (void);
-void KdMouseInfoDispose (KdMouseInfo *mi);
-void KdParseMouse (char *);
+void KdAddPointerDriver (KdPointerDriver *driver);
+void KdRemovePointerDriver (KdPointerDriver *driver);
+KdPointerInfo *KdNewPointer (void);
+void KdFreePointer (KdPointerInfo *);
+int KdAddPointer (KdPointerInfo *ki);
+int KdAddConfigPointer (char *pointer);
+void KdRemovePointer (KdPointerInfo *ki);
-typedef struct _KdMouseFuncs {
- Bool (*Init) (void);
- void (*Fini) (void);
-} KdMouseFuncs;
-typedef struct _KdKeyboardFuncs {
- void (*Load) (void);
- int (*Init) (void);
- void (*Leds) (int);
- void (*Bell) (int, int, int);
- void (*Fini) (void);
- int LockLed;
-} KdKeyboardFuncs;
+#define KD_KEY_COUNT 248
+#define KD_MIN_KEYCODE 8
+#define KD_MAX_KEYCODE 255
+#define KD_MAX_WIDTH 4
+#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
+
+typedef struct {
+ KeySym modsym;
+ int modbit;
+} KdKeySymModsRec;
+
+extern const KeySym kdDefaultKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
+extern const int kdDefaultKeymapWidth;
+extern const CARD8 kdDefaultModMap[MAP_LENGTH];
+extern const KeySymsRec kdDefaultKeySyms;
+
+typedef struct _KdKeyboardInfo KdKeyboardInfo;
+
+typedef struct _KdKeyboardDriver {
+ char *name;
+ Bool (*Init) (KdKeyboardInfo *);
+ Bool (*Enable) (KdKeyboardInfo *);
+ void (*Leds) (KdKeyboardInfo *, int);
+ void (*Bell) (KdKeyboardInfo *, int, int, int);
+ void (*Disable) (KdKeyboardInfo *);
+ void (*Fini) (KdKeyboardInfo *);
+ struct _KdKeyboardDriver *next;
+} KdKeyboardDriver;
+
+struct _KdKeyboardInfo {
+ struct _KdKeyboardInfo *next;
+ DeviceIntPtr dixdev;
+ void *closure;
+ char *name;
+ char *path;
+ int inputClass;
+#ifdef XKB
+ XkbDescPtr xkb;
+#endif
+ int LockLed;
+
+ CARD8 keyState[KD_KEY_COUNT/8];
+ int minScanCode;
+ int maxScanCode;
+ CARD8 modmap[MAP_LENGTH];
+ KeySymsRec keySyms;
+
+ int leds;
+ int bellPitch;
+ int bellDuration;
+ InputOption *options;
+
+ KdKeyboardDriver *driver;
+ void *driverPrivate;
+};
+
+void KdAddKeyboardDriver (KdKeyboardDriver *driver);
+void KdRemoveKeyboardDriver (KdKeyboardDriver *driver);
+KdKeyboardInfo *KdNewKeyboard (void);
+void KdFreeKeyboard (KdKeyboardInfo *ki);
+int KdAddConfigKeyboard (char *pointer);
+int KdAddKeyboard (KdKeyboardInfo *ki);
+void KdRemoveKeyboard (KdKeyboardInfo *ki);
typedef struct _KdOsFuncs {
int (*Init) (void);
@@ -279,6 +369,7 @@ typedef struct _KdOsFuncs {
void (*Disable) (void);
void (*Fini) (void);
void (*pollEvents) (void);
+ void (*Bell) (int, int, int);
} KdOsFuncs;
typedef enum _KdSyncPolarity {
@@ -307,9 +398,9 @@ typedef struct _KdMonitorTiming {
extern const KdMonitorTiming kdMonitorTimings[];
extern const int kdNumMonitorTimings;
-typedef struct _KdMouseMatrix {
+typedef struct _KdPointerMatrix {
int matrix[2][3];
-} KdMouseMatrix;
+} KdPointerMatrix;
typedef struct _KaaTrapezoid {
float tl, tr, ty;
@@ -628,8 +719,14 @@ KdParseScreen (KdScreenInfo *screen,
char *
KdSaveString (char *str);
-void
-KdParseMouse (char *arg);
+KdPointerInfo *
+KdParsePointer (char *arg);
+
+KdKeyboardInfo *
+KdParseKeyboard (char *arg);
+
+char *
+KdParseFindNext (char *cur, char *delim, char *save, char *last);
void
KdParseRgba (char *rgba);
@@ -643,6 +740,9 @@ KdProcessArgument (int argc, char **argv, int i);
void
KdOsInit (KdOsFuncs *pOsFuncs);
+void
+KdOsAddInputDrivers (void);
+
Bool
KdAllocatePrivates (ScreenPtr pScreen);
@@ -677,6 +777,9 @@ KdInitOutput (ScreenInfo *pScreenInfo,
void
KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr);
+
+void
+KdBacktrace (int signum);
/* kinfo.c */
KdCardInfo *
@@ -699,53 +802,54 @@ KdScreenInfoDispose (KdScreenInfo *si);
/* kinput.c */
void
-KdInitInput(KdMouseFuncs *, KdKeyboardFuncs *);
+KdInitInput(void);
void
-KdAddMouseDriver(KdMouseFuncs *);
+KdAddPointerDriver(KdPointerDriver *);
-int
-KdAllocInputType (void);
+void
+KdAddKeyboardDriver(KdKeyboardDriver *);
Bool
-KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure);
+KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure);
void
-KdRegisterFdEnableDisable (int fd,
- int (*enable) (int fd, void *closure),
- void (*disable) (int fd, void *closure));
+KdUnregisterFds (void *closure, Bool do_close);
void
-KdUnregisterFds (int type, Bool do_close);
+KdUnregisterFd (void *closure, int fd, Bool do_close);
void
-KdEnqueueKeyboardEvent(unsigned char scan_code,
- unsigned char is_up);
+KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, unsigned char scan_code,
+ unsigned char is_up);
#define KD_BUTTON_1 0x01
#define KD_BUTTON_2 0x02
#define KD_BUTTON_3 0x04
#define KD_BUTTON_4 0x08
#define KD_BUTTON_5 0x10
+#define KD_BUTTON_8 0x80
#define KD_MOUSE_DELTA 0x80000000
void
-KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int x, int y);
+KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
+ int rz);
void
-KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y);
+_KdEnqueuePointerEvent(KdPointerInfo *pi, int type, int x, int y, int z,
+ int b, int absrel, Bool force);
void
KdReleaseAllKeys (void);
void
-KdSetLed (int led, Bool on);
+KdSetLed (KdKeyboardInfo *ki, int led, Bool on);
void
-KdSetMouseMatrix (KdMouseMatrix *matrix);
+KdSetPointerMatrix (KdPointerMatrix *pointer);
void
-KdComputeMouseMatrix (KdMouseMatrix *matrix, Rotation randr, int width, int height);
+KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height);
void
KdBlockHandler (int screen,
@@ -768,19 +872,23 @@ KdEnableInput (void);
void
ProcessInputEvents (void);
-extern KdMouseFuncs LinuxMouseFuncs;
-extern KdMouseFuncs LinuxEvdevFuncs;
-extern KdMouseFuncs Ps2MouseFuncs;
-extern KdMouseFuncs BusMouseFuncs;
-extern KdMouseFuncs MsMouseFuncs;
-#ifdef TOUCHSCREEN
-extern KdMouseFuncs TsFuncs;
-#endif
-extern KdKeyboardFuncs LinuxKeyboardFuncs;
+void
+KdRingBell (KdKeyboardInfo *ki,
+ int volume,
+ int pitch,
+ int duration);
+
+extern KdPointerDriver LinuxMouseDriver;
+extern KdPointerDriver LinuxEvdevDriver;
+extern KdPointerDriver Ps2MouseDriver;
+extern KdPointerDriver BusMouseDriver;
+extern KdPointerDriver MsMouseDriver;
+extern KdPointerDriver TsDriver;
+extern KdKeyboardDriver LinuxKeyboardDriver;
extern KdOsFuncs LinuxFuncs;
-extern KdMouseFuncs VxWorksMouseFuncs;
-extern KdKeyboardFuncs VxWorksKeyboardFuncs;
+extern KdPointerDriver VxWorksMouseDriver;
+extern KdKeyboardDriver VxWorksKeyboardDriver;
extern KdOsFuncs VxWorksFuncs;
/* kmap.c */
diff --git a/hw/kdrive/src/kinfo.c b/hw/kdrive/src/kinfo.c
index 3ba7687c2..1e03ac8a2 100644
--- a/hw/kdrive/src/kinfo.c
+++ b/hw/kdrive/src/kinfo.c
@@ -101,7 +101,7 @@ KdScreenInfoDispose (KdScreenInfo *si)
KdCardInfo *ci = si->card;
KdScreenInfo **prev;
- for (prev = &ci->screenList; *prev; prev = &(*prev)->next)
+ for (prev = &ci->screenList; *prev; prev = &(*prev)->next) {
if (*prev == si)
{
*prev = si->next;
@@ -110,38 +110,67 @@ KdScreenInfoDispose (KdScreenInfo *si)
KdCardInfoDispose (ci);
break;
}
+ }
}
-KdMouseInfo *kdMouseInfo;
-
-KdMouseInfo *
-KdMouseInfoAdd (void)
+KdPointerInfo *
+KdNewPointer (void)
{
- KdMouseInfo *mi, **prev;
-
- mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
- if (!mi)
- return 0;
- bzero (mi, sizeof (KdMouseInfo));
- for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
- *prev = mi;
- return mi;
+ KdPointerInfo *pi;
+ int i;
+
+ pi = (KdPointerInfo *)xcalloc(1, sizeof(KdPointerInfo));
+ if (!pi)
+ return NULL;
+
+ pi->name = KdSaveString("Generic Pointer");
+ pi->path = NULL;
+ pi->inputClass = KD_MOUSE;
+ pi->driver = NULL;
+ pi->driverPrivate = NULL;
+ pi->next = NULL;
+ pi->options = NULL;
+ pi->nAxes = 3;
+ pi->nButtons = KD_MAX_BUTTON;
+ for (i = 1; i < KD_MAX_BUTTON; i++)
+ pi->map[i] = i;
+
+ return pi;
}
void
-KdMouseInfoDispose (KdMouseInfo *mi)
+KdFreePointer(KdPointerInfo *pi)
{
- KdMouseInfo **prev;
-
- for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
- if (*prev == mi)
- {
- *prev = mi->next;
- if (mi->name)
- xfree (mi->name);
- if (mi->prot)
- xfree (mi->prot);
- xfree (mi);
- break;
- }
+ InputOption *option, *prev = NULL;
+
+ if (pi->name)
+ xfree(pi->name);
+ if (pi->path)
+ xfree(pi->path);
+
+ for (option = pi->options; option; option = option->next) {
+ if (prev)
+ xfree(prev);
+ if (option->key)
+ xfree(option->key);
+ if (option->value)
+ xfree(option->value);
+ prev = option;
+ }
+
+ if (prev)
+ xfree(prev);
+
+ xfree(pi);
+}
+
+void
+KdFreeKeyboard(KdKeyboardInfo *ki)
+{
+ if (ki->name)
+ xfree(ki->name);
+ if (ki->path)
+ xfree(ki->path);
+ ki->next = NULL;
+ xfree(ki);
}
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index f671eb698..83da67f6c 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -2,20 +2,21 @@
* Id: kinput.c,v 1.1 1999/11/02 03:54:46 keithp Exp $
*
* Copyright © 1999 Keith Packard
+ * Copyright © 2006 Nokia Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
+ * documentation, and that the name of the authors not be used in
* advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
+ * specific, written prior permission. The authors make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
@@ -34,7 +35,6 @@
#if HAVE_X11_XF86KEYSYM_H
#include <X11/XF86keysym.h>
#endif
-#include "kkeymap.h"
#include <signal.h>
#include <stdio.h>
#ifdef sun
@@ -45,58 +45,61 @@
#include <X11/extensions/XKBsrv.h>
#endif
-static DeviceIntPtr pKdKeyboard, pKdPointer;
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h" /* even though we don't use stubs. cute, no? */
+#include "exevents.h"
+#include "extinit.h"
+#include "exglobals.h"
-#define MAX_MOUSE_DRIVERS 4
+#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
+
+struct KdConfigDevice {
+ char *line;
+ struct KdConfigDevice *next;
+};
+
+/* kdKeyboards and kdPointers hold all the real devices. */
+static KdKeyboardInfo *kdKeyboards = NULL;
+static KdPointerInfo *kdPointers = NULL;
+static struct KdConfigDevice *kdConfigKeyboards = NULL;
+static struct KdConfigDevice *kdConfigPointers = NULL;
+
+static KdKeyboardDriver *kdKeyboardDrivers = NULL;
+static KdPointerDriver *kdPointerDrivers = NULL;
+
+static xEvent *kdEvents = NULL;
-static KdMouseFuncs *kdMouseFuncs[MAX_MOUSE_DRIVERS];
-static int kdNMouseFuncs;
-static KdKeyboardFuncs *kdKeyboardFuncs;
-static int kdBellPitch;
-static int kdBellDuration;
-static int kdLeds;
static Bool kdInputEnabled;
static Bool kdOffScreen;
static unsigned long kdOffScreenTime;
-static KdMouseMatrix kdMouseMatrix = {
+static KdPointerMatrix kdPointerMatrix = {
{ { 1, 0, 0 },
{ 0, 1, 0 } }
};
-int kdMouseButtonCount;
-int kdMinScanCode;
-int kdMaxScanCode;
-int kdMinKeyCode;
-int kdMaxKeyCode;
-int kdKeymapWidth = KD_MAX_WIDTH;
-KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
-CARD8 kdModMap[MAP_LENGTH];
-KeySymsRec kdKeySyms;
-
-
-void
-KdResetInputMachine (void);
+void KdResetInputMachine (void);
-#define KD_KEY_COUNT 248
-
-CARD8 kdKeyState[KD_KEY_COUNT/8];
-
-#define IsKeyDown(key) ((kdKeyState[(key) >> 3] >> ((key) & 7)) & 1)
+#define IsKeyDown(ki, key) ((ki->keyState[(key) >> 3] >> ((key) & 7)) & 1)
+#define KEYMAP(ki) (ki->dixdev->key->curKeySyms)
+#define KEYMAPDDX(ki) (ki->keySyms)
+#define KEYCOL1(ki, k) (KEYMAP(ki).map[((k)-(KEYMAP(ki).minKeyCode))*KEYMAP(ki).mapWidth])
+#define KEYCOL1DDX(ki, k) (KEYMAPDDX(ki).map[((k)-(KEYMAPDDX(ki).minKeyCode))*KEYMAPDDX(ki).mapWidth])
#define KD_MAX_INPUT_FDS 8
typedef struct _kdInputFd {
- int type;
- int fd;
- void (*read) (int fd, void *closure);
- int (*enable) (int fd, void *closure);
- void (*disable) (int fd, void *closure);
- void *closure;
+ int fd;
+ void (*read) (int fd, void *closure);
+ int (*enable) (int fd, void *closure);
+ void (*disable) (int fd, void *closure);
+ void *closure;
} KdInputFd;
-KdInputFd kdInputFds[KD_MAX_INPUT_FDS];
-int kdNumInputFds;
-int kdInputTypeSequence;
+static KdInputFd kdInputFds[KD_MAX_INPUT_FDS];
+static int kdNumInputFds;
+
+extern Bool kdRawPointerCoordinates;
static void
KdSigio (int sig)
@@ -127,8 +130,7 @@ KdUnblockSigio (void)
sigprocmask (SIG_UNBLOCK, &set, 0);
}
-#undef VERIFY_SIGIO
-#ifdef VERIFY_SIGIO
+#ifdef DEBUG_SIGIO
void
KdAssertSigioBlocked (char *where)
@@ -137,8 +139,10 @@ KdAssertSigioBlocked (char *where)
sigemptyset (&set);
sigprocmask (SIG_BLOCK, &set, &old);
- if (!sigismember (&old, SIGIO))
+ if (!sigismember (&old, SIGIO)) {
ErrorF ("SIGIO not blocked at %s\n", where);
+ KdBacktrace(0);
+ }
}
#else
@@ -155,6 +159,17 @@ static int kdnFds;
#define NOBLOCK FNDELAY
#endif
+void
+KdResetInputMachine (void)
+{
+ KdPointerInfo *pi;
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ pi->mouseState = start;
+ pi->eventHeld = FALSE;
+ }
+}
+
static void
KdNonBlockFd (int fd)
{
@@ -205,98 +220,132 @@ KdRemoveFd (int fd)
}
}
-int
-KdAllocInputType (void)
-{
- return ++kdInputTypeSequence;
-}
-
Bool
-KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure)
+KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure)
{
if (kdNumInputFds == KD_MAX_INPUT_FDS)
return FALSE;
- kdInputFds[kdNumInputFds].type = type;
kdInputFds[kdNumInputFds].fd = fd;
kdInputFds[kdNumInputFds].read = read;
kdInputFds[kdNumInputFds].enable = 0;
kdInputFds[kdNumInputFds].disable = 0;
kdInputFds[kdNumInputFds].closure = closure;
- ++kdNumInputFds;
+ kdNumInputFds++;
if (kdInputEnabled)
KdAddFd (fd);
return TRUE;
}
void
-KdRegisterFdEnableDisable (int fd,
- int (*enable) (int fd, void *closure),
- void (*disable) (int fd, void *closure))
-{
- int i;
-
- for (i = 0; i < kdNumInputFds; i++)
- if (kdInputFds[i].fd == fd)
- {
- kdInputFds[i].enable = enable;
- kdInputFds[i].disable = disable;
- break;
- }
-}
-
-void
-KdUnregisterFds (int type, Bool do_close)
+KdUnregisterFd (void *closure, int fd, Bool do_close)
{
int i, j;
- for (i = 0; i < kdNumInputFds;)
- {
- if (kdInputFds[i].type == type)
- {
+ for (i = 0; i < kdNumInputFds; i++) {
+ if (kdInputFds[i].closure == closure &&
+ (fd == -1 || kdInputFds[i].fd == fd)) {
if (kdInputEnabled)
KdRemoveFd (kdInputFds[i].fd);
if (do_close)
close (kdInputFds[i].fd);
- --kdNumInputFds;
+ kdNumInputFds--;
for (j = i; j < kdNumInputFds; j++)
kdInputFds[j] = kdInputFds[j+1];
+ break;
}
- else
- i++;
}
}
void
+KdUnregisterFds (void *closure, Bool do_close)
+{
+ KdUnregisterFd(closure, -1, do_close);
+}
+
+void
KdDisableInput (void)
{
- int i;
+ KdKeyboardInfo *ki;
+ KdPointerInfo *pi;
+ int found = 0, i = 0;
- KdBlockSigio ();
+ KdBlockSigio();
- for (i = 0; i < kdNumInputFds; i++)
- {
- KdRemoveFd (kdInputFds[i].fd);
- if (kdInputFds[i].disable)
- (*kdInputFds[i].disable) (kdInputFds[i].fd, kdInputFds[i].closure);
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->driver && ki->driver->Disable)
+ (*ki->driver->Disable) (ki);
+ }
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi->driver && pi->driver->Disable)
+ (*pi->driver->Disable) (pi);
+ }
+
+ if (kdNumInputFds) {
+ ErrorF("[KdDisableInput] Buggy drivers: still %d input fds left!",
+ kdNumInputFds);
+ i = 0;
+ while (i < kdNumInputFds) {
+ found = 0;
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki == kdInputFds[i].closure) {
+ ErrorF(" fd %d belongs to keybd driver %s\n",
+ kdInputFds[i].fd,
+ ki->driver && ki->driver->name ?
+ ki->driver->name : "(unnamed!)");
+ found = 1;
+ break;
+ }
+ }
+
+ if (found) {
+ i++;
+ continue;
+ }
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi == kdInputFds[i].closure) {
+ ErrorF(" fd %d belongs to pointer driver %s\n",
+ kdInputFds[i].fd,
+ pi->driver && pi->driver->name ?
+ pi->driver->name : "(unnamed!)");
+ break;
+ }
+ }
+
+ if (found) {
+ i++;
+ continue;
+ }
+
+ ErrorF(" fd %d not claimed by any active device!\n",
+ kdInputFds[i].fd);
+ KdUnregisterFd(kdInputFds[i].closure, kdInputFds[i].fd, TRUE);
+ }
}
+
kdInputEnabled = FALSE;
}
void
KdEnableInput (void)
{
- xEvent xE;
- int i;
+ xEvent xE;
+ KdKeyboardInfo *ki;
+ KdPointerInfo *pi;
kdInputEnabled = TRUE;
- for (i = 0; i < kdNumInputFds; i++)
- {
- KdNonBlockFd (kdInputFds[i].fd);
- if (kdInputFds[i].enable)
- kdInputFds[i].fd = (*kdInputFds[i].enable) (kdInputFds[i].fd, kdInputFds[i].closure);
- KdAddFd (kdInputFds[i].fd);
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->driver && ki->driver->Enable)
+ (*ki->driver->Enable) (ki);
}
-
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi->driver && pi->driver->Enable)
+ (*pi->driver->Enable) (pi);
+ }
+
/* reset screen saver */
xE.u.keyButtonPointer.time = GetTimeInMillis ();
NoticeEventTime (&xE);
@@ -304,84 +353,250 @@ KdEnableInput (void)
KdUnblockSigio ();
}
-static int
-KdMouseProc(DeviceIntPtr pDevice, int onoff)
+static KdKeyboardDriver *
+KdFindKeyboardDriver (char *name)
{
- BYTE map[KD_MAX_BUTTON];
- DevicePtr pDev = (DevicePtr)pDevice;
- int i;
+ KdKeyboardDriver *ret;
+
+ /* ask a stupid question ... */
+ if (!name)
+ return NULL;
+ for (ret = kdKeyboardDrivers; ret; ret = ret->next) {
+ if (strcmp(ret->name, name) == 0)
+ return ret;
+ }
+
+ return NULL;
+}
+
+static KdPointerDriver *
+KdFindPointerDriver (char *name)
+{
+ KdPointerDriver *ret;
+
+ /* ask a stupid question ... */
+ if (!name)
+ return NULL;
+
+ for (ret = kdPointerDrivers; ret; ret = ret->next) {
+ if (strcmp(ret->name, name) == 0)
+ return ret;
+ }
+
+ return NULL;
+}
+
+static int
+KdPointerProc(DeviceIntPtr pDevice, int onoff)
+{
+ DevicePtr pDev = (DevicePtr)pDevice;
+ KdPointerInfo *pi;
+ Atom xiclass;
+
if (!pDev)
return BadImplementation;
-
+
+ for (pi = kdPointers; pi; pi = pi->next) {
+ if (pi->dixdev && pi->dixdev->id == pDevice->id)
+ break;
+ }
+
+ if (!pi || !pi->dixdev || pi->dixdev->id != pDevice->id) {
+ ErrorF("[KdPointerProc] Failed to find pointer for device %d!\n",
+ pDevice->id);
+ return BadImplementation;
+ }
+
switch (onoff)
{
case DEVICE_INIT:
- for (i = 1; i <= kdMouseButtonCount; i++)
- map[i] = i;
- InitPointerDeviceStruct(pDev, map, kdMouseButtonCount,
- miPointerGetMotionEvents,
+#ifdef DEBUG
+ ErrorF("initialising pointer %s ...\n", pi->name);
+#endif
+ if (!pi->driver) {
+ if (!pi->driverPrivate) {
+ ErrorF("no driver specified for %s\n", pi->name);
+ return BadImplementation;
+ }
+
+ pi->driver = KdFindPointerDriver(pi->driverPrivate);
+ if (!pi->driver) {
+ ErrorF("Couldn't find pointer driver %s\n",
+ pi->driverPrivate ? (char *) pi->driverPrivate :
+ "(unnamed)");
+ return !Success;
+ }
+ xfree(pi->driverPrivate);
+ pi->driverPrivate = NULL;
+ }
+
+ if (!pi->driver->Init) {
+ ErrorF("no init function\n");
+ return BadImplementation;
+ }
+
+ if ((*pi->driver->Init) (pi) != Success) {
+ return !Success;
+ }
+
+ InitPointerDeviceStruct(pDev, pi->map, pi->nButtons,
+ GetMotionHistory,
(PtrCtrlProcPtr)NoopDDA,
- miPointerGetMotionBufferSize());
- break;
+ GetMotionHistorySize(), pi->nAxes);
+
+ if (pi->inputClass == KD_TOUCHSCREEN) {
+ InitAbsoluteClassDeviceStruct(pDevice);
+ xiclass = AtomFromName(XI_TOUCHSCREEN);
+ }
+ else {
+ xiclass = AtomFromName(XI_MOUSE);
+ }
+
+ AssignTypeAndName(pi->dixdev, xiclass,
+ pi->name ? pi->name : "Generic KDrive Pointer");
+
+ return Success;
case DEVICE_ON:
- pDev->on = TRUE;
- pKdPointer = pDevice;
- for (i = 0; i < kdNMouseFuncs; i++)
- (*kdMouseFuncs[i]->Init)();
- break;
+ if (pDev->on == TRUE)
+ return Success;
+
+ if (!pi->driver->Enable) {
+ ErrorF("no enable function\n");
+ return BadImplementation;
+ }
+
+ if ((*pi->driver->Enable) (pi) == Success) {
+ pDev->on = TRUE;
+ return Success;
+ }
+ else {
+ return BadImplementation;
+ }
+
+ return Success;
+
case DEVICE_OFF:
+ if (pDev->on == FALSE) {
+ return Success;
+ }
+
+ if (!pi->driver->Disable) {
+ return BadImplementation;
+ }
+ else {
+ (*pi->driver->Disable) (pi);
+ pDev->on = FALSE;
+ return Success;
+ }
+
+ return Success;
+
case DEVICE_CLOSE:
- if (pDev->on)
- {
- pDev->on = FALSE;
- pKdPointer = 0;
- for (i = 0; i < kdNMouseFuncs; i++)
- (*kdMouseFuncs[i]->Fini) ();
- }
- break;
+ if (pDev->on) {
+ if (!pi->driver->Disable) {
+ return BadImplementation;
+ }
+ (*pi->driver->Disable) (pi);
+ pDev->on = FALSE;
+ }
+
+ if (!pi->driver->Fini)
+ return BadImplementation;
+
+ (*pi->driver->Fini) (pi);
+
+ KdRemovePointer(pi);
+
+ return Success;
}
- return Success;
+
+ /* NOTREACHED */
+ return BadImplementation;
}
Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
static void
-KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
+KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something)
{
+ KeybdCtrl *ctrl = arg;
+ KdKeyboardInfo *ki = NULL;
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev && ki->dixdev->id == pDev->id)
+ break;
+ }
+
+ if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
+ return;
+
+ KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
+}
+
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
+ KdKeyboardInfo *ki = NULL;
+
+ if (kdOsFuncs->Bell) {
+ (*kdOsFuncs->Bell)(volume, pitch, duration);
+ }
+ else {
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev->coreEvents)
+ KdRingBell(ki, volume, pitch, duration);
+ }
+ }
+}
+
+void
+KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration)
+{
+ if (!ki || !ki->driver || !ki->driver->Bell)
+ return;
+
if (kdInputEnabled)
- (*kdKeyboardFuncs->Bell) (volume, kdBellPitch, kdBellDuration);
+ (*ki->driver->Bell) (ki, volume, pitch, duration);
}
static void
-KdSetLeds (void)
+KdSetLeds (KdKeyboardInfo *ki, int leds)
{
- if (kdInputEnabled)
- (*kdKeyboardFuncs->Leds) (kdLeds);
+ if (!ki || !ki->driver)
+ return;
+
+ if (kdInputEnabled) {
+ if (ki->driver->Leds)
+ (*ki->driver->Leds) (ki, leds);
+ }
}
void
-KdSetLed (int led, Bool on)
+KdSetLed (KdKeyboardInfo *ki, int led, Bool on)
{
- NoteLedState (pKdKeyboard, led, on);
- kdLeds = pKdKeyboard->kbdfeed->ctrl.leds;
- KdSetLeds ();
+ if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed)
+ return;
+
+ NoteLedState (ki->dixdev, led, on);
+ KdSetLeds (ki, ki->dixdev->kbdfeed->ctrl.leds);
}
void
-KdSetMouseMatrix (KdMouseMatrix *matrix)
+KdSetPointerMatrix (KdPointerMatrix *matrix)
{
- kdMouseMatrix = *matrix;
+ kdPointerMatrix = *matrix;
}
void
-KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height)
+KdComputePointerMatrix (KdPointerMatrix *m, Rotation randr, int width,
+ int height)
{
int x_dir = 1, y_dir = 1;
int i, j;
@@ -422,73 +637,25 @@ KdComputeMouseMatrix (KdMouseMatrix *m, Rotation randr, int width, int height)
static void
KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
{
- kdLeds = ctrl->leds;
- kdBellPitch = ctrl->bell_pitch;
- kdBellDuration = ctrl->bell_duration;
- KdSetLeds ();
-}
+ KdKeyboardInfo *ki;
-static int
-KdKeybdProc(DeviceIntPtr pDevice, int onoff)
-{
- Bool ret;
- DevicePtr pDev = (DevicePtr)pDevice;
-#ifdef XKB
- XkbComponentNamesRec names;
-#endif
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev && ki->dixdev->id == pDevice->id)
+ break;
+ }
- if (!pDev)
- return BadImplementation;
+ if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver)
+ return;
- switch (onoff)
- {
- case DEVICE_INIT:
- if (pDev != LookupKeyboardDevice())
- {
- return !Success;
- }
-#ifndef XKB
- ret = InitKeyboardDeviceStruct(pDev,
- &kdKeySyms,
- kdModMap,
- KdBell, KdKbdCtrl);
-#else
- memset(&names, 0, sizeof(XkbComponentNamesRec));
-
- XkbSetRulesDflts ("base", "pc101", "us", NULL, NULL);
- ret = XkbInitKeyboardDeviceStruct ((DeviceIntPtr) pDev,
- &names,
- &kdKeySyms,
- kdModMap,
- KdBell, KdKbdCtrl);
-#endif
- if (!ret)
- return BadImplementation;
- break;
- case DEVICE_ON:
- pDev->on = TRUE;
- pKdKeyboard = pDevice;
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Init) ();
- break;
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- pKdKeyboard = 0;
- if (pDev->on)
- {
- pDev->on = FALSE;
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Fini) ();
- }
- break;
- }
- return Success;
+ KdSetLeds(ki, ctrl->leds);
+ ki->bellPitch = ctrl->bell_pitch;
+ ki->bellDuration = ctrl->bell_duration;
}
extern KeybdCtrl defaultKeyboardControl;
static void
-KdInitAutoRepeats (void)
+KdInitAutoRepeats (KdKeyboardInfo *ki)
{
int key_code;
unsigned char mask;
@@ -499,7 +666,7 @@ KdInitAutoRepeats (void)
memset (repeats, '\0', 32);
for (key_code = KD_MIN_KEYCODE; key_code <= KD_MAX_KEYCODE; key_code++)
{
- if (!kdModMap[key_code])
+ if (!ki->modmap[key_code])
{
i = key_code >> 3;
mask = 1 << (key_code & 7);
@@ -525,7 +692,6 @@ const KdKeySymModsRec kdKeySymMods[] = {
{ XK_Hyper_L, Mod3Mask },
{ XK_Hyper_R, Mod3Mask },
{ XK_Mode_switch, Mod4Mask },
-#ifdef TOUCHSCREEN
/* PDA specific hacks */
#ifdef XF86XK_Start
{ XF86XK_Start, ControlMask },
@@ -538,13 +704,12 @@ const KdKeySymModsRec kdKeySymMods[] = {
#ifdef XF86XK_Calendar
{ XF86XK_Calendar, Mod3Mask }
#endif
-#endif
};
#define NUM_SYM_MODS (sizeof(kdKeySymMods) / sizeof(kdKeySymMods[0]))
static void
-KdInitModMap (void)
+KdInitModMap (KdKeyboardInfo *ki)
{
int key_code;
int row;
@@ -552,79 +717,579 @@ KdInitModMap (void)
KeySym *syms;
int i;
- width = kdKeySyms.mapWidth;
- for (key_code = kdMinKeyCode; key_code <= kdMaxKeyCode; key_code++)
+ width = ki->keySyms.mapWidth;
+ for (key_code = ki->keySyms.minKeyCode; key_code <= ki->keySyms.maxKeyCode; key_code++)
{
- kdModMap[key_code] = 0;
- syms = kdKeymap + (key_code - kdMinKeyCode) * width;
+ ki->modmap[key_code] = 0;
+ syms = ki->keySyms.map + (key_code - ki->keySyms.minKeyCode) * width;
for (row = 0; row < width; row++, syms++)
{
for (i = 0; i < NUM_SYM_MODS; i++)
{
if (*syms == kdKeySymMods[i].modsym)
- kdModMap[key_code] |= kdKeySymMods[i].modbit;
+ ki->modmap[key_code] |= kdKeySymMods[i].modbit;
}
}
}
}
+static int
+KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
+{
+ Bool ret;
+ DevicePtr pDev = (DevicePtr)pDevice;
+ KdKeyboardInfo *ki;
+ Atom xiclass;
+
+ if (!pDev)
+ return BadImplementation;
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ if (ki->dixdev && ki->dixdev->id == pDevice->id)
+ break;
+ }
+
+ if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id) {
+ return BadImplementation;
+ }
+
+ switch (onoff)
+ {
+ case DEVICE_INIT:
+#ifdef DEBUG
+ ErrorF("initialising keyboard %s\n", ki->name);
+#endif
+ if (!ki->driver) {
+ if (!ki->driverPrivate) {
+ ErrorF("no driver specified!\n");
+ return BadImplementation;
+ }
+
+ ki->driver = KdFindKeyboardDriver(ki->driverPrivate);
+ if (!ki->driver) {
+ ErrorF("Couldn't find keyboard driver %s\n",
+ ki->driverPrivate ? (char *) ki->driverPrivate :
+ "(unnamed)");
+ return !Success;
+ }
+ xfree(ki->driverPrivate);
+ ki->driverPrivate = NULL;
+ }
+
+ if (!ki->driver->Init) {
+ ErrorF("Keyboard %s: no init function\n", ki->name);
+ return BadImplementation;
+ }
+
+ if ((*ki->driver->Init) (ki) != Success) {
+ return !Success;
+ }
+
+ KdInitModMap(ki);
+ KdInitAutoRepeats(ki);
+
+#ifndef XKB
+ if (!noXkbExtension) {
+ memset(&names, 0, sizeof(XkbComponentNamesRec));
+ if (XkbInitialMap)
+ names.keymap = XkbInitialMap;
+
+ XkbSetRulesDflts ("base", "pc105", "us", NULL, NULL);
+ ret = XkbInitKeyboardDeviceStruct (pDevice,
+ &names,
+ &ki->keySyms,
+ ki->modmap,
+ KdBell, KdKbdCtrl);
+ }
+ else
+#endif
+ ret = InitKeyboardDeviceStruct(pDev,
+ &ki->keySyms,
+ ki->modmap,
+ KdBell, KdKbdCtrl);
+ if (!ret) {
+ ErrorF("Couldn't initialise keyboard %s\n", ki->name);
+ return BadImplementation;
+ }
+
+ xiclass = AtomFromName(XI_KEYBOARD);
+ AssignTypeAndName(pDevice, xiclass,
+ ki->name ? ki->name : "Generic KDrive Keyboard");
+
+ KdResetInputMachine();
+
+ return Success;
+
+ case DEVICE_ON:
+ if (pDev->on == TRUE)
+ return Success;
+
+ if (!ki->driver->Enable)
+ return BadImplementation;
+
+ if ((*ki->driver->Enable) (ki) != Success) {
+ return BadMatch;
+ }
+
+ pDev->on = TRUE;
+ return Success;
+
+ case DEVICE_OFF:
+ if (pDev->on == FALSE)
+ return Success;
+
+ if (!ki->driver->Disable)
+ return BadImplementation;
+
+ (*ki->driver->Disable) (ki);
+ pDev->on = FALSE;
+
+ return Success;
+
+ break;
+
+ case DEVICE_CLOSE:
+ if (pDev->on) {
+ if (!ki->driver->Disable)
+ return BadImplementation;
+
+ (*ki->driver->Disable) (ki);
+ pDev->on = FALSE;
+ }
+
+ if (!ki->driver->Fini)
+ return BadImplementation;
+
+ (*ki->driver->Fini) (ki);
+
+ KdRemoveKeyboard(ki);
+
+ return Success;
+ }
+
+ /* NOTREACHED */
+ return BadImplementation;
+}
+
+void
+KdAddPointerDriver (KdPointerDriver *driver)
+{
+ KdPointerDriver **prev;
+
+ if (!driver)
+ return;
+
+ for (prev = &kdPointerDrivers; *prev; prev = &(*prev)->next) {
+ if (*prev == driver)
+ return;
+ }
+ *prev = driver;
+}
+
void
-KdAddMouseDriver(KdMouseFuncs *pMouseFuncs)
+KdRemovePointerDriver (KdPointerDriver *driver)
{
- if (kdNMouseFuncs < MAX_MOUSE_DRIVERS)
- kdMouseFuncs[kdNMouseFuncs++] = pMouseFuncs;
+ KdPointerDriver *tmp;
+
+ if (!driver)
+ return;
+
+ /* FIXME remove all pointers using this driver */
+ for (tmp = kdPointerDrivers; tmp; tmp = tmp->next) {
+ if (tmp->next == driver)
+ tmp->next = driver->next;
+ }
+ if (tmp == driver)
+ tmp = NULL;
}
void
-KdInitInput(KdMouseFuncs *pMouseFuncs,
- KdKeyboardFuncs *pKeyboardFuncs)
+KdAddKeyboardDriver (KdKeyboardDriver *driver)
+{
+ KdKeyboardDriver **prev;
+
+ if (!driver)
+ return;
+
+ for (prev = &kdKeyboardDrivers; *prev; prev = &(*prev)->next) {
+ if (*prev == driver)
+ return;
+ }
+ *prev = driver;
+}
+
+void
+KdRemoveKeyboardDriver (KdKeyboardDriver *driver)
+{
+ KdKeyboardDriver *tmp;
+
+ if (!driver)
+ return;
+
+ /* FIXME remove all keyboards using this driver */
+ for (tmp = kdKeyboardDrivers; tmp; tmp = tmp->next) {
+ if (tmp->next == driver)
+ tmp->next = driver->next;
+ }
+ if (tmp == driver)
+ tmp = NULL;
+}
+
+KdKeyboardInfo *
+KdNewKeyboard (void)
+{
+ KdKeyboardInfo *ki = xcalloc(sizeof(KdKeyboardInfo), 1);
+
+ if (!ki)
+ return NULL;
+
+ ki->keySyms.map = (KeySym *)xcalloc(sizeof(KeySym),
+ KD_MAX_LENGTH *
+ kdDefaultKeySyms.mapWidth);
+ if (!ki->keySyms.map) {
+ xfree(ki);
+ return NULL;
+ }
+
+ memcpy(ki->keySyms.map, kdDefaultKeySyms.map,
+ sizeof(KeySym) * (KD_MAX_LENGTH * kdDefaultKeySyms.mapWidth));
+ ki->keySyms.minKeyCode = kdDefaultKeySyms.minKeyCode;
+ ki->keySyms.maxKeyCode = kdDefaultKeySyms.maxKeyCode;
+ ki->keySyms.mapWidth = kdDefaultKeySyms.mapWidth;
+ ki->minScanCode = 0;
+ ki->maxScanCode = 0;
+ ki->leds = 0;
+ ki->bellPitch = 1000;
+ ki->bellDuration = 200;
+ ki->next = NULL;
+ ki->options = NULL;
+
+ return ki;
+}
+
+int
+KdAddConfigKeyboard (char *keyboard)
+{
+ struct KdConfigDevice **prev, *new;
+
+ if (!keyboard)
+ return Success;
+
+ new = (struct KdConfigDevice *) xcalloc(sizeof(struct KdConfigDevice), 1);
+ if (!new)
+ return BadAlloc;
+
+ new->line = xstrdup(keyboard);
+ new->next = NULL;
+
+ for (prev = &kdConfigKeyboards; *prev; prev = &(*prev)->next);
+ *prev = new;
+
+ return Success;
+}
+
+int
+KdAddKeyboard (KdKeyboardInfo *ki)
{
- DeviceIntPtr pKeyboard, pPointer;
- KdMouseInfo *mi;
+ KdKeyboardInfo **prev;
+
+ if (!ki)
+ return !Success;
- if (!kdMouseInfo)
- KdParseMouse (0);
- kdMouseButtonCount = 0;
- for (mi = kdMouseInfo; mi; mi = mi->next)
+ ki->dixdev = AddInputDevice(KdKeyboardProc, TRUE);
+ if (!ki->dixdev) {
+ ErrorF("Couldn't register keyboard device %s\n",
+ ki->name ? ki->name : "(unnamed)");
+ return !Success;
+ }
+
+ RegisterOtherDevice(ki->dixdev);
+
+#ifdef DEBUG
+ ErrorF("added keyboard %s with dix id %d\n", ki->name, ki->dixdev->id);
+#endif
+
+ for (prev = &kdKeyboards; *prev; prev = &(*prev)->next);
+ *prev = ki;
+
+ return Success;
+}
+
+void
+KdRemoveKeyboard (KdKeyboardInfo *ki)
+{
+ KdKeyboardInfo **prev;
+
+ if (!ki)
+ return;
+
+ for (prev = &kdKeyboards; *prev; prev = &(*prev)->next) {
+ if (*prev == ki) {
+ *prev = ki->next;
+ break;
+ }
+ }
+
+ KdFreeKeyboard(ki);
+}
+
+int
+KdAddConfigPointer (char *pointer)
+{
+ struct KdConfigDevice **prev, *new;
+
+ if (!pointer)
+ return Success;
+
+ new = (struct KdConfigDevice *) xcalloc(sizeof(struct KdConfigDevice), 1);
+ if (!new)
+ return BadAlloc;
+
+ new->line = xstrdup(pointer);
+ new->next = NULL;
+
+ for (prev = &kdConfigPointers; *prev; prev = &(*prev)->next);
+ *prev = new;
+
+ return Success;
+}
+
+int
+KdAddPointer (KdPointerInfo *pi)
+{
+ KdPointerInfo **prev;
+
+ if (!pi)
+ return Success;
+
+ pi->mouseState = start;
+ pi->eventHeld = FALSE;
+
+ pi->dixdev = AddInputDevice(KdPointerProc, TRUE);
+ if (!pi->dixdev) {
+ ErrorF("Couldn't add pointer device %s\n",
+ pi->name ? pi->name : "(unnamed)");
+ return BadDevice;
+ }
+
+ RegisterOtherDevice(pi->dixdev);
+
+ for (prev = &kdPointers; *prev; prev = &(*prev)->next);
+ *prev = pi;
+
+ return Success;
+}
+
+void
+KdRemovePointer (KdPointerInfo *pi)
+{
+ KdPointerInfo **prev;
+
+ if (!pi)
+ return;
+
+ for (prev = &kdPointers; *prev; prev = &(*prev)->next) {
+ if (*prev == pi) {
+ *prev = pi->next;
+ break;
+ }
+ }
+
+ KdFreePointer(pi);
+}
+
+KdKeyboardInfo *
+KdParseKeyboard (char *arg)
+{
+ char save[1024];
+ char delim;
+ KdKeyboardInfo *ki = NULL;
+
+ ki = KdNewKeyboard();
+ if (!ki)
+ return NULL;
+
+ ki->name = strdup("Unknown KDrive Keyboard");
+ ki->path = NULL;
+ ki->driver = NULL;
+ ki->driverPrivate = NULL;
+#ifdef XKB
+ ki->xkb = NULL;
+#endif
+ ki->next = NULL;
+
+ if (!arg)
{
- if (mi->nbutton > kdMouseButtonCount)
- kdMouseButtonCount = mi->nbutton;
- }
-
- kdNMouseFuncs = 0;
- KdAddMouseDriver (pMouseFuncs);
- kdKeyboardFuncs = pKeyboardFuncs;
- memset (kdKeyState, '\0', sizeof (kdKeyState));
- if (kdKeyboardFuncs)
- (*kdKeyboardFuncs->Load) ();
- kdMinKeyCode = kdMinScanCode + KD_KEY_OFFSET;
- kdMaxKeyCode = kdMaxScanCode + KD_KEY_OFFSET;
- kdKeySyms.map = kdKeymap;
- kdKeySyms.minKeyCode = kdMinKeyCode;
- kdKeySyms.maxKeyCode = kdMaxKeyCode;
- kdKeySyms.mapWidth = kdKeymapWidth;
- kdLeds = 0;
- kdBellPitch = 1000;
- kdBellDuration = 200;
- kdInputEnabled = TRUE;
- KdInitModMap ();
- KdInitAutoRepeats ();
- KdResetInputMachine ();
- pPointer = AddInputDevice(KdMouseProc, TRUE);
- pKeyboard = AddInputDevice(KdKeybdProc, TRUE);
- RegisterPointerDevice(pPointer);
- RegisterKeyboardDevice(pKeyboard);
- miRegisterPointerDevice(screenInfo.screens[0], pPointer);
- mieqInit(&pKeyboard->public, &pPointer->public);
-#ifdef XINPUT
+ ErrorF("keybd: no arg\n");
+ KdFreeKeyboard (ki);
+ return NULL;
+ }
+
+ if (strlen (arg) >= sizeof (save))
{
- static long zero1, zero2;
+ ErrorF("keybd: arg too long\n");
+ KdFreeKeyboard (ki);
+ return NULL;
+ }
- //SetExtInputCheck (&zero1, &zero2);
- ErrorF("Extended Input Devices not yet supported. Impelement it at line %d in %s\n",
- __LINE__, __FILE__);
+ arg = KdParseFindNext (arg, ",", save, &delim);
+ if (!save[0])
+ {
+ ErrorF("keybd: failed on save[0]\n");
+ KdFreeKeyboard (ki);
+ return NULL;
}
-#endif
+
+ if (strcmp (save, "auto") == 0)
+ ki->driverPrivate = NULL;
+ else
+ ki->driverPrivate = xstrdup(save);
+
+ /* FIXME actually implement options */
+
+ return ki;
+}
+
+KdPointerInfo *
+KdParsePointer (char *arg)
+{
+ char save[1024];
+ char delim;
+ KdPointerInfo *pi = NULL;
+ InputOption *options = NULL, *newopt = NULL, **tmpo = NULL;
+ int i = 0;
+
+ pi = KdNewPointer();
+ if (!pi)
+ return NULL;
+ pi->emulateMiddleButton = kdEmulateMiddleButton;
+ pi->transformCoordinates = !kdRawPointerCoordinates;
+ pi->nButtons = 3;
+ pi->inputClass = KD_MOUSE;
+
+ if (!arg)
+ {
+ ErrorF("mouse: no arg\n");
+ KdFreePointer (pi);
+ return NULL;
+ }
+
+ if (strlen (arg) >= sizeof (save))
+ {
+ ErrorF("mouse: arg too long\n");
+ KdFreePointer (pi);
+ return NULL;
+ }
+ arg = KdParseFindNext (arg, ",", save, &delim);
+ if (!save[0])
+ {
+ ErrorF("failed on save[0]\n");
+ KdFreePointer (pi);
+ return NULL;
+ }
+
+ if (strcmp(save, "auto") == 0)
+ pi->driverPrivate = NULL;
+ else
+ pi->driverPrivate = xstrdup(save);
+
+ if (delim != ',')
+ {
+ return pi;
+ }
+
+ arg = KdParseFindNext (arg, ",", save, &delim);
+
+ while (delim == ',')
+ {
+ arg = KdParseFindNext (arg, ",", save, &delim);
+ if (save[0] == '{')
+ {
+ char *s = save + 1;
+ i = 0;
+ while (*s && *s != '}')
+ {
+ if ('1' <= *s && *s <= '0' + pi->nButtons)
+ pi->map[i] = *s - '0';
+ else
+ UseMsg ();
+ s++;
+ }
+ }
+ else if (!strcmp (save, "emulatemiddle"))
+ pi->emulateMiddleButton = TRUE;
+ else if (!strcmp (save, "noemulatemiddle"))
+ pi->emulateMiddleButton = FALSE;
+ else if (!strcmp (save, "transformcoord"))
+ pi->transformCoordinates = TRUE;
+ else if (!strcmp (save, "rawcoord"))
+ pi->transformCoordinates = FALSE;
+ else
+ {
+ newopt = (InputOption *) xalloc(sizeof (InputOption));
+ if (!newopt)
+ {
+ KdFreePointer(pi);
+ return NULL;
+ }
+ bzero(newopt, sizeof (InputOption));
+
+ for (tmpo = &options; *tmpo; tmpo = &(*tmpo)->next)
+ *tmpo = newopt;
+
+ if (strchr(arg, '='))
+ {
+ i = (strchr(arg, '=') - arg);
+ newopt->key = (char *)xalloc(i+1);
+ strncpy(newopt->key, arg, i+1);
+ newopt->value = xstrdup(strchr(arg, '=') + 1);
+ }
+ else
+ {
+ newopt->key = xstrdup(save);
+ newopt->value = NULL;
+ }
+ newopt->next = NULL;
+ }
+ }
+
+ if (options)
+ pi->options = options;
+
+ return pi;
+}
+
+
+void
+KdInitInput (void)
+{
+ KdPointerInfo *pi;
+ KdKeyboardInfo *ki;
+ struct KdConfigDevice *dev;
+
+ kdInputEnabled = TRUE;
+
+ for (dev = kdConfigPointers; dev; dev = dev->next) {
+ pi = KdParsePointer(dev->line);
+ if (!pi)
+ ErrorF("Failed to parse pointer\n");
+ if (KdAddPointer(pi) != Success)
+ ErrorF("Failed to add pointer!\n");
+ }
+ for (dev = kdConfigKeyboards; dev; dev = dev->next) {
+ ki = KdParseKeyboard(dev->line);
+ if (!ki)
+ ErrorF("Failed to parse keyboard\n");
+ if (KdAddKeyboard(ki) != Success)
+ ErrorF("Failed to add keyboard!\n");
+ }
+
+ if (!kdEvents)
+ kdEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!kdEvents)
+ FatalError("Couldn't allocate event buffer\n");
+
+ mieqInit();
}
/*
@@ -786,7 +1451,7 @@ typedef enum _inputAction {
typedef struct _inputTransition {
KdInputAction actions[MAX_ACTIONS];
- KdMouseState nextState;
+ KdPointerState nextState;
} KdInputTransition;
static const
@@ -931,32 +1596,22 @@ KdInputTransition kdInputMachine[num_input_states][num_input_class] = {
#define EMULATION_WINDOW 10
#define EMULATION_TIMEOUT 100
-#define EventX(e) ((e)->u.keyButtonPointer.rootX)
-#define EventY(e) ((e)->u.keyButtonPointer.rootY)
-
static int
-KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev)
+KdInsideEmulationWindow (KdPointerInfo *pi, int x, int y, int z)
{
- if (ev->u.keyButtonPointer.pad1)
- {
- mi->emulationDx += EventX(ev);
- mi->emulationDy += EventY(ev);
- }
- else
- {
- mi->emulationDx = EventX(&mi->heldEvent) - EventX(ev);
- mi->emulationDy = EventY(&mi->heldEvent) - EventY(ev);
- }
- return (abs (mi->emulationDx) < EMULATION_WINDOW &&
- abs (mi->emulationDy) < EMULATION_WINDOW);
+ pi->emulationDx = pi->heldEvent.x - x;
+ pi->emulationDy = pi->heldEvent.y - y;
+
+ return (abs (pi->emulationDx) < EMULATION_WINDOW &&
+ abs (pi->emulationDy) < EMULATION_WINDOW);
}
static KdInputClass
-KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
+KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
{
- switch (ev->u.u.type) {
+ switch (type) {
case ButtonPress:
- switch (ev->u.u.detail) {
+ switch (b) {
case 1: return down_1;
case 2: return down_2;
case 3: return down_3;
@@ -964,7 +1619,7 @@ KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
}
break;
case ButtonRelease:
- switch (ev->u.u.detail) {
+ switch (b) {
case 1: return up_1;
case 2: return up_2;
case 3: return up_3;
@@ -972,7 +1627,7 @@ KdClassifyInput (KdMouseInfo *mi, xEvent *ev)
}
break;
case MotionNotify:
- if (mi->eventHeld && !KdInsideEmulationWindow(mi, ev))
+ if (pi->eventHeld && !KdInsideEmulationWindow(pi, x, y, z))
return outside_box;
else
return motion;
@@ -1018,119 +1673,101 @@ char *kdActionNames[] = {
#endif
static void
-KdQueueEvent (xEvent *ev)
+KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
{
KdAssertSigioBlocked ("KdQueueEvent");
- if (ev->u.u.type == MotionNotify)
- {
- if (ev->u.keyButtonPointer.pad1)
- {
- ev->u.keyButtonPointer.pad1 = 0;
- miPointerDeltaCursor (ev->u.keyButtonPointer.rootX,
- ev->u.keyButtonPointer.rootY,
- ev->u.keyButtonPointer.time);
- }
- else
- {
- miPointerAbsoluteCursor(ev->u.keyButtonPointer.rootX,
- ev->u.keyButtonPointer.rootY,
- ev->u.keyButtonPointer.time);
- }
- }
- else
- {
- mieqEnqueue (ev);
- }
+ mieqEnqueue (pDev, ev);
}
-static void
-KdRunMouseMachine (KdMouseInfo *mi, KdInputClass c, xEvent *ev)
+/* We return true if we're stealing the event. */
+static Bool
+KdRunMouseMachine (KdPointerInfo *pi, KdInputClass c, int type, int x, int y,
+ int z, int b, int absrel)
{
const KdInputTransition *t;
- int a;
+ int a;
- t = &kdInputMachine[mi->mouseState][c];
+ c = KdClassifyInput(pi, type, x, y, z, b);
+ t = &kdInputMachine[pi->mouseState][c];
for (a = 0; a < MAX_ACTIONS; a++)
{
switch (t->actions[a]) {
case noop:
break;
case hold:
- mi->eventHeld = TRUE;
- mi->emulationDx = 0;
- mi->emulationDy = 0;
- mi->heldEvent = *ev;
+ pi->eventHeld = TRUE;
+ pi->emulationDx = 0;
+ pi->emulationDy = 0;
+ pi->heldEvent.type = type;
+ pi->heldEvent.x = x;
+ pi->heldEvent.y = y;
+ pi->heldEvent.z = z;
+ pi->heldEvent.flags = b;
+ pi->heldEvent.absrel = absrel;
+ return TRUE;
break;
case setto:
- mi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT;
- mi->timeoutPending = TRUE;
+ pi->emulationTimeout = GetTimeInMillis () + EMULATION_TIMEOUT;
+ pi->timeoutPending = TRUE;
break;
case deliver:
- KdQueueEvent (ev);
+ _KdEnqueuePointerEvent (pi, pi->heldEvent.type, pi->heldEvent.x,
+ pi->heldEvent.y, pi->heldEvent.z,
+ pi->heldEvent.flags, pi->heldEvent.absrel,
+ TRUE);
break;
case release:
- mi->eventHeld = FALSE;
- mi->timeoutPending = FALSE;
- KdQueueEvent (&mi->heldEvent);
+ pi->eventHeld = FALSE;
+ pi->timeoutPending = FALSE;
+ _KdEnqueuePointerEvent (pi, pi->heldEvent.type, pi->heldEvent.x,
+ pi->heldEvent.y, pi->heldEvent.z,
+ pi->heldEvent.flags, pi->heldEvent.absrel,
+ TRUE);
+ return TRUE;
break;
case clearto:
- mi->timeoutPending = FALSE;
+ pi->timeoutPending = FALSE;
break;
case gen_down_2:
- ev->u.u.detail = 2;
- mi->eventHeld = FALSE;
- KdQueueEvent (ev);
+ _KdEnqueuePointerEvent (pi, ButtonPress, x, y, z, 2, absrel,
+ TRUE);
+ pi->eventHeld = FALSE;
+ return TRUE;
break;
case gen_up_2:
- ev->u.u.detail = 2;
- KdQueueEvent (ev);
+ _KdEnqueuePointerEvent (pi, ButtonRelease, x, y, z, 2, absrel,
+ TRUE);
+ return TRUE;
break;
}
}
- mi->mouseState = t->nextState;
-}
-
-void
-KdResetInputMachine (void)
-{
- KdMouseInfo *mi;
-
- for (mi = kdMouseInfo; mi; mi = mi->next)
- {
- mi->mouseState = start;
- mi->eventHeld = FALSE;
- }
+ pi->mouseState = t->nextState;
+ return FALSE;
}
-static void
-KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev)
+static int
+KdHandlePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z, int b,
+ int absrel)
{
- if (mi->emulateMiddleButton)
- KdRunMouseMachine (mi, KdClassifyInput (mi, ev), ev);
- else
- KdQueueEvent (ev);
+ if (pi->emulateMiddleButton)
+ return KdRunMouseMachine (pi, KdClassifyInput(pi, type, x, y, z, b),
+ type, x, y, z, b, absrel);
+ return FALSE;
}
static void
-KdReceiveTimeout (KdMouseInfo *mi)
+KdReceiveTimeout (KdPointerInfo *pi)
{
- KdRunMouseMachine (mi, timeout, 0);
+ KdRunMouseMachine (pi, timeout, 0, 0, 0, 0, 0, 0);
}
-#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10))
-#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT))
-#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b)))
-#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b)))
-#define KEYMAP (pKdKeyboard->key->curKeySyms)
-#define KEYCOL1(k) (KEYMAP.map[((k)-kdMinKeyCode)*KEYMAP.mapWidth])
+#define KILL_SEQUENCE ((1L << KK_CONTROL)|(1L << KK_ALT)|(1L << KK_F8)|(1L << KK_F10))
+#define SPECIAL_SEQUENCE ((1L << KK_CONTROL) | (1L << KK_ALT))
+#define SETKILLKEY(b) (KdSpecialKeys |= (1L << (b)))
+#define CLEARKILLKEY(b) (KdSpecialKeys &= ~(1L << (b)))
CARD32 KdSpecialKeys = 0;
-#if 0
-/* already defined in opaque.h */
-extern char dispatchException;
-#endif
-
/*
* kdCheckTermination
*
@@ -1145,44 +1782,28 @@ extern char dispatchException;
extern int nClients;
static void
-KdCheckSpecialKeys(xEvent *xE)
+KdCheckSpecialKeys(KdKeyboardInfo *ki, int type, int sym)
{
- KeySym sym = KEYCOL1(xE->u.u.detail);
-
- if (!pKdKeyboard) return;
+ if (!ki)
+ return;
/*
* Ignore key releases
*/
-
- if (xE->u.u.type == KeyRelease) return;
-#ifdef XIPAQ
- /*
- * Check for buttons 1, 2 and 3 on the iPAQ
- */
- if (sym == XK_Pointer_Button1 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_1, 0, 0);
- return;
- }
- if (sym == XK_Pointer_Button2 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_2, 0, 0);
- return;
- }
- if (sym == XK_Pointer_Button3 && kdMouseInfo) {
- KdEnqueueMouseEvent(kdMouseInfo, KD_MOUSE_DELTA | KD_BUTTON_3, 0, 0);
- return;
- }
-#endif
+ if (type == KeyRelease)
+ return;
+
+ /* Some iPaq keyboard -> mouse button mapping used to be here, but I
+ * refuse to perpetuate this madness. -daniels */
/*
* Check for control/alt pressed
*/
- if ((pKdKeyboard->key->state & (ControlMask|Mod1Mask)) !=
+ if ((ki->dixdev->key->state & (ControlMask|Mod1Mask)) !=
(ControlMask|Mod1Mask))
return;
-
-
+
/*
* Let OS function see keysym first
*/
@@ -1194,6 +1815,8 @@ KdCheckSpecialKeys(xEvent *xE)
/*
* Now check for backspace or delete; these signal the
* X server to terminate
+ *
+ * I can't believe it's not XKB. -daniels
*/
switch (sym) {
case XK_BackSpace:
@@ -1219,150 +1842,125 @@ KdCheckSpecialKeys(xEvent *xE)
*/
static void
-KdHandleKeyboardEvent (xEvent *ev)
+KdHandleKeyboardEvent (KdKeyboardInfo *ki, int type, int key)
{
- int key = ev->u.u.detail;
- int byte;
- CARD8 bit;
- KdMouseInfo *mi;
+ int byte;
+ CARD8 bit;
+ KdPointerInfo *pi;
byte = key >> 3;
bit = 1 << (key & 7);
- switch (ev->u.u.type) {
+
+ switch (type) {
case KeyPress:
- kdKeyState[byte] |= bit;
+ ki->keyState[byte] |= bit;
break;
case KeyRelease:
- kdKeyState[byte] &= ~bit;
+ ki->keyState[byte] &= ~bit;
break;
}
- for (mi = kdMouseInfo; mi; mi = mi->next)
- KdRunMouseMachine (mi, keyboard, 0);
- KdQueueEvent (ev);
+
+ for (pi = kdPointers; pi; pi = pi->next)
+ KdRunMouseMachine (pi, keyboard, 0, 0, 0, 0, 0, 0);
}
void
KdReleaseAllKeys (void)
{
- xEvent xE;
- int key;
+ int key, nEvents, i;
+ KdKeyboardInfo *ki;
KdBlockSigio ();
- for (key = 0; key < KD_KEY_COUNT; key++)
- if (IsKeyDown(key))
- {
- xE.u.keyButtonPointer.time = GetTimeInMillis();
- xE.u.u.type = KeyRelease;
- xE.u.u.detail = key;
- KdHandleKeyboardEvent (&xE);
- }
+
+ for (ki = kdKeyboards; ki; ki = ki->next) {
+ for (key = ki->keySyms.minKeyCode; key < ki->keySyms.maxKeyCode;
+ key++) {
+ if (IsKeyDown(ki, key)) {
+ KdHandleKeyboardEvent(ki, KeyRelease, key);
+ nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key);
+ for (i = 0; i < nEvents; i++)
+ KdQueueEvent (ki->dixdev, kdEvents + i);
+ }
+ }
+ }
+
KdUnblockSigio ();
}
static void
KdCheckLock (void)
{
- KeyClassPtr keyc = pKdKeyboard->key;
- Bool isSet, shouldBeSet;
-
- if (kdKeyboardFuncs->LockLed)
- {
- isSet = (kdLeds & (1 << (kdKeyboardFuncs->LockLed-1))) != 0;
- shouldBeSet = (keyc->state & LockMask) != 0;
- if (isSet != shouldBeSet)
- {
- KdSetLed (kdKeyboardFuncs->LockLed, shouldBeSet);
- }
+ KeyClassPtr keyc = NULL;
+ Bool isSet = FALSE, shouldBeSet = FALSE;
+ KdKeyboardInfo *tmp = NULL;
+
+ for (tmp = kdKeyboards; tmp; tmp = tmp->next) {
+ if (tmp->LockLed && tmp->dixdev && tmp->dixdev->key) {
+ keyc = tmp->dixdev->key;
+ isSet = (tmp->leds & (1 << (tmp->LockLed-1))) != 0;
+ shouldBeSet = (keyc->state & LockMask) != 0;
+ if (isSet != shouldBeSet)
+ KdSetLed (tmp, tmp->LockLed, shouldBeSet);
+ }
}
}
void
-KdEnqueueKeyboardEvent(unsigned char scan_code,
- unsigned char is_up)
+KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
+ unsigned char scan_code,
+ unsigned char is_up)
{
- unsigned char key_code;
- xEvent xE;
- KeyClassPtr keyc;
-
- if (!pKdKeyboard)
+ unsigned char key_code;
+ KeyClassPtr keyc = NULL;
+ KeybdCtrl *ctrl = NULL;
+ int type, nEvents, i;
+
+#ifdef DEBUG
+ ErrorF("enqueuing kb event (scancode %d, %s)\n", scan_code, is_up ? "up" : "down");
+ ErrorF("event is from %s\n", ki->name);
+#endif
+
+ if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed || !ki->dixdev->key)
return;
- keyc = pKdKeyboard->key;
- xE.u.keyButtonPointer.time = GetTimeInMillis();
+ keyc = ki->dixdev->key;
+ ctrl = &ki->dixdev->kbdfeed->ctrl;
- if (kdMinScanCode <= scan_code && scan_code <= kdMaxScanCode)
+ if (scan_code >= ki->minScanCode && scan_code <= ki->maxScanCode)
{
- key_code = scan_code + KD_MIN_KEYCODE - kdMinScanCode;
+ key_code = scan_code + KD_MIN_KEYCODE - ki->minScanCode;
/*
* Set up this event -- the type may be modified below
*/
if (is_up)
- xE.u.u.type = KeyRelease;
+ type = KeyRelease;
else
- xE.u.u.type = KeyPress;
- xE.u.u.detail = key_code;
+ type = KeyPress;
- switch (KEYCOL1(key_code))
- {
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Shift_Lock:
- case XK_Caps_Lock:
- if (xE.u.u.type == KeyRelease)
- return;
- if (IsKeyDown (key_code))
- xE.u.u.type = KeyRelease;
- else
- xE.u.u.type = KeyPress;
+#ifdef XKB
+ if (noXkbExtension)
+#endif
+ {
+ KdCheckSpecialKeys(ki, type, key_code);
+ KdHandleKeyboardEvent(ki, type, key_code);
}
- /*
- * Check pressed keys which are already down
- */
- if (IsKeyDown (key_code) && xE.u.u.type == KeyPress)
- {
- KeybdCtrl *ctrl = &pKdKeyboard->kbdfeed->ctrl;
-
- /*
- * Check auto repeat
- */
- if (!ctrl->autoRepeat || keyc->modifierMap[key_code] ||
- !(ctrl->autoRepeats[key_code >> 3] & (1 << (key_code & 7))))
- {
- return;
- }
- /*
- * X delivers press/release even for autorepeat
- */
- xE.u.u.type = KeyRelease;
- KdHandleKeyboardEvent (&xE);
- xE.u.u.type = KeyPress;
- }
- /*
- * Check released keys which are already up
- */
- else if (!IsKeyDown (key_code) && xE.u.u.type == KeyRelease)
- {
- return;
- }
- KdCheckSpecialKeys (&xE);
- KdHandleKeyboardEvent (&xE);
+ nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code);
+#ifdef DEBUG
+ ErrorF("KdEnqueueKeyboardEvent: got %d events from GKE\n", nEvents);
+#endif
+ for (i = 0; i < nEvents; i++)
+ KdQueueEvent(ki->dixdev, kdEvents + i);
+ }
+ else {
+ ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n",
+ ki->name, scan_code, ki->minScanCode, ki->maxScanCode);
}
}
-#define SetButton(mi, b, v, s) \
-{\
- xE.u.u.detail = mi->map[b]; \
- xE.u.u.type = v; \
- KdHandleMouseEvent (mi, &xE); \
-}
-
-#define Press(mi, b) SetButton(mi, b, ButtonPress, "Down")
-#define Release(mi, b) SetButton(mi, b, ButtonRelease, "Up")
-
/*
- * kdEnqueueMouseEvent
+ * kdEnqueuePointerEvent
*
* This function converts hardware mouse event information into X event
* information. A mouse movement event is passed off to MI to generate
@@ -1370,124 +1968,108 @@ KdEnqueueKeyboardEvent(unsigned char scan_code,
* passed off to MI for enqueueing.
*/
-static void
-KdMouseAccelerate (DeviceIntPtr device, int *dx, int *dy)
-{
- PtrCtrl *pCtrl = &device->ptrfeed->ctrl;
- double speed = sqrt (*dx * *dx + *dy * *dy);
- double accel;
-#ifdef QUADRATIC_ACCELERATION
- double m;
-
- /*
- * Ok, so we want it moving num/den times faster at threshold*2
- *
- * accel = m *threshold + b
- * 1 = m * 0 + b -> b = 1
- *
- * num/den = m * (threshold * 2) + 1
- *
- * num / den - 1 = m * threshold * 2
- * (num / den - 1) / threshold * 2 = m
- */
- m = (((double) pCtrl->num / (double) pCtrl->den - 1.0) /
- ((double) pCtrl->threshold * 2.0));
- accel = m * speed + 1;
-#else
- accel = 1.0;
- if (speed > pCtrl->threshold)
- accel = (double) pCtrl->num / pCtrl->den;
-#endif
- *dx = accel * *dx;
- *dy = accel * *dy;
-}
-
+/* FIXME do something a little more clever to deal with multiple axes here */
void
-KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int rx, int ry)
+KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
+ int rz)
{
- CARD32 ms;
- xEvent xE;
- unsigned char buttons;
- int x, y;
- int (*matrix)[3] = kdMouseMatrix.matrix;
- unsigned long button;
- int n;
-
- if (!pKdPointer)
+ CARD32 ms;
+ unsigned char buttons;
+ int x, y, z;
+ int (*matrix)[3] = kdPointerMatrix.matrix;
+ unsigned long button;
+ int n;
+ int dixflags;
+
+ if (!pi)
return;
ms = GetTimeInMillis();
-
- if (flags & KD_MOUSE_DELTA)
- {
- if (mi->transformCoordinates)
- {
+
+ /* we don't need to transform z, so we don't. */
+ if (flags & KD_MOUSE_DELTA) {
+ if (pi->transformCoordinates) {
x = matrix[0][0] * rx + matrix[0][1] * ry;
y = matrix[1][0] * rx + matrix[1][1] * ry;
}
- else
- {
+ else {
x = rx;
y = ry;
}
- KdMouseAccelerate (pKdPointer, &x, &y);
- xE.u.keyButtonPointer.pad1 = 1;
}
- else
- {
- if (mi->transformCoordinates)
- {
- x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2];
- y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2];
+ else {
+ if (pi->transformCoordinates) {
+ x = matrix[0][0] * rx + matrix[0][1] * ry;
+ y = matrix[1][0] * rx + matrix[1][1] * ry;
}
- else
- {
+ else {
x = rx;
y = ry;
}
- xE.u.keyButtonPointer.pad1 = 0;
}
- xE.u.keyButtonPointer.time = ms;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
+ z = rz;
- xE.u.u.type = MotionNotify;
- xE.u.u.detail = 0;
- KdHandleMouseEvent (mi, &xE);
+#ifdef DEBUG
+ ErrorF("sending motion notification for (%d, %d, %d)\n", x, y, z);
+ ErrorF(" comes from (%d, %d, %d)\n", rx, ry, rz);
+ ErrorF(" is %s\n", (flags & KD_MOUSE_DELTA) ? "relative" : "absolute");
+#endif
+
+ if (flags & KD_MOUSE_DELTA)
+ dixflags = POINTER_RELATIVE & POINTER_ACCELERATE;
+ else
+ dixflags = POINTER_ABSOLUTE;
+
+ _KdEnqueuePointerEvent(pi, MotionNotify, x, y, z, 0, dixflags, FALSE);
buttons = flags;
- for (button = KD_BUTTON_1, n = 0; button <= KD_BUTTON_5; button <<= 1, n++)
- {
- if ((mi->buttonState & button) ^ (buttons & button))
- {
- if (buttons & button)
- {
- Press(mi, n);
- }
- else
- {
- Release(mi, n);
- }
+ for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons;
+ button <<= 1, n++) {
+ if (((pi->buttonState & button) ^ (buttons & button)) &&
+ !(buttons & button)) {
+#ifdef DEBUG
+ ErrorF(" posting button release %d\n", n);
+#endif
+ _KdEnqueuePointerEvent(pi, ButtonRelease, x, y, z, n,
+ dixflags, FALSE);
}
}
- mi->buttonState = buttons;
+ for (button = KD_BUTTON_1, n = 1; n <= pi->nButtons;
+ button <<= 1, n++) {
+ if (((pi->buttonState & button) ^ (buttons & button)) &&
+ (buttons & button)) {
+#ifdef DEBUG
+ ErrorF(" posting button press %d\n", n);
+#endif
+ _KdEnqueuePointerEvent(pi, ButtonPress, x, y, z, n,
+ dixflags, FALSE);
+ }
+ }
+
+ pi->buttonState = buttons;
}
void
-KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y)
+_KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
+ int b, int absrel, Bool force)
{
- xEvent xE;
- CARD32 ms;
-
- ms = GetTimeInMillis();
-
- xE.u.u.type = MotionNotify;
- xE.u.keyButtonPointer.time = ms;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
+ int nEvents = 0, i = 0;
+ int valuators[3] = { x, y, z };
- KdHandleMouseEvent (mi, &xE);
+#ifdef DEBUG
+ ErrorF("mouse enqueuing event from device %s (%d, %d, %d; %d)\n",
+ pi->name, x, y, z, b);
+#endif
+
+ /* TRUE from KdHandlePointerEvent, means 'we swallowed the event'. */
+ if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel))
+ return;
+
+ nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, 0, 3,
+ valuators);
+ for (i = 0; i < nEvents; i++)
+ KdQueueEvent(pi->dixdev, kdEvents + i);
}
void
@@ -1496,16 +2078,16 @@ KdBlockHandler (int screen,
pointer timeout,
pointer readmask)
{
- KdMouseInfo *mi;
+ KdPointerInfo *pi;
int myTimeout=0;
- for (mi = kdMouseInfo; mi; mi = mi->next)
+ for (pi = kdPointers; pi; pi = pi->next)
{
- if (mi->timeoutPending)
+ if (pi->timeoutPending)
{
int ms;
- ms = mi->emulationTimeout - GetTimeInMillis ();
+ ms = pi->emulationTimeout - GetTimeInMillis ();
if (ms < 1)
ms = 1;
if(ms<myTimeout || myTimeout==0)
@@ -1531,7 +2113,7 @@ KdWakeupHandler (int screen,
int result = (int) lresult;
fd_set *pReadmask = (fd_set *) readmask;
int i;
- KdMouseInfo *mi;
+ KdPointerInfo *pi;
if (kdInputEnabled && result > 0)
{
@@ -1543,15 +2125,15 @@ KdWakeupHandler (int screen,
KdUnblockSigio ();
}
}
- for (mi = kdMouseInfo; mi; mi = mi->next)
+ for (pi = kdPointers; pi; pi = pi->next)
{
- if (mi->timeoutPending)
+ if (pi->timeoutPending)
{
- if ((long) (GetTimeInMillis () - mi->emulationTimeout) >= 0)
+ if ((long) (GetTimeInMillis () - pi->emulationTimeout) >= 0)
{
- mi->timeoutPending = FALSE;
+ pi->timeoutPending = FALSE;
KdBlockSigio ();
- KdReceiveTimeout (mi);
+ KdReceiveTimeout (pi);
KdUnblockSigio ();
}
}
@@ -1686,3 +2268,134 @@ ProcessInputEvents ()
KdProcessSwitch ();
KdCheckLock ();
}
+
+/* FIXME use XSECURITY to work out whether the client should be allowed to
+ * open and close. */
+void
+OpenInputDevice(DeviceIntPtr pDev, ClientPtr client, int *status)
+{
+ if (!pDev)
+ *status = BadDevice;
+ else
+ *status = Success;
+}
+
+void
+CloseInputDevice(DeviceIntPtr pDev, ClientPtr client)
+{
+ return;
+}
+
+/* We initialise all input devices at startup. */
+void
+AddOtherInputDevices(void)
+{
+ return;
+}
+
+/* At the moment, absolute/relative is up to the client. */
+int
+SetDeviceMode(register ClientPtr client, DeviceIntPtr pDev, int mode)
+{
+ return BadMatch;
+}
+
+int
+SetDeviceValuators(register ClientPtr client, DeviceIntPtr pDev,
+ int *valuators, int first_valuator, int num_valuators)
+{
+ return BadMatch;
+}
+
+int
+ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
+ xDeviceCtl *control)
+{
+ switch (control->control) {
+ case DEVICE_RESOLUTION:
+ /* FIXME do something more intelligent here */
+ return BadMatch;
+
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return Success;
+
+ case DEVICE_CORE:
+ return Success;
+
+ default:
+ return BadMatch;
+ }
+
+ /* NOTREACHED */
+ return BadImplementation;
+}
+
+int
+NewInputDeviceRequest(InputOption *options)
+{
+ InputOption *option = NULL;
+ KdPointerInfo *pi = NULL;
+ KdKeyboardInfo *ki = NULL;
+
+ for (option = options; option; option = option->next) {
+ if (strcmp(option->key, "type") == 0) {
+ if (strcmp(option->value, "pointer") == 0) {
+ pi = KdNewPointer();
+ if (!pi)
+ return BadAlloc;
+ pi->options = options;
+ }
+ else if (strcmp(option->value, "keyboard") == 0) {
+ ki = KdNewKeyboard();
+ if (!ki)
+ return BadAlloc;
+ ki->options = options;
+ }
+ else {
+ ErrorF("unrecognised device type!\n");
+ return BadValue;
+ }
+ }
+ }
+
+ for (option = options; option; option = option->next) {
+ if (strcmp(option->key, "driver") == 0) {
+ if (pi) {
+ pi->driver = KdFindPointerDriver(option->value);
+ if (!pi->driver) {
+ ErrorF("couldn't find driver!\n");
+ KdFreePointer(pi);
+ return BadValue;
+ }
+ }
+ else if (ki) {
+ ki->driver = KdFindKeyboardDriver(option->value);
+ if (!ki->driver) {
+ ErrorF("couldn't find driver!\n");
+ KdFreeKeyboard(ki);
+ return BadValue;
+ }
+ }
+ }
+ }
+
+ if (pi) {
+ if (KdAddPointer(pi) != Success ||
+ ActivateDevice(pi->dixdev) != Success ||
+ EnableDevice(pi->dixdev) != TRUE) {
+ ErrorF("couldn't add or enable pointer\n");
+ return BadImplementation;
+ }
+ }
+ else if (ki) {
+ if (KdAddKeyboard(ki) != Success ||
+ ActivateDevice(ki->dixdev) != Success ||
+ EnableDevice(ki->dixdev) != TRUE) {
+ ErrorF("couldn't add or enable keyboard\n");
+ return BadImplementation;
+ }
+ }
+
+ return Success;
+}
diff --git a/hw/kdrive/src/kkeymap.c b/hw/kdrive/src/kkeymap.c
index 66383e7f3..ce4596fc8 100644
--- a/hw/kdrive/src/kkeymap.c
+++ b/hw/kdrive/src/kkeymap.c
@@ -28,14 +28,13 @@
#endif
#include "kdrive.h"
#include <X11/keysym.h>
-#include "kkeymap.h"
/*
* Map scan codes (both regular and synthesized from extended keys)
* to X keysyms
*/
-KeySym kdKeymap[(MAX_SCANCODE - MIN_SCANCODE + 1) * MAX_WIDTH] = {
+const KeySym kdDefaultKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH] = {
/* These are directly mapped from DOS scanset 0 */
/* 1 8 */ XK_Escape, NoSymbol,
/* 2 9 */ XK_1, XK_exclam,
@@ -152,58 +151,13 @@ KeySym kdKeymap[(MAX_SCANCODE - MIN_SCANCODE + 1) * MAX_WIDTH] = {
/* 110 117 */ NoSymbol, NoSymbol,
/* 111 118 */ NoSymbol, NoSymbol,
/* 112 119 */ NoSymbol, NoSymbol,
-;
-
-/*
- * Map extended keys to additional scancodes
- */
-KdExtendMap kdExtendMap[] = {
- 0x1d, 89, /* Control_R */
- 0x1c, 90, /* KP_Enter */
- 0x35, 91, /* KP_Divide */
- 0x37, 92, /* Sys_Req */
- 0x38, 93, /* Alt_R */
- 0x45, 94, /* Num_Lock */
- 0x47, 95, /* Home */
- 0x48, 96, /* Up */
- 0x49, 97, /* Page_Up */
- 0x4b, 98, /* Left */
- 0x4d, 99, /* Right */
- 0x4f, 100, /* End */
- 0x50, 101, /* Down */
- 0x51, 102, /* Page_Down */
- 0x52, 103, /* Insert */
- 0x53, 104, /* Delete */
- 0x5b, 105, /* Super_L (Windows_L) */
- 0x5c, 106, /* Super_R (Windows_R) */
- 0x5d, 107, /* Menu */
- 0x46, 69, /* Break (with control pressed) */
};
-#define NUM_EXTEND (sizeof (kdExtendMap)/ sizeof (kdExtendMap[0]))
-
-int kdNumExtend = NUM_EXTEND;
-
-/*
- * Map keys on Japanese keyboard far from zero back to reasonable values
- */
-KdExtendMap kdJapanMap[] = {
- 0x70, 108, /* next to Alt key */
- 0x73, 109, /* dash/vbar */
- 0x79, 110, /* right of space bar */
- 0x7b, 111, /* left of space bar */
- 0x7d, 112, /* Yen */
-};
-
-#define NUM_JAPAN (sizeof (kdJapanMap)/sizeof (kdJapanMap[0]))
-
-int kdNumJapan = NUM_JAPAN;
-
/*
* List of locking key codes
*/
-CARD8 kdLockMap[] = {
+CARD8 kdLockMap[] = {
65,
101,
77,
@@ -218,7 +172,7 @@ int kdNumLock = NUM_LOCK;
* the KEYMAP_LOCKING_ALTGR flag is set in CEKeymapFlags
*/
-CARD8 kdOptionalLockMap[] = {
+CARD8 kdOptionalLockMap[] = {
100,
};
@@ -226,13 +180,13 @@ CARD8 kdOptionalLockMap[] = {
int kdNumOptionalLock = NUM_OPTIONAL_LOCK;
-CARD8 kdModMap[MAP_LENGTH];
+const CARD8 kdDefaultModMap[MAP_LENGTH];
-unsigned long kdKeymapFlags = 0;
+unsigned long kdDefaultKeymapFlags = 0;
-KeySymsRec kdKeySyms = {
- kdKeymap,
- MIN_KEYCODE,
- MAX_KEYCODE,
- 2
+const KeySymsRec kdDefaultKeySyms = {
+ kdDefaultKeymap,
+ KD_MIN_KEYCODE,
+ KD_MAX_KEYCODE,
+ KD_MAX_WIDTH
};
diff --git a/hw/kdrive/src/kloadmap.c b/hw/kdrive/src/kloadmap.c
index bc003d485..b62b2deb2 100644
--- a/hw/kdrive/src/kloadmap.c
+++ b/hw/kdrive/src/kloadmap.c
@@ -27,7 +27,6 @@
#include <kdrive-config.h>
#endif
#include "kdrive.h"
-#include "kkeymap.h"
#ifdef WINDOWS
#define KM_BUF 1024
diff --git a/hw/kdrive/trident/tridentstub.c b/hw/kdrive/trident/tridentstub.c
index ebfd7ee9c..650206aac 100644
--- a/hw/kdrive/trident/tridentstub.c
+++ b/hw/kdrive/trident/tridentstub.c
@@ -49,7 +49,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/trio/s3stub.c b/hw/kdrive/trio/s3stub.c
index 68178eda0..7531858c5 100644
--- a/hw/kdrive/trio/s3stub.c
+++ b/hw/kdrive/trio/s3stub.c
@@ -52,7 +52,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdOsAddInputDrivers ();
+ KdInitInput ();
}
void
diff --git a/hw/kdrive/vesa/Makefile.am b/hw/kdrive/vesa/Makefile.am
index 70ba55fa7..54a6f47ee 100644
--- a/hw/kdrive/vesa/Makefile.am
+++ b/hw/kdrive/vesa/Makefile.am
@@ -22,8 +22,4 @@ Xvesa_SOURCES = \
Xvesa_LDADD = \
libvesa.a \
@KDRIVE_LIBS@ \
- @KDRIVE_LIBS@ \
@XSERVER_LIBS@
-
-Xvesa_DEPENDENCIES = \
- libvesa.a
diff --git a/hw/kdrive/vesa/vesa.c b/hw/kdrive/vesa/vesa.c
index 67d2d438a..766cacdc8 100644
--- a/hw/kdrive/vesa/vesa.c
+++ b/hw/kdrive/vesa/vesa.c
@@ -871,7 +871,7 @@ vesaComputeFramebufferMapping (KdScreenInfo *screen)
VesaScreenPrivPtr pscr = screen->driver;
int depth, bpp, fbbpp;
Pixel allbits;
- KdMouseMatrix m;
+ KdPointerMatrix m;
if (vesa_linear_fb)
{
@@ -970,10 +970,10 @@ vesaComputeFramebufferMapping (KdScreenInfo *screen)
pscr->mapping = VESA_WINDOWED;
pscr->shadow = TRUE;
}
- KdComputeMouseMatrix (&m, pscr->randr,
- pscr->mode.XResolution, pscr->mode.YResolution);
+ KdComputePointerMatrix (&m, pscr->randr,
+ pscr->mode.XResolution, pscr->mode.YResolution);
- KdSetMouseMatrix (&m);
+ KdSetPointerMatrix (&m);
screen->width = pscr->mode.XResolution;
screen->height = pscr->mode.YResolution;
diff --git a/hw/kdrive/vesa/vesainit.c b/hw/kdrive/vesa/vesainit.c
index 933715731..4f552d1a1 100644
--- a/hw/kdrive/vesa/vesainit.c
+++ b/hw/kdrive/vesa/vesainit.c
@@ -71,7 +71,16 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
- KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
+ KdKeyboardInfo *ki = NULL;
+
+ KdAddPointerDriver(&LinuxMouseDriver);
+ KdAddKeyboardDriver(&LinuxKeyboardDriver);
+ ki = KdNewKeyboard();
+ if (ki) {
+ ki->driver = &LinuxKeyboardDriver;
+ KdAddKeyboard(ki);
+ }
+ KdInitInput();
}
void
diff --git a/hw/kdrive/via/Makefile.am b/hw/kdrive/via/Makefile.am
index 7dcfd7c5b..0ea88816a 100644
--- a/hw/kdrive/via/Makefile.am
+++ b/hw/kdrive/via/Makefile.am
@@ -5,10 +5,6 @@ INCLUDES = \
bin_PROGRAMS = Xvia
-if TSLIB
-TSLIB_FLAG = -lts
-endif
-
noinst_LIBRARIES = libvia.a
libvia_a_SOURCES = \
@@ -28,7 +24,4 @@ VIA_LIBS = \
Xvia_LDADD = \
$(VIA_LIBS) \
@KDRIVE_LIBS@ \
- @XSERVER_LIBS@ \
- $(TSLIB_FLAG)
-
-Xvia_DEPENDENCIES = $(VIA_LIBS)
+ @XSERVER_LIBS@
diff --git a/hw/kdrive/via/viastub.c b/hw/kdrive/via/viastub.c
index f63ee0d81..1439010a9 100644
--- a/hw/kdrive/via/viastub.c
+++ b/hw/kdrive/via/viastub.c
@@ -87,7 +87,8 @@ InitOutput( ScreenInfo* pScreenInfo, int argc, char** argv ) {
*/
void
InitInput( int argc, char** argv ) {
- KdInitInput( &LinuxMouseFuncs, &LinuxKeyboardFuncs );
+ KdOsAddInputDrivers();
+ KdInitInput();
}
/*
diff --git a/hw/kdrive/vxworks/vxkbd.c b/hw/kdrive/vxworks/vxkbd.c
index 1c23aa915..b421e923e 100644
--- a/hw/kdrive/vxworks/vxkbd.c
+++ b/hw/kdrive/vxworks/vxkbd.c
@@ -171,7 +171,7 @@ static int kbdFd = -1;
#include <event.h>
#include <kbd_ioctl.h>
-extern KeybdCtrl defaultKeyboardControl;
+extern KeyboardCtrl defaultKeyboardControl;
static void
VxWorksSetAutorepeat (unsigned char *repeats, Bool on)
@@ -235,7 +235,7 @@ void
VxWorksKeyboardLeds (int leds)
{
DeviceIntPtr pKeyboard = (DeviceIntPtr) LookupKeyboardDevice ();
- KeybdCtrl *ctrl = &pKeyboard->kbdfeed->ctrl;
+ KeyboardCtrl *ctrl = &pKeyboard->kbdfeed->ctrl;
led_ioctl_info led_info;
int i;
diff --git a/hw/kdrive/vxworks/vxworks.c b/hw/kdrive/vxworks/vxworks.c
index ce214ff84..688de620b 100644
--- a/hw/kdrive/vxworks/vxworks.c
+++ b/hw/kdrive/vxworks/vxworks.c
@@ -12,17 +12,6 @@
#include "kdrive.h"
#include <X11/keysym.h>
-int
-VxWorksInit (void)
-{
- return 1;
-}
-
-void
-VxWorksEnable (void)
-{
-}
-
Bool
VxWorksSpecialKey (KeySym sym)
{
@@ -33,33 +22,19 @@ VxWorksSpecialKey (KeySym sym)
case XK_Break:
download(1, "launcher", 0);
return TRUE;
- case XK_Delete:
- dispatchException |= DE_REBOOT;
- return TRUE;
- case XK_BackSpace:
- dispatchException |= DE_RESET;
- return TRUE;
}
return FALSE;
}
void
-VxWorksDisable (void)
-{
-}
-
-void
-VxWorksFini (void)
+KdOsAddInputDrivers (void)
{
+ KdAddPointerDriver(&VxWorksMouseDriver);
+ KdAddPointerDriver(&VxWorksKeyboardDriver);
}
KdOsFuncs VxWorksFuncs = {
- VxWorksInit,
- VxWorksEnable,
- VxWorksSpecialKey,
- VxWorksDisable,
- VxWorksFini,
- 0
+ .SpecialKey = VxWorksSpecialKey,
};
void
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index 773c45420..99cf56c70 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -43,7 +43,7 @@ from The Open Group.
#include <X11/keysym.h>
Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
@@ -55,6 +55,10 @@ ProcessInputEvents()
miPointerUpdate();
}
+void DDXRingBell(int volume, int pitch, int duration)
+{
+}
+
#define VFB_MIN_KEY 8
#define VFB_MAX_KEY 255
KeySym map[MAP_LENGTH * LK201_GLYPHS_PER_KEY];
@@ -292,8 +296,8 @@ vfbMouseProc(DeviceIntPtr pDevice, int onoff)
map[1] = 1;
map[2] = 2;
map[3] = 3;
- InitPointerDeviceStruct(pDev, map, 3, miPointerGetMotionEvents,
- (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize());
+ InitPointerDeviceStruct(pDev, map, 3, GetMotionHistory,
+ (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), 2);
break;
case DEVICE_ON:
@@ -318,6 +322,5 @@ InitInput(int argc, char *argv[])
k = AddInputDevice(vfbKeybdProc, TRUE);
RegisterPointerDevice(p);
RegisterKeyboardDevice(k);
- miRegisterPointerDevice(screenInfo.screens[0], p);
- (void)mieqInit ((DevicePtr) k, (DevicePtr) p);
+ (void)mieqInit();
}
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 64c54f886..72befea19 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -58,12 +58,15 @@ Xorg_LDADD = $(XORG_LIBS) \
Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+BUILT_SOURCES = xorg.conf.example
+CLEAN = xorg.conf.example xorg.conf.example.pre
+EXTRA_DIST = xorgconf.cpp
if SOLARIS_ASM_INLINE
# Needs to be built before any files are compiled when using Sun compilers
# so in*/out* inline definitions are properly processed.
-BUILT_SOURCES = os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il
+BUILT_SOURCES += os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il
os-support/solaris/solaris-$(SOLARIS_INOUT_ARCH).il:
cd os-support/solaris ; make solaris-$(SOLARIS_INOUT_ARCH).il
@@ -84,10 +87,6 @@ endif
optionsdir = $(libdir)/X11
dist_options_DATA = Options
-BUILT_SOURCES = xorg.conf.example
-CLEAN = xorg.conf.example xorg.conf.example.pre
-EXTRA_DIST = xorgconf.cpp
-
CPP_FILES_FLAGS = \
-DRGBPATH=\"$(RGB_DB)\" \
-DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index 08a3a877d..0e1582e69 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -21,8 +21,6 @@ RANDRSOURCES = xf86RandR.c
BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
-KBDSOURCES = xf86Kbd@XORG_OS_KBD@.c
-
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
xf86DefModeSet.c: $(srcdir)/modeline2c.pl $(MODEDEFSOURCES)
@@ -34,14 +32,13 @@ AM_LDFLAGS = -r
libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
xf86Cursor.c xf86cvt.c xf86DGA.c xf86DPMS.c \
xf86DoProbe.c xf86DoScanPci.c xf86Events.c \
- xf86Globals.c xf86Io.c xf86AutoConfig.c \
+ xf86Globals.c xf86AutoConfig.c \
xf86MiscExt.c xf86Option.c \
xf86VidMode.c xf86fbman.c xf86cmap.c \
xf86Helper.c xf86PM.c \
xf86Mode.c xf86Build.h xorgHelper.c xf86Versions.c \
$(XVSOURCES) $(BUSSOURCES) $(XKBSOURCES) \
- $(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES) \
- $(KBDSOURCES)
+ $(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES)
nodist_libcommon_la_SOURCES = xf86DefModeSet.c
libinit_a_SOURCES = xf86Build.h xf86Init.c
@@ -59,11 +56,6 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
DISTCLEANFILES = xf86Build.h
CLEANFILES = $(BUILT_SOURCES)
-# this is a hack for now. as above we don't have rules to build all of these
-# yet, but we want to make sure they all get into the distball. this should
-# eventually go away.
-DISTKBDSOURCES = xf86Kbd.c xf86KbdBSD.c xf86KbdLnx.c xf86KbdMach.c
-
EXTRA_DIST = \
atKeynames.h \
compiler.h \
diff --git a/hw/xfree86/common/vesamodes b/hw/xfree86/common/vesamodes
index 851643fa6..2bc886276 100644
--- a/hw/xfree86/common/vesamodes
+++ b/hw/xfree86/common/vesamodes
@@ -16,10 +16,10 @@ ModeLine "640x400" 31.5 640 672 736 832 400 401 404 445 -hsync +vsy
ModeLine "720x400" 35.5 720 756 828 936 400 401 404 446 -hsync +vsync
# 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz
-ModeLine "640x480" 25.2 640 656 752 800 480 490 492 525 -hsync -vsync
+ModeLine "640x480" 25.175 640 656 752 800 480 490 492 525 -hsync -vsync
# 640x480 @ 72Hz (VESA) hsync: 37.9kHz
-ModeLine "640x480" 31.5 640 664 704 832 480 489 491 520 -hsync -vsync
+ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520 -hsync -vsync
# 640x480 @ 75Hz (VESA) hsync: 37.5kHz
ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -hsync -vsync
@@ -52,7 +52,7 @@ ModeLine "1024x768" 65.0 1024 1048 1184 1344 768 771 777 806 -hsync -vsy
ModeLine "1024x768" 75.0 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
# 1024x768 @ 75Hz (VESA) hsync: 60.0kHz
-ModeLine "1024x768" 78.8 1024 1040 1136 1312 768 769 772 800 +hsync +vsync
+ModeLine "1024x768" 78.75 1024 1040 1136 1312 768 769 772 800 +hsync +vsync
# 1024x768 @ 85Hz (VESA) hsync: 68.7kHz
ModeLine "1024x768" 94.5 1024 1072 1168 1376 768 769 772 808 +hsync +vsync
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index bff9233f8..4138eb16c 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -383,18 +383,6 @@ xf86DriverlistFromConfig()
return modulearray;
}
-
-Bool
-xf86BuiltinInputDriver(const char *name)
-{
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- if (xf86NameCmp(name, "keyboard") == 0)
- return TRUE;
- else
-#endif
- return FALSE;
-}
-
char **
xf86InputDriverlistFromConfig()
{
@@ -419,8 +407,7 @@ xf86InputDriverlistFromConfig()
if (xf86ConfigLayout.inputs) {
idp = xf86ConfigLayout.inputs;
while (idp->identifier) {
- if (!xf86BuiltinInputDriver(idp->driver))
- count++;
+ count++;
idp++;
}
}
@@ -435,10 +422,8 @@ xf86InputDriverlistFromConfig()
count = 0;
idp = xf86ConfigLayout.inputs;
while (idp->identifier) {
- if (!xf86BuiltinInputDriver(idp->driver)) {
- modulearray[count] = idp->driver;
- count++;
- }
+ modulearray[count] = idp->driver;
+ count++;
idp++;
}
modulearray[count] = NULL;
@@ -762,7 +747,8 @@ typedef enum {
FLAG_HANDLE_SPECIAL_KEYS,
FLAG_RANDR,
FLAG_AIGLX,
- FLAG_IGNORE_ABI
+ FLAG_IGNORE_ABI,
+ FLAG_ALLOW_EMPTY_INPUT,
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@@ -834,6 +820,8 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_AIGLX, "AIGLX", OPTV_BOOLEAN,
{0}, FALSE },
+ { FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN,
+ {0}, FALSE },
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE },
{ -1, NULL, OPTV_NONE,
@@ -1031,6 +1019,10 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.aiglxFrom = X_CONFIG;
}
+ xf86Info.allowEmptyInput = FALSE;
+ if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value))
+ xf86Info.allowEmptyInput = TRUE;
+
/* Make sure that timers don't overflow CARD32's after multiplying */
#define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN)
@@ -1120,304 +1112,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
/*
- * XXX This function is temporary, and will be removed when the keyboard
- * driver is converted into a regular input driver.
- */
-static Bool
-configInputKbd(IDevPtr inputp)
-{
- char *s;
- MessageType from = X_DEFAULT;
- Bool customKeycodesDefault = FALSE;
- int verb = 0;
-#if defined(XQUEUE)
- char *kbdproto = "Xqueue";
-#else
- char *kbdproto = "standard";
-#endif
-
- /* Initialize defaults */
- xf86Info.xleds = 0L;
- xf86Info.kbdDelay = 500;
- xf86Info.kbdRate = 30;
-
- xf86Info.kbdProc = NULL;
- xf86Info.vtinit = NULL;
- xf86Info.vtSysreq = VT_SYSREQ_DEFAULT;
-#if defined(SVR4) && defined(i386)
- xf86Info.panix106 = FALSE;
-#endif
- xf86Info.kbdCustomKeycodes = FALSE;
-#ifdef WSCONS_SUPPORT
- xf86Info.kbdFd = -1;
-#endif
-#ifdef XKB
- if (!xf86IsPc98()) {
- xf86Info.xkbrules = __XKBDEFRULES__;
- xf86Info.xkbmodel = "pc105";
- xf86Info.xkblayout = "us";
- xf86Info.xkbvariant = NULL;
- xf86Info.xkboptions = NULL;
- } else {
- xf86Info.xkbrules = "xfree98";
- xf86Info.xkbmodel = "pc98";
- xf86Info.xkblayout = "nec/jp";
- xf86Info.xkbvariant = NULL;
- xf86Info.xkboptions = NULL;
- }
- xf86Info.xkbcomponents_specified = FALSE;
- /* Should discourage the use of these. */
- xf86Info.xkbkeymap = NULL;
- xf86Info.xkbtypes = NULL;
- xf86Info.xkbcompat = NULL;
- xf86Info.xkbkeycodes = NULL;
- xf86Info.xkbsymbols = NULL;
- xf86Info.xkbgeometry = NULL;
-#endif
-
- s = xf86SetStrOption(inputp->commonOptions, "Protocol", kbdproto);
- if (xf86NameCmp(s, "standard") == 0) {
- xf86Info.kbdProc = xf86KbdProc;
- xf86Info.kbdEvents = xf86KbdEvents;
- xfree(s);
- } else if (xf86NameCmp(s, "xqueue") == 0) {
-#ifdef __UNIXWARE__
- /*
- * To retain compatibility with older config files, on UnixWare, we
- * accept the xqueue protocol but use the normal keyboard procs.
- */
- xf86Info.kbdProc = xf86KbdProc;
- xf86Info.kbdEvents = xf86KbdEvents;
-#else
-#ifdef XQUEUE
- xf86Info.kbdProc = xf86XqueKbdProc;
- xf86Info.kbdEvents = xf86XqueEvents;
- xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n");
-#endif
-#endif
- xfree(s);
-#ifdef WSCONS_SUPPORT
- } else if (xf86NameCmp(s, "wskbd") == 0) {
- xf86Info.kbdProc = xf86KbdProc;
- xf86Info.kbdEvents = xf86WSKbdEvents;
- xfree(s);
- s = xf86SetStrOption(inputp->commonOptions, "Device", NULL);
- xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n");
- if (s == NULL) {
- xf86ConfigError("A \"device\" option is required with"
- " the \"wskbd\" keyboard protocol");
- return FALSE;
- }
- xf86Info.kbdFd = open(s, O_RDWR | O_NONBLOCK | O_EXCL);
- if (xf86Info.kbdFd == -1) {
- xf86ConfigError("cannot open \"%s\"", s);
- xfree(s);
- return FALSE;
- }
- xfree(s);
- /* Find out keyboard type */
- if (ioctl(xf86Info.kbdFd, WSKBDIO_GTYPE, &xf86Info.wsKbdType) == -1) {
- xf86ConfigError("cannot get keyboard type");
- close(xf86Info.kbdFd);
- return FALSE;
- }
- switch (xf86Info.wsKbdType) {
- case WSKBD_TYPE_PC_XT:
- xf86Msg(X_PROBED, "Keyboard type: XT\n");
- break;
- case WSKBD_TYPE_PC_AT:
- xf86Msg(X_PROBED, "Keyboard type: AT\n");
- break;
- case WSKBD_TYPE_USB:
- xf86Msg(X_PROBED, "Keyboard type: USB\n");
- break;
-#ifdef WSKBD_TYPE_ADB
- case WSKBD_TYPE_ADB:
- xf86Msg(X_PROBED, "Keyboard type: ADB\n");
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN
- case WSKBD_TYPE_SUN:
- xf86Msg(X_PROBED, "Keyboard type: Sun\n");
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN5
- case WSKBD_TYPE_SUN5:
- xf86Msg(X_PROBED, "Keyboard type: Sun5\n");
- break;
-#endif
- default:
- xf86ConfigError("Unsupported wskbd type \"%d\"",
- xf86Info.wsKbdType);
- close(xf86Info.kbdFd);
- return FALSE;
- }
-#endif
- } else {
- xf86ConfigError("\"%s\" is not a valid keyboard protocol name", s);
- xfree(s);
- return FALSE;
- }
-
- s = xf86SetStrOption(inputp->commonOptions, "AutoRepeat", NULL);
- if (s) {
- if (sscanf(s, "%d %d", &xf86Info.kbdDelay, &xf86Info.kbdRate) != 2) {
- xf86ConfigError("\"%s\" is not a valid AutoRepeat value", s);
- xfree(s);
- return FALSE;
- }
- xfree(s);
- }
-
- s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL);
- if (s) {
- char *l, *end;
- unsigned int i;
- l = strtok(s, " \t\n");
- while (l) {
- i = strtoul(l, &end, 0);
- if (*end == '\0')
- xf86Info.xleds |= 1L << (i - 1);
- else {
- xf86ConfigError("\"%s\" is not a valid XLeds value", l);
- xfree(s);
- return FALSE;
- }
- l = strtok(NULL, " \t\n");
- }
- xfree(s);
- }
-
-#ifdef XKB
- from = X_DEFAULT;
- if (noXkbExtension)
- from = X_CMDLINE;
- else if (xf86FindOption(inputp->commonOptions, "XkbDisable")) {
- xf86Msg(X_WARNING, "KEYBOARD: XKB should be disabled in the "
- "ServerFlags section instead\n"
- "\tof in the \"keyboard\" InputDevice section.\n");
- noXkbExtension =
- xf86SetBoolOption(inputp->commonOptions, "XkbDisable", FALSE);
- from = X_CONFIG;
- }
- if (noXkbExtension)
- xf86Msg(from, "XKB: disabled\n");
-
-#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), (char *)NULL))
-
- if (!noXkbExtension) {
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) {
- xf86Info.xkbkeymap = NULL_IF_EMPTY(s);
- xf86Msg(X_CONFIG, "XKB: keymap: \"%s\" "
- "(overrides other XKB settings)\n", xf86Info.xkbkeymap);
- } else {
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbCompat", NULL))) {
- xf86Info.xkbcompat = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: compat: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbTypes", NULL))) {
- xf86Info.xkbtypes = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: types: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeycodes", NULL))) {
- xf86Info.xkbkeycodes = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: keycodes: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbGeometry", NULL))) {
- xf86Info.xkbgeometry = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: geometry: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbSymbols", NULL))) {
- xf86Info.xkbsymbols = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: symbols: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbRules", NULL))) {
- xf86Info.xkbrules = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: rules: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbModel", NULL))) {
- xf86Info.xkbmodel = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: model: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbLayout", NULL))) {
- xf86Info.xkblayout = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: layout: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbVariant", NULL))) {
- xf86Info.xkbvariant = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: variant: \"%s\"\n", s);
- }
-
- if ((s = xf86SetStrOption(inputp->commonOptions, "XkbOptions", NULL))) {
- xf86Info.xkboptions = NULL_IF_EMPTY(s);
- xf86Info.xkbcomponents_specified = TRUE;
- xf86Msg(X_CONFIG, "XKB: options: \"%s\"\n", s);
- }
- }
- }
-#undef NULL_IF_EMPTY
-#endif
-#if defined(SVR4) && defined(i386)
- if ((xf86Info.panix106 =
- xf86SetBoolOption(inputp->commonOptions, "Panix106", FALSE))) {
- xf86Msg(X_CONFIG, "PANIX106: enabled\n");
- }
-#endif
-
- /*
- * This was once a compile time option (ASSUME_CUSTOM_KEYCODES)
- * defaulting to 1 on Linux/PPC. It is no longer necessary, but for
- * backwards compatibility we provide 'Option "CustomKeycodes"'
- * and try to autoprobe on Linux/PPC.
- */
- from = X_DEFAULT;
- verb = 2;
-#if defined(__linux__) && defined(__powerpc__)
- {
- FILE *f;
-
- f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r");
- if (f) {
- if (fgetc(f) == '0') {
- customKeycodesDefault = TRUE;
- from = X_PROBED;
- verb = 1;
- }
- fclose(f);
- }
- }
-#endif
- if (xf86FindOption(inputp->commonOptions, "CustomKeycodes")) {
- from = X_CONFIG;
- verb = 1;
- }
- xf86Info.kbdCustomKeycodes =
- xf86SetBoolOption(inputp->commonOptions, "CustomKeycodes",
- customKeycodesDefault);
- xf86MsgVerb(from, verb, "Keyboard: CustomKeycode %s\n",
- xf86Info.kbdCustomKeycodes ? "enabled" : "disabled");
-
- return TRUE;
-}
-
-/*
* Locate the core input devices. These can be specified/located in
* the following ways, in order of priority:
*
@@ -1653,10 +1347,6 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
confInput = xf86findInputByDriver("kbd",
xf86configptr->conf_input_lst);
}
- if (!confInput) {
- confInput = xf86findInputByDriver("keyboard",
- xf86configptr->conf_input_lst);
- }
if (confInput) {
foundKeyboard = TRUE;
from = X_DEFAULT;
@@ -1974,8 +1664,6 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
servlayoutp->options = conf_layout->lay_option_lst;
from = X_DEFAULT;
- if (!checkCoreInputDevices(servlayoutp, FALSE))
- return FALSE;
return TRUE;
}
@@ -2034,7 +1722,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
indp = xnfalloc(sizeof(IDevRec));
indp->identifier = NULL;
servlayoutp->inputs = indp;
- if (!checkCoreInputDevices(servlayoutp, TRUE))
+ if (!xf86Info.allowEmptyInput && checkCoreInputDevices(servlayoutp, TRUE))
return FALSE;
return TRUE;
@@ -2563,10 +2251,6 @@ configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
inputp->commonOptions = conf_input->inp_option_lst;
inputp->extraOptions = NULL;
- /* XXX This is required until the keyboard driver is converted */
- if (!xf86NameCmp(inputp->driver, "keyboard"))
- return configInputKbd(inputp);
-
return TRUE;
}
@@ -2624,6 +2308,12 @@ addDefaultModes(MonPtr monitorp)
return TRUE;
}
+static void
+checkInput(serverLayoutPtr layout) {
+ if (!xf86Info.allowEmptyInput)
+ checkCoreInputDevices(layout, FALSE);
+}
+
/*
* load the config file and fill the global data structure
*/
@@ -2745,6 +2435,8 @@ xf86HandleConfigFile(Bool autoconfig)
return CONFIG_PARSE_ERROR;
}
+ checkInput(&xf86ConfigLayout);
+
/*
* Handle some command line options that can override some of the
* ServerFlags settings.
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index cb091080c..f1f173dd8 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -76,7 +76,7 @@ Bool foundMouse = FALSE;
#elif defined(__SCO__)
static char *DFLT_MOUSE_PROTO = "OSMouse";
#elif defined(__UNIXWARE__)
-static char *DFLT_MOUSE_PROTO = "Xqueue";
+static char *DFLT_MOUSE_PROTO = "OSMouse";
static char *DFLT_MOUSE_DEV = "/dev/mouse";
#elif defined(QNX4)
static char *DFLT_MOUSE_PROTO = "OSMouse";
@@ -265,11 +265,7 @@ configureInputSection (void)
parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
ptr->inp_identifier = "Keyboard0";
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- ptr->inp_driver = "keyboard";
-#else
ptr->inp_driver = "kbd";
-#endif
ptr->list.next = NULL;
/* Crude mechanism to auto-detect mouse (os dependent) */
diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c
index dcdf46674..46d812804 100644
--- a/hw/xfree86/common/xf86Cursor.c
+++ b/hw/xfree86/common/xf86Cursor.c
@@ -77,14 +77,9 @@ static miPointerScreenFuncRec xf86PointerScreenFuncs = {
xf86CursorOffScreen,
xf86CrossScreen,
xf86WarpCursor,
-#ifdef XINPUT
- xf86eqEnqueue,
- xf86eqSwitchScreen
-#else
/* let miPointerInitialize take care of these */
NULL,
NULL
-#endif
};
static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
@@ -228,9 +223,9 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY)
return FALSE;
- pCursorScreen = miPointerCurrentScreen();
+ pCursorScreen = miPointerGetScreen(inputInfo.pointer);
if (pScreen == pCursorScreen)
- miPointerPosition(&px, &py);
+ miPointerGetPosition(inputInfo.pointer, &px, &py);
xf86EnterServerState(SETUP);
Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 55c85e630..204457fb1 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -47,6 +47,8 @@
#endif
#include "xf86Xinput.h"
+#include "mi.h"
+
static unsigned long DGAGeneration = 0;
static int DGAScreenIndex = -1;
@@ -907,22 +909,6 @@ DGAVTSwitch(void)
Bool
DGAStealKeyEvent(int index, xEvent *e)
{
- DGAScreenPtr pScreenPriv;
- dgaEvent de;
-
- if(DGAScreenIndex < 0) /* no DGA */
- return FALSE;
-
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
- return FALSE;
-
- de.u.u.type = e->u.u.type + *XDGAEventBase;
- de.u.u.detail = e->u.u.detail;
- de.u.event.time = e->u.keyButtonPointer.time;
- xf86eqEnqueue ((xEvent *) &de);
- return TRUE;
}
static int DGAMouseX, DGAMouseY;
@@ -930,36 +916,6 @@ static int DGAMouseX, DGAMouseY;
Bool
DGAStealMouseEvent(int index, xEvent *e, int dx, int dy)
{
- DGAScreenPtr pScreenPriv;
- dgaEvent de;
-
- if(DGAScreenIndex < 0) /* no DGA */
- return FALSE;
-
- pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-
- if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
- return FALSE;
-
- DGAMouseX += dx;
- if (DGAMouseX < 0)
- DGAMouseX = 0;
- else if (DGAMouseX > screenInfo.screens[index]->width)
- DGAMouseX = screenInfo.screens[index]->width;
- DGAMouseY += dy;
- if (DGAMouseY < 0)
- DGAMouseY = 0;
- else if (DGAMouseY > screenInfo.screens[index]->height)
- DGAMouseY = screenInfo.screens[index]->height;
- de.u.u.type = e->u.u.type + *XDGAEventBase;
- de.u.u.detail = e->u.u.detail;
- de.u.event.time = e->u.keyButtonPointer.time;
- de.u.event.dx = dx;
- de.u.event.dy = dy;
- de.u.event.pad1 = DGAMouseX;
- de.u.event.pad2 = DGAMouseY;
- xf86eqEnqueue ((xEvent *) &de);
- return TRUE;
}
Bool
diff --git a/hw/xfree86/common/xf86Debug.c b/hw/xfree86/common/xf86Debug.c
index 2eb28876d..cb579343a 100644
--- a/hw/xfree86/common/xf86Debug.c
+++ b/hw/xfree86/common/xf86Debug.c
@@ -163,6 +163,7 @@ void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v)
}
+#if 0
_X_EXPORT void
xf86STimestamp(xf86TsPtr* timestamp)
{
@@ -194,3 +195,4 @@ xf86SPTimestamp(xf86TsPtr* timestamp, char *str)
gettimeofday((struct timeval*)*timestamp,NULL);
}
}
+#endif
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 831c68ad8..6ce9319c2 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -104,23 +104,12 @@ extern Bool noXkbExtension;
#define XE_POINTER 1
#define XE_KEYBOARD 2
-#ifdef XINPUT
-#define __EqEnqueue(ev) xf86eqEnqueue(ev)
-#else
-#define __EqEnqueue(ev) mieqEnqueue(ev)
-#endif
-
-#define EqEnqueue(ev) { \
+#define EqEnqueue(pDev, ev) { \
int __sigstate = xf86BlockSIGIO (); \
- __EqEnqueue (ev); \
+ mieqEnqueue (pDev, ev); \
xf86UnblockSIGIO(__sigstate); \
}
-#define ENQUEUE(ev, code, direction, dev_type) \
- (ev)->u.u.detail = (code); \
- (ev)->u.u.type = (direction); \
- EqEnqueue((ev))
-
/*
* The first of many hacks to get VT switching to work under
* Solaris 2.1 for x86. The basic problem is that Solaris is supposed
@@ -146,9 +135,6 @@ Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
extern fd_set EnabledDevices;
-#if defined(XQUEUE)
-extern void xf86XqueRequest(void);
-#endif
#ifdef XF86PM
extern void (*xf86OSPMClose)(void);
#endif
@@ -170,6 +156,12 @@ typedef struct x_IHRec {
static IHPtr InputHandlers = NULL;
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return TRUE;
+}
+
/*
* TimeSinceLastInputEvent --
* Function used for screensaver purposes by the os module. Returns the
@@ -253,14 +245,10 @@ ProcessInputEvents ()
xf86Info.inputPending = FALSE;
-#ifdef XINPUT
- xf86eqProcessInputEvents();
-#else
mieqProcessInputEvents();
-#endif
- miPointerUpdate();
+ miPointerUpdateSprite(inputInfo.pointer);
- miPointerPosition(&x, &y);
+ miPointerGetPosition(inputInfo.pointer, &x, &y);
xf86SetViewport(xf86Info.currentScreen, x, y);
}
@@ -403,679 +391,6 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
}
}
-/*
- * xf86PostKbdEvent --
- * Translate the raw hardware KbdEvent into an XEvent, and tell DIX
- * about it. Scancode preprocessing and so on is done ...
- *
- * OS/2 specific xf86PostKbdEvent(key) has been moved to os-support/os2/os2_kbd.c
- * as some things differ, and I did not want to scatter this routine with
- * ifdefs further (hv).
- */
-
-#ifdef __linux__
-extern u_char SpecialServerMap[];
-#endif
-
-#if !defined(__UNIXOS2__)
-void
-xf86PostKbdEvent(unsigned key)
-{
- int scanCode = (key & 0x7f);
- int specialkey = 0;
- Bool down = (key & 0x80 ? FALSE : TRUE);
- KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key;
- Bool updateLeds = FALSE;
- Bool UsePrefix = FALSE;
- Bool Direction = FALSE;
- xEvent kevent;
- KeySym *keysym;
- int keycode;
- static int lockkeys = 0;
-#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- static Bool first_time = TRUE;
-#endif
-#if defined(__sparc__) && defined(__linux__)
- static int kbdSun = -1;
-#endif
- /* Disable any keyboard processing while in suspend */
- if (xf86inSuspend)
- return;
-
-#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- if (first_time)
- {
- first_time = FALSE;
- VTSwitchEnabled = (xf86Info.consType == SYSCONS)
- || (xf86Info.consType == PCVT);
- }
-#endif
-
-#if defined (__sparc__) && defined(__linux__)
- if (kbdSun == -1) {
- if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun"))
- || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun")))
- kbdSun = 1;
- else
- kbdSun = 0;
- }
- if (kbdSun)
- goto special;
-#endif /* __sparc__ && __linux__ */
-
-#ifdef __linux__
- if (xf86Info.kbdCustomKeycodes) {
- specialkey = SpecialServerMap[scanCode];
- goto customkeycodes;
- }
-#endif
-
- /*
- * First do some special scancode remapping ...
- */
- if (xf86Info.scanPrefix == 0) {
-
- switch (scanCode) {
- case KEY_Prefix0:
- case KEY_Prefix1:
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
- || xf86Info.consType == PCVT
-#ifdef WSCONS_SUPPORT
- || (xf86Info.consType == WSCONS && xf86Info.kbdEvents != xf86WSKbdEvents)
-#endif
- ) {
-#endif
- xf86Info.scanPrefix = scanCode; /* special prefixes */
- return;
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- }
- break;
-#endif
- }
-#if defined (i386) && defined (SVR4)
- /*
- * PANIX returns DICOP standards based keycodes in using 106jp
- * keyboard. We need to remap some keys.
- */
- if(xf86Info.panix106 == TRUE){
- switch (scanCode) {
- case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */
- case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/
- case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */
- case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */
- case 0x6B: scanCode = KEY_Left; break; /* Cur Left */
- case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */
- case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */
- case 0x73: scanCode = KEY_RCtrl; break; /* not needed */
- }
- } else
-#endif /* i386 && SVR4 */
- {
- switch (scanCode) {
- case 0x59: scanCode = KEY_0x59; break;
- case 0x5a: scanCode = KEY_0x5A; break;
- case 0x5b: scanCode = KEY_0x5B; break;
- case 0x5c: scanCode = KEY_KP_Equal; break; /* Keypad Equal */
- case 0x5d: scanCode = KEY_0x5D; break;
- case 0x5e: scanCode = KEY_0x5E; break;
- case 0x5f: scanCode = KEY_0x5F; break;
- case 0x62: scanCode = KEY_0x62; break;
- case 0x63: scanCode = KEY_0x63; break;
- case 0x64: scanCode = KEY_0x64; break;
- case 0x65: scanCode = KEY_0x65; break;
- case 0x66: scanCode = KEY_0x66; break;
- case 0x67: scanCode = KEY_0x67; break;
- case 0x68: scanCode = KEY_0x68; break;
- case 0x69: scanCode = KEY_0x69; break;
- case 0x6a: scanCode = KEY_0x6A; break;
- case 0x6b: scanCode = KEY_0x6B; break;
- case 0x6c: scanCode = KEY_0x6C; break;
- case 0x6d: scanCode = KEY_0x6D; break;
- case 0x6e: scanCode = KEY_0x6E; break;
- case 0x6f: scanCode = KEY_0x6F; break;
- case 0x70: scanCode = KEY_0x70; break;
- case 0x71: scanCode = KEY_0x71; break;
- case 0x72: scanCode = KEY_0x72; break;
- case 0x73: scanCode = KEY_0x73; break;
- case 0x74: scanCode = KEY_0x74; break;
- case 0x75: scanCode = KEY_0x75; break;
- case 0x76: scanCode = KEY_0x76; break;
- }
- }
- }
-
- else if (
-#ifdef CSRG_BASED
- (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
- || xf86Info.consType == PCVT
-#ifdef WSCONS_SUPPORT
- || (xf86Info.consType == WSCONS && xf86Info.kbdEvents !=
- xf86WSKbdEvents)
-#endif
- ) &&
-#endif
- (xf86Info.scanPrefix == KEY_Prefix0)) {
- xf86Info.scanPrefix = 0;
-
- switch (scanCode) {
- case KEY_KP_7: scanCode = KEY_Home; break; /* curs home */
- case KEY_KP_8: scanCode = KEY_Up; break; /* curs up */
- case KEY_KP_9: scanCode = KEY_PgUp; break; /* curs pgup */
- case KEY_KP_4: scanCode = KEY_Left; break; /* curs left */
- case KEY_KP_5: scanCode = KEY_Begin; break; /* curs begin */
- case KEY_KP_6: scanCode = KEY_Right; break; /* curs right */
- case KEY_KP_1: scanCode = KEY_End; break; /* curs end */
- case KEY_KP_2: scanCode = KEY_Down; break; /* curs down */
- case KEY_KP_3: scanCode = KEY_PgDown; break; /* curs pgdown */
- case KEY_KP_0: scanCode = KEY_Insert; break; /* curs insert */
- case KEY_KP_Decimal: scanCode = KEY_Delete; break; /* curs delete */
- case KEY_Enter: scanCode = KEY_KP_Enter; break; /* keypad enter */
- case KEY_LCtrl: scanCode = KEY_RCtrl; break; /* right ctrl */
- case KEY_KP_Multiply: scanCode = KEY_Print; break; /* print */
- case KEY_Slash: scanCode = KEY_KP_Divide; break; /* keyp divide */
- case KEY_Alt: scanCode = KEY_AltLang; break; /* right alt */
- case KEY_ScrollLock: scanCode = KEY_Break; break; /* curs break */
- case 0x5b: scanCode = KEY_LMeta; break;
- case 0x5c: scanCode = KEY_RMeta; break;
- case 0x5d: scanCode = KEY_Menu; break;
- case KEY_F3: scanCode = KEY_F13; break;
- case KEY_F4: scanCode = KEY_F14; break;
- case KEY_F5: scanCode = KEY_F15; break;
- case KEY_F6: scanCode = KEY_F16; break;
- case KEY_F7: scanCode = KEY_F17; break;
- case KEY_KP_Plus: scanCode = KEY_KP_DEC; break;
- /*
- * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6)
- */
- case 0x2A:
- case 0x36:
- return;
- default:
- xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n",
- scanCode);
- /*
- * "Internet" keyboards are generating lots of new codes. Let them
- * pass. There is little consistency between them, so don't bother
- * with symbolic names at this level.
- */
- scanCode += 0x78;
- }
- }
-
- else if (xf86Info.scanPrefix == KEY_Prefix1)
- {
- xf86Info.scanPrefix = (scanCode == KEY_LCtrl) ? KEY_LCtrl : 0;
- return;
- }
-
- else if (xf86Info.scanPrefix == KEY_LCtrl)
- {
- xf86Info.scanPrefix = 0;
- if (scanCode != KEY_NumLock) return;
- scanCode = KEY_Pause; /* pause */
- }
-
-#ifndef __sparc64__
- /*
- * PC keyboards generate separate key codes for
- * Alt+Print and Control+Pause but in the X keyboard model
- * they need to get the same key code as the base key on the same
- * physical keyboard key.
- */
- if (scanCode == KEY_SysReqest)
- scanCode = KEY_Print;
- else if (scanCode == KEY_Break)
- scanCode = KEY_Pause;
-#endif
-
- /*
- * and now get some special keysequences
- */
-
- specialkey = scanCode;
-
-#ifdef __linux__
-customkeycodes:
-#endif
-#if defined(i386) || defined(__i386__)
- if (xf86IsPc98()) {
- switch (scanCode) {
- case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */
- case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */
- case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */
-
- /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
-
- case 0x62: specialkey = 0x3b; break; /* KEY_F1 */
- case 0x63: specialkey = 0x3c; break; /* KEY_F2 */
- case 0x64: specialkey = 0x3d; break; /* KEY_F3 */
- case 0x65: specialkey = 0x3e; break; /* KEY_F4 */
- case 0x66: specialkey = 0x3f; break; /* KEY_F5 */
- case 0x67: specialkey = 0x40; break; /* KEY_F6 */
- case 0x68: specialkey = 0x41; break; /* KEY_F7 */
- case 0x69: specialkey = 0x42; break; /* KEY_F8 */
- case 0x6a: specialkey = 0x43; break; /* KEY_F9 */
- case 0x6b: specialkey = 0x44; break; /* KEY_F10 */
- /* case 0x73: specialkey = 0x38; break; KEY_Alt */
- /* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */
- default: specialkey = 0x00; break;
- }
- }
-#endif
-#if defined (__sparc__) && defined(__linux__)
-special:
- if (kbdSun) {
- switch (scanCode) {
- case 0x2b: specialkey = KEY_BackSpace; break;
- case 0x47: specialkey = KEY_KP_Minus; break;
- case 0x7d: specialkey = KEY_KP_Plus; break;
-
- /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
-
- case 0x05: specialkey = KEY_F1; break;
- case 0x06: specialkey = KEY_F2; break;
- case 0x08: specialkey = KEY_F3; break;
- case 0x0a: specialkey = KEY_F4; break;
- case 0x0c: specialkey = KEY_F5; break;
- case 0x0e: specialkey = KEY_F6; break;
- case 0x10: specialkey = KEY_F7; break;
- case 0x11: specialkey = KEY_F8; break;
- case 0x12: specialkey = KEY_F9; break;
- case 0x07: specialkey = KEY_F10; break;
- case 0x09: specialkey = KEY_F11; break;
- case 0x0b: specialkey = KEY_F12; break;
- default: specialkey = 0; break;
- }
- /*
- * XXX XXX XXX:
- *
- * I really don't know what's wrong here, but passing the real
- * scanCode offsets by one from XKB's point of view.
- *
- * (ecd@skynet.be, 980405)
- */
- scanCode--;
- }
-#endif /* defined (__sparc__) && defined(__linux__) */
-
-#ifdef XKB
- if ((xf86Info.ddxSpecialKeys == SKWhenNeeded &&
- !xf86Info.ActionKeyBindingsSet) ||
- noXkbExtension || xf86Info.ddxSpecialKeys == SKAlways) {
-#endif
- if (!(ModifierDown(ShiftMask)) &&
- ((ModifierDown(ControlMask | AltMask)) ||
- (ModifierDown(ControlMask | AltLangMask))))
- {
- switch (specialkey) {
-
- case KEY_BackSpace:
- xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
- break;
-
- /*
- * Check grabs
- */
- case KEY_KP_Divide:
- xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
- break;
- case KEY_KP_Multiply:
- xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
- break;
-
- /*
- * Video mode switches
- */
- case KEY_KP_Minus: /* Keypad - */
- if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
-
- case KEY_KP_Plus: /* Keypad + */
- if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
-
- /* Under QNX4, we set the vtPending flag for VT switching and
- * let the VT switch function do the rest...
- * This is a little different from the other OS'es.
- */
-#if defined(QNX4)
- case KEY_1:
- case KEY_2:
- case KEY_3:
- case KEY_4:
- case KEY_5:
- case KEY_6:
- case KEY_7:
- case KEY_8:
- case KEY_9:
- if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
- if (down) {
- int vtno = specialkey - KEY_1 + 1;
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- }
- return;
- }
- break;
-#endif
-
-#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) || defined(__SCO__) || defined(__UNIXWARE__)
- /*
- * Under Linux, the raw keycodes are consumed before the kernel
- * does any processing on them, so we must emulate the vt switching
- * we want ourselves.
- */
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- case KEY_F11:
- case KEY_F12:
- if ((VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
-#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)))
- && (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
-#endif
- ) {
- int vtno = specialkey - KEY_F1 + 1;
- if (specialkey == KEY_F11 || specialkey == KEY_F12)
- vtno = specialkey - KEY_F11 + 11;
- if (down)
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- return;
- }
- break;
-#endif /* linux || BSD with VTs */
-
- /* just worth mentioning here: any 386bsd keyboard driver
- * (pccons.c or co_kbd.c) catches CTRL-ALT-DEL and CTRL-ALT-ESC
- * before any application (e.g. XF86) will see it
- * OBS: syscons does not, nor does pcvt !
- */
- }
- }
-
- /*
- * Start of actual Solaris VT switching code.
- * This should pretty much emulate standard SVR4 switching keys.
- *
- * DWH 12/2/93
- */
-
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
- {
- switch (specialkey)
- {
- /*
- * syscons on *BSD doesn't have a VT #0 -- don't think Linux does
- * either
- */
-#if defined (sun) && defined (i386) && defined (SVR4)
- case KEY_H:
- if (VTSysreqToggle && down)
- {
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, NULL);
- VTSysreqToggle = 0;
- return;
- }
- break;
-
- /*
- * Yah, I know the N, and P keys seem backwards, however that's
- * how they work under Solaris
- * XXXX N means go to next active VT not necessarily vtno+1 (or vtno-1)
- */
-
- case KEY_N:
- if (VTSysreqToggle && down)
- {
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-
- case KEY_P:
- if (VTSysreqToggle && down)
- {
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-#endif
-
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down)
- { int vtno = specialkey - KEY_F1 + 1;
- if (specialkey == KEY_F11 || specialkey == KEY_F12)
- vtno = specialkey - KEY_F11 + 11;
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- VTSysreqToggle = FALSE;
- return;
- }
- break;
-
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
-
- case KEY_SysReqest:
- if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask)))
- VTSysreqToggle = TRUE;
- break;
-
- default:
- if (VTSysreqToggle)
- {
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- VTSysreqToggle = FALSE;
-
- }
- }
- }
-
-#endif /* USE_VT_SYSREQ */
-
-#ifdef __SCO__
- /*
- * With the console in raw mode, SCO will not switch consoles,
- * you get around this by activating the next console along, if
- * this fails then go back to console 0, if there is only one
- * then it doesn't matter, switching to yourself is a nop as far
- * as the console driver is concerned.
- * We could do something similar to linux here but SCO ODT uses
- * Ctrl-PrintScrn, so why change?
- */
- if (specialkey == KEY_Print && ModifierDown(ControlMask)) {
- if (down)
- xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
- return;
- }
-#endif /* __SCO__ */
-#ifdef XKB
- }
-#endif
-
- /*
- * Now map the scancodes to real X-keycodes ...
- */
- keycode = scanCode + MIN_KEYCODE;
- keysym = (keyc->curKeySyms.map +
- keyc->curKeySyms.mapWidth *
- (keycode - keyc->curKeySyms.minKeyCode));
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- /*
- * Filter autorepeated caps/num/scroll lock keycodes.
- */
-#define CAPSFLAG 0x01
-#define NUMFLAG 0x02
-#define SCROLLFLAG 0x04
-#define MODEFLAG 0x08
- if( down ) {
- switch( keysym[0] ) {
- case XK_Caps_Lock :
- if (lockkeys & CAPSFLAG)
- return;
- else
- lockkeys |= CAPSFLAG;
- break;
-
- case XK_Num_Lock :
- if (lockkeys & NUMFLAG)
- return;
- else
- lockkeys |= NUMFLAG;
- break;
-
- case XK_Scroll_Lock :
- if (lockkeys & SCROLLFLAG)
- return;
- else
- lockkeys |= SCROLLFLAG;
- break;
- }
- if (keysym[1] == XF86XK_ModeLock)
- {
- if (lockkeys & MODEFLAG)
- return;
- else
- lockkeys |= MODEFLAG;
- }
-
- }
- else {
- switch( keysym[0] ) {
- case XK_Caps_Lock :
- lockkeys &= ~CAPSFLAG;
- break;
-
- case XK_Num_Lock :
- lockkeys &= ~NUMFLAG;
- break;
-
- case XK_Scroll_Lock :
- lockkeys &= ~SCROLLFLAG;
- break;
- }
- if (keysym[1] == XF86XK_ModeLock)
- lockkeys &= ~MODEFLAG;
- }
-
- /*
- * LockKey special handling:
- * ignore releases, toggle on & off on presses.
- * Don't deal with the Caps_Lock keysym directly, but check the lock modifier
- */
- if (keyc->modifierMap[keycode] & LockMask ||
- keysym[0] == XK_Scroll_Lock ||
- keysym[1] == XF86XK_ModeLock ||
- keysym[0] == XK_Num_Lock)
- {
- Bool flag;
-
- if (!down) return;
- if (KeyPressed(keycode)) {
- down = !down;
- flag = FALSE;
- }
- else
- flag = TRUE;
-
- if (keyc->modifierMap[keycode] & LockMask) xf86Info.capsLock = flag;
- if (keysym[0] == XK_Num_Lock) xf86Info.numLock = flag;
- if (keysym[0] == XK_Scroll_Lock) xf86Info.scrollLock = flag;
- if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag;
- updateLeds = TRUE;
- }
-
- if (!xf86Info.kbdCustomKeycodes) {
- /*
- * normal, non-keypad keys
- */
- if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) {
-#if !defined(CSRG_BASED) && \
- !defined(__GNU__) && \
- defined(KB_84)
- /*
- * magic ALT_L key on AT84 keyboards for multilingual support
- */
- if (xf86Info.kbdType == KB_84 &&
- ModifierDown(AltMask) &&
- keysym[2] != NoSymbol)
- {
- UsePrefix = TRUE;
- Direction = TRUE;
- }
-#endif /* !CSRG_BASED && ... */
- }
- }
- if (updateLeds) xf86UpdateKbdLeds();
-#ifdef XKB
- }
-#endif
-
- /*
- * check for an autorepeat-event
- */
- if (down && KeyPressed(keycode)) {
- KbdFeedbackClassRec *kbdfeed = ((DeviceIntPtr)xf86Info.pKeyboard)->kbdfeed;
- if ((xf86Info.autoRepeat != AutoRepeatModeOn) ||
- keyc->modifierMap[keycode] ||
- (kbdfeed && !(kbdfeed->ctrl.autoRepeats[keycode>>3] & ( 1<<(keycode&7) ))))
- return;
- }
-
-
- xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis();
- /*
- * And now send these prefixes ...
- * NOTE: There cannot be multiple Mode_Switch keys !!!!
- */
- if (UsePrefix)
- {
- ENQUEUE(&kevent,
- keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
- (Direction ? KeyPress : KeyRelease),
- XE_KEYBOARD);
- ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
- ENQUEUE(&kevent,
- keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
- (Direction ? KeyRelease : KeyPress),
- XE_KEYBOARD);
- }
- else
- {
- ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
- }
-}
-#endif /* !__UNIXOS2__ */
-
#define ModifierIsSet(k) ((modifiers & (k)) == (k))
_X_EXPORT Bool
@@ -1137,8 +452,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
if (XFD_ANYSET(&devicesWithInput)) {
- if (xf86Info.kbdEvents)
- (xf86Info.kbdEvents)();
pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->read_input && pInfo->fd >= 0 &&
@@ -1161,8 +474,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
InputInfoPtr pInfo;
- (xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */
-
pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->read_input && pInfo->fd >= 0) {
@@ -1470,6 +781,65 @@ xf86SigMemDebug(int signo)
}
#endif
+static void
+xf86ReleaseKeys(DeviceIntPtr pDev)
+{
+ KeyClassPtr keyc = NULL;
+ KeySym *map = NULL;
+ xEvent ke;
+ int i = 0, j = 0, nevents = 0;
+
+ ErrorF("releasekeys: called on device %s (%d)\n", pDev->name, pDev->id);
+
+ if (!pDev || !pDev->key)
+ return;
+
+ keyc = pDev->key;
+ map = keyc->curKeySyms.map;
+
+ /*
+ * Hmm... here is the biggest hack of every time !
+ * It may be possible that a switch-vt procedure has finished BEFORE
+ * you released all keys neccessary to do this. That peculiar behavior
+ * can fool the X-server pretty much, cause it assumes that some keys
+ * were not released. TWM may stuck alsmost completly....
+ * OK, what we are doing here is after returning from the vt-switch
+ * exeplicitely unrelease all keyboard keys before the input-devices
+ * are reenabled.
+ */
+
+ for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
+ i < keyc->curKeySyms.maxKeyCode;
+ i++, map += keyc->curKeySyms.mapWidth) {
+ if (KeyPressed(i)) {
+ switch (*map) {
+ /* Don't release the lock keys */
+ case XK_Caps_Lock:
+ case XK_Shift_Lock:
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Kana_Lock:
+ break;
+ default:
+ if (pDev == inputInfo.keyboard) {
+ ke.u.keyButtonPointer.time = GetTimeInMillis();
+ ke.u.keyButtonPointer.rootX = 0;
+ ke.u.keyButtonPointer.rootY = 0;
+ ke.u.u.type = KeyRelease;
+ ke.u.u.detail = i;
+ (*pDev->public.processInputProc) (&ke, pDev, 1);
+ }
+ else {
+ nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
+ for (j = 0; j < nevents; j++)
+ EqEnqueue(pDev, xf86Events + i);
+ }
+ break;
+ }
+ }
+ }
+}
+
/*
* xf86VTSwitch --
* Handle requests for switching the vt.
@@ -1515,10 +885,10 @@ xf86VTSwitch()
* Keep the order: Disable Device > LeaveVT
* EnterVT > EnableDevice
*/
- DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
- DisableDevice(pInfo->dev);
+ if (pInfo->dev)
+ DisableDevice(pInfo->dev);
pInfo = pInfo->next;
}
#endif /* !__UNIXOS2__ */
@@ -1556,12 +926,16 @@ xf86VTSwitch()
SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
#if !defined(__UNIXOS2__)
- EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
- EnableDevice(pInfo->dev);
+ if (pInfo->dev) {
+ xf86ReleaseKeys(pInfo->dev);
+ EnableDevice(pInfo->dev);
+ }
pInfo = pInfo->next;
}
+ /* XXX HACK */
+ xf86ReleaseKeys(inputInfo.keyboard);
#endif /* !__UNIXOS2__ */
for (ih = InputHandlers; ih; ih = ih->next)
xf86EnableInputHandler(ih);
@@ -1618,12 +992,16 @@ xf86VTSwitch()
SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
#if !defined(__UNIXOS2__)
- EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
- EnableDevice(pInfo->dev);
+ if (pInfo->dev) {
+ xf86ReleaseKeys(pInfo->dev);
+ EnableDevice(pInfo->dev);
+ }
pInfo = pInfo->next;
}
+ /* XXX HACK */
+ xf86ReleaseKeys(inputInfo.keyboard);
#endif /* !__UNIXOS2__ */
for (ih = InputHandlers; ih; ih = ih->next)
@@ -1745,9 +1123,6 @@ xf86ReloadInputDevs(int sig)
signal(sig, (void(*)(int))xf86ReloadInputDevs);
- DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
- EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
-
pInfo = xf86InputDevs;
while (pInfo) {
DisableDevice(pInfo->dev);
@@ -1758,6 +1133,11 @@ xf86ReloadInputDevs(int sig)
return;
}
+_X_EXPORT void
+DDXRingBell(int volume, int pitch, int duration) {
+ xf86OSRingBell(volume, pitch, duration);
+}
+
#ifdef WSCONS_SUPPORT
/* XXX Currently XKB is mandatory. */
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 745c06379..9b23710bb 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -93,36 +93,11 @@ InputInfoPtr xf86InputDevs = NULL;
/* Globals that video drivers may not access */
xf86InfoRec xf86Info = {
- NULL, /* pKeyboard */
- NULL, /* kbdProc */
- NULL, /* kbdEvents */
-1, /* consoleFd */
- -1, /* kbdFd */
-1, /* vtno */
- -1, /* kbdType */
- -1, /* kbdRate */
- -1, /* kbdDelay */
- -1, /* bell_pitch */
- -1, /* bell_duration */
- TRUE, /* autoRepeat */
- 0, /* leds */
- 0, /* xleds */
NULL, /* vtinit */
- 0, /* scanPrefix */
- FALSE, /* capsLock */
- FALSE, /* numLock */
- FALSE, /* scrollLock */
- FALSE, /* modeSwitchLock */
- FALSE, /* composeLock */
FALSE, /* vtSysreq */
SKWhenNeeded, /* ddxSpecialKeys */
- FALSE, /* ActionKeyBindingsSet */
-#if defined(SVR4) && defined(i386)
- FALSE, /* panix106 */
-#endif
-#if defined(__OpenBSD__) || defined(__NetBSD__)
- 0, /* wskbdType */
-#endif
NULL, /* pMouse */
#ifdef XINPUT
NULL, /* mouseLocal */
@@ -141,20 +116,6 @@ xf86InfoRec xf86Info = {
-1, /* screenFd */
-1, /* consType */
#endif
-#ifdef XKB
- NULL, /* xkbkeymap */
- NULL, /* xkbkeycodes */
- NULL, /* xkbtypes */
- NULL, /* xkbcompat */
- NULL, /* xkbsymbols */
- NULL, /* xkbgeometry */
- FALSE, /* xkbcomponents_specified */
- NULL, /* xkbrules */
- NULL, /* xkbmodel */
- NULL, /* xkblayout */
- NULL, /* xkbvariant */
- NULL, /* xkboptions */
-#endif
FALSE, /* allowMouseOpenFail */
TRUE, /* vidModeEnabled */
FALSE, /* vidModeAllowNonLocal */
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index c7d3fae7a..d7fc43731 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -141,6 +141,32 @@ xf86DeleteInputDriver(int drvIndex)
xf86InputDriverList[drvIndex] = NULL;
}
+InputDriverPtr
+xf86LookupInputDriver(const char *name)
+{
+ int i;
+
+ for (i = 0; i < xf86NumInputDrivers; i++) {
+ if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
+ xf86NameCmp(name, xf86InputDriverList[i]->driverName) == 0)
+ return xf86InputDriverList[i];
+ }
+ return NULL;
+}
+
+InputInfoPtr
+xf86LookupInput(const char *name)
+{
+ InputInfoPtr p;
+
+ for (p = xf86InputDevs; p != NULL; p = p->next) {
+ if (strcmp(name, p->name) == 0)
+ return p;
+ }
+
+ return NULL;
+}
+
_X_EXPORT void
xf86AddModuleInfo(ModuleInfoPtr info, pointer module)
{
@@ -2550,7 +2576,7 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
/*
* XXX quick hack to report correctly for OSs that can't do SilkenMouse
* yet. Should handle this differently so that alternate async methods
- * like Xqueue work correctly with this too.
+ * work correctly with this too.
*/
pScrn->silkenMouse = useSM && xf86SIGIOSupported();
if (serverGeneration == 1)
diff --git a/hw/xfree86/common/xf86InPriv.h b/hw/xfree86/common/xf86InPriv.h
index 58c18904e..62e4820cb 100644
--- a/hw/xfree86/common/xf86InPriv.h
+++ b/hw/xfree86/common/xf86InPriv.h
@@ -40,4 +40,7 @@ extern int xf86NumInputDrivers;
/* xf86Xinput.c */
void xf86ActivateDevice(InputInfoPtr pInfo);
+/* xf86Helper.c */
+InputDriverPtr xf86LookupInputDriver(const char *name);
+
#endif /* _xf86InPriv_h */
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 8f0a26dd7..33351f2c1 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -135,18 +135,6 @@ static int numFormats = 6;
#endif
static Bool formatsDone = FALSE;
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
-static InputDriverRec XF86KEYBOARD = {
- 1,
- "keyboard",
- NULL,
- NULL,
- NULL,
- NULL,
- 0
-};
-#endif
-
static Bool
xf86CreateRootWindow(WindowPtr pWin)
{
@@ -409,10 +397,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xfree(modulelist);
}
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- /* Setup the builtin input drivers */
- xf86AddInputDriver(&XF86KEYBOARD, NULL, 0);
-#endif
/* Load all input driver modules specified in the config file. */
if ((modulelist = xf86InputDriverlistFromConfig())) {
xf86LoadModules(modulelist, NULL);
@@ -984,21 +968,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
NULL);
}
-
-static InputDriverPtr
-MatchInput(IDevPtr pDev)
-{
- int i;
-
- for (i = 0; i < xf86NumInputDrivers; i++) {
- if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
- xf86NameCmp(pDev->driver, xf86InputDriverList[i]->driverName) == 0)
- return xf86InputDriverList[i];
- }
- return NULL;
-}
-
-
/*
* InitInput --
* Initialize all supported input devices.
@@ -1012,7 +981,6 @@ InitInput(argc, argv)
IDevPtr pDev;
InputDriverPtr pDrv;
InputInfoPtr pInfo;
- static InputInfoPtr coreKeyboard = NULL, corePointer = NULL;
xf86Info.vtRequestsPending = FALSE;
xf86Info.inputPending = FALSE;
@@ -1020,19 +988,7 @@ InitInput(argc, argv)
if (serverGeneration == 1) {
/* Call the PreInit function for each input device instance. */
for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- /* XXX The keyboard driver is a special case for now. */
- if (!xf86NameCmp(pDev->driver, "keyboard")) {
- xf86MsgVerb(X_WARNING, 0, "*** WARNING the legacy keyboard driver \"keyboard\" is deprecated\n");
- xf86MsgVerb(X_WARNING, 0, "*** and will be removed in the next release of the Xorg server.\n");
- xf86MsgVerb(X_WARNING, 0, "*** Please consider using the the new \"kbd\" driver for \"%s\".\n",
- pDev->identifier);
-
- continue;
- }
-#endif
-
- if ((pDrv = MatchInput(pDev)) == NULL) {
+ if ((pDrv = xf86LookupInputDriver(pDev->driver)) == NULL) {
xf86Msg(X_ERROR, "No Input driver matching `%s'\n", pDev->driver);
/* XXX For now, just continue. */
continue;
@@ -1054,80 +1010,18 @@ InitInput(argc, argv)
xf86DeleteInput(pInfo, 0);
continue;
}
- if (pInfo->flags & XI86_CORE_KEYBOARD) {
- if (coreKeyboard) {
- xf86Msg(X_ERROR,
- "Attempt to register more than one core keyboard (%s)\n",
- pInfo->name);
- pInfo->flags &= ~XI86_CORE_KEYBOARD;
- } else {
- if (!(pInfo->flags & XI86_KEYBOARD_CAPABLE)) {
- /* XXX just a warning for now */
- xf86Msg(X_WARNING,
- "%s: does not have core keyboard capabilities\n",
- pInfo->name);
- }
- coreKeyboard = pInfo;
- }
- }
- if (pInfo->flags & XI86_CORE_POINTER) {
- if (corePointer) {
- xf86Msg(X_ERROR,
- "Attempt to register more than one core pointer (%s)\n",
- pInfo->name);
- pInfo->flags &= ~XI86_CORE_POINTER;
- } else {
- if (!(pInfo->flags & XI86_POINTER_CAPABLE)) {
- /* XXX just a warning for now */
- xf86Msg(X_WARNING,
- "%s: does not have core pointer capabilities\n",
- pInfo->name);
- }
- corePointer = pInfo;
- }
- }
}
- if (!corePointer) {
- xf86Msg(X_WARNING, "No core pointer registered\n");
- /* XXX register a dummy core pointer */
- }
-#ifdef NEW_KBD
- if (!coreKeyboard) {
- xf86Msg(X_WARNING, "No core keyboard registered\n");
- /* XXX register a dummy core keyboard */
- }
-#endif
}
/* Initialise all input devices. */
pInfo = xf86InputDevs;
while (pInfo) {
+ xf86Msg(X_INFO, "evaluating device (%s)\n", pInfo->name);
xf86ActivateDevice(pInfo);
pInfo = pInfo->next;
}
- if (coreKeyboard) {
- xf86Info.pKeyboard = coreKeyboard->dev;
- xf86Info.kbdEvents = NULL; /* to prevent the internal keybord driver usage*/
- }
- else {
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
- /* Only set this if we're allowing the old driver. */
- if (xf86Info.kbdProc != NULL)
- xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE);
-#endif
- }
- if (corePointer)
- xf86Info.pMouse = corePointer->dev;
- if (xf86Info.pKeyboard)
- RegisterKeyboardDevice(xf86Info.pKeyboard);
-
- miRegisterPointerDevice(screenInfo.screens[0], xf86Info.pMouse);
-#ifdef XINPUT
- xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
-#else
- mieqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
-#endif
+ mieqInit();
}
#ifndef SET_STDERR_NONBLOCKING
@@ -1247,12 +1141,6 @@ AbortDDX()
int i;
/*
- * try to deinitialize all input devices
- */
- if (xf86Info.kbdProc && xf86Info.pKeyboard)
- (xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE);
-
- /*
* try to restore the original video state
*/
#ifdef HAS_USL_VTS
diff --git a/hw/xfree86/common/xf86Io.c b/hw/xfree86/common/xf86Io.c
deleted file mode 100644
index 86ac74522..000000000
--- a/hw/xfree86/common/xf86Io.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/*
- * Copyright (c) 1992-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-/* $XConsortium: xf86Io.c /main/27 1996/10/19 17:58:55 kaleb $ */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#define XF86_OS_PRIVS
-#include "xf86_OSlib.h"
-#include "mipointer.h"
-
-#ifdef XINPUT
-#include "xf86Xinput.h"
-#include <X11/extensions/XIproto.h>
-#include "exevents.h"
-#endif
-
-#ifdef XKB
-#include <X11/extensions/XKB.h>
-#include <X11/extensions/XKBstr.h>
-#include <X11/extensions/XKBsrv.h>
-#endif
-
-unsigned int xf86InitialCaps = 0;
-unsigned int xf86InitialNum = 0;
-unsigned int xf86InitialScroll = 0;
-
-#include "atKeynames.h"
-
-/*
- * xf86KbdBell --
- * Ring the terminal/keyboard bell for an amount of time proportional to
- * "loudness".
- */
-
-void
-xf86KbdBell(percent, pKeyboard, ctrl, unused)
- int percent; /* Percentage of full volume */
- DeviceIntPtr pKeyboard; /* Keyboard to ring */
- pointer ctrl;
- int unused;
-{
- xf86SoundKbdBell(percent, xf86Info.bell_pitch, xf86Info.bell_duration);
-}
-
-void
-xf86UpdateKbdLeds()
-{
- int leds = 0;
- if (xf86Info.capsLock) leds |= XLED1;
- if (xf86Info.numLock) leds |= XLED2;
- if (xf86Info.scrollLock || xf86Info.modeSwitchLock) leds |= XLED3;
- if (xf86Info.composeLock) leds |= XLED4;
- xf86Info.leds = (xf86Info.leds & xf86Info.xleds) | (leds & ~xf86Info.xleds);
- xf86KbdLeds();
-}
-
-void
-xf86KbdLeds ()
-{
- int leds, real_leds = 0;
-
-#if defined (__sparc__) && defined(__linux__)
- static int kbdSun = -1;
- if (kbdSun == -1) {
- if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) ||
- (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun")))
- kbdSun = 1;
- else
- kbdSun = 0;
- }
- if (kbdSun) {
- if (xf86Info.leds & 0x08) real_leds |= XLED1;
- if (xf86Info.leds & 0x04) real_leds |= XLED3;
- if (xf86Info.leds & 0x02) real_leds |= XLED4;
- if (xf86Info.leds & 0x01) real_leds |= XLED2;
- leds = real_leds;
- real_leds = 0;
- } else {
- leds = xf86Info.leds;
- }
-#else
- leds = xf86Info.leds;
-#endif /* defined (__sparc__) */
-
-#ifdef LED_CAP
- if (leds & XLED1) real_leds |= LED_CAP;
- if (leds & XLED2) real_leds |= LED_NUM;
- if (leds & XLED3) real_leds |= LED_SCR;
-#ifdef LED_COMP
- if (leds & XLED4) real_leds |= LED_COMP;
-#else
- if (leds & XLED4) real_leds |= LED_SCR;
-#endif
-#endif
-#ifdef sun
- /* Pass through any additional LEDs, such as Kana LED on Sun Japanese kbd */
- real_leds |= (leds & 0xFFFFFFF0);
-#endif
- xf86SetKbdLeds(real_leds);
- (void)leds;
-}
-
-/*
- * xf86KbdCtrl --
- * Alter some of the keyboard control parameters. All special protocol
- * values are handled by dix (ProgChangeKeyboardControl)
- */
-
-void
-xf86KbdCtrl (pKeyboard, ctrl)
- DevicePtr pKeyboard; /* Keyboard to alter */
- KeybdCtrl *ctrl;
-{
- int leds;
- xf86Info.bell_pitch = ctrl->bell_pitch;
- xf86Info.bell_duration = ctrl->bell_duration;
- xf86Info.autoRepeat = ctrl->autoRepeat;
-
- xf86Info.composeLock = (ctrl->leds & XCOMP) ? TRUE : FALSE;
-
- leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR));
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- xf86Info.leds = (leds & xf86Info.xleds)|(xf86Info.leds & ~xf86Info.xleds);
-#ifdef XKB
- } else {
- xf86Info.leds = leds;
- }
-#endif
-
- xf86KbdLeds();
-}
-
-/*
- * xf86InitKBD --
- * Reinitialize the keyboard. Only set Lockkeys according to ours leds.
- * Depress all other keys.
- */
-
-void
-xf86InitKBD(init)
-Bool init;
-{
- char leds = 0, rad;
- unsigned int i;
- xEvent kevent;
- DeviceIntPtr pKeyboard = xf86Info.pKeyboard;
- KeyClassRec *keyc = xf86Info.pKeyboard->key;
- KeySym *map = keyc->curKeySyms.map;
-
- kevent.u.keyButtonPointer.time = GetTimeInMillis();
- kevent.u.keyButtonPointer.rootX = 0;
- kevent.u.keyButtonPointer.rootY = 0;
-
- /*
- * Hmm... here is the biggest hack of every time !
- * It may be possible that a switch-vt procedure has finished BEFORE
- * you released all keys neccessary to do this. That peculiar behavior
- * can fool the X-server pretty much, cause it assumes that some keys
- * were not released. TWM may stuck alsmost completly....
- * OK, what we are doing here is after returning from the vt-switch
- * exeplicitely unrelease all keyboard keys before the input-devices
- * are reenabled.
- */
- for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
- i < keyc->curKeySyms.maxKeyCode;
- i++, map += keyc->curKeySyms.mapWidth)
- if (KeyPressed(i))
- {
- switch (*map) {
- /* Don't release the lock keys */
- case XK_Caps_Lock:
- case XK_Shift_Lock:
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Kana_Lock:
- break;
- default:
- kevent.u.u.detail = i;
- kevent.u.u.type = KeyRelease;
- (* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1);
- }
- }
-
- xf86Info.scanPrefix = 0;
-
- if (init)
- {
- /*
- * we must deal here with the fact, that on some cases the numlock or
- * capslock key are enabled BEFORE the server is started up. So look
- * here at the state on the according LEDS to determine whether a
- * lock-key is already set.
- */
-
- xf86Info.capsLock = FALSE;
- xf86Info.numLock = FALSE;
- xf86Info.scrollLock = FALSE;
- xf86Info.modeSwitchLock = FALSE;
- xf86Info.composeLock = FALSE;
-
-#ifdef LED_CAP
-#ifdef INHERIT_LOCK_STATE
- leds = xf86Info.leds;
-
- for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
- i < keyc->curKeySyms.maxKeyCode;
- i++, map += keyc->curKeySyms.mapWidth)
-
- switch(*map) {
-
- case XK_Caps_Lock:
- case XK_Shift_Lock:
- if (leds & LED_CAP)
- {
- xf86InitialCaps = i;
- xf86Info.capsLock = TRUE;
- }
- break;
-
- case XK_Num_Lock:
- if (leds & LED_NUM)
- {
- xf86InitialNum = i;
- xf86Info.numLock = TRUE;
- }
- break;
-
- case XK_Scroll_Lock:
- case XK_Kana_Lock:
- if (leds & LED_SCR)
- {
- xf86InitialScroll = i;
- xf86Info.scrollLock = TRUE;
- }
- break;
- }
-#endif /* INHERIT_LOCK_STATE */
- xf86SetKbdLeds(leds);
-#endif /* LED_CAP */
- (void)leds;
-
- if (xf86Info.kbdDelay <= 375) rad = 0x00;
- else if (xf86Info.kbdDelay <= 625) rad = 0x20;
- else if (xf86Info.kbdDelay <= 875) rad = 0x40;
- else rad = 0x60;
-
- if (xf86Info.kbdRate <= 2) rad |= 0x1F;
- else if (xf86Info.kbdRate >= 30) rad |= 0x00;
- else rad |= ((58 / xf86Info.kbdRate) - 2);
-
- xf86SetKbdRepeat(rad);
- }
-}
-
-/*
- * xf86KbdProc --
- * Handle the initialization, etc. of a keyboard.
- */
-
-int
-xf86KbdProc (pKeyboard, what)
- DeviceIntPtr pKeyboard; /* Keyboard to manipulate */
- int what; /* What to do to it */
-{
- KeySymsRec keySyms;
- CARD8 modMap[MAP_LENGTH];
- int kbdFd;
-
- switch (what) {
-
- case DEVICE_INIT:
- /*
- * First open and find the current state of the keyboard.
- */
-
- xf86KbdInit();
-
- xf86KbdGetMapping(&keySyms, modMap);
-
-
-#ifndef XKB
- defaultKeyboardControl.leds = xf86GetKbdLeds();
-#else
- defaultKeyboardControl.leds = 0;
-#endif
-
- /*
- * Perform final initialization of the system private keyboard
- * structure and fill in various slots in the device record
- * itself which couldn't be filled in before.
- */
-
- pKeyboard->public.on = FALSE;
-
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
-#ifdef XKB
- } else {
- XkbComponentNamesRec names;
- XkbDescPtr desc;
- Bool foundTerminate = FALSE;
- int keyc;
- if (xf86Info.xkbkeymap) {
- names.keymap = xf86Info.xkbkeymap;
- names.keycodes = NULL;
- names.types = NULL;
- names.compat = NULL;
- names.symbols = NULL;
- names.geometry = NULL;
- } else {
- names.keymap = NULL;
- names.keycodes = xf86Info.xkbkeycodes;
- names.types = xf86Info.xkbtypes;
- names.compat = xf86Info.xkbcompat;
- names.symbols = xf86Info.xkbsymbols;
- names.geometry = xf86Info.xkbgeometry;
- }
- if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified)
- && (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) {
- xf86Info.xkbrules = NULL;
- }
- XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel,
- xf86Info.xkblayout, xf86Info.xkbvariant,
- xf86Info.xkboptions);
-
- XkbInitKeyboardDeviceStruct(pKeyboard,
- &names,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
-
- /* Search keymap for Terminate action */
- desc = pKeyboard->key->xkbInfo->desc;
- for (keyc = desc->min_key_code; keyc <= desc->max_key_code; keyc++) {
- int i;
- for (i = 1; i <= XkbKeyNumActions(desc, keyc); i++) {
- if (XkbKeyAction(desc, keyc, i)
- && XkbKeyAction(desc, keyc, i)->type == XkbSA_Terminate) {
- foundTerminate = TRUE;
- goto searchdone;
- }
- }
- }
-searchdone:
- xf86Info.ActionKeyBindingsSet = foundTerminate;
- if (!foundTerminate)
- xf86Msg(X_INFO, "Server_Terminate keybinding not found\n");
- }
-#endif
-
- xf86InitKBD(TRUE);
- break;
-
- case DEVICE_ON:
- /*
- * Set the keyboard into "direct" mode and turn on
- * event translation.
- */
-
- kbdFd = xf86KbdOn();
- /*
- * Discard any pending input after a VT switch to prevent the server
- * passing on parts of the VT switch sequence.
- */
- sleep(1);
-#if defined(WSCONS_SUPPORT)
- if (xf86Info.consType != WSCONS) {
-#endif
- if (kbdFd != -1) {
- char buf[16];
- read(kbdFd, buf, 16);
- }
-#if defined(WSCONS_SUPPORT)
- }
-#endif
-
-#if !defined(__UNIXOS2__) /* Under EMX, keyboard cannot be select()'ed */
- if (kbdFd != -1)
- AddEnabledDevice(kbdFd);
-#endif /* __UNIXOS2__ */
-
- pKeyboard->public.on = TRUE;
- xf86InitKBD(FALSE);
- break;
-
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- /*
- * Restore original keyboard directness and translation.
- */
-
- kbdFd = xf86KbdOff();
-
- if (kbdFd != -1)
- RemoveEnabledDevice(kbdFd);
-
- pKeyboard->public.on = FALSE;
- break;
-
- }
- return (Success);
-}
diff --git a/hw/xfree86/common/xf86Kbd.c b/hw/xfree86/common/xf86Kbd.c
deleted file mode 100644
index a86581c25..000000000
--- a/hw/xfree86/common/xf86Kbd.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/*
- * Copyright (c) 1992-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifdef __UNIXOS2__
-#define I_NEED_OS2_H
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "atKeynames.h"
-#include "xf86Config.h"
-
-#include "xf86Keymap.h"
-
-#if defined(KDGKBTYPE) && \
- !defined(Lynx) && \
- !defined(__UNIXOS2__) && !defined(__mips__) && \
- !defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__)
-#define HAS_GETKBTYPE
-#endif
-#if defined(GIO_KEYMAP) && \
- !defined(Lynx) && \
- !defined(__UNIXOS2__) && !defined(__mips__) && \
- !defined(__arm32__) && !defined(__GNU__) && !defined(DGUX) && \
- !defined(__QNX__)
-#define HAS_GETKEYMAP
-
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
-
-/*
- * NOTE: Not all possible remappable symbols are remapped. There are two main
- * reasons:
- * a) The mapping between scancode and SYSV/386 - symboltable
- * is inconsistent between different versions and has some
- * BIG mistakes.
- * b) In X-Windows there is a difference between numpad-keys
- * and normal keys. SYSV/386 uses for both kinds of keys
- * the same symbol.
- *
- * Thus only the alpha keypad and the function keys are translated.
- * Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt.
- */
-
-static unsigned char remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
- XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- };
-
-#endif /* HAS_GETKEYMAP */
-
-/*
- * LegalModifier --
- * determine whether a key is a legal modifier key, i.e send a
- * press/release sequence.
- */
-
-/*ARGSUSED*/
-Bool
-LegalModifier(key, pDev)
- unsigned int key;
- DevicePtr pDev;
-{
- return (TRUE);
-}
-
-
-
-/*
- * xf86KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-xf86KbdGetMapping (pKeySyms, pModMap)
- KeySymsPtr pKeySyms;
- CARD8 *pModMap;
-{
- KeySym *k;
-#ifdef HAS_GETKEYMAP
- keymap_t keymap;
-#endif
- int i;
- KeySym *pMap;
-
-#ifdef HAS_GETKBTYPE
- char type;
-
- xf86Info.kbdType =
- ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
- if (xf86Info.kbdType == KB_84)
- pMap = map84;
- else
- pMap = map;
-#else
-/* OS/2 sets the keyboard type during xf86OpenKbd */
-#ifndef __UNIXOS2__
- xf86Info.kbdType = 0;
-#endif
- pMap = map;
-#endif
-
-#ifdef HAS_GETKEYMAP
- /*
- * use the keymap, which can be gotten from our oringinal vt??.
- * ( ttymap(1) !!!! )
- */
- if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) {
- for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
-
- if (remap[i]) {
-
- k = pMap + (remap[i] << 2);
-
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
-#endif
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = pMap, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- pKeySyms->map = pMap;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
diff --git a/hw/xfree86/common/xf86KbdBSD.c b/hw/xfree86/common/xf86KbdBSD.c
deleted file mode 100644
index 97a737db1..000000000
--- a/hw/xfree86/common/xf86KbdBSD.c
+++ /dev/null
@@ -1,1265 +0,0 @@
-/*
- * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk)
- * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * and from xf86KbdCODrv.c by Holger Veit
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1994-2002 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-/* $XConsortium: xf86KbdBSD.c /main/6 1996/10/23 13:12:27 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "atKeynames.h"
-#include "xf86Keymap.h"
-
-#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP)
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
-
-static unsigned char remap[NUM_KEYCODES] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-/* This table assumes the ibm code page 437 coding for characters
- * > 0x80. They are returned in this form by PCVT */
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
-#if 1
- /* This has been checked against what syscons actually does */
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol
-#else
- /* The old table, supposedly for pcvt. */
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
- XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol
-#endif
- };
-
-#ifdef __OpenBSD__
-/* don't mark AltR and CtrlR for remapping, since they
- * cannot be remapped by pccons */
-static unsigned char pccons_remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-/* This table assumes an iso8859_1 encoding for the characters
- * > 80, as returned by pccons */
-static KeySym latin1_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
- };
-#endif
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
-/*
- * LegalModifier --
- * determine whether a key is a legal modifier key, i.e send a
- * press/release sequence.
- */
-
-/*ARGSUSED*/
-Bool
-LegalModifier(key, pDev)
- unsigned int key;
- DevicePtr pDev;
-{
- return (TRUE);
-}
-
-/*
- * xf86KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-xf86KbdGetMapping (pKeySyms, pModMap)
- KeySymsPtr pKeySyms;
- CARD8 *pModMap;
-{
- KeySym *k;
- int i;
-
-#ifndef __bsdi__
- switch (xf86Info.consType) {
-
-#ifdef PCCONS_SUPPORT
- case PCCONS:
-#if defined(__OpenBSD__)
- /*
- * on OpenBSD, the pccons keymap is programmable, too
- */
- {
- pccons_keymap_t keymap[KB_NUM_KEYS];
- if (ioctl(xf86Info.consoleFd, CONSOLE_GET_KEYMAP, &keymap) != -1) {
- for (i = 0; i < KB_NUM_KEYS; i++)
- if (pccons_remap[i]) {
- k = map + (pccons_remap[i] << 2);
- switch (keymap[i].type) {
- case KB_ASCII:
- /* For ASCII keys, there is only one char in the keymap */
- k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]];
- k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]];
- k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]];
- k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]];
- break;
- case KB_SCROLL:
- k[0] = XK_Scroll_Lock;
- goto special;
- case KB_NUM:
- k[0] = XK_Num_Lock;
- goto special;
- case KB_CAPS:
- k[0] = XK_Caps_Lock;
- goto special;
- case KB_SHIFT:
- switch (keymap[i].unshift[0]) {
- case 1:
- /* left shift */
- k[0] = XK_Shift_L;
- break;
- case 2:
- /* right shift */
- k[0] = XK_Shift_R;
- break;
- default:
- k[0] = NoSymbol;
- }
- goto special;
- case KB_CTL:
- k[0] = XK_Control_L;
- goto special;
- case KB_ALT:
- k[0] = XK_Alt_L;
- goto special;
- case KB_FUNC:
- switch (keymap[i].unshift[2]) {
- case 'M':
- k[0] = XK_F1;
- break;
- case 'N':
- k[0] = XK_F2;
- break;
- case 'O':
- k[0] = XK_F3;
- break;
- case 'P':
- k[0] = XK_F4;
- break;
- case 'Q':
- k[0] = XK_F5;
- break;
- case 'R':
- k[0] = XK_F6;
- break;
- case 'S':
- k[0] = XK_F7;
- break;
- case 'T':
- k[0] = XK_F8;
- break;
- case 'U':
- k[0] = XK_F9;
- break;
- case 'V':
- k[0] = XK_F10;
- break;
- case 'W':
- k[0] = XK_F11;
- break;
- case 'X':
- k[0] = XK_F12;
- break;
- default:
- k[0] = NoSymbol;
- break;
- }
- goto special;
- default:
- k[0] = NoSymbol;
- special:
- k[1] = k[2] = k[3] = NoSymbol;
- }
- }
- } else {
- ErrorF("Can't read pccons keymap\n");
- }
- }
-#endif /* __OpenBSD__ */
- break;
-#endif
-
-/*
- * XXX wscons has no GIO_KEYMAP
- */
-#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP)
- case SYSCONS:
- case PCVT:
- {
- keymap_t keymap;
-
- if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) {
- for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
- if (remap[i]) {
- k = map + (remap[i] << 2);
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3])
- k[2] = k[3] = NoSymbol;
- }
- }
- }
- break;
-#endif /* SYSCONS || PCVT */
-
- }
-#endif /* !bsdi */
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- xf86Info.kbdType = 0;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-
-}
-
-#ifdef WSCONS_SUPPORT
-#include "atKeynames.h"
-
-static CARD8 wsUsbMap[] = {
- /* 0 */ KEY_NOTUSED,
- /* 1 */ KEY_NOTUSED,
- /* 2 */ KEY_NOTUSED,
- /* 3 */ KEY_NOTUSED,
- /* 4 */ KEY_A,
- /* 5 */ KEY_B,
- /* 6 */ KEY_C,
- /* 7 */ KEY_D,
- /* 8 */ KEY_E,
- /* 9 */ KEY_F,
- /* 10 */ KEY_G,
- /* 11 */ KEY_H,
- /* 12 */ KEY_I,
- /* 13 */ KEY_J,
- /* 14 */ KEY_K,
- /* 15 */ KEY_L,
- /* 16 */ KEY_M,
- /* 17 */ KEY_N,
- /* 18 */ KEY_O,
- /* 19 */ KEY_P,
- /* 20 */ KEY_Q,
- /* 21 */ KEY_R,
- /* 22 */ KEY_S,
- /* 23 */ KEY_T,
- /* 24 */ KEY_U,
- /* 25 */ KEY_V,
- /* 26 */ KEY_W,
- /* 27 */ KEY_X,
- /* 28 */ KEY_Y,
- /* 29 */ KEY_Z,
- /* 30 */ KEY_1, /* 1 !*/
- /* 31 */ KEY_2, /* 2 @ */
- /* 32 */ KEY_3, /* 3 # */
- /* 33 */ KEY_4, /* 4 $ */
- /* 34 */ KEY_5, /* 5 % */
- /* 35 */ KEY_6, /* 6 ^ */
- /* 36 */ KEY_7, /* 7 & */
- /* 37 */ KEY_8, /* 8 * */
- /* 38 */ KEY_9, /* 9 ( */
- /* 39 */ KEY_0, /* 0 ) */
- /* 40 */ KEY_Enter, /* Return */
- /* 41 */ KEY_Escape, /* Escape */
- /* 42 */ KEY_BackSpace, /* Backspace Delete */
- /* 43 */ KEY_Tab, /* Tab */
- /* 44 */ KEY_Space, /* Space */
- /* 45 */ KEY_Minus, /* - _ */
- /* 46 */ KEY_Equal, /* = + */
- /* 47 */ KEY_LBrace, /* [ { */
- /* 48 */ KEY_RBrace, /* ] } */
- /* 49 */ KEY_BSlash, /* \ | */
- /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */
- /* 51 */ KEY_SemiColon, /* ; : */
- /* 52 */ KEY_Quote, /* ' " */
- /* 53 */ KEY_Tilde, /* ` ~ */
- /* 54 */ KEY_Comma, /* , < */
- /* 55 */ KEY_Period, /* . > */
- /* 56 */ KEY_Slash, /* / ? */
- /* 57 */ KEY_CapsLock, /* Caps Lock */
- /* 58 */ KEY_F1, /* F1 */
- /* 59 */ KEY_F2, /* F2 */
- /* 60 */ KEY_F3, /* F3 */
- /* 61 */ KEY_F4, /* F4 */
- /* 62 */ KEY_F5, /* F5 */
- /* 63 */ KEY_F6, /* F6 */
- /* 64 */ KEY_F7, /* F7 */
- /* 65 */ KEY_F8, /* F8 */
- /* 66 */ KEY_F9, /* F9 */
- /* 67 */ KEY_F10, /* F10 */
- /* 68 */ KEY_F11, /* F11 */
- /* 69 */ KEY_F12, /* F12 */
- /* 70 */ KEY_Print, /* PrintScrn SysReq */
- /* 71 */ KEY_ScrollLock, /* Scroll Lock */
- /* 72 */ KEY_Pause, /* Pause Break */
- /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */
- /* 74 */ KEY_Home, /* Home */
- /* 75 */ KEY_PgUp, /* Page Up */
- /* 76 */ KEY_Delete, /* Delete */
- /* 77 */ KEY_End, /* End */
- /* 78 */ KEY_PgDown, /* Page Down */
- /* 79 */ KEY_Right, /* Right Arrow */
- /* 80 */ KEY_Left, /* Left Arrow */
- /* 81 */ KEY_Down, /* Down Arrow */
- /* 82 */ KEY_Up, /* Up Arrow */
- /* 83 */ KEY_NumLock, /* Num Lock */
- /* 84 */ KEY_KP_Divide, /* Keypad / */
- /* 85 */ KEY_KP_Multiply, /* Keypad * */
- /* 86 */ KEY_KP_Minus, /* Keypad - */
- /* 87 */ KEY_KP_Plus, /* Keypad + */
- /* 88 */ KEY_KP_Enter, /* Keypad Enter */
- /* 89 */ KEY_KP_1, /* Keypad 1 End */
- /* 90 */ KEY_KP_2, /* Keypad 2 Down */
- /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */
- /* 92 */ KEY_KP_4, /* Keypad 4 Left */
- /* 93 */ KEY_KP_5, /* Keypad 5 */
- /* 94 */ KEY_KP_6, /* Keypad 6 */
- /* 95 */ KEY_KP_7, /* Keypad 7 Home */
- /* 96 */ KEY_KP_8, /* Keypad 8 Up */
- /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */
- /* 98 */ KEY_KP_0, /* Keypad 0 Ins */
- /* 99 */ KEY_KP_Decimal, /* Keypad . Del */
- /* 100 */ KEY_Less, /* < > on some keyboards */
- /* 101 */ KEY_Menu, /* Menu */
- /* 102 */ KEY_NOTUSED,
- /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_NOTUSED,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_NOTUSED,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_NOTUSED,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_NOTUSED,
- /* 116 */ KEY_NOTUSED,
- /* 117 */ KEY_NOTUSED,
- /* 118 */ KEY_NOTUSED,
- /* 119 */ KEY_NOTUSED,
- /* 120 */ KEY_NOTUSED,
- /* 121 */ KEY_NOTUSED,
- /* 122 */ KEY_NOTUSED,
- /* 123 */ KEY_NOTUSED,
- /* 124 */ KEY_NOTUSED,
- /* 125 */ KEY_NOTUSED,
- /* 126 */ KEY_NOTUSED,
- /* 127 */ KEY_NOTUSED,
- /* 128 */ KEY_NOTUSED,
- /* 129 */ KEY_NOTUSED,
- /* 130 */ KEY_NOTUSED,
- /* 131 */ KEY_NOTUSED,
- /* 132 */ KEY_NOTUSED,
- /* 133 */ KEY_NOTUSED,
- /* 134 */ KEY_NOTUSED,
- /* 135 */ KEY_NOTUSED,
- /* 136 */ KEY_NOTUSED,
- /* 137 */ KEY_NOTUSED,
- /* 138 */ KEY_NOTUSED,
- /* 139 */ KEY_NOTUSED,
- /* 140 */ KEY_NOTUSED,
- /* 141 */ KEY_NOTUSED,
- /* 142 */ KEY_NOTUSED,
- /* 143 */ KEY_NOTUSED,
- /* 144 */ KEY_NOTUSED,
- /* 145 */ KEY_NOTUSED,
- /* 146 */ KEY_NOTUSED,
- /* 147 */ KEY_NOTUSED,
- /* 148 */ KEY_NOTUSED,
- /* 149 */ KEY_NOTUSED,
- /* 150 */ KEY_NOTUSED,
- /* 151 */ KEY_NOTUSED,
- /* 152 */ KEY_NOTUSED,
- /* 153 */ KEY_NOTUSED,
- /* 154 */ KEY_NOTUSED,
- /* 155 */ KEY_NOTUSED,
- /* 156 */ KEY_NOTUSED,
- /* 157 */ KEY_NOTUSED,
- /* 158 */ KEY_NOTUSED,
- /* 159 */ KEY_NOTUSED,
- /* 160 */ KEY_NOTUSED,
- /* 161 */ KEY_NOTUSED,
- /* 162 */ KEY_NOTUSED,
- /* 163 */ KEY_NOTUSED,
- /* 164 */ KEY_NOTUSED,
- /* 165 */ KEY_NOTUSED,
- /* 166 */ KEY_NOTUSED,
- /* 167 */ KEY_NOTUSED,
- /* 168 */ KEY_NOTUSED,
- /* 169 */ KEY_NOTUSED,
- /* 170 */ KEY_NOTUSED,
- /* 171 */ KEY_NOTUSED,
- /* 172 */ KEY_NOTUSED,
- /* 173 */ KEY_NOTUSED,
- /* 174 */ KEY_NOTUSED,
- /* 175 */ KEY_NOTUSED,
- /* 176 */ KEY_NOTUSED,
- /* 177 */ KEY_NOTUSED,
- /* 178 */ KEY_NOTUSED,
- /* 179 */ KEY_NOTUSED,
- /* 180 */ KEY_NOTUSED,
- /* 181 */ KEY_NOTUSED,
- /* 182 */ KEY_NOTUSED,
- /* 183 */ KEY_NOTUSED,
- /* 184 */ KEY_NOTUSED,
- /* 185 */ KEY_NOTUSED,
- /* 186 */ KEY_NOTUSED,
- /* 187 */ KEY_NOTUSED,
- /* 188 */ KEY_NOTUSED,
- /* 189 */ KEY_NOTUSED,
- /* 190 */ KEY_NOTUSED,
- /* 191 */ KEY_NOTUSED,
- /* 192 */ KEY_NOTUSED,
- /* 193 */ KEY_NOTUSED,
- /* 194 */ KEY_NOTUSED,
- /* 195 */ KEY_NOTUSED,
- /* 196 */ KEY_NOTUSED,
- /* 197 */ KEY_NOTUSED,
- /* 198 */ KEY_NOTUSED,
- /* 199 */ KEY_NOTUSED,
- /* 200 */ KEY_NOTUSED,
- /* 201 */ KEY_NOTUSED,
- /* 202 */ KEY_NOTUSED,
- /* 203 */ KEY_NOTUSED,
- /* 204 */ KEY_NOTUSED,
- /* 205 */ KEY_NOTUSED,
- /* 206 */ KEY_NOTUSED,
- /* 207 */ KEY_NOTUSED,
- /* 208 */ KEY_NOTUSED,
- /* 209 */ KEY_NOTUSED,
- /* 210 */ KEY_NOTUSED,
- /* 211 */ KEY_NOTUSED,
- /* 212 */ KEY_NOTUSED,
- /* 213 */ KEY_NOTUSED,
- /* 214 */ KEY_NOTUSED,
- /* 215 */ KEY_NOTUSED,
- /* 216 */ KEY_NOTUSED,
- /* 217 */ KEY_NOTUSED,
- /* 218 */ KEY_NOTUSED,
- /* 219 */ KEY_NOTUSED,
- /* 220 */ KEY_NOTUSED,
- /* 221 */ KEY_NOTUSED,
- /* 222 */ KEY_NOTUSED,
- /* 223 */ KEY_NOTUSED,
- /* 224 */ KEY_LCtrl, /* Left Control */
- /* 225 */ KEY_ShiftL, /* Left Shift */
- /* 226 */ KEY_Alt, /* Left Alt */
- /* 227 */ KEY_LMeta, /* Left Meta */
- /* 228 */ KEY_RCtrl, /* Right Control */
- /* 229 */ KEY_ShiftR, /* Right Shift */
- /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
- /* 231 */ KEY_LMeta, /* Right Meta XXX */
-};
-
-#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char))
-
-/* Map for adb keyboards */
-static CARD8 wsAdbMap[] = {
- /* 0 */ KEY_A,
- /* 1 */ KEY_S,
- /* 2 */ KEY_D,
- /* 3 */ KEY_F,
- /* 4 */ KEY_H,
- /* 5 */ KEY_G,
- /* 6 */ KEY_Z,
- /* 7 */ KEY_X,
- /* 8 */ KEY_C,
- /* 9 */ KEY_V,
- /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */
- /* 11 */ KEY_B,
- /* 12 */ KEY_Q,
- /* 13 */ KEY_W,
- /* 14 */ KEY_E,
- /* 15 */ KEY_R,
- /* 16 */ KEY_Y,
- /* 17 */ KEY_T,
- /* 18 */ KEY_1,
- /* 19 */ KEY_2,
- /* 20 */ KEY_3,
- /* 21 */ KEY_4,
- /* 22 */ KEY_6,
- /* 23 */ KEY_5,
- /* 24 */ KEY_Equal,
- /* 25 */ KEY_9,
- /* 26 */ KEY_7,
- /* 27 */ KEY_Minus,
- /* 28 */ KEY_8,
- /* 29 */ KEY_0,
- /* 30 */ KEY_RBrace,
- /* 31 */ KEY_O,
- /* 32 */ KEY_U,
- /* 33 */ KEY_LBrace,
- /* 34 */ KEY_I,
- /* 35 */ KEY_P,
- /* 36 */ KEY_Enter,
- /* 37 */ KEY_L,
- /* 38 */ KEY_J,
- /* 39 */ KEY_Quote,
- /* 40 */ KEY_K,
- /* 41 */ KEY_SemiColon,
- /* 42 */ KEY_BSlash,
- /* 43 */ KEY_Comma,
- /* 44 */ KEY_Slash,
- /* 45 */ KEY_N,
- /* 46 */ KEY_M,
- /* 47 */ KEY_Period,
- /* 48 */ KEY_Tab,
- /* 49 */ KEY_Space,
- /* 50 */ KEY_Tilde,
- /* 51 */ KEY_Delete,
- /* 52 */ KEY_AltLang,
- /* 53 */ KEY_Escape,
- /* 54 */ KEY_LCtrl,
- /* 55 */ KEY_Alt,
- /* 56 */ KEY_ShiftL,
- /* 57 */ KEY_CapsLock,
- /* 58 */ KEY_LMeta,
- /* 59 */ KEY_Left,
- /* 60 */ KEY_Right,
- /* 61 */ KEY_Down,
- /* 62 */ KEY_Up,
- /* 63 */ KEY_UNKNOWN, /* Fn */
- /* 64 */ KEY_NOTUSED,
- /* 65 */ KEY_KP_Decimal,
- /* 66 */ KEY_NOTUSED,
- /* 67 */ KEY_KP_Multiply,
- /* 68 */ KEY_NOTUSED,
- /* 69 */ KEY_KP_Plus,
- /* 70 */ KEY_NOTUSED,
- /* 71 */ KEY_UNKNOWN, /* Clear */
- /* 72 */ KEY_NOTUSED,
- /* 73 */ KEY_NOTUSED,
- /* 74 */ KEY_NOTUSED,
- /* 75 */ KEY_KP_Divide,
- /* 76 */ KEY_KP_Enter,
- /* 77 */ KEY_NOTUSED,
- /* 78 */ KEY_KP_Minus,
- /* 79 */ KEY_NOTUSED,
- /* 80 */ KEY_NOTUSED,
- /* 81 */ KEY_KP_Equal, /* Keypad = */
- /* 82 */ KEY_KP_0,
- /* 83 */ KEY_KP_1,
- /* 84 */ KEY_KP_2,
- /* 85 */ KEY_KP_3,
- /* 86 */ KEY_KP_4,
- /* 87 */ KEY_KP_5,
- /* 88 */ KEY_KP_6,
- /* 89 */ KEY_KP_7,
- /* 90 */ KEY_NOTUSED,
- /* 91 */ KEY_KP_8,
- /* 92 */ KEY_KP_9,
- /* 93 */ KEY_NOTUSED,
- /* 94 */ KEY_NOTUSED,
- /* 95 */ KEY_UNKNOWN, /* Keypad , */
- /* 96 */ KEY_F5,
- /* 97 */ KEY_F6,
- /* 98 */ KEY_F7,
- /* 99 */ KEY_F3,
- /* 100 */ KEY_F8,
- /* 101 */ KEY_F9,
- /* 102 */ KEY_NOTUSED,
- /* 103 */ KEY_F11,
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_KP_Enter,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_F10,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_F12,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_Home,
- /* 116 */ KEY_PgUp,
- /* 117 */ KEY_NOTUSED,
- /* 118 */ KEY_F4,
- /* 119 */ KEY_End,
- /* 120 */ KEY_F2,
- /* 121 */ KEY_PgDown,
- /* 122 */ KEY_F1,
- /* 123 */ KEY_NOTUSED,
- /* 124 */ KEY_NOTUSED,
- /* 125 */ KEY_NOTUSED,
- /* 126 */ KEY_NOTUSED,
- /* 127 */ KEY_NOTUSED,
- /* 128 */ KEY_NOTUSED,
- /* 129 */ KEY_NOTUSED,
- /* 130 */ KEY_NOTUSED,
- /* 131 */ KEY_NOTUSED,
- /* 132 */ KEY_NOTUSED,
- /* 133 */ KEY_NOTUSED,
- /* 134 */ KEY_NOTUSED,
- /* 135 */ KEY_NOTUSED,
- /* 136 */ KEY_NOTUSED,
- /* 137 */ KEY_NOTUSED,
- /* 138 */ KEY_NOTUSED,
- /* 139 */ KEY_NOTUSED,
- /* 140 */ KEY_NOTUSED,
- /* 141 */ KEY_NOTUSED,
- /* 142 */ KEY_NOTUSED,
- /* 143 */ KEY_NOTUSED,
- /* 144 */ KEY_NOTUSED,
- /* 145 */ KEY_NOTUSED,
- /* 146 */ KEY_NOTUSED,
- /* 147 */ KEY_NOTUSED,
- /* 148 */ KEY_NOTUSED,
- /* 149 */ KEY_NOTUSED,
- /* 150 */ KEY_NOTUSED,
- /* 151 */ KEY_NOTUSED,
- /* 152 */ KEY_NOTUSED,
- /* 153 */ KEY_NOTUSED,
- /* 154 */ KEY_NOTUSED,
- /* 155 */ KEY_NOTUSED,
- /* 156 */ KEY_NOTUSED,
- /* 157 */ KEY_NOTUSED,
- /* 158 */ KEY_NOTUSED,
- /* 159 */ KEY_NOTUSED,
- /* 160 */ KEY_NOTUSED,
- /* 161 */ KEY_NOTUSED,
- /* 162 */ KEY_NOTUSED,
- /* 163 */ KEY_NOTUSED,
- /* 164 */ KEY_NOTUSED,
- /* 165 */ KEY_NOTUSED,
- /* 166 */ KEY_NOTUSED,
- /* 167 */ KEY_NOTUSED,
- /* 168 */ KEY_NOTUSED,
- /* 169 */ KEY_NOTUSED,
- /* 170 */ KEY_NOTUSED,
- /* 171 */ KEY_NOTUSED,
- /* 172 */ KEY_NOTUSED,
- /* 173 */ KEY_NOTUSED,
- /* 174 */ KEY_NOTUSED,
- /* 175 */ KEY_NOTUSED,
- /* 176 */ KEY_NOTUSED,
- /* 177 */ KEY_NOTUSED,
- /* 178 */ KEY_NOTUSED,
- /* 179 */ KEY_NOTUSED,
- /* 180 */ KEY_NOTUSED,
- /* 181 */ KEY_NOTUSED,
- /* 182 */ KEY_NOTUSED,
- /* 183 */ KEY_NOTUSED,
- /* 184 */ KEY_NOTUSED,
- /* 185 */ KEY_NOTUSED,
- /* 186 */ KEY_NOTUSED,
- /* 187 */ KEY_NOTUSED,
- /* 188 */ KEY_NOTUSED,
- /* 189 */ KEY_NOTUSED,
- /* 190 */ KEY_NOTUSED,
- /* 191 */ KEY_NOTUSED,
- /* 192 */ KEY_NOTUSED,
- /* 193 */ KEY_NOTUSED,
- /* 194 */ KEY_NOTUSED,
- /* 195 */ KEY_NOTUSED,
- /* 196 */ KEY_NOTUSED,
- /* 197 */ KEY_NOTUSED,
- /* 198 */ KEY_NOTUSED,
- /* 199 */ KEY_NOTUSED,
- /* 200 */ KEY_NOTUSED,
- /* 201 */ KEY_NOTUSED,
- /* 202 */ KEY_NOTUSED,
- /* 203 */ KEY_NOTUSED,
- /* 204 */ KEY_NOTUSED,
- /* 205 */ KEY_NOTUSED,
- /* 206 */ KEY_NOTUSED,
- /* 207 */ KEY_NOTUSED,
- /* 208 */ KEY_NOTUSED,
- /* 209 */ KEY_NOTUSED,
- /* 210 */ KEY_NOTUSED,
- /* 211 */ KEY_NOTUSED,
- /* 212 */ KEY_NOTUSED,
- /* 213 */ KEY_NOTUSED,
- /* 214 */ KEY_NOTUSED,
- /* 215 */ KEY_NOTUSED,
- /* 216 */ KEY_NOTUSED,
- /* 217 */ KEY_NOTUSED,
- /* 218 */ KEY_NOTUSED,
- /* 219 */ KEY_NOTUSED,
- /* 220 */ KEY_NOTUSED,
- /* 221 */ KEY_NOTUSED,
- /* 222 */ KEY_NOTUSED,
- /* 223 */ KEY_NOTUSED,
-};
-
-#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char))
-
-static CARD8 wsSunMap[] = {
- /* 0x00 */ KEY_NOTUSED,
- /* 0x01 */ KEY_NOTUSED, /* stop */
- /* 0x02 */ KEY_NOTUSED, /* BrightnessDown / S-VolumeDown */
- /* 0x03 */ KEY_NOTUSED, /* again */
- /* 0x04 */ KEY_NOTUSED, /* BridgtnessUp / S-VolumeUp */
- /* 0x05 */ KEY_F1,
- /* 0x06 */ KEY_F2,
- /* 0x07 */ KEY_F10,
- /* 0x08 */ KEY_F3,
- /* 0x09 */ KEY_F11,
- /* 0x0a */ KEY_F4,
- /* 0x0b */ KEY_F12,
- /* 0x0c */ KEY_F5,
- /* 0x0d */ KEY_AltLang,
- /* 0x0e */ KEY_F6,
- /* 0x0f */ KEY_NOTUSED,
- /* 0x10 */ KEY_F7,
- /* 0x11 */ KEY_F8,
- /* 0x12 */ KEY_F9,
- /* 0x13 */ KEY_Alt,
- /* 0x14 */ KEY_Up,
- /* 0x15 */ KEY_Pause,
- /* 0x16 */ KEY_Print,
- /* 0x17 */ KEY_NOTUSED, /* props */
- /* 0x18 */ KEY_Left,
- /* 0x19 */ KEY_ScrollLock,
- /* 0x1a */ KEY_NOTUSED, /* undo */
- /* 0x1b */ KEY_Down,
- /* 0x1c */ KEY_Right,
- /* 0x1d */ KEY_Escape,
- /* 0x1e */ KEY_1,
- /* 0x1f */ KEY_2,
- /* 0x20 */ KEY_3,
- /* 0x21 */ KEY_4,
- /* 0x22 */ KEY_5,
- /* 0x23 */ KEY_6,
- /* 0x24 */ KEY_7,
- /* 0x25 */ KEY_8,
- /* 0x26 */ KEY_9,
- /* 0x27 */ KEY_0,
- /* 0x28 */ KEY_Minus,
- /* 0x29 */ KEY_Equal,
- /* 0x2a */ KEY_Tilde,
- /* 0x2b */ KEY_BackSpace,
- /* 0x2c */ KEY_Insert,
- /* 0x2d */ KEY_KP_Equal,
- /* 0x2e */ KEY_KP_Divide,
- /* 0x2f */ KEY_KP_Multiply,
- /* 0x30 */ KEY_NOTUSED,
- /* 0x31 */ KEY_NOTUSED, /* front */
- /* 0x32 */ KEY_KP_Decimal,
- /* 0x33 */ KEY_NOTUSED, /* copy */
- /* 0x34 */ KEY_Home,
- /* 0x35 */ KEY_Tab,
- /* 0x36 */ KEY_Q,
- /* 0x37 */ KEY_W,
- /* 0x38 */ KEY_E,
- /* 0x39 */ KEY_R,
- /* 0x3a */ KEY_T,
- /* 0x3b */ KEY_Y,
- /* 0x3c */ KEY_U,
- /* 0x3d */ KEY_I,
- /* 0x3e */ KEY_O,
- /* 0x3f */ KEY_P,
- /* 0x40 */ KEY_LBrace,
- /* 0x41 */ KEY_RBrace,
- /* 0x42 */ KEY_Delete,
- /* 0x43 */ KEY_NOTUSED, /* compose */
- /* 0x44 */ KEY_KP_7,
- /* 0x45 */ KEY_KP_8,
- /* 0x46 */ KEY_KP_9,
- /* 0x47 */ KEY_KP_Minus,
- /* 0x48 */ KEY_NOTUSED, /* open */
- /* 0x49 */ KEY_NOTUSED, /* paste */
- /* 0x4a */ KEY_End,
- /* 0x4b */ KEY_NOTUSED,
- /* 0x4c */ KEY_LCtrl,
- /* 0x4d */ KEY_A,
- /* 0x4e */ KEY_S,
- /* 0x4f */ KEY_D,
- /* 0x50 */ KEY_F,
- /* 0x51 */ KEY_G,
- /* 0x52 */ KEY_H,
- /* 0x53 */ KEY_J,
- /* 0x54 */ KEY_K,
- /* 0x55 */ KEY_L,
- /* 0x56 */ KEY_SemiColon,
- /* 0x57 */ KEY_Quote,
- /* 0x58 */ KEY_BSlash,
- /* 0x59 */ KEY_Enter,
- /* 0x5a */ KEY_KP_Enter,
- /* 0x5b */ KEY_KP_4,
- /* 0x5c */ KEY_KP_5,
- /* 0x5d */ KEY_KP_6,
- /* 0x5e */ KEY_KP_0,
- /* 0x5f */ KEY_NOTUSED, /* find */
- /* 0x60 */ KEY_PgUp,
- /* 0x61 */ KEY_NOTUSED, /* cut */
- /* 0x62 */ KEY_NumLock,
- /* 0x63 */ KEY_ShiftL,
- /* 0x64 */ KEY_Z,
- /* 0x65 */ KEY_X,
- /* 0x66 */ KEY_C,
- /* 0x67 */ KEY_V,
- /* 0x68 */ KEY_B,
- /* 0x69 */ KEY_N,
- /* 0x6a */ KEY_M,
- /* 0x6b */ KEY_Comma,
- /* 0x6c */ KEY_Period,
- /* 0x6d */ KEY_Slash,
- /* 0x6e */ KEY_ShiftR,
- /* 0x6f */ KEY_NOTUSED, /* linefeed */
- /* 0x70 */ KEY_KP_1,
- /* 0x71 */ KEY_KP_2,
- /* 0x72 */ KEY_KP_3,
- /* 0x73 */ KEY_NOTUSED,
- /* 0x74 */ KEY_NOTUSED,
- /* 0x75 */ KEY_NOTUSED,
- /* 0x76 */ KEY_NOTUSED, /* help */
- /* 0x77 */ KEY_CapsLock,
- /* 0x78 */ KEY_LMeta,
- /* 0x79 */ KEY_Space,
- /* 0x7a */ KEY_RMeta,
- /* 0x7b */ KEY_PgDown,
- /* 0x7c */ KEY_NOTUSED,
- /* 0x7d */ KEY_KP_Plus,
- /* 0x7e */ KEY_NOTUSED,
- /* 0x7f */ KEY_NOTUSED
-};
-
-#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char))
-
-/*
- * Translate raw wskbd keyboard event values to XFree86 standard keycodes
- * (based on the AT keyboard scan codes using the tables above
- */
-int
-WSKbdToKeycode(int keycode)
-{
- switch (xf86Info.wsKbdType) {
- case WSKBD_TYPE_PC_XT:
- case WSKBD_TYPE_PC_AT:
- /* No translation needed */
- return keycode;
- case WSKBD_TYPE_USB:
- if (keycode < 0 || keycode >= WS_USB_MAP_SIZE)
- return KEY_UNKNOWN;
- else
- return wsUsbMap[keycode];
-#ifdef WSKBD_TYPE_ADB
- case WSKBD_TYPE_ADB:
- if (keycode < 0 || keycode >= WS_ADB_MAP_SIZE)
- return KEY_UNKNOWN;
- else
- return wsAdbMap[keycode];
-#endif
-#ifdef WSKBD_TYPE_SUN
- case WSKBD_TYPE_SUN:
-#ifdef WSKBD_TYPE_SUN5
- case WSKBD_TYPE_SUN5:
-#endif
- if (keycode < 0 || keycode >= WS_SUN_MAP_SIZE)
- return KEY_UNKNOWN;
- else
- return wsSunMap[keycode];
-#endif
- default:
- ErrorF("Unknown wskbd type %d\n", xf86Info.wsKbdType);
- return KEY_UNKNOWN;
- }
-}
-
-#endif /* WSCONS_SUPPORT */
diff --git a/hw/xfree86/common/xf86KbdLnx.c b/hw/xfree86/common/xf86KbdLnx.c
deleted file mode 100644
index 74cb42d0f..000000000
--- a/hw/xfree86/common/xf86KbdLnx.c
+++ /dev/null
@@ -1,650 +0,0 @@
-/*
- * Linux version of keymapping setup. The kernel (since 0.99.14) has support
- * for fully remapping the keyboard, but there are some differences between
- * the Linux map and the SVR4 map (esp. in the extended keycodes). We also
- * remove the restriction on what keycodes can be remapped.
- * Orest Zborowski.
- */
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/*
- * Copyright (c) 1994-2001 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-/* $XConsortium: xf86KbdLnx.c /main/7 1996/10/19 17:59:00 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "atKeynames.h"
-
-#include "xf86Keymap.h"
-
-/*
- * LegalModifier --
- * determine whether a key is a legal modifier key, i.e send a
- * press/release sequence.
- */
-
-/*ARGSUSED*/
-Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
-{
- return (TRUE);
-}
-
-/*
- * xf86KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-static void readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap);
-
-void
-xf86KbdGetMapping (KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KeySym *k;
- char type;
- int i;
-
- readKernelMapping(pKeySyms, pModMap);
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- xf86Info.kbdType =
- ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
-
-#include <linux/keyboard.h>
-
-static KeySym linux_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
-};
-
-/*
- * Maps the AT keycodes to Linux keycodes
- */
-static unsigned char at2lnx[NUM_KEYCODES] =
-{
- 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
- 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
- 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
- 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
- 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
- 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
- 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
- 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
- 0x11, /* KEY_W */ 0x12, /* KEY_E */
- 0x13, /* KEY_R */ 0x14, /* KEY_T */
- 0x15, /* KEY_Y */ 0x16, /* KEY_U */
- 0x17, /* KEY_I */ 0x18, /* KEY_O */
- 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
- 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
- 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
- 0x1f, /* KEY_S */ 0x20, /* KEY_D */
- 0x21, /* KEY_F */ 0x22, /* KEY_G */
- 0x23, /* KEY_H */ 0x24, /* KEY_J */
- 0x25, /* KEY_K */ 0x26, /* KEY_L */
- 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
- 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
- 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
- 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
- 0x2f, /* KEY_V */ 0x30, /* KEY_B */
- 0x31, /* KEY_N */ 0x32, /* KEY_M */
- 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
- 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
- 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
- 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
- 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
- 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
- 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
- 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
- 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
- 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
- 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
- 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
- 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
- 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
- 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
- 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
- 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
- 0x00, /* 0x55 */ 0x56, /* KEY_Less */
- 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
- 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
- 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
- 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
- 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
- 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
- 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
- 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
- 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
- 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
- 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
- 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
- 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
- 0x00, /* 0x71 */ 0x00, /* 0x72 */
- 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
- 0x00, /* 0x75 */ 0x00, /* 0x76 */
- 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
- 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
- 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
- 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
- 0x00, /* 0x7f */
-};
-#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
-
-#define NUM_CUSTOMKEYS NR_KEYS
-
-u_char SpecialServerMap[NUM_CUSTOMKEYS];
-
-static void
-readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KeySym *k;
- int i;
- int maxkey;
- static unsigned char tbl[GLYPHS_PER_KEY] =
- {
- 0, /* unshifted */
- 1, /* shifted */
- 0, /* modeswitch unshifted */
- 0 /* modeswitch shifted */
- };
-
- /*
- * Read the mapping from the kernel.
- * Since we're still using the XFree86 scancode->AT keycode mapping
- * routines, we need to convert the AT keycodes to Linux keycodes,
- * then translate the Linux keysyms into X keysyms.
- *
- * First, figure out which tables to use for the modeswitch columns
- * above, from the XF86Config fields.
- */
- tbl[2] = 8; /* alt */
- tbl[3] = tbl[2] | 1;
-
- if (xf86Info.kbdCustomKeycodes) {
- k = map;
- maxkey = NUM_CUSTOMKEYS;
- }
- else {
- k = map+GLYPHS_PER_KEY;
- maxkey = NUM_AT2LNX;
- }
-
- for (i = 0; i < maxkey; ++i)
- {
- struct kbentry kbe;
- int j;
-
- if (xf86Info.kbdCustomKeycodes)
- kbe.kb_index = i;
- else
- kbe.kb_index = at2lnx[i];
-
- for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k)
- {
- unsigned short kval;
-
- *k = NoSymbol;
-
- kbe.kb_table = tbl[j];
- if (
- (!xf86Info.kbdCustomKeycodes && kbe.kb_index == 0) ||
- ioctl(xf86Info.consoleFd, KDGKBENT, &kbe))
- continue;
-
- kval = KVAL(kbe.kb_value);
- switch (KTYP(kbe.kb_value))
- {
- case KT_LATIN:
- case KT_LETTER:
- *k = linux_to_x[kval];
- break;
-
- case KT_FN:
- if (kval <= 19)
- *k = XK_F1 + kval;
- else switch (kbe.kb_value)
- {
- case K_FIND:
- *k = XK_Home; /* or XK_Find */
- break;
- case K_INSERT:
- *k = XK_Insert;
- break;
- case K_REMOVE:
- *k = XK_Delete;
- break;
- case K_SELECT:
- *k = XK_End; /* or XK_Select */
- break;
- case K_PGUP:
- *k = XK_Prior;
- break;
- case K_PGDN:
- *k = XK_Next;
- break;
- case K_HELP:
- *k = XK_Help;
- break;
- case K_DO:
- *k = XK_Execute;
- break;
- case K_PAUSE:
- *k = XK_Pause;
- break;
- case K_MACRO:
- *k = XK_Menu;
- break;
- default:
- break;
- }
- break;
-
- case KT_SPEC:
- switch (kbe.kb_value)
- {
- case K_ENTER:
- *k = XK_Return;
- break;
- case K_BREAK:
- *k = XK_Break;
- break;
- case K_CAPS:
- *k = XK_Caps_Lock;
- break;
- case K_NUM:
- *k = XK_Num_Lock;
- break;
- case K_HOLD:
- *k = XK_Scroll_Lock;
- break;
- case K_COMPOSE:
- *k = XK_Multi_key;
- break;
- default:
- break;
- }
- break;
-
- case KT_PAD:
- switch (kbe.kb_value)
- {
- case K_PPLUS:
- *k = XK_KP_Add;
- break;
- case K_PMINUS:
- *k = XK_KP_Subtract;
- break;
- case K_PSTAR:
- *k = XK_KP_Multiply;
- break;
- case K_PSLASH:
- *k = XK_KP_Divide;
- break;
- case K_PENTER:
- *k = XK_KP_Enter;
- break;
- case K_PCOMMA:
- *k = XK_KP_Separator;
- break;
- case K_PDOT:
- *k = XK_KP_Decimal;
- break;
- case K_PPLUSMINUS:
- *k = XK_KP_Subtract;
- break;
- default:
- if (kval <= 9)
- *k = XK_KP_0 + kval;
- break;
- }
- break;
-
- /*
- * KT_DEAD keys are for accelerated diacritical creation.
- */
- case KT_DEAD:
- switch (kbe.kb_value)
- {
- case K_DGRAVE:
- *k = XK_dead_grave;
- break;
- case K_DACUTE:
- *k = XK_dead_acute;
- break;
- case K_DCIRCM:
- *k = XK_dead_circumflex;
- break;
- case K_DTILDE:
- *k = XK_dead_tilde;
- break;
- case K_DDIERE:
- *k = XK_dead_diaeresis;
- break;
- }
- break;
-
- case KT_CUR:
- switch (kbe.kb_value)
- {
- case K_DOWN:
- *k = XK_Down;
- break;
- case K_LEFT:
- *k = XK_Left;
- break;
- case K_RIGHT:
- *k = XK_Right;
- break;
- case K_UP:
- *k = XK_Up;
- break;
- }
- break;
-
- case KT_SHIFT:
- switch (kbe.kb_value)
- {
- case K_ALTGR:
- *k = XK_Alt_R;
- break;
- case K_ALT:
- *k = (kbe.kb_index == 0x64 ?
- XK_Alt_R : XK_Alt_L);
- break;
- case K_CTRL:
- *k = (kbe.kb_index == 0x61 ?
- XK_Control_R : XK_Control_L);
- break;
- case K_CTRLL:
- *k = XK_Control_L;
- break;
- case K_CTRLR:
- *k = XK_Control_R;
- break;
- case K_SHIFT:
- *k = (kbe.kb_index == 0x36 ?
- XK_Shift_R : XK_Shift_L);
- break;
- case K_SHIFTL:
- *k = XK_Shift_L;
- break;
- case K_SHIFTR:
- *k = XK_Shift_R;
- break;
- default:
- break;
- }
- break;
-
- /*
- * KT_ASCII keys accumulate a 3 digit decimal number that gets
- * emitted when the shift state changes. We can't emulate that.
- */
- case KT_ASCII:
- break;
-
- case KT_LOCK:
- if (kbe.kb_value == K_SHIFTLOCK)
- *k = XK_Shift_Lock;
- break;
-
- default:
- break;
- }
- }
-
- if (k[-1] == k[-2]) k[-1] = NoSymbol;
- if (k[-2] == k[-3]) k[-2] = NoSymbol;
- if (k[-3] == k[-4]) k[-3] = NoSymbol;
- if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
- if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol;
- }
-
- if (!xf86Info.kbdCustomKeycodes)
- return;
-
- /*
- * Find the Mapping for the special server functions
- */
- for (i = 0; i < NUM_CUSTOMKEYS; ++i) {
- struct kbentry kbe;
- int special = 0;
-
- kbe.kb_index = i;
- kbe.kb_table = 0; /* Plain map */
- if (!ioctl(xf86Info.consoleFd, KDGKBENT, &kbe))
- switch (kbe.kb_value) {
- case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */
- special = KEY_BackSpace;
- break;
- case K_PMINUS:
- special = KEY_KP_Minus;
- break;
- case K_PPLUS:
- special = KEY_KP_Plus;
- break;
- case K_F1:
- special = KEY_F1;
- break;
- case K_F2:
- special = KEY_F2;
- break;
- case K_F3:
- special = KEY_F3;
- break;
- case K_F4:
- special = KEY_F4;
- break;
- case K_F5:
- special = KEY_F5;
- break;
- case K_F6:
- special = KEY_F6;
- break;
- case K_F7:
- special = KEY_F7;
- break;
- case K_F8:
- special = KEY_F8;
- break;
- case K_F9:
- special = KEY_F9;
- break;
- case K_F10:
- special = KEY_F10;
- break;
- case K_F11:
- special = KEY_F11;
- break;
- case K_F12:
- special = KEY_F12;
- break;
- case K_ALT:
- special = KEY_Alt;
- break;
- case K_ALTGR:
- special = KEY_AltLang;
- break;
- case K_CONS:
- special = KEY_SysReqest;
- break;
- }
- SpecialServerMap[i] = special;
- }
-}
diff --git a/hw/xfree86/common/xf86KbdMach.c b/hw/xfree86/common/xf86KbdMach.c
deleted file mode 100644
index 82e3c720e..000000000
--- a/hw/xfree86/common/xf86KbdMach.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- *****************************************************************************
- * HISTORY
- * Log: xf86KbdMach.c,v
- * Revision 2.1.2.1 92/06/25 10:32:08 moore
- * Incorporate the Elliot Dresselhaus's, Ernest Hua's and local changes
- * to run Thomas Roell's I386 color X11R5. Original code only worked
- * with SCO Unix. New code works with 2.5 and 3.0 Mach
- * [92/06/24 rvb]
- *
- * EndLog
- *
- *****************************************************************************
- */
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XConsortium: xf86KbdMach.c /main/9 1996/02/21 17:38:43 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "atKeynames.h"
-#include "xf86Config.h"
-
-#include "xf86Keymap.h"
-
-static KeySym ascii_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
- };
-
-/*
- * LegalModifier --
- * determine whether a key is a legal modifier key, i.e send a
- * press/release sequence.
- */
-
-/*ARGSUSED*/
-Bool
-LegalModifier(key, pDev)
- unsigned int key;
- DevicePtr pDev;
-{
- return (TRUE);
-}
-
-
-
-/*
- * xf86KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-xf86KbdGetMapping (pKeySyms, pModMap)
- KeySymsPtr pKeySyms;
- CARD8 *pModMap;
-{
- KeySym *k;
- struct kbentry kbe;
- char type;
- int i, j;
-
- for (i = 0; i < NUMKEYS; i++)
- {
- static int states[] = { NORM_STATE, SHIFT_STATE, ALT_STATE, SHIFT_ALT };
- int j;
-
- k = &map[i*4];
- kbe.kb_index = i;
-
- for (j = 0; j < 4; j++)
- {
- kbe.kb_state = states[j];
-
- if (ioctl (xf86Info.consoleFd, KDGKBENT, &kbe) != -1)
- continue;
-
- if (kbe.kb_value [0] == K_SCAN)
- {
- int keycode = -1;
- switch (kbe.kb_value [1])
- {
- case K_CTLSC: keycode = XK_Control_L; break;
- case K_LSHSC: keycode = XK_Shift_L; break;
- case K_RSHSC: keycode = XK_Shift_R; break;
- case K_ALTSC: keycode = XK_Alt_L; break;
- case K_CLCKSC: keycode = XK_Caps_Lock; break;
- case K_NLCKSC: keycode = XK_Num_Lock; break;
- default: break;
- }
- if (keycode > 0)
- k[j] = keycode;
- }
- else if (kbe.kb_value[1] != NC)
- {
- /* How to handle multiple characters?
- Ignore them for now. */
- }
- else
- {
- k[j] = ascii_to_x[kbe.kb_value[0]];
- }
- }
- }
-
- /*
- * Apply the special key mapping specified in XF86Config
- */
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4) {
- switch (k[0]) {
- case XK_Alt_L:
- j = K_INDEX_LEFTALT;
- break;
- case XK_Alt_R:
- j = K_INDEX_RIGHTALT;
- break;
- case XK_Scroll_Lock:
- j = K_INDEX_SCROLLLOCK;
- break;
- case XK_Control_R:
- j = K_INDEX_RIGHTCTL;
- break;
- default:
- j = -1;
- }
- if (j >= 0)
- switch (xf86Info.specialKeyMap[j]) {
- case KM_META:
- if (k[0] == XK_Alt_R)
- k[1] = XK_Meta_R;
- else {
- k[0] = XK_Alt_L;
- k[1] = XK_Meta_L;
- }
- break;
- case KM_COMPOSE:
- k[0] = XK_Multi_key;
- break;
- case KM_MODESHIFT:
- k[0] = XK_Mode_switch;
- k[1] = NoSymbol;
- break;
- case KM_MODELOCK:
- k[0] = XK_Mode_switch;
- k[1] = XF86XK_ModeLock;
- break;
- case KM_SCROLLLOCK:
- k[0] = XK_Scroll_Lock;
- break;
- case KM_CONTROL:
- k[0] = XK_Control_R;
- break;
- }
- }
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- xf86Info.kbdType =
- ioctl(xf86Info.kbdFd, KDGKBDTYPE, &type) != -1 ? type : KB_VANILLAKB;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- if (xf86Info.serverNumLock)
- pKeySyms->maxKeyCode = MAX_KEYCODE;
- else
- pKeySyms->maxKeyCode = MAX_STD_KEYCODE;
-
-}
diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c
index 7596fbea7..375226a83 100644
--- a/hw/xfree86/common/xf86MiscExt.c
+++ b/hw/xfree86/common/xf86MiscExt.c
@@ -89,6 +89,7 @@ typedef struct {
int rate;
int delay;
int serverNumLock; /* obsolete */
+ pointer private;
} kbdParamsRec, *kbdParamsPtr;
/*
@@ -256,53 +257,22 @@ _X_EXPORT Bool
MiscExtGetKbdSettings(pointer *kbd)
{
kbdParamsPtr kbdptr;
+ InputInfoPtr pInfo;
DEBUG_P("MiscExtGetKbdSettings");
- kbdptr = MiscExtCreateStruct(MISC_KEYBOARD);
- if (!kbdptr)
- return FALSE;
- kbdptr->type = xf86Info.kbdType;
- kbdptr->rate = xf86Info.kbdRate;
- kbdptr->delay = xf86Info.kbdDelay;
- *kbd = kbdptr;
- return TRUE;
+ return FALSE;
}
_X_EXPORT int
MiscExtGetKbdValue(pointer keyboard, MiscExtKbdValType valtype)
{
- kbdParamsPtr kbd = keyboard;
-
- DEBUG_P("MiscExtGetKbdValue");
- switch (valtype) {
- case MISC_KBD_TYPE: return kbd->type;
- case MISC_KBD_RATE: return kbd->rate;
- case MISC_KBD_DELAY: return kbd->delay;
- case MISC_KBD_SERVNUMLOCK: return 0;
- }
return 0;
}
_X_EXPORT Bool
MiscExtSetKbdValue(pointer keyboard, MiscExtKbdValType valtype, int value)
{
- kbdParamsPtr kbd = keyboard;
-
- DEBUG_P("MiscExtSetKbdValue");
- switch (valtype) {
- case MISC_KBD_TYPE:
- kbd->type = value;
- return TRUE;
- case MISC_KBD_RATE:
- kbd->rate = value;
- return TRUE;
- case MISC_KBD_DELAY:
- kbd->delay = value;
- return TRUE;
- case MISC_KBD_SERVNUMLOCK:
- return TRUE;
- }
return FALSE;
}
@@ -365,7 +335,7 @@ MiscExtCreateStruct(MiscExtStructType mse_or_kbd)
InputInfoPtr pInfo = xf86InputDevs;
while (pInfo) {
- if (xf86IsCorePointer(pInfo->dev))
+ if (pInfo->dev == inputInfo.pointer)
break;
pInfo = pInfo->next;
}
@@ -463,15 +433,13 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
if (!xf86MouseProtocolIDToName)
return MISC_RET_NOMODULE;
if (mse->type < MTYPE_MICROSOFT
- || ( mse->type > MTYPE_EXPPS2
- && (mse->type!=MTYPE_OSMOUSE && mse->type!=MTYPE_XQUEUE)))
+ || (mse->type > MTYPE_EXPPS2
+ && (mse->type != MTYPE_OSMOUSE)))
return MISC_RET_BADMSEPROTO;
#ifdef OSMOUSE_ONLY
if (mse->type != MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#else
- if (mse->type == MTYPE_XQUEUE)
- return MISC_RET_BADMSEPROTO;
if (mse->type == MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#endif /* OSMOUSE_ONLY */
@@ -492,7 +460,6 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
mse->flags &= ~MF_REOPEN;
}
if (mse->type != MTYPE_OSMOUSE
- && mse->type != MTYPE_XQUEUE
&& mse->type != MTYPE_PS_2
&& mse->type != MTYPE_BUSMOUSE
&& mse->type != MTYPE_IMPS2
@@ -513,7 +480,6 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
return MISC_RET_BADFLAGS;
if (mse->type != MTYPE_OSMOUSE
- && mse->type != MTYPE_XQUEUE
&& mse->type != MTYPE_BUSMOUSE)
{
if (mse->samplerate < 0)
@@ -586,37 +552,7 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
xf86ReplaceBoolOption(pInfo->options, "ClearRTS",
pMse->mouseFlags | MF_CLEAR_RTS);
}
- if (mse_or_kbd == MISC_KEYBOARD) {
- kbdParamsPtr kbd = structure;
-
- if (kbd->rate < 0)
- return MISC_RET_BADVAL;
- if (kbd->delay < 0)
- return MISC_RET_BADVAL;
- if (kbd->type < KTYPE_UNKNOWN || kbd->type > KTYPE_XQUEUE)
- return MISC_RET_BADKBDTYPE;
-
- if (xf86Info.kbdRate!=kbd->rate || xf86Info.kbdDelay!=kbd->delay) {
- char rad;
-
- xf86Info.kbdRate = kbd->rate;
- xf86Info.kbdDelay = kbd->delay;
- if (xf86Info.kbdDelay <= 375) rad = 0x00;
- else if (xf86Info.kbdDelay <= 625) rad = 0x20;
- else if (xf86Info.kbdDelay <= 875) rad = 0x40;
- else rad = 0x60;
-
- if (xf86Info.kbdRate <= 2) rad |= 0x1F;
- else if (xf86Info.kbdRate >= 30) rad |= 0x00;
- else rad |= ((58/xf86Info.kbdRate)-2);
-
- xf86SetKbdRepeat(rad);
- }
-#if 0 /* Not done yet */
- xf86Info.kbdType = kbd->kbdtype;
-#endif
- }
- return MISC_RET_SUCCESS;
+ return MISC_RET_BADVAL;
}
_X_EXPORT Bool
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index cf404fb89..3c3247e40 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -85,7 +85,7 @@ typedef enum {
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 1)
-#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 6)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(1, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5)
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 0a4c11d8d..7afb63a4d 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -142,14 +142,14 @@ xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
if (defaultOpts) {
pInfo->options = xf86OptionListCreate(defaultOpts, -1, 0);
}
- if (pInfo->conf_idev->commonOptions) {
+ if (pInfo->conf_idev && pInfo->conf_idev->commonOptions) {
tmp = xf86optionListDup(pInfo->conf_idev->commonOptions);
if (pInfo->options)
pInfo->options = xf86optionListMerge(pInfo->options, tmp);
else
pInfo->options = tmp;
}
- if (pInfo->conf_idev->extraOptions) {
+ if (pInfo->conf_idev && pInfo->conf_idev->extraOptions) {
tmp = xf86optionListDup(pInfo->conf_idev->extraOptions);
if (pInfo->options)
pInfo->options = xf86optionListMerge(pInfo->options, tmp);
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index e7c0a9f67..9279dbd7b 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -193,20 +193,6 @@ Bool xf86LoadModules(char **list, pointer *optlist);
int xf86SetVerbosity(int verb);
int xf86SetLogVerbosity(int verb);
-/* xf86Io.c */
-
-void xf86KbdBell(int percent, DeviceIntPtr pKeyboard, pointer ctrl,
- int unused);
-void xf86KbdLeds(void);
-void xf86UpdateKbdLeds(void);
-void xf86KbdCtrl(DevicePtr pKeyboard, KeybdCtrl *ctrl);
-void xf86InitKBD(Bool init);
-int xf86KbdProc(DeviceIntPtr pKeyboard, int what);
-
-/* xf86Kbd.c */
-
-void xf86KbdGetMapping(KeySymsPtr pKeySyms, CARD8 *pModMap);
-
/* xf86Lock.c */
#ifdef USE_XF86_SERVERLOCK
@@ -217,6 +203,9 @@ void xf86UnlockServer(void);
void xf86InitXkb(void);
+/* xf86Xinput.c */
+extern xEvent *xf86Events;
+
#endif /* _NO_XF86_PROTOTYPES */
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
index 67d4304c9..659e566e0 100644
--- a/hw/xfree86/common/xf86Privstr.h
+++ b/hw/xfree86/common/xf86Privstr.h
@@ -67,38 +67,11 @@ typedef enum {
*/
typedef struct {
-
- /* keyboard part */
- DeviceIntPtr pKeyboard;
- DeviceProc kbdProc; /* procedure for initializing */
- void (* kbdEvents)(void); /* proc for processing events */
int consoleFd;
- int kbdFd;
int vtno;
- int kbdType; /* AT84 / AT101 */
- int kbdRate;
- int kbdDelay;
- int bell_pitch;
- int bell_duration;
- Bool autoRepeat;
- unsigned long leds;
- unsigned long xleds;
char * vtinit;
- int scanPrefix; /* scancode-state */
- Bool capsLock;
- Bool numLock;
- Bool scrollLock;
- Bool modeSwitchLock;
- Bool composeLock;
Bool vtSysreq;
SpecialKeysInDDX ddxSpecialKeys;
- Bool ActionKeyBindingsSet;
-#if defined(SVR4) && defined(i386)
- Bool panix106;
-#endif /* SVR4 && i386 */
-#if defined(__OpenBSD__) || defined(__NetBSD__)
- int wsKbdType;
-#endif
/* mouse part */
DeviceIntPtr pMouse;
@@ -125,25 +98,6 @@ typedef struct {
int consType; /* Which console driver? */
#endif
-#ifdef XKB
- /*
- * would like to use an XkbComponentNamesRec here but can't without
- * pulling in a bunch of header files. :-(
- */
- char * xkbkeymap;
- char * xkbkeycodes;
- char * xkbtypes;
- char * xkbcompat;
- char * xkbsymbols;
- char * xkbgeometry;
- Bool xkbcomponents_specified;
- char * xkbrules;
- char * xkbmodel;
- char * xkblayout;
- char * xkbvariant;
- char * xkboptions;
-#endif
-
/* Other things */
Bool allowMouseOpenFail;
Bool vidModeEnabled; /* VidMode extension enabled */
@@ -179,6 +133,9 @@ typedef struct {
Bool allowClosedown;
ServerGrabInfoRec server;
} grabInfo;
+
+ Bool allowEmptyInput; /* Allow the server to start with no input
+ * devices. */
} xf86InfoRec, *xf86InfoPtr;
#ifdef DPMSExtension
diff --git a/hw/xfree86/common/xf86Versions.c b/hw/xfree86/common/xf86Versions.c
index e984e80c1..97a35590e 100644
--- a/hw/xfree86/common/xf86Versions.c
+++ b/hw/xfree86/common/xf86Versions.c
@@ -31,7 +31,6 @@
#include "xf86.h"
#include "xf86OSmouse.h"
-#include "xf86OSKbd.h"
static CARD32 registeredVersions[NUM_BUILTIN_IFS];
@@ -51,8 +50,6 @@ xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flags)
switch (iface) {
case BUILTIN_IF_OSMOUSE:
return OS_MOUSE_VERSION_CURRENT;
- case BUILTIN_IF_OSKBD:
- return OS_KBD_VERSION_CURRENT;
default:
xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: internal error: "
"interface %d not handled\n", iface);
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index c56475b12..be3368dff 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -38,7 +38,6 @@
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
@@ -63,6 +62,7 @@
#include "xf86Xinput.h"
#ifdef XINPUT
#include "XIstubs.h"
+#include "xf86Optrec.h"
#endif
#include "mipointer.h"
#include "xf86InPriv.h"
@@ -73,10 +73,6 @@
#include "dpmsproc.h"
#endif
-#ifdef XFreeXDGA
-#include "dgaproc.h"
-#endif
-
#include "exevents.h" /* AddInputDevice */
#include "exglobals.h"
@@ -92,131 +88,29 @@
#include <X11/Xpoll.h>
#include "xf86_OSproc.h" /* sigio stuff */
+#include "mi.h"
+
/******************************************************************************
* debugging macro
*****************************************************************************/
-#ifdef DBG
-#undef DBG
-#endif
#ifdef DEBUG
-#undef DEBUG
-#endif
-
-#define DEBUG 0
-
-#if DEBUG
static int debug_level = 0;
-
#define DBG(lvl, f) {if ((lvl) <= debug_level) f;}
#else
#define DBG(lvl, f)
#endif
-/******************************************************************************
- * macros
- *****************************************************************************/
-#define ENQUEUE(e) xf86eqEnqueue((e))
-
-/***********************************************************************
- *
- * xf86AlwaysCoreControl --
- *
- * Control proc for the integer feedback that controls the always
- * core feature.
- *
- ***********************************************************************
- */
-static void
-xf86AlwaysCoreControl(DeviceIntPtr device,
- IntegerCtrl *control)
-{
-}
-
-/***********************************************************************
- *
- * Core devices functions --
- *
- * Test if device is the core device by checking the
- * value of always core feedback and the inputInfo struct.
- *
- ***********************************************************************
- */
-_X_EXPORT int
-xf86IsCorePointer(DeviceIntPtr device)
-{
- return(device == inputInfo.pointer);
-}
-
-static int
-xf86ShareCorePointer(DeviceIntPtr device)
-{
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
-
- return((local->always_core_feedback &&
- local->always_core_feedback->ctrl.integer_displayed));
-}
+xEvent *xf86Events = NULL;
static Bool
xf86SendDragEvents(DeviceIntPtr device)
{
LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
- if (inputInfo.pointer->button->buttonsDown > 0)
- return (local->flags & XI86_SEND_DRAG_EVENTS);
+ if (device->button->buttonsDown > 0)
+ return (local->flags & XI86_SEND_DRAG_EVENTS);
else
- return (TRUE);
-}
-
-int
-xf86IsCoreKeyboard(DeviceIntPtr device)
-{
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
-
- return((local->flags & XI86_ALWAYS_CORE) ||
- (device == inputInfo.keyboard));
-}
-
-_X_EXPORT void
-xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always)
-{
- if (always) {
- local->flags |= XI86_ALWAYS_CORE;
- } else {
- local->flags &= ~XI86_ALWAYS_CORE;
- }
-}
-
-static int xf86CoreButtonState;
-
-/***********************************************************************
- *
- * xf86CheckButton --
- *
- * Test if the core pointer button state is coherent with
- * the button event to send.
- *
- ***********************************************************************
- */
-Bool
-xf86CheckButton(int button,
- int down)
-{
- int check;
- int bit = (1 << (button - 1));
-
- check = xf86CoreButtonState & bit;
-
- DBG(5, ErrorF("xf86CheckButton "
- "button=%d down=%d state=%d check=%d returns ",
- button, down, xf86CoreButtonState, check));
- if ((check && down) || (!check && !down)) {
- DBG(5, ErrorF("FALSE\n"));
- return FALSE;
- }
- xf86CoreButtonState ^= bit;
-
- DBG(5, ErrorF("TRUE\n"));
- return TRUE;
+ return (TRUE);
}
/***********************************************************************
@@ -229,36 +123,26 @@ xf86CheckButton(int button,
*/
_X_EXPORT void
xf86ProcessCommonOptions(LocalDevicePtr local,
- pointer list)
+ pointer list)
{
- if (xf86SetBoolOption(list, "AlwaysCore", 0) ||
- xf86SetBoolOption(list, "SendCoreEvents", 0)) {
- local->flags |= XI86_ALWAYS_CORE;
- xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
- }
-
- if (xf86SetBoolOption(list, "CorePointer", 0)) {
- local->flags |= XI86_CORE_POINTER;
- xf86Msg(X_CONFIG, "%s: Core Pointer\n", local->name);
- }
-
- if (xf86SetBoolOption(list, "CoreKeyboard", 0)) {
- local->flags |= XI86_CORE_KEYBOARD;
- xf86Msg(X_CONFIG, "%s: Core Keyboard\n", local->name);
+ if (!xf86SetBoolOption(list, "AlwaysCore", 0) ||
+ xf86SetBoolOption(list, "SendCoreEvents", 0) ||
+ xf86SetBoolOption(list, "CorePointer", 0) ||
+ xf86SetBoolOption(list, "CoreKeyboard", 0)) {
+ local->flags |= XI86_ALWAYS_CORE;
+ xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
}
if (xf86SetBoolOption(list, "SendDragEvents", 1)) {
- local->flags |= XI86_SEND_DRAG_EVENTS;
+ local->flags |= XI86_SEND_DRAG_EVENTS;
} else {
- xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
+ xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
}
-
- local->history_size = xf86SetIntOption(list, "HistorySize", 0);
+}
- if (local->history_size > 0) {
- xf86Msg(X_CONFIG, "%s: has a history of %d motions\n", local->name,
- local->history_size);
- }
+void
+xf86AlwaysCoreControl(DeviceIntPtr pDev, IntegerCtrl *control)
+{
}
/***********************************************************************
@@ -275,14 +159,11 @@ xf86XinputFinalizeInit(DeviceIntPtr dev)
{
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
- local->dxremaind = 0.0;
- local->dyremaind = 0.0;
-
if (InitIntegerFeedbackClassDeviceStruct(dev, xf86AlwaysCoreControl) == FALSE) {
- ErrorF("Unable to init integer feedback for always core feature\n");
+ ErrorF("Unable to init integer feedback for always core feature\n");
} else {
- local->always_core_feedback = dev->intfeed;
- dev->intfeed->ctrl.integer_displayed = (local->flags & XI86_ALWAYS_CORE) ? 1 : 0;
+ local->always_core_feedback = dev->intfeed;
+ dev->intfeed->ctrl.integer_displayed = (local->flags & XI86_ALWAYS_CORE) ? 1 : 0;
}
}
@@ -300,42 +181,26 @@ xf86ActivateDevice(LocalDevicePtr local)
DeviceIntPtr dev;
if (local->flags & XI86_CONFIGURED) {
- int open_on_init;
-
- open_on_init = local->flags &
- (XI86_OPEN_ON_INIT |
- XI86_ALWAYS_CORE | XI86_CORE_POINTER | XI86_CORE_KEYBOARD);
-
- dev = AddInputDevice(local->device_control,
- open_on_init);
- if (dev == NULL)
- FatalError("Too many input devices");
-
- local->atom = MakeAtom(local->type_name,
- strlen(local->type_name),
- TRUE);
- AssignTypeAndName (dev, local->atom, local->name);
- dev->public.devicePrivate = (pointer) local;
- local->dev = dev;
-
- xf86XinputFinalizeInit(dev);
-
- /*
- * XXX Can a single device instance be both core keyboard and
- * core pointer? If so, this should be changed.
- */
- if (local->flags & XI86_CORE_POINTER)
- RegisterPointerDevice(dev);
- else if (local->flags & XI86_CORE_KEYBOARD)
- RegisterKeyboardDevice(dev);
-#ifdef XINPUT
- else
- RegisterOtherDevice(dev);
-#endif
+ dev = AddInputDevice(local->device_control, TRUE);
+
+ if (dev == NULL)
+ FatalError("Too many input devices");
+
+ local->atom = MakeAtom(local->type_name,
+ strlen(local->type_name),
+ TRUE);
+ AssignTypeAndName(dev, local->atom, local->name);
+ dev->public.devicePrivate = (pointer) local;
+ local->dev = dev;
+
+ xf86XinputFinalizeInit(dev);
- if (serverGeneration == 1)
- xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
- local->name, local->type_name);
+ dev->coreEvents = local->flags & XI86_ALWAYS_CORE;
+ RegisterOtherDevice(dev);
+
+ if (serverGeneration == 1)
+ xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
+ local->name, local->type_name);
}
}
@@ -366,190 +231,32 @@ xf86ActivateDevice(LocalDevicePtr local)
void
OpenInputDevice(DeviceIntPtr dev,
- ClientPtr client,
- int *status)
+ ClientPtr client,
+ int *status)
{
- if (!dev->inited) {
- *status = BadDevice;
- } else {
- if (!dev->public.on) {
- if (!EnableDevice(dev)) {
- *status = BadDevice;
- } else {
- /* to prevent ProcXOpenDevice to call EnableDevice again */
- dev->startup = FALSE;
- }
- }
- }
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXChangeKeyboardDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the keyboard device.
- *
- * The X keyboard device has a FocusRec. If the device that has been
- * made into the new X keyboard did not have a FocusRec,
- * ProcXChangeKeyboardDevice will allocate one for it.
- *
- * If you do not want clients to be able to focus the old X keyboard
- * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
- *
- * If you support input devices with keys that you do not want to be
- * used as the X keyboard, you need to check for them here and return
- * a BadDevice error.
- *
- * The default implementation is to do nothing (assume you do want
- * clients to be able to focus the old X keyboard). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- ***********************************************************************
- */
+ if (!dev->inited)
+ ActivateDevice(dev);
-int
-ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev)
-{
- /**********************************************************************
- * DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
- **********************************************************************/
- return !Success;
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXChangePointerDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the pointer device.
- *
- * The X pointer device does not have a FocusRec. If the device that
- * has been made into the new X pointer had a FocusRec,
- * ProcXChangePointerDevice will free it.
- *
- * If you want clients to be able to focus the old pointer device that
- * has now become accessible through the input extension, you need to
- * add a FocusRec to it here.
- *
- * The XChangePointerDevice protocol request also allows the client
- * to choose which axes of the new pointer device are used to move
- * the X cursor in the X- and Y- directions. If the axes are different
- * than the default ones, you need to keep track of that here.
- *
- * If you support input devices with valuators that you do not want to be
- * used as the X pointer, you need to check for them here and return a
- * BadDevice error.
- *
- * The default implementation is to do nothing (assume you don't want
- * clients to be able to focus the old X pointer). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- ***********************************************************************
- */
-
-int
-ChangePointerDevice (
- DeviceIntPtr old_dev,
- DeviceIntPtr new_dev,
- unsigned char x,
- unsigned char y)
-{
- /************************************************************************
- InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
-
- x_axis = x; * keep track of new x-axis*
- y_axis = y; * keep track of new y-axis*
- if (x_axis != 0 || y_axis != 1)
- axes_changed = TRUE; * remember axes have changed*
- else
- axes_changed = FALSE;
- *************************************************************************/
-
- /*
- * We don't allow axis swap or other exotic features.
- */
- if (x == 0 && y == 1) {
- LocalDevicePtr old_local = (LocalDevicePtr)old_dev->public.devicePrivate;
- LocalDevicePtr new_local = (LocalDevicePtr)new_dev->public.devicePrivate;
-
- InitFocusClassDeviceStruct(old_dev);
-
- /* Restore Extended motion history information */
- old_dev->valuator->GetMotionProc = old_local->motion_history_proc;
- old_dev->valuator->numMotionEvents = old_local->history_size;
-
- /* Save Extended motion history information */
- new_local->motion_history_proc = new_dev->valuator->GetMotionProc;
- new_local->history_size = new_dev->valuator->numMotionEvents;
-
- /* Set Core motion history information */
- new_dev->valuator->GetMotionProc = miPointerGetMotionEvents;
- new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize();
-
- return Success;
- }
- else
- return !Success;
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXCloseDevice
- *
- * Take care of implementation-dependent details of closing a device.
- * Some implementations may actually close the device, others may just
- * remove this clients interest in that device.
- *
- * The default implementation is to do nothing (assume all input devices
- * are initialized during X server initialization and kept open).
- *
- ***********************************************************************
- */
+ if (!dev->public.on) {
+ if (EnableDevice(dev)) {
+ dev->startup = FALSE;
+ }
+ else {
+ ErrorF("couldn't enable device %s\n", dev->name);
+ *status = BadDevice;
+ return;
+ }
+ }
-void
-CloseInputDevice (DeviceIntPtr d, ClientPtr client)
-{
- ErrorF("ProcXCloseDevice to close or not ?\n");
+ *status = Success;
}
-
-/***********************************************************************
- *
- * Caller: ProcXListInputDevices
- *
- * This is the implementation-dependent routine to initialize an input
- * device to the point that information about it can be listed.
- * Some implementations open all input devices when the server is first
- * initialized, and never close them. Other implementations open only
- * the X pointer and keyboard devices during server initialization,
- * and only open other input devices when some client makes an
- * XOpenDevice request. If some other process has the device open, the
- * server may not be able to get information about the device to list it.
- *
- * This procedure should be used by implementations that do not initialize
- * all input devices at server startup. It should do device-dependent
- * initialization for any devices not previously initialized, and call
- * AddInputDevice for each of those devices so that a DeviceIntRec will be
- * created for them.
- *
- * The default implementation is to do nothing (assume all input devices
- * are initialized during X server initialization and kept open).
- * The commented-out sample code shows what you might do if you don't want
- * the default.
- *
- ***********************************************************************
- */
-
void
-AddOtherInputDevices ()
+CloseInputDevice(DeviceIntPtr dev,
+ ClientPtr client)
{
}
-
/****************************************************************************
*
* Caller: ProcXSetDeviceMode
@@ -591,9 +298,15 @@ SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
int
SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
- int first_valuator, int num_valuators)
+ int first_valuator, int num_valuators)
{
- return BadMatch;
+ LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate;
+
+ if (local->set_device_valuators)
+ return (*local->set_device_valuators)(local, valuators, first_valuator,
+ num_valuators);
+
+ return BadMatch;
}
@@ -612,251 +325,100 @@ ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
if (!local->control_proc) {
- return (BadMatch);
+ switch (control->control) {
+ case DEVICE_CORE:
+ case DEVICE_RESOLUTION:
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return Success;
+ default:
+ return BadMatch;
+ }
}
else {
return (*local->control_proc)(local, control);
}
}
-#endif
-
-/*
- * adapted from mieq.c to support extended events
- *
- */
-#define QUEUE_SIZE 256
-
-typedef struct _Event {
- xEvent event;
-#ifdef XINPUT
- deviceValuator val;
-#endif
- ScreenPtr pScreen;
-} EventRec, *EventPtr;
-
-typedef struct _EventQueue {
- HWEventQueueType head, tail;
- CARD32 lastEventTime; /* to avoid time running backwards */
- Bool lastMotion;
- EventRec events[QUEUE_SIZE]; /* static allocation for signals */
- DevicePtr pKbd, pPtr; /* device pointer, to get funcs */
- ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
- ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
-} EventQueueRec, *EventQueuePtr;
-
-static EventQueueRec xf86EventQueue;
-
-Bool
-xf86eqInit (DevicePtr pKbd, DevicePtr pPtr)
-{
- xf86EventQueue.head = xf86EventQueue.tail = 0;
- xf86EventQueue.lastEventTime = GetTimeInMillis ();
- xf86EventQueue.pKbd = pKbd;
- xf86EventQueue.pPtr = pPtr;
- xf86EventQueue.lastMotion = FALSE;
- xf86EventQueue.pEnqueueScreen = screenInfo.screens[0];
- xf86EventQueue.pDequeueScreen = xf86EventQueue.pEnqueueScreen;
- SetInputCheck (&xf86EventQueue.head, &xf86EventQueue.tail);
- return TRUE;
-}
-/*
- * Must be reentrant with ProcessInputEvents. Assumption: xf86eqEnqueue
- * will never be interrupted. If this is called from both signal
- * handlers and regular code, make sure the signal is suspended when
- * called from regular code.
- */
-
-_X_EXPORT void
-xf86eqEnqueue (xEvent *e)
-{
- int oldtail, newtail;
- Bool isMotion;
-#ifdef XINPUT
- int count;
-
- xf86AssertBlockedSIGIO ("xf86eqEnqueue");
- switch (e->u.u.type) {
- case KeyPress:
- case KeyRelease:
-#ifdef XFreeXDGA
- /* we do this here, because nobody seems to be calling
- xf86PostKeyEvent(). We can't steal MotionNotify events here
- because the motion-relative information has been lost already. */
- if(DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, e))
- return;
-#endif
- /* fall through */
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- count = 1;
- break;
- default:
-#ifdef XFreeXDGA
- if (DGAIsDgaEvent (e))
- {
- count = 1;
- break;
- }
-#endif
- if (!((deviceKeyButtonPointer *) e)->deviceid & MORE_EVENTS) {
- count = 1;
- }
- else {
- count = 2;
- }
- break;
- }
-#endif
-
- oldtail = xf86EventQueue.tail;
- isMotion = e->u.u.type == MotionNotify;
- if (isMotion && xf86EventQueue.lastMotion && oldtail != xf86EventQueue.head) {
- if (oldtail == 0)
- oldtail = QUEUE_SIZE;
- oldtail = oldtail - 1;
- }
- else {
- newtail = oldtail + 1;
- if (newtail == QUEUE_SIZE)
- newtail = 0;
- /* Toss events which come in late */
- if (newtail == xf86EventQueue.head)
- return;
- xf86EventQueue.tail = newtail;
- }
-
- xf86EventQueue.lastMotion = isMotion;
- xf86EventQueue.events[oldtail].event = *e;
-#ifdef XINPUT
- if (count == 2) {
- xf86EventQueue.events[oldtail].val = *((deviceValuator *) (((deviceKeyButtonPointer *) e)+1));
- }
-#endif
- /*
- * Make sure that event times don't go backwards - this
- * is "unnecessary", but very useful
- */
- if (e->u.keyButtonPointer.time < xf86EventQueue.lastEventTime &&
- xf86EventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) {
-
- xf86EventQueue.events[oldtail].event.u.keyButtonPointer.time =
- xf86EventQueue.lastEventTime;
- }
- xf86EventQueue.events[oldtail].pScreen = xf86EventQueue.pEnqueueScreen;
-}
-
-/*
- * Call this from ProcessInputEvents()
- */
void
-xf86eqProcessInputEvents ()
+AddOtherInputDevices()
{
- EventRec *e;
- int x, y;
- struct {
- xEvent event;
-#ifdef XINPUT
- deviceValuator val;
-#endif
- } xe;
-#ifdef XINPUT
- DeviceIntPtr dev;
- int id, count;
- deviceKeyButtonPointer *dev_xe;
-#endif
-
- while (xf86EventQueue.head != xf86EventQueue.tail) {
- if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
-#ifdef DPMSExtension
- else if (DPMSPowerLevel != DPMSModeOn)
- SetScreenSaverTimer();
-
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+}
#endif
- e = &xf86EventQueue.events[xf86EventQueue.head];
- /*
- * Assumption - screen switching can only occur on motion events
- */
- if (e->pScreen != xf86EventQueue.pDequeueScreen) {
- xf86EventQueue.pDequeueScreen = e->pScreen;
- x = e->event.u.keyButtonPointer.rootX;
- y = e->event.u.keyButtonPointer.rootY;
- if (xf86EventQueue.head == QUEUE_SIZE - 1)
- xf86EventQueue.head = 0;
- else
- ++xf86EventQueue.head;
- NewCurrentScreen (xf86EventQueue.pDequeueScreen, x, y);
- }
- else {
- xe.event = e->event;
- xe.val = e->val;
- if (xf86EventQueue.head == QUEUE_SIZE - 1)
- xf86EventQueue.head = 0;
- else
- ++xf86EventQueue.head;
- switch (xe.event.u.u.type) {
- case KeyPress:
- case KeyRelease:
- (*xf86EventQueue.pKbd->processInputProc)
- (&xe.event, (DeviceIntPtr)xf86EventQueue.pKbd, 1);
- break;
-#ifdef XINPUT
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- (*(inputInfo.pointer->public.processInputProc))
- (&xe.event, (DeviceIntPtr)inputInfo.pointer, 1);
- break;
-
- default:
-#ifdef XFreeXDGA
- if (DGADeliverEvent (xf86EventQueue.pDequeueScreen, &xe.event))
- break;
-#endif
- dev_xe = (deviceKeyButtonPointer *) &xe.event;
- id = dev_xe->deviceid & DEVICE_BITS;
- if (!(dev_xe->deviceid & MORE_EVENTS)) {
- count = 1;
- }
- else {
- count = 2;
- }
- dev = LookupDeviceIntRec(id);
- if (dev == NULL) {
- ErrorF("LookupDeviceIntRec id=0x%x not found\n", id);
-/* FatalError("xf86eqProcessInputEvents : device not found.\n");
- */
- break;
- }
- if (!dev->public.processInputProc) {
- FatalError("xf86eqProcessInputEvents : device has no input proc.\n");
- break;
- }
- (*dev->public.processInputProc)(&xe.event, dev, count);
-#else
- default:
- (*xf86EventQueue.pPtr->processInputProc)
- (&xe.event, (DeviceIntPtr)xf86EventQueue.pPtr, 1);
-#endif
- break;
- }
- }
- }
-}
+int
+NewInputDeviceRequest (InputOption *options)
+{
+ IDevRec *idev = NULL;
+ InputDriverPtr drv = NULL;
+ InputInfoPtr pInfo = NULL;
+ InputOption *option = NULL;
+ DeviceIntPtr dev = NULL;
+
+ idev = xcalloc(sizeof(*idev), 1);
+ if (!idev)
+ return BadAlloc;
+
+ for (option = options; option; option = option->next) {
+ if (strcmp(option->key, "driver") == 0) {
+ if (!xf86LoadOneModule(option->value, NULL))
+ return BadName;
+ drv = xf86LookupInputDriver(option->value);
+ if (!drv) {
+ xf86Msg(X_ERROR, "No input driver matching `%s'\n",
+ option->value);
+ return BadName;
+ }
+ idev->driver = xstrdup(option->value);
+ if (!idev->driver) {
+ xfree(idev);
+ return BadAlloc;
+ }
+ }
+ if (strcmp(option->key, "name") == 0 ||
+ strcmp(option->key, "identifier") == 0) {
+ idev->identifier = xstrdup(option->value);
+ if (!idev->identifier) {
+ xfree(idev);
+ return BadAlloc;
+ }
+ }
+ }
+
+ if (!drv->PreInit) {
+ xf86Msg(X_ERROR,
+ "Input driver `%s' has no PreInit function (ignoring)\n",
+ drv->driverName);
+ return BadImplementation;
+ }
+
+ idev->commonOptions = NULL;
+ for (option = options; option; option = option->next)
+ idev->commonOptions = xf86addNewOption(idev->commonOptions,
+ option->key, option->value);
+ idev->extraOptions = NULL;
+
+ pInfo = drv->PreInit(drv, idev, 0);
+
+ if (!pInfo) {
+ xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n", idev->identifier);
+ return BadMatch;
+ }
+ else if (!(pInfo->flags & XI86_CONFIGURED)) {
+ xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
+ idev->identifier);
+ xf86DeleteInput(pInfo, 0);
+ return BadMatch;
+ }
+
+ xf86ActivateDevice(pInfo);
+
+ dev = pInfo->dev;
+ dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
+ if (dev->inited && dev->startup)
+ EnableDevice(dev);
-void
-xf86eqSwitchScreen(ScreenPtr pScreen,
- Bool fromDIX)
-{
- xf86EventQueue.pEnqueueScreen = pScreen;
-
- if (fromDIX)
- xf86EventQueue.pDequeueScreen = pScreen;
+ return Success;
}
/*
@@ -865,479 +427,156 @@ xf86eqSwitchScreen(ScreenPtr pScreen,
_X_EXPORT void
xf86PostMotionEvent(DeviceIntPtr device,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- ...)
-{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
- char *buff = 0;
- Time current;
- Bool is_core = xf86IsCorePointer(device);
- Bool is_shared = xf86ShareCorePointer(device);
- Bool drag = xf86SendDragEvents(device);
- ValuatorClassPtr val = device->valuator;
- int valuator[6];
- int oldaxis[6];
- int *axisvals;
- int dx = 0, dy = 0;
- float mult;
- int x, y;
- int loop_start;
- int i;
- int num;
-
- DBG(5, ErrorF("xf86PostMotionEvent BEGIN 0x%x(%s) is_core=%s is_shared=%s is_absolute=%s\n",
- device, device->name,
- is_core ? "True" : "False",
- is_shared ? "True" : "False",
- is_absolute ? "True" : "False"));
-
- xf86Info.lastEventTime = xev->time = current = GetTimeInMillis();
-
- if (!is_core) {
- if (HAS_MOTION_HISTORY(local)) {
- buff = ((char *)local->motion_history +
- (sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last);
- }
- }
-
- if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
- }
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int i = 0, nevents = 0;
+ Bool drag = xf86SendDragEvents(device);
+ LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
+ int *valuators = NULL;
+ int flags = 0;
- axisvals = val->axisVal;
+ if (is_absolute)
+ flags = POINTER_ABSOLUTE;
+ else
+ flags = POINTER_RELATIVE | POINTER_ACCELERATE;
- va_start(var, num_valuators);
+ valuators = xcalloc(sizeof(int), num_valuators);
- loop_start = first_valuator;
- for(loop=0; loop<num_valuators; loop++) {
-
- valuator[loop%6] = va_arg(var,int);
-
- if (loop % 6 == 5 || loop == num_valuators - 1) {
- num = loop % 6 + 1;
- /*
- * Adjust first two relative valuators
- */
- if (!is_absolute && num_valuators >= 2 && loop_start == 0) {
-
- dx = valuator[0];
- dy = valuator[1];
-
- /*
- * Accelerate
- */
- if (device->ptrfeed && device->ptrfeed->ctrl.num) {
- /* modeled from xf86Events.c */
- if (device->ptrfeed->ctrl.threshold) {
- if ((abs(dx) + abs(dy)) >= device->ptrfeed->ctrl.threshold) {
- local->dxremaind = ((float)dx * (float)(device->ptrfeed->ctrl.num)) /
- (float)(device->ptrfeed->ctrl.den) + local->dxremaind;
- valuator[0] = (int)local->dxremaind;
- local->dxremaind = local->dxremaind - (float)valuator[0];
-
- local->dyremaind = ((float)dy * (float)(device->ptrfeed->ctrl.num)) /
- (float)(device->ptrfeed->ctrl.den) + local->dyremaind;
- valuator[1] = (int)local->dyremaind;
- local->dyremaind = local->dyremaind - (float)valuator[1];
- }
- }
- else if (dx || dy) {
- mult = pow((float)(dx*dx+dy*dy),
- ((float)(device->ptrfeed->ctrl.num) /
- (float)(device->ptrfeed->ctrl.den) - 1.0) /
- 2.0) / 2.0;
- if (dx) {
- local->dxremaind = mult * (float)dx + local->dxremaind;
- valuator[0] = (int)local->dxremaind;
- local->dxremaind = local->dxremaind - (float)valuator[0];
- }
- if (dy) {
- local->dyremaind = mult * (float)dy + local->dyremaind;
- valuator[1] = (int)local->dyremaind;
- local->dyremaind = local->dyremaind - (float)valuator[1];
- }
- }
- DBG(6, ErrorF("xf86PostMotionEvent acceleration v0=%d v1=%d\n",
- valuator[0], valuator[1]));
- }
-
- /*
- * Map current position back to device space in case
- * the cursor was warped
- */
- if (is_core || is_shared)
- {
- miPointerPosition (&x, &y);
- if (local->reverse_conversion_proc)
- (*local->reverse_conversion_proc)(local, x, y, axisvals);
- else
- {
- axisvals[0] = x;
- axisvals[1] = y;
- }
- }
- }
-
- /*
- * Update axes
- */
- for (i = 0; i < num; i++)
- {
- oldaxis[i] = axisvals[loop_start + i];
- if (is_absolute)
- axisvals[loop_start + i] = valuator[i];
- else
- axisvals[loop_start + i] += valuator[i];
- }
-
- /*
- * Deliver extension event
- */
- if (!is_core) {
- xev->type = DeviceMotionNotify;
- xev->detail = 0;
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
-
- xv->device_state = 0;
- xv->num_valuators = num;
- xv->first_valuator = loop_start;
- memcpy (&xv->valuator0, &axisvals[loop_start],
- sizeof(INT32)*xv->num_valuators);
-
- if (HAS_MOTION_HISTORY(local)) {
- *(Time*)buff = current;
- memcpy(buff+sizeof(Time)+sizeof(INT32)*xv->first_valuator,
- &axisvals[loop_start],
- sizeof(INT32)*xv->num_valuators);
- }
- ENQUEUE(xE);
- }
-
- /*
- * Deliver core event
- */
- if (is_core ||
- (is_shared && num_valuators >= 2 && loop_start == 0)) {
-#ifdef XFreeXDGA
- /*
- * Let DGA peek at the event and steal it
- */
- xev->type = MotionNotify;
- xev->detail = 0;
- if (is_absolute)
- {
- dx = axisvals[0] - oldaxis[0];
- dy = axisvals[1] - oldaxis[1];
- }
- if (DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum,
- xE, dx, dy))
- continue;
-#endif
- if (!(*local->conversion_proc)(local, loop_start, num,
- axisvals[0], axisvals[1],
- axisvals[2], axisvals[3],
- axisvals[4], axisvals[5],
- &x, &y))
- continue;
-
- if (drag)
- miPointerAbsoluteCursor (x, y, current);
- /*
- * Retrieve the position
- */
- miPointerPosition (&x, &y);
- if (local->reverse_conversion_proc)
- (*local->reverse_conversion_proc)(local, x, y, axisvals);
- else
- {
- axisvals[0] = x;
- axisvals[1] = y;
- }
- }
- loop_start += 6;
- }
- }
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
va_end(var);
- if (HAS_MOTION_HISTORY(local)) {
- local->last = (local->last + 1) % device->valuator->numMotionEvents;
- if (local->last == local->first)
- local->first = (local->first + 1) % device->valuator->numMotionEvents;
- }
- DBG(5, ErrorF("xf86PostMotionEvent END 0x%x(%s) is_core=%s is_shared=%s\n",
- device, device->name,
- is_core ? "True" : "False",
- is_shared ? "True" : "False"));
+
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
+
+ nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0,
+ flags, first_valuator, num_valuators,
+ valuators);
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+
+ xfree(valuators);
}
_X_EXPORT void
xf86PostProximityEvent(DeviceIntPtr device,
- int is_in,
- int first_valuator,
- int num_valuators,
- ...)
+ int is_in,
+ int first_valuator,
+ int num_valuators,
+ ...)
{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
- ValuatorClassPtr val = device->valuator;
- Bool is_core = xf86IsCorePointer(device);
- Bool is_absolute = val && ((val->mode & 1) == Relative);
-
- DBG(5, ErrorF("xf86PostProximityEvent BEGIN 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
- device, device->name, is_in ? "true" : "false",
- is_core ? "True" : "False",
- is_absolute ? "True" : "False"));
-
- if (is_core) {
- return;
- }
-
- if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
- }
+ va_list var;
+ int i, nevents, *valuators = NULL;
- xev->type = is_in ? ProximityIn : ProximityOut;
- xev->detail = 0;
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
+ valuators = xcalloc(sizeof(int), num_valuators);
- if ((device->valuator->mode & 1) == Relative) {
- num_valuators = 0;
- }
-
- if (num_valuators != 0) {
- int *axisvals = val->axisVal;
-
- va_start(var, num_valuators);
-
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 1:
- xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 2:
- xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 3:
- xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 4:
- xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 5:
- xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- }
- if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
-
- xv->num_valuators = (loop % 6) + 1;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
- ENQUEUE(xE);
- }
- }
- va_end(var);
- }
- else {
- /* no valuator */
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
- xv->num_valuators = 0;
- xv->first_valuator = 0;
- ENQUEUE(xE);
- }
- DBG(5, ErrorF("xf86PostProximityEvent END 0x%x(%s) prox=%s is_core=%s is_absolute=%s\n",
- device, device->name, is_in ? "true" : "false",
- is_core ? "True" : "False",
- is_absolute ? "True" : "False"));
-
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
+
+ nevents = GetProximityEvents(xf86Events, device,
+ is_in ? ProximityIn : ProximityOut,
+ first_valuator, num_valuators, valuators);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+
+ xfree(valuators);
}
_X_EXPORT void
xf86PostButtonEvent(DeviceIntPtr device,
- int is_absolute,
- int button,
- int is_down,
- int first_valuator,
- int num_valuators,
- ...)
-{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
- ValuatorClassPtr val = device->valuator;
- Bool is_core = xf86IsCorePointer(device);
- Bool is_shared = xf86ShareCorePointer(device);
+ int is_absolute,
+ int button,
+ int is_down,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int *valuators = NULL;
+ int i = 0, nevents = 0;
- DBG(5, ErrorF("xf86PostButtonEvent BEGIN 0x%x(%s) button=%d down=%s is_core=%s is_shared=%s is_absolute=%s\n",
- device, device->name, button,
- is_down ? "True" : "False",
- is_core ? "True" : "False",
- is_shared ? "True" : "False",
- is_absolute ? "True" : "False"));
-
- /* Check the core pointer button state not to send an inconsistent
- * event. This can happen with the AlwaysCore feature.
- */
- if ((is_core || is_shared) &&
- !xf86CheckButton(device->button->map[button], is_down))
- {
- return;
- }
-
- if (num_valuators && (!val || (first_valuator + num_valuators > val->numAxes))) {
- ErrorF("Bad valuators reported for device \"%s\"\n", device->name);
- return;
- }
+ valuators = xcalloc(sizeof(int), num_valuators);
- if (!is_core) {
- xev->type = is_down ? DeviceButtonPress : DeviceButtonRelease;
- xev->detail = button;
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
-
- if (num_valuators != 0) {
- int *axisvals = val->axisVal;
-
- va_start(var, num_valuators);
-
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 1:
- xv->valuator1 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 2:
- xv->valuator2 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 3:
- xv->valuator3 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 4:
- xv->valuator4 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- case 5:
- xv->valuator5 = is_absolute ? va_arg(var, int) : axisvals[loop];
- break;
- }
- if ((loop % 6 == 5) || (loop == num_valuators - 1)) {
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xv->num_valuators = (loop % 6) + 1;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
- ENQUEUE(xE);
-
- }
- }
- va_end(var);
- }
- else {
- /* no valuator */
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xv->num_valuators = 0;
- xv->first_valuator = 0;
- ENQUEUE(xE);
- }
- }
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
- /* removed rootX/rootY as DIX sets these fields */
- if (is_core || is_shared) {
- xE->u.u.type = is_down ? ButtonPress : ButtonRelease;
- xE->u.u.detail = device->button->map[button];
- xf86Info.lastEventTime = xE->u.keyButtonPointer.time = GetTimeInMillis();
-
-#ifdef XFreeXDGA
- if (!DGAStealMouseEvent(xf86EventQueue.pEnqueueScreen->myNum, xE, 0, 0))
-#endif
- ENQUEUE(xE);
- }
- DBG(5, ErrorF("xf86PostButtonEvent END\n"));
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
+
+ nevents = GetPointerEvents(xf86Events, device,
+ is_down ? ButtonPress : ButtonRelease, button,
+ is_absolute ? POINTER_ABSOLUTE :
+ POINTER_RELATIVE,
+ first_valuator, num_valuators, valuators);
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
+
+ xfree(valuators);
}
_X_EXPORT void
xf86PostKeyEvent(DeviceIntPtr device,
- unsigned int key_code,
- int is_down,
- int is_absolute,
- int first_valuator,
- int num_valuators,
- ...)
-{
- va_list var;
- int loop;
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
- deviceValuator *xv = (deviceValuator*) xev+1;
-
- va_start(var, num_valuators);
-
- for(loop=0; loop<num_valuators; loop++) {
- switch (loop % 6) {
- case 0:
- xv->valuator0 = va_arg(var, int);
- break;
- case 1:
- xv->valuator1 = va_arg(var, int);
- break;
- case 2:
- xv->valuator2 = va_arg(var, int);
- break;
- case 3:
- xv->valuator3 = va_arg(var, int);
- break;
- case 4:
- xv->valuator4 = va_arg(var, int);
- break;
- case 5:
- xv->valuator5 = va_arg(var, int);
- break;
- }
- if (((loop % 6 == 5) || (loop == num_valuators - 1))) {
- xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease;
- xev->detail = key_code;
-
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
- xev->deviceid = device->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = device->id;
- xv->device_state = 0;
- /* if the device is in the relative mode we don't have to send valuators */
- xv->num_valuators = is_absolute ? (loop % 6) + 1 : 0;
- xv->first_valuator = first_valuator + (loop / 6) * 6;
-
- ENQUEUE(xE);
- /* if the device is in the relative mode only one event is needed */
- if (!is_absolute) break;
- }
+ unsigned int key_code,
+ int is_down,
+ int is_absolute,
+ int first_valuator,
+ int num_valuators,
+ ...)
+{
+ va_list var;
+ int i = 0, nevents = 0, *valuators = NULL;
+
+ /* instil confidence in the user */
+ DebugF("this function has never been tested properly. if things go quite "
+ "badly south after this message, then xf86PostKeyEvent is "
+ "broken.\n");
+
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
+
+ if (is_absolute) {
+ valuators = xcalloc(sizeof(int), num_valuators);
+ va_start(var, num_valuators);
+ for (i = 0; i < num_valuators; i++)
+ valuators[i] = va_arg(var, int);
+ va_end(var);
+
+ nevents = GetKeyboardValuatorEvents(xf86Events, device,
+ is_down ? KeyPress : KeyRelease,
+ key_code, first_valuator,
+ num_valuators, valuators);
+ xfree(valuators);
}
- va_end(var);
+ else {
+ nevents = GetKeyboardEvents(xf86Events, device,
+ is_down ? KeyPress : KeyRelease,
+ key_code);
+ }
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT void
@@ -1345,72 +584,18 @@ xf86PostKeyboardEvent(DeviceIntPtr device,
unsigned int key_code,
int is_down)
{
- xEvent xE[2];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer*) xE;
-
- if (xf86IsCoreKeyboard(device)) {
- xev->type = is_down ? KeyPress : KeyRelease;
- } else {
- xev->type = is_down ? DeviceKeyPress : DeviceKeyRelease;
- }
- xev->detail = key_code;
- xf86Info.lastEventTime = xev->time = GetTimeInMillis();
+ int nevents = 0, i = 0;
-#ifdef XFreeXDGA
- /* if(!DGAStealKeyEvent(xf86EventQueue.pEnqueueScreen->myNum, xE)) */
-#endif
- ENQUEUE(xE);
-}
-
-/*
- * Motion history management.
- */
+ if (!xf86Events)
+ xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xf86Events)
+ FatalError("Couldn't allocate event store\n");
-_X_EXPORT void
-xf86MotionHistoryAllocate(LocalDevicePtr local)
-{
- ValuatorClassPtr valuator = local->dev->valuator;
-
- if (!HAS_MOTION_HISTORY(local))
- return;
- if (local->motion_history) xfree(local->motion_history);
- local->motion_history = xalloc((sizeof(INT32) * valuator->numAxes + sizeof(Time))
- * valuator->numMotionEvents);
- local->first = 0;
- local->last = 0;
-}
+ nevents = GetKeyboardEvents(xf86Events, device,
+ is_down ? KeyPress : KeyRelease, key_code);
-_X_EXPORT int
-xf86GetMotionEvents(DeviceIntPtr dev,
- xTimecoord *buff,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen)
-{
- LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
- ValuatorClassPtr valuator = dev->valuator;
- int num = 0;
- int loop = local->first;
- int size;
- Time current;
-
- if (!HAS_MOTION_HISTORY(local))
- return 0;
-
- size = (sizeof(INT32) * valuator->numAxes + sizeof(Time));
-
- while (loop != local->last) {
- current = *(Time*)(((char *)local->motion_history)+loop*size);
- if (current > stop)
- return num;
- if (current >= start) {
- memcpy(((char *)buff)+size*num,
- ((char *)local->motion_history)+loop*size, size);
- num++;
- }
- loop = (loop + 1) % valuator->numMotionEvents;
- }
- return num;
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT LocalDevicePtr
@@ -1434,10 +619,10 @@ xf86FirstLocalDevice()
_X_EXPORT int
xf86ScaleAxis(int Cx,
- int Sxhigh,
- int Sxlow,
- int Rxhigh,
- int Rxlow )
+ int Sxhigh,
+ int Sxlow,
+ int Rxhigh,
+ int Rxlow )
{
int X;
int dSx = Sxhigh - Sxlow;
@@ -1472,9 +657,9 @@ xf86XInputSetScreen(LocalDevicePtr local,
int x,
int y)
{
- if ((xf86IsCorePointer(local->dev) || xf86ShareCorePointer(local->dev)) &&
- (miPointerCurrentScreen() != screenInfo.screens[screen_number])) {
- miPointerSetNewScreen (screen_number, x, y);
+ if (miPointerGetScreen(local->dev) !=
+ screenInfo.screens[screen_number]) {
+ miPointerSetScreen(local->dev, screen_number, x, y);
}
}
@@ -1483,17 +668,11 @@ _X_EXPORT void
xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
int resolution, int min_res, int max_res)
{
-#ifdef XINPUT
- if (maxval == -1) {
- if (axnum == 0)
- maxval = screenInfo.screens[0]->width - 1;
- else if (axnum == 1)
- maxval = screenInfo.screens[0]->height - 1;
- /* else? */
- }
+ if (!dev || !dev->valuator)
+ return;
+
InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res,
max_res);
-#endif
}
/*
@@ -1503,12 +682,14 @@ xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
_X_EXPORT void
xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
{
-#ifdef XINPUT
- if (axnum == 0)
+ if (axnum == 0) {
dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
- else if (axnum == 1)
+ dev->valuator->lastx = dev->valuator->axisVal[0];
+ }
+ else if (axnum == 1) {
dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
-#endif
+ dev->valuator->lasty = dev->valuator->axisVal[1];
+ }
}
/* end of xf86Xinput.c */
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 20bf0a9e1..fe65643ce 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -86,15 +86,6 @@
#define XI_PRIVATE(dev) \
(((LocalDevicePtr)((dev)->public.devicePrivate))->private)
-#ifdef DBG
-#undef DBG
-#endif
-#define DBG(lvl, f) {if ((lvl) <= xf86GetVerbosity()) f;}
-
-#ifdef HAS_MOTION_HISTORY
-#undef HAS_MOTION_HISTORY
-#endif
-#define HAS_MOTION_HISTORY(local) ((local)->dev->valuator && (local)->dev->valuator->numMotionEvents)
#ifdef XINPUT
/* This holds the input driver entry and module information. */
@@ -118,7 +109,7 @@ typedef struct _LocalDeviceRec {
struct _LocalDeviceRec *next;
char * name;
int flags;
-
+
Bool (*device_control)(DeviceIntPtr device, int what);
void (*read_input)(struct _LocalDeviceRec *local);
int (*control_proc)(struct _LocalDeviceRec *local,
@@ -133,21 +124,20 @@ typedef struct _LocalDeviceRec {
Bool (*reverse_conversion_proc)(
struct _LocalDeviceRec *local,
int x, int y, int *valuators);
-
+ int (*set_device_valuators)
+ (struct _LocalDeviceRec *local,
+ int *valuators, int first_valuator,
+ int num_valuators);
+
int fd;
Atom atom;
DeviceIntPtr dev;
pointer private;
int private_flags;
- pointer motion_history;
- ValuatorMotionProcPtr motion_history_proc;
- unsigned int history_size; /* only for configuration purpose */
unsigned int first;
unsigned int last;
int old_x;
int old_y;
- float dxremaind;
- float dyremaind;
char * type_name;
IntegerFeedbackPtr always_core_feedback;
IDevPtr conf_idev;
@@ -166,16 +156,7 @@ typedef struct _DeviceAssocRec
extern InputInfoPtr xf86InputDevs;
/* xf86Xinput.c */
-int xf86IsCorePointer(DeviceIntPtr dev);
-int xf86IsCoreKeyboard(DeviceIntPtr dev);
-void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always);
-#define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b)
-
void InitExtInput(void);
-Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr);
-void xf86eqEnqueue(struct _xEvent *event);
-void xf86eqProcessInputEvents (void);
-void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
int first_valuator, int num_valuators, ...);
void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
@@ -188,10 +169,6 @@ void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
...);
void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
int is_down);
-void xf86MotionHistoryAllocate(LocalDevicePtr local);
-int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
- unsigned long start, unsigned long stop,
- ScreenPtr pScreen);
void xf86XinputFinalizeInit(DeviceIntPtr dev);
void xf86ActivateDevice(LocalDevicePtr local);
Bool xf86CheckButton(int button, int down);
@@ -211,10 +188,16 @@ void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
void xf86DeleteInputDriver(int drvIndex);
InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
+InputDriverPtr xf86LookupInputDriver(const char *name);
+InputInfoPtr xf86LookupInput(const char *name);
void xf86DeleteInput(InputInfoPtr pInp, int flags);
/* xf86Option.c */
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
pointer extraOpts);
+/* Legacy hatred */
+#define SendCoreEvents 59
+#define DontSendCoreEvents 60
+
#endif /* _xf86Xinput_h */
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index b763042cc..ae33568b8 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1398,7 +1398,7 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, unsigned long type)
(*p_base) = H2B(tag,range.rBegin,type);
#ifdef DEBUG
ErrorF("New PCI res %i base: 0x%lx, size: 0x%lx, type %s\n",
- res_n,(*p_base),(1 << (*p_size)),
+ res_n,(*p_base),(1L << (*p_size)),
((type & ResPhysMask) == ResMem) ? "Mem" : "Io");
#endif
if (res_n != 0xff) {
@@ -1577,8 +1577,8 @@ findPciRange(PCITAG tag, resPtr m, resPtr avoid, CARD32 size)
return 0;
}
-pciVideoPtr
-getPciVideoPtr(tag)
+static pciVideoPtr
+getPciVideoPtr(PCITAG tag)
{
int n = 0;
diff --git a/hw/xfree86/int10/Makefile.am b/hw/xfree86/int10/Makefile.am
index 868954fd4..28e20d502 100644
--- a/hw/xfree86/int10/Makefile.am
+++ b/hw/xfree86/int10/Makefile.am
@@ -13,8 +13,12 @@ COMMON_SOURCES = \
xf86int10.c \
xf86int10module.c
+if I386_VIDEO
+I386_VIDEO_CFLAGS = -D_PC
+endif
+
if INT10_VM86
-AM_CFLAGS = -D_PC -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
INCLUDES = $(XORG_INCS)
libint10_la_SOURCES = \
$(COMMON_SOURCES) \
@@ -23,7 +27,8 @@ libint10_la_SOURCES = \
endif
if INT10_X86EMU
-AM_CFLAGS = -D_X86EMU -DNO_SYS_HEADERS -D_PC $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_X86EMU -DNO_SYS_HEADERS \
+ $(XORG_CFLAGS) $(EXTRA_CFLAGS) $(DIX_CFLAGS)
INCLUDES = $(XORG_INCS) -I$(srcdir)/../x86emu
libint10_la_SOURCES = \
$(COMMON_SOURCES) \
@@ -33,7 +38,7 @@ libint10_la_SOURCES = \
endif
if INT10_STUB
-AM_CFLAGS = -D_PC -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
libint10_la_SOURCES = stub.c xf86int10module.c
endif
diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index 734d84720..d80de89cc 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -469,7 +469,6 @@ Mem_wl(CARD32 addr, CARD32 val)
static CARD32 PciCfg1Addr = 0;
-#define TAG(Cfg1Addr) (Cfg1Addr & 0xffff00)
#define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff)
static int
@@ -480,7 +479,7 @@ pciCfg1in(CARD16 addr, CARD32 *val)
return 1;
}
if (addr == 0xCFC) {
- *val = pciReadLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr));
+ *val = pciReadLong(Int10Current->Tag, OFFSET(PciCfg1Addr));
return 1;
}
return 0;
@@ -494,7 +493,7 @@ pciCfg1out(CARD16 addr, CARD32 val)
return 1;
}
if (addr == 0xCFC) {
- pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr), val);
+ pciWriteLong(Int10Current->Tag, OFFSET(PciCfg1Addr), val);
return 1;
}
return 0;
@@ -512,7 +511,7 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
- *val = pciReadWord(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset);
+ *val = pciReadWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset);
return 1;
}
return 0;
@@ -531,7 +530,7 @@ pciCfg1outw(CARD16 addr, CARD16 val)
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
- pciWriteWord(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset, val);
+ pciWriteWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val);
return 1;
}
return 0;
@@ -549,7 +548,7 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
- *val = pciReadByte(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset);
+ *val = pciReadByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset);
return 1;
}
return 0;
@@ -568,7 +567,7 @@ pciCfg1outb(CARD16 addr, CARD8 val)
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
- pciWriteByte(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset, val);
+ pciWriteByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val);
return 1;
}
return 0;
diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c
index 3f959faa2..46d6a024d 100644
--- a/hw/xfree86/loader/misym.c
+++ b/hw/xfree86/loader/misym.c
@@ -191,8 +191,6 @@ _X_HIDDEN void *miLookupTab[] = {
SYMFUNC(miSegregateChildren)
SYMFUNC(miHookInitVisuals)
SYMFUNC(miPointerAbsoluteCursor)
- SYMFUNC(miPointerGetMotionEvents)
- SYMFUNC(miPointerGetMotionBufferSize)
SYMFUNC(miOverlayCopyUnderlay)
SYMFUNC(miOverlaySetTransFunction)
SYMFUNC(miOverlayCollectUnderlayRegions)
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index a498cccbd..3051dedaf 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -70,7 +70,6 @@
# include "xf86Xinput.h"
#endif
#include "xf86OSmouse.h"
-#include "xf86OSKbd.h"
#include "xf86xv.h"
#include "xf86xvmc.h"
#include "xf86cmap.h"
@@ -280,7 +279,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86SerialModemClearBits)
SYMFUNC(xf86LoadKernelModule)
SYMFUNC(xf86OSMouseInit)
- SYMFUNC(xf86OSKbdPreInit)
SYMFUNC(xf86AgpGARTSupported)
SYMFUNC(xf86GetAGPInfo)
SYMFUNC(xf86AcquireGART)
@@ -290,10 +288,8 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86BindGARTMemory)
SYMFUNC(xf86UnbindGARTMemory)
SYMFUNC(xf86EnableAGP)
- SYMFUNC(xf86SoundKbdBell)
SYMFUNC(xf86GARTCloseScreen)
#ifdef XINPUT
- /* XISB routines (Merged from Metrolink tree) */
SYMFUNC(XisbNew)
SYMFUNC(XisbFree)
SYMFUNC(XisbRead)
@@ -696,22 +692,15 @@ _X_HIDDEN void *xfree86LookupTab[] = {
/* xf86Xinput.c */
#ifdef XINPUT
SYMFUNC(xf86ProcessCommonOptions)
- SYMFUNC(xf86IsCorePointer)
SYMFUNC(xf86PostMotionEvent)
SYMFUNC(xf86PostProximityEvent)
SYMFUNC(xf86PostButtonEvent)
SYMFUNC(xf86PostKeyEvent)
SYMFUNC(xf86PostKeyboardEvent)
- SYMFUNC(xf86GetMotionEvents)
- SYMFUNC(xf86MotionHistoryAllocate)
SYMFUNC(xf86FirstLocalDevice)
- SYMFUNC(xf86eqEnqueue)
SYMFUNC(xf86ActivateDevice)
-/* The following segment merged from Metrolink tree */
SYMFUNC(xf86XInputSetScreen)
SYMFUNC(xf86ScaleAxis)
- SYMFUNC(xf86XInputSetSendCoreEvents)
-/* End merged segment */
#endif
#ifdef DPMSExtension
SYMFUNC(DPMSGet)
diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am
index 58b0e95c2..0bce3de40 100644
--- a/hw/xfree86/os-support/Makefile.am
+++ b/hw/xfree86/os-support/Makefile.am
@@ -6,7 +6,7 @@ SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
DIST_SUBDIRS = bsd bus drm misc linux lynxos solaris sysv sco usl hurd
sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h xf86_ansic.h xf86_libc.h \
- assyntax.h xf86OSKbd.h xf86OSmouse.h
+ assyntax.h xf86OSmouse.h
EXTRA_DIST = int10Defines.h xf86OSpriv.h README.OS-lib xf86drm.h
@@ -29,5 +29,4 @@ DISTCLEANFILES = xorgos.c
# FIXME: These don't seem to be used anywhere
EXTRA_DIST += \
shared/bios_devmem.c \
- shared/inout.S \
- shared/kbd.c
+ shared/inout.S
diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am
index 20885e866..e456328df 100644
--- a/hw/xfree86/os-support/bsd/Makefile.am
+++ b/hw/xfree86/os-support/bsd/Makefile.am
@@ -55,19 +55,15 @@ AM_CFLAGS = -DUSESTDRES $(XORG_CFLAGS)
INCLUDES = $(XORG_INCS)
libbsd_la_SOURCES = \
- $(srcdir)/../shared/at_scancode.c \
$(srcdir)/../shared/libc_wrapper.c \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/sigio.c \
- $(srcdir)/../shared/std_kbdEv.c \
$(srcdir)/../shared/stdPci.c \
$(srcdir)/../shared/vidmem.c \
bsd_VTsw.c \
bsd_init.c \
- bsd_io.c \
- bsd_kbd.c \
- bsd_KbdMap.c \
bsd_mouse.c \
+ bsd_bell.c \
$(ARCH_SOURCES) \
$(AGP_SOURCES) \
$(APM_SOURCES) \
@@ -80,7 +76,6 @@ libbsd_la_SOURCES = \
EXTRA_DIST = \
bsd_apm.c \
bsd_jstk.c \
- bsd_kbd.h \
bsd_kqueue_apm.c \
bsdResource.c \
memrange.h \
diff --git a/hw/xfree86/os-support/bsd/bsd_KbdMap.c b/hw/xfree86/os-support/bsd/bsd_KbdMap.c
deleted file mode 100644
index d225c1f38..000000000
--- a/hw/xfree86/os-support/bsd/bsd_KbdMap.c
+++ /dev/null
@@ -1,1087 +0,0 @@
-/* $XFree86$ */
-
-/*
- * Slightly modified xf86KbdBSD.c which is
- *
- * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk)
- * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * and from xf86KbdCODrv.c by Holger Veit
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "xf86Keymap.h"
-#include "bsd_kbd.h"
-
-#if (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT)) && defined(GIO_KEYMAP)
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
-
-static unsigned char remap[NUM_KEYCODES] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-/* This table assumes the ibm code page 437 coding for characters
- * > 0x80. They are returned in this form by PCVT */
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
- /* This has been checked against what syscons actually does */
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol
-};
-
-#ifdef __OpenBSD__
-/* don't mark AltR and CtrlR for remapping, since they
- * cannot be remapped by pccons */
-static unsigned char pccons_remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-/* This table assumes an iso8859_1 encoding for the characters
- * > 80, as returned by pccons */
-static KeySym latin1_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
- };
-#endif
-
-#ifdef SYSCONS_SUPPORT
-static
-unsigned char sysconsCODEMap[] = {
- KEY_KP_Enter, KEY_RCtrl, KEY_KP_Divide, KEY_Print,
- KEY_AltLang, KEY_KP_7, KEY_KP_8, KEY_KP_9,
- KEY_KP_4, KEY_KP_6, KEY_KP_1, KEY_KP_2,
- KEY_KP_3, KEY_KP_0, KEY_KP_Decimal, KEY_Pause,
- KEY_LMeta, KEY_RMeta, KEY_Menu, KEY_Break
-};
-static
-TransMapRec sysconsCODE = {
- 0x59,
- 0x6d,
- sysconsCODEMap
-};
-#endif
-#endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */
-
-#ifdef WSCONS_SUPPORT
-
-static CARD8 wsUsbMap[] = {
- /* 0 */ KEY_NOTUSED,
- /* 1 */ KEY_NOTUSED,
- /* 2 */ KEY_NOTUSED,
- /* 3 */ KEY_NOTUSED,
- /* 4 */ KEY_A,
- /* 5 */ KEY_B,
- /* 6 */ KEY_C,
- /* 7 */ KEY_D,
- /* 8 */ KEY_E,
- /* 9 */ KEY_F,
- /* 10 */ KEY_G,
- /* 11 */ KEY_H,
- /* 12 */ KEY_I,
- /* 13 */ KEY_J,
- /* 14 */ KEY_K,
- /* 15 */ KEY_L,
- /* 16 */ KEY_M,
- /* 17 */ KEY_N,
- /* 18 */ KEY_O,
- /* 19 */ KEY_P,
- /* 20 */ KEY_Q,
- /* 21 */ KEY_R,
- /* 22 */ KEY_S,
- /* 23 */ KEY_T,
- /* 24 */ KEY_U,
- /* 25 */ KEY_V,
- /* 26 */ KEY_W,
- /* 27 */ KEY_X,
- /* 28 */ KEY_Y,
- /* 29 */ KEY_Z,
- /* 30 */ KEY_1, /* 1 !*/
- /* 31 */ KEY_2, /* 2 @ */
- /* 32 */ KEY_3, /* 3 # */
- /* 33 */ KEY_4, /* 4 $ */
- /* 34 */ KEY_5, /* 5 % */
- /* 35 */ KEY_6, /* 6 ^ */
- /* 36 */ KEY_7, /* 7 & */
- /* 37 */ KEY_8, /* 8 * */
- /* 38 */ KEY_9, /* 9 ( */
- /* 39 */ KEY_0, /* 0 ) */
- /* 40 */ KEY_Enter, /* Return */
- /* 41 */ KEY_Escape, /* Escape */
- /* 42 */ KEY_BackSpace, /* Backspace Delete */
- /* 43 */ KEY_Tab, /* Tab */
- /* 44 */ KEY_Space, /* Space */
- /* 45 */ KEY_Minus, /* - _ */
- /* 46 */ KEY_Equal, /* = + */
- /* 47 */ KEY_LBrace, /* [ { */
- /* 48 */ KEY_RBrace, /* ] } */
- /* 49 */ KEY_BSlash, /* \ | */
- /* 50 */ KEY_BSlash2, /* \ _ # ~ on some keyboards */
- /* 51 */ KEY_SemiColon, /* ; : */
- /* 52 */ KEY_Quote, /* ' " */
- /* 53 */ KEY_Tilde, /* ` ~ */
- /* 54 */ KEY_Comma, /* , < */
- /* 55 */ KEY_Period, /* . > */
- /* 56 */ KEY_Slash, /* / ? */
- /* 57 */ KEY_CapsLock, /* Caps Lock */
- /* 58 */ KEY_F1, /* F1 */
- /* 59 */ KEY_F2, /* F2 */
- /* 60 */ KEY_F3, /* F3 */
- /* 61 */ KEY_F4, /* F4 */
- /* 62 */ KEY_F5, /* F5 */
- /* 63 */ KEY_F6, /* F6 */
- /* 64 */ KEY_F7, /* F7 */
- /* 65 */ KEY_F8, /* F8 */
- /* 66 */ KEY_F9, /* F9 */
- /* 67 */ KEY_F10, /* F10 */
- /* 68 */ KEY_F11, /* F11 */
- /* 69 */ KEY_F12, /* F12 */
- /* 70 */ KEY_Print, /* PrintScrn SysReq */
- /* 71 */ KEY_ScrollLock, /* Scroll Lock */
- /* 72 */ KEY_Pause, /* Pause Break */
- /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */
- /* 74 */ KEY_Home, /* Home */
- /* 75 */ KEY_PgUp, /* Page Up */
- /* 76 */ KEY_Delete, /* Delete */
- /* 77 */ KEY_End, /* End */
- /* 78 */ KEY_PgDown, /* Page Down */
- /* 79 */ KEY_Right, /* Right Arrow */
- /* 80 */ KEY_Left, /* Left Arrow */
- /* 81 */ KEY_Down, /* Down Arrow */
- /* 82 */ KEY_Up, /* Up Arrow */
- /* 83 */ KEY_NumLock, /* Num Lock */
- /* 84 */ KEY_KP_Divide, /* Keypad / */
- /* 85 */ KEY_KP_Multiply, /* Keypad * */
- /* 86 */ KEY_KP_Minus, /* Keypad - */
- /* 87 */ KEY_KP_Plus, /* Keypad + */
- /* 88 */ KEY_KP_Enter, /* Keypad Enter */
- /* 89 */ KEY_KP_1, /* Keypad 1 End */
- /* 90 */ KEY_KP_2, /* Keypad 2 Down */
- /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */
- /* 92 */ KEY_KP_4, /* Keypad 4 Left */
- /* 93 */ KEY_KP_5, /* Keypad 5 */
- /* 94 */ KEY_KP_6, /* Keypad 6 */
- /* 95 */ KEY_KP_7, /* Keypad 7 Home */
- /* 96 */ KEY_KP_8, /* Keypad 8 Up */
- /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */
- /* 98 */ KEY_KP_0, /* Keypad 0 Ins */
- /* 99 */ KEY_KP_Decimal, /* Keypad . Del */
- /* 100 */ KEY_Less, /* < > on some keyboards */
- /* 101 */ KEY_Menu, /* Menu */
- /* 102 */ KEY_NOTUSED,
- /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_NOTUSED,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_NOTUSED,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_NOTUSED,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_NOTUSED,
- /* 116 */ KEY_NOTUSED,
- /* 117 */ KEY_NOTUSED,
- /* 118 */ KEY_NOTUSED,
- /* 119 */ KEY_NOTUSED,
- /* 120 */ KEY_NOTUSED,
- /* 121 */ KEY_NOTUSED,
- /* 122 */ KEY_NOTUSED,
- /* 123 */ KEY_NOTUSED,
- /* 124 */ KEY_NOTUSED,
- /* 125 */ KEY_NOTUSED,
- /* 126 */ KEY_NOTUSED,
- /* 127 */ KEY_NOTUSED,
- /* 128 */ KEY_NOTUSED,
- /* 129 */ KEY_NOTUSED,
- /* 130 */ KEY_NOTUSED,
- /* 131 */ KEY_NOTUSED,
- /* 132 */ KEY_NOTUSED,
- /* 133 */ KEY_NOTUSED,
- /* 134 */ KEY_NOTUSED,
- /* 135 */ KEY_NOTUSED,
- /* 136 */ KEY_NOTUSED,
- /* 137 */ KEY_NOTUSED,
- /* 138 */ KEY_NOTUSED,
- /* 139 */ KEY_NOTUSED,
- /* 140 */ KEY_NOTUSED,
- /* 141 */ KEY_NOTUSED,
- /* 142 */ KEY_NOTUSED,
- /* 143 */ KEY_NOTUSED,
- /* 144 */ KEY_NOTUSED,
- /* 145 */ KEY_NOTUSED,
- /* 146 */ KEY_NOTUSED,
- /* 147 */ KEY_NOTUSED,
- /* 148 */ KEY_NOTUSED,
- /* 149 */ KEY_NOTUSED,
- /* 150 */ KEY_NOTUSED,
- /* 151 */ KEY_NOTUSED,
- /* 152 */ KEY_NOTUSED,
- /* 153 */ KEY_NOTUSED,
- /* 154 */ KEY_NOTUSED,
- /* 155 */ KEY_NOTUSED,
- /* 156 */ KEY_NOTUSED,
- /* 157 */ KEY_NOTUSED,
- /* 158 */ KEY_NOTUSED,
- /* 159 */ KEY_NOTUSED,
- /* 160 */ KEY_NOTUSED,
- /* 161 */ KEY_NOTUSED,
- /* 162 */ KEY_NOTUSED,
- /* 163 */ KEY_NOTUSED,
- /* 164 */ KEY_NOTUSED,
- /* 165 */ KEY_NOTUSED,
- /* 166 */ KEY_NOTUSED,
- /* 167 */ KEY_NOTUSED,
- /* 168 */ KEY_NOTUSED,
- /* 169 */ KEY_NOTUSED,
- /* 170 */ KEY_NOTUSED,
- /* 171 */ KEY_NOTUSED,
- /* 172 */ KEY_NOTUSED,
- /* 173 */ KEY_NOTUSED,
- /* 174 */ KEY_NOTUSED,
- /* 175 */ KEY_NOTUSED,
- /* 176 */ KEY_NOTUSED,
- /* 177 */ KEY_NOTUSED,
- /* 178 */ KEY_NOTUSED,
- /* 179 */ KEY_NOTUSED,
- /* 180 */ KEY_NOTUSED,
- /* 181 */ KEY_NOTUSED,
- /* 182 */ KEY_NOTUSED,
- /* 183 */ KEY_NOTUSED,
- /* 184 */ KEY_NOTUSED,
- /* 185 */ KEY_NOTUSED,
- /* 186 */ KEY_NOTUSED,
- /* 187 */ KEY_NOTUSED,
- /* 188 */ KEY_NOTUSED,
- /* 189 */ KEY_NOTUSED,
- /* 190 */ KEY_NOTUSED,
- /* 191 */ KEY_NOTUSED,
- /* 192 */ KEY_NOTUSED,
- /* 193 */ KEY_NOTUSED,
- /* 194 */ KEY_NOTUSED,
- /* 195 */ KEY_NOTUSED,
- /* 196 */ KEY_NOTUSED,
- /* 197 */ KEY_NOTUSED,
- /* 198 */ KEY_NOTUSED,
- /* 199 */ KEY_NOTUSED,
- /* 200 */ KEY_NOTUSED,
- /* 201 */ KEY_NOTUSED,
- /* 202 */ KEY_NOTUSED,
- /* 203 */ KEY_NOTUSED,
- /* 204 */ KEY_NOTUSED,
- /* 205 */ KEY_NOTUSED,
- /* 206 */ KEY_NOTUSED,
- /* 207 */ KEY_NOTUSED,
- /* 208 */ KEY_NOTUSED,
- /* 209 */ KEY_NOTUSED,
- /* 210 */ KEY_NOTUSED,
- /* 211 */ KEY_NOTUSED,
- /* 212 */ KEY_NOTUSED,
- /* 213 */ KEY_NOTUSED,
- /* 214 */ KEY_NOTUSED,
- /* 215 */ KEY_NOTUSED,
- /* 216 */ KEY_NOTUSED,
- /* 217 */ KEY_NOTUSED,
- /* 218 */ KEY_NOTUSED,
- /* 219 */ KEY_NOTUSED,
- /* 220 */ KEY_NOTUSED,
- /* 221 */ KEY_NOTUSED,
- /* 222 */ KEY_NOTUSED,
- /* 223 */ KEY_NOTUSED,
- /* 224 */ KEY_LCtrl, /* Left Control */
- /* 225 */ KEY_ShiftL, /* Left Shift */
- /* 226 */ KEY_Alt, /* Left Alt */
- /* 227 */ KEY_LMeta, /* Left Meta */
- /* 228 */ KEY_RCtrl, /* Right Control */
- /* 229 */ KEY_ShiftR, /* Right Shift */
- /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
- /* 231 */ KEY_LMeta, /* Right Meta XXX */
-};
-#define WS_USB_MAP_SIZE (sizeof(wsUsbMap)/sizeof(unsigned char))
-
-static
-TransMapRec wsUsb = {
- 0,
- WS_USB_MAP_SIZE,
- wsUsbMap
-};
-
-/* Map for adb keyboards */
-static CARD8 wsAdbMap[] = {
- /* 0 */ KEY_A,
- /* 1 */ KEY_S,
- /* 2 */ KEY_D,
- /* 3 */ KEY_F,
- /* 4 */ KEY_H,
- /* 5 */ KEY_G,
- /* 6 */ KEY_Z,
- /* 7 */ KEY_X,
- /* 8 */ KEY_C,
- /* 9 */ KEY_V,
- /* 10 */ KEY_UNKNOWN, /* @ # on french keyboards */
- /* 11 */ KEY_B,
- /* 12 */ KEY_Q,
- /* 13 */ KEY_W,
- /* 14 */ KEY_E,
- /* 15 */ KEY_R,
- /* 16 */ KEY_Y,
- /* 17 */ KEY_T,
- /* 18 */ KEY_1,
- /* 19 */ KEY_2,
- /* 20 */ KEY_3,
- /* 21 */ KEY_4,
- /* 22 */ KEY_6,
- /* 23 */ KEY_5,
- /* 24 */ KEY_Equal,
- /* 25 */ KEY_9,
- /* 26 */ KEY_7,
- /* 27 */ KEY_Minus,
- /* 28 */ KEY_8,
- /* 29 */ KEY_0,
- /* 30 */ KEY_RBrace,
- /* 31 */ KEY_O,
- /* 32 */ KEY_U,
- /* 33 */ KEY_LBrace,
- /* 34 */ KEY_I,
- /* 35 */ KEY_P,
- /* 36 */ KEY_Enter,
- /* 37 */ KEY_L,
- /* 38 */ KEY_J,
- /* 39 */ KEY_Quote,
- /* 40 */ KEY_K,
- /* 41 */ KEY_SemiColon,
- /* 42 */ KEY_BSlash,
- /* 43 */ KEY_Comma,
- /* 44 */ KEY_Slash,
- /* 45 */ KEY_N,
- /* 46 */ KEY_M,
- /* 47 */ KEY_Period,
- /* 48 */ KEY_Tab,
- /* 49 */ KEY_Space,
- /* 50 */ KEY_Tilde,
- /* 51 */ KEY_Delete,
- /* 52 */ KEY_AltLang,
- /* 53 */ KEY_Escape,
- /* 54 */ KEY_LCtrl,
- /* 55 */ KEY_Alt,
- /* 56 */ KEY_ShiftL,
- /* 57 */ KEY_CapsLock,
- /* 58 */ KEY_LMeta,
- /* 59 */ KEY_Left,
- /* 60 */ KEY_Right,
- /* 61 */ KEY_Down,
- /* 62 */ KEY_Up,
- /* 63 */ KEY_UNKNOWN, /* Fn */
- /* 64 */ KEY_NOTUSED,
- /* 65 */ KEY_KP_Decimal,
- /* 66 */ KEY_NOTUSED,
- /* 67 */ KEY_KP_Multiply,
- /* 68 */ KEY_NOTUSED,
- /* 69 */ KEY_KP_Plus,
- /* 70 */ KEY_NOTUSED,
- /* 71 */ KEY_UNKNOWN, /* Clear */
- /* 72 */ KEY_NOTUSED,
- /* 73 */ KEY_NOTUSED,
- /* 74 */ KEY_NOTUSED,
- /* 75 */ KEY_KP_Divide,
- /* 76 */ KEY_KP_Enter,
- /* 77 */ KEY_NOTUSED,
- /* 78 */ KEY_KP_Minus,
- /* 79 */ KEY_NOTUSED,
- /* 80 */ KEY_NOTUSED,
- /* 81 */ KEY_KP_Equal, /* Keypad = */
- /* 82 */ KEY_KP_0,
- /* 83 */ KEY_KP_1,
- /* 84 */ KEY_KP_2,
- /* 85 */ KEY_KP_3,
- /* 86 */ KEY_KP_4,
- /* 87 */ KEY_KP_5,
- /* 88 */ KEY_KP_6,
- /* 89 */ KEY_KP_7,
- /* 90 */ KEY_NOTUSED,
- /* 91 */ KEY_KP_8,
- /* 92 */ KEY_KP_9,
- /* 93 */ KEY_NOTUSED,
- /* 94 */ KEY_NOTUSED,
- /* 95 */ KEY_UNKNOWN, /* Keypad , */
- /* 96 */ KEY_F5,
- /* 97 */ KEY_F6,
- /* 98 */ KEY_F7,
- /* 99 */ KEY_F3,
- /* 100 */ KEY_F8,
- /* 101 */ KEY_F9,
- /* 102 */ KEY_NOTUSED,
- /* 103 */ KEY_F11,
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_KP_Enter,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_F10,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_F12,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_Home,
- /* 116 */ KEY_PgUp,
- /* 117 */ KEY_NOTUSED,
- /* 118 */ KEY_F4,
- /* 119 */ KEY_End,
- /* 120 */ KEY_F2,
- /* 121 */ KEY_PgDown,
- /* 122 */ KEY_F1
-};
-#define WS_ADB_MAP_SIZE (sizeof(wsAdbMap)/sizeof(unsigned char))
-
-static
-TransMapRec wsAdb = {
- 0,
- WS_ADB_MAP_SIZE,
- wsAdbMap
-};
-
-static CARD8 wsSunMap[] = {
- /* 0x00 */ KEY_Help,
- /* 0x01 */ KEY_L1, /* stop */
- /* 0x02 */ KEY_AudioLower, /* BrightnessDown / S-VolumeDown */
- /* 0x03 */ KEY_L2, /* again */
- /* 0x04 */ KEY_AudioRaise, /* BridgtnessUp / S-VolumeUp */
- /* 0x05 */ KEY_F1,
- /* 0x06 */ KEY_F2,
- /* 0x07 */ KEY_F10,
- /* 0x08 */ KEY_F3,
- /* 0x09 */ KEY_F11,
- /* 0x0a */ KEY_F4,
- /* 0x0b */ KEY_F12,
- /* 0x0c */ KEY_F5,
- /* 0x0d */ KEY_AltLang,
- /* 0x0e */ KEY_F6,
- /* 0x0f */ KEY_NOTUSED,
- /* 0x10 */ KEY_F7,
- /* 0x11 */ KEY_F8,
- /* 0x12 */ KEY_F9,
- /* 0x13 */ KEY_Alt,
- /* 0x14 */ KEY_Up,
- /* 0x15 */ KEY_Pause,
- /* 0x16 */ KEY_Print,
- /* 0x17 */ KEY_ScrollLock,
- /* 0x18 */ KEY_Left,
- /* 0x19 */ KEY_L3, /* props */
- /* 0x1a */ KEY_L4, /* undo */
- /* 0x1b */ KEY_Down,
- /* 0x1c */ KEY_Right,
- /* 0x1d */ KEY_Escape,
- /* 0x1e */ KEY_1,
- /* 0x1f */ KEY_2,
- /* 0x20 */ KEY_3,
- /* 0x21 */ KEY_4,
- /* 0x22 */ KEY_5,
- /* 0x23 */ KEY_6,
- /* 0x24 */ KEY_7,
- /* 0x25 */ KEY_8,
- /* 0x26 */ KEY_9,
- /* 0x27 */ KEY_0,
- /* 0x28 */ KEY_Minus,
- /* 0x29 */ KEY_Equal,
- /* 0x2a */ KEY_Tilde,
- /* 0x2b */ KEY_BackSpace,
- /* 0x2c */ KEY_Insert,
- /* 0x2d */ KEY_Mute, /* Audio Mute */
- /* 0x2e */ KEY_KP_Divide,
- /* 0x2f */ KEY_KP_Multiply,
- /* 0x30 */ KEY_NOTUSED,
- /* 0x31 */ KEY_L5, /* front */
- /* 0x32 */ KEY_KP_Decimal,
- /* 0x33 */ KEY_L6, /* copy */
- /* 0x34 */ KEY_Home,
- /* 0x35 */ KEY_Tab,
- /* 0x36 */ KEY_Q,
- /* 0x37 */ KEY_W,
- /* 0x38 */ KEY_E,
- /* 0x39 */ KEY_R,
- /* 0x3a */ KEY_T,
- /* 0x3b */ KEY_Y,
- /* 0x3c */ KEY_U,
- /* 0x3d */ KEY_I,
- /* 0x3e */ KEY_O,
- /* 0x3f */ KEY_P,
- /* 0x40 */ KEY_LBrace,
- /* 0x41 */ KEY_RBrace,
- /* 0x42 */ KEY_Delete,
- /* 0x43 */ KEY_Menu, /* compose */
- /* 0x44 */ KEY_KP_7,
- /* 0x45 */ KEY_KP_8,
- /* 0x46 */ KEY_KP_9,
- /* 0x47 */ KEY_KP_Minus,
- /* 0x48 */ KEY_L7, /* open */
- /* 0x49 */ KEY_L8, /* paste */
- /* 0x4a */ KEY_End,
- /* 0x4b */ KEY_NOTUSED,
- /* 0x4c */ KEY_LCtrl,
- /* 0x4d */ KEY_A,
- /* 0x4e */ KEY_S,
- /* 0x4f */ KEY_D,
- /* 0x50 */ KEY_F,
- /* 0x51 */ KEY_G,
- /* 0x52 */ KEY_H,
- /* 0x53 */ KEY_J,
- /* 0x54 */ KEY_K,
- /* 0x55 */ KEY_L,
- /* 0x56 */ KEY_SemiColon,
- /* 0x57 */ KEY_Quote,
- /* 0x58 */ KEY_BSlash,
- /* 0x59 */ KEY_Enter,
- /* 0x5a */ KEY_KP_Enter,
- /* 0x5b */ KEY_KP_4,
- /* 0x5c */ KEY_KP_5,
- /* 0x5d */ KEY_KP_6,
- /* 0x5e */ KEY_KP_0,
- /* 0x5f */ KEY_L9, /* find */
- /* 0x60 */ KEY_PgUp,
- /* 0x61 */ KEY_L10, /* cut */
- /* 0x62 */ KEY_NumLock,
- /* 0x63 */ KEY_ShiftL,
- /* 0x64 */ KEY_Z,
- /* 0x65 */ KEY_X,
- /* 0x66 */ KEY_C,
- /* 0x67 */ KEY_V,
- /* 0x68 */ KEY_B,
- /* 0x69 */ KEY_N,
- /* 0x6a */ KEY_M,
- /* 0x6b */ KEY_Comma,
- /* 0x6c */ KEY_Period,
- /* 0x6d */ KEY_Slash,
- /* 0x6e */ KEY_ShiftR,
- /* 0x6f */ KEY_NOTUSED, /* linefeed */
- /* 0x70 */ KEY_KP_1,
- /* 0x71 */ KEY_KP_2,
- /* 0x72 */ KEY_KP_3,
- /* 0x73 */ KEY_NOTUSED,
- /* 0x74 */ KEY_NOTUSED,
- /* 0x75 */ KEY_NOTUSED,
- /* 0x76 */ KEY_NOTUSED, /* help */
- /* 0x77 */ KEY_CapsLock,
- /* 0x78 */ KEY_LMeta,
- /* 0x79 */ KEY_Space,
- /* 0x7a */ KEY_RMeta,
- /* 0x7b */ KEY_PgDown,
- /* 0x7c */ KEY_Less, /* < > on some keyboards */
- /* 0x7d */ KEY_KP_Plus,
- /* 0x7e */ KEY_NOTUSED,
- /* 0x7f */ KEY_NOTUSED
-};
-#define WS_SUN_MAP_SIZE (sizeof(wsSunMap)/sizeof(unsigned char))
-
-static
-TransMapRec wsSun = {
- 0,
- WS_SUN_MAP_SIZE,
- wsSunMap
-};
-
-#endif /* WSCONS_SUPPORT */
-
-/*ARGSUSED*/
-
-/*
- * KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- KeySym *k;
- int i;
-
-#ifndef __bsdi__
- switch (pKbd->consType) {
-
-#ifdef PCCONS_SUPPORT
- case PCCONS:
-#if defined(__OpenBSD__)
- /*
- * on OpenBSD, the pccons keymap is programmable, too
- */
- {
- pccons_keymap_t keymap[KB_NUM_KEYS];
- if (ioctl(pInfo->fd, CONSOLE_GET_KEYMAP, &keymap) != -1) {
- for (i = 0; i < KB_NUM_KEYS; i++)
- if (pccons_remap[i]) {
- k = map + (pccons_remap[i] << 2);
- switch (keymap[i].type) {
- case KB_ASCII:
- /* For ASCII keys, there is only one char in the keymap */
- k[0] = latin1_to_x[(unsigned char)keymap[i].unshift[0]];
- k[1] = latin1_to_x[(unsigned char)keymap[i].shift[0]];
- k[2] = latin1_to_x[(unsigned char)keymap[i].altgr[0]];
- k[3] = latin1_to_x[(unsigned char)keymap[i].shift_altgr[0]];
- break;
- case KB_SCROLL:
- k[0] = XK_Scroll_Lock;
- goto special;
- case KB_NUM:
- k[0] = XK_Num_Lock;
- goto special;
- case KB_CAPS:
- k[0] = XK_Caps_Lock;
- goto special;
- case KB_SHIFT:
- switch (keymap[i].unshift[0]) {
- case 1:
- /* left shift */
- k[0] = XK_Shift_L;
- break;
- case 2:
- /* right shift */
- k[0] = XK_Shift_R;
- break;
- default:
- k[0] = NoSymbol;
- }
- goto special;
- case KB_CTL:
- k[0] = XK_Control_L;
- goto special;
- case KB_ALT:
- k[0] = XK_Alt_L;
- goto special;
- case KB_FUNC:
- switch (keymap[i].unshift[2]) {
- case 'M':
- k[0] = XK_F1;
- break;
- case 'N':
- k[0] = XK_F2;
- break;
- case 'O':
- k[0] = XK_F3;
- break;
- case 'P':
- k[0] = XK_F4;
- break;
- case 'Q':
- k[0] = XK_F5;
- break;
- case 'R':
- k[0] = XK_F6;
- break;
- case 'S':
- k[0] = XK_F7;
- break;
- case 'T':
- k[0] = XK_F8;
- break;
- case 'U':
- k[0] = XK_F9;
- break;
- case 'V':
- k[0] = XK_F10;
- break;
- case 'W':
- k[0] = XK_F11;
- break;
- case 'X':
- k[0] = XK_F12;
- break;
- default:
- k[0] = NoSymbol;
- break;
- }
- goto special;
- default:
- k[0] = NoSymbol;
- special:
- k[1] = k[2] = k[3] = NoSymbol;
- }
- }
- } else {
- ErrorF("Can't read pccons keymap\n");
- }
- }
-#endif /* __OpenBSD__ */
- break;
-#endif
-
-/*
- * XXX wscons has no GIO_KEYMAP
- */
-#if (defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)) && defined(GIO_KEYMAP)
- case SYSCONS:
- case PCVT:
- {
- keymap_t keymap;
-
- if (ioctl(pInfo->fd, GIO_KEYMAP, &keymap) != -1) {
- for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
- if (remap[i]) {
- k = map + (remap[i] << 2);
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3])
- k[2] = k[3] = NoSymbol;
- }
- }
- }
- break;
-#endif /* SYSCONS || PCVT */
-
- }
-#endif /* !bsdi */
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- pKbd->kbdType = 0;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-
- switch(pKbd->consType) {
-#ifdef SYSCONS_SUPPORT
- case SYSCONS:
- if (pKbd->CustomKeycodes)
- pKbd->scancodeMap = &sysconsCODE;
- else
- pKbd->RemapScanCode = ATScancode;
- break;
-#endif
-#if defined(PCCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case PCCONS:
- case PCVT:
- pKbd->RemapScanCode = ATScancode;
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- if (!pKbd->isConsole) {
- switch (pKbd->wsKbdType) {
- case WSKBD_TYPE_PC_XT:
- case WSKBD_TYPE_PC_AT:
- pKbd->RemapScanCode = ATScancode;
- break;
- case WSKBD_TYPE_USB:
- pKbd->scancodeMap = &wsUsb;
- break;
-#ifdef WSKBD_TYPE_ADB
- case WSKBD_TYPE_ADB:
- pKbd->scancodeMap = &wsAdb;
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN
-#ifdef WSKBD_TYPE_SUN5
- case WSKBD_TYPE_SUN5:
-#endif
- case WSKBD_TYPE_SUN:
- pKbd->scancodeMap = &wsSun;
- break;
-#endif
- default:
- ErrorF("Unknown wskbd type %d\n", pKbd->wsKbdType);
- }
- } else {
- pKbd->RemapScanCode = ATScancode;
- }
- break;
-#endif
- }
- return;
-}
diff --git a/hw/xfree86/os-support/bsd/bsd_bell.c b/hw/xfree86/os-support/bsd/bsd_bell.c
new file mode 100644
index 000000000..60c2ffc8b
--- /dev/null
+++ b/hw/xfree86/os-support/bsd/bsd_bell.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
+ * Copyright 1993 by David Dawes <dawes@xfree86.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of Rich Murphey and David Dawes
+ * not be used in advertising or publicity pertaining to distribution of
+ * the software without specific, written prior permission. Rich Murphey and
+ * David Dawes make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES BE LIABLE FOR
+ * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <termios.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+#ifdef WSCONS_SUPPORT
+#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd)
+#endif
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+#ifdef WSCONS_SUPPORT
+ struct wskbd_bell_data wsb;
+#endif
+
+ if (loudness && pitch)
+ {
+#ifdef PCCONS_SUPPORT
+ int data[2];
+#endif
+
+ switch (xf86Info.consType) {
+
+#ifdef PCCONS_SUPPORT
+ case PCCONS:
+ data[0] = pitch;
+ data[1] = (duration * loudness) / 50;
+ ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
+ break;
+#endif
+#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
+ case SYSCONS:
+ case PCVT:
+ ioctl(xf86Info.consoleFd, KDMKTONE,
+ ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration*loudness/50)<<16));
+ break;
+#endif
+#if defined (WSCONS_SUPPORT)
+ case WSCONS:
+ wsb.which = WSKBD_BELL_DOALL;
+ wsb.pitch = pitch;
+ wsb.period = duration;
+ wsb.volume = loudness;
+ ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL,
+ &wsb);
+ break;
+#endif
+ }
+ }
+}
diff --git a/hw/xfree86/os-support/bsd/bsd_io.c b/hw/xfree86/os-support/bsd/bsd_io.c
deleted file mode 100644
index b433d7ba3..000000000
--- a/hw/xfree86/os-support/bsd/bsd_io.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Rich Murphey and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Rich Murphey and
- * David Dawes make no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES BE LIABLE FOR
- * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XConsortium: bsd_io.c /main/11 1996/10/19 18:06:07 kaleb $ */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <termios.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#ifdef WSCONS_SUPPORT
-#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd)
-#endif
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
-#ifdef WSCONS_SUPPORT
- struct wskbd_bell_data wsb;
-#endif
-
- if (loudness && pitch)
- {
-#ifdef PCCONS_SUPPORT
- int data[2];
-#endif
-
- switch (xf86Info.consType) {
-
-#ifdef PCCONS_SUPPORT
- case PCCONS:
- data[0] = pitch;
- data[1] = (duration * loudness) / 50;
- ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
- break;
-#endif
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration*loudness/50)<<16));
- break;
-#endif
-#if defined (WSCONS_SUPPORT)
- case WSCONS:
- wsb.which = WSKBD_BELL_DOALL;
- wsb.pitch = pitch;
- wsb.period = duration;
- wsb.volume = loudness;
- ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL,
- &wsb);
- break;
-#endif
- }
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
- switch (xf86Info.consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDSETLED, leds);
- break;
-#endif
-#if defined(WSCONS_SUPPORT)
- case WSCONS:
- ioctl(KBD_FD(xf86Info), WSKBDIO_SETLEDS, &leds);
- break;
-#endif
- }
-}
-
-int
-xf86GetKbdLeds()
-{
- int leds = 0;
-
- switch (xf86Info.consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDGETLED, &leds);
- break;
-#endif
-#if defined(WSCONS_SUPPORT)
- case WSCONS:
- ioctl(KBD_FD(xf86Info), WSKBDIO_GETLEDS, &leds);
- break;
-#endif
- }
- return(leds);
-}
-
-void
-xf86SetKbdRepeat(char rad)
-{
- switch (xf86Info.consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDSETRAD, rad);
- break;
-#endif
- }
-}
-
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
-static struct termios kbdtty;
-#endif
-
-void
-xf86KbdInit()
-{
- switch (xf86Info.consType) {
-
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case PCCONS:
- case SYSCONS:
- case PCVT:
- tcgetattr(xf86Info.consoleFd, &kbdtty);
- break;
-#endif
-#if defined WSCONS_SUPPORT
- case WSCONS:
- if (xf86Info.kbdFd != -1)
- xf86FlushInput(xf86Info.kbdFd);
- else
- tcgetattr(xf86Info.consoleFd, &kbdtty);
- break;
-#endif
- }
-}
-
-int
-xf86KbdOn()
-{
- struct termios nTty;
-#ifdef WSCONS_SUPPORT
- int option;
-#endif
-
-
- switch (xf86Info.consType) {
-
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
- case SYSCONS:
- case PCCONS:
- case PCVT:
- nTty = kbdtty;
- nTty.c_iflag = IGNPAR | IGNBRK;
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
-
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
-#endif
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- if (xf86Info.kbdFd == -1) {
- nTty = kbdtty;
- nTty.c_iflag = IGNPAR | IGNBRK;
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
- option = WSKBD_RAW;
- if (ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE,
- &option) == -1)
- FatalError("can't switch keyboard to raw mode. "
- "Enable support for it in the kernel\n"
- "or use for example:\n\n"
- "Option \"Protocol\" \"wskbd\"\n"
- "Option \"Device\" \"/dev/wskbd0\"\n"
- "\nin your XF86Config(5) file\n");
- } else {
- return xf86Info.kbdFd;
- }
-#endif
- }
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff()
-{
-#ifdef WSCONS_SUPPORT
- int option;
-#endif
-
- switch (xf86Info.consType) {
-
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_XLATE);
- /* FALL THROUGH */
-#endif
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
- case PCCONS:
- tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- if (xf86Info.kbdFd != -1) {
- return xf86Info.kbdFd;
- } else {
- option = WSKBD_TRANSLATED;
- ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
- }
- break;
-#endif
- }
- return(xf86Info.consoleFd);
-}
-
-#ifdef WSCONS_SUPPORT
-
-#define NUMEVENTS 64
-
-void
-xf86WSKbdEvents(void)
-{
- static struct wscons_event events[NUMEVENTS];
- int n, i;
-
- n = read(xf86Info.kbdFd, events, sizeof events);
- if (n <= 0)
- return;
- n /= sizeof(struct wscons_event);
- for (i = 0; i < n; i++)
- xf86PostWSKbdEvent(&events[i]);
-}
-
-#endif /* WSCONS_SUPPORT */
-
-
diff --git a/hw/xfree86/os-support/bsd/bsd_kbd.c b/hw/xfree86/os-support/bsd/bsd_kbd.c
deleted file mode 100644
index 65d577eb8..000000000
--- a/hw/xfree86/os-support/bsd/bsd_kbd.c
+++ /dev/null
@@ -1,572 +0,0 @@
-
-/*
- * Copyright (c) 2002 by The XFree86 Project, Inc.
- * Author: Ivan Pascal.
- *
- * Based on the code from bsd_io.c which is
- * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <termios.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "bsd_kbd.h"
-
-extern Bool VTSwitchEnabled;
-#ifdef USE_VT_SYSREQ
-extern Bool VTSysreqToggle;
-#endif
-
-static KbdProtocolRec protocols[] = {
- {"standard", PROT_STD },
-#ifdef WSCONS_SUPPORT
- {"wskbd", PROT_WSCONS },
-#endif
- { NULL, PROT_UNKNOWN_KBD }
-};
-
-typedef struct {
- struct termios kbdtty;
-} BsdKbdPrivRec, *BsdKbdPrivPtr;
-
-static
-int KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- switch (pKbd->consType) {
-#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT)
- case PCCONS:
- case SYSCONS:
- case PCVT:
-#if defined WSCONS_SUPPORT
- case WSCONS:
-#endif
- tcgetattr(pInfo->fd, &(priv->kbdtty));
-#endif
- break;
- }
- }
-
- return Success;
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int real_leds = 0;
-
-#ifdef LED_CAP
- if (leds & XLED1) real_leds |= LED_CAP;
-#endif
-#ifdef LED_NUM
- if (leds & XLED2) real_leds |= LED_NUM;
-#endif
-#ifdef LED_SCR
- if (leds & XLED3) real_leds |= LED_SCR;
- if (leds & XLED4) real_leds |= LED_SCR;
-#endif
-
- switch (pKbd->consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDSETLED, real_leds);
- break;
-#endif
-#if defined(WSCONS_SUPPORT)
- case WSCONS:
- ioctl(pInfo->fd, WSKBDIO_SETLEDS, &real_leds);
- break;
-#endif
- }
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int leds = 0, real_leds = 0;
-
- switch (pKbd->consType) {
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDGETLED, &real_leds);
- break;
-#endif
-#if defined(WSCONS_SUPPORT)
- case WSCONS:
- ioctl(pInfo->fd, WSKBDIO_GETLEDS, &real_leds);
- break;
-#endif
- }
-
-#ifdef LED_CAP
- if (real_leds & LED_CAP) leds |= XLED1;
-#endif
-#ifdef LED_NUM
- if (real_leds & LED_NUM) leds |= XLED2;
-#endif
-#ifdef LED_SCR
- if (real_leds & LED_SCR) leds |= XLED3;
-#endif
-
- return(leds);
-}
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- switch (pKbd->consType) {
-
- case PCCONS:
- break;
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDSETRAD, rad);
- break;
-#endif
- }
-}
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private;
- struct termios nTty;
-#endif
-#ifdef WSCONS_SUPPORT
- int option;
-#endif
-
- if (pKbd->isConsole) {
- switch (pKbd->consType) {
-
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
- case SYSCONS:
- case PCCONS:
- case PCVT:
-#ifdef WSCONS_SUPPORT
- case WSCONS:
-#endif
- nTty = priv->kbdtty;
- nTty.c_iflag = IGNPAR | IGNBRK;
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- if (tcsetattr(pInfo->fd, TCSANOW, &nTty) < 0) {
- xf86Msg(X_ERROR, "KbdOn: tcsetattr: %s\n",
- strerror(errno));
- }
- break;
-#endif
- }
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) || defined (WSCONS_SUPPORT)
- switch (pKbd->consType) {
- case SYSCONS:
- case PCVT:
-#ifdef K_CODE
- if (pKbd->CustomKeycodes)
- ioctl(pInfo->fd, KDSKBMODE, K_CODE);
- else
- ioctl(pInfo->fd, KDSKBMODE, K_RAW);
-#else
- ioctl(pInfo->fd, KDSKBMODE, K_RAW);
-#endif
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- option = WSKBD_RAW;
- if (ioctl(pInfo->fd, WSKBDIO_SETMODE, &option) == -1) {
- FatalError("can't switch keyboard to raw mode. "
- "Enable support for it in the kernel\n"
- "or use for example:\n\n"
- "Option \"Protocol\" \"wskbd\"\n"
- "Option \"Device\" \"/dev/wskbd0\"\n"
- "\nin your xorg.conf(5) file\n");
- }
- break;
-#endif
- }
- }
- return Success;
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- BsdKbdPrivPtr priv = (BsdKbdPrivPtr) pKbd->private;
-#ifdef WSCONS_SUPPORT
- int option;
-#endif
-
- if (pKbd->isConsole) {
- switch (pKbd->consType) {
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDSKBMODE, K_XLATE);
- /* FALL THROUGH */
-#endif
-#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
- case PCCONS:
- tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty));
- break;
-#endif
-#ifdef WSCONS_SUPPORT
- case WSCONS:
- option = WSKBD_TRANSLATED;
- ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option);
- tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty));
- break;
-#endif
- }
- }
- return Success;
-}
-
-static void
-SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-#ifdef WSCONS_SUPPORT
- struct wskbd_bell_data wsb;
-#endif
-
- if (loudness && pitch) {
- switch (pKbd->consType) {
-#ifdef PCCONS_SUPPORT
- case PCCONS:
- { int data[2];
- data[0] = pitch;
- data[1] = (duration * loudness) / 50;
- ioctl(pInfo->fd, CONSOLE_X_BELL, data);
- break;
- }
-#endif
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- case SYSCONS:
- case PCVT:
- ioctl(pInfo->fd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration*loudness/50)<<16));
- break;
-#endif
-#if defined (WSCONS_SUPPORT)
- case WSCONS:
- wsb.which = WSKBD_BELL_DOALL;
- wsb.pitch = pitch;
- wsb.period = duration;
- wsb.volume = loudness;
- ioctl(pInfo->fd, WSKBDIO_COMPLEXBELL, &wsb);
- break;
-#endif
- }
- }
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static
-Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
-#ifdef VT_ACTIVATE
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- return TRUE;
- }
-#endif
- case KEY_F11:
- case KEY_F12:
-#ifdef VT_ACTIVATE
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- return TRUE;
- }
-#endif
- }
- }
- }
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (VTSysreqToggle && down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
- case KEY_SysReqest:
- if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down)
- VTSysreqToggle = TRUE;
- break;
- default:
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- if (VTSysreqToggle)
- VTSysreqToggle = FALSE;
- }
- }
-#endif /* USE_VT_SYSREQ */
-
- return FALSE;
-}
-
-static void
-stdReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- unsigned char rBuf[64];
- int nBytes, i;
- if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) {
- for (i = 0; i < nBytes; i++)
- pKbd->PostEvent(pInfo, rBuf[i] & 0x7f,
- rBuf[i] & 0x80 ? FALSE : TRUE);
- }
-}
-
-#ifdef WSCONS_SUPPORT
-
-static void
-WSReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- struct wscons_event events[64];
- int type;
- int blocked, n, i;
-
- if ((n = read( pInfo->fd, events, sizeof(events))) > 0) {
- n /= sizeof(struct wscons_event);
- for (i = 0; i < n; i++) {
- type = events[i].type;
- if (type == WSCONS_EVENT_KEY_UP || type == WSCONS_EVENT_KEY_DOWN) {
- /* It seems better to block SIGIO there */
- blocked = xf86BlockSIGIO();
- pKbd->PostEvent(pInfo, (unsigned int)(events[i].value),
- type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE);
- xf86UnblockSIGIO(blocked);
- }
- } /* for */
- }
-}
-
-static void
-printWsType(char *type, char *devname)
-{
- xf86Msg(X_PROBED, "%s: Keyboard type: %s\n", type, devname);
-}
-#endif
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- KbdProtocolId prot = PROT_UNKNOWN_KBD;
- char *s;
-
- s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
- for (i = 0; protocols[i].name; i++) {
- if (xf86NameCmp(s, protocols[i].name) == 0) {
- prot = protocols[i].id;
- break;
- }
- }
-
- switch (prot) {
- case PROT_STD:
- pInfo->read_input = stdReadInput;
- break;
-#ifdef WSCONS_SUPPORT
- case PROT_WSCONS:
- pInfo->read_input = WSReadInput;
- break;
-#endif
- default:
- xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
- xfree(s);
- return FALSE;
- }
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
- xfree(s);
-
- s = xf86SetStrOption(pInfo->options, "Device", NULL);
- if (s == NULL) {
- if (prot == PROT_WSCONS) {
- xf86Msg(X_ERROR,"A \"device\" option is required with"
- " the \"wskbd\" keyboard protocol\n");
- return FALSE;
- } else {
- pInfo->fd = xf86Info.consoleFd;
- pKbd->isConsole = TRUE;
- pKbd->consType = xf86Info.consType;
- }
- } else {
- pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
- if (pInfo->fd == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
- xfree(s);
- return FALSE;
- }
- pKbd->isConsole = FALSE;
- pKbd->consType = xf86Info.consType;
- xfree(s);
- }
-
-#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
- if (pKbd->isConsole &&
- ((pKbd->consType == SYSCONS) || (pKbd->consType == PCVT)))
- pKbd->vtSwitchSupported = TRUE;
-#endif
-
-#ifdef WSCONS_SUPPORT
- if( prot == PROT_WSCONS) {
- pKbd->consType = WSCONS;
- /* Find out keyboard type */
- if (ioctl(pInfo->fd, WSKBDIO_GTYPE, &(pKbd->wsKbdType)) == -1) {
- xf86Msg(X_ERROR, "%s: cannot get keyboard type", pInfo->name);
- close(pInfo->fd);
- return FALSE;
- }
- switch (pKbd->wsKbdType) {
- case WSKBD_TYPE_PC_XT:
- printWsType("XT", pInfo->name);
- break;
- case WSKBD_TYPE_PC_AT:
- printWsType("AT", pInfo->name);
- break;
- case WSKBD_TYPE_USB:
- printWsType("USB", pInfo->name);
- break;
-#ifdef WSKBD_TYPE_ADB
- case WSKBD_TYPE_ADB:
- printWsType("ADB", pInfo->name);
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN
- case WSKBD_TYPE_SUN:
- printWsType("Sun", pInfo->name);
- break;
-#endif
-#ifdef WSKBD_TYPE_SUN5
- case WSKBD_TYPE_SUN5:
- xf86Msg(X_PROBED, "Keyboard type: Sun5\n");
- break;
-#endif
- default:
- xf86Msg(X_ERROR, "%s: Unsupported wskbd type \"%d\"",
- pInfo->name, pKbd->wsKbdType);
- close(pInfo->fd);
- return FALSE;
- }
- }
-#endif
- return TRUE;
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
-
- pKbd->RemapScanCode = NULL;
- pKbd->GetSpecialKey = NULL;
-
- pKbd->OpenKeyboard = OpenKeyboard;
- pKbd->vtSwitchSupported = FALSE;
- pKbd->CustomKeycodes = FALSE;
-
- pKbd->private = xcalloc(sizeof(BsdKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- }
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/bsd/bsd_kbd.h b/hw/xfree86/os-support/bsd/bsd_kbd.h
deleted file mode 100644
index b2ae179e1..000000000
--- a/hw/xfree86/os-support/bsd/bsd_kbd.h
+++ /dev/null
@@ -1,4 +0,0 @@
-
-extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
- CARD8 *pModMap);
-
diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c
index ea6ac4ec0..b80371d83 100644
--- a/hw/xfree86/os-support/bus/Pci.c
+++ b/hw/xfree86/os-support/bus/Pci.c
@@ -20,6 +20,8 @@
* pciSetBitsByte() - Write an 8 bit value against a mask
* pciTag() - Return tag for a given PCI bus, device, &
* function
+ * pciDomTag() - Return tag for a given PCI domain, bus,
+ * device & function
* pciBusAddrToHostAddr() - Convert a PCI address to a host address
* pciHostAddrToBusAddr() - Convert a host address to a PCI address
* pciGetBaseSize() - Returns the number of bits in a PCI base
@@ -614,6 +616,12 @@ pciTag(int busnum, int devnum, int funcnum)
return(PCI_MAKE_TAG(busnum,devnum,funcnum));
}
+_X_EXPORT PCITAG
+pciDomTag(int domnum, int busnum, int devnum, int funcnum)
+{
+ return(PCI_MAKE_TAG(PCI_MAKE_BUS(domnum,busnum),devnum,funcnum));
+}
+
#if defined(PCI_MFDEV_SUPPORT)
Bool
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 0f1af2086..7cc882d36 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -119,7 +119,7 @@
/* by xf86scanpci */
#if defined(sun) && defined(SVR4) && defined(sparc)
# define MAX_PCI_BUSES 4096 /* Max number of PCI buses */
-#elif defined(__alpha__) && defined (linux)
+#elif (defined(__alpha__) || defined(__ia64__)) && defined (linux)
# define MAX_PCI_DOMAINS 512
# define PCI_DOM_MASK 0x01fful
# define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */
@@ -258,7 +258,7 @@
# endif
#elif defined(__ia64__)
# if defined(linux)
-# define ARCH_PCI_INIT linuxPciInit
+# define ARCH_PCI_INIT ia64linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# elif defined(FreeBSD)
# define ARCH_PCI_INIT freebsdPciInit
diff --git a/hw/xfree86/os-support/bus/altixPCI.c b/hw/xfree86/os-support/bus/altixPCI.c
index 010f6619a..7a72ec6e7 100644
--- a/hw/xfree86/os-support/bus/altixPCI.c
+++ b/hw/xfree86/os-support/bus/altixPCI.c
@@ -41,13 +41,14 @@ static pciDevice *get_dev_on_bus(unsigned int segnum, unsigned int busnum)
static void get_bridge_info(pciBusInfo_t *bus_info, pciDevice *pdev)
{
unsigned int parent_segnum, segnum = PCI_DOM_FROM_TAG(pdev->tag);
- unsigned int parent_busnum, busnum = pdev->busnum;
+ unsigned int parent_busnum, parent_nodombus, busnum = pdev->busnum;
+ unsigned int nodombus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(pdev->tag));
char bridge_path[] = "/sys/class/pci_bus/0000:00/bridge";
char bridge_target[] = "../../../devices/pci0000:00";
/* Path to this device's bridge */
sprintf(bridge_path, "/sys/class/pci_bus/%04x:%02x/bridge", segnum,
- busnum);
+ nodombus);
if (readlink(bridge_path, bridge_target, strlen(bridge_target)) < 0) {
perror("failed to dereference bridge link");
@@ -56,7 +57,9 @@ static void get_bridge_info(pciBusInfo_t *bus_info, pciDevice *pdev)
}
sscanf(bridge_target, "../../../devices/pci%04x:%02x", &parent_segnum,
- &parent_busnum);
+ &parent_nodombus);
+
+ parent_busnum = PCI_MAKE_BUS(parent_segnum, parent_nodombus);
/*
* If there's no bridge or the bridge points to the device, use
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index 7d220d08a..15fc2b8c7 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -54,6 +54,7 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "Pci.h"
+#include <dirent.h>
/*
* linux platform specific PCI access functions -- using /proc/bus/pci
@@ -73,6 +74,7 @@ static void linuxPciCfgWriteByte(PCITAG tag, int off, CARD8 val);
static CARD16 linuxPciCfgReadWord(PCITAG tag, int off);
static void linuxPciCfgWriteWord(PCITAG tag, int off, CARD16 val);
static int linuxPciHandleBIOS(PCITAG Tag, int basereg, unsigned char *buf, int len);
+static Bool linuxDomainSupport(void);
static pciBusFuncs_t linuxFuncs0 = {
/* pciReadLong */ linuxPciCfgRead,
@@ -116,6 +118,8 @@ static pciBusInfo_t linuxPci0 = {
/* from lnx_pci.c. */
extern int lnxPciInit(void);
+static Bool domain_support = FALSE;
+
void
linuxPciInit()
{
@@ -126,6 +130,9 @@ linuxPciInit()
we'll need a fallback for 2.0 kernels here */
return;
}
+#ifndef INCLUDE_XF86_NO_DOMAIN
+ domain_support = linuxDomainSupport();
+#endif
pciNumBuses = 1;
pciBusInfo[0] = &linuxPci0;
pciFindFirstFP = pciGenFindFirst;
@@ -137,13 +144,14 @@ linuxPciInit()
static int
linuxPciOpenFile(PCITAG tag, Bool write)
{
- static int lbus,ldev,lfunc,fd = -1,is_write = 0;
- int bus, dev, func;
+ static int ldomain, lbus,ldev,lfunc,fd = -1,is_write = 0;
+ int domain, bus, dev, func;
char file[64];
struct stat ignored;
static int is26 = -1;
- bus = PCI_BUS_FROM_TAG(tag);
+ domain = PCI_DOM_FROM_TAG(tag);
+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag));
dev = PCI_DEV_FROM_TAG(tag);
func = PCI_FUNC_FROM_TAG(tag);
if (is26 == -1) {
@@ -153,30 +161,41 @@ linuxPciOpenFile(PCITAG tag, Bool write)
is26 = 1;
}
- if (fd == -1 || (write && (!is_write))
+ if (!domain_support && domain > 0)
+ return -1;
+
+ if (fd == -1 || (write && (!is_write)) || domain != ldomain
|| bus != lbus || dev != ldev || func != lfunc) {
- if (fd != -1)
+ if (fd != -1) {
close(fd);
+ fd = -1;
+ }
if (is26)
- sprintf(file,"/sys/bus/pci/devices/0000:%02x:%02x.%01x/config",
- bus, dev, func);
+ sprintf(file,"/sys/bus/pci/devices/%04x:%02x:%02x.%01x/config",
+ domain, bus, dev, func);
else {
if (bus < 256) {
- sprintf(file,"/proc/bus/pci/%02x",bus);
- if (stat(file, &ignored) < 0)
- sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x",
- bus, dev, func);
- else
- sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
- bus, dev, func);
+ sprintf(file, "/proc/bus/pci/%04x:%02x", domain, bus);
+ if (stat(file, &ignored) < 0) {
+ if (domain == 0)
+ sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
+ bus, dev, func);
+ else
+ goto bail;
+ } else
+ sprintf(file, "/proc/bus/pci/%04x:%02x/%02x.%1x",
+ domain, bus, dev, func);
} else {
- sprintf(file,"/proc/bus/pci/%04x",bus);
- if (stat(file, &ignored) < 0)
- sprintf(file, "/proc/bus/pci/0000:%04x/%02x.%1x",
- bus, dev, func);
- else
- sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
- bus, dev, func);
+ sprintf(file, "/proc/bus/pci/%04x:%04x", domain, bus);
+ if (stat(file, &ignored) < 0) {
+ if (domain == 0)
+ sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
+ bus, dev, func);
+ else
+ goto bail;
+ } else
+ sprintf(file, "/proc/bus/pci/%04x:%04x/%02x.%1x",
+ domain, bus, dev, func);
}
}
if (write) {
@@ -191,7 +210,8 @@ linuxPciOpenFile(PCITAG tag, Bool write)
fd = open(file,O_RDONLY);
is_write = FALSE;
}
-
+ bail:
+ ldomain = domain;
lbus = bus;
ldev = dev;
lfunc = func;
@@ -489,6 +509,32 @@ linuxGetSizes(PCITAG Tag, unsigned long *io_size, unsigned long *mem_size)
*mem_size = sizes->mem_size;
}
+static Bool
+linuxDomainSupport(void)
+{
+ DIR *dir;
+ struct dirent *dirent;
+ char *end;
+
+ if (!(dir = opendir("/proc/bus/pci")))
+ return FALSE;
+ while (1) {
+ if (!(dirent = readdir(dir)))
+ return FALSE;
+ strtol(dirent->d_name,&end,16);
+ /* entry of the form xx or xxxx : x=[0..f] no domain */
+ if (*end == '\0')
+ return FALSE;
+ else if (*end == ':') {
+ /* ':' found immediately after: verify for xxxx:xx or xxxx:xxxx */
+ strtol(end + 1,&end,16);
+ if (*end == '\0')
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
_X_EXPORT int
xf86GetPciDomain(PCITAG Tag)
{
@@ -524,9 +570,7 @@ linuxMapPci(int ScreenNum, int Flags, PCITAG Tag,
xf86InitVidMem();
- pPCI = xf86GetPciHostConfigFromTag(Tag);
-
- if (((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0) ||
+ if (((fd = linuxPciOpenFile(Tag ,FALSE)) < 0) ||
(ioctl(fd, mmap_ioctl, 0) < 0))
break;
@@ -583,7 +627,6 @@ linuxMapPci(int ScreenNum, int Flags, PCITAG Tag,
#define MAX_DOMAINS 257
static pointer DomainMmappedIO[MAX_DOMAINS];
-static pointer DomainMmappedMem[MAX_DOMAINS];
static int
linuxOpenLegacy(PCITAG Tag, char *name)
@@ -641,6 +684,7 @@ xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
{
int domain = xf86GetPciDomain(Tag);
int fd;
+ pointer addr;
/*
* We use /proc/bus/pci on non-legacy addresses or if the Linux sysfs
@@ -654,20 +698,14 @@ xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
return linuxMapPci(ScreenNum, Flags, Tag, Base, Size,
PCIIOC_MMAP_IS_MEM);
-
- /* If we haven't already mapped this legacy space, try to. */
- if (!DomainMmappedMem[domain]) {
- DomainMmappedMem[domain] = mmap(NULL, 1024*1024, PROT_READ|PROT_WRITE,
- MAP_SHARED, fd, 0);
- if (DomainMmappedMem[domain] == MAP_FAILED) {
- close(fd);
- perror("mmap failure");
- FatalError("xf86MapDomainMem(): mmap() failure\n");
- }
+ addr = mmap(NULL, Size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, Base);
+ if (addr == MAP_FAILED) {
+ close (fd);
+ perror("mmap failure");
+ FatalError("xf86MapDomainMem(): mmap() failure\n");
}
-
close(fd);
- return (pointer)((char *)DomainMmappedMem[domain] + Base);
+ return addr;
}
/*
@@ -731,7 +769,7 @@ xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf)
struct stat st;
dom = PCI_DOM_FROM_TAG(Tag);
- bus = PCI_BUS_FROM_TAG(Tag);
+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag));
dev = PCI_DEV_FROM_TAG(Tag);
func = PCI_FUNC_FROM_TAG(Tag);
sprintf(file, "/sys/devices/pci%04x:%02x/%04x:%02x:%02x.%1x/rom",
@@ -910,7 +948,7 @@ int linuxPciHandleBIOS(PCITAG Tag, int basereg, unsigned char *buf, int len)
int sofar = 0;
dom = PCI_DOM_FROM_TAG(Tag);
- bus = PCI_BUS_FROM_TAG(Tag);
+ bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag));
dev = PCI_DEV_FROM_TAG(Tag);
func = PCI_FUNC_FROM_TAG(Tag);
sprintf(file, "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/rom",
@@ -940,3 +978,106 @@ int linuxPciHandleBIOS(PCITAG Tag, int basereg, unsigned char *buf, int len)
}
return 0;
}
+
+#ifdef __ia64__
+static PCITAG ia64linuxPciFindFirst(void);
+static PCITAG ia64linuxPciFindNext(void);
+
+void
+ia64linuxPciInit()
+{
+ struct stat st;
+
+ linuxPciInit();
+
+ if (!stat("/proc/sgi_sn/licenseID", &st) && pciNumBuses) {
+ /* Be a little paranoid here and only use this code for Altix systems.
+ * It is generic, so it should work on any system, but depends on
+ * /proc/bus/pci entries for each domain/bus combination. Altix is
+ * guaranteed a recent enough kernel to have them.
+ */
+ pciFindFirstFP = ia64linuxPciFindFirst;
+ pciFindNextFP = ia64linuxPciFindNext;
+ }
+}
+
+static DIR *busdomdir;
+static DIR *devdir;
+
+static PCITAG
+ia64linuxPciFindFirst(void)
+{
+ busdomdir = opendir("/proc/bus/pci");
+ devdir = NULL;
+
+ return ia64linuxPciFindNext();
+}
+
+static struct dirent *getnextbus(int *domain, int *bus)
+{
+ struct dirent *entry;
+ int dombus;
+
+ for (;;) {
+ entry = readdir(busdomdir);
+ if (entry == NULL) {
+ *domain = 0;
+ *bus = 0;
+ closedir(busdomdir);
+ return NULL;
+ }
+ if (sscanf(entry->d_name, "%04x:%02x", domain, bus) != 2)
+ continue;
+ dombus = PCI_MAKE_BUS(*domain, *bus);
+
+ if (pciNumBuses <= dombus)
+ pciNumBuses = dombus + 1;
+ if (!pciBusInfo[dombus]) {
+ pciBusInfo[dombus] = xnfalloc(sizeof(pciBusInfo_t));
+ *pciBusInfo[dombus] = *pciBusInfo[0];
+ }
+
+ return entry;
+ }
+}
+
+static PCITAG
+ia64linuxPciFindNext(void)
+{
+ struct dirent *entry;
+ char file[40];
+ static int bus, dev, func, domain;
+ PCITAG pciDeviceTag;
+ CARD32 devid;
+
+ for (;;) {
+ if (devdir == NULL) {
+ entry = getnextbus(&domain, &bus);
+ if (!entry)
+ return PCI_NOT_FOUND;
+ snprintf(file, 40, "/proc/bus/pci/%s", entry->d_name);
+ devdir = opendir(file);
+ if (!devdir)
+ return PCI_NOT_FOUND;
+
+ }
+
+ entry = readdir(devdir);
+
+ if (entry == NULL) {
+ closedir(devdir);
+ devdir = NULL;
+ continue;
+ }
+
+ if (sscanf(entry->d_name, "%02x . %01x", &dev, &func) == 2) {
+ pciDeviceTag = PCI_MAKE_TAG(PCI_MAKE_BUS(domain, bus), dev, func);
+ devid = pciReadLong(pciDeviceTag, PCI_ID_REG);
+ if ((devid & pciDevidMask) == pciDevid)
+ /* Yes - Return it. Otherwise, next device */
+ return pciDeviceTag;
+ }
+ }
+}
+#endif
+
diff --git a/hw/xfree86/os-support/bus/xf86Pci.h b/hw/xfree86/os-support/bus/xf86Pci.h
index fdb88e832..c444a0cd1 100644
--- a/hw/xfree86/os-support/bus/xf86Pci.h
+++ b/hw/xfree86/os-support/bus/xf86Pci.h
@@ -766,6 +766,7 @@ void pciSetBitsByte(PCITAG tag, int offset, CARD8 mask, CARD8 val);
ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
PCITAG pciTag(int busnum, int devnum, int funcnum);
+PCITAG pciDomTag(int domnum, int busnum, int devnum, int funcnum);
int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min);
CARD32 pciCheckForBrokenBase(PCITAG tag,int basereg);
pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag,
diff --git a/hw/xfree86/os-support/hurd/Makefile.am b/hw/xfree86/os-support/hurd/Makefile.am
index a05087619..b80fdde99 100644
--- a/hw/xfree86/os-support/hurd/Makefile.am
+++ b/hw/xfree86/os-support/hurd/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libhurd.la
-libhurd_la_SOURCES = hurd_init.c hurd_mmap.c \
+libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
hurd_mouse.c hurd_video.c \
$(srcdir)/../shared/VTsw_noop.c \
$(srcdir)/../shared/posix_tty.c \
@@ -12,6 +12,6 @@ libhurd_la_SOURCES = hurd_init.c hurd_mmap.c \
$(srcdir)/../shared/kmod_noop.c \
$(srcdir)/../shared/agp_noop.c
-AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) @SERVER_DEFINES@ @LOADER_DEFINES@
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS)
INCLUDES = $(XORG_INCS)
diff --git a/hw/xfree86/os-support/hurd/hurd_bell.c b/hw/xfree86/os-support/hurd/hurd_bell.c
new file mode 100644
index 000000000..2726611bb
--- /dev/null
+++ b/hw/xfree86/os-support/hurd/hurd_bell.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that this copyright notice and this permission notice appear in
+ * supporting electronic documentation.
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR AUTHORS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ return;
+}
diff --git a/hw/xfree86/os-support/hurd/hurd_mouse.c b/hw/xfree86/os-support/hurd/hurd_mouse.c
index e7a2da84d..ccc08a248 100644
--- a/hw/xfree86/os-support/hurd/hurd_mouse.c
+++ b/hw/xfree86/os-support/hurd/hurd_mouse.c
@@ -77,85 +77,6 @@ typedef struct {
#define NUMEVENTS 64
/*
- * OsMouseProc --
- * Handle the initialization, etc. of a mouse
- */
-static int
-OsMouseProc(DeviceIntPtr pPointer, int what)
-{
- InputInfoPtr pInfo;
- MouseDevPtr pMse;
- unsigned char map[MSE_MAXBUTTONS + 1];
- int nbuttons;
-
- pInfo = pPointer->public.devicePrivate;
- pMse = pInfo->private;
- pMse->device = pPointer;
-
- switch (what) {
- case DEVICE_INIT:
- pPointer->public.on = FALSE;
-
- for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons)
- map[nbuttons + 1] = nbuttons + 1;
-
- InitPointerDeviceStruct((DevicePtr)pPointer,
- map,
- min(pMse->buttons, MSE_MAXBUTTONS),
- miPointerGetMotionEvents,
- pMse->Ctrl,
- miPointerGetMotionBufferSize());
-
- /* X valuator */
- xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
- xf86InitValuatorDefaults(pPointer, 0);
- /* Y valuator */
- xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
- xf86InitValuatorDefaults(pPointer, 1);
- xf86MotionHistoryAllocate(pInfo);
- break;
-
- case DEVICE_ON:
- pInfo->fd = xf86OpenSerial(pInfo->options);
- if (pInfo->fd == -1)
- xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
- else {
- pMse->buffer = XisbNew(pInfo->fd,
- NUMEVENTS * sizeof(kd_event));
- if (!pMse->buffer) {
- xfree(pMse);
- xf86CloseSerial(pInfo->fd);
- pInfo->fd = -1;
- } else {
- xf86FlushInput(pInfo->fd);
- AddEnabledDevice(pInfo->fd);
- }
- }
- pMse->lastButtons = 0;
- pMse->lastMappedButtons = 0;
- pMse->emulateState = 0;
- pPointer->public.on = TRUE;
- break;
-
- case DEVICE_OFF:
- case DEVICE_CLOSE:
- if (pInfo->fd != -1) {
- RemoveEnabledDevice(pInfo->fd);
- if (pMse->buffer) {
- XisbFree(pMse->buffer);
- pMse->buffer = NULL;
- }
- xf86CloseSerial(pInfo->fd);
- pInfo->fd = -1;
- }
- pPointer->public.on = FALSE;
- usleep(300000);
- break;
- }
- return Success;
-}
-
-/*
* OsMouseReadInput --
* Get some events from our queue. Process all outstanding events now.
*/
@@ -240,7 +161,6 @@ OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
pMse->CommonOptions(pInfo);
/* Setup the local procs. */
- pInfo->device_control = OsMouseProc;
pInfo->read_input = OsMouseReadInput;
pInfo->flags |= XI86_CONFIGURED;
diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am
index 6fdc1bc42..caf600787 100644
--- a/hw/xfree86/os-support/linux/Makefile.am
+++ b/hw/xfree86/os-support/linux/Makefile.am
@@ -1,7 +1,9 @@
noinst_LTLIBRARIES = liblinux.la
if LINUX_IA64
-PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c
+PLATFORM_PCI_SUPPORT = $(srcdir)/lnx_ia64.c $(srcdir)/../shared/ia64Pci.c
+PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset
+PLATFORM_INCLUDES = -I$(srcdir)/../shared
endif
if LINUX_ALPHA
PLATFORM_PCI_SUPPORT = lnx_ev56.c \
@@ -10,44 +12,39 @@ PLATFORM_PCI_SUPPORT = lnx_ev56.c \
endif
if LNXACPI
-ACPI_SOURCES = lnx_acpi.c lnx_apm.c
+ACPI_SRCS = lnx_acpi.c lnx_apm.c
XORG_CFLAGS += -DHAVE_ACPI
endif
if LNXAPM
-APM_SOURCES = lnx_apm.c
+APM_SRCS = lnx_apm.c
XORG_CFLAGS += -DHAVE_APM
endif
-liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_io.c lnx_kbd.c lnx_mouse.c \
- lnx_pci.c lnx_agp.c lnx_kmod.c lnx_KbdMap.c \
+liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_mouse.c \
+ lnx_pci.c lnx_agp.c lnx_kmod.c lnx_bell.c \
$(srcdir)/../shared/bios_mmap.c \
$(srcdir)/../shared/VTsw_usl.c \
- $(srcdir)/../shared/std_kbdEv.c \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/vidmem.c \
$(srcdir)/../shared/sigio.c \
$(srcdir)/../shared/stdResource.c \
$(srcdir)/../shared/libc_wrapper.c \
- $(srcdir)/../shared/at_scancode.c \
- $(ACPI_SOURCES) \
- $(APM_SOURCES) \
+ $(ACPI_SRCS) \
+ $(APM_SRCS) \
$(PLATFORM_PCI_SUPPORT)
-AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS)
+AM_CFLAGS = -DUSESTDRES -DHAVE_SYSV_IPC $(XORG_CFLAGS) $(PLATFORM_DEFINES)
-INCLUDES = $(XORG_INCS) -I/usr/include/drm # FIXME this last part is crack
+INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) -I/usr/include/drm # FIXME this last part is crack
# FIXME: These need to be added to the build
-LNX_EXTRA_SOURCES = \
+LNX_EXTRA_SRCS = \
lnx_font.c \
- lnx_ia64.c \
lnx_jstk.c \
lnxResource.c
EXTRA_DIST = \
- $(LNX_EXTRA_SOURCES) \
+ $(LNX_EXTRA_SRCS) \
lnx.h \
- lnx_kbd.h \
- $(srcdir)/../shared/ia64Pci.h \
$(srcdir)/../shared/xf86Axp.h
diff --git a/hw/xfree86/os-support/linux/lnx_KbdMap.c b/hw/xfree86/os-support/linux/lnx_KbdMap.c
deleted file mode 100644
index a2a2e224d..000000000
--- a/hw/xfree86/os-support/linux/lnx_KbdMap.c
+++ /dev/null
@@ -1,606 +0,0 @@
-/* $XFree86$ */
-
-/*
- * Slightly modified xf86KbdLnx.c which is
- *
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-
-#include "xf86Keymap.h"
-
-#include "lnx_kbd.h"
-
-/*ARGSUSED*/
-
-/*
- * KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-static void readKernelMapping(InputInfoPtr pInfo,
- KeySymsPtr pKeySyms, CARD8 *pModMap);
-void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- KeySym *k;
- char type;
- int i;
-
- readKernelMapping(pInfo, pKeySyms, pModMap);
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = map, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4)
-
- switch(*k) {
-
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
-
- }
-
- pKbd->kbdType = ioctl(pInfo->fd, KDGKBTYPE, &type) != -1 ? type : KB_101;
-
- pKeySyms->map = map;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
-
-#include <linux/keyboard.h>
-
-static KeySym linux_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
-};
-
-/*
- * Maps the AT keycodes to Linux keycodes
- */
-static unsigned char at2lnx[] =
-{
- 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
- 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
- 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
- 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
- 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
- 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
- 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
- 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
- 0x11, /* KEY_W */ 0x12, /* KEY_E */
- 0x13, /* KEY_R */ 0x14, /* KEY_T */
- 0x15, /* KEY_Y */ 0x16, /* KEY_U */
- 0x17, /* KEY_I */ 0x18, /* KEY_O */
- 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
- 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
- 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
- 0x1f, /* KEY_S */ 0x20, /* KEY_D */
- 0x21, /* KEY_F */ 0x22, /* KEY_G */
- 0x23, /* KEY_H */ 0x24, /* KEY_J */
- 0x25, /* KEY_K */ 0x26, /* KEY_L */
- 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
- 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
- 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
- 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
- 0x2f, /* KEY_V */ 0x30, /* KEY_B */
- 0x31, /* KEY_N */ 0x32, /* KEY_M */
- 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
- 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
- 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
- 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
- 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
- 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
- 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
- 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
- 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
- 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
- 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
- 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
- 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
- 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
- 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
- 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
- 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
- 0x00, /* 0x55 */ 0x56, /* KEY_Less */
- 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
- 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
- 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
- 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
- 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
- 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
- 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
- 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
- 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
- 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
- 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
- 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
- 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
- 0x00, /* 0x71 */ 0x00, /* 0x72 */
- 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
- 0x00, /* 0x75 */ 0x00, /* 0x76 */
- 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
- 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
- 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
- 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
- 0x00, /* 0x7f */
-};
-#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
-
-#define NUM_CUSTOMKEYS NR_KEYS
-
-static void
-readKernelMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- KeySym *k;
- int i;
- int maxkey;
- static unsigned char tbl[GLYPHS_PER_KEY] =
- {
- 0, /* unshifted */
- 1, /* shifted */
- 0, /* modeswitch unshifted */
- 0 /* modeswitch shifted */
- };
-
- /*
- * Read the mapping from the kernel.
- * Since we're still using the XFree86 scancode->AT keycode mapping
- * routines, we need to convert the AT keycodes to Linux keycodes,
- * then translate the Linux keysyms into X keysyms.
- *
- * First, figure out which tables to use for the modeswitch columns
- * above, from the XF86Config fields.
- */
- tbl[2] = 8; /* alt */
- tbl[3] = tbl[2] | 1;
-
- if (pKbd->CustomKeycodes) {
- k = map;
- maxkey = NUM_CUSTOMKEYS;
- }
- else {
- k = map+GLYPHS_PER_KEY;
- maxkey = NUM_AT2LNX;
- }
-
- for (i = 0; i < maxkey; ++i)
- {
- struct kbentry kbe;
- int j;
-
- if (pKbd->CustomKeycodes)
- kbe.kb_index = i;
- else
- kbe.kb_index = at2lnx[i];
-
- for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k)
- {
- unsigned short kval;
-
- *k = NoSymbol;
-
- kbe.kb_table = tbl[j];
- if (
- (!pKbd->CustomKeycodes && kbe.kb_index == 0) ||
- ioctl(pInfo->fd, KDGKBENT, &kbe))
- continue;
-
- kval = KVAL(kbe.kb_value);
- switch (KTYP(kbe.kb_value))
- {
- case KT_LATIN:
- case KT_LETTER:
- *k = linux_to_x[kval];
- break;
-
- case KT_FN:
- if (kval <= 19)
- *k = XK_F1 + kval;
- else switch (kbe.kb_value)
- {
- case K_FIND:
- *k = XK_Home; /* or XK_Find */
- break;
- case K_INSERT:
- *k = XK_Insert;
- break;
- case K_REMOVE:
- *k = XK_Delete;
- break;
- case K_SELECT:
- *k = XK_End; /* or XK_Select */
- break;
- case K_PGUP:
- *k = XK_Prior;
- break;
- case K_PGDN:
- *k = XK_Next;
- break;
- case K_HELP:
- *k = XK_Help;
- break;
- case K_DO:
- *k = XK_Execute;
- break;
- case K_PAUSE:
- *k = XK_Pause;
- break;
- case K_MACRO:
- *k = XK_Menu;
- break;
- default:
- break;
- }
- break;
-
- case KT_SPEC:
- switch (kbe.kb_value)
- {
- case K_ENTER:
- *k = XK_Return;
- break;
- case K_BREAK:
- *k = XK_Break;
- break;
- case K_CAPS:
- *k = XK_Caps_Lock;
- break;
- case K_NUM:
- *k = XK_Num_Lock;
- break;
- case K_HOLD:
- *k = XK_Scroll_Lock;
- break;
- case K_COMPOSE:
- *k = XK_Multi_key;
- break;
- default:
- break;
- }
- break;
-
- case KT_PAD:
- switch (kbe.kb_value)
- {
- case K_PPLUS:
- *k = XK_KP_Add;
- break;
- case K_PMINUS:
- *k = XK_KP_Subtract;
- break;
- case K_PSTAR:
- *k = XK_KP_Multiply;
- break;
- case K_PSLASH:
- *k = XK_KP_Divide;
- break;
- case K_PENTER:
- *k = XK_KP_Enter;
- break;
- case K_PCOMMA:
- *k = XK_KP_Separator;
- break;
- case K_PDOT:
- *k = XK_KP_Decimal;
- break;
- case K_PPLUSMINUS:
- *k = XK_KP_Subtract;
- break;
- default:
- if (kval <= 9)
- *k = XK_KP_0 + kval;
- break;
- }
- break;
-
- /*
- * KT_DEAD keys are for accelerated diacritical creation.
- */
- case KT_DEAD:
- switch (kbe.kb_value)
- {
- case K_DGRAVE:
- *k = XK_dead_grave;
- break;
- case K_DACUTE:
- *k = XK_dead_acute;
- break;
- case K_DCIRCM:
- *k = XK_dead_circumflex;
- break;
- case K_DTILDE:
- *k = XK_dead_tilde;
- break;
- case K_DDIERE:
- *k = XK_dead_diaeresis;
- break;
- }
- break;
-
- case KT_CUR:
- switch (kbe.kb_value)
- {
- case K_DOWN:
- *k = XK_Down;
- break;
- case K_LEFT:
- *k = XK_Left;
- break;
- case K_RIGHT:
- *k = XK_Right;
- break;
- case K_UP:
- *k = XK_Up;
- break;
- }
- break;
-
- case KT_SHIFT:
- switch (kbe.kb_value)
- {
- case K_ALTGR:
- *k = XK_Alt_R;
- break;
- case K_ALT:
- *k = (kbe.kb_index == 0x64 ?
- XK_Alt_R : XK_Alt_L);
- break;
- case K_CTRL:
- *k = (kbe.kb_index == 0x61 ?
- XK_Control_R : XK_Control_L);
- break;
- case K_CTRLL:
- *k = XK_Control_L;
- break;
- case K_CTRLR:
- *k = XK_Control_R;
- break;
- case K_SHIFT:
- *k = (kbe.kb_index == 0x36 ?
- XK_Shift_R : XK_Shift_L);
- break;
- case K_SHIFTL:
- *k = XK_Shift_L;
- break;
- case K_SHIFTR:
- *k = XK_Shift_R;
- break;
- default:
- break;
- }
- break;
-
- /*
- * KT_ASCII keys accumulate a 3 digit decimal number that gets
- * emitted when the shift state changes. We can't emulate that.
- */
- case KT_ASCII:
- break;
-
- case KT_LOCK:
- if (kbe.kb_value == K_SHIFTLOCK)
- *k = XK_Shift_Lock;
- break;
-
- default:
- break;
- }
- }
-
- if (k[-1] == k[-2]) k[-1] = NoSymbol;
- if (k[-2] == k[-3]) k[-2] = NoSymbol;
- if (k[-3] == k[-4]) k[-3] = NoSymbol;
- if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
- if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol;
- }
-
- if (!pKbd->CustomKeycodes)
- return;
-
- /*
- * Find the Mapping for the special server functions
- */
- pKbd->specialMap = (TransMapPtr) xcalloc(NUM_CUSTOMKEYS, 1);
- if (pKbd->specialMap != NULL) {
- pKbd->specialMap->end = NUM_CUSTOMKEYS;
- pKbd->specialMap->map = (unsigned char*) xcalloc(NUM_CUSTOMKEYS, 1);
- if (pKbd->specialMap == NULL) {
- xfree(pKbd->specialMap);
- pKbd->specialMap = NULL;
- }
- }
- if (pKbd->specialMap == NULL) {
- xf86Msg(X_ERROR, "%s can't allocate \"special map\"\n", pInfo->name);
- return;
- }
-
- for (i = 0; i < NUM_CUSTOMKEYS; ++i) {
- struct kbentry kbe;
- int special = 0;
-
- kbe.kb_index = i;
- kbe.kb_table = 0; /* Plain map */
- if (!ioctl(pInfo->fd, KDGKBENT, &kbe))
- switch (kbe.kb_value) {
- case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */
- special = KEY_BackSpace;
- break;
- case K_PMINUS:
- special = KEY_KP_Minus;
- break;
- case K_PPLUS:
- special = KEY_KP_Plus;
- break;
- case K_F1:
- special = KEY_F1;
- break;
- case K_F2:
- special = KEY_F2;
- break;
- case K_F3:
- special = KEY_F3;
- break;
- case K_F4:
- special = KEY_F4;
- break;
- case K_F5:
- special = KEY_F5;
- break;
- case K_F6:
- special = KEY_F6;
- break;
- case K_F7:
- special = KEY_F7;
- break;
- case K_F8:
- special = KEY_F8;
- break;
- case K_F9:
- special = KEY_F9;
- break;
- case K_F10:
- special = KEY_F10;
- break;
- case K_F11:
- special = KEY_F11;
- break;
- case K_F12:
- special = KEY_F12;
- break;
- case K_ALT:
- special = KEY_Alt;
- break;
- case K_ALTGR:
- special = KEY_AltLang;
- break;
- case K_CONS:
- special = KEY_SysReqest;
- break;
- }
- pKbd->specialMap->map[i] = special;
- }
-}
diff --git a/hw/xfree86/os-support/linux/lnx_bell.c b/hw/xfree86/os-support/linux/lnx_bell.c
new file mode 100644
index 000000000..6ef881bf7
--- /dev/null
+++ b/hw/xfree86/os-support/linux/lnx_bell.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that this copyright notice and this permission notice appear in
+ * supporting electronic documentation.
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR AUTHORS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+
+_X_EXPORT void
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ if (xf86Info.consoleFd == -1 || !pitch || !loudness)
+ return;
+
+ ioctl(xf86Info.consoleFd, KDMKTONE,
+ ((1193190 / pitch) & 0xffff) |
+ (((unsigned long)duration * loudness / 50) << 16));
+}
diff --git a/hw/xfree86/os-support/linux/lnx_io.c b/hw/xfree86/os-support/linux/lnx_io.c
deleted file mode 100644
index 836aaa15b..000000000
--- a/hw/xfree86/os-support/linux/lnx_io.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Orest Zborowski and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Orest Zborowski
- * and David Dawes make no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * OREST ZBOROWSKI AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI OR DAVID DAWES BE LIABLE
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XConsortium: lnx_io.c /main/8 1996/10/19 18:06:28 kaleb $ */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch)
- {
- ioctl(xf86Info.consoleFd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration *
- loudness / 50) << 16));
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
- ioctl(xf86Info.consoleFd, KDSETLED, leds);
-}
-
-int
-xf86GetKbdLeds()
-{
- int leds = 0;
-
- ioctl(xf86Info.consoleFd, KDGETLED, &leds);
- return(leds);
-}
-
-static int
-KDKBDREP_ioctl_ok(int rate, int delay) {
-#if defined(KDKBDREP) && !defined(__sparc__)
- /* This ioctl is defined in <linux/kd.h> but is not
- implemented anywhere - must be in some m68k patches. */
- struct kbd_repeat kbdrep_s;
-
- /* don't change, just test */
- kbdrep_s.LNX_KBD_PERIOD_NAME = -1;
- kbdrep_s.delay = -1;
- if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) {
- return 0;
- }
- /* do the change */
- if (rate == 0) /* switch repeat off */
- kbdrep_s.LNX_KBD_PERIOD_NAME = 0;
- else
- kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */
- if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1)
- kbdrep_s.LNX_KBD_PERIOD_NAME = 1;
- kbdrep_s.delay = delay;
- if (kbdrep_s.delay < 1)
- kbdrep_s.delay = 1;
-
- if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) {
- return 0;
- }
-
- return 1; /* success! */
-#else /* no KDKBDREP */
- return 0;
-#endif /* KDKBDREP */
-}
-
-static int
-KIOCSRATE_ioctl_ok(int rate, int delay) {
-#ifdef KIOCSRATE
- struct kbd_rate kbdrate_s;
- int fd;
-
- fd = open("/dev/kbd", O_RDONLY);
- if (fd == -1)
- return 0;
-
- kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */
- kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */
- if (kbdrate_s.rate > 50)
- kbdrate_s.rate = 50;
-
- if (ioctl( fd, KIOCSRATE, &kbdrate_s )) {
- return 0;
- }
-
- close( fd );
-
- return 1;
-#else /* no KIOCSRATE */
- return 0;
-#endif /* KIOCSRATE */
-}
-
-void xf86SetKbdRepeat(char rad)
-{
-#ifdef __sparc__
- int rate = 500; /* Default rate */
- int delay = 200; /* Default delay */
-#else
- int rate = 300; /* Default rate */
- int delay = 250; /* Default delay */
-#endif
-
-#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
- int i;
- int timeout;
- int value = 0x7f; /* Maximum delay with slowest rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-#endif
-
- if (xf86Info.kbdRate >= 0)
- rate = xf86Info.kbdRate * 10;
- if (xf86Info.kbdDelay >= 0)
- delay = xf86Info.kbdDelay;
-
- if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */
- return;
-
- if(KIOCSRATE_ioctl_ok(rate, delay)) /* sparc? */
- return;
-
- if (xf86IsPc98())
- return;
-
-#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
-
- /* The ioport way */
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- timeout = KBC_TIMEOUT;
- while (((inb(0x64) & 2) == 2) && --timeout)
- usleep(1000); /* wait */
-
- if (timeout == 0)
- return;
-
- outb(0x60, 0xf3); /* set typematic rate */
- while (((inb(0x64) & 2) == 2) && --timeout)
- usleep(1000); /* wait */
-
- usleep(10000);
- outb(0x60, value);
-
-#endif /* __alpha__ || __i386__ || __ia64__ */
-}
-
-static int kbdtrans;
-static struct termios kbdtty;
-
-void
-xf86KbdInit()
-{
- ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans);
- tcgetattr (xf86Info.consoleFd, &kbdtty);
-}
-
-int
-xf86KbdOn()
-{
- struct termios nTty;
-
-#ifdef __powerpc__
- if (xf86Info.kbdCustomKeycodes)
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW);
- else
-#endif
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
-
- nTty = kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff()
-{
- ioctl(xf86Info.consoleFd, KDSKBMODE, kbdtrans);
- tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
- return(xf86Info.consoleFd);
-}
-
diff --git a/hw/xfree86/os-support/linux/lnx_kbd.c b/hw/xfree86/os-support/linux/lnx_kbd.c
deleted file mode 100644
index a4890d2df..000000000
--- a/hw/xfree86/os-support/linux/lnx_kbd.c
+++ /dev/null
@@ -1,530 +0,0 @@
-
-/*
- * Copyright (c) 2002 by The XFree86 Project, Inc.
- * Author: Ivan Pascal.
- *
- * Based on the code from lnx_io.c which is
- * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- */
-
-#define NEED_EVENTS
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#if defined(DO_OS_FONTRESTORE)
-#include "lnx.h"
-#endif
-#include "lnx_kbd.h"
-
-#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */
-
-static KbdProtocolRec protocols[] = {
- {"standard", PROT_STD },
- { NULL, PROT_UNKNOWN_KBD }
-};
-
-extern Bool VTSwitchEnabled;
-#ifdef USE_VT_SYSREQ
-extern Bool VTSysreqToggle;
-#endif
-
-static void
-SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- if (loudness && pitch)
- {
- ioctl(pInfo->fd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration *
- loudness / 50) << 16));
- }
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- int real_leds = 0;
-
-#if defined (__sparc__)
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- if (pKbd->sunKbd) {
- if (leds & 0x08) real_leds |= XLED1;
- if (leds & 0x04) real_leds |= XLED3;
- if (leds & 0x02) real_leds |= XLED4;
- if (leds & 0x01) real_leds |= XLED2;
- leds = real_leds;
- real_leds = 0;
- }
-#endif /* defined (__sparc__) */
-#ifdef LED_CAP
- if (leds & XLED1) real_leds |= LED_CAP;
- if (leds & XLED2) real_leds |= LED_NUM;
- if (leds & XLED3) real_leds |= LED_SCR;
-#ifdef LED_COMP
- if (leds & XLED4) real_leds |= LED_COMP;
-#else
- if (leds & XLED4) real_leds |= LED_SCR;
-#endif
-#endif
- ioctl(pInfo->fd, KDSETLED, real_leds);
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- int real_leds, leds = 0;
-
- ioctl(pInfo->fd, KDGETLED, &real_leds);
-
- if (real_leds & LED_CAP) leds |= XLED1;
- if (real_leds & LED_NUM) leds |= XLED2;
- if (real_leds & LED_SCR) leds |= XLED3;
-
- return(leds);
-}
-
-static int
-KDKBDREP_ioctl_ok(int rate, int delay) {
-#if defined(KDKBDREP) && !defined(__sparc__)
- /* This ioctl is defined in <linux/kd.h> but is not
- implemented anywhere - must be in some m68k patches. */
- struct kbd_repeat kbdrep_s;
-
- /* don't change, just test */
- kbdrep_s.LNX_KBD_PERIOD_NAME = -1;
- kbdrep_s.delay = -1;
- if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) {
- return 0;
- }
-
- /* do the change */
- if (rate == 0) /* switch repeat off */
- kbdrep_s.LNX_KBD_PERIOD_NAME = 0;
- else
- kbdrep_s.LNX_KBD_PERIOD_NAME = 10000 / rate; /* convert cps to msec */
- if (kbdrep_s.LNX_KBD_PERIOD_NAME < 1)
- kbdrep_s.LNX_KBD_PERIOD_NAME = 1;
- kbdrep_s.delay = delay;
- if (kbdrep_s.delay < 1)
- kbdrep_s.delay = 1;
-
- if (ioctl( xf86Info.consoleFd, KDKBDREP, &kbdrep_s )) {
- return 0;
- }
-
- return 1; /* success! */
-#else /* no KDKBDREP */
- return 0;
-#endif /* KDKBDREP */
-}
-
-static int
-KIOCSRATE_ioctl_ok(int rate, int delay) {
-#ifdef KIOCSRATE
- struct kbd_rate kbdrate_s;
- int fd;
-
- fd = open("/dev/kbd", O_RDONLY);
- if (fd == -1)
- return 0;
-
- kbdrate_s.rate = (rate + 5) / 10; /* must be integer, so round up */
- kbdrate_s.delay = delay * HZ / 1000; /* convert ms to Hz */
- if (kbdrate_s.rate > 50)
- kbdrate_s.rate = 50;
-
- if (ioctl( fd, KIOCSRATE, &kbdrate_s )) {
- return 0;
- }
-
- close( fd );
-
- return 1;
-#else /* no KIOCSRATE */
- return 0;
-#endif /* KIOCSRATE */
-}
-
-#undef rate
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- int timeout;
- int value = 0x7f; /* Maximum delay with slowest rate */
-
-#ifdef __sparc__
- int rate = 500; /* Default rate */
- int delay = 200; /* Default delay */
-#else
- int rate = 300; /* Default rate */
- int delay = 250; /* Default delay */
-#endif
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (pKbd->rate >= 0)
- rate = pKbd->rate * 10;
- if (pKbd->delay >= 0)
- delay = pKbd->delay;
-
- if(KDKBDREP_ioctl_ok(rate, delay)) /* m68k? */
- return;
-
- if(KIOCSRATE_ioctl_ok(rate, delay)) /* sparc? */
- return;
-
- if (xf86IsPc98())
- return;
-
-#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
-
- if (!xorgHWAccess) {
- if (xf86EnableIO())
- xorgHWAccess = TRUE;
- else
- return;
- }
-
- /* The ioport way */
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- timeout = KBC_TIMEOUT;
- while (((inb(0x64) & 2) == 2) && --timeout)
- usleep(1000); /* wait */
-
- if (timeout == 0)
- return;
-
- outb(0x60, 0xf3); /* set typematic rate */
- while (((inb(0x64) & 2) == 2) && --timeout)
- usleep(1000); /* wait */
-
- usleep(10000);
- outb(0x60, value);
-
-#endif /* __alpha__ || __i386__ || __ia64__ */
-}
-
-typedef struct {
- int kbdtrans;
- struct termios kbdtty;
-} LnxKbdPrivRec, *LnxKbdPrivPtr;
-
-static int
-KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- ioctl (pInfo->fd, KDGKBMODE, &(priv->kbdtrans));
- tcgetattr (pInfo->fd, &(priv->kbdtty));
- }
- if (!pKbd->CustomKeycodes) {
- pKbd->RemapScanCode = ATScancode;
- }
-
- return Success;
-}
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private;
- struct termios nTty;
-
- if (pKbd->isConsole) {
- if (pKbd->CustomKeycodes)
- ioctl(pInfo->fd, KDSKBMODE, K_MEDIUMRAW);
- else
- ioctl(pInfo->fd, KDSKBMODE, K_RAW);
-
- nTty = priv->kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
- cfsetispeed(&nTty, 9600);
- cfsetospeed(&nTty, 9600);
- tcsetattr(pInfo->fd, TCSANOW, &nTty);
- }
- return Success;
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- LnxKbdPrivPtr priv = (LnxKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- ioctl(pInfo->fd, KDSKBMODE, priv->kbdtrans);
- tcsetattr(pInfo->fd, TCSANOW, &(priv->kbdtty));
- }
- return Success;
-}
-
-static int
-GetSpecialKey(InputInfoPtr pInfo, int scanCode)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int specialkey = scanCode;
-
-#if defined (__sparc__)
- if (pKbd->sunKbd) {
- switch (scanCode) {
- case 0x2b: specialkey = KEY_BackSpace; break;
- case 0x47: specialkey = KEY_KP_Minus; break;
- case 0x7d: specialkey = KEY_KP_Plus; break;
- /* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
- case 0x05: specialkey = KEY_F1; break;
- case 0x06: specialkey = KEY_F2; break;
- case 0x08: specialkey = KEY_F3; break;
- case 0x0a: specialkey = KEY_F4; break;
- case 0x0c: specialkey = KEY_F5; break;
- case 0x0e: specialkey = KEY_F6; break;
- case 0x10: specialkey = KEY_F7; break;
- case 0x11: specialkey = KEY_F8; break;
- case 0x12: specialkey = KEY_F9; break;
- case 0x07: specialkey = KEY_F10; break;
- case 0x09: specialkey = KEY_F11; break;
- case 0x0b: specialkey = KEY_F12; break;
- default: specialkey = 0; break;
- }
- return specialkey;
- }
-#endif
-
- if (pKbd->CustomKeycodes) {
- specialkey = pKbd->specialMap->map[scanCode];
- }
- return specialkey;
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static
-Bool SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- return TRUE;
- }
- case KEY_F11:
- case KEY_F12:
- if (down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- return TRUE;
- }
- }
- }
- }
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (VTSysreqToggle && down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F1 + 1);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down) {
- ioctl(xf86Info.consoleFd, VT_ACTIVATE, key - KEY_F11 + 11);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
- case KEY_SysReqest:
- if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down)
- VTSysreqToggle = TRUE;
- break;
- default:
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- if (VTSysreqToggle)
- VTSysreqToggle = FALSE;
- }
- }
-#endif /* USE_VT_SYSREQ */
- return FALSE;
-}
-
-static void
-stdReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- unsigned char rBuf[64];
- int nBytes, i;
- if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) {
- for (i = 0; i < nBytes; i++)
- pKbd->PostEvent(pInfo, rBuf[i] & 0x7f,
- rBuf[i] & 0x80 ? FALSE : TRUE);
- }
-}
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- KbdProtocolId prot = PROT_UNKNOWN_KBD;
- char *s;
-
- s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
- for (i = 0; protocols[i].name; i++) {
- if (xf86NameCmp(s, protocols[i].name) == 0) {
- prot = protocols[i].id;
- break;
- }
- }
-
- switch (prot) {
- case PROT_STD:
- pInfo->read_input = stdReadInput;
- break;
- default:
- xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
- xfree(s);
- return FALSE;
- }
-
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
- xfree(s);
-
- s = xf86SetStrOption(pInfo->options, "Device", NULL);
- if (s == NULL) {
- pInfo->fd = xf86Info.consoleFd;
- pKbd->isConsole = TRUE;
- } else {
- pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
- if (pInfo->fd == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
- xfree(s);
- return FALSE;
- }
- pKbd->isConsole = FALSE;
- xfree(s);
- }
-
- if (pKbd->isConsole)
- pKbd->vtSwitchSupported = TRUE;
-
- return TRUE;
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
-
- pKbd->RemapScanCode = NULL;
- pKbd->GetSpecialKey = GetSpecialKey;
-
- pKbd->OpenKeyboard = OpenKeyboard;
- pKbd->vtSwitchSupported = FALSE;
-
- pKbd->private = xcalloc(sizeof(LnxKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- }
-
-#if defined(__powerpc__)
- {
- FILE *f;
- f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r");
- if (f) {
- if (fgetc(f) == '0')
- pKbd->CustomKeycodes = TRUE;
- fclose(f);
- }
- }
-#endif
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/linux/lnx_kbd.h b/hw/xfree86/os-support/linux/lnx_kbd.h
deleted file mode 100644
index b2ae179e1..000000000
--- a/hw/xfree86/os-support/linux/lnx_kbd.h
+++ /dev/null
@@ -1,4 +0,0 @@
-
-extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
- CARD8 *pModMap);
-
diff --git a/hw/xfree86/os-support/linux/lnx_pci.c b/hw/xfree86/os-support/linux/lnx_pci.c
index a1dbc7604..a95703899 100644
--- a/hw/xfree86/os-support/linux/lnx_pci.c
+++ b/hw/xfree86/os-support/linux/lnx_pci.c
@@ -3,7 +3,9 @@
#include <xorg-config.h>
#endif
+#include <sys/types.h>
#include <stdio.h>
+#include <dirent.h>
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
@@ -25,8 +27,10 @@
int lnxPciInit(void);
struct pci_dev {
+ unsigned int domain;
unsigned int bus;
- unsigned int devfn;
+ unsigned int dev;
+ unsigned int fn;
PCIADDR_TYPE offset[7];
PCIADDR_TYPE size[7];
struct pci_dev *next;
@@ -38,10 +42,53 @@ int xf86OSLinuxNumPciDevs = 0;
static struct pci_dev *xf86OSLinuxGetPciDevs(void) {
char c[0x200];
FILE *file = NULL;
+ DIR *dir;
+ struct dirent *dirent;
struct pci_dev *tmp, *ret = NULL;
- unsigned int num;
+ unsigned int i, num, devfn;
+ unsigned PCIADDR_TYPE begin, end;
char *res;
+ /* Try 2.6 devices first, with domain support */
+ if ( (dir = opendir ("/sys/bus/pci/devices")) ) {
+ xf86OSLinuxNumPciDevs = 0;
+ while ( (dirent = readdir (dir)) ) {
+ unsigned int domain, bus, dev, fn;
+ if (sscanf (dirent->d_name, "%04x:%02x:%02x.%01x",
+ &domain, &bus, &dev, &fn) == 4) {
+ tmp = xcalloc (sizeof(struct pci_dev), 1);
+ tmp->domain = domain;
+ tmp->bus = bus;
+ tmp->dev = dev;
+ tmp->fn = fn;
+ sprintf (c, "/sys/bus/pci/devices/%12s/resource",
+ dirent->d_name);
+ i = 0;
+ if ( (file = fopen (c, "r")) ) {
+ while (i < 7 && fgets (c, 0x200, file)) {
+ if (sscanf (c, PCIADDR_FMT " " PCIADDR_FMT " "
+ PCIADDR_IGNORE_FMT, &begin, &end) == 2) {
+ tmp->offset[i] = begin;
+ tmp->size[i] = begin ? end-begin+1 : 0;
+ i++;
+ }
+ }
+ fclose (file);
+ }
+ if (i > 0) {
+ tmp->next = ret;
+ ret = tmp;
+ xf86OSLinuxNumPciDevs++;
+ } else
+ xfree (tmp);
+ }
+ }
+ closedir (dir);
+ }
+
+ if (ret)
+ return ret;
+
file = fopen("/proc/bus/pci/devices", "r");
if (!file) return NULL;
@@ -70,9 +117,11 @@ static struct pci_dev *xf86OSLinuxGetPciDevs(void) {
"\t" PCIADDR_FMT
"\t" PCIADDR_FMT
"\t" PCIADDR_FMT,
- &tmp->bus,&tmp->devfn,&tmp->offset[0],&tmp->offset[1],&tmp->offset[2],&tmp->offset[3],
+ &tmp->bus,&devfn,&tmp->offset[0],&tmp->offset[1],&tmp->offset[2],&tmp->offset[3],
&tmp->offset[4],&tmp->offset[5],&tmp->offset[6], &tmp->size[0], &tmp->size[1], &tmp->size[2],
&tmp->size[3], &tmp->size[4], &tmp->size[5], &tmp->size[6]);
+ tmp->dev = devfn >> 3;
+ tmp->fn = devfn & 0x7;
if (num != 16) { /* apparantly not 2.3 style */
xfree(tmp);
fclose(file);
@@ -100,11 +149,10 @@ int lnxPciInit(void) {
Bool
xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
{
- unsigned int dev, fn;
signed PCIADDR_TYPE Size;
struct pci_dev *device;
- if (index > 7)
+ if (index >= 7)
return FALSE;
if (!xf86OSLinuxPCIDevs) {
@@ -114,10 +162,8 @@ xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
return FALSE;
for (device = xf86OSLinuxPCIDevs; device; device = device->next) {
- dev = device->devfn >> 3;
- fn = device->devfn & 0x7;
- if (tag == pciTag(device->bus,dev,fn)) {
- *bits = 0;
+ if (tag == pciDomTag (device->domain, device->bus,
+ device->dev, device->fn)) {
if (device->size[index] != 0) {
Size = device->size[index] - ((PCIADDR_TYPE) 1);
while (Size & ((PCIADDR_TYPE) 0x01)) {
@@ -134,14 +180,14 @@ xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
+#if 0
/* Query the kvirt address (64bit) of a BAR range from TAG */
Bool
xf86GetPciOffsetFromOS(PCITAG tag, int index, unsigned long* bases)
{
- unsigned int dev, fn;
struct pci_dev *device;
- if (index > 7)
+ if (index >= 7)
return FALSE;
if (!xf86OSLinuxPCIDevs) {
@@ -151,9 +197,8 @@ xf86GetPciOffsetFromOS(PCITAG tag, int index, unsigned long* bases)
return FALSE;
for (device = xf86OSLinuxPCIDevs; device; device = device->next) {
- dev = device->devfn >> 3;
- fn = device->devfn & 0x7;
- if (tag == pciTag(device->bus,dev,fn)) {
+ if (tag == pciDomTag (device->domain, device->bus,
+ device->dev, device->fn)) {
/* return the offset for the index requested */
*bases = device->offset[index];
return TRUE;
@@ -162,12 +207,12 @@ xf86GetPciOffsetFromOS(PCITAG tag, int index, unsigned long* bases)
return FALSE;
}
+#endif
/* Query the kvirt address (64bit) of a BAR range from size for a given TAG */
unsigned long
xf86GetOSOffsetFromPCI(PCITAG tag, int space, unsigned long base)
{
- unsigned int dev, fn;
unsigned int ndx;
struct pci_dev *device;
@@ -179,9 +224,8 @@ xf86GetOSOffsetFromPCI(PCITAG tag, int space, unsigned long base)
}
for (device = xf86OSLinuxPCIDevs; device; device = device->next) {
- dev = device->devfn >> 3;
- fn = device->devfn & 0x7;
- if (tag == pciTag(device->bus, dev, fn)) {
+ if (tag == pciDomTag (device->domain, device->bus,
+ device->dev, device->fn)) {
/* ok now look through all the BAR values of this device */
pciConfigPtr pDev = xf86GetPciConfigFromTag(tag);
diff --git a/hw/xfree86/os-support/lynxos/Makefile.am b/hw/xfree86/os-support/lynxos/Makefile.am
index 0bb514b8a..4085c49a9 100644
--- a/hw/xfree86/os-support/lynxos/Makefile.am
+++ b/hw/xfree86/os-support/lynxos/Makefile.am
@@ -1,6 +1,5 @@
EXTRA_DIST = \
lynx_init.c \
- lynx_io.c \
lynx_mmap.c \
lynx_mouse.c \
lynx_noinline.c \
diff --git a/hw/xfree86/os-support/lynxos/lynx_io.c b/hw/xfree86/os-support/lynxos/lynx_io.c
deleted file mode 100644
index 818104634..000000000
--- a/hw/xfree86/os-support/lynxos/lynx_io.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 1993 by Thomas Mueller
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Mueller not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Mueller makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS MUELLER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-#if defined(KDMKTONE) || defined(KIOCSOUND)
-/* Lynx 2.2.1 has sophisticated atc stuff.... */
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch)
- {
-#ifdef KDMKTONE
- /*
- * If we have KDMKTONE use it to avoid putting the server
- * to sleep
- */
- ioctl(xf86Info.consoleFd, KDMKTONE,
- (pitch & 0xffff) |
- (((unsigned long)duration *
- loudness / 50) << 16));
-#else
- ioctl(xf86Info.consoleFd, KIOCSOUND, pitch);
- usleep(xf86Info.bell_duration * loudness * 20);
- ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
-#endif
- }
-}
-
-#else
-
-/* this is pulled from /sys/drivers/vt100/atbeep.c */
-
-#define SPEAKER_CONTROL 0x61
-#define TIMER_CONTROL 0x43
-#define TIMER_DATA 0x42
-#define TIMER_LOAD_CMD 0xb6
-
-#define TIMER_CONSTANT 1193280
-#define FREQ_LO(f) ((TIMER_CONSTANT / (f)) % 256)
-#define FREQ_HI(f) ((TIMER_CONSTANT / (f)) / 256)
-
-void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- int flo = FREQ_LO(pitch);
- int fhi = FREQ_HI(pitch);
-
- outb(TIMER_CONTROL, TIMER_LOAD_CMD);
- outb(TIMER_DATA, flo);
- outb(TIMER_DATA, fhi);
-
- /* speaker on */
- outb(SPEAKER_CONTROL, inb(SPEAKER_CONTROL) | 3);
- usleep(xf86Info.bell_duration * loudness * 20);
- /* speaker off */
- outb(SPEAKER_CONTROL, inb(SPEAKER_CONTROL) & ~3);
-}
-#endif
-
-void
-xf86SetKbdLeds(int leds)
-{
-#ifdef KBD_SET_LEDS
- ioctl(xf86Info.consoleFd, KBD_SET_LEDS, &leds);
-#endif
-}
-
-int
-xf86GetKbdLeds()
-{
-#ifdef KBD_SET_LEDS
- int leds;
-
- if (ioctl(xf86Info.consoleFd, KBD_SET_LEDS, &leds) < 0)
- return 0;
-
- return leds;
-#endif
- return 0;
-}
-
-void
-xf86SetKbdRepeat(char rad)
-{
-}
-
-static struct termio kbdtty;
-
-void
-xf86KbdInit()
-{
- ioctl(xf86Info.consoleFd, TCGETA, &kbdtty);
-}
-
-int
-xf86KbdOn()
-{
- struct termio nTty;
-
- /* set CAPS_LOCK to behave as CAPS_LOCK not as CTRL */
- write(xf86Info.consoleFd, "\033<", 2);
-
- /* enable scan mode */
- ioctl(xf86Info.consoleFd, TIO_ENSCANMODE, NULL);
-
- nTty = kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
- ioctl(xf86Info.consoleFd, TCSETA, &nTty);
-
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff()
-{
- /* disable scan mode */
- ioctl(xf86Info.consoleFd, TIO_DISSCANMODE, NULL);
- ioctl(xf86Info.consoleFd, TCSETA, &kbdtty);
- return(xf86Info.consoleFd);
-}
-
-#include "xf86OSKbd.h"
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- return FALSE;
-}
diff --git a/hw/xfree86/os-support/misc/Makefile.am b/hw/xfree86/os-support/misc/Makefile.am
index f546e1a92..8bec35088 100644
--- a/hw/xfree86/os-support/misc/Makefile.am
+++ b/hw/xfree86/os-support/misc/Makefile.am
@@ -1,18 +1,18 @@
# FIXME: Add the *.S files to build when applicable
-I386_SOURCES = BUSmemcpy.S IODelay.S SlowBcopy.S
-OTHER_SOURCES = BUSmemcpy.c IODelay.c SlowBcopy.c
+I386_SRCS = BUSmemcpy.S IODelay.S SlowBcopy.S
+OTHER_SRCS = BUSmemcpy.c IODelay.c SlowBcopy.c
-ARCH_SOURCES = $(OTHER_SOURCES)
+ARCH_SRCS = $(OTHER_SRCS)
# FIXME: Add to the build (NeedPortIO)
-PORTIO_SOURCES = PortIO.S
+PORTIO_SRCS = PortIO.S
# FIXME: Add to the build (if HasGcc || HasGcc2)
-ILHACK_SOURCES = xf86_IlHack.c
+ILHACK_SRCS = xf86_IlHack.c
noinst_LTLIBRARIES = libmisc.la
-libmisc_la_SOURCES = xf86_Util.c Delay.c $(ARCH_SOURCES)
+libmisc_la_SOURCES = xf86_Util.c Delay.c $(ARCH_SRCS)
#AM_LDFLAGS = -r
@@ -20,4 +20,4 @@ INCLUDES = $(XORG_INCS)
AM_CFLAGS = $(XORG_CFLAGS)
-EXTRA_DIST = $(I386_SOURCES) $(PORTIO_SOURCES) $(ILHACK_SOURCES)
+EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS) $(ILHACK_SRCS)
diff --git a/hw/xfree86/os-support/sco/Makefile.am b/hw/xfree86/os-support/sco/Makefile.am
index 1271c9d34..9cb5011fb 100644
--- a/hw/xfree86/os-support/sco/Makefile.am
+++ b/hw/xfree86/os-support/sco/Makefile.am
@@ -1,10 +1,6 @@
EXTRA_DIST = \
VTsw_sco.c \
- sco_KbdMap.c \
sco_init.c \
- sco_io.c \
sco_iop.c \
- sco_kbd.c \
- sco_kbd.h \
sco_mouse.c \
sco_video.c
diff --git a/hw/xfree86/os-support/sco/sco_KbdMap.c b/hw/xfree86/os-support/sco/sco_KbdMap.c
deleted file mode 100644
index 6a0e9de04..000000000
--- a/hw/xfree86/os-support/sco/sco_KbdMap.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* $XFree86$ */
-/*
- * Copyright 2005 by J. Kean Johnston <jkj@sco.com>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Based on xf86KbdMap.c, which is
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * Copyright (c) 1992-2003 by The XFree86 Project, Inc.
- */
-
-#include "X.h"
-#include "Xmd.h"
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "xf86Keymap.h"
-
-#include "sco_kbd.h"
-
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((priv->keymap.key[i].spcl << (n+1)) & 0x100) + priv->keymap.key[i].map[n]]
-
-/*
- * NOTE: Not all possible remappable symbols are remapped. There are two main
- * reasons:
- * a) The mapping between scancode and SYSV/386 - symboltable
- * is inconsistent between different versions and has some
- * BIG mistakes.
- * b) In X-Windows there is a difference between numpad-keys
- * and normal keys. SYSV/386 uses for both kinds of keys
- * the same symbol.
- *
- * Thus only the alpha keypad and the function keys are translated.
- * Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt.
- */
-
-static unsigned char remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
- XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- };
-
-/*
- * KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- ScoKbdPrivPtr priv = (ScoKbdPrivPtr) pKbd->private;
- KeySym *k;
- int i;
- KeySym *pMap = map;
-
- for (i = 0; i < priv->keymap.n_keys && i < NUM_KEYCODES; i++) {
- if (remap[i]) {
- k = pMap + (remap[i] << 2);
-
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = pMap, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += GLYPHS_PER_KEY) {
-
- switch(*k) {
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
- }
- }
-
- pKeySyms->map = pMap;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
diff --git a/hw/xfree86/os-support/sco/sco_io.c b/hw/xfree86/os-support/sco/sco_io.c
deleted file mode 100644
index eafc14cfb..000000000
--- a/hw/xfree86/os-support/sco/sco_io.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright 2001 by J. Kean Johnston <jkj@sco.com>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/* $XConsortium$ */
-
-/* Re-written May 2001 to represent the current state of reality */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86OSpriv.h"
-#include "xf86_OSlib.h"
-
-#include <sys/param.h>
-#include <sys/emap.h>
-#include <sys/nmap.h>
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch) {
- ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
- usleep(duration * loudness * 20);
- ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
- /*
- * sleep the first time through under SCO. There appears to be a
- * timing problem in the driver which causes the keyboard to be lost.
- * This usleep stops it from occurring. NOTE: this was in the old code.
- * I am not convinced it is true any longer, but it doesn't hurt to
- * leave this in here.
- */
- static int once = 1;
-
- if (once) {
- usleep(100);
- once = 0;
- }
-
- ioctl(xf86Info.consoleFd, KDSETLED, leds );
-}
-
-int
-xf86GetKbdLeds(void)
-{
- int leds;
-
- ioctl (xf86Info.consoleFd, KDGETLED, &leds);
- return leds;
-}
-
-/*
- * Much of the code in this function is duplicated from the Linux code
- * by Orest Zborowski <obz@Kodak.com> and David Dawes <dawes@xfree86.org>.
- * Please see the file ../linux/lnx_io.c for full copyright information.
- *
- * NOTE: Only OpenServer Release 5.0.6 with Release Supplement 5.0.6A
- * and later have the required ioctl. 5.0.6A or higher is HIGHLY
- * recommended. The console driver is quite a different beast on that OS.
- */
-void
-xf86SetKbdRepeat(char rad)
-{
-#if defined(KBIO_SETRATE)
- int i;
- int value = 0x7f; /* Maximum delay with slowest rate */
- int delay = 250; /* Default delay */
- int rate = 300; /* Default repeat rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (xf86Info.kbdRate >= 0)
- rate = xf86Info.kbdRate * 10;
- if (xf86Info.kbdDelay >= 0)
- delay = xf86Info.kbdDelay;
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- ioctl (xf86Info.consoleFd, KBIO_SETRATE, value);
-#endif /* defined(KBIO_SETRATE) */
-}
-
-static Bool use_tcs = TRUE, use_kd = TRUE;
-static Bool no_nmap = TRUE, no_emap = TRUE;
-static int orig_getsc, orig_kbm;
-static struct termios orig_termios;
-static keymap_t keymap, noledmap;
-static uchar_t *sc_mapbuf;
-static uchar_t *sc_mapbuf2;
-
-void
-xf86KbdInit(void)
-{
- orig_getsc = 0;
- if (ioctl (xf86Info.consoleFd, TCGETSC, &orig_getsc) < 0)
- use_tcs = FALSE;
- if (ioctl (xf86Info.consoleFd, KDGKBMODE, &orig_kbm) < 0)
- use_kd = FALSE;
-
- if (!use_tcs && !use_kd)
- FatalError ("xf86KbdInit: Could not determine keyboard mode\n");
-
- /*
- * One day this should be fixed to translate normal ASCII characters
- * back into scancodes or into events that XFree86 wants, but not
- * now. For the time being, we only support scancode mode screens.
- */
- if (use_tcs && !(orig_getsc & KB_ISSCANCODE))
- FatalError ("xf86KbdInit: Keyboard can not send scancodes\n");
-
- /*
- * We need to get the original keyboard map and NUL out the lock
- * modifiers. This prevents the scancode API from messing with
- * the keyboard LED's. We restore the original map when we exit.
- */
- if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &keymap) < 0) {
- FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- }
- if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &noledmap) < 0) {
- FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- } else {
- int i, j;
-
- for (i = 0; i < noledmap.n_keys; i++) {
- for (j = 0; j < NUM_STATES; j++) {
- if (IS_SPECIAL(noledmap, i, j) &&
- ((noledmap.key[i].map[j] == K_CLK) ||
- (noledmap.key[i].map[j] == K_NLK) ||
- (noledmap.key[i].map[j] == K_SLK))) {
- noledmap.key[i].map[j] = K_NOP;
- }
- }
- }
- }
-
- if (ioctl (xf86Info.consoleFd, XCGETA, &orig_termios) < 0) {
- FatalError ("xf86KbdInit: Failed to get terminal modes (%s)\n",
- strerror(errno));
- }
-
- sc_mapbuf = xalloc (10*BSIZE);
- sc_mapbuf2 = xalloc(10*BSIZE);
-
- /* Get the emap */
- if (ioctl (xf86Info.consoleFd, LDGMAP, sc_mapbuf) < 0) {
- if (errno != ENAVAIL) {
- FatalError ("xf86KbdInit: Failed to retrieve e-map (%s)\n",
- strerror (errno));
- }
- no_emap = FALSE;
- }
-
- /* Get the nmap */
- if (ioctl (xf86Info.consoleFd, NMGMAP, sc_mapbuf2) < 0) {
- if (errno != ENAVAIL) {
- FatalError ("xf86KbdInit: Failed to retrieve n-map (%s)\n",
- strerror (errno));
- }
- no_nmap = FALSE;
- }
-}
-
-int
-xf86KbdOn(void)
-{
- struct termios newtio;
-
- ioctl (xf86Info.consoleFd, LDNMAP); /* Turn e-mapping off */
- ioctl (xf86Info.consoleFd, NMNMAP); /* Turn n-mapping off */
-
- newtio = orig_termios; /* structure copy */
- newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- newtio.c_oflag = 0;
- newtio.c_cflag = CREAD | CS8 | B9600;
- newtio.c_lflag = 0;
- newtio.c_cc[VTIME]=0;
- newtio.c_cc[VMIN]=1;
- cfsetispeed(&newtio, 9600);
- cfsetospeed(&newtio, 9600);
- ioctl(xf86Info.consoleFd, XCSETA, &newtio);
-
- /* Now tell the keyboard driver to send us raw scancodes */
- if (use_tcs) {
- int nm = orig_getsc;
- nm &= ~KB_XSCANCODE;
- ioctl (xf86Info.consoleFd, TCSETSC, &nm);
- }
-
- if (use_kd)
- ioctl (xf86Info.consoleFd, KDSKBMODE, K_RAW);
-
- ioctl (xf86Info.consoleFd, PIO_KEYMAP, &noledmap);
-
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff(void)
-{
- /* Revert back to original translate scancode mode */
- if (use_tcs)
- ioctl (xf86Info.consoleFd, TCSETSC, &orig_getsc);
- if (use_kd)
- ioctl (xf86Info.consoleFd, KDSKBMODE, orig_kbm);
-
- ioctl (xf86Info.consoleFd, PIO_KEYMAP, &keymap);
-
- if (no_emap)
- ioctl (xf86Info.consoleFd, LDSMAP, sc_mapbuf);
- if (no_nmap)
- ioctl (xf86Info.consoleFd, NMSMAP, sc_mapbuf2);
-
- ioctl(xf86Info.consoleFd, XCSETA, &orig_termios);
-
- return(xf86Info.consoleFd);
-}
diff --git a/hw/xfree86/os-support/sco/sco_kbd.c b/hw/xfree86/os-support/sco/sco_kbd.c
deleted file mode 100644
index 8b1d5b762..000000000
--- a/hw/xfree86/os-support/sco/sco_kbd.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/* $XFree86$ */
-/*
- * Copyright 2005 by J. Kean Johnston <jkj@sco.com>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/* $XConsortium$ */
-
-/*
- * Based on sco_io.c which is
- * (C) Copyright 2003 J. Kean Johnston <jkj@sco.com>
- *
- * Based on lnx_kbd.c which is
- * Copyright (c) 2002 by The XFree86 Project, Inc.
- *
- * Based on the code from lnx_io.c which is
- * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- */
-
-#define NEED_EVENTS
-#include "X.h"
-
-#include "compiler.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86OSpriv.h"
-#include "xf86_OSlib.h"
-
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "sco_kbd.h"
-
-#include <sys/param.h>
-#include <sys/emap.h>
-#include <sys/nmap.h>
-
-static KbdProtocolRec protocols[] = {
- { "standard", PROT_STD },
- { NULL, PROT_UNKNOWN_KBD }
-};
-
-extern Bool VTSwitchEnabled;
-#ifdef USE_VT_SYSREQ
-extern Bool VTSysreqToggle;
-#endif
-
-static void
-SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- if (loudness && pitch) {
- ioctl(pInfo->fd, KIOCSOUND, 1193180 / pitch);
- usleep(duration * loudness * 20);
- ioctl(pInfo->fd, KIOCSOUND, 0);
- }
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- int real_leds = 0;
- static int once = 1;
-
- /*
- * sleep the first time through under SCO. There appears to be a
- * timing problem in the driver which causes the keyboard to be lost.
- * This usleep stops it from occurring. NOTE: this was in the old code.
- * I am not convinced it is true any longer, but it doesn't hurt to
- * leave this in here.
- */
- if (once) {
- usleep(100);
- once = 0;
- }
-
-#ifdef LED_CAP
- if (leds & XLED1)
- real_leds |= LED_CAP;
- if (leds & XLED2)
- real_leds |= LED_NUM;
- if (leds & XLED3)
- real_leds |= LED_SCR;
-#ifdef LED_COMP
- if (leds & XLED4)
- real_leds |= LED_COMP;
-#else
- if (leds & XLED4)
- real_leds |= LED_SCR;
-#endif
-#endif
- ioctl(pInfo->fd, KDSETLED, real_leds);
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- int real_leds, leds = 0;
-
- ioctl(pInfo->fd, KDGETLED, &real_leds);
-
- if (real_leds & LED_CAP) leds |= XLED1;
- if (real_leds & LED_NUM) leds |= XLED2;
- if (real_leds & LED_SCR) leds |= XLED3;
-
- return(leds);
-}
-
-/*
- * NOTE: Only OpenServer Release 5.0.6 with Release Supplement 5.0.6A
- * and later have the required ioctl. 5.0.6A or higher is HIGHLY
- * recommended. The console driver is quite a different beast on that OS.
- */
-#undef rate
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
-#if defined(KBIO_SETRATE)
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- int value = 0x7f; /* Maximum delay with slowest rate */
- int delay = 250; /* Default delay */
- int rate = 300; /* Default repeat rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (pKbd->rate >= 0)
- rate = pKbd->rate * 10;
- if (pKbd->delay >= 0)
- delay = pKbd->delay;
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- ioctl (pInfo->fd, KBIO_SETRATE, value);
-#endif /* defined(KBIO_SETRATE) */
-}
-
-static int
-KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- ScoKbdPrivPtr priv = (ScoKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- priv->use_tcs = 1;
- priv->use_kd = 1;
- priv->no_nmap = 1;
- priv->no_emap = 1;
- priv->orig_getsc = 0;
-
- if (ioctl (pInfo->fd, TCGETSC, &priv->orig_getsc) < 0)
- priv->use_tcs = 0;
- if (ioctl (pInfo->fd, KDGKBMODE, &priv->orig_kbm) < 0)
- priv->use_kd = 0;
-
- if (!priv->use_tcs && !priv->use_kd) {
- xf86Msg (X_ERROR, "KbdInit: Could not determine keyboard mode\n");
- return !Success;
- }
-
- /*
- * One day this should be fixed to translate normal ASCII characters
- * back into scancodes or into events that XFree86 wants, but not
- * now. For the time being, we only support scancode mode screens.
- */
- if (priv->use_tcs && !(priv->orig_getsc & KB_ISSCANCODE)) {
- xf86Msg (X_ERROR, "KbdInit: Keyboard can not send scancodes\n");
- return !Success;
- }
-
- /*
- * We need to get the original keyboard map and NUL out the lock
- * modifiers. This prevents the scancode API from messing with
- * the keyboard LED's. We restore the original map when we exit.
- */
- if (ioctl (pInfo->fd, GIO_KEYMAP, &priv->keymap) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- return !Success;
- }
- if (ioctl (pInfo->fd, GIO_KEYMAP, &priv->noledmap) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- return !Success;
- } else {
- int i, j;
-
- for (i = 0; i < priv->noledmap.n_keys; i++) {
- for (j = 0; j < NUM_STATES; j++) {
- if (IS_SPECIAL(priv->noledmap, i, j) &&
- ((priv->noledmap.key[i].map[j] == K_CLK) ||
- (priv->noledmap.key[i].map[j] == K_NLK) ||
- (priv->noledmap.key[i].map[j] == K_SLK))) {
- priv->noledmap.key[i].map[j] = K_NOP;
- }
- }
- }
- }
-
- if (ioctl (pInfo->fd, XCGETA, &priv->kbdtty) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get terminal modes (%s)\n",
- strerror(errno));
- return !Success;
- }
-
- priv->sc_mapbuf = xalloc (10*BSIZE);
- priv->sc_mapbuf2 = xalloc(10*BSIZE);
-
- /* Get the emap */
- if (ioctl (pInfo->fd, LDGMAP, priv->sc_mapbuf) < 0) {
- if (errno != ENAVAIL) {
- xf86Msg (X_ERROR, "KbdInit: Failed to retrieve e-map (%s)\n",
- strerror (errno));
- return !Success;
- }
- priv->no_emap = 0;
- }
-
- /* Get the nmap */
- if (ioctl (pInfo->fd, NMGMAP, priv->sc_mapbuf2) < 0) {
- if (errno != ENAVAIL) {
- xf86Msg (X_ERROR, "KbdInit: Failed to retrieve n-map (%s)\n",
- strerror (errno));
- return !Success;
- }
- priv->no_nmap = 0;
- }
- } /* End of if we are on a console */
-
- return Success;
-}
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- ScoKbdPrivPtr priv = (ScoKbdPrivPtr) pKbd->private;
- struct termios newtio;
-
- if (pKbd->isConsole) {
- ioctl (pInfo->fd, LDNMAP); /* Turn e-mapping off */
- ioctl (pInfo->fd, NMNMAP); /* Turn n-mapping off */
-
- newtio = priv->kbdtty; /* structure copy */
- newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- newtio.c_oflag = 0;
- newtio.c_cflag = CREAD | CS8 | B9600;
- newtio.c_lflag = 0;
- newtio.c_cc[VTIME]=0;
- newtio.c_cc[VMIN]=1;
- cfsetispeed(&newtio, 9600);
- cfsetospeed(&newtio, 9600);
- ioctl(pInfo->fd, XCSETA, &newtio);
-
- /* Now tell the keyboard driver to send us raw scancodes */
- if (priv->use_tcs) {
- int nm = priv->orig_getsc;
- nm &= ~KB_XSCANCODE;
- ioctl (pInfo->fd, TCSETSC, &nm);
- }
-
- if (priv->use_kd)
- ioctl (pInfo->fd, KDSKBMODE, K_RAW);
-
- ioctl (pInfo->fd, PIO_KEYMAP, &priv->noledmap);
- }
-
- return Success;
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- ScoKbdPrivPtr priv = (ScoKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- /* Revert back to original translate scancode mode */
- if (priv->use_tcs)
- ioctl (pInfo->fd, TCSETSC, &priv->orig_getsc);
- if (priv->use_kd)
- ioctl (pInfo->fd, KDSKBMODE, priv->orig_kbm);
-
- ioctl (pInfo->fd, PIO_KEYMAP, &priv->keymap);
-
- if (priv->no_emap)
- ioctl (pInfo->fd, LDSMAP, priv->sc_mapbuf);
- if (priv->no_nmap)
- ioctl (pInfo->fd, NMSMAP, priv->sc_mapbuf2);
-
- ioctl(pInfo->fd, XCSETA, &priv->kbdtty);
- }
-
- return Success;
-}
-
-static int
-GetSpecialKey(InputInfoPtr pInfo, int scanCode)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int specialkey = scanCode;
-
- if (pKbd->CustomKeycodes) {
- specialkey = pKbd->specialMap->map[scanCode];
- }
- return specialkey;
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static Bool
-SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((!ModifierSet(ShiftMask)) && ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask)))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (down) {
- int sts = key - KEY_F1;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_ACTIVATE, sts);
- }
- return TRUE;
- }
- case KEY_F11:
- case KEY_F12:
- if (down) {
- int sts = key - KEY_F11 + 10;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_ACTIVATE, sts);
- }
- return TRUE;
- }
- }
- }
- }
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (VTSysreqToggle && down) {
- ioctl(pInfo->fd, VT_ACTIVATE, key - KEY_F1);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down) {
- ioctl(pInfo->fd, VT_ACTIVATE, key - KEY_F11 + 10);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
- case KEY_SysReqest:
- if (!(ModifierSet(ShiftMask) || ModifierSet(ControlMask))) {
- if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down)
- VTSysreqToggle = TRUE;
- }
- break;
- default:
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- if (VTSysreqToggle)
- VTSysreqToggle = FALSE;
- }
- }
-#endif /* USE_VT_SYSREQ */
- return FALSE;
-}
-
-static void
-stdReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- unsigned char rBuf[64];
- int nBytes, i;
-
- if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) {
- for (i = 0; i < nBytes; i++) {
- pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, rBuf[i] & 0x80 ? FALSE : TRUE);
- }
- }
-}
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- KbdProtocolId prot = PROT_UNKNOWN_KBD;
- char *s;
-
- s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
- for (i = 0; protocols[i].name; i++) {
- if (xf86NameCmp(s, protocols[i].name) == 0) {
- prot = protocols[i].id;
- break;
- }
- }
-
- switch (prot) {
- case PROT_STD:
- pInfo->read_input = stdReadInput;
- break;
- default:
- xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
- xfree(s);
- return FALSE;
- }
-
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
- xfree(s);
-
- s = xf86SetStrOption(pInfo->options, "Device", NULL);
- if (s == NULL) {
- pInfo->fd = xf86Info.consoleFd;
- pKbd->isConsole = TRUE;
- } else {
- pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
- if (pInfo->fd == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
- xfree(s);
- return FALSE;
- }
- pKbd->isConsole = FALSE;
- xfree(s);
- }
-
- if (pKbd->isConsole)
- pKbd->vtSwitchSupported = TRUE;
-
- return TRUE;
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
- pKbd->GetSpecialKey = GetSpecialKey;
- pKbd->OpenKeyboard = OpenKeyboard;
- pKbd->RemapScanCode = ATScancode;
- pKbd->vtSwitchSupported = FALSE;
-
- pKbd->private = xcalloc(sizeof(ScoKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/sco/sco_kbd.h b/hw/xfree86/os-support/sco/sco_kbd.h
deleted file mode 100644
index a79cd7bb9..000000000
--- a/hw/xfree86/os-support/sco/sco_kbd.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $XFree86$ */
-#ifndef SCO_KBD_HDR
-#define SCO_KBD_HDR
-
-typedef struct {
- int use_tcs;
- int use_kd;
- int no_nmap;
- int no_emap;
- int orig_getsc;
- int orig_kbm;
- struct termios kbdtty;
- keymap_t keymap, noledmap;
- uchar_t *sc_mapbuf;
- uchar_t *sc_mapbuf2;
-} ScoKbdPrivRec, *ScoKbdPrivPtr;
-
-extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
- CARD8 *pModMap);
-#endif /* SCO_KBD_HDR */
diff --git a/hw/xfree86/os-support/shared/at_scancode.c b/hw/xfree86/os-support/shared/at_scancode.c
deleted file mode 100644
index 10d3da2ba..000000000
--- a/hw/xfree86/os-support/shared/at_scancode.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2002-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-
-Bool
-ATScancode(InputInfoPtr pInfo, int *scanCode)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- switch (pKbd->scanPrefix) {
- case 0:
- switch (*scanCode) {
- case KEY_Prefix0:
- case KEY_Prefix1:
- pKbd->scanPrefix = *scanCode; /* special prefixes */
- return TRUE;
- }
- if (!xf86IsPc98()) {
- switch (*scanCode) {
- case 0x59: *scanCode = KEY_0x59; break;
- case 0x5a: *scanCode = KEY_0x5A; break;
- case 0x5b: *scanCode = KEY_0x5B; break;
- case 0x5c: *scanCode = KEY_KP_Equal; break; /* Keypad Equal */
- case 0x5d: *scanCode = KEY_0x5D; break;
- case 0x5e: *scanCode = KEY_0x5E; break;
- case 0x5f: *scanCode = KEY_0x5F; break;
- case 0x62: *scanCode = KEY_0x62; break;
- case 0x63: *scanCode = KEY_0x63; break;
- case 0x64: *scanCode = KEY_0x64; break;
- case 0x65: *scanCode = KEY_0x65; break;
- case 0x66: *scanCode = KEY_0x66; break;
- case 0x67: *scanCode = KEY_0x67; break;
- case 0x68: *scanCode = KEY_0x68; break;
- case 0x69: *scanCode = KEY_0x69; break;
- case 0x6a: *scanCode = KEY_0x6A; break;
- case 0x6b: *scanCode = KEY_0x6B; break;
- case 0x6c: *scanCode = KEY_0x6C; break;
- case 0x6d: *scanCode = KEY_0x6D; break;
- case 0x6e: *scanCode = KEY_0x6E; break;
- case 0x6f: *scanCode = KEY_0x6F; break;
- case 0x70: *scanCode = KEY_0x70; break;
- case 0x71: *scanCode = KEY_0x71; break;
- case 0x72: *scanCode = KEY_0x72; break;
- case 0x73: *scanCode = KEY_0x73; break;
- case 0x74: *scanCode = KEY_0x74; break;
- case 0x75: *scanCode = KEY_0x75; break;
- case 0x76: *scanCode = KEY_0x76; break;
- }
- }
- break;
- case KEY_Prefix0:
- pKbd->scanPrefix = 0;
- switch (*scanCode) {
- case KEY_KP_7: *scanCode = KEY_Home; break; /* curs home */
- case KEY_KP_8: *scanCode = KEY_Up; break; /* curs up */
- case KEY_KP_9: *scanCode = KEY_PgUp; break; /* curs pgup */
- case KEY_KP_4: *scanCode = KEY_Left; break; /* curs left */
- case KEY_KP_5: *scanCode = KEY_Begin; break; /* curs begin */
- case KEY_KP_6: *scanCode = KEY_Right; break; /* curs right */
- case KEY_KP_1: *scanCode = KEY_End; break; /* curs end */
- case KEY_KP_2: *scanCode = KEY_Down; break; /* curs down */
- case KEY_KP_3: *scanCode = KEY_PgDown; break; /* curs pgdown */
- case KEY_KP_0: *scanCode = KEY_Insert; break; /* curs insert */
- case KEY_KP_Decimal: *scanCode = KEY_Delete; break; /* curs delete */
- case KEY_Enter: *scanCode = KEY_KP_Enter; break; /* keypad enter */
- case KEY_LCtrl: *scanCode = KEY_RCtrl; break; /* right ctrl */
- case KEY_KP_Multiply: *scanCode = KEY_Print; break; /* print */
- case KEY_Slash: *scanCode = KEY_KP_Divide; break; /* keyp divide */
- case KEY_Alt: *scanCode = KEY_AltLang; break; /* right alt */
- case KEY_ScrollLock: *scanCode = KEY_Break; break; /* curs break */
- case 0x5b: *scanCode = KEY_LMeta; break;
- case 0x5c: *scanCode = KEY_RMeta; break;
- case 0x5d: *scanCode = KEY_Menu; break;
- case KEY_F3: *scanCode = KEY_F13; break;
- case KEY_F4: *scanCode = KEY_F14; break;
- case KEY_F5: *scanCode = KEY_F15; break;
- case KEY_F6: *scanCode = KEY_F16; break;
- case KEY_F7: *scanCode = KEY_F17; break;
- case KEY_KP_Plus: *scanCode = KEY_KP_DEC; break;
- case 0x2A:
- case 0x36:
- return TRUE;
- default:
- xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n",
- *scanCode);
- *scanCode += 0x78;
- }
- break;
- case KEY_Prefix1:
- pKbd->scanPrefix = (*scanCode == KEY_LCtrl) ? KEY_LCtrl : 0;
- return TRUE;
- case KEY_LCtrl:
- pKbd->scanPrefix = 0;
- if (*scanCode != KEY_NumLock)
- return TRUE;
- *scanCode = KEY_Pause; /* pause */
- }
- return FALSE;
-}
diff --git a/hw/xfree86/os-support/shared/kbd.c b/hw/xfree86/os-support/shared/kbd.c
deleted file mode 100644
index dd6d77d82..000000000
--- a/hw/xfree86/os-support/shared/kbd.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2001-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86OSKbd.h"
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- return FALSE;
-}
diff --git a/hw/xfree86/os-support/shared/std_kbdEv.c b/hw/xfree86/os-support/shared/std_kbdEv.c
deleted file mode 100644
index f56a5fd05..000000000
--- a/hw/xfree86/os-support/shared/std_kbdEv.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Thomas Roell and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Thomas Roell and
- * David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR
- * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XConsortium: std_kbdEv.c /main/4 1996/03/11 10:47:33 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-void
-xf86KbdEvents()
-{
- unsigned char rBuf[64];
- int nBytes, i;
-
- if ((nBytes = read( xf86Info.consoleFd, (char *)rBuf, sizeof(rBuf)))
- > 0)
- {
- for (i = 0; i < nBytes; i++)
- xf86PostKbdEvent(rBuf[i]);
- }
-}
-
diff --git a/hw/xfree86/os-support/shared/sysv_kbd.c b/hw/xfree86/os-support/shared/sysv_kbd.c
deleted file mode 100644
index d7d75191e..000000000
--- a/hw/xfree86/os-support/shared/sysv_kbd.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@XFree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Thomas Roell and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Thomas Roell and
- * David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR
- * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XConsortium: sysv_kbd.c /main/3 1996/02/21 17:53:59 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-int
-xf86GetKbdLeds()
-{
- int leds;
-
- ioctl(xf86Info.consoleFd, KDGETLED, &leds);
- return(leds);
-}
-
-void
-xf86SetKbdRepeat(char rad)
-{
-#ifdef KDSETRAD
- ioctl(xf86Info.consoleFd, KDSETRAD, rad);
-#endif
-}
-
-static int kbdtrans;
-static struct termio kbdtty;
-static char *kbdemap = NULL;
-
-void
-xf86KbdInit()
-{
-#ifdef KDGKBMODE
- ioctl (xf86Info.consoleFd, KDGKBMODE, &kbdtrans);
-#endif
- ioctl (xf86Info.consoleFd, TCGETA, &kbdtty);
-#if defined(E_TABSZ)
- kbdemap = xalloc(E_TABSZ);
- if (ioctl(xf86Info.consoleFd, LDGMAP, kbdemap) < 0)
- {
- xfree(kbdemap);
- kbdemap = NULL;
- }
-#endif
-}
-
-int
-xf86KbdOn()
-{
- struct termio nTty;
-
- ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
- ioctl(xf86Info.consoleFd, LDNMAP, 0); /* disable mapping completely */
- nTty = kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8 | B9600;
- nTty.c_lflag = 0;
- nTty.c_cc[VTIME]=0;
- nTty.c_cc[VMIN]=1;
- ioctl(xf86Info.consoleFd, TCSETA, &nTty);
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff()
-{
- if (kbdemap)
- {
- ioctl(xf86Info.consoleFd, LDSMAP, kbdemap);
- }
- ioctl(xf86Info.consoleFd, KDSKBMODE, kbdtrans);
- ioctl(xf86Info.consoleFd, TCSETA, &kbdtty);
- return(xf86Info.consoleFd);
-}
diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am
index 6b29b3080..291c329ea 100644
--- a/hw/xfree86/os-support/solaris/Makefile.am
+++ b/hw/xfree86/os-support/solaris/Makefile.am
@@ -1,10 +1,6 @@
if SOLARIS_USL_CONSOLE
-IO_SRC = $(srcdir)/../sysv/sysv_io.c
-KBD_SRCS = $(srcdir)/../shared/sysv_kbd.c $(srcdir)/../shared/std_kbdEv.c
VTSW_SRC = $(srcdir)/../shared/VTsw_usl.c
else
-IO_SRC = sun_io.c sun_kbd.h
-KBD_SRCS = sun_kbd.c sun_kbdEv.c sun_kbd.h
VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c
endif
@@ -22,8 +18,8 @@ solaris-$(SOLARIS_INOUT_ARCH).il: solaris-${SOLARIS_INOUT_ARCH}.S
$(CPP) -P -DINLINE_ASM solaris-${SOLARIS_INOUT_ARCH}.S > $@
noinst_LTLIBRARIES = libsolaris.la
-libsolaris_la_SOURCES = sun_bios.c sun_init.c $(IO_SRC) $(KBD_SRCS) \
- sun_mouse.c sun_vid.c $(AGP_SRC) \
+libsolaris_la_SOURCES = sun_bios.c sun_init.c \
+ sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) \
$(srcdir)/../shared/libc_wrapper.c \
$(srcdir)/../shared/kmod_noop.c $(srcdir)/../shared/pm_noop.c \
$(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \
diff --git a/hw/xfree86/os-support/solaris/sun_bell.c b/hw/xfree86/os-support/solaris/sun_bell.c
new file mode 100644
index 000000000..b3a9bfe7e
--- /dev/null
+++ b/hw/xfree86/os-support/solaris/sun_bell.c
@@ -0,0 +1,185 @@
+/* Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <sys/audio.h>
+#include <sys/uio.h>
+#include <limits.h>
+#include <math.h>
+#include <poll.h>
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#define BELL_RATE 48000 /* Samples per second */
+#define BELL_HZ 50 /* Fraction of a second i.e. 1/x */
+#define BELL_MS (1000/BELL_HZ) /* MS */
+#define BELL_SAMPLES (BELL_RATE / BELL_HZ)
+#define BELL_MIN 3 /* Min # of repeats */
+
+#define AUDIO_DEVICE "/dev/audio"
+
+_X_EXPORT int
+xf86OSRingBell(int loudness, int pitch, int duration)
+{
+ static short samples[BELL_SAMPLES];
+ static short silence[BELL_SAMPLES]; /* "The Sound of Silence" */
+ static int lastFreq;
+ int cnt;
+ int i;
+ int written;
+ int repeats;
+ int freq;
+ audio_info_t audioInfo;
+ struct iovec iov[IOV_MAX];
+ int iovcnt;
+ double ampl, cyclen, phase;
+ int audioFD;
+
+ if ((loudness <= 0) || (pitch <= 0) || (duration <= 0)) {
+ return 0;
+ }
+
+ lastFreq = 0;
+ bzero(silence, sizeof(silence));
+
+ audioFD = open(AUDIO_DEVICE, O_WRONLY | O_NONBLOCK);
+ if (audioFD == -1) {
+ xf86Msg(X_ERROR, "Bell: cannot open audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ return -1;
+ }
+
+ freq = pitch;
+ freq = min(freq, (BELL_RATE / 2) - 1);
+ freq = max(freq, 2 * BELL_HZ);
+
+ /*
+ * Ensure full waves per buffer
+ */
+ freq -= freq % BELL_HZ;
+
+ if (freq != lastFreq) {
+ lastFreq = freq;
+ ampl = 16384.0;
+
+ cyclen = (double) freq / (double) BELL_RATE;
+ phase = 0.0;
+
+ for (i = 0; i < BELL_SAMPLES; i++) {
+ samples[i] = (short) (ampl * sin(2.0 * M_PI * phase));
+ phase += cyclen;
+ if (phase >= 1.0)
+ phase -= 1.0;
+ }
+ }
+
+ repeats = (duration + (BELL_MS / 2)) / BELL_MS;
+ repeats = max(repeats, BELL_MIN);
+
+ loudness = max(0, loudness);
+ loudness = min(loudness, 100);
+
+#ifdef DEBUG
+ ErrorF("BELL : freq %d volume %d duration %d repeats %d\n",
+ freq, loudness, duration, repeats);
+#endif
+
+ AUDIO_INITINFO(&audioInfo);
+ audioInfo.play.encoding = AUDIO_ENCODING_LINEAR;
+ audioInfo.play.sample_rate = BELL_RATE;
+ audioInfo.play.channels = 2;
+ audioInfo.play.precision = 16;
+ audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100);
+
+ if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0){
+ xf86Msg(X_ERROR,
+ "Bell: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return -1;
+ }
+
+ iovcnt = 0;
+
+ for (cnt = 0; cnt <= repeats; cnt++) {
+ iov[iovcnt].iov_base = (char *) samples;
+ iov[iovcnt++].iov_len = sizeof(samples);
+ if (cnt == repeats) {
+ /* Insert a bit of silence so that multiple beeps are distinct and
+ * not compressed into a single tone.
+ */
+ iov[iovcnt].iov_base = (char *) silence;
+ iov[iovcnt++].iov_len = sizeof(silence);
+ }
+ if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
+ written = writev(audioFD, iov, iovcnt);
+
+ if ((written < ((int)(sizeof(samples) * iovcnt)))) {
+ /* audio buffer was full! */
+
+ int naptime;
+
+ if (written == -1) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_ERROR,
+ "Bell: writev failed on audio device \"%s\": %s\n",
+ AUDIO_DEVICE, strerror(errno));
+ close(audioFD);
+ return -1;
+ }
+ i = iovcnt;
+ } else {
+ i = ((sizeof(samples) * iovcnt) - written)
+ / sizeof(samples);
+ }
+ cnt -= i;
+
+ /* sleep a little to allow audio buffer to drain */
+ naptime = BELL_MS * i;
+ poll(NULL, 0, naptime);
+
+ i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples);
+ iovcnt = 0;
+ if ((written != -1) && (i > 0)) {
+ iov[iovcnt].iov_base = ((char *) samples) + i;
+ iov[iovcnt++].iov_len = sizeof(samples) - i;
+ }
+ } else {
+ iovcnt = 0;
+ }
+ }
+ }
+
+ close(audioFD);
+ return 0;
+}
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index 691cb3f9e..08d35c59c 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -291,23 +291,6 @@ xf86CloseConsole(void)
#endif /* HAS_USL_VTS */
close(xf86Info.consoleFd);
-
-#if defined(__SOL8__) || !defined(i386)
-
- /*
- * This probably shouldn't be here. However, there is no corresponding
- * xf86CloseKbd() routine - DWH
- */
-
- /* Set the keyboard into "indirect" mode and turn off even translation */
- tmp = 0;
- (void) ioctl(xf86Info.kbdFd, KIOCSDIRECT, &tmp);
- tmp = TR_ASCII;
- (void) ioctl(xf86Info.kbdFd, KIOCTRANS, &tmp);
-
- close(xf86Info.kbdFd);
-
-#endif
}
int
@@ -357,16 +340,6 @@ xf86ProcessArgument(int argc, char **argv, int i)
fb_dev[PATH_MAX - 1] = '\0';
return 2;
}
-
- if (!strcmp(argv[i], "-ar1")) {
- xf86Info.kbdDelay = atoi(argv[i + 1]) * 1000;
- return 2;
- }
-
- if (!strcmp(argv[i], "-ar2")) {
- xf86Info.kbdRate = atoi(argv[i + 1]) * 1000;
- return 2;
- }
}
#endif
@@ -381,10 +354,6 @@ void xf86UseMsg()
#endif
#if defined(__SOL8__) || !defined(i386)
ErrorF("-dev <fb> Framebuffer device\n");
- ErrorF("-ar1 <float> Set autorepeat initiate time (sec)\n");
- ErrorF(" (if not using XKB)\n");
- ErrorF("-ar2 <float> Set autorepeat interval time (sec)\n");
- ErrorF(" (if not using XKB)\n");
#endif
ErrorF("-keeptty Don't detach controlling tty\n");
ErrorF(" (for debugging only)\n");
diff --git a/hw/xfree86/os-support/solaris/sun_io.c b/hw/xfree86/os-support/solaris/sun_io.c
deleted file mode 100644
index 3d8292e72..000000000
--- a/hw/xfree86/os-support/solaris/sun_io.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $XdotOrg: $ */
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Thomas Roell and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Thomas Roell and
- * David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
- * IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, and/or sell copies of the Software, and to permit persons
- * to whom the Software is furnished to do so, provided that the above
- * copyright notice(s) and this permission notice appear in all copies of
- * the Software and that both the above copyright notice(s) and this
- * permission notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder
- * shall not be used in advertising or otherwise to promote the sale, use
- * or other dealings in this Software without prior written authorization
- * of the copyright holder.
- */
-
-/* Solaris support routines for builtin "keyboard" driver */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "sun_kbd.h"
-
-static sunKbdPrivRec sunKeyboardPriv;
-
-_X_HIDDEN void
-xf86KbdInit(void)
-{
- const char *kbdName = "keyboard";
- pointer *kbdOptions = NULL;
- IDevPtr pDev;
-
- /* There should be a better way to find the keyboard device name, but
- this seems to work for now. */
- for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
- if (!xf86NameCmp(pDev->driver, "keyboard")) {
- kbdName = pDev->identifier;
- kbdOptions = pDev->commonOptions;
- break;
- }
- }
-
- if (xf86Info.kbdFd < 0) {
- xf86Info.kbdFd = sunKbdOpen(kbdName, kbdOptions);
- if (xf86Info.kbdFd < 0) {
- FatalError("Unable to open keyboard: /dev/kbd\n");
- }
- }
-
- memset(&sunKeyboardPriv, 0, sizeof(sunKbdPrivRec));
- if (sunKbdInit(&sunKeyboardPriv, xf86Info.kbdFd,
- kbdName, kbdOptions) != Success) {
- FatalError("Unable to initialize keyboard driver\n");
- }
-}
-
-_X_HIDDEN int
-xf86KbdOn(void)
-{
- if (sunKbdOn(&sunKeyboardPriv) != Success) {
- FatalError("Enabling keyboard");
- }
-
- return xf86Info.kbdFd;
-}
-
-_X_HIDDEN int
-xf86KbdOff(void)
-{
- if (sunKbdOff(&sunKeyboardPriv) != Success) {
- FatalError("Disabling keyboard");
- }
-
- return xf86Info.kbdFd;
-}
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- sunKbdSoundBell(&sunKeyboardPriv, loudness, pitch, duration);
-}
-
-_X_HIDDEN void
-xf86SetKbdLeds(int leds)
-{
- sunKbdSetLeds(&sunKeyboardPriv, leds);
-}
-
-_X_HIDDEN int
-xf86GetKbdLeds(void)
-{
- return sunKbdGetLeds(&sunKeyboardPriv);
-}
-
-_X_HIDDEN void
-xf86SetKbdRepeat(char rad)
-{
- sunKbdSetRepeat(&sunKeyboardPriv, rad);
-}
-
-/*
- * Lets try reading more than one keyboard event at a time in the hopes that
- * this will be slightly more efficient. Or we could just try the MicroSoft
- * method, and forget about efficiency. :-)
- */
-_X_HIDDEN void
-xf86KbdEvents(void)
-{
- Firm_event event[64];
- int nBytes, i;
-
- /* I certainly hope its not possible to read partial events */
-
- if ((nBytes = read(xf86Info.kbdFd, (char *)event, sizeof(event))) > 0)
- {
- for (i = 0; i < (nBytes / sizeof(Firm_event)); i++)
- sunPostKbdEvent(sunKeyboardPriv.ktype, &event[i]);
- }
-}
diff --git a/hw/xfree86/os-support/solaris/sun_kbd.c b/hw/xfree86/os-support/solaris/sun_kbd.c
deleted file mode 100644
index 2cb1d13a8..000000000
--- a/hw/xfree86/os-support/solaris/sun_kbd.c
+++ /dev/null
@@ -1,660 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@XFree86.org>
- * Copyright 1999 by David Holland <davidh@iquest.net)
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the names of Thomas Roell, David Dawes, and David Holland not be used
- * in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. Thomas Roell, David Dawes, and
- * David Holland make no representations about the suitability of this software
- * for any purpose. It is provided "as is" without express or implied
- * warranty.
- *
- * THOMAS ROELL, DAVID DAWES, AND DAVID HOLLAND DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS. IN NO EVENT SHALL THOMAS ROELL, DAVID DAWES, OR DAVID HOLLAND
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/* Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, and/or sell copies of the Software, and to permit persons
- * to whom the Software is furnished to do so, provided that the above
- * copyright notice(s) and this permission notice appear in all copies of
- * the Software and that both the above copyright notice(s) and this
- * permission notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder
- * shall not be used in advertising or otherwise to promote the sale, use
- * or other dealings in this Software without prior written authorization
- * of the copyright holder.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86OSKbd.h"
-#include "sun_kbd.h"
-
-/* Define to provide support for using /dev/audio to ring the bell instead of
- the keyboard beeper */
-#define AUDIO_BELL
-
-#ifdef AUDIO_BELL
-#include <sys/audio.h>
-#include <sys/uio.h>
-#include <limits.h>
-#include <math.h>
-#include <poll.h>
-#endif
-
-/***************************************************************************
- * Common implementation of routines shared by "keyboard" driver in sun_io.c
- * and "kbd" driver (later on in this file)
- */
-
-#include <sys/stropts.h>
-#include <sys/vuid_event.h>
-#include <sys/kbd.h>
-
-_X_HIDDEN int
-sunKbdOpen(const char *devName, pointer options)
-{
- int kbdFD;
- const char *kbdPath = NULL;
- const char *defaultKbd = "/dev/kbd";
-
- if (options != NULL) {
- kbdPath = xf86SetStrOption(options, "Device", NULL);
- }
- if (kbdPath == NULL) {
- kbdPath = defaultKbd;
- }
-
- kbdFD = open(kbdPath, O_RDONLY | O_NONBLOCK);
-
- if (kbdFD == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", devName, kbdPath);
- } else {
- xf86MsgVerb(X_INFO, 3, "%s: Opened device \"%s\"\n", devName, kbdPath);
- }
-
- if ((kbdPath != NULL) && (kbdPath != defaultKbd)) {
- xfree(kbdPath);
- }
- return kbdFD;
-}
-
-
-/*
- * Save initial keyboard state. This is called at the start of each server
- * generation.
- */
-
-_X_HIDDEN int
-sunKbdInit(sunKbdPrivPtr priv, int kbdFD, const char *devName, pointer options)
-{
- int ktype, klayout, i;
- const char *ktype_name;
-
- priv->kbdFD = kbdFD;
- priv->devName = devName;
- priv->otranslation = -1;
- priv->odirect = -1;
-
- if (options != NULL) {
- priv->strmod = xf86SetStrOption(options, "StreamsModule", NULL);
- priv->audioDevName = xf86SetStrOption(options, "BellDevice", NULL);
-
- if (priv->audioDevName && (priv->audioDevName[0] == '\0')) {
- xfree(priv->audioDevName);
- priv->audioDevName = NULL;
- }
- } else {
- priv->strmod = NULL;
- priv->audioDevName = NULL;
- }
-
- if (priv->strmod) {
- SYSCALL(i = ioctl(priv->kbdFD, I_PUSH, priv->strmod));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: cannot push module '%s' onto keyboard device: %s\n",
- priv->devName, priv->strmod, strerror(errno));
- }
- }
-
- SYSCALL(i = ioctl(kbdFD, KIOCTYPE, &ktype));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Unable to determine keyboard type: %s\n",
- devName, strerror(errno));
- return BadImplementation;
- }
-
- SYSCALL(i = ioctl(kbdFD, KIOCLAYOUT, &klayout));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Unable to determine keyboard layout: %s\n",
- devName, strerror(errno));
- return BadImplementation;
- }
-
- switch (ktype) {
- case KB_SUN3:
- ktype_name = "Sun Type 3"; break;
- case KB_SUN4:
- ktype_name = "Sun Type 4/5/6"; break;
- case KB_USB:
- ktype_name = "USB"; break;
- case KB_PC:
- ktype_name = "PC"; break;
- default:
- ktype_name = "Unknown"; break;
- }
-
- xf86Msg(X_PROBED, "%s: Keyboard type: %s (%d)\n",
- devName, ktype_name, ktype);
- xf86Msg(X_PROBED, "%s: Keyboard layout: %d\n", devName, klayout);
-
- priv->ktype = ktype;
- priv->keyMap = sunGetKbdMapping(ktype);
- priv->audioState = AB_INITIALIZING;
- priv->oleds = sunKbdGetLeds(priv);
-
- return Success;
-}
-
-_X_HIDDEN int
-sunKbdOn(sunKbdPrivPtr priv)
-{
- int ktrans, kdirect, i;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCGDIRECT, &kdirect));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: Unable to determine keyboard direct setting: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
-
- priv->odirect = kdirect;
- kdirect = 1;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCSDIRECT, &kdirect));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed turning keyboard direct mode on: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
-
- /* Setup translation */
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCGTRANS, &ktrans));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: Unable to determine keyboard translation mode: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
-
- priv->otranslation = ktrans;
- ktrans = TR_UNTRANS_EVENT;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCTRANS, &ktrans));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed setting keyboard translation mode: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
-
- return Success;
-}
-
-_X_HIDDEN int
-sunKbdOff(sunKbdPrivPtr priv)
-{
- int i;
-
- /* restore original state */
-
- sunKbdSetLeds(priv, priv->oleds);
-
- if (priv->otranslation != -1) {
- SYSCALL(i = ioctl(priv->kbdFD, KIOCTRANS, &priv->otranslation));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: Unable to restore keyboard translation mode: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
- priv->otranslation = -1;
- }
-
- if (priv->odirect != -1) {
- SYSCALL(i = ioctl(priv->kbdFD, KIOCSDIRECT, &priv->odirect));
- if (i < 0) {
- xf86Msg(X_ERROR,
- "%s: Unable to restore keyboard direct setting: %s\n",
- priv->devName, strerror(errno));
- return BadImplementation;
- }
- priv->odirect = -1;
- }
-
- if (priv->strmod) {
- SYSCALL(i = ioctl(priv->kbdFD, I_POP, priv->strmod));
- if (i < 0) {
- xf86Msg(X_WARNING,
- "%s: cannot pop module '%s' off keyboard device: %s\n",
- priv->devName, priv->strmod, strerror(errno));
- }
- }
-
- return Success;
-}
-
-#ifdef AUDIO_BELL
-
-/* Helper function to ring bell via audio device instead of keyboard beeper */
-
-#define BELL_RATE 48000 /* Samples per second */
-#define BELL_HZ 50 /* Fraction of a second i.e. 1/x */
-#define BELL_MS (1000/BELL_HZ) /* MS */
-#define BELL_SAMPLES (BELL_RATE / BELL_HZ)
-#define BELL_MIN 3 /* Min # of repeats */
-
-static int
-sunKbdAudioBell(sunKbdPrivPtr priv, int loudness, int pitch, int duration)
-{
- static short samples[BELL_SAMPLES];
- static short silence[BELL_SAMPLES]; /* "The Sound of Silence" */
- static int lastFreq;
- int cnt;
- int i;
- int written;
- int repeats;
- int freq;
- audio_info_t audioInfo;
- struct iovec iov[IOV_MAX];
- int iovcnt;
- double ampl, cyclen, phase;
- int audioFD;
-
- if ((loudness <= 0) || (pitch <= 0) || (duration <= 0)) {
- return 0;
- }
-
- if ((priv == NULL) || (priv->audioDevName == NULL)) {
- return -1;
- }
-
- if (priv->audioState == AB_INITIALIZING) {
- priv->audioState = AB_NORMAL;
- lastFreq = 0;
- bzero(silence, sizeof(silence));
- }
-
- audioFD = open(priv->audioDevName, O_WRONLY | O_NONBLOCK);
- if (audioFD == -1) {
- xf86Msg(X_ERROR, "%s: cannot open audio device \"%s\": %s\n",
- priv->devName, priv->audioDevName, strerror(errno));
- return -1;
- }
-
- freq = pitch;
- freq = min(freq, (BELL_RATE / 2) - 1);
- freq = max(freq, 2 * BELL_HZ);
-
- /*
- * Ensure full waves per buffer
- */
- freq -= freq % BELL_HZ;
-
- if (freq != lastFreq) {
- lastFreq = freq;
- ampl = 16384.0;
-
- cyclen = (double) freq / (double) BELL_RATE;
- phase = 0.0;
-
- for (i = 0; i < BELL_SAMPLES; i++) {
- samples[i] = (short) (ampl * sin(2.0 * M_PI * phase));
- phase += cyclen;
- if (phase >= 1.0)
- phase -= 1.0;
- }
- }
-
- repeats = (duration + (BELL_MS / 2)) / BELL_MS;
- repeats = max(repeats, BELL_MIN);
-
- loudness = max(0, loudness);
- loudness = min(loudness, 100);
-
-#ifdef DEBUG
- ErrorF("BELL : freq %d volume %d duration %d repeats %d\n",
- freq, loudness, duration, repeats);
-#endif
-
- AUDIO_INITINFO(&audioInfo);
- audioInfo.play.encoding = AUDIO_ENCODING_LINEAR;
- audioInfo.play.sample_rate = BELL_RATE;
- audioInfo.play.channels = 2;
- audioInfo.play.precision = 16;
- audioInfo.play.gain = min(AUDIO_MAX_GAIN, AUDIO_MAX_GAIN * loudness / 100);
-
- if (ioctl(audioFD, AUDIO_SETINFO, &audioInfo) < 0){
- xf86Msg(X_ERROR,
- "%s: AUDIO_SETINFO failed on audio device \"%s\": %s\n",
- priv->devName, priv->audioDevName, strerror(errno));
- close(audioFD);
- return -1;
- }
-
- iovcnt = 0;
-
- for (cnt = 0; cnt <= repeats; cnt++) {
- iov[iovcnt].iov_base = (char *) samples;
- iov[iovcnt++].iov_len = sizeof(samples);
- if (cnt == repeats) {
- /* Insert a bit of silence so that multiple beeps are distinct and
- * not compressed into a single tone.
- */
- iov[iovcnt].iov_base = (char *) silence;
- iov[iovcnt++].iov_len = sizeof(silence);
- }
- if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
- written = writev(audioFD, iov, iovcnt);
-
- if ((written < ((int)(sizeof(samples) * iovcnt)))) {
- /* audio buffer was full! */
-
- int naptime;
-
- if (written == -1) {
- if (errno != EAGAIN) {
- xf86Msg(X_ERROR,
- "%s: writev failed on audio device \"%s\": %s\n",
- priv->devName, priv->audioDevName,
- strerror(errno));
- close(audioFD);
- return -1;
- }
- i = iovcnt;
- } else {
- i = ((sizeof(samples) * iovcnt) - written)
- / sizeof(samples);
- }
- cnt -= i;
-
- /* sleep a little to allow audio buffer to drain */
- naptime = BELL_MS * i;
- poll(NULL, 0, naptime);
-
- i = ((sizeof(samples) * iovcnt) - written) % sizeof(samples);
- iovcnt = 0;
- if ((written != -1) && (i > 0)) {
- iov[iovcnt].iov_base = ((char *) samples) + i;
- iov[iovcnt++].iov_len = sizeof(samples) - i;
- }
- } else {
- iovcnt = 0;
- }
- }
- }
-
- close(audioFD);
- return 0;
-}
-
-#endif /* AUDIO_BELL */
-
-_X_HIDDEN void
-sunKbdSoundBell(sunKbdPrivPtr priv, int loudness, int pitch, int duration)
-{
- int kbdCmd, i;
-
- if (loudness && pitch)
- {
-#ifdef AUDIO_BELL
- if (priv->audioDevName != NULL) {
- if (sunKbdAudioBell(priv, loudness, pitch, duration) == 0) {
- return;
- }
- }
-#endif
-
- kbdCmd = KBD_CMD_BELL;
-
- SYSCALL(i = ioctl (priv->kbdFD, KIOCCMD, &kbdCmd));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed to activate bell: %s\n",
- priv->devName, strerror(errno));
- }
-
- usleep(duration * loudness * 20);
-
- kbdCmd = KBD_CMD_NOBELL;
- SYSCALL(i = ioctl (priv->kbdFD, KIOCCMD, &kbdCmd));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed to deactivate bell: %s\n",
- priv->devName, strerror(errno));
- }
- }
-}
-
-_X_HIDDEN void
-sunKbdSetLeds(sunKbdPrivPtr priv, int leds)
-{
- int i;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCSLED, &leds));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed to set keyboard LED's: %s\n",
- priv->devName, strerror(errno));
- }
-}
-
-_X_HIDDEN int
-sunKbdGetLeds(sunKbdPrivPtr priv)
-{
- int i, leds = 0;
-
- SYSCALL(i = ioctl(priv->kbdFD, KIOCGLED, &leds));
- if (i < 0) {
- xf86Msg(X_ERROR, "%s: Failed to get keyboard LED's: %s\n",
- priv->devName, strerror(errno));
- }
- return leds;
-}
-
-/* ARGSUSED0 */
-_X_HIDDEN void
-sunKbdSetRepeat(sunKbdPrivPtr priv, char rad)
-{
- /* Nothing to do */
-}
-
-/***************************************************************************
- * Routines called from "kbd" driver via proc vectors filled in by
- * xf86OSKbdPreInit().
- */
-
-
-static int
-KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- return sunKbdInit(priv, pInfo->fd, pInfo->name, pInfo->options);
-}
-
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- return sunKbdOn(priv);
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- return sunKbdOff(priv);
-}
-
-
-static void
-SoundKbdBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- sunKbdSoundBell(priv, loudness, pitch, duration);
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
- int real_leds = sunKbdGetLeds(priv);
-
- real_leds &= ~(LED_CAPS_LOCK | LED_NUM_LOCK | LED_SCROLL_LOCK | LED_COMPOSE);
-
- if (leds & XLED1) real_leds |= LED_CAPS_LOCK;
- if (leds & XLED2) real_leds |= LED_NUM_LOCK;
- if (leds & XLED3) real_leds |= LED_SCROLL_LOCK;
- if (leds & XLED4) real_leds |= LED_COMPOSE;
-
- sunKbdSetLeds(priv, real_leds);
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
- int leds = 0;
- int real_leds = sunKbdGetLeds(priv);
-
- if (real_leds & LED_CAPS_LOCK) leds |= XLED1;
- if (real_leds & LED_NUM_LOCK) leds |= XLED2;
- if (real_leds & LED_SCROLL_LOCK) leds |= XLED3;
- if (real_leds & LED_COMPOSE) leds |= XLED4;
-
- return leds;
-}
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
-
- sunKbdSetRepeat(priv, rad);
-}
-
-static void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- /* Should probably do something better here */
- xf86KbdGetMapping(pKeySyms, pModMap);
-}
-
-static void
-ReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
- Firm_event event[64];
- int nBytes, i;
-
- /* I certainly hope its not possible to read partial events */
-
- if ((nBytes = read(pInfo->fd, (char *)event, sizeof(event))) > 0)
- {
- for (i = 0; i < (nBytes / sizeof(Firm_event)); i++) {
- pKbd->PostEvent(pInfo, priv->keyMap[event[i].id],
- event[i].value == VKEY_DOWN ? TRUE : FALSE);
- }
- }
-}
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- pInfo->fd = sunKbdOpen(pInfo->name, pInfo->options);
-
- if (pInfo->fd >= 0) {
- pInfo->read_input = ReadInput;
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundKbdBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
-
- pKbd->RemapScanCode = NULL;
- pKbd->GetSpecialKey = NULL;
- pKbd->SpecialKey = NULL;
-
- pKbd->OpenKeyboard = OpenKeyboard;
-
- pKbd->vtSwitchSupported = FALSE;
- pKbd->CustomKeycodes = FALSE;
-
- pKbd->private = xcalloc(sizeof(sunKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- } else {
- sunKbdPrivPtr priv = (sunKbdPrivPtr) pKbd->private;
- priv->otranslation = -1;
- priv->odirect = -1;
- }
-
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/solaris/sun_kbd.h b/hw/xfree86/os-support/solaris/sun_kbd.h
deleted file mode 100644
index ed2824b1f..000000000
--- a/hw/xfree86/os-support/solaris/sun_kbd.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, and/or sell copies of the Software, and to permit persons
- * to whom the Software is furnished to do so, provided that the above
- * copyright notice(s) and this permission notice appear in all copies of
- * the Software and that both the above copyright notice(s) and this
- * permission notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder
- * shall not be used in advertising or otherwise to promote the sale, use
- * or other dealings in this Software without prior written authorization
- * of the copyright holder.
- */
-
-#ifndef _XORG_SUN_KBD_H_
-#define _XORG_SUN_KBD_H_
-
-/*
- * Keyboard common implementation routines shared by "keyboard" driver
- * in sun_io.c and "kbd" driver in sun_kbd.c
- */
-
-typedef struct {
- int kbdFD;
- const char * devName;
- int ktype; /* Keyboard type from KIOCTYPE */
- Bool kbdActive; /* Have we set kbd modes for X? */
- int otranslation; /* Original translation mode */
- int odirect; /* Original "direct" mode setting */
- unsigned char oleds; /* Original LED state */
- const char * strmod; /* Streams module pushed on kbd device */
- const char * audioDevName; /* Audio device path to use for bell
- or NULL to use keyboard beeper */
- enum {AB_INITIALIZING, AB_NORMAL} audioState;
- const unsigned char *keyMap;
-} sunKbdPrivRec, *sunKbdPrivPtr;
-
-/* sun_kbd.c */
-extern int sunKbdOpen (const char *devName, pointer options);
-extern int sunKbdInit (sunKbdPrivPtr priv, int kbdFD,
- const char *devName, pointer options);
-extern int sunKbdOn (sunKbdPrivPtr priv);
-extern int sunKbdOff (sunKbdPrivPtr priv);
-
-extern void sunKbdSoundBell (sunKbdPrivPtr priv,
- int loudness, int pitch, int duration);
-
-extern void sunKbdSetLeds (sunKbdPrivPtr priv, int leds);
-extern int sunKbdGetLeds (sunKbdPrivPtr priv);
-extern void sunKbdSetRepeat (sunKbdPrivPtr priv, char rad);
-
-/* sun_kbdEv.c */
-#include <sys/vuid_event.h>
-extern void sunPostKbdEvent (int ktype, Firm_event *event);
-
-extern const unsigned char *sunGetKbdMapping(int ktype);
-
-#endif
diff --git a/hw/xfree86/os-support/solaris/sun_kbdEv.c b/hw/xfree86/os-support/solaris/sun_kbdEv.c
deleted file mode 100644
index df8b6fac5..000000000
--- a/hw/xfree86/os-support/solaris/sun_kbdEv.c
+++ /dev/null
@@ -1,854 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the names of Thomas Roell and David Dawes not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Thomas Roell and David Dawes make no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
- * IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* [JCH-96/01/21] Extended std reverse map to four buttons. */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "sun_kbd.h"
-
-#ifdef XINPUT
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "xf86Xinput.h"
-#else
-#include "inputstr.h"
-#endif
-
-#include <sys/kbd.h>
-#include "atKeynames.h"
-
-#ifdef XKB
-extern Bool noXkbExtension;
-#endif
-
-#define XE_POINTER 1
-#define XE_KEYBOARD 2
-
-#ifdef XINPUT
-#define ENQUEUE(ev, code, direction, dev_type) \
- (ev)->u.u.detail = (code); \
- (ev)->u.u.type = (direction); \
- xf86eqEnqueue((ev))
-#else
-#define ENQUEUE(ev, code, direction, dev_type) \
- (ev)->u.u.detail = (code); \
- (ev)->u.u.type = (direction); \
- mieqEnqueue((ev))
-#endif
-
-static void startautorepeat(long keycode);
-static CARD32 processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg);
-
-static OsTimerPtr sunTimer = NULL;
-
-/* Map the Solaris keycodes to the "XFree86" keycodes. */
-/*
- * This doesn't seem right. It probably needs to be dependent on a keyboard
- * type.
- */
-
-/* Additional Sun Japanese Keyboard Keys not defined in common/atKeynames.h */
-#define KEY_Kanji 0x82
-#define KEY_Execute 0x83
-
-static unsigned char map[256] = {
-#if defined(i386) || defined(__i386) || defined(__i386__) || defined(__x86)
- KEY_NOTUSED, /* 0 */
- KEY_Tilde, /* 1 */
- KEY_1, /* 2 */
- KEY_2, /* 3 */
- KEY_3, /* 4 */
- KEY_4, /* 5 */
- KEY_5, /* 6 */
- KEY_6, /* 7 */
- KEY_7, /* 8 */
- KEY_8, /* 9 */
- KEY_9, /* 10 */
- KEY_0, /* 11 */
- KEY_Minus, /* 12 */
- KEY_Equal, /* 13 */
- 0x7D, /*KEY_P_YEN*/ /* 14 */
- KEY_BackSpace, /* 15 */
- KEY_Tab, /* 16 */
- KEY_Q, /* 17 */
- KEY_W, /* 18 */
- KEY_E, /* 19 */
- KEY_R, /* 20 */
- KEY_T, /* 21 */
- KEY_Y, /* 22 */
- KEY_U, /* 23 */
- KEY_I, /* 24 */
- KEY_O, /* 25 */
- KEY_P, /* 26 */
- KEY_LBrace, /* 27 */
- KEY_RBrace, /* 28 */
- KEY_BSlash, /* 29 */
- KEY_CapsLock, /* 30 */
- KEY_A, /* 31 */
- KEY_S, /* 32 */
- KEY_D, /* 33 */
- KEY_F, /* 34 */
- KEY_G, /* 35 */
- KEY_H, /* 36 */
- KEY_J, /* 37 */
- KEY_K, /* 38 */
- KEY_L, /* 39 */
- KEY_SemiColon, /* 40 */
- KEY_Quote, /* 41 */
- KEY_UNKNOWN, /* 42 */
- KEY_Enter, /* 43 */
- KEY_ShiftL, /* 44 */
- KEY_Less, /* 45 */
- KEY_Z, /* 46 */
- KEY_X, /* 47 */
- KEY_C, /* 48 */
- KEY_V, /* 49 */
- KEY_B, /* 50 */
- KEY_N, /* 51 */
- KEY_M, /* 52 */
- KEY_Comma, /* 53 */
- KEY_Period, /* 54 */
- KEY_Slash, /* 55 */
- KEY_BSlash2, /* 56 */
- KEY_ShiftR, /* 57 */
- KEY_LCtrl, /* 58 */
- KEY_LMeta, /* 59 */
- KEY_Alt, /* 60 */
- KEY_Space, /* 61 */
- KEY_AltLang, /* 62 */
- KEY_RMeta, /* 63 */
- KEY_RCtrl, /* 64 */
- KEY_Menu, /* 65 */
- KEY_UNKNOWN, /* 66 */
- KEY_UNKNOWN, /* 67 */
- KEY_UNKNOWN, /* 68 */
- KEY_UNKNOWN, /* 69 */
- KEY_UNKNOWN, /* 70 */
- KEY_UNKNOWN, /* 71 */
- KEY_UNKNOWN, /* 72 */
- KEY_UNKNOWN, /* 73 */
- KEY_UNKNOWN, /* 74 */
- KEY_Insert, /* 75 */
- KEY_Delete, /* 76 */
- KEY_UNKNOWN, /* 77 */
- KEY_UNKNOWN, /* 78 */
- KEY_Left, /* 79 */
- KEY_Home, /* 80 */
- KEY_End, /* 81 */
- KEY_UNKNOWN, /* 82 */
- KEY_Up, /* 83 */
- KEY_Down, /* 84 */
- KEY_PgUp, /* 85 */
- KEY_PgDown, /* 86 */
- KEY_UNKNOWN, /* 87 */
- KEY_UNKNOWN, /* 88 */
- KEY_Right, /* 89 */
- KEY_NumLock, /* 90 */
- KEY_KP_7, /* 91 */
- KEY_KP_4, /* 92 */
- KEY_KP_1, /* 93 */
- KEY_UNKNOWN, /* 94 */
- KEY_KP_Divide, /* 95 */
- KEY_KP_8, /* 96 */
- KEY_KP_5, /* 97 */
- KEY_KP_2, /* 98 */
- KEY_KP_0, /* 99 */
- KEY_KP_Multiply, /* 100 */
- KEY_KP_9, /* 101 */
- KEY_KP_6, /* 102 */
- KEY_KP_3, /* 103 */
- KEY_KP_Decimal, /* 104 */
- KEY_KP_Minus, /* 105 */
- KEY_KP_Plus, /* 106 */
- KEY_UNKNOWN, /* 107 */
- KEY_KP_Enter, /* 108 */
- KEY_UNKNOWN, /* 109 */
- KEY_Escape, /* 110 */
- KEY_UNKNOWN, /* 111 */
- KEY_F1, /* 112 */
- KEY_F2, /* 113 */
- KEY_F3, /* 114 */
- KEY_F4, /* 115 */
- KEY_F5, /* 116 */
- KEY_F6, /* 117 */
- KEY_F7, /* 118 */
- KEY_F8, /* 119 */
- KEY_F9, /* 120 */
- KEY_F10, /* 121 */
- KEY_F11, /* 122 */
- KEY_F12, /* 123 */
- KEY_Print, /* 124 */
- KEY_ScrollLock, /* 125 */
- KEY_Pause, /* 126 */
- KEY_UNKNOWN, /* 127 */
- KEY_UNKNOWN, /* 128 */
- KEY_UNKNOWN, /* 129 */
- KEY_UNKNOWN, /* 130 */
- KEY_NFER, /* 131 */
- KEY_XFER, /* 132 */
- KEY_HKTG, /* 133 */
- KEY_UNKNOWN, /* 134 */
-#elif defined(sparc) || defined(__sparc__)
- KEY_UNKNOWN, /* 0x00 */
- KEY_UNKNOWN, /* 0x01 */
- KEY_UNKNOWN, /* 0x02 */
- KEY_UNKNOWN, /* 0x03 */
- KEY_UNKNOWN, /* 0x04 */
- KEY_F1, /* 0x05 */
- KEY_F2, /* 0x06 */
- KEY_F10, /* 0x07 */
- KEY_F3, /* 0x08 */
- KEY_F11, /* 0x09 */
- KEY_F4, /* 0x0A */
- KEY_F12, /* 0x0B */
- KEY_F5, /* 0x0C */
- KEY_UNKNOWN, /* 0x0D */
- KEY_F6, /* 0x0E */
- KEY_UNKNOWN, /* 0x0F */
- KEY_F7, /* 0x10 */
- KEY_F8, /* 0x11 */
- KEY_F9, /* 0x12 */
- KEY_Alt, /* 0x13 */
- KEY_Up, /* 0x14 */
- KEY_Pause, /* 0x15 */
- KEY_SysReqest, /* 0x16 */
- KEY_ScrollLock, /* 0x17 */
- KEY_Left, /* 0x18 */
- KEY_UNKNOWN, /* 0x19 */
- KEY_UNKNOWN, /* 0x1A */
- KEY_Down, /* 0x1B */
- KEY_Right, /* 0x1C */
- KEY_Escape, /* 0x1D */
- KEY_1, /* 0x1E */
- KEY_2, /* 0x1F */
- KEY_3, /* 0x20 */
- KEY_4, /* 0x21 */
- KEY_5, /* 0x22 */
- KEY_6, /* 0x23 */
- KEY_7, /* 0x24 */
- KEY_8, /* 0x25 */
- KEY_9, /* 0x26 */
- KEY_0, /* 0x27 */
- KEY_Minus, /* 0x28 */
- KEY_Equal, /* 0x29 */
- KEY_Tilde, /* 0x2A */
- KEY_BackSpace, /* 0x2B */
- KEY_Insert, /* 0x2C */
- KEY_UNKNOWN, /* 0x2D */
- KEY_KP_Divide, /* 0x2E */
- KEY_KP_Multiply, /* 0x2F */
- KEY_UNKNOWN, /* 0x30 */
- KEY_UNKNOWN, /* 0x31 */
- KEY_KP_Decimal, /* 0x32 */
- KEY_UNKNOWN, /* 0x33 */
- KEY_Home, /* 0x34 */
- KEY_Tab, /* 0x35 */
- KEY_Q, /* 0x36 */
- KEY_W, /* 0x37 */
- KEY_E, /* 0x38 */
- KEY_R, /* 0x39 */
- KEY_T, /* 0x3A */
- KEY_Y, /* 0x3B */
- KEY_U, /* 0x3C */
- KEY_I, /* 0x3D */
- KEY_O, /* 0x3E */
- KEY_P, /* 0x3F */
- KEY_LBrace, /* 0x40 */
- KEY_RBrace, /* 0x41 */
- KEY_Delete, /* 0x42 */
- KEY_UNKNOWN, /* 0x43 */
- KEY_KP_7, /* 0x44 */
- KEY_KP_8, /* 0x45 */
- KEY_KP_9, /* 0x46 */
- KEY_KP_Minus, /* 0x47 */
- KEY_UNKNOWN, /* 0x48 */
- KEY_UNKNOWN, /* 0x49 */
- KEY_End, /* 0x4A */
- KEY_UNKNOWN, /* 0x4B */
- KEY_LCtrl, /* 0x4C */
- KEY_A, /* 0x4D */
- KEY_S, /* 0x4E */
- KEY_D, /* 0x4F */
- KEY_F, /* 0x50 */
- KEY_G, /* 0x51 */
- KEY_H, /* 0x52 */
- KEY_J, /* 0x53 */
- KEY_K, /* 0x54 */
- KEY_L, /* 0x55 */
- KEY_SemiColon, /* 0x56 */
- KEY_Quote, /* 0x57 */
- KEY_BSlash, /* 0x58 */
- KEY_Enter, /* 0x59 */
- KEY_KP_Enter, /* 0x5A */
- KEY_KP_4, /* 0x5B */
- KEY_KP_5, /* 0x5C */
- KEY_KP_6, /* 0x5D */
- KEY_KP_0, /* 0x5E */
- KEY_UNKNOWN, /* 0x5F */
- KEY_PgUp, /* 0x60 */
- KEY_UNKNOWN, /* 0x61 */
- KEY_NumLock, /* 0x62 */
- KEY_ShiftL, /* 0x63 */
- KEY_Z, /* 0x64 */
- KEY_X, /* 0x65 */
- KEY_C, /* 0x66 */
- KEY_V, /* 0x67 */
- KEY_B, /* 0x68 */
- KEY_N, /* 0x69 */
- KEY_M, /* 0x6A */
- KEY_Comma, /* 0x6B */
- KEY_Period, /* 0x6C */
- KEY_Slash, /* 0x6D */
- KEY_ShiftR, /* 0x6E */
- KEY_UNKNOWN, /* 0x6F */
- KEY_KP_1, /* 0x70 */
- KEY_KP_2, /* 0x71 */
- KEY_KP_3, /* 0x72 */
- KEY_UNKNOWN, /* 0x73 */
- KEY_UNKNOWN, /* 0x74 */
- KEY_UNKNOWN, /* 0x75 */
- KEY_UNKNOWN, /* 0x76 */
- KEY_CapsLock, /* 0x77 */
- KEY_LMeta, /* 0x78 */
- KEY_Space, /* 0x79 */
- KEY_RMeta, /* 0x7A */
- KEY_PgDown, /* 0x7B */
- KEY_UNKNOWN, /* 0x7C */
- KEY_KP_Plus, /* 0x7D */
- KEY_UNKNOWN, /* 0x7E */
- KEY_UNKNOWN, /* 0x7F */
-#endif
- /* The rest default to KEY_UNKNOWN */
-};
-
-#if defined(KB_USB)
-static unsigned char usbmap[256] = {
-/*
- * partially taken from ../bsd/bsd_KbdMap.c
- *
- * added keycodes for Sun special keys (left function keys, audio control)
- */
- /* 0 */ KEY_NOTUSED,
- /* 1 */ KEY_NOTUSED,
- /* 2 */ KEY_NOTUSED,
- /* 3 */ KEY_NOTUSED,
- /* 4 */ KEY_A,
- /* 5 */ KEY_B,
- /* 6 */ KEY_C,
- /* 7 */ KEY_D,
- /* 8 */ KEY_E,
- /* 9 */ KEY_F,
- /* 10 */ KEY_G,
- /* 11 */ KEY_H,
- /* 12 */ KEY_I,
- /* 13 */ KEY_J,
- /* 14 */ KEY_K,
- /* 15 */ KEY_L,
- /* 16 */ KEY_M,
- /* 17 */ KEY_N,
- /* 18 */ KEY_O,
- /* 19 */ KEY_P,
- /* 20 */ KEY_Q,
- /* 21 */ KEY_R,
- /* 22 */ KEY_S,
- /* 23 */ KEY_T,
- /* 24 */ KEY_U,
- /* 25 */ KEY_V,
- /* 26 */ KEY_W,
- /* 27 */ KEY_X,
- /* 28 */ KEY_Y,
- /* 29 */ KEY_Z,
- /* 30 */ KEY_1, /* 1 !*/
- /* 31 */ KEY_2, /* 2 @ */
- /* 32 */ KEY_3, /* 3 # */
- /* 33 */ KEY_4, /* 4 $ */
- /* 34 */ KEY_5, /* 5 % */
- /* 35 */ KEY_6, /* 6 ^ */
- /* 36 */ KEY_7, /* 7 & */
- /* 37 */ KEY_8, /* 8 * */
- /* 38 */ KEY_9, /* 9 ( */
- /* 39 */ KEY_0, /* 0 ) */
- /* 40 */ KEY_Enter, /* Return */
- /* 41 */ KEY_Escape, /* Escape */
- /* 42 */ KEY_BackSpace, /* Backspace Delete */
- /* 43 */ KEY_Tab, /* Tab */
- /* 44 */ KEY_Space, /* Space */
- /* 45 */ KEY_Minus, /* - _ */
- /* 46 */ KEY_Equal, /* = + */
- /* 47 */ KEY_LBrace, /* [ { */
- /* 48 */ KEY_RBrace, /* ] } */
- /* 49 */ KEY_BSlash, /* \ | */
- /* 50 */ KEY_BSlash, /* \ _ # ~ on some keyboards */
- /* 51 */ KEY_SemiColon, /* ; : */
- /* 52 */ KEY_Quote, /* ' " */
- /* 53 */ KEY_Tilde, /* ` ~ */
- /* 54 */ KEY_Comma, /* , < */
- /* 55 */ KEY_Period, /* . > */
- /* 56 */ KEY_Slash, /* / ? */
- /* 57 */ KEY_CapsLock, /* Caps Lock */
- /* 58 */ KEY_F1, /* F1 */
- /* 59 */ KEY_F2, /* F2 */
- /* 60 */ KEY_F3, /* F3 */
- /* 61 */ KEY_F4, /* F4 */
- /* 62 */ KEY_F5, /* F5 */
- /* 63 */ KEY_F6, /* F6 */
- /* 64 */ KEY_F7, /* F7 */
- /* 65 */ KEY_F8, /* F8 */
- /* 66 */ KEY_F9, /* F9 */
- /* 67 */ KEY_F10, /* F10 */
- /* 68 */ KEY_F11, /* F11 */
- /* 69 */ KEY_F12, /* F12 */
- /* 70 */ KEY_Print, /* PrintScrn SysReq */
- /* 71 */ KEY_ScrollLock, /* Scroll Lock */
- /* 72 */ KEY_Pause, /* Pause Break */
- /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */
- /* 74 */ KEY_Home, /* Home */
- /* 75 */ KEY_PgUp, /* Page Up */
- /* 76 */ KEY_Delete, /* Delete */
- /* 77 */ KEY_End, /* End */
- /* 78 */ KEY_PgDown, /* Page Down */
- /* 79 */ KEY_Right, /* Right Arrow */
- /* 80 */ KEY_Left, /* Left Arrow */
- /* 81 */ KEY_Down, /* Down Arrow */
- /* 82 */ KEY_Up, /* Up Arrow */
- /* 83 */ KEY_NumLock, /* Num Lock */
- /* 84 */ KEY_KP_Divide, /* Keypad / */
- /* 85 */ KEY_KP_Multiply, /* Keypad * */
- /* 86 */ KEY_KP_Minus, /* Keypad - */
- /* 87 */ KEY_KP_Plus, /* Keypad + */
- /* 88 */ KEY_KP_Enter, /* Keypad Enter */
- /* 89 */ KEY_KP_1, /* Keypad 1 End */
- /* 90 */ KEY_KP_2, /* Keypad 2 Down */
- /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */
- /* 92 */ KEY_KP_4, /* Keypad 4 Left */
- /* 93 */ KEY_KP_5, /* Keypad 5 */
- /* 94 */ KEY_KP_6, /* Keypad 6 */
- /* 95 */ KEY_KP_7, /* Keypad 7 Home */
- /* 96 */ KEY_KP_8, /* Keypad 8 Up */
- /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */
- /* 98 */ KEY_KP_0, /* Keypad 0 Ins */
- /* 99 */ KEY_KP_Decimal, /* Keypad . Del */
- /* 100 */ KEY_Less, /* < > on some keyboards */
- /* 101 */ KEY_Menu, /* Menu */
- /* 102 */ KEY_Power, /* Sun: Power */
- /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */
- /* 104 */ KEY_NOTUSED,
- /* 105 */ KEY_NOTUSED,
- /* 106 */ KEY_NOTUSED,
- /* 107 */ KEY_NOTUSED,
- /* 108 */ KEY_NOTUSED,
- /* 109 */ KEY_NOTUSED,
- /* 110 */ KEY_NOTUSED,
- /* 111 */ KEY_NOTUSED,
- /* 112 */ KEY_NOTUSED,
- /* 113 */ KEY_NOTUSED,
- /* 114 */ KEY_NOTUSED,
- /* 115 */ KEY_NOTUSED,
- /* 116 */ KEY_L7, /* Sun: Open */
- /* 117 */ KEY_Help, /* Sun: Help */
- /* 118 */ KEY_L3, /* Sun: Props */
- /* 119 */ KEY_L5, /* Sun: Front */
- /* 120 */ KEY_L1, /* Sun: Stop */
- /* 121 */ KEY_L2, /* Sun: Again */
- /* 122 */ KEY_L4, /* Sun: Undo */
- /* 123 */ KEY_L10, /* Sun: Cut */
- /* 124 */ KEY_L6, /* Sun: Copy */
- /* 125 */ KEY_L8, /* Sun: Paste */
- /* 126 */ KEY_L9, /* Sun: Find */
- /* 127 */ KEY_Mute, /* Sun: AudioMute */
- /* 128 */ KEY_AudioRaise, /* Sun: AudioRaise */
- /* 129 */ KEY_AudioLower, /* Sun: AudioLower */
- /* 130 */ KEY_NOTUSED,
- /* 131 */ KEY_NOTUSED,
- /* 132 */ KEY_NOTUSED,
- /* 133 */ KEY_NOTUSED,
- /* 134 */ KEY_NOTUSED,
- /* 135 */ KEY_BSlash2, /* Sun Japanese Kbd: Backslash / Underscore */
- /* 136 */ KEY_XFER, /* Sun Japanese Kbd: Henkan Mode */
- /* 137 */ KEY_Yen, /* Sun Japanese Kbd: Yen / Brokenbar */
- /* 138 */ KEY_Kanji, /* Sun Japanese Kbd: Kanji */
- /* 139 */ KEY_Execute, /* Sun Japanese Kbd: Execute */
- /* 140 */ KEY_NOTUSED,
- /* 141 */ KEY_NOTUSED,
- /* 142 */ KEY_NOTUSED,
- /* 143 */ KEY_NOTUSED,
- /* 144 */ KEY_NOTUSED,
- /* 145 */ KEY_NOTUSED,
- /* 146 */ KEY_NOTUSED,
- /* 147 */ KEY_NOTUSED,
- /* 148 */ KEY_NOTUSED,
- /* 149 */ KEY_NOTUSED,
- /* 150 */ KEY_NOTUSED,
- /* 151 */ KEY_NOTUSED,
- /* 152 */ KEY_NOTUSED,
- /* 153 */ KEY_NOTUSED,
- /* 154 */ KEY_NOTUSED,
- /* 155 */ KEY_NOTUSED,
- /* 156 */ KEY_NOTUSED,
- /* 157 */ KEY_NOTUSED,
- /* 158 */ KEY_NOTUSED,
- /* 159 */ KEY_NOTUSED,
- /* 160 */ KEY_NOTUSED,
- /* 161 */ KEY_NOTUSED,
- /* 162 */ KEY_NOTUSED,
- /* 163 */ KEY_NOTUSED,
- /* 164 */ KEY_NOTUSED,
- /* 165 */ KEY_NOTUSED,
- /* 166 */ KEY_NOTUSED,
- /* 167 */ KEY_NOTUSED,
- /* 168 */ KEY_NOTUSED,
- /* 169 */ KEY_NOTUSED,
- /* 170 */ KEY_NOTUSED,
- /* 171 */ KEY_NOTUSED,
- /* 172 */ KEY_NOTUSED,
- /* 173 */ KEY_NOTUSED,
- /* 174 */ KEY_NOTUSED,
- /* 175 */ KEY_NOTUSED,
- /* 176 */ KEY_NOTUSED,
- /* 177 */ KEY_NOTUSED,
- /* 178 */ KEY_NOTUSED,
- /* 179 */ KEY_NOTUSED,
- /* 180 */ KEY_NOTUSED,
- /* 181 */ KEY_NOTUSED,
- /* 182 */ KEY_NOTUSED,
- /* 183 */ KEY_NOTUSED,
- /* 184 */ KEY_NOTUSED,
- /* 185 */ KEY_NOTUSED,
- /* 186 */ KEY_NOTUSED,
- /* 187 */ KEY_NOTUSED,
- /* 188 */ KEY_NOTUSED,
- /* 189 */ KEY_NOTUSED,
- /* 190 */ KEY_NOTUSED,
- /* 191 */ KEY_NOTUSED,
- /* 192 */ KEY_NOTUSED,
- /* 193 */ KEY_NOTUSED,
- /* 194 */ KEY_NOTUSED,
- /* 195 */ KEY_NOTUSED,
- /* 196 */ KEY_NOTUSED,
- /* 197 */ KEY_NOTUSED,
- /* 198 */ KEY_NOTUSED,
- /* 199 */ KEY_NOTUSED,
- /* 200 */ KEY_NOTUSED,
- /* 201 */ KEY_NOTUSED,
- /* 202 */ KEY_NOTUSED,
- /* 203 */ KEY_NOTUSED,
- /* 204 */ KEY_NOTUSED,
- /* 205 */ KEY_NOTUSED,
- /* 206 */ KEY_NOTUSED,
- /* 207 */ KEY_NOTUSED,
- /* 208 */ KEY_NOTUSED,
- /* 209 */ KEY_NOTUSED,
- /* 210 */ KEY_NOTUSED,
- /* 211 */ KEY_NOTUSED,
- /* 212 */ KEY_NOTUSED,
- /* 213 */ KEY_NOTUSED,
- /* 214 */ KEY_NOTUSED,
- /* 215 */ KEY_NOTUSED,
- /* 216 */ KEY_NOTUSED,
- /* 217 */ KEY_NOTUSED,
- /* 218 */ KEY_NOTUSED,
- /* 219 */ KEY_NOTUSED,
- /* 220 */ KEY_NOTUSED,
- /* 221 */ KEY_NOTUSED,
- /* 222 */ KEY_NOTUSED,
- /* 223 */ KEY_NOTUSED,
- /* 224 */ KEY_LCtrl, /* Left Control */
- /* 225 */ KEY_ShiftL, /* Left Shift */
- /* 226 */ KEY_Alt, /* Left Alt */
- /* 227 */ KEY_LMeta, /* Left Meta */
- /* 228 */ KEY_RCtrl, /* Right Control */
- /* 229 */ KEY_ShiftR, /* Right Shift */
- /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
- /* 231 */ KEY_RMeta, /* Right Meta */
-};
-
-#endif /* KB_USB */
-
-_X_HIDDEN const unsigned char *
-sunGetKbdMapping(int ktype) {
-#if defined(KB_USB)
- if (ktype == KB_USB)
- return usbmap;
- else
-#endif
- return map;
-}
-
-
-/*
- * sunPostKbdEvent --
- * Translate the raw hardware Firm_event into an XEvent, and tell DIX
- * about it. KeyCode preprocessing and so on is done ...
- *
- * Most of the Solaris stuff has whacked Panix/PC98 support in the
- * interests of simplicity - DWH 8/30/99
- */
-
-_X_HIDDEN void
-sunPostKbdEvent(int sun_ktype, Firm_event *event)
-{
- Bool down;
- KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key;
- Bool updateLeds = FALSE;
- xEvent kevent;
- KeySym *keysym;
- int keycode;
- static int lockkeys = 0;
-
- /* Give down a value */
- if (event->value == VKEY_DOWN)
- down = TRUE;
- else
- down = FALSE;
-
-
-#if defined(KB_USB)
- if(sun_ktype == KB_USB)
- keycode = usbmap[event->id];
- else
-#endif
- keycode = map[event->id];
-
- /*
- * and now get some special keysequences
- */
-
-#ifdef XKB
- if (((xf86Info.ddxSpecialKeys == SKWhenNeeded) &&
- (!xf86Info.ActionKeyBindingsSet)) ||
- noXkbExtension || (xf86Info.ddxSpecialKeys == SKAlways))
-#endif
- {
- if (!(ModifierDown(ShiftMask)) &&
- ((ModifierDown(ControlMask | AltMask)) ||
- (ModifierDown(ControlMask | AltLangMask))))
- {
- switch (keycode) {
- /*
- * The idea here is to pass the scancode down to a list of
- * registered routines. There should be some standard conventions
- * for processing certain keys.
- */
- case KEY_BackSpace:
- xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
- break;
-
- /*
- * Check grabs
- */
- case KEY_KP_Divide:
- xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
- break;
- case KEY_KP_Multiply:
- xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
- break;
-
- /*
- * Video mode switches
- */
- case KEY_KP_Minus: /* Keypad - */
- if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
-
- case KEY_KP_Plus: /* Keypad + */
- if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
- if (!xf86Info.dontZoom) return;
- break;
- }
- }
- }
-
- /*
- * Now map the scancodes to real X-keycodes ...
- */
- if (keycode == KEY_NOTUSED) {
- xf86MsgVerb(X_INFO, 0,
- "raw code %d mapped to KEY_NOTUSED -- please report\n", event->id);
- return;
- }
- if (keycode == KEY_UNKNOWN) {
- xf86MsgVerb(X_INFO, 0,
- "raw code %d mapped to KEY_UNKNOWN -- please report\n", event->id);
- return;
- }
- keycode += MIN_KEYCODE;
- keysym = keyc->curKeySyms.map +
- (keyc->curKeySyms.mapWidth *
- (keycode - keyc->curKeySyms.minKeyCode));
-
-#ifdef XKB
- if (noXkbExtension)
-#endif
- {
- /*
- * Toggle lock keys.
- */
-#define CAPSFLAG 0x01
-#define NUMFLAG 0x02
-#define SCROLLFLAG 0x04
-#define MODEFLAG 0x08
-
- if (down) {
- /*
- * Handle the KeyPresses of the lock keys.
- */
-
- switch (keysym[0]) {
-
- case XK_Caps_Lock:
- if (lockkeys & CAPSFLAG) {
- lockkeys &= ~CAPSFLAG;
- return;
- }
- lockkeys |= CAPSFLAG;
- updateLeds = TRUE;
- xf86Info.capsLock = down;
- break;
-
- case XK_Num_Lock:
- if (lockkeys & NUMFLAG) {
- lockkeys &= ~NUMFLAG;
- return;
- }
- lockkeys |= NUMFLAG;
- updateLeds = TRUE;
- xf86Info.numLock = down;
- break;
-
- case XK_Scroll_Lock:
- if (lockkeys & SCROLLFLAG) {
- lockkeys &= ~SCROLLFLAG;
- return;
- }
- lockkeys |= SCROLLFLAG;
- updateLeds = TRUE;
- xf86Info.scrollLock = down;
- break;
- }
- } else {
- /*
- * Handle the releases of the lock keys.
- */
-
- switch (keysym[0]) {
-
- case XK_Caps_Lock:
- if (lockkeys & CAPSFLAG)
- return;
- updateLeds = TRUE;
- xf86Info.capsLock = down;
- break;
-
- case XK_Num_Lock:
- if (lockkeys & NUMFLAG)
- return;
- updateLeds = TRUE;
- xf86Info.numLock = down;
- break;
-
- case XK_Scroll_Lock:
- if (lockkeys & SCROLLFLAG)
- return;
- updateLeds = TRUE;
- xf86Info.scrollLock = down;
- break;
- }
- }
-
- if (updateLeds)
- xf86KbdLeds();
-
- /*
- * If this keycode is not a modifier key, and its down initiate the
- * autorepeate sequence. (Only necessary if not using XKB).
- *
- * If its not down, then reset the timer.
- */
- if (!keyc->modifierMap[keycode]) {
- if (down) {
- startautorepeat(keycode);
- } else {
- TimerFree(sunTimer);
- sunTimer = NULL;
- }
- }
- }
-
- xf86Info.lastEventTime =
- kevent.u.keyButtonPointer.time =
- GetTimeInMillis();
-
- /*
- * And now send these prefixes ...
- * NOTE: There cannot be multiple Mode_Switch keys !!!!
- */
-
- ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
-}
-
-
-
-/*
- * Autorepeat stuff
- */
-
-void
-startautorepeat(long keycode)
-{
- sunTimer = TimerSet(sunTimer, /* Timer */
- 0, /* Flags */
- xf86Info.kbdDelay, /* millis */
- processautorepeat, /* callback */
- (pointer) keycode); /* arg for timer */
-}
-
-CARD32
-processautorepeat(OsTimerPtr timer, CARD32 now, pointer arg)
-{
- xEvent kevent;
- int keycode;
-
- keycode = (long)arg;
-
- xf86Info.lastEventTime =
- kevent.u.keyButtonPointer.time =
- GetTimeInMillis();
-
- /*
- * Repeat a key by faking a KeyRelease, and a KeyPress event in rapid
- * succession
- */
-
- ENQUEUE(&kevent, keycode, KeyRelease, XE_KEYBOARD);
- ENQUEUE(&kevent, keycode, KeyPress, XE_KEYBOARD);
-
- /* And return the appropriate value so we get rescheduled */
- return xf86Info.kbdRate;
-}
diff --git a/hw/xfree86/os-support/sysv/Makefile.am b/hw/xfree86/os-support/sysv/Makefile.am
index b67cf99d9..f9d2f237a 100644
--- a/hw/xfree86/os-support/sysv/Makefile.am
+++ b/hw/xfree86/os-support/sysv/Makefile.am
@@ -1 +1 @@
-EXTRA_DIST = sysv_init.c sysv_io.c sysv_mouse.c sysv_video.c xqueue.c xqueue.h
+EXTRA_DIST = sysv_init.c sysv_mouse.c sysv_video.c
diff --git a/hw/xfree86/os-support/sysv/sysv_io.c b/hw/xfree86/os-support/sysv/sysv_io.c
deleted file mode 100644
index d6c8ca037..000000000
--- a/hw/xfree86/os-support/sysv/sysv_io.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Thomas Roell and David Dawes
- * not be used in advertising or publicity pertaining to distribution of
- * the software without specific, written prior permission. Thomas Roell and
- * David Dawes makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * THOMAS ROELL AND DAVID DAWES DISCLAIMS ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES BE LIABLE FOR
- * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XConsortium: sysv_io.c /main/8 1996/10/19 18:08:06 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch)
- {
-#ifdef KDMKTONE
- /*
- * If we have KDMKTONE use it to avoid putting the server
- * to sleep
- */
- ioctl(xf86Info.consoleFd, KDMKTONE,
- ((1193190 / pitch) & 0xffff) |
- (((unsigned long)duration *
- loudness / 50) << 16));
-#else
- ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
- usleep(xf86Info.bell_duration * loudness * 20);
- ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
-#endif
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
-#ifdef KBIO_SETMODE
- ioctl(xf86Info.consoleFd, KBIO_SETMODE, KBM_AT);
- ioctl(xf86Info.consoleFd, KDSETLED, leds);
- ioctl(xf86Info.consoleFd, KBIO_SETMODE, KBM_XT);
-#endif
-}
-
-#include "xf86OSKbd.h"
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- return FALSE;
-}
diff --git a/hw/xfree86/os-support/sysv/sysv_mouse.c b/hw/xfree86/os-support/sysv/sysv_mouse.c
index 581ed58e8..e62010515 100644
--- a/hw/xfree86/os-support/sysv/sysv_mouse.c
+++ b/hw/xfree86/os-support/sysv/sysv_mouse.c
@@ -11,7 +11,6 @@
#include "xf86.h"
#include "xf86Xinput.h"
#include "xf86OSmouse.h"
-#include "xqueue.h"
static int
SupportedInterfaces(void)
@@ -22,7 +21,6 @@ SupportedInterfaces(void)
#ifndef ISC
static const char *internalNames[] = {
- "Xqueue",
NULL
};
@@ -56,7 +54,6 @@ xf86OSMouseInit(int flags)
#ifndef ISC
p->BuiltinNames = BuiltinNames;
p->CheckProtocol = CheckProtocol;
- p->PreInit = XqueueMousePreInit;
#endif
return p;
}
diff --git a/hw/xfree86/os-support/sysv/xqueue.c b/hw/xfree86/os-support/sysv/xqueue.c
deleted file mode 100644
index f0032111f..000000000
--- a/hw/xfree86/os-support/sysv/xqueue.c
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993-1999 by The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holders make no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XConsortium: xqueue.c /main/8 1996/10/19 18:08:11 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSmouse.h"
-#include "xqueue.h"
-
-#ifdef XQUEUE
-
-static xqEventQueue *XqueQaddr;
-static int xqueFd = -1;
-#ifndef XQUEUE_ASYNC
-static int xquePipe[2];
-#endif
-
-#ifdef XKB
-#include "inputstr.h"
-#include <X11/extensions/XKB.h>
-#include <X11/extensions/XKBstr.h>
-#include <X11/extensions/XKBsrv.h>
-extern Bool noXkbExtension;
-#endif
-
-#include "xf86Xinput.h"
-#include "mipointer.h"
-
-typedef struct {
- int xquePending;
- int xqueSema;
-} XqInfoRec, *XqInfoPtr;
-
-InputInfoPtr XqMouse = NULL;
-InputInfoPtr XqKeyboard = NULL;
-
-#ifndef XQUEUE_ASYNC
-/*
- * xf86XqueSignal --
- * Trap the signal from xqueue and let it be known that events are
- * ready for collection
- */
-
-static void
-xf86XqueSignal(int signum)
-{
- ((XqInfoPtr)(((MouseDevPtr)(XqMouse->private))->mousePriv))->xquePending = 1;
- /*
- * This is a hack, but it is the only reliable way I can find of letting
- * the main select() loop know that there is more input waiting. Receiving
- * a signal will interrupt select(), but there is no way I can find of
- * dealing with events that come in between the end of processing the
- * last set and when select() gets called.
- *
- * Suggestions for better ways of dealing with this without going back to
- * asynchronous event processing are welcome.
- */
-#ifdef DEBUG
- ErrorF("xf86XqueSignal\n");
-#endif
- write(xquePipe[1], "X", 1);
- signal(SIGUSR2, xf86XqueSignal);
-}
-#endif
-
-
-/*
- * xf86XqueKbdProc --
- * Handle the initialization, etc. of a keyboard.
- */
-
-int
-xf86XqueKbdProc(DeviceIntPtr pKeyboard, int what)
-{
- KeySymsRec keySyms;
- CARD8 modMap[MAP_LENGTH];
-
- switch (what) {
-
- case DEVICE_INIT:
-
- xf86KbdGetMapping(&keySyms, modMap);
-
- /*
- * Get also the initial led settings
- */
- ioctl(xf86Info.consoleFd, KDGETLED, &xf86Info.leds);
-
- /*
- * Perform final initialization of the system private keyboard
- * structure and fill in various slots in the device record
- * itself which couldn't be filled in before.
- */
- pKeyboard->public.on = FALSE;
-
-#ifdef XKB
- if (noXkbExtension) {
-#endif
- InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
-#ifdef XKB
- } else {
- XkbComponentNamesRec names;
- if (xf86Info.xkbkeymap) {
- names.keymap = xf86Info.xkbkeymap;
- names.keycodes = NULL;
- names.types = NULL;
- names.compat = NULL;
- names.symbols = NULL;
- names.geometry = NULL;
- } else {
- names.keymap = NULL;
- names.keycodes = xf86Info.xkbkeycodes;
- names.types = xf86Info.xkbtypes;
- names.compat = xf86Info.xkbcompat;
- names.symbols = xf86Info.xkbsymbols;
- names.geometry = xf86Info.xkbgeometry;
- }
- if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified)
- && (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) {
- xf86Info.xkbrules = NULL;
- }
- XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel,
- xf86Info.xkblayout, xf86Info.xkbvariant,
- xf86Info.xkboptions);
- XkbInitKeyboardDeviceStruct(pKeyboard,
- &names,
- &keySyms,
- modMap,
- xf86KbdBell,
- (KbdCtrlProcPtr)xf86KbdCtrl);
- }
-#endif
-
- xf86InitKBD(TRUE);
- break;
-
- case DEVICE_ON:
- pKeyboard->public.on = TRUE;
- xf86InitKBD(FALSE);
- break;
-
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pKeyboard->public.on = FALSE;
- break;
- }
-
- return (Success);
-}
-
-
-/*
- * xf86XqueEvents --
- * Get some events from our queue. Nothing to do here ...
- */
-
-void
-xf86XqueEvents()
-{
-}
-
-
-#ifdef XQUEUE_ASYNC
-static void XqDoInput(int signum);
-#endif
-
-void
-XqReadInput(InputInfoPtr pInfo)
-{
- MouseDevPtr pMse;
- XqInfoPtr pXq;
- xqEvent *XqueEvents;
- int XqueHead;
- char buf[100];
- signed char dx, dy;
-
- if (xqueFd < 0)
- return;
-
- pMse = pInfo->private;
- pXq = pMse->mousePriv;
-
- XqueEvents = XqueQaddr->xq_events;
- XqueHead = XqueQaddr->xq_head;
-
- while (XqueHead != XqueQaddr->xq_tail) {
- switch (XqueEvents[XqueHead].xq_type) {
- case XQ_BUTTON:
- pMse->PostEvent(pInfo, ~(XqueEvents[XqueHead].xq_code) & 0x07,
- 0, 0, 0, 0);
-#ifdef DEBUG
- ErrorF("xqueue: buttons: %d\n", ~(XqueEvents[XqueHead].xq_code) & 0x07);
-#endif
- break;
-
- case XQ_MOTION:
- dx = (signed char)XqueEvents[XqueHead].xq_x;
- dy = (signed char)XqueEvents[XqueHead].xq_y;
- pMse->PostEvent(pInfo, ~(XqueEvents[XqueHead].xq_code) & 0x07,
- (int)dx, (int)dy, 0, 0);
-#ifdef DEBUG
- ErrorF("xqueue: Motion: (%d, %d) (buttons: %d)\n", dx, dy, ~(XqueEvents[XqueHead].xq_code) & 0x07);
-#endif
- break;
-
- case XQ_KEY:
- /* XXX Need to deal with the keyboard part nicely. */
-#ifdef DEBUG
- ErrorF("xqueue: key: %d\n", XqueEvents[XqueHead].xq_code);
-#endif
- xf86PostKbdEvent(XqueEvents[XqueHead].xq_code);
- break;
- default:
- xf86Msg(X_WARNING, "Unknown Xque Event: 0x%02x\n",
- XqueEvents[XqueHead].xq_type);
- }
-
- if ((++XqueHead) == XqueQaddr->xq_size) XqueHead = 0;
- xf86Info.inputPending = TRUE;
- }
-
- /* reenable the signal-processing */
-#ifdef XQUEUE_ASYNC
- signal(SIGUSR2, XqDoInput);
-#endif
-
-#ifndef XQUEUE_ASYNC
- {
- int rval;
-
- while ((rval = read(xquePipe[0], buf, sizeof(buf))) > 0)
-#ifdef DEBUG
- ErrorF("Read %d bytes from xquePipe[0]\n", rval);
-#else
- ;
-#endif
- }
-#endif
-
-#ifdef DEBUG
- ErrorF("Leaving XqReadInput()\n");
-#endif
- pXq->xquePending = 0;
- XqueQaddr->xq_head = XqueQaddr->xq_tail;
- XqueQaddr->xq_sigenable = 1; /* UNLOCK */
-}
-
-#ifdef XQUEUE_ASYNC
-static void
-XqDoInput(int signum)
-{
- if (XqMouse)
- XqReadInput(XqMouse);
-}
-#endif
-
-static void
-XqBlock(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
-{
- InputInfoPtr pInfo;
- MouseDevPtr pMse;
- XqInfoPtr pXq;
- /*
- * On MP SVR4 boxes, a race condition exists because the XQUEUE does
- * not have anyway to lock it for exclusive access. This results in one
- * processor putting something on the queue at the same time the other
- * processor is taking it something off. The count of items in the queue
- * can get off by 1. This just goes and checks to see if an extra event
- * was put in the queue a during this period. The signal for this event
- * was ignored while processing the previous event.
- */
-
- pInfo = blockData;
- pMse = pInfo->private;
- pXq = pMse-> mousePriv;
- if (!pXq->xquePending) {
-#ifdef DEBUG
- ErrorF("XqBlock: calling XqReadInput()\n");
-#endif
- XqReadInput((InputInfoPtr)blockData);
- } else {
-#ifdef DEBUG
- ErrorF("XqBlock: not calling XqReadInput()\n");
-#endif
- ;
- }
- /*
- * Make sure that any events that come in here are passed on without.
- * waiting for the next wakeup.
- */
- if (xf86Info.inputPending) {
-#ifdef DEBUG
- ErrorF("XqBlock: calling ProcessInputEvents()\n");
-#endif
- ProcessInputEvents();
- } else {
-#ifdef DEBUG
- ErrorF("XqBlock: not calling ProcessInputEvents()\n");
-#endif
- ;
- }
-}
-
-/*
- * XqEnable --
- * Enable the handling of the Xque
- */
-
-static int
-XqEnable(InputInfoPtr pInfo)
-{
- MouseDevPtr pMse;
- XqInfoPtr pXq;
- static struct kd_quemode xqueMode;
- static Bool was_here = FALSE;
-
- pMse = pInfo->private;
- pXq = pMse->mousePriv;
-
- if (xqueFd < 0) {
- if ((xqueFd = open("/dev/mouse", O_RDONLY | O_NDELAY)) < 0) {
- if (xf86GetAllowMouseOpenFail()) {
- xf86Msg(X_WARNING,
- "%s: Cannot open /dev/mouse (%s) - Continuing...\n",
- pInfo->name, strerror(errno));
- return Success;
- } else {
- xf86Msg(X_ERROR, "%s: Cannot open /dev/mouse (%s)\n",
- pInfo->name, strerror(errno));
- return !Success;
- }
- }
- }
-#ifndef XQUEUE_ASYNC
- if (!was_here) {
- pipe(xquePipe);
- fcntl(xquePipe[0], F_SETFL, fcntl(xquePipe[0], F_GETFL, 0) | O_NDELAY);
- fcntl(xquePipe[1], F_SETFL, fcntl(xquePipe[1], F_GETFL, 0) | O_NDELAY);
- was_here = TRUE;
- }
-#endif
-
- if (pXq->xqueSema++ == 0) {
-#ifdef XQUEUE_ASYNC
- (void) signal(SIGUSR2, XqDoInput);
-#else
- (void) signal(SIGUSR2, xf86XqueSignal);
-#endif
- xqueMode.qsize = 64; /* max events */
- xqueMode.signo = SIGUSR2;
- ioctl(xf86Info.consoleFd, KDQUEMODE, NULL);
-
- if (ioctl(xf86Info.consoleFd, KDQUEMODE, &xqueMode) < 0) {
- xf86Msg(X_ERROR, "%s: Cannot set KDQUEMODE", pInfo->name);
- return !Success;
- }
- XqueQaddr = (xqEventQueue *)xqueMode.qaddr;
- XqueQaddr->xq_sigenable = 1; /* UNLOCK */
- }
-
- return Success;
-}
-
-
-
-/*
- * xf86XqueDisable --
- * disable the handling of the Xque
- */
-
-static int
-XqDisable(InputInfoPtr pInfo)
-{
- MouseDevPtr pMse;
- XqInfoPtr pXq;
-
- pMse = pInfo->private;
- pXq = pMse->mousePriv;
-
- if (pXq->xqueSema-- == 1)
- {
- XqueQaddr->xq_sigenable = 0; /* LOCK */
-
- if (ioctl(xf86Info.consoleFd, KDQUEMODE, NULL) < 0) {
- xf86Msg(X_ERROR, "%s: Cannot unset KDQUEMODE", pInfo->name);
- return !Success;
- }
- }
-
- if (xqueFd >= 0) {
- close(xqueFd);
- xqueFd = -1;
- }
-
- return Success;
-}
-
-/*
- * XqMouseProc --
- * Handle the initialization, etc. of a mouse
- */
-
-static int
-XqMouseProc(DeviceIntPtr pPointer, int what)
-{
- InputInfoPtr pInfo;
- MouseDevPtr pMse;
- unchar map[4];
- int ret;
-
- pInfo = pPointer->public.devicePrivate;
- pMse = pInfo->private;
- pMse->device = pPointer;
-
- switch (what) {
- case DEVICE_INIT:
- pPointer->public.on = FALSE;
-
- map[1] = 1;
- map[2] = 2;
- map[3] = 3;
-
- InitPointerDeviceStruct((DevicePtr)pPointer,
- map,
- 3,
- miPointerGetMotionEvents,
- pMse->Ctrl,
- miPointerGetMotionBufferSize());
- /* X valuator */
- xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
- xf86InitValuatorDefaults(pPointer, 0);
- /* Y valuator */
- xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
- xf86InitValuatorDefaults(pPointer, 1);
- xf86MotionHistoryAllocate(pInfo);
- RegisterBlockAndWakeupHandlers(XqBlock, (WakeupHandlerProcPtr)NoopDDA,
- pInfo);
- break;
-
- case DEVICE_ON:
- pMse->lastButtons = 0;
- pMse->lastMappedButtons = 0;
- pMse->emulateState = 0;
- pPointer->public.on = TRUE;
- ret = XqEnable(pInfo);
-#ifndef XQUEUE_ASYNC
- if (xquePipe[0] != -1) {
- pInfo->fd = xquePipe[0];
- AddEnabledDevice(xquePipe[0]);
- }
-#endif
- return ret;
-
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pPointer->public.on = FALSE;
- ret = XqDisable(pInfo);
-#ifndef XQUEUE_ASYNC
- if (xquePipe[0] != -1) {
- RemoveEnabledDevice(xquePipe[0]);
- pInfo->fd = -1;
- }
-#endif
- return ret;
- }
- return Success;
-}
-
-Bool
-XqueueMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
-{
- MouseDevPtr pMse;
- XqInfoPtr pXq;
-
- pMse = pInfo->private;
- pMse->protocol = protocol;
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
- pXq = pMse->mousePriv = xnfcalloc(sizeof(XqInfoRec), 1);
-
- /* Collect the options, and process the common options. */
- xf86CollectInputOptions(pInfo, NULL, NULL);
- xf86ProcessCommonOptions(pInfo, pInfo->options);
-
- /* Process common mouse options (like Emulate3Buttons, etc). */
- pMse->CommonOptions(pInfo);
-
- /* Setup the local procs. */
- pInfo->device_control = XqMouseProc;
-#ifdef XQUEUE_ASYNC
- pInfo->read_input = NULL;
-#else
- pInfo->read_input = XqReadInput;
-#endif
- pInfo->fd = -1;
-
- XqMouse = pInfo;
-
- pInfo->flags |= XI86_CONFIGURED;
- return TRUE;
-}
-
-#endif /* XQUEUE */
diff --git a/hw/xfree86/os-support/sysv/xqueue.h b/hw/xfree86/os-support/sysv/xqueue.h
deleted file mode 100644
index d693d2b36..000000000
--- a/hw/xfree86/os-support/sysv/xqueue.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $XFree86$ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _XF86_XQUEUE_H_
-#define _XF86_XQUEUE_H_
-
-Bool XqueueMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags);
-
-#endif
diff --git a/hw/xfree86/os-support/usl/Makefile.am b/hw/xfree86/os-support/usl/Makefile.am
index 5143b243c..db08f5d85 100644
--- a/hw/xfree86/os-support/usl/Makefile.am
+++ b/hw/xfree86/os-support/usl/Makefile.am
@@ -1,12 +1,6 @@
EXTRA_DIST = \
usl_init.c \
- usl_io.c \
usl_iop.c \
- usl_kbd.c \
- usl_kbd.h \
- usl_KbdMap.c \
usl_mouse.c \
usl_video.c \
- usl_vtsw.c \
- usl_xqueue.c \
- usl_xqueue.h
+ usl_vtsw.c
diff --git a/hw/xfree86/os-support/usl/usl_KbdMap.c b/hw/xfree86/os-support/usl/usl_KbdMap.c
deleted file mode 100644
index 76032e61a..000000000
--- a/hw/xfree86/os-support/usl/usl_KbdMap.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* $XdotOrg$ */
-/*
- * Copyright 2005 by J. Kean Johnston <jkj@sco.com>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Based on xf86KbdMap.c, which is
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- * Copyright (c) 1992-2003 by The XFree86 Project, Inc.
- */
-
-#include "X.h"
-#include "Xmd.h"
-#include "input.h"
-#include "scrnintstr.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "xf86Keymap.h"
-
-#include "usl_kbd.h"
-
-#define KD_GET_ENTRY(i,n) \
- eascii_to_x[((priv->keymap.key[i].spcl << (n+1)) & 0x100) + priv->keymap.key[i].map[n]]
-
-/*
- * NOTE: Not all possible remappable symbols are remapped. There are two main
- * reasons:
- * a) The mapping between scancode and SYSV/386 - symboltable
- * is inconsistent between different versions and has some
- * BIG mistakes.
- * b) In X-Windows there is a difference between numpad-keys
- * and normal keys. SYSV/386 uses for both kinds of keys
- * the same symbol.
- *
- * Thus only the alpha keypad and the function keys are translated.
- * Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt.
- */
-
-static unsigned char remap[128] = {
- 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
- 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
- 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
- 0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
- 0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
- 0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
- 0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
-};
-
-static KeySym eascii_to_x[512] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, XK_Return, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
- XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
- XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
- XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
- XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
- XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
- XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
- XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
- XK_sterling, XK_yen, XK_paragraph, XK_section,
- XK_aacute, XK_iacute, XK_oacute, XK_uacute,
- XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
- XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
- XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
- XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
- XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
- XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
- XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
- XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
- XK_degree, NoSymbol, NoSymbol, XK_radical,
- XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
-
- /*
- * special marked entries (256 + x)
- */
-
- NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
- XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
- NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
- XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_F1,
- XK_F2, XK_F3, XK_F4, XK_F5,
- XK_F6, XK_F7, XK_F8, XK_F9,
- XK_F10, XK_F11, XK_F12, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- };
-
-/*
- * KbdGetMapping --
- * Get the national keyboard mapping. The keyboard type is set, a new map
- * and the modifiermap is computed.
- */
-
-void
-KbdGetMapping (InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
- KeySym *k;
- int i;
- KeySym *pMap = map;
-
- for (i = 0; i < priv->keymap.n_keys && i < NUM_KEYCODES; i++) {
- if (remap[i]) {
- k = pMap + (remap[i] << 2);
-
- k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
- k[1] = KD_GET_ENTRY(i,1); /* shifted */
- k[2] = KD_GET_ENTRY(i,4); /* alt */
- k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
-
- if (k[3] == k[2]) k[3] = NoSymbol;
- if (k[2] == k[1]) k[2] = NoSymbol;
- if (k[1] == k[0]) k[1] = NoSymbol;
- if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- }
- }
-
- /*
- * compute the modifier map
- */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = pMap, i = MIN_KEYCODE;
- i < (NUM_KEYCODES + MIN_KEYCODE);
- i++, k += 4) {
-
- switch(*k) {
- case XK_Shift_L:
- case XK_Shift_R:
- pModMap[i] = ShiftMask;
- break;
-
- case XK_Control_L:
- case XK_Control_R:
- pModMap[i] = ControlMask;
- break;
-
- case XK_Caps_Lock:
- pModMap[i] = LockMask;
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- pModMap[i] = AltMask;
- break;
-
- case XK_Num_Lock:
- pModMap[i] = NumLockMask;
- break;
-
- case XK_Scroll_Lock:
- pModMap[i] = ScrollLockMask;
- break;
-
- /* kana support */
- case XK_Kana_Lock:
- case XK_Kana_Shift:
- pModMap[i] = KanaMask;
- break;
-
- /* alternate toggle for multinational support */
- case XK_Mode_switch:
- pModMap[i] = AltLangMask;
- break;
- }
- }
-
- pKeySyms->map = pMap;
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
diff --git a/hw/xfree86/os-support/usl/usl_io.c b/hw/xfree86/os-support/usl/usl_io.c
deleted file mode 100644
index 4cb23d40e..000000000
--- a/hw/xfree86/os-support/usl/usl_io.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2001-2005 by Kean Johnston <jkj@sco.com>
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the names of Thomas Roell, David Dawes
- * and Kean Johnston not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Thomas Roell, David Dawes and Kean Johnston make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL, DAVID DAWES AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT
- * OR KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
- * THIS SOFTWARE.
- *
- */
-/* $XConsortium$ */
-
-#include "X.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-_X_EXPORT void
-xf86SoundKbdBell(int loudness, int pitch, int duration)
-{
- if (loudness && pitch) {
- ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
- usleep(xf86Info.bell_duration * loudness * 20);
- ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
- }
-}
-
-void
-xf86SetKbdLeds(int leds)
-{
- ioctl(xf86Info.consoleFd, KDSETLED, leds);
-}
-
-int
-xf86GetKbdLeds(void)
-{
- int leds;
-
- ioctl(xf86Info.consoleFd, KDGETLED, &leds);
- return(leds);
-}
-
-/*
- * Much of the code in this function is duplicated from the Linux code
- * by Orest Zborowski <obz@Kodak.com> and David Dawes <dawes@xfree86.org>.
- * Please see the file ../linux/lnx_io.c for full copyright information.
- */
-void
-xf86SetKbdRepeat(char rad)
-{
- int i;
- int value = 0x7f; /* Maximum delay with slowest rate */
- int delay = 250; /* Default delay */
- int rate = 300; /* Default repeat rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (xf86Info.kbdRate >= 0)
- rate = xf86Info.kbdRate * 10;
- if (xf86Info.kbdDelay >= 0)
- delay = xf86Info.kbdDelay;
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- ioctl (xf86Info.consoleFd, KDSETTYPEMATICS, value);
-}
-
-static int orig_kbm;
-static struct termio orig_termio;
-static keymap_t keymap, noledmap;
-
-void
-xf86KbdInit(void)
-{
- ioctl (xf86Info.consoleFd, KDGKBMODE, &orig_kbm);
- ioctl (xf86Info.consoleFd, TCGETA, &orig_termio);
- /*
- * We need to get the original keyboard map and NUL out the lock
- * modifiers. This prevents the scancode API from messing with
- * the keyboard LED's. We restore the original map when we exit.
- */
- if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &keymap) < 0) {
- FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- }
- if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &noledmap) < 0) {
- FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- } else {
- int i, j;
-
- for (i = 0; i < noledmap.n_keys; i++) {
- for (j = 0; j < NUM_STATES; j++) {
- if (IS_SPECKEY(&noledmap, i, j) &&
- ((noledmap.key[i].map[j] == K_CLK) ||
- (noledmap.key[i].map[j] == K_NLK) ||
- (noledmap.key[i].map[j] == K_SLK))) {
- noledmap.key[i].map[j] = K_NOP;
- }
- }
- }
- }
-}
-
-int
-xf86KbdOn(void)
-{
- struct termio newtio;
-
- newtio = orig_termio; /* structure copy */
- newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- newtio.c_oflag = 0;
- newtio.c_cflag = CREAD | CS8 | B9600;
- newtio.c_lflag = 0;
- newtio.c_cc[VTIME]=0;
- newtio.c_cc[VMIN]=1;
- ioctl(xf86Info.consoleFd, TCSETA, &newtio);
-
- ioctl (xf86Info.consoleFd, KDSKBMODE, K_RAW);
- ioctl (xf86Info.consoleFd, PIO_KEYMAP, &noledmap);
-
- return(xf86Info.consoleFd);
-}
-
-int
-xf86KbdOff(void)
-{
- ioctl (xf86Info.consoleFd, KDSKBMODE, orig_kbm);
- ioctl (xf86Info.consoleFd, PIO_KEYMAP, &keymap);
- ioctl(xf86Info.consoleFd, TCSETA, &orig_termio);
-
- return(xf86Info.consoleFd);
-}
diff --git a/hw/xfree86/os-support/usl/usl_kbd.c b/hw/xfree86/os-support/usl/usl_kbd.c
deleted file mode 100644
index d6e6af212..000000000
--- a/hw/xfree86/os-support/usl/usl_kbd.c
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * Copyright 2005 by Kean Johnston <jkj@sco.com>
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEAN JOHNSTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
- * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-/* $XConsortium$ */
-
-/*
- * Based on sco_io.c which is
- * (C) Copyright 2003 Kean Johnston <jkj@sco.com>
- *
- * Based on lnx_kbd.c which is
- * Copyright (c) 2002 by The XFree86 Project, Inc.
- *
- * Based on the code from lnx_io.c which is
- * Copyright 1992 by Orest Zborowski <obz@Kodak.com>
- * Copyright 1993 by David Dawes <dawes@xfree86.org>
- */
-
-#define NEED_EVENTS
-#include "X.h"
-
-#include "compiler.h"
-
-#define _NEED_SYSI86
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86OSpriv.h"
-#include "xf86_OSlib.h"
-
-#include "xf86Xinput.h"
-#include "xf86OSKbd.h"
-#include "atKeynames.h"
-#include "usl_kbd.h"
-#include "usl_xqueue.h"
-
-#include <sys/param.h>
-
-static KbdProtocolRec protocols[] = {
- { "standard", PROT_STD },
- { "Xqueue", PROT_XQUEUE },
- { NULL, PROT_UNKNOWN_KBD }
-};
-
-extern Bool VTSwitchEnabled;
-#ifdef USE_VT_SYSREQ
-extern Bool VTSysreqToggle;
-#endif
-
-static void
-SoundBell(InputInfoPtr pInfo, int loudness, int pitch, int duration)
-{
- if (loudness && pitch) {
- ioctl(pInfo->fd, KIOCSOUND, 1193180 / pitch);
- usleep(duration * loudness * 20);
- ioctl(pInfo->fd, KIOCSOUND, 0);
- }
-}
-
-static void
-SetKbdLeds(InputInfoPtr pInfo, int leds)
-{
- int real_leds = 0;
-
- if (leds & XLED1)
- real_leds |= LED_CAP;
- if (leds & XLED2)
- real_leds |= LED_NUM;
- if (leds & XLED3)
- real_leds |= LED_SCR;
- ioctl(pInfo->fd, KDSETLED, real_leds);
-}
-
-static int
-GetKbdLeds(InputInfoPtr pInfo)
-{
- int real_leds, leds = 0;
-
- ioctl(pInfo->fd, KDGETLED, &real_leds);
-
- if (real_leds & LED_CAP) leds |= XLED1;
- if (real_leds & LED_NUM) leds |= XLED2;
- if (real_leds & LED_SCR) leds |= XLED3;
-
- return(leds);
-}
-
-static void
-SetKbdRepeat(InputInfoPtr pInfo, char rad)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- int i;
- int value = 0x7f; /* Maximum delay with slowest rate */
- int delay = 250; /* Default delay */
- int rate = 300; /* Default repeat rate */
-
- static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
- 133, 120, 109, 100, 92, 86, 80, 75, 67,
- 60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
- 25, 23, 21, 20 };
-#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
-
- static int valid_delays[] = { 250, 500, 750, 1000 };
-#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
-
- if (pKbd->rate >= 0)
- rate = pKbd->rate * 10;
- if (pKbd->delay >= 0)
- delay = pKbd->delay;
-
- for (i = 0; i < RATE_COUNT; i++)
- if (rate >= valid_rates[i]) {
- value &= 0x60;
- value |= i;
- break;
- }
-
- for (i = 0; i < DELAY_COUNT; i++)
- if (delay <= valid_delays[i]) {
- value &= 0x1f;
- value |= i << 5;
- break;
- }
-
- ioctl (pInfo->fd, KDSETTYPEMATICS, value);
-}
-
-static int
-KbdInit(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- if (ioctl (pInfo->fd, KDGKBMODE, &priv->orig_kbm) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Could not determine keyboard mode\n");
- return !Success;
- }
-
- /*
- * We need to get the original keyboard map and NUL out the lock
- * modifiers. This prevents the kernel from messing with
- * the keyboard LED's. We restore the original map when we exit.
- * Note that we also have to eliminate screen switch sequences
- * else the VT manager will switch for us, which we don't want.
- * For example, lets say you had changed the VT manager to switch
- * on Alt-Fx instead of Ctrl-Alt-Fx. This means that while inside
- * X, you cant use, for example, Alt-F4, which is a pain in the
- * fundamental when you're using CDE-like thingies.
- */
- if (ioctl (pInfo->fd, GIO_KEYMAP, &priv->keymap) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- return !Success;
- }
- if (ioctl (pInfo->fd, GIO_KEYMAP, &priv->noledmap) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get keyboard map (%s)\n",
- strerror(errno));
- return !Success;
- } else {
- int i, j;
-
- for (i = 0; i < priv->noledmap.n_keys; i++) {
- for (j = 0; j < NUM_STATES; j++) {
- if (IS_SPECKEY(&priv->noledmap, i, j) &&
- ((priv->noledmap.key[i].map[j] == K_CLK) ||
- (priv->noledmap.key[i].map[j] == K_NLK) ||
- (priv->noledmap.key[i].map[j] == K_SLK) ||
- (priv->noledmap.key[i].map[j] == K_FRCNEXT) ||
- (priv->noledmap.key[i].map[j] == K_FRCPREV) ||
- ((priv->noledmap.key[i].map[j] >= K_VTF) &&
- (priv->noledmap.key[i].map[j] <= K_VTL)) )) {
- priv->noledmap.key[i].map[j] = K_NOP;
- }
- }
- }
- }
-
- if (ioctl (pInfo->fd, TCGETA, &priv->kbdtty) < 0) {
- xf86Msg (X_ERROR, "KbdInit: Failed to get terminal modes (%s)\n",
- strerror(errno));
- return !Success;
- }
- } /* End of if we are on a console */
-
- return Success;
-}
-
-static int
-KbdOn(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
- struct termio newtio;
-
- if (pKbd->isConsole) {
- /*
- * Use the calculated keyboard map that does not have active
- * LED lock handling (we track LEDs ourselves).
- */
- ioctl (pInfo->fd, PIO_KEYMAP, &priv->noledmap);
-
-#ifdef NOTYET
- newtio = priv->kbdtty; /* structure copy */
- newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- newtio.c_oflag = 0;
- newtio.c_cflag = CREAD | CS8 | B9600;
- newtio.c_lflag = 0;
- newtio.c_cc[VTIME]=0;
- newtio.c_cc[VMIN]=1;
- ioctl(pInfo->fd, TCSETA, &newtio);
-
- if (priv->xq == 0)
- ioctl (pInfo->fd, KDSKBMODE, K_RAW);
- else
-#endif
- XqKbdOnOff (pInfo, 1);
- }
-
- return Success;
-}
-
-static int
-KbdOff(InputInfoPtr pInfo, int what)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
-
- if (pKbd->isConsole) {
- /* Revert back to original translate scancode mode */
-#ifdef NOTYET
- if (priv->xq == 0)
- ioctl (pInfo->fd, KDSKBMODE, priv->orig_kbm);
- else
-#endif
- XqKbdOnOff (pInfo, 0);
-
- ioctl (pInfo->fd, PIO_KEYMAP, &priv->keymap);
- ioctl(pInfo->fd, TCSETA, &priv->kbdtty);
- }
-
- return Success;
-}
-
-#define ModifierSet(k) ((modifiers & (k)) == (k))
-
-static Bool
-SpecialKey(InputInfoPtr pInfo, int key, Bool down, int modifiers)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
- if(!pKbd->vtSwitchSupported)
- return FALSE;
-
- if ((!ModifierSet(ShiftMask)) && ((ModifierSet(ControlMask | AltMask)) ||
- (ModifierSet(ControlMask | AltLangMask)))) {
- if (VTSwitchEnabled && !xf86Info.vtSysreq) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (down) {
- int sts = key - KEY_F1;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_SWITCH, sts);
- }
- return TRUE;
- }
- case KEY_F11:
- case KEY_F12:
- if (down) {
- int sts = key - KEY_F11 + 10;
- if (sts != xf86Info.vtno) {
- ioctl(pInfo->fd, VT_SWITCH, sts);
- }
- return TRUE;
- }
- }
- }
- }
-#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq) {
- switch (key) {
- case KEY_F1:
- case KEY_F2:
- case KEY_F3:
- case KEY_F4:
- case KEY_F5:
- case KEY_F6:
- case KEY_F7:
- case KEY_F8:
- case KEY_F9:
- case KEY_F10:
- if (VTSysreqToggle && down) {
- ioctl(pInfo->fd, VT_ACTIVATE, key - KEY_F1);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- case KEY_F11:
- case KEY_F12:
- if (VTSysreqToggle && down) {
- ioctl(pInfo->fd, VT_ACTIVATE, key - KEY_F11 + 10);
- VTSysreqToggle = FALSE;
- return TRUE;
- }
- break;
- /* Ignore these keys -- ie don't let them cancel an alt-sysreq */
- case KEY_Alt:
- case KEY_AltLang:
- break;
- case KEY_SysReqest:
- if (!(ModifierSet(ShiftMask) || ModifierSet(ControlMask))) {
- if ((ModifierSet(AltMask) || ModifierSet(AltLangMask)) && down)
- VTSysreqToggle = TRUE;
- }
- break;
- default:
- /*
- * We only land here when Alt-SysReq is followed by a
- * non-switching key.
- */
- if (VTSysreqToggle)
- VTSysreqToggle = FALSE;
- }
- }
-#endif /* USE_VT_SYSREQ */
- return FALSE;
-}
-
-#ifdef NOTYET
-static void
-stdReadInput(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- unsigned char rBuf[64];
- int nBytes, i;
-
- if ((nBytes = read( pInfo->fd, (char *)rBuf, sizeof(rBuf))) > 0) {
- for (i = 0; i < nBytes; i++) {
- pKbd->PostEvent(pInfo, rBuf[i] & 0x7f, rBuf[i] & 0x80 ? FALSE : TRUE);
- }
- }
-}
-#endif
-
-static Bool
-OpenKeyboard(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
- USLKbdPrivPtr priv = (USLKbdPrivPtr) pKbd->private;
- int i;
- KbdProtocolId prot = PROT_UNKNOWN_KBD;
- char *s;
-
- s = xf86SetStrOption(pInfo->options, "Protocol", NULL);
- for (i = 0; protocols[i].name; i++) {
- if (xf86NameCmp(s, protocols[i].name) == 0) {
- prot = protocols[i].id;
- break;
- }
- }
-
- switch (prot) {
- case PROT_STD:
-#ifdef NOTYET
- pInfo->read_input = stdReadInput;
- priv->xq = 0;
- break;
-#endif
- case PROT_XQUEUE:
- pInfo->read_input = NULL; /* Handled by the XQUEUE signal handler */
- priv->xq = 1;
- break;
- default:
- xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
- xfree(s);
- return FALSE;
- }
-
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
- xfree(s);
-
- s = xf86SetStrOption(pInfo->options, "Device", NULL);
- if (s == NULL) {
- pInfo->fd = xf86Info.consoleFd;
- pKbd->isConsole = TRUE;
- } else {
- pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
- if (pInfo->fd == -1) {
- xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
- xfree(s);
- return FALSE;
- }
- pKbd->isConsole = FALSE;
- xfree(s);
- }
-
- if (pKbd->isConsole)
- pKbd->vtSwitchSupported = TRUE;
-
- return TRUE;
-}
-
-_X_EXPORT Bool
-xf86OSKbdPreInit(InputInfoPtr pInfo)
-{
- KbdDevPtr pKbd = pInfo->private;
-
- pKbd->KbdInit = KbdInit;
- pKbd->KbdOn = KbdOn;
- pKbd->KbdOff = KbdOff;
- pKbd->Bell = SoundBell;
- pKbd->SetLeds = SetKbdLeds;
- pKbd->GetLeds = GetKbdLeds;
- pKbd->SetKbdRepeat = SetKbdRepeat;
- pKbd->KbdGetMapping = KbdGetMapping;
- pKbd->SpecialKey = SpecialKey;
- pKbd->OpenKeyboard = OpenKeyboard;
-
- pKbd->GetSpecialKey = NULL;
- pKbd->RemapScanCode = ATScancode;
- pKbd->vtSwitchSupported = FALSE;
-
- pKbd->private = xcalloc(sizeof(USLKbdPrivRec), 1);
- if (pKbd->private == NULL) {
- xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/hw/xfree86/os-support/usl/usl_kbd.h b/hw/xfree86/os-support/usl/usl_kbd.h
deleted file mode 100644
index 990c13cc7..000000000
--- a/hw/xfree86/os-support/usl/usl_kbd.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* $XdotOrg$ */
-#ifndef SCO_KBD_HDR
-#define SCO_KBD_HDR
-
-typedef struct {
- int orig_kbm;
- struct termio kbdtty;
- keymap_t keymap, noledmap;
- int xq;
-} USLKbdPrivRec, *USLKbdPrivPtr;
-
-extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
- CARD8 *pModMap);
-#endif /* SCO_KBD_HDR */
diff --git a/hw/xfree86/os-support/usl/usl_mouse.c b/hw/xfree86/os-support/usl/usl_mouse.c
index 15a0ac5ac..aa4600f79 100644
--- a/hw/xfree86/os-support/usl/usl_mouse.c
+++ b/hw/xfree86/os-support/usl/usl_mouse.c
@@ -33,7 +33,6 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "mipointer.h"
-#include "usl_xqueue.h"
static int
SupportedInterfaces(void)
@@ -42,7 +41,6 @@ SupportedInterfaces(void)
}
static const char *internalNames[] = {
- "Xqueue",
NULL
};
@@ -55,7 +53,7 @@ BuiltinNames(void)
static const char *
DefaultProtocol (void)
{
- return "Xqueue";
+ return "OSMouse";
}
static Bool
@@ -121,7 +119,6 @@ OsMouseProc(DeviceIntPtr pPointer, int what)
static Bool
OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
{
- /* This is called when the protocol is "Xqueue" */
MouseDevPtr pMse;
pMse = pInfo->private;
@@ -155,7 +152,7 @@ OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
/* Setup the local procs. */
pInfo->device_control = OsMouseProc;
- pInfo->read_input = NULL; /* Handled by the XQUEUE signal handler */
+ pInfo->read_input = NULL;
pInfo->flags |= XI86_CONFIGURED;
return TRUE;
diff --git a/hw/xfree86/os-support/usl/usl_xqueue.c b/hw/xfree86/os-support/usl/usl_xqueue.c
deleted file mode 100644
index c00d37489..000000000
--- a/hw/xfree86/os-support/usl/usl_xqueue.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/* $XdotOrg$ */
-/*
- * Copyright 2005 by Kean Johnston <jkj@sco.com>
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
- * Copyright 1993-1999 by The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the copyright holders not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. The copyright holders make no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XConsortium$ */
-
-#include "X.h"
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-#include "xf86Xinput.h"
-#include "xf86OSmouse.h"
-#include "xf86OSKbd.h"
-#include "usl_xqueue.h"
-
-#ifdef XKB
-#include "inputstr.h"
-#include <X11/extensions/XKB.h>
-#include <X11/extensions/XKBstr.h>
-#include <X11/extensions/XKBsrv.h>
-extern Bool noXkbExtension;
-#endif
-
-#include "xf86Xinput.h"
-#include "mipointer.h"
-
-#if !defined(XQ_WHEEL)
-# define XQ_WHEEL 4
-#endif
-
-/*
- * Implementation notes
- *
- * This code is based on a mixture of the original XFree86 sysv/xqueue.c
- * and information gathered from the SCO X server code (no actual code
- * was used, just the principles).
- *
- * The XFree86 XQUEUE code went to some considerable lengths to implement
- * what it calls "asynchronous XQUEUE". This involved creating a pipe,
- * and writing to that pipe each time an XQUEUE signal is received. The
- * one end of that pipe was then added to the list of selectable file
- * descriptors with AddEnabledDevice(). I completely fail to see the need
- * for this, and this code does not implement that mechanism. The server
- * will be interrupted anyway by the XQUEUE driver, so whether we pull the
- * events off the queue at the time we receive the signal or whether we
- * write to a pipe and then have the main select() loop stop and call us,
- * it makes no difference I can fathom.
- *
- * The code also differs from the original XFree86 code in that it maintains
- * local variables for the number of devices initialized. The original code
- * stored that information in the private data pointer of the mouse structure,
- * but this same code is used for both the keyboard and the mouse, so that
- * was changed.
- *
- * Part of the difficulty in dealing with XQUEUE is that it is a single
- * interface to two devices. The recent changes in XFree86/Xorg try to
- * treat the mouse and keyboard as discrete devices, and the code is
- * structured in such a way that they should be able to be independently
- * opened and closed. But we can't do that with XQUEUE, so we have to
- * centralize XQUEUE access here in this module.
- */
-
-static xqEventQueue *xqQaddr = NULL;
-static int xqSigEnable = 1;
-static int xqEnableCount = 0;
-static struct kd_quemode xqMode;
-
-/*
- * These two pointers are set when the keyboard/mouse handler procs
- * are called to turn them on or off. This is so that we can call the
- * correct PostEvent for the device.
- */
-static InputInfoPtr xqMouse = NULL;
-static InputInfoPtr xqKeyboard = NULL;
-
-static void XqSignalHandler (int signo);
-
-/*
- * Private functions
- */
-static void
-XqReset (void)
-{
- if (xqEnableCount > 0) {
- xqQaddr->xq_head = xqQaddr->xq_tail;
- xqQaddr->xq_sigenable = xqSigEnable;
- }
-}
-
-#ifdef NOTNEEDED
-static void
-XqLock (void)
-{
- xqSigEnable = 0;
- if (xqEnableCount > 0) {
- xqQaddr->xq_sigenable = xqSigEnable;
- }
-}
-
-static void
-XqUnlock (void)
-{
- xqSigEnable = 1;
- if (xqEnableCount > 0) {
- xqQaddr->xq_sigenable = xqSigEnable;
- }
-}
-#endif /* NOTNEEDED */
-
-/*
- * Since this code is shared between two devices, we need to keep track
- * of how many times we've been enabled or disabled. For example, if the
- * keyboard has been turned off, but the mouse hasn't, then we do not
- * want the whole queue off. Only when both devices are turned off do we
- * actually disable Xqueue mode. When either device is turned on, we
- * enable it.
- */
-static int
-XqEnable (InputInfoPtr pInfo)
-{
- struct sigaction xqsig;
- static int msefd = -1;
-
- if (msefd == -1) {
- msefd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK);
-#if 0
- msefd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK | O_NOCTTY);
- if (msefd < 0) {
- /*
- * Try giving it a controlling tty
- */
- msefd = open (ttyname(xf86Info.consoleFd), O_RDWR | O_NONBLOCK);
- if (msefd >= 0)
- close (msefd);
- msefd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK | O_NOCTTY);
- if (msefd < 0)
- sleep(2);
- }
-#endif
- }
-
- if (msefd < 0) {
- if (xf86GetAllowMouseOpenFail()) {
- ErrorF("%s: cannot open /dev/mouse (%s)\n",
- ttyname(xf86Info.consoleFd), strerror(errno));
- } else {
- sleep(5);
- FatalError ("%s: cannot open /dev/mouse (%s)\n",
- ttyname(xf86Info.consoleFd), strerror(errno));
- }
- }
-
- if (xqEnableCount++ == 0) {
- xqMode.qaddr = 0;
- ioctl (xf86Info.consoleFd, KDQUEMODE, NULL);
-
- /*
- * Note: We need to make sure the signal is armed before we enable
- * XQUEUE mode, so that if we get events immediately after the ioctl
- * we dont have an unhandled signal coming to the Xserver.
- * Also note that we use sigaction, so that we do not have to re-arm
- * the signal every time it is delivered, which just slows things
- * down (setting a signal is a fairly expensive operation).
- */
-
- xqsig.sa_handler = XqSignalHandler;
- sigfillset (&xqsig.sa_mask);
- xqsig.sa_flags = 0;
- sigaction (SIGUSR2, &xqsig, NULL);
-
- /*
- * This is a fairly large queue size. Since we are reacting to events
- * asynchronously, its best for performance if we deal with as many
- * events as possible, and high resolution mice generate a lot of
- * events.
- */
- xqMode.qsize = 64;
- xqMode.signo = SIGUSR2;
- xqMode.qaddr = 0;
- if (ioctl (xf86Info.consoleFd, KDQUEMODE, &xqMode) < 0) {
- xf86Msg (X_ERROR, "%s: could not set XQUEUE mode (%s)", pInfo->name,
- strerror(errno));
- xqEnableCount--;
-
- xqsig.sa_handler = SIG_DFL;
- sigfillset (&xqsig.sa_mask);
- xqsig.sa_flags = 0;
- sigaction (SIGUSR2, &xqsig, NULL);
-
- return !Success;
- }
-
- /*
- * We're in business. The workstation is now in XQUEUE mode.
- */
- xqQaddr = (xqEventQueue *)xqMode.qaddr;
- xqQaddr->xq_sigenable = 0; /* LOCK */
- nap(500);
- XqReset();
- }
- return Success;
-}
-
-static int
-XqDisable (InputInfoPtr pInfo)
-{
- struct sigaction xqsig;
-
- if (xqEnableCount-- == 1) {
- xqQaddr->xq_sigenable = 0; /* LOCK */
-
- if (ioctl (xf86Info.consoleFd, KDQUEMODE, NULL) < 0) {
- xf86Msg (X_ERROR, "%s: could not unset XQUEUE mode (%s)", pInfo->name,
- strerror(errno));
- xqEnableCount++;
- return !Success;
- }
-
- xqsig.sa_handler = SIG_DFL;
- sigfillset (&xqsig.sa_mask);
- xqsig.sa_flags = 0;
- sigaction (SIGUSR2, &xqsig, NULL);
- }
-
- return Success;
-}
-
-/*
- * XQUEUE signal handler. This is what goes through the list of events
- * we've already received and dispatches them to either the keyboard or
- * mouse event poster.
- */
-static void
-XqSignalHandler (int signo)
-{
- xqEvent *xqEvents = xqQaddr->xq_events;
- int xqHead = xqQaddr->xq_head;
- xEvent xE;
- MouseDevPtr pMse = NULL;
- KbdDevPtr pKbd = NULL;
- signed char dx, dy;
-
- if (xqMouse)
- pMse = (MouseDevPtr)xqMouse->private;
- if (xqKeyboard)
- pKbd = (KbdDevPtr)xqKeyboard->private;
-
- while (xqHead != xqQaddr->xq_tail) {
-
- switch (xqEvents[xqHead].xq_type) {
- case XQ_MOTION:
- dx = (signed char)xqEvents[xqHead].xq_x;
- dy = (signed char)xqEvents[xqHead].xq_y;
- if (pMse)
- pMse->PostEvent(xqMouse, ~(xqEvents[xqHead].xq_code) & 0x07,
- (int)dx, (int)dy, 0, 0);
- break;
-
- case XQ_BUTTON:
- if (pMse)
- pMse->PostEvent(xqMouse, ~(xqEvents[xqHead].xq_code) & 0x07,
- 0, 0, 0, 0);
- break;
-
- case XQ_WHEEL:
- if (pMse) {
- int wbut = pMse->lastButtons, dz;
- if (xqEvents[xqHead].xq_code == 1)
- dz = 1;
- else
- dz = -1;
- pMse->PostEvent(xqMouse, wbut, 0, 0, dz, 0);
- }
- break;
-
- case XQ_KEY:
- if (pKbd)
- pKbd->PostEvent(xqKeyboard, xqEvents[xqHead].xq_code & 0x7f,
- xqEvents[xqHead].xq_code & 0x80 ? FALSE : TRUE);
- break;
-
- default:
- xf86Msg(X_WARNING, "XQUEUE: unknown event type %d\n",
- xqEvents[xqHead].xq_type);
- break;
- }
-
- xqHead++;
- if (xqHead == xqQaddr->xq_size)
- xqHead = 0;
- xf86Info.inputPending = TRUE;
- }
-
- XqReset();
-}
-
-/*
- * Public functions
- */
-int
-XqMseOnOff (InputInfoPtr pInfo, int on)
-{
- if (on) {
- if (xqMouse) {
- if (xqMouse != pInfo)
- xf86Msg(X_WARNING, "XqMseOnOff: mouse pointer structure changed!\n");
- xqMouse = pInfo;
- } else {
- xqMouse = pInfo;
- return XqEnable(pInfo);
- }
- } else {
- xqMouse = NULL;
- return XqDisable(pInfo);
- }
- return Success;
-}
-
-int
-XqKbdOnOff (InputInfoPtr pInfo, int on)
-{
- if (on) {
- if (xqKeyboard) {
- if (xqKeyboard != pInfo)
- xf86Msg(X_WARNING, "XqKbdOnOff: keyboard pointer structure changed!\n");
- xqKeyboard = pInfo;
- } else {
- xqKeyboard = pInfo;
- return XqEnable(pInfo);
- }
- } else {
- xqKeyboard = NULL;
- return XqDisable(pInfo);
- }
- return Success;
-}
-
diff --git a/hw/xfree86/os-support/usl/usl_xqueue.h b/hw/xfree86/os-support/usl/usl_xqueue.h
deleted file mode 100644
index bad86a907..000000000
--- a/hw/xfree86/os-support/usl/usl_xqueue.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $XdotOrg$ */
-
-#ifndef _XF86_USL_XQUEUE_H_
-#define _XF86_USL_XQUEUE_H_
-
-extern int XqMseOnOff (InputInfoPtr pInfo, int on);
-extern int XqKbdOnOff (InputInfoPtr pInfo, int on);
-
-#endif
diff --git a/hw/xfree86/os-support/xf86OSKbd.h b/hw/xfree86/os-support/xf86OSKbd.h
deleted file mode 100644
index 4ab722ca3..000000000
--- a/hw/xfree86/os-support/xf86OSKbd.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2002-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- *
- * Author: Ivan Pascal.
- */
-
-#include "xf86Xinput.h"
-
-Bool ATScancode(InputInfoPtr pInfo, int *scanCode);
-
-/* Public interface to OS-specific keyboard support. */
-
-typedef int (*KbdInitProc)(InputInfoPtr pInfo, int what);
-typedef int (*KbdOnProc)(InputInfoPtr pInfo, int what);
-typedef int (*KbdOffProc)(InputInfoPtr pInfo, int what);
-typedef void (*BellProc)(InputInfoPtr pInfo,
- int loudness, int pitch, int duration);
-typedef void (*SetLedsProc)(InputInfoPtr pInfo, int leds);
-typedef int (*GetLedsProc)(InputInfoPtr pInfo);
-typedef void (*SetKbdRepeatProc)(InputInfoPtr pInfo, char rad);
-typedef void (*KbdGetMappingProc)(InputInfoPtr pInfo,
- KeySymsPtr pKeySyms, CARD8* pModMap);
-typedef int (*GetSpecialKeyProc)(InputInfoPtr pInfo, int scanCode);
-typedef Bool (*SpecialKeyProc)(InputInfoPtr pInfo,
- int key, Bool down, int modifiers);
-typedef int (*RemapScanCodeProc)(InputInfoPtr pInfo, int *scanCode);
-typedef Bool (*OpenKeyboardProc)(InputInfoPtr pInfo);
-typedef void (*PostEventProc)(InputInfoPtr pInfo,
- unsigned int key, Bool down);
-typedef struct {
- int begin;
- int end;
- unsigned char *map;
-} TransMapRec, *TransMapPtr;
-
-typedef struct {
- KbdInitProc KbdInit;
- KbdOnProc KbdOn;
- KbdOffProc KbdOff;
- BellProc Bell;
- SetLedsProc SetLeds;
- GetLedsProc GetLeds;
- SetKbdRepeatProc SetKbdRepeat;
- KbdGetMappingProc KbdGetMapping;
- RemapScanCodeProc RemapScanCode;
- GetSpecialKeyProc GetSpecialKey;
- SpecialKeyProc SpecialKey;
-
- OpenKeyboardProc OpenKeyboard;
- PostEventProc PostEvent;
-
- int rate;
- int delay;
- int bell_pitch;
- int bell_duration;
- Bool autoRepeat;
- unsigned long leds;
- unsigned long xledsMask;
- unsigned long keyLeds;
- int scanPrefix;
- Bool vtSwitchSupported;
- Bool CustomKeycodes;
- Bool noXkb;
- Bool isConsole;
- TransMapPtr scancodeMap;
- TransMapPtr specialMap;
-
- /* os specific */
- pointer private;
- int kbdType;
- int consType;
- int wsKbdType;
- Bool sunKbd;
- Bool Panix106;
-
-} KbdDevRec, *KbdDevPtr;
-
-typedef enum {
- PROT_STD,
- PROT_XQUEUE,
- PROT_WSCONS,
- PROT_USB,
- PROT_UNKNOWN_KBD
-} KbdProtocolId;
-
-typedef struct {
- const char *name;
- KbdProtocolId id;
-} KbdProtocolRec;
-
-Bool xf86OSKbdPreInit(InputInfoPtr pInfo);
-
-/* Adjust this when the kbd interface changes. */
-
-/*
- * History:
- *
- * 1.0.0 - Initial version.
- */
-
-#define OS_KBD_VERSION_MAJOR 1
-#define OS_KBD_VERSION_MINOR 0
-#define OS_KBD_VERSION_PATCH 0
-
-#define OS_KBD_VERSION_CURRENT \
- BUILTIN_INTERFACE_VERSION_NUMERIC(OS_KBD_VERSION_MAJOR, \
- OS_KBD_VERSION_MINOR, \
- OS_KBD_VERSION_PATCH)
-
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index e04854729..97f872301 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -235,15 +235,6 @@ typedef signed long xf86ssize_t;
# define i386 /* not defined in ANSI C mode */
# endif /* ATT && !i386 */
-# if (defined(ATT) || defined(SVR4)) && !defined(sun)
-# ifndef __UNIXWARE__
-# ifndef XQUEUE
-# define XQUEUE
-# endif
-# endif
-# include <sys/xque.h>
-# endif /* ATT || SVR4 */
-
# ifdef SYSV
# if !defined(ISC) || defined(ISC202) || defined(ISC22)
# define NEED_STRERROR
diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h
index 89a33013f..0311b8193 100644
--- a/hw/xfree86/os-support/xf86_OSproc.h
+++ b/hw/xfree86/os-support/xf86_OSproc.h
@@ -135,10 +135,6 @@ extern void xf86WrapperInit(void);
#include <X11/Xfuncproto.h>
#include "opaque.h"
-#if defined(XQUEUE)
-#include "input.h" /* for DeviceIntPtr */
-#endif
-
_XFUNCPROTOBEGIN
/* public functions */
@@ -178,6 +174,7 @@ extern int xf86GetSerialModemState(int fd);
extern int xf86SerialModemSetBits(int fd, int bits);
extern int xf86SerialModemClearBits(int fd, int bits);
extern int xf86LoadKernelModule(const char *pathname);
+extern void xf86RingBell(int volume, int pitch, int duration);
/* AGP GART interface */
@@ -224,21 +221,7 @@ extern Bool xf86VTSwitchTo(void);
extern void xf86VTRequest(int sig);
extern int xf86ProcessArgument(int, char **, int);
extern void xf86UseMsg(void);
-extern void xf86SetKbdLeds(int);
-extern int xf86GetKbdLeds(void);
-extern void xf86SetKbdRepeat(char);
-extern void xf86KbdInit(void);
-extern int xf86KbdOn(void);
-extern int xf86KbdOff(void);
-extern void xf86KbdEvents(void);
-#ifdef XQUEUE
-extern int xf86XqueKbdProc(DeviceIntPtr, int);
-extern void xf86XqueEvents(void);
-#endif
extern void xf86ReloadInputDevs(int sig);
-#ifdef WSCONS_SUPPORT
-extern void xf86WSKbdEvents(void);
-#endif
extern PMClose xf86OSPMOpen(void);
#ifdef NEED_OS_RAC_PROTOS
diff --git a/hw/xfree86/parser/Input.c b/hw/xfree86/parser/Input.c
index 3e2186a9d..3d9801968 100644
--- a/hw/xfree86/parser/Input.c
+++ b/hw/xfree86/parser/Input.c
@@ -102,7 +102,10 @@ xf86parseInputSection (void)
case DRIVER:
if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
Error (QUOTE_MSG, "Driver");
- ptr->inp_driver = val.str;
+ if (strcmp(val.str, "keyboard") == 0)
+ ptr->inp_driver = "kbd";
+ else
+ ptr->inp_driver = val.str;
break;
case OPTION:
ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
diff --git a/hw/xfree86/parser/Keyboard.c b/hw/xfree86/parser/Keyboard.c
deleted file mode 100644
index 9749a1a21..000000000
--- a/hw/xfree86/parser/Keyboard.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-#include "ctype.h"
-
-extern LexRec val;
-
-static xf86ConfigSymTabRec KeyboardTab[] =
-{
- {ENDSECTION, "endsection"},
- {KPROTOCOL, "protocol"},
- {AUTOREPEAT, "autorepeat"},
- {XLEDS, "xleds"},
- {PANIX106, "panix106"},
- {XKBKEYMAP, "xkbkeymap"},
- {XKBCOMPAT, "xkbcompat"},
- {XKBTYPES, "xkbtypes"},
- {XKBKEYCODES, "xkbkeycodes"},
- {XKBGEOMETRY, "xkbgeometry"},
- {XKBSYMBOLS, "xkbsymbols"},
- {XKBDISABLE, "xkbdisable"},
- {XKBRULES, "xkbrules"},
- {XKBMODEL, "xkbmodel"},
- {XKBLAYOUT, "xkblayout"},
- {XKBVARIANT, "xkbvariant"},
- {XKBOPTIONS, "xkboptions"},
- /* The next two have become ServerFlags options */
- {VTINIT, "vtinit"},
- {VTSYSREQ, "vtsysreq"},
- /* Obsolete keywords */
- {SERVERNUM, "servernumlock"},
- {LEFTALT, "leftalt"},
- {RIGHTALT, "rightalt"},
- {RIGHTALT, "altgr"},
- {SCROLLLOCK_TOK, "scrolllock"},
- {RIGHTCTL, "rightctl"},
- {-1, ""},
-};
-
-/* Obsolete */
-static xf86ConfigSymTabRec KeyMapTab[] =
-{
- {CONF_KM_META, "meta"},
- {CONF_KM_COMPOSE, "compose"},
- {CONF_KM_MODESHIFT, "modeshift"},
- {CONF_KM_MODELOCK, "modelock"},
- {CONF_KM_SCROLLLOCK, "scrolllock"},
- {CONF_KM_CONTROL, "control"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeInputList
-
-XF86ConfInputPtr
-xf86parseKeyboardSection (void)
-{
- char *s, *s1, *s2;
- int l;
- int token, ntoken;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
-
- while ((token = xf86getToken (KeyboardTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
- break;
- case KPROTOCOL:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Protocol");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("Protocol"),
- val.str);
- break;
- case AUTOREPEAT:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER)
- Error (AUTOREPEAT_MSG, NULL);
- s1 = xf86uLongToString(val.num);
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER) {
- xf86conffree(s1);
- Error (AUTOREPEAT_MSG, NULL);
- }
- s2 = xf86uLongToString(val.num);
- l = strlen(s1) + 1 + strlen(s2) + 1;
- s = xf86confmalloc(l);
- sprintf(s, "%s %s", s1, s2);
- xf86conffree(s1);
- xf86conffree(s2);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("AutoRepeat"), s);
- break;
- case XLEDS:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER)
- Error (XLEDS_MSG, NULL);
- s = xf86uLongToString(val.num);
- l = strlen(s) + 1;
- while ((token = xf86getSubToken (&(ptr->inp_comment))) == NUMBER)
- {
- s1 = xf86uLongToString(val.num);
- l += (1 + strlen(s1));
- s = xf86confrealloc(s, l);
- strcat(s, " ");
- strcat(s, s1);
- xf86conffree(s1);
- }
- xf86unGetToken (token);
- xf86conffree(s);
- break;
- case SERVERNUM:
- xf86parseWarning(OBSOLETE_MSG, xf86tokenString());
- break;
- case LEFTALT:
- case RIGHTALT:
- case SCROLLLOCK_TOK:
- case RIGHTCTL:
- xf86parseWarning(OBSOLETE_MSG, xf86tokenString());
- break;
- ntoken = xf86getToken (KeyMapTab);
- switch (ntoken)
- {
- case EOF_TOKEN:
- xf86parseError (UNEXPECTED_EOF_MSG);
- CLEANUP (ptr);
- return (NULL);
- break;
-
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- break;
- case VTINIT:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "VTInit");
- xf86parseWarning(MOVED_TO_FLAGS_MSG, "VTInit");
- break;
- case VTSYSREQ:
- xf86parseWarning(MOVED_TO_FLAGS_MSG, "VTSysReq");
- break;
- case XKBDISABLE:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbDisable"),
- NULL);
- break;
- case XKBKEYMAP:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBKeymap");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbKeymap"),
- val.str);
- break;
- case XKBCOMPAT:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBCompat");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbCompat"),
- val.str);
- break;
- case XKBTYPES:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBTypes");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbTypes"),
- val.str);
- break;
- case XKBKEYCODES:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBKeycodes");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbKeycodes"),
- val.str);
- break;
- case XKBGEOMETRY:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBGeometry");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbGeometry"),
- val.str);
- break;
- case XKBSYMBOLS:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBSymbols");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbSymbols"),
- val.str);
- break;
- case XKBRULES:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBRules");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbRules"),
- val.str);
- break;
- case XKBMODEL:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBModel");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbModel"),
- val.str);
- break;
- case XKBLAYOUT:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBLayout");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbLayout"),
- val.str);
- break;
- case XKBVARIANT:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBVariant");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbVariant"),
- val.str);
- break;
- case XKBOPTIONS:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "XKBOptions");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("XkbOptions"),
- val.str);
- break;
- case PANIX106:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("Panix106"), NULL);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_KEYBOARD);
- ptr->inp_driver = xf86configStrdup("keyboard");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- xf86configStrdup("CoreKeyboard"), NULL);
-
-#ifdef DEBUG
- printf ("Keyboard section parsed\n");
-#endif
-
- return ptr;
-}
-
diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am
index a9491a18a..1c1ba3f13 100644
--- a/hw/xfree86/parser/Makefile.am
+++ b/hw/xfree86/parser/Makefile.am
@@ -12,7 +12,6 @@ libxf86config_a_SOURCES = \
Files.c \
Flags.c \
Input.c \
- Keyboard.c \
Layout.c \
Module.c \
Video.c \
diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h
index 832437cd2..0b989054b 100644
--- a/hw/xfree86/parser/configProcs.h
+++ b/hw/xfree86/parser/configProcs.h
@@ -45,8 +45,6 @@ XF86ConfInputPtr xf86parseInputSection(void);
void xf86printInputSection(FILE *f, XF86ConfInputPtr ptr);
void xf86freeInputList(XF86ConfInputPtr ptr);
int xf86validateInput (XF86ConfigPtr p);
-/* Keyboard.c */
-XF86ConfInputPtr xf86parseKeyboardSection(void);
/* Layout.c */
XF86ConfLayoutPtr xf86parseLayoutSection(void);
void xf86printLayoutSection(FILE *cf, XF86ConfLayoutPtr ptr);
diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c
index 598a12666..b6b3bc377 100644
--- a/hw/xfree86/parser/read.c
+++ b/hw/xfree86/parser/read.c
@@ -112,13 +112,6 @@ xf86readConfigFile (void)
val.str = NULL;
HANDLE_RETURN (conf_flags, xf86parseFlagsSection ());
}
- else if (xf86nameCompare (val.str, "keyboard") == 0)
- {
- xf86conffree(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_input_lst, xf86parseKeyboardSection,
- XF86ConfInputPtr);
- }
else if (xf86nameCompare (val.str, "pointer") == 0)
{
xf86conffree(val.str);
diff --git a/hw/xfree86/utils/xorgcfg/interface.c b/hw/xfree86/utils/xorgcfg/interface.c
index b98d6ce73..9b22dc7cb 100644
--- a/hw/xfree86/utils/xorgcfg/interface.c
+++ b/hw/xfree86/utils/xorgcfg/interface.c
@@ -66,8 +66,7 @@
#define DefaultXFree86Dir "/usr"
#endif
-#define IS_KBDDRIV(S) ((strcasecmp((S),"kbd") == 0) || \
- (strcasecmp((S), "keyboard") == 0))
+#define IS_KBDDRIV(S) ((strcasecmp((S),"kbd") == 0))
/*
* Prototypes
diff --git a/hw/xfree86/utils/xorgcfg/keyboard-cfg.c b/hw/xfree86/utils/xorgcfg/keyboard-cfg.c
index 4856c5247..545a67067 100644
--- a/hw/xfree86/utils/xorgcfg/keyboard-cfg.c
+++ b/hw/xfree86/utils/xorgcfg/keyboard-cfg.c
@@ -37,8 +37,7 @@
#include <X11/Xaw/SimpleMenu.h>
#include <X11/Xaw/SmeBSB.h>
-#define IS_KBDDRIV(X) ((strcasecmp((X),"kbd") == 0) || \
- (strcasecmp((X), "keyboard") == 0))
+#define IS_KBDDRIV(X) ((strcasecmp((X),"kbd") == 0))
/*
* Types
@@ -254,11 +253,7 @@ KeyboardConfig(XtPointer config)
keyboard = XtNew(XF86ConfInputRec);
keyboard->list.next = NULL;
keyboard->inp_identifier = XtNewString(ident_string);
-#if defined(USE_DEPRECATED_KEYBOARD_DRIVER)
- keyboard->inp_driver = XtNewString("keyboard");
-#else
keyboard->inp_driver = XtNewString("kbd");
-#endif
keyboard->inp_option_lst = xf86newOption(XtNewString(XkbRules),
XtNewString(rules));
xf86addNewOption(keyboard->inp_option_lst,
diff --git a/hw/xfree86/utils/xorgcfg/mouse-cfg.c b/hw/xfree86/utils/xorgcfg/mouse-cfg.c
index 6c29c1f07..5bae6d326 100644
--- a/hw/xfree86/utils/xorgcfg/mouse-cfg.c
+++ b/hw/xfree86/utils/xorgcfg/mouse-cfg.c
@@ -60,9 +60,6 @@ static struct MouseProtocol {
#ifdef __SCO__
{"OsMouse", MTYPE_AUTOMOUSE},
#endif
-#if defined(__UNIXWARE__)
- {"Xqueue", MTYPE_XQUEUE},
-#endif
#ifdef WSCONS_SUPPORT
{"wsmouse", MTYPE_AUTOMOUSE},
#endif
diff --git a/hw/xfree86/utils/xorgcfg/text-mode.c b/hw/xfree86/utils/xorgcfg/text-mode.c
index 0fc5770ca..04b0ce6cb 100644
--- a/hw/xfree86/utils/xorgcfg/text-mode.c
+++ b/hw/xfree86/utils/xorgcfg/text-mode.c
@@ -46,8 +46,7 @@
#include "xf86config.h"
#include "loader.h"
-#define IS_KBDDRIV(X) ((strcmp((X),"kbd") == 0) || \
- (strcmp((X), "keyboard") == 0))
+#define IS_KBDDRIV(X) ((strcmp((X),"kbd") == 0))
#ifndef PROJECT_ROOT
#define PROJECT_ROOT "/usr"
@@ -362,9 +361,6 @@ static char *protocols[] = {
#ifdef __SCO__
"OsMouse",
#endif
-#ifdef __UNIXWARE__
- "Xqueue",
-#endif
#ifdef WSCONS_SUPPORT
"wsmouse",
#endif
@@ -744,11 +740,7 @@ KeyboardConfig(void)
input->inp_option_lst =
xf86addNewOption(input->inp_option_lst,
XtNewString("XkbLayout"), XtNewString("us"));
-#if defined(USE_DEPRECATED_KEYBOARD_DRIVER)
- input->inp_driver = XtNewString("keyboard");
-#else
input->inp_driver = XtNewString("kbd");
-#endif
XF86Config->conf_input_lst =
xf86addInput(XF86Config, input);
}
@@ -824,11 +816,7 @@ KeyboardConfig(void)
XtNewString("XkbLayout"), XtNewString(layout));
if (input->inp_driver == NULL) {
-#if defined(USE_DEPRECATED_KEYBOARD_DRIVER)
- input->inp_driver = XtNewString("keyboard");
-#else
input->inp_driver = XtNewString("kbd");
-#endif
XF86Config->conf_input_lst =
xf86addInput(XF86Config->conf_input_lst, input);
}
diff --git a/hw/xfree86/utils/xorgconfig/xorgconfig.c b/hw/xfree86/utils/xorgconfig/xorgconfig.c
index f00eea038..f7174832e 100644
--- a/hw/xfree86/utils/xorgconfig/xorgconfig.c
+++ b/hw/xfree86/utils/xorgconfig/xorgconfig.c
@@ -2066,17 +2066,7 @@ static char *XF86Config_fontpathchunk_text =
"Section \"InputDevice\"\n"
"\n"
" Identifier \"Keyboard1\"\n"
-#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
-" Driver \"Keyboard\"\n"
-#else
" Driver \"kbd\"\n"
-#endif
-"\n"
-"# For most OSs the protocol can be omitted (it defaults to \"Standard\").\n"
-"# When using XQUEUE (only for SVR3 and SVR4, but not Solaris),\n"
-"# uncomment the following line.\n"
-"\n"
-"# Option \"Protocol\" \"Xqueue\"\n"
"\n"
" Option \"AutoRepeat\" \"500 30\"\n"
"\n"
@@ -2129,7 +2119,7 @@ static char *pointersection_text1 =
"\n"
"# Identifier and driver\n"
"\n"
-#if defined(__UNIXWARE__) || defined(XQUEUE)
+#if defined(__UNIXWARE__)
"# Identifier \"Mouse1\"\n"
"# Driver \"mouse\"\n"
#else
@@ -2140,15 +2130,6 @@ static char *pointersection_text1 =
static char *pointersection_text2 =
"\n"
-"# When using XQUEUE, comment out the above two lines, and uncomment\n"
-"# the following line.\n"
-"\n"
-#if defined(__UNIXWARE__) || defined(XQUEUE)
-" Option \"Protocol\" \"Xqueue\"\n"
-#else
-"# Option \"Protocol\" \"Xqueue\"\n"
-#endif
-"\n"
"# Mouse-speed setting for PS/2 mouse.\n"
"\n"
"# Option \"Resolution\" \"256\"\n"
diff --git a/hw/xfree86/xorgconf.cpp b/hw/xfree86/xorgconf.cpp
index 6c522134e..71abe130d 100644
--- a/hw/xfree86/xorgconf.cpp
+++ b/hw/xfree86/xorgconf.cpp
@@ -176,13 +176,7 @@ XCOMM **********************************************************************
Section "InputDevice"
Identifier "Keyboard1"
- Driver "keyboard"
-
-XCOMM For most OSs the protocol can be omitted (it defaults to "Standard").
-XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), comment
-XCOMM out the above line, and uncomment the following line.
-
-XCOMM Option "Protocol" "Xqueue"
+ Driver "kbd"
XCOMM Set the keyboard auto repeat parameters. Not all platforms implement
XCOMM this.
@@ -267,12 +261,6 @@ XCOMM be available.
XCOMM Option "Protocol" "PS/2"
-XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), use
-XCOMM the following instead of any of the lines above. The Device line
-XCOMM is not required in this case.
-
-XCOMM Option "Protocol" "Xqueue"
-
XCOMM Baudrate and SampleRate are only for some older Logitech mice. In
XCOMM almost every case these lines should be omitted.
diff --git a/hw/xgl/egl/module/xeglmodule.c b/hw/xgl/egl/module/xeglmodule.c
index ff695f614..abd0d0d75 100644
--- a/hw/xgl/egl/module/xeglmodule.c
+++ b/hw/xgl/egl/module/xeglmodule.c
@@ -52,7 +52,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return xeglLegalModifier (key, pDev);
}
diff --git a/hw/xgl/egl/xegl.c b/hw/xgl/egl/xegl.c
index 70db7c083..c671dbe7c 100644
--- a/hw/xgl/egl/xegl.c
+++ b/hw/xgl/egl/xegl.c
@@ -252,7 +252,7 @@ xeglInitInput (int argc,
Bool
xeglLegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return KdLegalModifier (key, pDev);
}
diff --git a/hw/xgl/egl/xegl.h b/hw/xgl/egl/xegl.h
index cf21fca95..be9b48c9c 100644
--- a/hw/xgl/egl/xegl.h
+++ b/hw/xgl/egl/xegl.h
@@ -173,7 +173,7 @@ KdWakeupHandler (pointer data,
Bool
KdLegalModifier (unsigned int key,
- DevicePtr pDev);
+ DeviceIntPtr pDev);
void
KdProcessInputEvents (void);
diff --git a/hw/xgl/egl/xeglinit.c b/hw/xgl/egl/xeglinit.c
index 51100a4d1..c28d946ac 100644
--- a/hw/xgl/egl/xeglinit.c
+++ b/hw/xgl/egl/xeglinit.c
@@ -58,7 +58,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return xeglLegalModifier (key, pDev);
}
diff --git a/hw/xgl/glx/module/xglxmodule.c b/hw/xgl/glx/module/xglxmodule.c
index 066cb8082..40af8907d 100644
--- a/hw/xgl/glx/module/xglxmodule.c
+++ b/hw/xgl/glx/module/xglxmodule.c
@@ -52,7 +52,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return xglxLegalModifier (key, pDev);
}
diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c
index 1ded3e304..57cb84702 100644
--- a/hw/xgl/glx/xglx.c
+++ b/hw/xgl/glx/xglx.c
@@ -1243,7 +1243,7 @@ xglxKeybdProc (DeviceIntPtr pDevice,
Bool
xglxLegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return TRUE;
}
diff --git a/hw/xgl/glx/xglx.h b/hw/xgl/glx/xglx.h
index b0c5d3d70..a8c894661 100644
--- a/hw/xgl/glx/xglx.h
+++ b/hw/xgl/glx/xglx.h
@@ -91,7 +91,7 @@ xglxInitOutput (ScreenInfo *pScreenInfo,
Bool
xglxLegalModifier (unsigned int key,
- DevicePtr pDev);
+ DeviceIntPtr pDev);
void
xglxProcessInputEvents (void);
diff --git a/hw/xgl/glx/xglxinit.c b/hw/xgl/glx/xglxinit.c
index 50bbca52b..b87e5d682 100644
--- a/hw/xgl/glx/xglxinit.c
+++ b/hw/xgl/glx/xglxinit.c
@@ -81,7 +81,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return xglxLegalModifier (key, pDev);
}
diff --git a/hw/xgl/xglinit.c b/hw/xgl/xglinit.c
index 3d93c46cc..e0c9e7ded 100644
--- a/hw/xgl/xglinit.c
+++ b/hw/xgl/xglinit.c
@@ -192,7 +192,7 @@ InitOutput (ScreenInfo *pScreenInfo,
Bool
LegalModifier (unsigned int key,
- DevicePtr pDev)
+ DeviceIntPtr pDev)
{
return (*__ddxFunc.legalModifier) (key, pDev);
}
diff --git a/hw/xnest/Args.c b/hw/xnest/Args.c
index 5d0a0c02d..c2e8b0db7 100644
--- a/hw/xnest/Args.c
+++ b/hw/xnest/Args.c
@@ -53,18 +53,21 @@ Window xnestParentWindow = 0;
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
void ddxInitGlobals(void)
{
-}
-
-int
-ddxProcessArgument (int argc, char *argv[], int i)
-{
-
#ifdef COMPOSITE
/* XXX terrible hack */
extern Bool noCompositeExtension;
noCompositeExtension = TRUE;
#endif
+#ifdef XKB
+ extern Bool noXkbExtension;
+ noXkbExtension = TRUE;
+#endif
+}
+
+int
+ddxProcessArgument (int argc, char *argv[], int i)
+{
if (!strcmp(argv[i], "-display")) {
if (++i < argc) {
xnestDisplayName = argv[i];
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index e5cf99e2c..a20924128 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -37,10 +37,13 @@ is" without express or implied warranty.
#include "XNWindow.h"
#include "Events.h"
#include "Keyboard.h"
+#include "Pointer.h"
#include "mipointer.h"
CARD32 lastEventTime = 0;
+extern xEvent *xnestEvents;
+
void
ProcessInputEvents()
{
@@ -101,11 +104,12 @@ xnestCollectExposures()
void
xnestQueueKeyEvent(int type, unsigned int keycode)
{
- xEvent x;
- x.u.u.type = type;
- x.u.u.detail = keycode;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
+ int i, n;
+
+ lastEventTime = GetTimeInMillis();
+ n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestKeyboardDevice, xnestEvents + i);
}
void
@@ -113,6 +117,7 @@ xnestCollectEvents()
{
XEvent X;
xEvent x;
+ int i, n, valuators[2];
ScreenPtr pScreen;
while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
@@ -129,30 +134,30 @@ xnestCollectEvents()
case ButtonPress:
xnestUpdateModifierState(X.xkey.state);
- x.u.u.type = ButtonPress;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress,
+ X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
break;
case ButtonRelease:
xnestUpdateModifierState(X.xkey.state);
- x.u.u.type = ButtonRelease;
- x.u.u.detail = X.xbutton.button;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease,
+ X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
break;
case MotionNotify:
-#if 0
- x.u.u.type = MotionNotify;
- x.u.keyButtonPointer.rootX = X.xmotion.x;
- x.u.keyButtonPointer.rootY = X.xmotion.y;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
-#endif
- miPointerAbsoluteCursor (X.xmotion.x, X.xmotion.y,
- lastEventTime = GetTimeInMillis());
+ valuators[0] = X.xmotion.x;
+ valuators[1] = X.xmotion.y;
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
break;
case FocusIn:
@@ -179,15 +184,13 @@ xnestCollectEvents()
pScreen = xnestScreen(X.xcrossing.window);
if (pScreen) {
NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y);
-#if 0
- x.u.u.type = MotionNotify;
- x.u.keyButtonPointer.rootX = X.xcrossing.x;
- x.u.keyButtonPointer.rootY = X.xcrossing.y;
- x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis();
- mieqEnqueue(&x);
-#endif
- miPointerAbsoluteCursor (X.xcrossing.x, X.xcrossing.y,
- lastEventTime = GetTimeInMillis());
+ valuators[0] = X.xcrossing.x;
+ valuators[1] = X.xcrossing.y;
+ lastEventTime = GetTimeInMillis();
+ n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
+ 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ for (i = 0; i < n; i++)
+ mieqEnqueue(xnestPointerDevice, xnestEvents + i);
xnestDirectInstallColormaps(pScreen);
}
}
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 8c397a7bb..5bf0300c6 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -45,6 +45,8 @@ is" without express or implied warranty.
Bool xnestDoFullGeneration = True;
+xEvent *xnestEvents = NULL;
+
void
InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
{
@@ -92,10 +94,15 @@ InitInput(int argc, char *argv[])
xnestPointerDevice = AddInputDevice(xnestPointerProc, TRUE);
xnestKeyboardDevice = AddInputDevice(xnestKeyboardProc, TRUE);
+ if (!xnestEvents)
+ xnestEvents = (xEvent *) xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ if (!xnestEvents)
+ FatalError("couldn't allocate room for events\n");
+
RegisterPointerDevice(xnestPointerDevice);
RegisterKeyboardDevice(xnestKeyboardDevice);
- mieqInit((DevicePtr)xnestKeyboardDevice, (DevicePtr)xnestPointerDevice);
+ mieqInit();
AddEnabledDevice(XConnectionNumber(xnestDisplay));
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index f18cc9760..0dacae70b 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -94,6 +94,12 @@ xnestBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls)
}
void
+DDXRingBell(int volume, int pitch, int duration)
+{
+ XBell(xnestDisplay, volume);
+}
+
+void
xnestChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
{
#if 0
@@ -253,7 +259,7 @@ XkbError:
}
Bool
-LegalModifier(unsigned int key, DevicePtr pDev)
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
diff --git a/hw/xnest/Pointer.c b/hw/xnest/Pointer.c
index 454449732..912b6fa21 100644
--- a/hw/xnest/Pointer.c
+++ b/hw/xnest/Pointer.c
@@ -57,9 +57,9 @@ xnestPointerProc(DeviceIntPtr pDev, int onoff)
for (i = 0; i <= nmap; i++)
map[i] = i; /* buttons are already mapped */
InitPointerDeviceStruct(&pDev->public, map, nmap,
- miPointerGetMotionEvents,
+ GetMotionHistory,
xnestChangePointerControl,
- miPointerGetMotionBufferSize());
+ GetMotionHistorySize(), 2);
break;
case DEVICE_ON:
xnestEventMask |= XNEST_POINTER_EVENT_MASK;
diff --git a/hw/xprint/ddxInit.c b/hw/xprint/ddxInit.c
index 6cd3cfd3c..8e7ec2e0a 100644
--- a/hw/xprint/ddxInit.c
+++ b/hw/xprint/ddxInit.c
@@ -156,9 +156,9 @@ PointerProc(
{
map[0] = 0;
InitPointerDeviceStruct(pPtr, map, NUM_BUTTONS,
- miPointerGetMotionEvents,
+ GetMotionHistory,
(PtrCtrlProcPtr)_XpVoidNoop,
- miPointerGetMotionBufferSize());
+ GetMotionHistorySize(), 2);
break;
}
case DEVICE_ON:
@@ -189,7 +189,7 @@ InitInput(
Bool
LegalModifier(
unsigned int key,
- DevicePtr dev)
+ DeviceIntPtr dev)
{
return TRUE;
}
diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c
index f4796e079..52f837ede 100644
--- a/hw/xwin/InitInput.c
+++ b/hw/xwin/InitInput.c
@@ -79,7 +79,7 @@ extern winDispatchProcPtr winProcQueryTreeOrig;
*/
Bool
-LegalModifier (unsigned int uiKey, DevicePtr pDevice)
+LegalModifier (unsigned int uiKey, DeviceIntPtr pDevice)
{
return TRUE;
}
diff --git a/include/Makefile.am b/include/Makefile.am
index 9e340d72d..9f07fa650 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -7,6 +7,7 @@ sdk_HEADERS = \
closure.h \
colormap.h \
colormapst.h \
+ config.h \
cursor.h \
cursorstr.h \
dix.h \
diff --git a/include/XIstubs.h b/include/XIstubs.h
index 45f6eb10c..6797e0732 100644
--- a/include/XIstubs.h
+++ b/include/XIstubs.h
@@ -26,18 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef XI_STUBS_H
#define XI_STUBS_H 1
-int
-ChangeKeyboardDevice (
- DeviceIntPtr /* old_dev */,
- DeviceIntPtr /* new_dev */);
-
-int
-ChangePointerDevice (
- DeviceIntPtr /* old_dev */,
- DeviceIntPtr /* new_dev */,
- unsigned char /* x */,
- unsigned char /* y */);
-
void
CloseInputDevice (
DeviceIntPtr /* d */,
diff --git a/include/config.h b/include/config.h
new file mode 100644
index 000000000..0c304b15e
--- /dev/null
+++ b/include/config.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright © 2006 Daniel Stone
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders and/or authors
+ * not be used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission. The copyright holders
+ * and/or authors make no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS AND/OR AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR AUTHORS BE LIABLE
+ * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+void configInitialise(void);
+void configFini(void);
+void configDispatch(void);
+
+#endif /* CONFIG_H */
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 84d693f5c..7aabae2ec 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -448,7 +448,25 @@
/* Define to 1 if modules should avoid the libcwrapper */
#undef NO_LIBCWRAPPER
+/* Support D-BUS */
+#undef HAVE_DBUS
+
+/* Use only built-in fonts */
+#undef BUILTIN_FONTS
+
+/* Avoid using font servers */
+#undef NOFONTSERVERACCESS
+
+/* Use an empty root cursor */
+#undef NULL_ROOT_CURSOR
+
/* Have a monotonic clock from clock_gettime() */
#undef MONOTONIC_CLOCK
+/* Define to 1 if the DTrace Xserver provider probes should be built in */
+#undef XSERVER_DTRACE
+
+/* Path to XErrorDB file */
+#undef XERRORDB_PATH
+
#endif /* _DIX_CONFIG_H_ */
diff --git a/include/exevents.h b/include/exevents.h
index 1169a6c4e..7fbaddbb5 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -179,4 +179,17 @@ extern int DeviceEventSuppressForWindow(
Mask /* mask */,
int /* maskndx */);
+void FindInterestedChildren(
+ DeviceIntPtr /* dev */,
+ WindowPtr /* p1 */,
+ Mask /* mask */,
+ xEvent * /* ev */,
+ int /* count */);
+
+void SendEventToAllWindows(
+ DeviceIntPtr /* dev */,
+ Mask /* mask */,
+ xEvent * /* ev */,
+ int /* count */);
+
#endif /* EXEVENTS_H */
diff --git a/include/extinit.h b/include/extinit.h
index b1a0f215d..2087d74d6 100644
--- a/include/extinit.h
+++ b/include/extinit.h
@@ -104,6 +104,12 @@ SDeviceMappingNotifyEvent (
);
void
+SDevicePresenceNotifyEvent (
+ devicePresenceNotify * /* from */,
+ devicePresenceNotify * /* to */
+ );
+
+void
FixExtensionEvents (
ExtensionEntry * /* extEntry */
);
diff --git a/include/input.h b/include/input.h
index c0cee2458..f2fe6d137 100644
--- a/include/input.h
+++ b/include/input.h
@@ -59,6 +59,10 @@ SOFTWARE.
#define DEVICE_OFF 2
#define DEVICE_CLOSE 3
+#define POINTER_RELATIVE (1 << 1)
+#define POINTER_ABSOLUTE (1 << 2)
+#define POINTER_ACCELERATE (1 << 3)
+
#define MAP_LENGTH 256
#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
#define NullGrab ((GrabPtr)NULL)
@@ -161,6 +165,14 @@ extern void ResetDevicePrivateIndex(void);
extern KeybdCtrl defaultKeyboardControl;
extern PtrCtrl defaultPointerControl;
+typedef struct _InputOption {
+ char *key;
+ char *value;
+ struct _InputOption *next;
+} InputOption;
+
+extern void InitCoreDevices(void);
+
extern DeviceIntPtr AddInputDevice(
DeviceProc /*deviceProc*/,
Bool /*autoStart*/);
@@ -168,6 +180,9 @@ extern DeviceIntPtr AddInputDevice(
extern Bool EnableDevice(
DeviceIntPtr /*device*/);
+extern Bool ActivateDevice(
+ DeviceIntPtr /*device*/);
+
extern Bool DisableDevice(
DeviceIntPtr /*device*/);
@@ -175,7 +190,7 @@ extern int InitAndStartDevices(void);
extern void CloseDownDevices(void);
-extern void RemoveDevice(
+extern int RemoveDevice(
DeviceIntPtr /*dev*/);
extern int NumMotionEvents(void);
@@ -225,6 +240,9 @@ extern Bool InitValuatorClassDeviceStruct(
int /*numMotionEvents*/,
int /*mode*/);
+extern Bool InitAbsoluteClassDeviceStruct(
+ DeviceIntPtr /*device*/);
+
extern Bool InitFocusClassDeviceStruct(
DeviceIntPtr /*device*/);
@@ -294,7 +312,8 @@ extern Bool InitPointerDeviceStruct(
int /*numButtons*/,
ValuatorMotionProcPtr /*motionProc*/,
PtrCtrlProcPtr /*controlProc*/,
- int /*numMotionEvents*/);
+ int /*numMotionEvents*/,
+ int /*numAxes*/);
extern Bool InitKeyboardDeviceStruct(
DevicePtr /*device*/,
@@ -356,7 +375,7 @@ extern void CoreProcessKeyboardEvent(
extern Bool LegalModifier(
unsigned int /*key*/,
- DevicePtr /*pDev*/);
+ DeviceIntPtr /*pDev*/);
extern void ProcessInputEvents(void);
@@ -364,4 +383,67 @@ extern void InitInput(
int /*argc*/,
char ** /*argv*/);
+extern int GetMaximumEventsNum(void);
+
+extern int GetPointerEvents(
+ xEvent *events,
+ DeviceIntPtr pDev,
+ int type,
+ int buttons,
+ int flags,
+ int first_valuator,
+ int num_valuators,
+ int *valuators);
+
+extern int GetKeyboardEvents(
+ xEvent *events,
+ DeviceIntPtr pDev,
+ int type,
+ int key_code);
+
+extern int GetKeyboardValuatorEvents(
+ xEvent *events,
+ DeviceIntPtr pDev,
+ int type,
+ int key_code,
+ int first_valuator,
+ int num_valuator,
+ int *valuators);
+
+extern int GetProximityEvents(
+ xEvent *events,
+ DeviceIntPtr pDev,
+ int type,
+ int first_valuator,
+ int num_valuators,
+ int *valuators);
+
+extern int GetMotionHistorySize(
+ void);
+
+extern void AllocateMotionHistory(
+ DeviceIntPtr pDev);
+
+extern int GetMotionHistory(
+ DeviceIntPtr pDev,
+ xTimecoord *buff,
+ unsigned long start,
+ unsigned long stop,
+ ScreenPtr pScreen);
+
+extern void SwitchCoreKeyboard(DeviceIntPtr pDev);
+extern void SwitchCorePointer(DeviceIntPtr pDev);
+
+extern DeviceIntPtr LookupDeviceIntRec(
+ CARD8 deviceid);
+
+/* Implemented by the DDX. */
+extern int NewInputDeviceRequest(
+ InputOption *options);
+
+extern void DDXRingBell(
+ int volume,
+ int pitch,
+ int duration);
+
#endif /* INPUT_H */
diff --git a/include/inputstr.h b/include/inputstr.h
index 5e2e26968..ada94e6b4 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -62,6 +62,8 @@ SOFTWARE.
#define EMASKSIZE MAX_DEVICES
+extern int CoreDevicePrivatesIndex, CoreDevicePrivatesGeneration;
+
/* Kludge: OtherClients and InputClients must be compatible, see code */
typedef struct _OtherClients {
@@ -91,15 +93,15 @@ typedef struct _OtherInputMasks {
*/
#define MasksPerDetailMask 8 /* 256 keycodes and 256 possible
- modifier combinations, but only
- 3 buttons. */
+ modifier combinations, but only
+ 3 buttons. */
- typedef struct _DetailRec { /* Grab details may be bit masks */
- unsigned short exact;
- Mask *pMask;
- } DetailRec;
+typedef struct _DetailRec { /* Grab details may be bit masks */
+ unsigned short exact;
+ Mask *pMask;
+} DetailRec;
- typedef struct _GrabRec {
+typedef struct _GrabRec {
GrabPtr next; /* for chain of passive grabs */
XID resource;
DeviceIntPtr device;
@@ -129,6 +131,8 @@ typedef struct _KeyClassRec {
unsigned short prev_state;
#ifdef XKB
struct _XkbSrvInfo *xkbInfo;
+#else
+ void *pad0;
#endif
} KeyClassRec, *KeyClassPtr;
@@ -142,12 +146,20 @@ typedef struct _AxisInfo {
typedef struct _ValuatorClassRec {
ValuatorMotionProcPtr GetMotionProc;
- int numMotionEvents;
- WindowPtr motionHintWindow;
- AxisInfoPtr axes;
- unsigned short numAxes;
- int *axisVal;
- CARD8 mode;
+ int numMotionEvents;
+ int first_motion;
+ int last_motion;
+ void *motion;
+
+ WindowPtr motionHintWindow;
+
+ AxisInfoPtr axes;
+ unsigned short numAxes;
+ int *axisVal;
+ int lastx, lasty; /* last event recorded, not posted to
+ * client; see dix/devices.c */
+ int dxremaind, dyremaind; /* for acceleration */
+ CARD8 mode;
} ValuatorClassRec, *ValuatorClassPtr;
typedef struct _ButtonClassRec {
@@ -158,7 +170,9 @@ typedef struct _ButtonClassRec {
CARD8 down[DOWN_LENGTH];
CARD8 map[MAP_LENGTH];
#ifdef XKB
- union _XkbAction * xkb_acts;
+ union _XkbAction *xkb_acts;
+#else
+ void *pad0;
#endif
} ButtonClassRec, *ButtonClassPtr;
@@ -175,6 +189,26 @@ typedef struct _ProximityClassRec {
char pad;
} ProximityClassRec, *ProximityClassPtr;
+typedef struct _AbsoluteClassRec {
+ /* Calibration. */
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+ int flip_x;
+ int flip_y;
+ int rotation;
+ int button_threshold;
+
+ /* Area. */
+ int offset_x;
+ int offset_y;
+ int width;
+ int height;
+ int screen;
+ XID following;
+} AbsoluteClassRec, *AbsoluteClassPtr;
+
typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
@@ -189,6 +223,8 @@ typedef struct _KbdFeedbackClassRec {
KbdFeedbackPtr next;
#ifdef XKB
struct _XkbSrvLedInfo *xkb_sli;
+#else
+ void *pad0;
#endif
} KbdFeedbackClassRec;
@@ -223,6 +259,8 @@ typedef struct _LedFeedbackClassRec {
LedFeedbackPtr next;
#ifdef XKB
struct _XkbSrvLedInfo *xkb_sli;
+#else
+ void *pad0;
#endif
} LedFeedbackClassRec;
@@ -248,6 +286,8 @@ typedef struct _DeviceIntRec {
used to initialize, turn on, or
turn off the device */
Bool inited; /* TRUE if INIT returns Success */
+ Bool enabled; /* TRUE if ON returns Success */
+ Bool coreEvents; /* TRUE if device also sends core */
GrabPtr grab; /* the grabber - used by DIX */
struct {
Bool frozen;
@@ -274,6 +314,7 @@ typedef struct _DeviceIntRec {
ButtonClassPtr button;
FocusClassPtr focus;
ProximityClassPtr proximity;
+ AbsoluteClassPtr absolute;
KbdFeedbackPtr kbdfeed;
PtrFeedbackPtr ptrfeed;
IntegerFeedbackPtr intfeed;
@@ -281,7 +322,9 @@ typedef struct _DeviceIntRec {
BellFeedbackPtr bell;
LedFeedbackPtr leds;
#ifdef XKB
- struct _XkbInterest * xkb_interest;
+ struct _XkbInterest *xkb_interest;
+#else
+ void *pad0;
#endif
DevUnion *devPrivates;
int nPrivates;
diff --git a/include/kdrive-config.h.in b/include/kdrive-config.h.in
index 2f454d702..3bc779218 100644
--- a/include/kdrive-config.h.in
+++ b/include/kdrive-config.h.in
@@ -25,4 +25,10 @@
/* Verbose debugging output hilarity */
#undef DEBUG
+/* Have the backtrace() function. */
+#undef HAVE_BACKTRACE
+
+/* Have execinfo.h for backtrace(). */
+#undef HAVE_EXECINFO_H
+
#endif /* _KDRIVE_CONFIG_H_ */
diff --git a/include/os.h b/include/os.h
index 4c4967164..d4eed220f 100644
--- a/include/os.h
+++ b/include/os.h
@@ -147,6 +147,10 @@ extern void CheckConnections(void);
extern void CloseDownConnection(ClientPtr /*client*/);
+extern void AddGeneralSocket(int /*fd*/);
+
+extern void RemoveGeneralSocket(int /*fd*/);
+
extern void AddEnabledDevice(int /*fd*/);
extern void RemoveEnabledDevice(int /*fd*/);
@@ -506,6 +510,12 @@ __attribute((noreturn))
#endif
;
+#ifdef DEBUG
+#define DebugF ErrorF
+#else
+#define DebugF(x, ...) /* */
+#endif
+
extern void VErrorF(const char *f, va_list args);
extern void ErrorF(const char *f, ...) _printf_attribute(1,2);
extern void Error(char *str);
diff --git a/mi/mi.h b/mi/mi.h
index 97e1b6f3a..8d9d120bd 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -169,11 +169,11 @@ typedef struct _DeviceRec *DevicePtr;
#endif
extern Bool mieqInit(
- DevicePtr /*pKbd*/,
- DevicePtr /*pPtr*/
+ void
);
extern void mieqEnqueue(
+ DeviceIntPtr /*pDev*/,
xEventPtr /*e*/
);
diff --git a/mi/mieq.c b/mi/mieq.c
index a69ce7037..be76580ae 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -45,39 +45,42 @@ in this Software without prior written authorization from The Open Group.
# include "pixmapstr.h"
# include "inputstr.h"
# include "mi.h"
+# include "mipointer.h"
# include "scrnintstr.h"
+# include <X11/extensions/XI.h>
+# include <X11/extensions/XIproto.h>
+# include "extinit.h"
+# include "exglobals.h"
#define QUEUE_SIZE 256
typedef struct _Event {
- xEvent event;
- ScreenPtr pScreen;
+ xEvent event[7];
+ int nevents;
+ ScreenPtr pScreen;
+ DeviceIntPtr pDev;
} EventRec, *EventPtr;
typedef struct _EventQueue {
- HWEventQueueType head, tail; /* long for SetInputCheck */
- CARD32 lastEventTime; /* to avoid time running backwards */
- Bool lastMotion;
- EventRec events[QUEUE_SIZE]; /* static allocation for signals */
- DevicePtr pKbd, pPtr; /* device pointer, to get funcs */
- ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
- ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
+ HWEventQueueType head, tail; /* long for SetInputCheck */
+ CARD32 lastEventTime; /* to avoid time running backwards */
+ int lastMotion; /* device ID if last event motion? */
+ EventRec events[QUEUE_SIZE]; /* static allocation for signals */
+ ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
+ ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
} EventQueueRec, *EventQueuePtr;
static EventQueueRec miEventQueue;
Bool
-mieqInit (pKbd, pPtr)
- DevicePtr pKbd, pPtr;
+mieqInit()
{
miEventQueue.head = miEventQueue.tail = 0;
miEventQueue.lastEventTime = GetTimeInMillis ();
- miEventQueue.pKbd = pKbd;
- miEventQueue.pPtr = pPtr;
miEventQueue.lastMotion = FALSE;
miEventQueue.pEnqueueScreen = screenInfo.screens[0];
miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen;
- SetInputCheck (&miEventQueue.head, &miEventQueue.tail);
+ SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
return TRUE;
}
@@ -89,106 +92,130 @@ mieqInit (pKbd, pPtr)
*/
void
-mieqEnqueue (e)
- xEvent *e;
+mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
{
- HWEventQueueType oldtail, newtail;
- Bool isMotion;
+ HWEventQueueType oldtail = miEventQueue.tail, newtail;
+ int isMotion = 0;
+ deviceValuator *v = (deviceValuator *) e;
+ EventPtr laste = &miEventQueue.events[oldtail - 1];
+ deviceKeyButtonPointer *lastkbp = (deviceKeyButtonPointer *)
+ &laste->event[0];
+
+ if (e->u.u.type == MotionNotify)
+ isMotion = inputInfo.pointer->id;
+ else if (e->u.u.type == DeviceMotionNotify)
+ isMotion = pDev->id;
+
+ /* We silently steal valuator events: just tack them on to the last
+ * motion event they need to be attached to. Sigh. */
+ if (e->u.u.type == DeviceValuator) {
+ if (laste->nevents > 6) {
+ ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
+ return;
+ }
+ if (oldtail == miEventQueue.head ||
+ !(lastkbp->type == DeviceMotionNotify ||
+ lastkbp->type == DeviceButtonPress ||
+ lastkbp->type == DeviceButtonRelease) ||
+ ((lastkbp->deviceid & DEVICE_BITS) !=
+ (v->deviceid & DEVICE_BITS))) {
+ ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n");
+ return;
+ }
+ memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent));
+ return;
+ }
- oldtail = miEventQueue.tail;
- isMotion = e->u.u.type == MotionNotify;
- if (isMotion && miEventQueue.lastMotion && oldtail != miEventQueue.head)
- {
+ if (isMotion && isMotion == miEventQueue.lastMotion &&
+ oldtail != miEventQueue.head) {
if (oldtail == 0)
oldtail = QUEUE_SIZE;
oldtail = oldtail - 1;
}
- else
- {
+ else {
newtail = oldtail + 1;
if (newtail == QUEUE_SIZE)
newtail = 0;
/* Toss events which come in late */
- if (newtail == miEventQueue.head)
+ if (newtail == miEventQueue.head) {
+ ErrorF("tossed event which came in late\n");
return;
+ }
miEventQueue.tail = newtail;
}
- miEventQueue.lastMotion = isMotion;
- miEventQueue.events[oldtail].event = *e;
- /*
- * Make sure that event times don't go backwards - this
- * is "unnecessary", but very useful
- */
+
+ memcpy(&(miEventQueue.events[oldtail].event[0]), e, sizeof(xEvent));
+ miEventQueue.events[oldtail].nevents = 1;
+
+ /* Make sure that event times don't go backwards - this
+ * is "unnecessary", but very useful. */
if (e->u.keyButtonPointer.time < miEventQueue.lastEventTime &&
miEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
- {
- miEventQueue.events[oldtail].event.u.keyButtonPointer.time =
+ miEventQueue.events[oldtail].event[0].u.keyButtonPointer.time =
miEventQueue.lastEventTime;
- }
+
miEventQueue.lastEventTime =
- miEventQueue.events[oldtail].event.u.keyButtonPointer.time;
+ miEventQueue.events[oldtail].event[0].u.keyButtonPointer.time;
miEventQueue.events[oldtail].pScreen = miEventQueue.pEnqueueScreen;
+ miEventQueue.events[oldtail].pDev = pDev;
+
+ miEventQueue.lastMotion = isMotion;
}
void
-mieqSwitchScreen (pScreen, fromDIX)
- ScreenPtr pScreen;
- Bool fromDIX;
+mieqSwitchScreen(ScreenPtr pScreen, Bool fromDIX)
{
miEventQueue.pEnqueueScreen = pScreen;
if (fromDIX)
miEventQueue.pDequeueScreen = pScreen;
}
-/*
- * Call this from ProcessInputEvents()
- */
-
-void mieqProcessInputEvents ()
+/* Call this from ProcessInputEvents(). */
+void
+mieqProcessInputEvents()
{
- EventRec *e;
- int x, y;
- xEvent xe;
-
- while (miEventQueue.head != miEventQueue.tail)
- {
- if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
-
- e = &miEventQueue.events[miEventQueue.head];
- /*
- * Assumption - screen switching can only occur on motion events
- */
- if (e->pScreen != miEventQueue.pDequeueScreen)
- {
- miEventQueue.pDequeueScreen = e->pScreen;
- x = e->event.u.keyButtonPointer.rootX;
- y = e->event.u.keyButtonPointer.rootY;
- if (miEventQueue.head == QUEUE_SIZE - 1)
- miEventQueue.head = 0;
- else
- ++miEventQueue.head;
- NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
- }
- else
- {
- xe = e->event;
- if (miEventQueue.head == QUEUE_SIZE - 1)
- miEventQueue.head = 0;
- else
- ++miEventQueue.head;
- switch (xe.u.u.type)
- {
- case KeyPress:
- case KeyRelease:
- (*miEventQueue.pKbd->processInputProc)
- (&xe, (DeviceIntPtr)miEventQueue.pKbd, 1);
- break;
- default:
- (*miEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)miEventQueue.pPtr, 1);
- break;
- }
- }
+ EventRec *e = NULL;
+ int x = 0, y = 0;
+ DeviceIntPtr dev = NULL;
+
+ while (miEventQueue.head != miEventQueue.tail) {
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
+
+ e = &miEventQueue.events[miEventQueue.head];
+ /* Assumption - screen switching can only occur on motion events. */
+ if (e->pScreen != miEventQueue.pDequeueScreen) {
+ miEventQueue.pDequeueScreen = e->pScreen;
+ x = e->event[0].u.keyButtonPointer.rootX;
+ y = e->event[0].u.keyButtonPointer.rootY;
+ if (miEventQueue.head == QUEUE_SIZE - 1)
+ miEventQueue.head = 0;
+ else
+ ++miEventQueue.head;
+ NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
+ }
+ else {
+ if (miEventQueue.head == QUEUE_SIZE - 1)
+ miEventQueue.head = 0;
+ else
+ ++miEventQueue.head;
+
+ if (e->event[0].u.u.type == KeyPress ||
+ e->event[0].u.u.type == KeyRelease) {
+ SwitchCoreKeyboard(e->pDev);
+ dev = inputInfo.keyboard;
+ }
+ else if (e->event[0].u.u.type == MotionNotify ||
+ e->event[0].u.u.type == ButtonPress ||
+ e->event[0].u.u.type == ButtonRelease) {
+ SwitchCorePointer(e->pDev);
+ dev = inputInfo.pointer;
+ }
+ else {
+ dev = e->pDev;
+ }
+
+ dev->public.processInputProc(e->event, dev, e->nevents);
+ }
}
}
diff --git a/mi/miinitext.c b/mi/miinitext.c
index aafd014ae..f61859578 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -549,7 +549,7 @@ InitExtensions(argc, argv)
#ifdef MULTIBUFFER
if (!noMultibufferExtension) MultibufferExtensionInit();
#endif
-#if defined(XINPUT) && !defined(NO_HW_ONLY_EXTS)
+#if defined(XINPUT)
if (!noXInputExtension) XInputExtensionInit();
#endif
#ifdef XTEST
@@ -579,7 +579,7 @@ InitExtensions(argc, argv)
#ifdef XSYNC
if (!noSyncExtension) SyncExtensionInit();
#endif
-#if defined(XKB) && !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
+#if defined(XKB) && !defined(PRINT_ONLY_SERVER)
if (!noXkbExtension) XkbExtensionInit();
#endif
#ifdef XCMISC
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 1715965fa..dbe2aaeab 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -44,6 +44,7 @@ in this Software without prior written authorization from The Open Group.
# include "mipointrst.h"
# include "cursorstr.h"
# include "dixstruct.h"
+# include "inputstr.h"
_X_EXPORT int miPointerScreenIndex;
static unsigned long miPointerGeneration = 0;
@@ -127,7 +128,6 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
miPointer.confined = FALSE;
miPointer.x = 0;
miPointer.y = 0;
- miPointer.history_start = miPointer.history_end = 0;
return TRUE;
}
@@ -178,7 +178,7 @@ miPointerDisplayCursor (pScreen, pCursor)
{
miPointer.pCursor = pCursor;
miPointer.pScreen = pScreen;
- miPointerUpdate ();
+ miPointerUpdateSprite(inputInfo.pointer);
return TRUE;
}
@@ -225,7 +225,7 @@ miPointerSetCursorPosition(pScreen, x, y, generateEvent)
/* device dependent - must pend signal and call miPointerWarpCursor */
(*pScreenPriv->screenFuncs->WarpCursor) (pScreen, x, y);
if (!generateEvent)
- miPointerUpdate();
+ miPointerUpdateSprite(inputInfo.pointer);
return TRUE;
}
@@ -266,39 +266,6 @@ miPointerWarpCursor (pScreen, x, y)
* Pointer/CursorDisplay interface routines
*/
-_X_EXPORT int
-miPointerGetMotionBufferSize ()
-{
- return MOTION_SIZE;
-}
-
-_X_EXPORT int
-miPointerGetMotionEvents (pPtr, coords, start, stop, pScreen)
- DeviceIntPtr pPtr;
- xTimecoord *coords;
- unsigned long start, stop;
- ScreenPtr pScreen;
-{
- int i;
- int count = 0;
- miHistoryPtr h;
-
- for (i = miPointer.history_start; i != miPointer.history_end;)
- {
- h = &miPointer.history[i];
- if (h->event.time >= stop)
- break;
- if (h->event.time >= start)
- {
- *coords++ = h->event;
- count++;
- }
- if (++i == MOTION_SIZE) i = 0;
- }
- return count;
-}
-
-
/*
* miPointerUpdate
*
@@ -308,18 +275,29 @@ miPointerGetMotionEvents (pPtr, coords, start, stop, pScreen)
void
miPointerUpdate ()
{
+ miPointerUpdateSprite(inputInfo.pointer);
+}
+
+void
+miPointerUpdateSprite (DeviceIntPtr pDev)
+{
ScreenPtr pScreen;
miPointerScreenPtr pScreenPriv;
CursorPtr pCursor;
int x, y, devx, devy;
+ if (!pDev || !(pDev->coreEvents || pDev == inputInfo.pointer))
+ return;
+
pScreen = miPointer.pScreen;
+ if (!pScreen)
+ return;
+
x = miPointer.x;
y = miPointer.y;
devx = miPointer.devx;
devy = miPointer.devy;
- if (!pScreen)
- return;
+
pScreenPriv = GetScreenPrivate (pScreen);
/*
* if the cursor has switched screens, disable the sprite
@@ -376,16 +354,22 @@ miPointerUpdate ()
*/
void
-miPointerDeltaCursor (dx, dy, time)
- int dx, dy;
- unsigned long time;
+miPointerDeltaCursor (int dx, int dy, unsigned long time)
{
- miPointerAbsoluteCursor (miPointer.x + dx, miPointer.y + dy, time);
+ int x = miPointer.x + dx, y = miPointer.y + dy;
+
+ miPointerSetPosition(inputInfo.pointer, &x, &y, time);
}
void
miPointerSetNewScreen(int screen_no, int x, int y)
{
+ miPointerSetScreen(inputInfo.pointer, screen_no, x, y);
+}
+
+void
+miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
+{
miPointerScreenPtr pScreenPriv;
ScreenPtr pScreen;
@@ -400,17 +384,26 @@ miPointerSetNewScreen(int screen_no, int x, int y)
_X_EXPORT ScreenPtr
miPointerCurrentScreen ()
{
- return (miPointer.pScreen);
+ return miPointerGetScreen(inputInfo.pointer);
}
-/*
- * miPointerAbsoluteCursor. The pointer has moved to x,y
- */
+_X_EXPORT ScreenPtr
+miPointerGetScreen(DeviceIntPtr pDev)
+{
+ return miPointer.pScreen;
+}
+/* Move the pointer to x, y on the current screen, update the sprite, and
+ * the motion history. Generates no events. Does not return changed x
+ * and y if they are clipped; use miPointerSetPosition instead. */
_X_EXPORT void
-miPointerAbsoluteCursor (x, y, time)
- int x, y;
- unsigned long time;
+miPointerAbsoluteCursor (int x, int y, unsigned long time)
+{
+ miPointerSetPosition(inputInfo.pointer, &x, &y, time);
+}
+
+_X_EXPORT void
+miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time)
{
miPointerScreenPtr pScreenPriv;
ScreenPtr pScreen;
@@ -419,13 +412,17 @@ miPointerAbsoluteCursor (x, y, time)
pScreen = miPointer.pScreen;
if (!pScreen)
return; /* called before ready */
- if (x < 0 || x >= pScreen->width || y < 0 || y >= pScreen->height)
+
+ if (!pDev || !(pDev->coreEvents || pDev == inputInfo.pointer))
+ return;
+
+ if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height)
{
pScreenPriv = GetScreenPrivate (pScreen);
if (!miPointer.confined)
{
newScreen = pScreen;
- (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y);
+ (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, x, y);
if (newScreen != pScreen)
{
pScreen = newScreen;
@@ -437,93 +434,58 @@ miPointerAbsoluteCursor (x, y, time)
}
}
}
- /*
- * constrain the hot-spot to the current
- * limits
- */
- if (x < miPointer.limits.x1)
- x = miPointer.limits.x1;
- if (x >= miPointer.limits.x2)
- x = miPointer.limits.x2 - 1;
- if (y < miPointer.limits.y1)
- y = miPointer.limits.y1;
- if (y >= miPointer.limits.y2)
- y = miPointer.limits.y2 - 1;
- if (miPointer.x == x && miPointer.y == y && miPointer.pScreen == pScreen)
+ /* Constrain the sprite to the current limits. */
+ if (*x < miPointer.limits.x1)
+ *x = miPointer.limits.x1;
+ if (*x >= miPointer.limits.x2)
+ *x = miPointer.limits.x2 - 1;
+ if (*y < miPointer.limits.y1)
+ *y = miPointer.limits.y1;
+ if (*y >= miPointer.limits.y2)
+ *y = miPointer.limits.y2 - 1;
+
+ if (miPointer.x == *x && miPointer.y == *y && miPointer.pScreen == pScreen)
return;
- miPointerMove (pScreen, x, y, time);
+
+ miPointerMoved(pDev, pScreen, *x, *y, time);
+}
+
+_X_EXPORT void
+miPointerPosition (int *x, int *y)
+{
+ miPointerGetPosition(inputInfo.pointer, x, y);
}
_X_EXPORT void
-miPointerPosition (x, y)
- int *x, *y;
+miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
{
*x = miPointer.x;
*y = miPointer.y;
}
-/*
- * miPointerMove. The pointer has moved to x,y on current screen
- */
+void
+miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time)
+{
+ miPointerMoved(inputInfo.pointer, pScreen, x, y, time);
+}
-static void
-miPointerMove (pScreen, x, y, time)
- ScreenPtr pScreen;
- int x, y;
- unsigned long time;
+/* Move the pointer on the current screen, and update the sprite. */
+void
+miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
+ unsigned long time)
{
SetupScreen(pScreen);
- xEvent xE;
- miHistoryPtr history;
- int prev, end, start;
- if (!pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen)
+ if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) &&
+ !pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen)
{
miPointer.devx = x;
miPointer.devy = y;
if(!miPointer.pCursor->bits->emptyMask)
(*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
}
+
miPointer.x = x;
miPointer.y = y;
miPointer.pScreen = pScreen;
-
- xE.u.u.type = MotionNotify;
- xE.u.keyButtonPointer.rootX = x;
- xE.u.keyButtonPointer.rootY = y;
- xE.u.keyButtonPointer.time = time;
- (*pScreenPriv->screenFuncs->EnqueueEvent) (&xE);
-
- end = miPointer.history_end;
- start = miPointer.history_start;
- prev = end - 1;
- if (end == 0)
- prev = MOTION_SIZE - 1;
- history = &miPointer.history[prev];
- if (end == start || history->event.time != time)
- {
- history = &miPointer.history[end];
- if (++end == MOTION_SIZE)
- end = 0;
- if (end == start)
- {
- start = end + 1;
- if (start == MOTION_SIZE)
- start = 0;
- miPointer.history_start = start;
- }
- miPointer.history_end = end;
- }
- history->event.x = x;
- history->event.y = y;
- history->event.time = time;
- history->pScreen = pScreen;
-}
-
-void
-miRegisterPointerDevice (pScreen, pDevice)
- ScreenPtr pScreen;
- DeviceIntPtr pDevice;
-{
- miPointer.pPointer = (DevicePtr)pDevice;
}
diff --git a/mi/mipointer.h b/mi/mipointer.h
index aae38377c..30e89444b 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -73,6 +73,7 @@ typedef struct _miPointerScreenFuncRec {
int /* y */
);
void (*EnqueueEvent)(
+ DeviceIntPtr /* pDev */,
xEventPtr /* event */
);
void (*NewEventScreen)(
@@ -97,11 +98,11 @@ extern void miPointerWarpCursor(
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/
-);
+) _X_DEPRECATED;
extern int miPointerGetMotionBufferSize(
void
-);
+) _X_DEPRECATED;
extern int miPointerGetMotionEvents(
DeviceIntPtr /*pPtr*/,
@@ -111,40 +112,74 @@ extern int miPointerGetMotionEvents(
ScreenPtr /*pScreen*/
);
+/* Deprecated in favour of miPointerUpdateSprite. */
extern void miPointerUpdate(
void
-);
+) _X_DEPRECATED;
+/* Deprecated in favour of miSetPointerPosition. */
extern void miPointerDeltaCursor(
int /*dx*/,
int /*dy*/,
unsigned long /*time*/
-);
-
+) _X_DEPRECATED;
extern void miPointerAbsoluteCursor(
int /*x*/,
int /*y*/,
unsigned long /*time*/
-);
+) _X_DEPRECATED;
+/* Deprecated in favour of miGetPointerPosition. */
extern void miPointerPosition(
int * /*x*/,
int * /*y*/
-);
+) _X_DEPRECATED;
+/* Deprecated in favour of miPointerSetScreen. */
extern void miPointerSetNewScreen(
int, /*screen_no*/
- int, /*x*/
- int /*y*/
-);
+ int, /*x*/
+ int /*y*/
+) _X_DEPRECATED;
+
+/* Deprecated in favour of miPointerGetScreen. */
extern ScreenPtr miPointerCurrentScreen(
void
-);
-
-extern void miRegisterPointerDevice(
- ScreenPtr /*pScreen*/,
- DeviceIntPtr /*pDevice*/
-);
+) _X_DEPRECATED;
+
+extern ScreenPtr miPointerGetScreen(
+ DeviceIntPtr pDev);
+extern void miPointerSetScreen(
+ DeviceIntPtr pDev,
+ int screen_num,
+ int x,
+ int y);
+
+/* Returns the current cursor position. */
+extern void miPointerGetPosition(
+ DeviceIntPtr pDev,
+ int *x,
+ int *y);
+
+/* Moves the cursor to the specified position. May clip the co-ordinates:
+ * x and y are modified in-place. */
+extern void miPointerSetPosition(
+ DeviceIntPtr pDev,
+ int *x,
+ int *y,
+ unsigned long time);
+
+extern void miPointerUpdateSprite(
+ DeviceIntPtr pDev);
+
+/* Moves the sprite to x, y on the current screen, and updates the event
+ * history. */
+extern void miPointerMoved(
+ DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ int x,
+ int y,
+ unsigned long time);
extern int miPointerScreenIndex;
diff --git a/mi/mipointrst.h b/mi/mipointrst.h
index f1fbfe4f9..a80c52e7a 100644
--- a/mi/mipointrst.h
+++ b/mi/mipointrst.h
@@ -32,13 +32,6 @@ in this Software without prior written authorization from The Open Group.
#include "mipointer.h"
#include "scrnintstr.h"
-#define MOTION_SIZE 256
-
-typedef struct {
- xTimecoord event;
- ScreenPtr pScreen;
-} miHistoryRec, *miHistoryPtr;
-
typedef struct {
ScreenPtr pScreen; /* current screen */
ScreenPtr pSpriteScreen;/* screen containing current sprite */
@@ -48,9 +41,6 @@ typedef struct {
Bool confined; /* pointer can't change screens */
int x, y; /* hot spot location */
int devx, devy; /* sprite position */
- DevicePtr pPointer; /* pointer device structure */
- miHistoryRec history[MOTION_SIZE];
- int history_start, history_end;
} miPointerRec, *miPointerPtr;
typedef struct {
diff --git a/os/Makefile.am b/os/Makefile.am
index 71e24c086..7381797ab 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -3,14 +3,14 @@ noinst_LTLIBRARIES = libos.la libcwrapper.la
AM_CFLAGS = $(DIX_CFLAGS)
# FIXME: Add support for these in configure.ac
-K5AUTH_SOURCES = k5auth.c
-SECURERPC_SOURCES = rpcauth.c
-INTERNALMALLOC_SOURCES = xalloc.c
+K5AUTH_SRCS = k5auth.c
+SECURERPC_SRCS = rpcauth.c
+INTERNALMALLOC_SRCS = xalloc.c
-XCSECURITY_SOURCES = secauth.c
-XDMCP_SOURCES = xdmcp.c
-STRLCAT_SOURCES = strlcat.c strlcpy.c
-XORG_SOURCES = log.c
+XCSECURITY_SRCS = secauth.c
+XDMCP_SRCS = xdmcp.c
+STRLCAT_SRCS = strlcat.c strlcpy.c
+XORG_SRCS = log.c
libos_la_SOURCES = \
WaitFor.c \
@@ -27,18 +27,18 @@ libos_la_SOURCES = \
xdmauth.c \
xstrans.c \
xprintf.c \
- $(XORG_SOURCES)
+ $(XORG_SRCS)
if XCSECURITY
-libos_la_SOURCES += $(XCSECURITY_SOURCES)
+libos_la_SOURCES += $(XCSECURITY_SRCS)
endif
if XDMCP
-libos_la_SOURCES += $(XDMCP_SOURCES)
+libos_la_SOURCES += $(XDMCP_SRCS)
endif
if NEED_STRLCAT
-libos_la_SOURCES += $(STRLCAT_SOURCES)
+libos_la_SOURCES += $(STRLCAT_SRCS)
endif
libcwrapper_la_SOURCES = \
@@ -48,5 +48,17 @@ libcwrapper_la_CFLAGS = \
-I$(top_srcdir)/hw/xfree86/os-support \
$(AM_CFLAGS)
-EXTRA_DIST = $(K5AUTH_SOURCES) $(SECURERPC_SOURCES) $(INTERNALMALLOC_SOURCES) \
- $(XCSECURITY_SOURCES) $(XDMCP_SOURCES) $(LBX_SOURCES) $(STRLCAT_SOURCES)
+EXTRA_DIST = $(K5AUTH_SRCS) $(SECURERPC_SRCS) $(INTERNALMALLOC_SRCS) \
+ $(XCSECURITY_SRCS) $(XDMCP_SRCS) $(STRLCAT_SRCS)
+
+if XSERVER_DTRACE
+# Generate dtrace object code for probes in libos & libdix
+dtrace.o: $(top_srcdir)/dix/Xserver.d $(am_libos_la_OBJECTS)
+ $(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o ../dix/.libs/*.o
+
+noinst_LIBRARIES = os.O
+
+os.O: dtrace.o $(am_libos_la_OBJECTS)
+ ld -r -o $@ dtrace.o .libs/*.o
+
+endif
diff --git a/os/WaitFor.c b/os/WaitFor.c
index 896fdf15d..6109e3477 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -202,11 +202,12 @@ WaitForSomething(int *pClientsReady)
{
now = GetTimeInMillis();
timeout = timers->expires - now;
- /* time has rewound. reset the timers. */
- if (timeout > timers->delta) {
+ if (timeout > 0 && timeout > timers->delta + 250) {
+ /* time has rewound. reset the timers. */
CheckAllTimers(now);
timeout = timers->expires - now;
}
+
if (timeout < 0)
timeout = 0;
waittime.tv_sec = timeout / MILLI_PER_SECOND;
@@ -434,17 +435,18 @@ ANYSET(FdMask *src)
#endif
/* If time has rewound, re-run every affected timer.
- * TimerForce will change timer->next, but it will _generally_ only
- * promote timers in the list, meaning that we should still be
- * walking every timer. */
+ * Timers might drop out of the list, so we have to restart every time. */
static void
CheckAllTimers(CARD32 now)
{
OsTimerPtr timer;
+start:
for (timer = timers; timer; timer = timer->next) {
- if (timer->expires - now > timer->delta)
+ if (timer->expires - now > timer->delta + 250) {
TimerForce(timer);
+ goto start;
+ }
}
}
@@ -507,10 +509,8 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis,
}
for (prev = &timers;
*prev && (int) ((*prev)->expires - millis) <= 0;
- prev = &(*prev)->next) {
- if ((*prev)->expires - now > (*prev)->delta)
- CheckAllTimers(now);
- }
+ prev = &(*prev)->next)
+ ;
timer->next = *prev;
*prev = timer;
return timer;
diff --git a/os/connection.c b/os/connection.c
index 571ba58ab..cdd1d184a 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -165,6 +165,18 @@ extern __const__ int _nfiles;
#include <netdnet/dn.h>
#endif /* DNETCONN */
+#ifdef HAS_GETPEERUCRED
+# include <ucred.h>
+# include <zone.h>
+#endif
+
+#ifdef XSERVER_DTRACE
+# include <sys/types.h>
+typedef const char *string;
+# include "../dix/Xserver-dtrace.h"
+# include <ucred.h>
+#endif
+
int lastfdesc; /* maximum file descriptor */
fd_set WellKnownConnections; /* Listener mask */
@@ -549,6 +561,13 @@ AuthAudit (ClientPtr client, Bool letin,
{
char addr[128];
char *out = addr;
+ int client_uid;
+ char client_uid_string[64];
+#ifdef HAS_GETPEERUCRED
+ ucred_t *peercred = NULL;
+ pid_t client_pid = -1;
+ zoneid_t client_zid = -1;
+#endif
if (!len)
strcpy(out, "local host");
@@ -585,14 +604,44 @@ AuthAudit (ClientPtr client, Bool letin,
default:
strcpy(out, "unknown address");
}
+
+#ifdef HAS_GETPEERUCRED
+ if (getpeerucred(((OsCommPtr)client->osPrivate)->fd, &peercred) >= 0) {
+ client_uid = ucred_geteuid(peercred);
+ client_pid = ucred_getpid(peercred);
+ client_zid = ucred_getzoneid(peercred);
+
+ ucred_free(peercred);
+ snprintf(client_uid_string, sizeof(client_uid_string),
+ " (uid %ld, pid %ld, zone %ld)",
+ (long) client_uid, (long) client_pid, (long) client_zid);
+ }
+#else
+ if (LocalClientCred(client, &client_uid, NULL) != -1) {
+ snprintf(client_uid_string, sizeof(client_uid_string),
+ " (uid %d)", client_uid);
+ }
+#endif
+ else {
+ client_uid_string[0] = '\0';
+ }
- if (proto_n)
- AuditF("client %d %s from %s\n Auth name: %.*s ID: %d\n",
+#ifdef XSERVER_DTRACE
+ XSERVER_CLIENT_AUTH(client->index, addr, client_pid, client_zid);
+ if (auditTrailLevel > 1) {
+#endif
+ if (proto_n)
+ AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n",
+ client->index, letin ? "connected" : "rejected", addr,
+ client_uid_string, (int)proto_n, auth_proto, auth_id);
+ else
+ AuditF("client %d %s from %s%s\n",
client->index, letin ? "connected" : "rejected", addr,
- (int)proto_n, auth_proto, auth_id);
- else
- AuditF("client %d %s from %s\n",
- client->index, letin ? "connected" : "rejected", addr);
+ client_uid_string);
+
+#ifdef XSERVER_DTRACE
+ }
+#endif
}
XID
@@ -659,7 +708,11 @@ ClientAuthorized(ClientPtr client,
else
{
auth_id = (XID) 0;
+#ifdef XSERVER_DTRACE
+ if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
+#else
if (auditTrailLevel > 1)
+#endif
AuthAudit(client, TRUE,
(struct sockaddr *) from, fromlen,
proto_n, auth_proto, auth_id);
@@ -675,7 +728,11 @@ ClientAuthorized(ClientPtr client,
return "Client is not authorized to connect to Server";
}
}
+#ifdef XSERVER_DTRACE
+ else if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
+#else
else if (auditTrailLevel > 1)
+#endif
{
if (_XSERVTransGetPeerAddr (trans_conn,
&family, &fromlen, &from) != -1)
@@ -753,6 +810,9 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
ErrorF("AllocNewConnection: client index = %d, socket fd = %d\n",
client->index, fd);
#endif
+#ifdef XSERVER_DTRACE
+ XSERVER_CLIENT_CONNECT(client->index, fd);
+#endif
return client;
}
@@ -1014,16 +1074,22 @@ CloseDownConnection(ClientPtr client)
}
_X_EXPORT void
-AddEnabledDevice(int fd)
+AddGeneralSocket(int fd)
{
- FD_SET(fd, &EnabledDevices);
FD_SET(fd, &AllSockets);
if (GrabInProgress)
FD_SET(fd, &SavedAllSockets);
}
_X_EXPORT void
-RemoveEnabledDevice(int fd)
+AddEnabledDevice(int fd)
+{
+ FD_SET(fd, &EnabledDevices);
+ AddGeneralSocket(fd);
+}
+
+_X_EXPORT void
+RemoveGeneralSocket(int fd)
{
FD_CLR(fd, &EnabledDevices);
FD_CLR(fd, &AllSockets);
@@ -1031,6 +1097,13 @@ RemoveEnabledDevice(int fd)
FD_CLR(fd, &SavedAllSockets);
}
+_X_EXPORT void
+RemoveEnabledDevice(int fd)
+{
+ FD_CLR(fd, &EnabledDevices);
+ RemoveGeneralSocket(fd);
+}
+
/*****************
* OnlyListenToOneClient:
* Only accept requests from one client. Continue to handle new
diff --git a/os/utils.c b/os/utils.c
index 7d258a444..65e131166 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -58,6 +58,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
#ifdef _POSIX_C_SOURCE
#define _SAVED_POSIX_C_SOURCE _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
+#else if defined(sun) /* Needed to tell Solaris headers not to restrict to */
+#define __EXTENSIONS__ /* only the functions defined in POSIX 199309. */
#endif
#define _POSIX_C_SOURCE 199309L
#include <time.h>
@@ -552,7 +554,7 @@ GetTimeInMillis(void)
#ifdef MONOTONIC_CLOCK
struct timespec tp;
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
- return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000);
+ return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
#endif
X_GETTIMEOFDAY(&tv);
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index 8356e47e7..c474733d0 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -324,8 +324,11 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
XkbFreeIndicatorMaps(xkb);
if (which&XkbNamesMask)
XkbFreeNames(xkb,XkbAllNamesMask,True);
- if ((which&XkbGeometryMask) && (xkb->geom!=NULL))
+ if ((which&XkbGeometryMask) && (xkb->geom!=NULL)) {
XkbFreeGeometry(xkb->geom,XkbGeomAllMask,True);
+ /* PERHAPS BONGHITS etc */
+ xkb->geom = NULL;
+ }
if (which&XkbControlsMask)
XkbFreeControls(xkb,XkbAllControlsMask,True);
if (freeAll)
diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c
index ff9dd99cf..53f3a6f9c 100644
--- a/xkb/ddxBeep.c
+++ b/xkb/ddxBeep.c
@@ -39,12 +39,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XKBsrv.h>
#include <X11/extensions/XI.h>
-#if (defined(__osf__) && defined(__alpha))
-#include <sys/sysinfo.h>
-#include <alpha/hal_sysinfo.h>
-#include <alpha/prom.h>
-#endif
-
/*#define FALLING_TONE 1*/
/*#define RISING_TONE 1*/
#define FALLING_TONE 10
@@ -116,32 +110,6 @@ _XkbDDXBeepInitAtoms(void)
stickyLock= MAKE_ATOM(STICKY_LOCK);
stickyUnlock= MAKE_ATOM(STICKY_UNLOCK);
bounceReject= MAKE_ATOM(BOUNCE_REJECT);
-#if (defined(__osf__) && defined(__alpha))
- /* [[[ WDW - Some bells do not allow for pitch changes.
- * Maybe this could become part of the keymap? ]]]
- */
- {
- char keyboard[8];
-
- /* Find the class of keyboard being used.
- */
- keyboard[0] = '\0';
- if (-1 == getsysinfo(GSI_KEYBOARD,
- keyboard, sizeof(keyboard),
- 0, NULL))
- keyboard[0] = '\0';
-
- if ((strcmp(keyboard,"LK201") == 0) ||
- (strcmp(keyboard,"LK401") == 0) ||
- (strcmp(keyboard,"LK421") == 0) ||
- (strcmp(keyboard,"LK443") == 0))
- doesPitch = 0;
- }
-#else
-#if defined(sun)
- doesPitch = 0;
-#endif
-#endif
return;
}
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 5795f8b0d..6e8f8921c 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -403,30 +403,6 @@ char tmpname[PATH_MAX];
strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0';
}
-#if defined(Lynx) && defined(__i386__) && defined(NEED_POPEN_WORKAROUND)
- /* somehow popen/pclose is broken on LynxOS AT 2.3.0/2.4.0!
- * the problem usually shows up with XF86Setup
- * this hack waits at max 5 seconds after pclose() returns
- * for the output of the xkbcomp output file.
- * I didn't manage to get a patch in time for the 3.2 release
- */
- {
- int i;
- char name[PATH_MAX];
- if (XkbBaseDirectory!=NULL)
- sprintf(name,"%s/%s%s.xkm", XkbBaseDirectory
- ,xkm_output_dir, keymap);
- else
- sprintf(name,"%s%s.xkm", xkm_output_dir, keymap);
- for (i = 0; i < 10; i++) {
- if (access(name, 0) == 0) break;
- usleep(500000);
- }
-#ifdef DEBUG
- if (i) ErrorF(">>>> Waited %d times for %s\n", i, name);
-#endif
- }
-#endif
if (buf != NULL)
xfree (buf);
return True;
diff --git a/xkb/xkb.c b/xkb/xkb.c
index f892c431f..2c97e05db 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -347,6 +347,7 @@ ProcXkbSelectEvents(ClientPtr client)
/***====================================================================***/
+/* FIXME: Needs to ding on all core-sending devices. */
int
ProcXkbBell(ClientPtr client)
{
@@ -534,56 +535,67 @@ int
ProcXkbLatchLockState(ClientPtr client)
{
int status;
- DeviceIntPtr dev;
+ DeviceIntPtr dev, tmpd;
XkbStateRec oldState,*newState;
CARD16 changed;
+ xkbStateNotify sn;
+ XkbEventCauseRec cause;
REQUEST(xkbLatchLockStateReq);
REQUEST_SIZE_MATCH(xkbLatchLockStateReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
- CHK_MASK_MATCH(0x01,stuff->affectModLocks,stuff->modLocks);
- CHK_MASK_MATCH(0x01,stuff->affectModLatches,stuff->modLatches);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec);
+ CHK_MASK_MATCH(0x01, stuff->affectModLocks, stuff->modLocks);
+ CHK_MASK_MATCH(0x01, stuff->affectModLatches, stuff->modLatches);
status = Success;
- oldState= dev->key->xkbInfo->state;
- newState= &dev->key->xkbInfo->state;
- if ( stuff->affectModLocks ) {
- newState->locked_mods&= ~stuff->affectModLocks;
- newState->locked_mods|= (stuff->affectModLocks&stuff->modLocks);
- }
- if (( status == Success ) && stuff->lockGroup )
- newState->locked_group = stuff->groupLock;
- if (( status == Success ) && stuff->affectModLatches )
- status=XkbLatchModifiers(dev,stuff->affectModLatches,stuff->modLatches);
- if (( status == Success ) && stuff->latchGroup )
- status=XkbLatchGroup(dev,stuff->groupLatch);
-
- if ( status != Success )
- return status;
-
- XkbComputeDerivedState(dev->key->xkbInfo);
- dev->key->state= XkbStateFieldFromRec(newState);
- changed = XkbStateChangedFlags(&oldState,newState);
- if (changed) {
- xkbStateNotify sn;
- sn.keycode= 0;
- sn.eventType= 0;
- sn.requestMajor = XkbReqCode;
- sn.requestMinor = X_kbLatchLockState;
- sn.changed= changed;
- XkbSendStateNotify(dev,&sn);
- changed= XkbIndicatorsToUpdate(dev,changed,False);
- if (changed) {
- XkbEventCauseRec cause;
- XkbSetCauseXkbReq(&cause,X_kbLatchLockState,client);
- XkbUpdateIndicators(dev,changed,True,NULL,&cause);
- }
+ for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
+ if ((dev == inputInfo.keyboard && tmpd->key && tmpd->coreEvents) ||
+ tmpd == dev) {
+ if (!tmpd->key->xkbInfo)
+ continue;
+
+ oldState = tmpd->key->xkbInfo->state;
+ newState = &tmpd->key->xkbInfo->state;
+ if (stuff->affectModLocks) {
+ newState->locked_mods &= ~stuff->affectModLocks;
+ newState->locked_mods |= (stuff->affectModLocks & stuff->modLocks);
+ }
+ if (status == Success && stuff->lockGroup)
+ newState->locked_group = stuff->groupLock;
+ if (status == Success && stuff->affectModLatches)
+ status = XkbLatchModifiers(tmpd, stuff->affectModLatches,
+ stuff->modLatches);
+ if (status == Success && stuff->latchGroup)
+ status = XkbLatchGroup(tmpd, stuff->groupLatch);
+
+ if (status != Success)
+ return status;
+
+ XkbComputeDerivedState(tmpd->key->xkbInfo);
+ tmpd->key->state = XkbStateFieldFromRec(newState);
+
+ changed = XkbStateChangedFlags(&oldState, newState);
+ if (changed) {
+ sn.keycode = 0;
+ sn.eventType = 0;
+ sn.requestMajor = XkbReqCode;
+ sn.requestMinor = X_kbLatchLockState;
+ sn.changed = changed;
+ XkbSendStateNotify(tmpd, &sn);
+ changed = XkbIndicatorsToUpdate(tmpd, changed, False);
+ if (changed) {
+ XkbSetCauseXkbReq(&cause, X_kbLatchLockState, client);
+ XkbUpdateIndicators(tmpd, changed, True, NULL, &cause);
+ }
+ }
+ }
}
+
return client->noClientException;
}
@@ -666,7 +678,7 @@ ProcXkbGetControls(ClientPtr client)
int
ProcXkbSetControls(ClientPtr client)
{
- DeviceIntPtr dev;
+ DeviceIntPtr dev, tmpd;
XkbSrvInfoPtr xkbi;
XkbControlsPtr ctrl;
XkbControlsRec new,old;
@@ -677,161 +689,213 @@ ProcXkbSetControls(ClientPtr client)
REQUEST(xkbSetControlsReq);
REQUEST_SIZE_MATCH(xkbSetControlsReq);
- if (!(client->xkbClientFlags&_XkbClientInitialized))
+ if (!(client->xkbClientFlags & _XkbClientInitialized))
return BadAccess;
- CHK_KBD_DEVICE(dev,stuff->deviceSpec);
- CHK_MASK_LEGAL(0x01,stuff->changeCtrls,XkbAllControlsMask);
+ CHK_KBD_DEVICE(dev, stuff->deviceSpec);
+ CHK_MASK_LEGAL(0x01, stuff->changeCtrls, XkbAllControlsMask);
+
+ for (tmpd = inputInfo.keyboard; tmpd; tmpd = tmpd->next) {
+ if ((dev == inputInfo.keyboard && tmpd->key && tmpd->coreEvents) ||
+ tmpd == dev) {
+
+ xkbi = tmpd->key->xkbInfo;
+ ctrl = xkbi->desc->ctrls;
+ new = *ctrl;
+ XkbSetCauseXkbReq(&cause, X_kbSetControls, client);
+
+ if (stuff->changeCtrls & XkbInternalModsMask) {
+ CHK_MASK_MATCH(0x02, stuff->affectInternalMods,
+ stuff->internalMods);
+ CHK_MASK_MATCH(0x03, stuff->affectInternalVMods,
+ stuff->internalVMods);
+
+ new.internal.real_mods &= ~(stuff->affectInternalMods);
+ new.internal.real_mods |= (stuff->affectInternalMods &
+ stuff->internalMods);
+ new.internal.vmods &= ~(stuff->affectInternalVMods);
+ new.internal.vmods |= (stuff->affectInternalVMods &
+ stuff->internalVMods);
+ new.internal.mask = new.internal.real_mods |
+ XkbMaskForVMask(xkbi->desc,
+ new.internal.vmods);
+ }
- xkbi = dev->key->xkbInfo;
- ctrl = xkbi->desc->ctrls;
- new = *ctrl;
- XkbSetCauseXkbReq(&cause,X_kbSetControls,client);
- if (stuff->changeCtrls&XkbInternalModsMask) {
- CHK_MASK_MATCH(0x02,stuff->affectInternalMods,stuff->internalMods);
- CHK_MASK_MATCH(0x03,stuff->affectInternalVMods,stuff->internalVMods);
- new.internal.real_mods&=~stuff->affectInternalMods;
- new.internal.real_mods|=(stuff->affectInternalMods&stuff->internalMods);
- new.internal.vmods&=~stuff->affectInternalVMods;
- new.internal.vmods|= (stuff->affectInternalVMods&stuff->internalVMods);
- new.internal.mask= new.internal.real_mods|
- XkbMaskForVMask(xkbi->desc,new.internal.vmods);
- }
- if (stuff->changeCtrls&XkbIgnoreLockModsMask) {
- CHK_MASK_MATCH(0x4,stuff->affectIgnoreLockMods,stuff->ignoreLockMods);
- CHK_MASK_MATCH(0x5,stuff->affectIgnoreLockVMods,stuff->ignoreLockVMods);
- new.ignore_lock.real_mods&=~stuff->affectIgnoreLockMods;
- new.ignore_lock.real_mods|=
- (stuff->affectIgnoreLockMods&stuff->ignoreLockMods);
- new.ignore_lock.vmods&= ~stuff->affectIgnoreLockVMods;
- new.ignore_lock.vmods|=
- (stuff->affectIgnoreLockVMods&stuff->ignoreLockVMods);
- new.ignore_lock.mask= new.ignore_lock.real_mods|
- XkbMaskForVMask(xkbi->desc,new.ignore_lock.vmods);
- }
- CHK_MASK_MATCH(0x06,stuff->affectEnabledCtrls,stuff->enabledCtrls);
- if (stuff->affectEnabledCtrls) {
- CHK_MASK_LEGAL(0x07,stuff->affectEnabledCtrls,XkbAllBooleanCtrlsMask);
- new.enabled_ctrls&= ~stuff->affectEnabledCtrls;
- new.enabled_ctrls|= (stuff->affectEnabledCtrls&stuff->enabledCtrls);
- }
- if (stuff->changeCtrls&XkbRepeatKeysMask) {
- if ((stuff->repeatDelay<1)||(stuff->repeatInterval<1)) {
- client->errorValue = _XkbErrCode3(0x08,stuff->repeatDelay,
- stuff->repeatInterval);
- return BadValue;
- }
- new.repeat_delay = stuff->repeatDelay;
- new.repeat_interval = stuff->repeatInterval;
- }
- if (stuff->changeCtrls&XkbSlowKeysMask) {
- if (stuff->slowKeysDelay<1) {
- client->errorValue = _XkbErrCode2(0x09,stuff->slowKeysDelay);
- return BadValue;
- }
- new.slow_keys_delay = stuff->slowKeysDelay;
- }
- if (stuff->changeCtrls&XkbBounceKeysMask) {
- if (stuff->debounceDelay<1) {
- client->errorValue = _XkbErrCode2(0x0A,stuff->debounceDelay);
- return BadValue;
- }
- new.debounce_delay = stuff->debounceDelay;
- }
- if (stuff->changeCtrls&XkbMouseKeysMask) {
- if (stuff->mkDfltBtn>XkbMaxMouseKeysBtn) {
- client->errorValue = _XkbErrCode2(0x0B,stuff->mkDfltBtn);
- return BadValue;
- }
- new.mk_dflt_btn = stuff->mkDfltBtn;
- }
- if (stuff->changeCtrls&XkbMouseKeysAccelMask) {
- if ((stuff->mkDelay<1) || (stuff->mkInterval<1) ||
- (stuff->mkTimeToMax<1) || (stuff->mkMaxSpeed<1)||
- (stuff->mkCurve<-1000)) {
- client->errorValue = _XkbErrCode2(0x0C,0);
- return BadValue;
- }
- new.mk_delay = stuff->mkDelay;
- new.mk_interval = stuff->mkInterval;
- new.mk_time_to_max = stuff->mkTimeToMax;
- new.mk_max_speed = stuff->mkMaxSpeed;
- new.mk_curve = stuff->mkCurve;
- AccessXComputeCurveFactor(xkbi,&new);
- }
- if (stuff->changeCtrls&XkbGroupsWrapMask) {
- unsigned act,num;
- act= XkbOutOfRangeGroupAction(stuff->groupsWrap);
- switch (act) {
- case XkbRedirectIntoRange:
- num= XkbOutOfRangeGroupNumber(stuff->groupsWrap);
- if (num>=new.num_groups) {
- client->errorValue= _XkbErrCode3(0x0D,new.num_groups,num);
- return BadValue;
- }
- case XkbWrapIntoRange:
- case XkbClampIntoRange:
- break;
- default:
- client->errorValue= _XkbErrCode2(0x0E,act);
- return BadValue;
- }
- new.groups_wrap= stuff->groupsWrap;
- }
- CHK_MASK_LEGAL(0x0F,stuff->axOptions,XkbAX_AllOptionsMask);
- if (stuff->changeCtrls&XkbAccessXKeysMask)
- new.ax_options = stuff->axOptions&XkbAX_AllOptionsMask;
- else {
- if (stuff->changeCtrls&XkbStickyKeysMask) {
- new.ax_options&= ~XkbAX_SKOptionsMask;
- new.ax_options|= stuff->axOptions&XkbAX_SKOptionsMask;
- }
- if (stuff->changeCtrls&XkbAccessXFeedbackMask) {
- new.ax_options&= ~XkbAX_FBOptionsMask;
- new.ax_options|= stuff->axOptions&XkbAX_FBOptionsMask;
- }
- }
+ if (stuff->changeCtrls & XkbIgnoreLockModsMask) {
+ CHK_MASK_MATCH(0x4, stuff->affectIgnoreLockMods,
+ stuff->ignoreLockMods);
+ CHK_MASK_MATCH(0x5, stuff->affectIgnoreLockVMods,
+ stuff->ignoreLockVMods);
+
+ new.ignore_lock.real_mods &= ~(stuff->affectIgnoreLockMods);
+ new.ignore_lock.real_mods |= (stuff->affectIgnoreLockMods &
+ stuff->ignoreLockMods);
+ new.ignore_lock.vmods &= ~(stuff->affectIgnoreLockVMods);
+ new.ignore_lock.vmods |= (stuff->affectIgnoreLockVMods &
+ stuff->ignoreLockVMods);
+ new.ignore_lock.mask = new.ignore_lock.real_mods |
+ XkbMaskForVMask(xkbi->desc,
+ new.ignore_lock.vmods);
+ }
- if (stuff->changeCtrls&XkbAccessXTimeoutMask) {
- if (stuff->axTimeout<1) {
- client->errorValue = _XkbErrCode2(0x10,stuff->axTimeout);
- return BadValue;
- }
- CHK_MASK_MATCH(0x11,stuff->axtCtrlsMask,stuff->axtCtrlsValues);
- CHK_MASK_LEGAL(0x12,stuff->axtCtrlsMask,XkbAllBooleanCtrlsMask);
- CHK_MASK_MATCH(0x13,stuff->axtOptsMask,stuff->axtOptsValues);
- CHK_MASK_LEGAL(0x14,stuff->axtOptsMask,XkbAX_AllOptionsMask);
- new.ax_timeout = stuff->axTimeout;
- new.axt_ctrls_mask = stuff->axtCtrlsMask;
- new.axt_ctrls_values = (stuff->axtCtrlsValues&stuff->axtCtrlsMask);
- new.axt_opts_mask = stuff->axtOptsMask;
- new.axt_opts_values= (stuff->axtOptsValues&stuff->axtOptsMask);
- }
- if (stuff->changeCtrls&XkbPerKeyRepeatMask) {
- memcpy(new.per_key_repeat,stuff->perKeyRepeat,XkbPerKeyBitArraySize);
- }
- old= *ctrl;
- *ctrl= new;
- XkbDDXChangeControls(dev,&old,ctrl);
- if (XkbComputeControlsNotify(dev,&old,ctrl,&cn,False)) {
- cn.keycode= 0;
- cn.eventType = 0;
- cn.requestMajor = XkbReqCode;
- cn.requestMinor = X_kbSetControls;
- XkbSendControlsNotify(dev,&cn);
- }
- if ((sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0))!=NULL)
- XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause);
-#ifndef NO_CLEAR_LATCHES_FOR_STICKY_KEYS_OFF
- /* If sticky keys were disabled, clear all locks and latches */
- if ((old.enabled_ctrls&XkbStickyKeysMask)&&
- (!(ctrl->enabled_ctrls&XkbStickyKeysMask))) {
- XkbClearAllLatchesAndLocks(dev,xkbi,True,&cause);
+ CHK_MASK_MATCH(0x06, stuff->affectEnabledCtrls,
+ stuff->enabledCtrls);
+ if (stuff->affectEnabledCtrls) {
+ CHK_MASK_LEGAL(0x07, stuff->affectEnabledCtrls,
+ XkbAllBooleanCtrlsMask);
+
+ new.enabled_ctrls &= ~(stuff->affectEnabledCtrls);
+ new.enabled_ctrls |= (stuff->affectEnabledCtrls &
+ stuff->enabledCtrls);
+ }
+
+ if (stuff->changeCtrls & XkbRepeatKeysMask) {
+ if (stuff->repeatDelay < 1 || stuff->repeatInterval < 1) {
+ client->errorValue = _XkbErrCode3(0x08, stuff->repeatDelay,
+ stuff->repeatInterval);
+ return BadValue;
+ }
+
+ new.repeat_delay = stuff->repeatDelay;
+ new.repeat_interval = stuff->repeatInterval;
+ }
+
+ if (stuff->changeCtrls & XkbSlowKeysMask) {
+ if (stuff->slowKeysDelay < 1) {
+ client->errorValue = _XkbErrCode2(0x09,
+ stuff->slowKeysDelay);
+ return BadValue;
+ }
+
+ new.slow_keys_delay = stuff->slowKeysDelay;
+ }
+
+ if (stuff->changeCtrls & XkbBounceKeysMask) {
+ if (stuff->debounceDelay < 1) {
+ client->errorValue = _XkbErrCode2(0x0A,
+ stuff->debounceDelay);
+ return BadValue;
+ }
+
+ new.debounce_delay = stuff->debounceDelay;
+ }
+
+ if (stuff->changeCtrls & XkbMouseKeysMask) {
+ if (stuff->mkDfltBtn > XkbMaxMouseKeysBtn) {
+ client->errorValue = _XkbErrCode2(0x0B, stuff->mkDfltBtn);
+ return BadValue;
+ }
+
+ new.mk_dflt_btn = stuff->mkDfltBtn;
+ }
+
+ if (stuff->changeCtrls & XkbMouseKeysAccelMask) {
+ if (stuff->mkDelay < 1 || stuff->mkInterval < 1 ||
+ stuff->mkTimeToMax < 1 || stuff->mkMaxSpeed < 1 ||
+ stuff->mkCurve < -1000) {
+ client->errorValue = _XkbErrCode2(0x0C,0);
+ return BadValue;
+ }
+
+ new.mk_delay = stuff->mkDelay;
+ new.mk_interval = stuff->mkInterval;
+ new.mk_time_to_max = stuff->mkTimeToMax;
+ new.mk_max_speed = stuff->mkMaxSpeed;
+ new.mk_curve = stuff->mkCurve;
+ AccessXComputeCurveFactor(xkbi, &new);
+ }
+
+ if (stuff->changeCtrls & XkbGroupsWrapMask) {
+ unsigned act, num;
+
+ act = XkbOutOfRangeGroupAction(stuff->groupsWrap);
+ switch (act) {
+ case XkbRedirectIntoRange:
+ num = XkbOutOfRangeGroupNumber(stuff->groupsWrap);
+ if (num >= new.num_groups) {
+ client->errorValue = _XkbErrCode3(0x0D, new.num_groups,
+ num);
+ return BadValue;
+ }
+ case XkbWrapIntoRange:
+ case XkbClampIntoRange:
+ break;
+ default:
+ client->errorValue = _XkbErrCode2(0x0E, act);
+ return BadValue;
+ }
+
+ new.groups_wrap= stuff->groupsWrap;
+ }
+
+ CHK_MASK_LEGAL(0x0F, stuff->axOptions, XkbAX_AllOptionsMask);
+ if (stuff->changeCtrls & XkbAccessXKeysMask) {
+ new.ax_options = stuff->axOptions & XkbAX_AllOptionsMask;
+ }
+ else {
+ if (stuff->changeCtrls & XkbStickyKeysMask) {
+ new.ax_options &= ~(XkbAX_SKOptionsMask);
+ new.ax_options |= (stuff->axOptions & XkbAX_SKOptionsMask);
+ }
+
+ if (stuff->changeCtrls & XkbAccessXFeedbackMask) {
+ new.ax_options &= ~(XkbAX_FBOptionsMask);
+ new.ax_options |= (stuff->axOptions & XkbAX_FBOptionsMask);
+ }
+ }
+
+ if (stuff->changeCtrls & XkbAccessXTimeoutMask) {
+ if (stuff->axTimeout < 1) {
+ client->errorValue = _XkbErrCode2(0x10, stuff->axTimeout);
+ return BadValue;
+ }
+ CHK_MASK_MATCH(0x11, stuff->axtCtrlsMask,
+ stuff->axtCtrlsValues);
+ CHK_MASK_LEGAL(0x12, stuff->axtCtrlsMask,
+ XkbAllBooleanCtrlsMask);
+ CHK_MASK_MATCH(0x13, stuff->axtOptsMask, stuff->axtOptsValues);
+ CHK_MASK_LEGAL(0x14, stuff->axtOptsMask, XkbAX_AllOptionsMask);
+ new.ax_timeout = stuff->axTimeout;
+ new.axt_ctrls_mask = stuff->axtCtrlsMask;
+ new.axt_ctrls_values = (stuff->axtCtrlsValues &
+ stuff->axtCtrlsMask);
+ new.axt_opts_mask = stuff->axtOptsMask;
+ new.axt_opts_values = (stuff->axtOptsValues &
+ stuff->axtOptsMask);
+ }
+
+ if (stuff->changeCtrls & XkbPerKeyRepeatMask)
+ memcpy(new.per_key_repeat, stuff->perKeyRepeat,
+ XkbPerKeyBitArraySize);
+
+ old= *ctrl;
+ *ctrl= new;
+ XkbDDXChangeControls(tmpd, &old, ctrl);
+
+ if (XkbComputeControlsNotify(tmpd, &old, ctrl, &cn, False)) {
+ cn.keycode = 0;
+ cn.eventType = 0;
+ cn.requestMajor = XkbReqCode;
+ cn.requestMinor = X_kbSetControls;
+ XkbSendControlsNotify(tmpd, &cn);
+ }
+
+ sli = XkbFindSrvLedInfo(tmpd, XkbDfltXIClass, XkbDfltXIId, 0);
+ if (sli)
+ XkbUpdateIndicators(tmpd, sli->usesControls, True, NULL,
+ &cause);
+
+ /* If sticky keys were disabled, clear all locks and latches */
+ if ((old.enabled_ctrls & XkbStickyKeysMask) &&
+ !(ctrl->enabled_ctrls & XkbStickyKeysMask))
+ XkbClearAllLatchesAndLocks(tmpd, xkbi, True, &cause);
+ }
}
-#endif
+
return client->noClientException;
}
+/* FIXME: Needs to set rate on all core-sending devices. */
int
XkbSetRepeatRate(DeviceIntPtr dev,int timeout,int interval,int major,int minor)
{
@@ -1261,7 +1325,7 @@ unsigned short * pMap;
wire= (xkbVModMapWireDesc *)buf;
pMap= &xkb->server->vmodmap[rep->firstVModMapKey];
- for (i=0;i<rep->nVModMapKeys;i++,pMap++) {
+ for (i=0;i<rep->nVModMapKeys-1;i++,pMap++) {
if (*pMap!=0) {
wire->key= i+rep->firstVModMapKey;
wire->vmods= *pMap;
@@ -2263,6 +2327,7 @@ XkbServerMapPtr srv = xkbi->desc->server;
return (char *)wire;
}
+/* FIXME: Needs to set map on all core-sending devices. */
int
ProcXkbSetMap(ClientPtr client)
{
@@ -2579,6 +2644,7 @@ ProcXkbGetCompatMap(ClientPtr client)
return XkbSendCompatMap(client,compat,&rep);
}
+/* FIXME: Needs to set compat map on all core-sending devices. */
int
ProcXkbSetCompatMap(ClientPtr client)
{
@@ -2856,6 +2922,7 @@ XkbIndicatorPtr leds;
return XkbSendIndicatorMap(client,leds,&rep);
}
+/* FIXME: Needs to set indicator map on all core-sending devices. */
int
ProcXkbSetIndicatorMap(ClientPtr client)
{
@@ -3019,6 +3086,7 @@ ProcXkbGetNamedIndicator(ClientPtr client)
return client->noClientException;
}
+/* FIXME: Needs to set indicator on all core-sending devices. */
int
ProcXkbSetNamedIndicator(ClientPtr client)
{
@@ -3507,6 +3575,7 @@ char * str;
return True;
}
+/* FIXME: Needs to set names on all core-sending devices. */
int
ProcXkbSetNames(ClientPtr client)
{
@@ -4804,6 +4873,7 @@ char * wire;
return Success;
}
+/* FIXME: Needs to set geom on all core-sending devices. */
int
ProcXkbSetGeometry(ClientPtr client)
{
@@ -5084,6 +5154,7 @@ int
ProcXkbGetKbdByName(ClientPtr client)
{
DeviceIntPtr dev;
+ DeviceIntPtr tmpd;
XkbFileInfo finfo;
xkbGetKbdByNameReply rep;
xkbGetMapReply mrep;
@@ -5099,6 +5170,8 @@ ProcXkbGetKbdByName(ClientPtr client)
unsigned fwant,fneed,reported;
int status;
Bool geom_changed;
+ XkbSrvLedInfoPtr old_sli;
+ XkbSrvLedInfoPtr sli;
REQUEST(xkbGetKbdByNameReq);
REQUEST_AT_LEAST_SIZE(xkbGetKbdByNameReq);
@@ -5169,8 +5242,10 @@ ProcXkbGetKbdByName(ClientPtr client)
fneed|= XkmKeyNamesIndex|XkmTypesIndex;
fwant|= XkmIndicatorsIndex;
}
+
+ /* We pass dev in here so we can get the old names out if needed. */
rep.found = XkbDDXLoadKeymapByNames(dev,&names,fwant,fneed,&finfo,
- mapFile,PATH_MAX);
+ mapFile,PATH_MAX);
rep.newKeyboard= False;
rep.pad1= rep.pad2= rep.pad3= rep.pad4= 0;
@@ -5365,23 +5440,34 @@ ProcXkbGetKbdByName(ClientPtr client)
}
xkb->ctrls->num_groups= nTG;
- memcpy(dev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1);
- XkbUpdateCoreDescription(dev,True);
-
- if (dev->kbdfeed && dev->kbdfeed->xkb_sli) {
- XkbSrvLedInfoPtr old_sli;
- XkbSrvLedInfoPtr sli;
- old_sli = dev->kbdfeed->xkb_sli;
- dev->kbdfeed->xkb_sli = NULL;
- sli = XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,0);
- if (sli) {
- sli->explicitState = old_sli->explicitState;
- sli->effectiveState = old_sli->effectiveState;
+ for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
+ if (tmpd == dev ||
+ (dev->id == inputInfo.keyboard->id && tmpd->key &&
+ tmpd->coreEvents)) {
+
+ memcpy(tmpd->key->modifierMap, xkb->map->modmap,
+ xkb->max_key_code + 1);
+ if (tmpd != dev)
+ XkbCopyKeymap(dev->key->xkbInfo->desc,
+ tmpd->key->xkbInfo->desc, True);
+ XkbUpdateCoreDescription(tmpd, True);
+
+ if (tmpd->kbdfeed && tmpd->kbdfeed->xkb_sli) {
+ old_sli = tmpd->kbdfeed->xkb_sli;
+ tmpd->kbdfeed->xkb_sli = NULL;
+ sli = XkbAllocSrvLedInfo(tmpd, tmpd->kbdfeed, NULL, 0);
+ if (sli) {
+ sli->explicitState = old_sli->explicitState;
+ sli->effectiveState = old_sli->effectiveState;
+ }
+ tmpd->kbdfeed->xkb_sli = sli;
+ XkbFreeSrvLedInfo(old_sli);
+ }
}
- dev->kbdfeed->xkb_sli = sli;
- XkbFreeSrvLedInfo(old_sli);
- }
+ }
+ /* this should be either a MN or an NKN, depending on whether or not
+ * the keycode range changed? */
nkn.deviceID= nkn.oldDeviceID= dev->id;
nkn.minKeyCode= finfo.xkb->min_key_code;
nkn.maxKeyCode= finfo.xkb->max_key_code;
@@ -5634,7 +5720,6 @@ char * str;
wanted&= ~XkbXI_ButtonActionsMask;
if ((!dev->kbdfeed)&&(!dev->leds))
wanted&= ~XkbXI_IndicatorsMask;
- wanted&= ~XkbXI_KeyboardsMask;
nameLen= XkbSizeCountedString(dev->name);
bzero((char *)&rep,SIZEOF(xkbGetDeviceInfoReply));
@@ -5643,8 +5728,8 @@ char * str;
rep.sequenceNumber = client->sequence;
rep.length = nameLen/4;
rep.present = wanted;
- rep.supported = XkbXI_AllDeviceFeaturesMask&(~XkbXI_KeyboardsMask);
- rep.unsupported = XkbXI_KeyboardsMask;
+ rep.supported = XkbXI_AllDeviceFeaturesMask;
+ rep.unsupported = 0;
rep.firstBtnWanted = rep.nBtnsWanted = 0;
rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
if (dev->button)
@@ -5940,6 +6025,7 @@ DeviceIntPtr kbd;
return (char *)ledWire;
}
+/* FIXME: Needs to set info on all core-sending devices. */
int
ProcXkbSetDeviceInfo(ClientPtr client)
{
@@ -5957,7 +6043,7 @@ xkbExtensionDeviceNotify ed;
change= stuff->change;
CHK_ANY_DEVICE(dev,stuff->deviceSpec);
- CHK_MASK_LEGAL(0x01,change,(XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask)));
+ CHK_MASK_LEGAL(0x01,change,XkbXI_AllFeaturesMask);
wire= (char *)&stuff[1];
if (change&XkbXI_ButtonActionsMask) {
diff --git a/xkb/xkb.h b/xkb/xkb.h
index 156608ef0..2be42582d 100644
--- a/xkb/xkb.h
+++ b/xkb/xkb.h
@@ -72,3 +72,8 @@ extern Bool XkbDDXCompileKeymapByNames(
unsigned need,
char * nameRtrn,
int nameRtrnLen);
+
+extern Bool XkbCopyKeymap(
+ XkbDescPtr src,
+ XkbDescPtr dst,
+ Bool sendNotifies);
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 7b57611e2..0ab3dadf6 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -361,10 +361,7 @@ XkbControlsPtr ctrls;
if (keybd->kbdfeed->ctrl.autoRepeat &&
((xkbi->slowKey != xkbi->mouseKey) || (!xkbi->mouseKeysAccel)) &&
(ctrls->enabled_ctrls&XkbRepeatKeysMask)) {
-#ifndef AIXV3
- if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,xkbi->slowKey))
-#endif
- {
+ if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,xkbi->slowKey)) {
xkbi->repeatKey = xkbi->slowKey;
xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
0, ctrls->repeat_delay,
@@ -530,10 +527,7 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
if ((keybd->kbdfeed->ctrl.autoRepeat) &&
((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))==
XkbRepeatKeysMask)) {
-#ifndef AIXV3
- if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key))
-#endif
- {
+ if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) {
#ifdef DEBUG
if (xkbDebugFlags&0x10)
ErrorF("Starting software autorepeat...\n");
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index ec8e7b14a..e94e0bff4 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -675,13 +675,13 @@ xkbExtensionDeviceNotify my_ed;
changes->names.changed_indicators|= changed_names;
}
- ed->reason|= (XkbXI_IndicatorNamesMask&(~XkbXI_KeyboardsMask));
+ ed->reason|= XkbXI_IndicatorNamesMask;
ed->ledClass= sli->class;
ed->ledID= sli->id;
ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
ed->ledState= sli->effectiveState;
- ed->unsupported= XkbXI_KeyboardsMask;
- ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask);
+ ed->unsupported= 0;
+ ed->supported= XkbXI_AllFeaturesMask;
if (changes!=&my_changes) changes= NULL;
if (ed!=&my_ed) ed= NULL;
@@ -753,13 +753,13 @@ xkbExtensionDeviceNotify my_ed;
XkbCheckIndicatorMaps(dev,sli,changed_maps);
- ed->reason|= (XkbXI_IndicatorMapsMask&(~XkbXI_KeyboardsMask));
+ ed->reason|= XkbXI_IndicatorMapsMask;
ed->ledClass= sli->class;
ed->ledID= sli->id;
ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
ed->ledState= sli->effectiveState;
- ed->unsupported|= XkbXI_KeyboardsMask&XkbXI_IndicatorMapsMask;
- ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask);
+ ed->unsupported|= XkbXI_IndicatorMapsMask;
+ ed->supported= XkbXI_AllFeaturesMask;
XkbUpdateLedAutoState(dev,sli,changed_maps,ed,changes,cause);
@@ -834,13 +834,13 @@ Bool kb_changed;
if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault))
changes->indicators.state_changes|= affected;
if (affected) {
- ed->reason|= (XkbXI_IndicatorStateMask&(~XkbXI_KeyboardsMask));
+ ed->reason|= XkbXI_IndicatorStateMask;
ed->ledClass= sli->class;
ed->ledID= sli->id;
ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
ed->ledState= sli->effectiveState;
- ed->unsupported|= XkbXI_KeyboardsMask&XkbXI_IndicatorStateMask;
- ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask);
+ ed->unsupported|= XkbXI_IndicatorStateMask;
+ ed->supported= XkbXI_AllFeaturesMask;
}
if (kb_changed) {
@@ -918,13 +918,13 @@ unsigned oldState;
changes->indicators.state_changes|= affected;
}
- ed->reason|= (XkbXI_IndicatorStateMask&(~XkbXI_KeyboardsMask));
+ ed->reason|= XkbXI_IndicatorStateMask;
ed->ledClass= sli->class;
ed->ledID= sli->id;
ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
ed->ledState= sli->effectiveState;
- ed->unsupported|= XkbXI_KeyboardsMask&XkbXI_IndicatorStateMask;
- ed->supported= XkbXI_AllFeaturesMask&(~XkbXI_KeyboardsMask);
+ ed->unsupported|= XkbXI_IndicatorStateMask;
+ ed->supported= XkbXI_AllFeaturesMask;
if (changes!=&my_changes) changes= NULL;
if (ed!=&my_ed) ed= NULL;
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 26ff35e89..627ab20f9 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -28,6 +28,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <dix-config.h>
#endif
+#include "os.h"
#include <stdio.h>
#include <ctype.h>
#include <math.h>
@@ -44,24 +45,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XKBgeom.h>
#include "xkb.h"
-#ifdef MODE_SWITCH
-extern Bool noKME; /* defined in os/utils.c */
-#endif
-
int XkbDisableLockActions = 0;
/***====================================================================***/
-#ifndef RETURN_SHOULD_REPEAT
-#if (defined(__osf__) && defined(__alpha))
-#define RETURN_SHOULD_REPEAT 1
-#else
-#define RETURN_SHOULD_REPEAT 0
-#endif
-#endif
-
-/***====================================================================***/
-
DeviceIntPtr
_XkbLookupAnyDevice(int id,int *why_rtrn)
{
@@ -91,6 +78,8 @@ _XkbLookupKeyboard(int id,int *why_rtrn)
{
DeviceIntPtr dev = NULL;
+ if (id == XkbDfltXIId)
+ id = XkbUseCoreKbd;
if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL)
return NULL;
else if ((!dev->key)||(!dev->key->xkbInfo)) {
@@ -121,6 +110,8 @@ _XkbLookupLedDevice(int id,int *why_rtrn)
{
DeviceIntPtr dev = NULL;
+ if (id == XkbDfltXIId)
+ id = XkbUseCorePtr;
if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL)
return NULL;
else if ((!dev->kbdfeed)&&(!dev->leds)) {
@@ -241,7 +232,7 @@ XkbMapChangesPtr mc;
xkb->min_key_code= first;
/* 1/12/95 (ef) -- XXX! should zero out the new maps */
changes->map.changed|= XkbKeycodesMask;
-generate a NewKeyboard notify here?
+/* generate a NewKeyboard notify here? */
}
}
#endif
@@ -559,12 +550,6 @@ CARD8 keysPerMod[XkbNumModifiers];
}
}
}
-#ifdef MODE_SWITCH
- /* Fix up any of the KME stuff if we changed the core description.
- */
- if (!noKME)
- HandleKeyBinding(keyc, &keyc->curKeySyms);
-#endif
return;
}
@@ -969,3 +954,1130 @@ XkbConvertCase(register KeySym sym, KeySym *lower, KeySym *upper)
break;
}
}
+
+
+/**
+ * Copy an XKB map from src to dst, reallocating when necessary: if some
+ * map components are present in one, but not in the other, the destination
+ * components will be allocated or freed as necessary.
+ *
+ * Basic map consistency is assumed on both sides, so maps with random
+ * uninitialised data (e.g. names->radio_grous == NULL, names->num_rg == 19)
+ * _will_ cause failures. You've been warned.
+ *
+ * Returns TRUE on success, or FALSE on failure. If this function fails,
+ * dst may be in an inconsistent state: all its pointers are guaranteed
+ * to remain valid, but part of the map may be from src and part from dst.
+ *
+ * FIXME: This function wants to be broken up into multiple functions.
+ */
+Bool
+XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
+{
+ int i = 0, j = 0, k = 0;
+ void *tmp = NULL;
+ XkbColorPtr scolor = NULL, dcolor = NULL;
+ XkbDoodadPtr sdoodad = NULL, ddoodad = NULL;
+ XkbKeyTypePtr stype = NULL, dtype = NULL;
+ XkbOutlinePtr soutline = NULL, doutline = NULL;
+ XkbPropertyPtr sprop = NULL, dprop = NULL;
+ XkbRowPtr srow = NULL, drow = NULL;
+ XkbSectionPtr ssection = NULL, dsection = NULL;
+ XkbShapePtr sshape = NULL, dshape = NULL;
+ DeviceIntPtr pDev = NULL, tmpDev = NULL;
+ xkbMapNotify mn;
+ xkbNewKeyboardNotify nkn;
+
+ if (!src || !dst || src == dst)
+ return FALSE;
+
+ /* client map */
+ if (src->map) {
+ if (!dst->map) {
+ tmp = xcalloc(1, sizeof(XkbClientMapRec));
+ if (!tmp)
+ return FALSE;
+ dst->map = tmp;
+ }
+
+ if (src->map->syms) {
+ if (src->map->size_syms != dst->map->size_syms) {
+ if (dst->map->syms)
+ tmp = xrealloc(dst->map->syms,
+ src->map->size_syms * sizeof(KeySym));
+ else
+ tmp = xalloc(src->map->size_syms * sizeof(KeySym));
+ if (!tmp)
+ return FALSE;
+ dst->map->syms = tmp;
+
+ }
+ memcpy(dst->map->syms, src->map->syms,
+ src->map->size_syms * sizeof(KeySym));
+ }
+ else {
+ if (dst->map->syms) {
+ xfree(dst->map->syms);
+ dst->map->syms = NULL;
+ }
+ }
+ dst->map->num_syms = src->map->num_syms;
+ dst->map->size_syms = src->map->size_syms;
+
+ if (src->map->key_sym_map) {
+ if (src->max_key_code != dst->max_key_code) {
+ if (dst->map->key_sym_map)
+ tmp = xrealloc(dst->map->key_sym_map,
+ (src->max_key_code + 1) *
+ sizeof(XkbSymMapRec));
+ else
+ tmp = xalloc((src->max_key_code + 1) *
+ sizeof(XkbSymMapRec));
+ if (!tmp)
+ return FALSE;
+ dst->map->key_sym_map = tmp;
+ }
+ memcpy(dst->map->key_sym_map, src->map->key_sym_map,
+ (src->max_key_code + 1) * sizeof(XkbSymMapRec));
+ }
+ else {
+ if (dst->map->key_sym_map) {
+ xfree(dst->map->key_sym_map);
+ dst->map->key_sym_map = NULL;
+ }
+ }
+
+ if (src->map->types) {
+ if (src->map->size_types > dst->map->size_types) {
+ if (dst->map->types) {
+ tmp = xrealloc(dst->map->types,
+ src->map->size_types * sizeof(XkbKeyTypeRec));
+ if (!tmp)
+ return FALSE;
+ dst->map->types = tmp;
+ bzero(dst->map->types +
+ (dst->map->size_types * sizeof(XkbKeyTypeRec)),
+ (src->map->size_types - dst->map->size_types) *
+ sizeof(XkbKeyTypeRec));
+ }
+ else {
+ tmp = xcalloc(src->map->size_types, sizeof(XkbKeyTypeRec));
+ if (!tmp)
+ return FALSE;
+ dst->map->types = tmp;
+ }
+ }
+ else if (src->map->size_types < dst->map->size_types) {
+ if (dst->map->types) {
+ for (i = src->map->num_types, dtype = (dst->map->types + i);
+ i < dst->map->size_types; i++, dtype++) {
+ if (dtype->level_names)
+ xfree(dtype->level_names);
+ dtype->level_names = NULL;
+ dtype->num_levels = 0;
+ }
+ }
+ }
+
+ stype = src->map->types;
+ dtype = dst->map->types;
+ for (i = 0; i < src->map->num_types; i++, dtype++, stype++) {
+ if (stype->num_levels) {
+ if (stype->num_levels != dtype->num_levels &&
+ dtype->num_levels && dtype->level_names) {
+ tmp = xrealloc(dtype->level_names,
+ stype->num_levels * sizeof(Atom));
+ if (!tmp)
+ continue;
+ dtype->level_names = tmp;
+ }
+ else if (!dtype->num_levels || !dtype->level_names) {
+ tmp = xalloc(stype->num_levels * sizeof(Atom));
+ if (!tmp)
+ continue;
+ dtype->level_names = tmp;
+ }
+ dtype->num_levels = stype->num_levels;
+ memcpy(dtype->level_names, stype->level_names,
+ stype->num_levels * sizeof(Atom));
+ }
+ else {
+ if (dtype->num_levels && dtype->level_names)
+ xfree(dtype->level_names);
+ dtype->num_levels = 0;
+ dtype->level_names = NULL;
+ }
+
+ dtype->name = stype->name;
+ memcpy(&dtype->mods, &stype->mods, sizeof(XkbModsRec));
+
+ if (stype->map_count) {
+ if (stype->map) {
+ if (stype->map_count != dtype->map_count &&
+ dtype->map_count && dtype->map) {
+ tmp = xrealloc(dtype->map,
+ stype->map_count *
+ sizeof(XkbKTMapEntryRec));
+ if (!tmp)
+ return FALSE;
+ dtype->map = tmp;
+ }
+ else if (!dtype->map_count || !dtype->map) {
+ tmp = xalloc(stype->map_count *
+ sizeof(XkbKTMapEntryRec));
+ if (!tmp)
+ return FALSE;
+ dtype->map = tmp;
+ }
+
+ memcpy(dtype->map, stype->map,
+ stype->map_count * sizeof(XkbKTMapEntryRec));
+ }
+
+ if (stype->preserve) {
+ if (stype->map_count != dtype->map_count &&
+ dtype->map_count && dtype->preserve) {
+ tmp = xrealloc(dtype->preserve,
+ stype->map_count *
+ sizeof(XkbModsRec));
+ if (!tmp)
+ return FALSE;
+ dtype->preserve = tmp;
+ }
+ else if (!dtype->preserve || !dtype->map_count) {
+ tmp = xalloc(stype->map_count *
+ sizeof(XkbModsRec));
+ if (!tmp)
+ return FALSE;
+ dtype->preserve = tmp;
+ }
+
+ memcpy(dtype->preserve, stype->preserve,
+ stype->map_count * sizeof(XkbModsRec));
+ }
+
+ dtype->map_count = stype->map_count;
+ }
+ else {
+ if (dtype->map_count) {
+ if (dtype->map)
+ xfree(dtype->map);
+ if (dtype->preserve)
+ xfree(dtype->preserve);
+ dtype->map_count = 0;
+ }
+ dtype->map = NULL;
+ dtype->preserve = NULL;
+ }
+ }
+ }
+ else {
+ if (dst->map->types) {
+ for (i = 0, dtype = dst->map->types; i < dst->map->num_types;
+ i++, dtype++) {
+ if (dtype->level_names)
+ xfree(dtype->level_names);
+ if (dtype->map && dtype->map_count)
+ xfree(dtype->map);
+ if (dtype->preserve && dtype->preserve)
+ xfree(dtype->preserve);
+ }
+ xfree(dst->map->types);
+ dst->map->types = NULL;
+ }
+ }
+ dst->map->size_types = src->map->size_types;
+ dst->map->num_types = src->map->num_types;
+
+ if (src->map->modmap) {
+ if (src->max_key_code != dst->max_key_code) {
+ if (dst->map->modmap)
+ tmp = xrealloc(dst->map->modmap, src->max_key_code + 1);
+ else
+ tmp = xalloc(src->max_key_code + 1);
+ if (!tmp)
+ return FALSE;
+ dst->map->syms = tmp;
+ }
+ memcpy(dst->map->modmap, src->map->modmap, src->max_key_code + 1);
+ }
+ else {
+ if (dst->map->modmap) {
+ xfree(dst->map->modmap);
+ dst->map->modmap = NULL;
+ }
+ }
+ }
+ else {
+ if (dst->map)
+ XkbFreeClientMap(dst, XkbAllClientInfoMask, True);
+ }
+
+ /* server map */
+ if (src->server) {
+ if (!dst->server) {
+ tmp = xcalloc(1, sizeof(XkbServerMapRec));
+ if (!tmp)
+ return FALSE;
+ dst->server = tmp;
+ }
+
+ if (src->server->explicit) {
+ if (src->max_key_code != dst->max_key_code) {
+ if (dst->server->explicit)
+ tmp = xrealloc(dst->server->explicit, src->max_key_code + 1);
+ else
+ tmp = xalloc(src->max_key_code + 1);
+ if (!tmp)
+ return FALSE;
+ dst->server->explicit = tmp;
+ }
+ memcpy(dst->server->explicit, src->server->explicit,
+ src->max_key_code + 1);
+ }
+ else {
+ if (dst->server->explicit) {
+ xfree(dst->server->explicit);
+ dst->server->explicit = NULL;
+ }
+ }
+
+ if (src->server->acts) {
+ if (src->server->size_acts != dst->server->size_acts) {
+ if (dst->server->acts)
+ tmp = xrealloc(dst->server->acts,
+ src->server->size_acts * sizeof(XkbAction));
+ else
+ tmp = xalloc(src->server->size_acts * sizeof(XkbAction));
+ if (!tmp)
+ return FALSE;
+ dst->server->acts = tmp;
+ }
+ memcpy(dst->server->acts, src->server->acts,
+ src->server->size_acts * sizeof(XkbAction));
+ }
+ else {
+ if (dst->server->acts) {
+ xfree(dst->server->acts);
+ dst->server->acts = NULL;
+ }
+ }
+ dst->server->size_acts = src->server->size_acts;
+ dst->server->num_acts = src->server->num_acts;
+
+ if (src->server->key_acts) {
+ if (src->max_key_code != dst->max_key_code) {
+ if (dst->server->key_acts)
+ tmp = xrealloc(dst->server->key_acts,
+ (src->max_key_code + 1) *
+ sizeof(unsigned short));
+ else
+ tmp = xalloc((src->max_key_code + 1) *
+ sizeof(unsigned short));
+ if (!tmp)
+ return FALSE;
+ dst->server->key_acts = tmp;
+ }
+ memcpy(dst->server->key_acts, src->server->key_acts,
+ (src->max_key_code + 1) * sizeof(unsigned short));
+ }
+ else {
+ if (dst->server->key_acts) {
+ xfree(dst->server->key_acts);
+ dst->server->key_acts = NULL;
+ }
+ }
+
+ if (src->server->behaviors) {
+ if (src->max_key_code != dst->max_key_code) {
+ if (dst->server->behaviors)
+ tmp = xrealloc(dst->server->behaviors,
+ (src->max_key_code + 1) *
+ sizeof(XkbBehavior));
+ else
+ tmp = xalloc((src->max_key_code + 1) *
+ sizeof(XkbBehavior));
+ if (!tmp)
+ return FALSE;
+ dst->server->behaviors = tmp;
+ }
+ memcpy(dst->server->behaviors, src->server->behaviors,
+ (src->max_key_code + 1) * sizeof(XkbBehavior));
+ }
+ else {
+ if (dst->server->behaviors) {
+ xfree(dst->server->behaviors);
+ dst->server->behaviors = NULL;
+ }
+ }
+
+ memcpy(dst->server->vmods, src->server->vmods, XkbNumVirtualMods);
+
+ if (src->server->vmodmap) {
+ if (src->max_key_code != dst->max_key_code) {
+ if (dst->server->vmodmap)
+ tmp = xrealloc(dst->server->vmodmap,
+ (src->max_key_code + 1) *
+ sizeof(unsigned short));
+ else
+ tmp = xalloc((src->max_key_code + 1) *
+ sizeof(unsigned short));
+ if (!tmp)
+ return FALSE;
+ dst->server->vmodmap = tmp;
+ }
+ memcpy(dst->server->vmodmap, src->server->vmodmap,
+ (src->max_key_code + 1) * sizeof(unsigned short));
+ }
+ else {
+ if (dst->server->vmodmap) {
+ xfree(dst->server->vmodmap);
+ dst->server->vmodmap = NULL;
+ }
+ }
+ }
+ else {
+ if (dst->server)
+ XkbFreeServerMap(dst, XkbAllServerInfoMask, True);
+ }
+
+ /* indicators */
+ if (src->indicators) {
+ if (!dst->indicators) {
+ dst->indicators = xalloc(sizeof(XkbIndicatorRec));
+ if (!dst->indicators)
+ return FALSE;
+ }
+ memcpy(dst->indicators, src->indicators, sizeof(XkbIndicatorRec));
+ }
+ else {
+ if (dst->indicators) {
+ xfree(dst->indicators);
+ dst->indicators = NULL;
+ }
+ }
+
+ /* controls */
+ if (src->ctrls) {
+ if (!dst->ctrls) {
+ dst->ctrls = xalloc(sizeof(XkbControlsRec));
+ if (!dst->ctrls)
+ return FALSE;
+ }
+ memcpy(dst->ctrls, src->ctrls, sizeof(XkbControlsRec));
+ }
+ else {
+ if (dst->ctrls) {
+ xfree(dst->ctrls);
+ dst->ctrls = NULL;
+ }
+ }
+
+ /* names */
+ if (src->names) {
+ if (!dst->names) {
+ dst->names = xcalloc(1, sizeof(XkbNamesRec));
+ if (!dst->names)
+ return FALSE;
+ }
+
+ if (src->names->keys) {
+ if (src->max_key_code != dst->max_key_code) {
+ if (dst->names->keys)
+ tmp = xrealloc(dst->names->keys, (src->max_key_code + 1) *
+ sizeof(XkbKeyNameRec));
+ else
+ tmp = xalloc((src->max_key_code + 1) *
+ sizeof(XkbKeyNameRec));
+ if (!tmp)
+ return FALSE;
+ dst->names->keys = tmp;
+ }
+ memcpy(dst->names->keys, src->names->keys,
+ (src->max_key_code + 1) * sizeof(XkbKeyNameRec));
+ }
+ else {
+ if (dst->names->keys) {
+ xfree(dst->names->keys);
+ dst->names->keys = NULL;
+ }
+ }
+
+ if (src->names->num_key_aliases) {
+ if (src->names->num_key_aliases != dst->names->num_key_aliases) {
+ if (dst->names->key_aliases)
+ tmp = xrealloc(dst->names->key_aliases,
+ src->names->num_key_aliases *
+ sizeof(XkbKeyAliasRec));
+ else
+ tmp = xalloc(src->names->num_key_aliases *
+ sizeof(XkbKeyAliasRec));
+ if (!tmp)
+ return FALSE;
+ dst->names->key_aliases = tmp;
+ }
+ memcpy(dst->names->key_aliases, src->names->key_aliases,
+ src->names->num_key_aliases * sizeof(XkbKeyAliasRec));
+ }
+ else {
+ if (dst->names->key_aliases) {
+ xfree(dst->names->key_aliases);
+ dst->names->key_aliases = NULL;
+ }
+ }
+ dst->names->num_key_aliases = src->names->num_key_aliases;
+
+ if (src->names->num_rg) {
+ if (src->names->num_rg != dst->names->num_rg) {
+ if (dst->names->radio_groups)
+ tmp = xrealloc(dst->names->radio_groups,
+ src->names->num_rg * sizeof(Atom));
+ else
+ tmp = xalloc(src->names->num_rg * sizeof(Atom));
+ if (!tmp)
+ return FALSE;
+ dst->names->radio_groups = tmp;
+ }
+ memcpy(dst->names->radio_groups, src->names->radio_groups,
+ src->names->num_rg * sizeof(Atom));
+ }
+ else {
+ if (dst->names->radio_groups)
+ xfree(dst->names->radio_groups);
+ }
+ dst->names->num_rg = src->names->num_rg;
+
+ dst->names->keycodes = src->names->keycodes;
+ dst->names->geometry = src->names->geometry;
+ dst->names->symbols = src->names->symbols;
+ dst->names->types = src->names->types;
+ dst->names->compat = src->names->compat;
+ dst->names->phys_symbols = src->names->phys_symbols;
+
+ memcpy(dst->names->vmods, src->names->vmods,
+ XkbNumVirtualMods * sizeof(Atom));
+ memcpy(dst->names->indicators, src->names->indicators,
+ XkbNumIndicators * sizeof(Atom));
+ memcpy(dst->names->groups, src->names->groups,
+ XkbNumKbdGroups * sizeof(Atom));
+ }
+ else {
+ if (dst->names)
+ XkbFreeNames(dst, XkbAllNamesMask, True);
+ }
+
+ /* compat */
+ if (src->compat) {
+ if (!dst->compat) {
+ dst->compat = xcalloc(1, sizeof(XkbCompatMapRec));
+ if (!dst->compat)
+ return FALSE;
+ }
+
+ if (src->compat->sym_interpret) {
+ if (src->compat->size_si != dst->compat->size_si) {
+ if (dst->compat->sym_interpret)
+ tmp = xrealloc(dst->compat->sym_interpret,
+ src->compat->size_si *
+ sizeof(XkbSymInterpretRec));
+ else
+ tmp = xalloc(src->compat->size_si *
+ sizeof(XkbSymInterpretRec));
+ if (!tmp)
+ return FALSE;
+ dst->compat->sym_interpret = tmp;
+ }
+ memcpy(dst->compat->sym_interpret, src->compat->sym_interpret,
+ src->compat->size_si * sizeof(XkbSymInterpretRec));
+ }
+ else {
+ if (dst->compat->sym_interpret) {
+ xfree(dst->compat->sym_interpret);
+ dst->compat->sym_interpret = NULL;
+ }
+ }
+ dst->compat->num_si = src->compat->num_si;
+ dst->compat->size_si = src->compat->size_si;
+
+ memcpy(dst->compat->groups, src->compat->groups,
+ XkbNumKbdGroups * sizeof(XkbModsRec));
+ }
+ else {
+ if (dst->compat)
+ XkbFreeCompatMap(dst, XkbAllCompatMask, True);
+ }
+
+ /* geometry */
+ if (src->geom) {
+ if (!dst->geom) {
+ dst->geom = xcalloc(sizeof(XkbGeometryRec), 1);
+ if (!dst->geom)
+ return FALSE;
+ }
+
+ /* properties */
+ if (src->geom->num_properties) {
+ if (src->geom->num_properties != dst->geom->sz_properties) {
+ if (src->geom->num_properties < dst->geom->sz_properties) {
+ for (i = src->geom->num_properties,
+ dprop = dst->geom->properties +
+ src->geom->num_properties;
+ i < dst->geom->num_properties;
+ i++, dprop++) {
+ xfree(dprop->name);
+ xfree(dprop->value);
+ }
+ }
+
+ if (dst->geom->sz_properties)
+ tmp = xrealloc(dst->geom->properties,
+ src->geom->num_properties *
+ sizeof(XkbPropertyRec));
+ else
+ tmp = xalloc(src->geom->num_properties *
+ sizeof(XkbPropertyRec));
+ if (!tmp)
+ return FALSE;
+ dst->geom->properties = tmp;
+ }
+
+ dst->geom->sz_properties = src->geom->num_properties;
+
+ if (dst->geom->sz_properties > dst->geom->num_properties) {
+ bzero(dst->geom->properties + dst->geom->num_properties,
+ (dst->geom->sz_properties - dst->geom->num_properties) *
+ sizeof(XkbPropertyRec));
+ }
+
+ for (i = 0,
+ sprop = src->geom->properties,
+ dprop = dst->geom->properties;
+ i < src->geom->num_properties;
+ i++, sprop++, dprop++) {
+ if (i < dst->geom->num_properties) {
+ if (strlen(sprop->name) != strlen(dprop->name)) {
+ tmp = xrealloc(dprop->name, strlen(sprop->name) + 1);
+ if (!tmp)
+ return FALSE;
+ dprop->name = tmp;
+ }
+ if (strlen(sprop->value) != strlen(dprop->value)) {
+ tmp = xrealloc(dprop->value, strlen(sprop->value) + 1);
+ if (!tmp)
+ return FALSE;
+ dprop->value = tmp;
+ }
+ strcpy(dprop->name, sprop->name);
+ strcpy(dprop->value, sprop->value);
+ }
+ else {
+ dprop->name = xstrdup(sprop->name);
+ dprop->value = xstrdup(sprop->value);
+ }
+ }
+
+ dst->geom->num_properties = dst->geom->sz_properties;
+ }
+ else {
+ if (dst->geom->sz_properties) {
+ for (i = 0, dprop = dst->geom->properties;
+ i < dst->geom->num_properties;
+ i++, dprop++) {
+ xfree(dprop->name);
+ xfree(dprop->value);
+ }
+ xfree(dst->geom->properties);
+ dst->geom->properties = NULL;
+ }
+
+ dst->geom->num_properties = 0;
+ dst->geom->sz_properties = 0;
+ }
+
+ /* colors */
+ if (src->geom->num_colors) {
+ if (src->geom->num_colors != dst->geom->sz_colors) {
+ if (src->geom->num_colors < dst->geom->sz_colors) {
+ for (i = src->geom->num_colors,
+ dcolor = dst->geom->colors +
+ src->geom->num_colors;
+ i < dst->geom->num_colors;
+ i++, dcolor++) {
+ xfree(dcolor->spec);
+ }
+ }
+
+ if (dst->geom->sz_colors)
+ tmp = xrealloc(dst->geom->colors,
+ src->geom->num_colors *
+ sizeof(XkbColorRec));
+ else
+ tmp = xalloc(src->geom->num_colors *
+ sizeof(XkbColorRec));
+ if (!tmp)
+ return FALSE;
+ dst->geom->colors = tmp;
+ }
+
+ dst->geom->sz_colors = src->geom->num_colors;
+
+ if (dst->geom->sz_colors > dst->geom->num_colors) {
+ bzero(dst->geom->colors + dst->geom->num_colors,
+ (dst->geom->sz_colors - dst->geom->num_colors) *
+ sizeof(XkbColorRec));
+ }
+
+ for (i = 0,
+ scolor = src->geom->colors,
+ dcolor = dst->geom->colors;
+ i < src->geom->num_colors;
+ i++, scolor++, dcolor++) {
+ if (i < dst->geom->num_colors) {
+ if (strlen(scolor->spec) != strlen(dcolor->spec)) {
+ tmp = xrealloc(dcolor->spec, strlen(scolor->spec) + 1);
+ if (!tmp)
+ return FALSE;
+ dcolor->spec = tmp;
+ }
+ strcpy(dcolor->spec, scolor->spec);
+ }
+ else {
+ dcolor->spec = xstrdup(scolor->spec);
+ }
+ }
+
+ dst->geom->num_colors = dst->geom->sz_colors;
+ }
+ else {
+ if (dst->geom->sz_colors) {
+ for (i = 0, dcolor = dst->geom->colors;
+ i < dst->geom->num_colors;
+ i++, dcolor++) {
+ xfree(dcolor->spec);
+ }
+ xfree(dst->geom->colors);
+ dst->geom->colors = NULL;
+ }
+
+ dst->geom->num_colors = 0;
+ dst->geom->sz_colors = 0;
+ }
+
+ /* shapes */
+ /* shapes break down into outlines, which break down into points. */
+ if (dst->geom->num_shapes) {
+ for (i = 0, dshape = dst->geom->shapes;
+ i < dst->geom->num_shapes;
+ i++, dshape++) {
+ for (j = 0, doutline = dshape->outlines;
+ j < dshape->num_outlines;
+ j++, doutline++) {
+ if (doutline->sz_points)
+ xfree(doutline->points);
+ }
+
+ if (dshape->sz_outlines) {
+ xfree(dshape->outlines);
+ dshape->outlines = NULL;
+ }
+
+ dshape->num_outlines = 0;
+ dshape->sz_outlines = 0;
+ }
+ }
+
+ if (src->geom->num_shapes) {
+ tmp = xcalloc(src->geom->num_shapes, sizeof(XkbShapeRec));
+ if (!tmp)
+ return FALSE;
+ dst->geom->shapes = tmp;
+
+ for (i = 0, sshape = src->geom->shapes, dshape = dst->geom->shapes;
+ i < src->geom->num_shapes;
+ i++, sshape++, dshape++) {
+ if (sshape->num_outlines) {
+ tmp = xcalloc(sshape->num_outlines, sizeof(XkbOutlineRec));
+ if (!tmp)
+ return FALSE;
+ dshape->outlines = tmp;
+
+ for (j = 0,
+ soutline = sshape->outlines,
+ doutline = dshape->outlines;
+ j < sshape->num_outlines;
+ j++, soutline++, doutline++) {
+ if (soutline->num_points) {
+ tmp = xalloc(soutline->num_points *
+ sizeof(XkbPointRec));
+ if (!tmp)
+ return FALSE;
+ doutline->points = tmp;
+
+ memcpy(doutline->points, soutline->points,
+ soutline->num_points * sizeof(XkbPointRec));
+ }
+
+ doutline->num_points = soutline->num_points;
+ doutline->sz_points = soutline->sz_points;
+ }
+ }
+
+ dshape->num_outlines = sshape->num_outlines;
+ dshape->sz_outlines = sshape->num_outlines;
+ }
+
+ dst->geom->num_shapes = src->geom->num_shapes;
+ dst->geom->sz_shapes = src->geom->num_shapes;
+ }
+ else {
+ if (dst->geom->sz_shapes) {
+ xfree(dst->geom->shapes);
+ dst->geom->shapes = NULL;
+ }
+
+ dst->geom->num_shapes = 0;
+ dst->geom->sz_shapes = 0;
+ }
+
+ /* sections */
+ /* sections break down into doodads, and also into rows, which break
+ * down into keys. */
+ if (dst->geom->num_sections) {
+ for (i = 0, dsection = dst->geom->sections;
+ i < dst->geom->num_sections;
+ i++, dsection++) {
+ for (j = 0, drow = dsection->rows;
+ j < dsection->num_rows;
+ j++, drow++) {
+ if (drow->num_keys)
+ xfree(drow->keys);
+ }
+
+ if (dsection->num_rows)
+ xfree(dsection->rows);
+
+ /* cut and waste from geom/doodad below. */
+ for (j = 0, ddoodad = dsection->doodads;
+ j < dsection->num_doodads;
+ j++, ddoodad++) {
+ if (ddoodad->any.type == XkbTextDoodad) {
+ if (ddoodad->text.text) {
+ xfree(ddoodad->text.text);
+ ddoodad->text.text = NULL;
+ }
+ if (ddoodad->text.font) {
+ xfree(ddoodad->text.font);
+ ddoodad->text.font = NULL;
+ }
+ }
+ else if (ddoodad->any.type == XkbLogoDoodad) {
+ if (ddoodad->logo.logo_name) {
+ xfree(ddoodad->logo.logo_name);
+ ddoodad->logo.logo_name = NULL;
+ }
+ }
+ }
+
+ if (dsection->num_doodads)
+ xfree(dsection->doodads);
+ }
+
+ dst->geom->num_sections = 0;
+ }
+
+ if (src->geom->num_sections) {
+ if (dst->geom->sz_sections)
+ tmp = xrealloc(dst->geom->sections,
+ src->geom->num_sections *
+ sizeof(XkbSectionRec));
+ else
+ tmp = xalloc(src->geom->num_sections * sizeof(XkbSectionRec));
+ if (!tmp)
+ return FALSE;
+ dst->geom->sections = tmp;
+
+ for (i = 0,
+ ssection = src->geom->sections,
+ dsection = dst->geom->sections;
+ i < src->geom->num_sections;
+ i++, ssection++, dsection++) {
+ if (ssection->num_rows) {
+ tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec));
+ if (!tmp)
+ return FALSE;
+ dsection->rows = tmp;
+ }
+ for (j = 0, srow = ssection->rows, drow = dsection->rows;
+ j < ssection->num_rows;
+ j++, srow++, drow++) {
+ if (srow->num_keys) {
+ tmp = xalloc(srow->num_keys * sizeof(XkbKeyRec));
+ if (!tmp)
+ return FALSE;
+ drow->keys = tmp;
+ memcpy(drow->keys, srow->keys,
+ srow->num_keys * sizeof(XkbKeyRec));
+ }
+ drow->num_keys = srow->num_keys;
+ drow->sz_keys = srow->num_keys;
+ }
+
+ if (ssection->num_doodads) {
+ tmp = xcalloc(ssection->num_doodads, sizeof(XkbDoodadRec));
+ if (!tmp)
+ return FALSE;
+ dsection->doodads = tmp;
+ }
+ for (k = 0,
+ sdoodad = ssection->doodads,
+ ddoodad = dsection->doodads;
+ k < ssection->num_doodads;
+ k++, sdoodad++, ddoodad++) {
+ if (sdoodad->any.type == XkbTextDoodad) {
+ if (sdoodad->text.text)
+ ddoodad->text.text =
+ xstrdup(sdoodad->text.text);
+ if (sdoodad->text.font)
+ ddoodad->text.font =
+ xstrdup(sdoodad->text.font);
+ }
+ else if (sdoodad->any.type == XkbLogoDoodad) {
+ if (sdoodad->logo.logo_name)
+ ddoodad->logo.logo_name =
+ xstrdup(sdoodad->logo.logo_name);
+ }
+ ddoodad->any.type = sdoodad->any.type;
+ }
+ dsection->num_doodads = ssection->num_doodads;
+ dsection->sz_doodads = ssection->num_doodads;
+ }
+ }
+ else {
+ if (dst->geom->sz_sections) {
+ xfree(dst->geom->sections);
+ dst->geom->sections = NULL;
+ }
+
+ dst->geom->num_sections = 0;
+ dst->geom->sz_sections = 0;
+ }
+
+ /* doodads */
+ if (dst->geom->num_doodads) {
+ for (i = src->geom->num_doodads,
+ ddoodad = dst->geom->doodads +
+ src->geom->num_doodads;
+ i < dst->geom->num_doodads;
+ i++, ddoodad++) {
+ if (ddoodad->any.type == XkbTextDoodad) {
+ if (ddoodad->text.text) {
+ xfree(ddoodad->text.text);
+ ddoodad->text.text = NULL;
+ }
+ if (ddoodad->text.font) {
+ xfree(ddoodad->text.font);
+ ddoodad->text.font = NULL;
+ }
+ }
+ else if (ddoodad->any.type == XkbLogoDoodad) {
+ if (ddoodad->logo.logo_name) {
+ xfree(ddoodad->logo.logo_name);
+ ddoodad->logo.logo_name = NULL;
+ }
+ }
+ }
+ }
+
+ if (src->geom->num_doodads) {
+ if (dst->geom->sz_doodads)
+ tmp = xrealloc(dst->geom->doodads,
+ src->geom->num_doodads *
+ sizeof(XkbDoodadRec));
+ else
+ tmp = xalloc(src->geom->num_doodads *
+ sizeof(XkbDoodadRec));
+ if (!tmp)
+ return FALSE;
+ bzero(tmp, src->geom->num_doodads * sizeof(XkbDoodadRec));
+ dst->geom->doodads = tmp;
+
+ dst->geom->sz_doodads = src->geom->num_doodads;
+
+ for (i = 0,
+ sdoodad = src->geom->doodads,
+ ddoodad = dst->geom->doodads;
+ i < src->geom->num_doodads;
+ i++, sdoodad++, ddoodad++) {
+ ddoodad->any.type = sdoodad->any.type;
+ if (sdoodad->any.type == XkbTextDoodad) {
+ if (sdoodad->text.text)
+ ddoodad->text.text = xstrdup(sdoodad->text.text);
+ if (sdoodad->text.font)
+ ddoodad->text.font = xstrdup(sdoodad->text.font);
+ }
+ else if (sdoodad->any.type == XkbLogoDoodad) {
+ if (sdoodad->logo.logo_name)
+ ddoodad->logo.logo_name =
+ xstrdup(sdoodad->logo.logo_name);
+ }
+ }
+
+ dst->geom->num_doodads = dst->geom->sz_doodads;
+ }
+ else {
+ if (dst->geom->sz_doodads) {
+ xfree(dst->geom->doodads);
+ dst->geom->doodads = NULL;
+ }
+
+ dst->geom->num_doodads = 0;
+ dst->geom->sz_doodads = 0;
+ }
+
+ /* key aliases */
+ if (src->geom->num_key_aliases) {
+ if (src->geom->num_key_aliases != dst->geom->sz_key_aliases) {
+ if (dst->geom->sz_key_aliases)
+ tmp = xrealloc(dst->geom->key_aliases,
+ src->geom->num_key_aliases *
+ 2 * XkbKeyNameLength);
+ else
+ tmp = xalloc(src->geom->num_key_aliases *
+ 2 * XkbKeyNameLength);
+ if (!tmp)
+ return FALSE;
+ dst->geom->key_aliases = tmp;
+
+ dst->geom->sz_key_aliases = src->geom->num_key_aliases;
+ }
+
+ memcpy(dst->geom->key_aliases, src->geom->key_aliases,
+ src->geom->num_key_aliases * 2 * XkbKeyNameLength);
+
+ dst->geom->num_key_aliases = dst->geom->sz_key_aliases;
+ }
+ else {
+ if (dst->geom->sz_key_aliases) {
+ xfree(dst->geom->key_aliases);
+ dst->geom->key_aliases = NULL;
+ }
+ dst->geom->num_key_aliases = 0;
+ dst->geom->sz_key_aliases = 0;
+ }
+
+ /* font */
+ if (src->geom->label_font) {
+ if (strlen(src->geom->label_font) !=
+ strlen(dst->geom->label_font)) {
+ if (dst->geom->label_font)
+ tmp = xrealloc(dst->geom->label_font,
+ strlen(src->geom->label_font));
+ else
+ tmp = xalloc(strlen(src->geom->label_font));
+ if (!tmp)
+ return FALSE;
+ dst->geom->label_font = tmp;
+ }
+
+ strcpy(dst->geom->label_font, src->geom->label_font);
+ i = XkbGeomColorIndex(src->geom, src->geom->label_color);
+ dst->geom->label_color = &(src->geom->colors[i]);
+ i = XkbGeomColorIndex(src->geom, src->geom->base_color);
+ dst->geom->base_color = &(src->geom->colors[i]);
+ }
+ else {
+ if (dst->geom->label_font) {
+ xfree(dst->geom->label_font);
+ dst->geom->label_font = NULL;
+ }
+ dst->geom->label_color = NULL;
+ dst->geom->base_color = NULL;
+ }
+
+ dst->geom->name = src->geom->name;
+ dst->geom->width_mm = src->geom->width_mm;
+ dst->geom->height_mm = src->geom->height_mm;
+ }
+ else
+ {
+ if (dst->geom) {
+ /* I LOVE THE DIFFERENT CALL SIGNATURE. REALLY, I DO. */
+ XkbFreeGeometry(dst->geom, XkbGeomAllMask, True);
+ dst->geom = NULL;
+ }
+ }
+
+ if (inputInfo.keyboard->key->xkbInfo &&
+ inputInfo.keyboard->key->xkbInfo->desc == dst) {
+ pDev = inputInfo.keyboard;
+ }
+ else {
+ for (tmpDev = inputInfo.devices; tmpDev && !pDev;
+ tmpDev = tmpDev->next) {
+ if (tmpDev->key && tmpDev->key->xkbInfo &&
+ tmpDev->key->xkbInfo->desc == dst) {
+ pDev = tmpDev;
+ break;
+ }
+ }
+ for (tmpDev = inputInfo.off_devices; tmpDev && !pDev;
+ tmpDev = tmpDev->next) {
+ if (tmpDev->key && tmpDev->key->xkbInfo &&
+ tmpDev->key->xkbInfo->desc == dst) {
+ pDev = tmpDev;
+ break;
+ }
+ }
+ }
+
+ if (sendNotifies) {
+ if (!pDev) {
+ ErrorF("XkbCopyKeymap: asked for notifies, but can't find device!\n");
+ }
+ else {
+ /* send NewKeyboardNotify if the keycode range changed, else
+ * just MapNotify. we also need to send NKN if the geometry
+ * changed (obviously ...). */
+ if ((src->min_key_code != dst->min_key_code ||
+ src->max_key_code != dst->max_key_code) && sendNotifies) {
+ nkn.oldMinKeyCode = dst->min_key_code;
+ nkn.oldMaxKeyCode = dst->max_key_code;
+ nkn.deviceID = nkn.oldDeviceID = pDev->id;
+ nkn.minKeyCode = src->min_key_code;
+ nkn.maxKeyCode = src->max_key_code;
+ nkn.requestMajor = XkbReqCode;
+ nkn.requestMinor = X_kbSetMap; /* XXX bare-faced lie */
+ nkn.changed = XkbAllNewKeyboardEventsMask;
+ XkbSendNewKeyboardNotify(pDev, &nkn);
+ }
+ else if (sendNotifies) {
+ mn.deviceID = pDev->id;
+ mn.minKeyCode = src->min_key_code;
+ mn.maxKeyCode = src->max_key_code;
+ mn.firstType = 0;
+ mn.nTypes = src->map->num_types;
+ mn.firstKeySym = src->min_key_code;
+ mn.nKeySyms = XkbNumKeys(src);
+ mn.firstKeyAct = src->min_key_code;
+ mn.nKeyActs = XkbNumKeys(src);
+ /* Cargo-culted from ProcXkbGetMap. */
+ mn.firstKeyBehavior = src->min_key_code;
+ mn.nKeyBehaviors = XkbNumKeys(src);
+ mn.firstKeyExplicit = src->min_key_code;
+ mn.nKeyExplicit = XkbNumKeys(src);
+ mn.firstModMapKey = src->min_key_code;
+ mn.nModMapKeys = XkbNumKeys(src);
+ mn.firstVModMapKey = src->min_key_code;
+ mn.nVModMapKeys = XkbNumKeys(src);
+ mn.virtualMods = ~0; /* ??? */
+ mn.changed = XkbAllMapComponentsMask;
+ XkbSendMapNotify(pDev, &mn);
+ }
+ }
+ }
+
+ dst->min_key_code = src->min_key_code;
+ dst->max_key_code = src->max_key_code;
+
+ return TRUE;
+}