aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-11-14 21:29:32 +0000
committermarha <marha@users.sourceforge.net>2010-11-14 21:29:32 +0000
commit3425b16d521b8846b95df2b7d32a548d93341f3b (patch)
treefa430e95285d90f990b2d5574dad1e409ba5980c /xorg-server/hw
parent41c64098a90b4e974d5005a1619472f2e8a64ea1 (diff)
downloadvcxsrv-3425b16d521b8846b95df2b7d32a548d93341f3b.tar.gz
vcxsrv-3425b16d521b8846b95df2b7d32a548d93341f3b.tar.bz2
vcxsrv-3425b16d521b8846b95df2b7d32a548d93341f3b.zip
xserver pixman libX11 libXext 14/11/2010
Diffstat (limited to 'xorg-server/hw')
-rw-r--r--xorg-server/hw/dmx/doc/dmx.xml14
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmds.c2
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxext.c18
-rw-r--r--xorg-server/hw/dmx/input/dmxevents.c1595
-rw-r--r--xorg-server/hw/dmx/input/dmxinputinit.c16
-rw-r--r--xorg-server/hw/dmx/input/dmxmotion.c7
-rw-r--r--xorg-server/hw/dmx/input/dmxxinput.c17
-rw-r--r--xorg-server/hw/kdrive/fake/fake.c7
-rw-r--r--xorg-server/hw/kdrive/src/kinput.c39
-rw-r--r--xorg-server/hw/vfb/InitInput.c2
-rw-r--r--xorg-server/hw/xfree86/common/Makefile.am188
-rw-r--r--xorg-server/hw/xfree86/common/xf86.h1
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c147
-rw-r--r--xorg-server/hw/xfree86/common/xf86Events.c20
-rw-r--r--xorg-server/hw/xfree86/common/xf86Globals.c5
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c107
-rw-r--r--xorg-server/hw/xfree86/common/xf86InPriv.h89
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Module.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Opt.h1
-rw-r--r--xorg-server/hw/xfree86/common/xf86Option.c61
-rw-r--r--xorg-server/hw/xfree86/common/xf86Privstr.h4
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c553
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.h122
-rw-r--r--xorg-server/hw/xfree86/common/xf86str.h12
-rw-r--r--xorg-server/hw/xfree86/doc/devel/Registry817
-rw-r--r--xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre12
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c11
-rw-r--r--xorg-server/hw/xfree86/loader/sdksyms.sh1
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c3
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Rotate.c2
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/hurd_video.c9
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_init.c4
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/lnx_video.c2
-rw-r--r--xorg-server/hw/xfree86/x86emu/ops.c20
-rw-r--r--xorg-server/hw/xnest/Events.c14
-rw-r--r--xorg-server/hw/xquartz/darwin.c21
-rw-r--r--xorg-server/hw/xquartz/darwinEvents.c10
-rw-r--r--xorg-server/hw/xquartz/darwinXinput.c72
-rw-r--r--xorg-server/hw/xwin/InitInput.c4
-rw-r--r--xorg-server/hw/xwin/glx/indirect.c5
-rw-r--r--xorg-server/hw/xwin/wincmap.c1345
-rw-r--r--xorg-server/hw/xwin/winmouse.c8
-rw-r--r--xorg-server/hw/xwin/winpixmap.c467
44 files changed, 2824 insertions, 3034 deletions
diff --git a/xorg-server/hw/dmx/doc/dmx.xml b/xorg-server/hw/dmx/doc/dmx.xml
index c7eaf1333..c998485bc 100644
--- a/xorg-server/hw/dmx/doc/dmx.xml
+++ b/xorg-server/hw/dmx/doc/dmx.xml
@@ -817,22 +817,10 @@ is called once for each input device.
</para>
<para>Once input handles for core keyboard and core pointer devices have
-been obtained from AddInputDevice(), they are registered as core devices
-by calling RegisterPointerDevice() and RegisterKeyboardDevice(). Each
-of these should be called once. If both core devices are not
+been obtained from AddInputDevice(). If both core devices are not
registered, then the X server will exit with a fatal error when it
attempts to start the input devices in InitAndStartDevices(), which is
called directly after InitInput() (see below).
-
-<variablelist>
-<varlistentry>
-<term>Register{Pointer,Keyboard}Device()</term>
-<listitem><para>These DIX functions take a
-handle returned from AddInputDevice() and initialize the core input
-device fields in inputInfo, and initialize the input processing and grab
-functions for each core input device.
-</para></listitem></varlistentry>
-</variablelist>
</para>
<para>The core pointer device is then registered with the miPointer code
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c
index f1893656f..26ffad825 100644
--- a/xorg-server/hw/dmx/glxProxy/glxcmds.c
+++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c
@@ -2565,7 +2565,7 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
- if (cl->GLClientextensions) free(cl->GLClientextensions);
+ free(cl->GLClientextensions);
buf = (const char *)(req+1);
cl->GLClientextensions = strdup(buf);
diff --git a/xorg-server/hw/dmx/glxProxy/glxext.c b/xorg-server/hw/dmx/glxProxy/glxext.c
index 01cbd6e08..a90c14906 100644
--- a/xorg-server/hw/dmx/glxProxy/glxext.c
+++ b/xorg-server/hw/dmx/glxProxy/glxext.c
@@ -77,10 +77,10 @@ static void ResetClientState(int clientIndex)
Display **keep_be_displays;
int i;
- if (cl->returnBuf) free(cl->returnBuf);
- if (cl->currentContexts) free(cl->currentContexts);
- if (cl->currentDrawables) free(cl->currentDrawables);
- if (cl->largeCmdBuf) free(cl->largeCmdBuf);
+ free(cl->returnBuf);
+ free(cl->currentContexts);
+ free(cl->currentDrawables);
+ free(cl->largeCmdBuf);
for (i=0; i< screenInfo.numScreens; i++) {
if (cl->be_displays[i])
@@ -97,7 +97,7 @@ static void ResetClientState(int clientIndex)
*/
cl->GLClientmajorVersion = 1;
cl->GLClientminorVersion = 0;
- if (cl->GLClientextensions) free(cl->GLClientextensions);
+ free(cl->GLClientextensions);
memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
}
@@ -222,10 +222,10 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
{
if (cx->idExists || cx->isCurrent) return GL_FALSE;
- if (cx->feedbackBuf) free(cx->feedbackBuf);
- if (cx->selectBuf) free(cx->selectBuf);
- if (cx->real_ids) free(cx->real_ids);
- if (cx->real_vids) free(cx->real_vids);
+ free(cx->feedbackBuf);
+ free(cx->selectBuf);
+ free(cx->real_ids);
+ free(cx->real_vids);
if (cx->pGlxPixmap) {
/*
diff --git a/xorg-server/hw/dmx/input/dmxevents.c b/xorg-server/hw/dmx/input/dmxevents.c
index dfa6bdad5..efcd07da3 100644
--- a/xorg-server/hw/dmx/input/dmxevents.c
+++ b/xorg-server/hw/dmx/input/dmxevents.c
@@ -1,795 +1,800 @@
-/*
- * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * Provide support and helper functions for enqueing events received by
- * the low-level input drivers. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_EVENTS_DEBUG 0
-
-#include "dmxinputinit.h"
-#include "dmxevents.h"
-#include "dmxcb.h"
-#include "dmxcommon.h"
-#include "dmxcursor.h"
-#include "dmxmotion.h"
-#include "dmxsigio.h"
-#include "dmxmap.h"
-
-#include <X11/keysym.h>
-#include "opaque.h"
-#include "inputstr.h"
-#include "mipointer.h"
-#include "mi.h"
-#include "exglobals.h"
-
-#include "xkbsrv.h"
-#include "XIstubs.h"
-
-static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
-static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
- * should move the mouse anyway. */
-
-#if DMX_EVENTS_DEBUG
-#define DMXDBG0(f) dmxLog(dmxDebug,f)
-#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
-#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
-#else
-#define DMXDBG0(f)
-#define DMXDBG1(f,a)
-#define DMXDBG2(f,a,b)
-#define DMXDBG3(f,a,b,c)
-#define DMXDBG4(f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h)
-#endif
-
-static int dmxApplyFunctions(DMXInputInfo *dmxInput, DMXFunctionType f)
-{
- int i;
- int rc = 0;
-
- for (i = 0; i < dmxInput->numDevs; i+= dmxInput->devs[i]->binding)
- if (dmxInput->devs[i]->functions)
- rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f);
- return rc;
-}
-
-static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
- int type,
- KeySym keySym)
-{
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
-
-#if 1 /* hack to detect ctrl-alt-q, etc */
- static int ctrl = 0, alt = 0;
- /* keep track of ctrl/alt key status */
- if (type == KeyPress && keySym == 0xffe3) {
- ctrl = 1;
- }
- else if (type == KeyRelease && keySym == 0xffe3) {
- ctrl = 0;
- }
- else if (type == KeyPress && keySym == 0xffe9) {
- alt = 1;
- }
- else if (type == KeyRelease && keySym == 0xffe9) {
- alt = 0;
- }
- if (!ctrl || !alt)
- return 0;
-#else
- unsigned short state = 0;
-
- if (dmxLocal->sendsCore)
- state = dmxLocalCoreKeyboard->pDevice->key->state;
- else if (dmxLocal->pDevice->key)
- state = dmxLocal->pDevice->key->state;
-
- DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
- keySym, type == KeyPress ? "press" : "release", state);
-
- if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
- return 0;
-#endif
-
- switch (keySym) {
- case XK_g:
- if (type == KeyPress)
- dmxApplyFunctions(dmxInput, DMX_FUNCTION_GRAB);
- return 1;
- case XK_f:
- if (type == KeyPress)
- dmxApplyFunctions(dmxInput, DMX_FUNCTION_FINE);
- return 1;
- case XK_q:
- if (type == KeyPress && dmxLocal->sendsCore)
- if (dmxApplyFunctions(dmxInput, DMX_FUNCTION_TERMINATE)) {
- dmxLog(dmxInfo, "User request for termination\n");
- dispatchException |= DE_TERMINATE;
- }
- return 1;
- }
-
- return 0;
-}
-
-
-DMXScreenInfo *dmxFindFirstScreen(int x, int y)
-{
- int i;
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- if (dmxOnScreen(x, y, dmxScreen))
- return dmxScreen;
- }
- return NULL;
-}
-
-
-/**
- * Enqueue a motion event.
- */
-static void enqueueMotion(DevicePtr pDev, int x, int y)
-{
- GETDMXLOCALFROMPDEV;
- DeviceIntPtr p = dmxLocal->pDevice;
- int i, nevents, valuators[3];
- EventListPtr events;
- int detail = 0; /* XXX should this be mask of pressed buttons? */
- valuators[0] = x;
- valuators[1] = y;
-
- GetEventList(&events);
- nevents = GetPointerEvents(events, p, MotionNotify, detail,
- POINTER_ABSOLUTE | POINTER_SCREEN, 0, 2, valuators);
- for (i = 0; i < nevents; i++)
- mieqEnqueue(p, (InternalEvent*)(events + i)->event);
- return;
-}
-
-
-void
-dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
-{
- DMXScreenInfo *dmxScreen;
- DMXInputInfo *dmxInput;
- ScreenPtr pScreen;
- int localX;
- int localY;
- int i;
-
- if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
- return;
-
- DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
- x, y, delta, dmxGlobalX, dmxGlobalY);
-
- dmxGlobalInvalid = 0;
- dmxGlobalX = x;
- dmxGlobalY = y;
-
- if (dmxGlobalX < 0)
- dmxGlobalX = 0;
- if (dmxGlobalY < 0)
- dmxGlobalY = 0;
- if (dmxGlobalX >= dmxGlobalWidth)
- dmxGlobalX = dmxGlobalWidth + delta -1;
- if (dmxGlobalY >= dmxGlobalHeight)
- dmxGlobalY = dmxGlobalHeight + delta -1;
-
- if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
- localX = dmxGlobalX - dmxScreen->rootXOrigin;
- localY = dmxGlobalY - dmxScreen->rootYOrigin;
- if ((pScreen = miPointerGetScreen(inputInfo.pointer))
- && pScreen->myNum == dmxScreen->index) {
- /* Screen is old screen */
- if (block)
- dmxSigioBlock();
- if (pDev)
- enqueueMotion(pDev, localX, localY);
- if (block)
- dmxSigioUnblock();
- } else {
- /* Screen is new */
- DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n",
- pScreen->myNum, dmxScreen->index, localX, localY);
- if (block)
- dmxSigioBlock();
- mieqProcessInputEvents();
- miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
- localX, localY);
- if (pDev)
- enqueueMotion(pDev, localX, localY);
- if (block)
- dmxSigioUnblock();
- }
-#if 00
- miPointerGetPosition(inputInfo.pointer, &localX, &localY);
-
- if ((pScreen = miPointerGetScreen(inputInfo.pointer))) {
- dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin;
- dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin;
- ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY,
- localX, localY);
- DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d"
- " on screen index=%d/%d localX=%d localY=%d\n",
- dmxGlobalX, dmxGlobalY,
- dmxScreen ? dmxScreen->index : -1, pScreen->myNum,
- localX, localY);
- }
-#endif
- }
- /* Send updates down to all core input
- * drivers */
- for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
- int j;
- for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
- if (!dmxInput->detached
- && dmxInput->devs[j]->sendsCore
- && dmxInput->devs[j]->update_position)
- dmxInput->devs[j]->update_position(dmxInput->devs[j]->private,
- dmxGlobalX, dmxGlobalY);
- }
- if (!dmxScreen) ProcessInputEvents();
-}
-
-
-
-#define DMX_MAX_AXES 32 /* Max axes reported by this routine */
-static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
- int *v, int firstAxis, int axesCount,
- DMXMotionType type, DMXBlockType block)
-{
- DeviceIntPtr pDevice = dmxLocal->pDevice;
- xEvent xE[2 * DMX_MAX_AXES/6];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *)xE;
- deviceValuator *xv = (deviceValuator *)xev+1;
- int thisX = 0;
- int thisY = 0;
- int i;
- int count;
- EventListPtr events;
- int nevents;
-
- memset(xE, 0, sizeof(xE));
-
- if (axesCount > DMX_MAX_AXES) axesCount = DMX_MAX_AXES;
-
- if (!pDevice->valuator->mode && axesCount == 2) {
- /* The dmx console is a relative mode
- * device that sometimes reports
- * absolute motion. It only has two
- * axes. */
- if (type == DMX_RELATIVE) {
- thisX = -v[0];
- thisY = -v[1];
- dmxLocal->lastX += thisX;
- dmxLocal->lastY += thisY;
- if (dmxLocal->update_position)
- dmxLocal->update_position(dmxLocal->private,
- dmxLocal->lastX, dmxLocal->lastY);
- } else { /* Convert to relative */
- if (dmxLocal->lastX || dmxLocal->lastY) {
- thisX = v[0] - dmxLocal->lastX;
- thisY = v[1] - dmxLocal->lastY;
- }
- dmxLocal->lastX = v[0];
- dmxLocal->lastY = v[1];
- }
- v[0] = thisX;
- v[1] = thisY;
- }
-
- if (axesCount <= 6) {
- /* Optimize for the common case when
- * only 1 or 2 axes change. */
- xev->time = GetTimeInMillis();
- xev->type = DeviceMotionNotify;
- xev->detail = 0;
- xev->deviceid = pDevice->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = pDevice->id;
- xv->num_valuators = axesCount;
- xv->first_valuator = firstAxis;
- switch (xv->num_valuators) {
- case 6: xv->valuator5 = v[5];
- case 5: xv->valuator4 = v[4];
- case 4: xv->valuator3 = v[3];
- case 3: xv->valuator2 = v[2];
- case 2: xv->valuator1 = v[1];
- case 1: xv->valuator0 = v[0];
- }
- count = 2;
- } else {
- for (i = 0, count = 0; i < axesCount; i += 6) {
- xev->time = GetTimeInMillis();
- xev->type = DeviceMotionNotify;
- xev->detail = 0;
- xev->deviceid = pDevice->id | MORE_EVENTS;
- xev += 2;
-
- xv->type = DeviceValuator;
- xv->deviceid = pDevice->id;
- xv->num_valuators = (i+6 >= axesCount ? axesCount - i : 6);
- xv->first_valuator = firstAxis + i;
- switch (xv->num_valuators) {
- case 6: xv->valuator5 = v[i+5];
- case 5: xv->valuator4 = v[i+4];
- case 4: xv->valuator3 = v[i+3];
- case 3: xv->valuator2 = v[i+2];
- case 2: xv->valuator1 = v[i+1];
- case 1: xv->valuator0 = v[i+0];
- }
- xv += 2;
- count += 2;
- }
- }
-
- if (block)
- dmxSigioBlock();
- GetEventList(&events);
- nevents = GetPointerEvents(events, pDevice, MotionNotify, 0, POINTER_ABSOLUTE,
- firstAxis, axesCount, v);
- for (i = 0; i < nevents; i++)
- mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
-
- if (block)
- dmxSigioUnblock();
-}
-
-static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
- XEvent *e, DMXBlockType block)
-{
- int type;
- int event = -1;
- XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e;
- XDeviceMotionEvent *me = (XDeviceMotionEvent *)e;
- DeviceIntPtr pDevice = dmxLocal->pDevice;
- int valuators[6];
- EventListPtr events;
- int nevents, i;
-
- if (!e)
- return -1; /* No extended event passed, cannot handle */
-
- if ((XID)dmxLocal->deviceId != ke->deviceid) {
- /* Search for the correct dmxLocal,
- * since backend and console events are
- * picked up for the first device on
- * that X server. */
- int i;
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
- for (i = 0; i < dmxInput->numDevs; i++) {
- dmxLocal = dmxInput->devs[i];
- if ((XID)dmxLocal->deviceId == ke->deviceid)
- break;
- }
- }
-
- if ((XID)dmxLocal->deviceId != ke->deviceid
- || (type = dmxMapLookup(dmxLocal, e->type)) < 0)
- return -1; /* No mapping, so this event is unhandled */
-
- switch (type) {
- case XI_DeviceValuator: event = DeviceValuator; break;
- case XI_DeviceKeyPress: event = KeyPress; break;
- case XI_DeviceKeyRelease: event = KeyRelease; break;
- case XI_DeviceButtonPress: event = ButtonPress; break;
- case XI_DeviceButtonRelease: event = ButtonRelease; break;
- case XI_DeviceMotionNotify: event = MotionNotify; break;
- case XI_DeviceFocusIn: event = DeviceFocusIn; break;
- case XI_DeviceFocusOut: event = DeviceFocusOut; break;
- case XI_ProximityIn: event = ProximityIn; break;
- case XI_ProximityOut: event = ProximityOut; break;
- case XI_DeviceStateNotify: event = DeviceStateNotify; break;
- case XI_DeviceMappingNotify: event = DeviceMappingNotify; break;
- case XI_ChangeDeviceNotify: event = ChangeDeviceNotify; break;
- case XI_DeviceKeystateNotify: event = DeviceStateNotify; break;
- case XI_DeviceButtonstateNotify: event = DeviceStateNotify; break;
- }
-
-#define EXTRACT_VALUATORS(ke, valuators) \
- valuators[0] = ke->axis_data[0]; \
- valuators[1] = ke->axis_data[1]; \
- valuators[2] = ke->axis_data[2]; \
- valuators[3] = ke->axis_data[3]; \
- valuators[4] = ke->axis_data[4]; \
- valuators[5] = ke->axis_data[5]; \
-
- switch (type) {
- case XI_DeviceKeyPress:
- case XI_DeviceKeyRelease:
- EXTRACT_VALUATORS(ke, valuators);
- if (block)
- dmxSigioBlock();
- GetEventList(&events);
- nevents = GetKeyboardValuatorEvents(events, pDevice, event,
- ke->keycode, ke->first_axis,
- ke->axes_count, valuators);
- for (i = 0; i < nevents; i++)
- mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
-
- if (block)
- dmxSigioUnblock();
- break;
- case XI_DeviceButtonPress:
- case XI_DeviceButtonRelease:
- EXTRACT_VALUATORS(ke, valuators);
- if (block)
- dmxSigioBlock();
- GetEventList(&events);
- nevents = GetPointerEvents(events, pDevice, event, ke->keycode,
- POINTER_ABSOLUTE, ke->first_axis,
- ke->axes_count, valuators);
- for (i = 0; i < nevents; i++)
- mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
-
- if (block)
- dmxSigioUnblock();
- break;
- case XI_ProximityIn:
- case XI_ProximityOut:
- EXTRACT_VALUATORS(ke, valuators);
- if (block)
- dmxSigioBlock();
- GetEventList(&events);
- nevents = GetProximityEvents(events, pDevice, event,
- ke->first_axis, ke->axes_count,
- valuators);
- for (i = 0; i < nevents; i++)
- mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
-
- if (block)
- dmxSigioUnblock();
- break;
-
- break;
-
- case XI_DeviceMotionNotify:
- dmxExtMotion(dmxLocal, me->axis_data, me->first_axis, me->axes_count,
- DMX_ABSOLUTE, block);
- break;
- case XI_DeviceFocusIn:
- case XI_DeviceFocusOut:
- case XI_DeviceStateNotify:
- case XI_DeviceMappingNotify:
- case XI_ChangeDeviceNotify:
- case XI_DeviceKeystateNotify:
- case XI_DeviceButtonstateNotify:
- /* These are ignored, since DMX will
- * generate its own events of these
- * types, as necessary.
-
- * Perhaps ChangeDeviceNotify should
- * generate an error, because it is
- * unexpected? */
- break;
- case XI_DeviceValuator:
- default:
- dmxLog(dmxWarning,
- "XInput extension event (remote=%d -> zero-based=%d)"
- " not supported yet\n", e->type, type);
- return -1;
- }
- return 0;
-}
-
-static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
-{
- ButtonClassPtr b = dmxLocal->pDevice->button;
-
- if (button > b->numButtons) { /* This shouldn't happen. */
- dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n",
- button, b->numButtons);
- return button;
- }
- return b->map[button];
-}
-
-/** Return DMX's notion of the pointer position in the global coordinate
- * space. */
-void dmxGetGlobalPosition(int *x, int *y)
-{
- *x = dmxGlobalX;
- *y = dmxGlobalY;
-}
-
-/** Invalidate the global position for #dmxCoreMotion. */
-void dmxInvalidateGlobalPosition(void)
-{
- dmxGlobalInvalid = 1;
-}
-
-/** Enqueue a motion event for \a pDev. The \a v vector has length \a
- * axesCount, and contains values for each of the axes, starting at \a
- * firstAxes.
- *
- * The \a type of the motion may be \a DMX_RELATIVE, \a DMX_ABSOLUTE, or
- * \a DMX_ABSOLUTE_CONFINED (in the latter case, the pointer will not be
- * allowed to move outside the global boundaires).
- *
- * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
- * blocked around calls to \a enqueueMotion(). */
-void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
- DMXMotionType type, DMXBlockType block)
-{
- GETDMXLOCALFROMPDEV;
-
- if (!dmxLocal->sendsCore) {
- dmxExtMotion(dmxLocal, v, firstAxes, axesCount, type, block);
- return;
- }
- if (axesCount == 2) {
- switch (type) {
- case DMX_RELATIVE:
- dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block);
- break;
- case DMX_ABSOLUTE:
- dmxCoreMotion(pDev, v[0], v[1], 0, block);
- break;
- case DMX_ABSOLUTE_CONFINED:
- dmxCoreMotion(pDev, v[0], v[1], -1, block);
- break;
- }
- }
-}
-
-static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
- KeyCode keyCode)
-{
- KeySym keysym = NoSymbol;
- int effectiveGroup;
- XkbSrvInfoPtr xkbi;
-
- if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key)
- goto out;
-
- xkbi = dmxLocal->pDevice->key->xkbInfo;
- effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, keyCode);
-
- if (effectiveGroup == -1)
- goto out;
-
- keysym = XkbKeySym(xkbi->desc, keyCode, effectiveGroup);
- DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
- keyCode, keysym);
-
-out:
- return keysym;
-}
-
-static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
- int tryFirst)
-{
- /* FIXME: this is quite ineffective, converting to a core map first and
- * then extracting the info from there. It'd be better to run the actual
- * xkb map */
- XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo;
- KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice);
- int i;
-
- /* Optimize for similar maps */
- if (XkbKeycodeInRange(xkbi->desc, tryFirst)
- && pKeySyms->map[(tryFirst - xkbi->desc->min_key_code)
- * pKeySyms->mapWidth] == keySym)
- return tryFirst;
-
- for (i = pKeySyms->minKeyCode; i <= pKeySyms->maxKeyCode; i++) {
- if (pKeySyms->map[(i - pKeySyms->minKeyCode)
- * pKeySyms->mapWidth] == keySym) {
- DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to"
- " keyCode=%d (reverses to core keySym=0x%04x)\n",
- keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard,i));
- return i;
- }
- }
- return 0;
-}
-
-static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
-{
- GETDMXLOCALFROMPDEV;
- int keyCode;
-
- if (!dmxLocal->pDevice->key) {
- dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n",
- dmxLocal->pDevice->name);
- return NoSymbol;
- }
- if (!keySym)
- keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
- if (keySym == NoSymbol)
- return detail;
- keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail);
-
- return keyCode ? keyCode : detail;
-}
-
-/** Enqueue an event from the \a pDev device with the
- * specified \a type and \a detail. If the event is a KeyPress or
- * KeyRelease event, then the \a keySym is also specified.
- *
- * FIXME: make the code do what the comment says, or remove this comment.
- * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
- * blocked around calls to dmxeqEnqueue(). */
-
-void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
- XEvent *e, DMXBlockType block)
-{
- GETDMXINPUTFROMPDEV;
- xEvent xE;
- DeviceIntPtr p = dmxLocal->pDevice;
- int i, nevents, valuators[3];
- EventListPtr events;
-
- DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail);
-
- switch (type) {
- case KeyPress:
- case KeyRelease:
- if (!keySym)
- keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
- if (dmxCheckFunctionKeys(dmxLocal, type, keySym))
- return;
- if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
- xE.u.u.detail = dmxFixup(pDev, detail, keySym);
-
- GetEventList(&events);
- /*ErrorF("KEY %d sym %d\n", detail, (int) keySym);*/
- nevents = GetKeyboardEvents(events, p, type, detail);
- for (i = 0; i < nevents; i++)
- mieqEnqueue(p, (InternalEvent*)(events + i)->event);
- return;
-
- case ButtonPress:
- case ButtonRelease:
- detail = dmxGetButtonMapping(dmxLocal, detail);
- GetEventList(&events);
- nevents = GetPointerEvents(events, p, type, detail,
- POINTER_ABSOLUTE | POINTER_SCREEN,
- 0, /* first_valuator = 0 */
- 0, /* num_valuators = 0 */
- valuators);
- for (i = 0; i < nevents; i++)
- mieqEnqueue(p, (InternalEvent*)(events + i)->event);
- return;
-
- case MotionNotify:
- GetEventList(&events);
- valuators[0] = e->xmotion.x;
- valuators[1] = e->xmotion.y;
- valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
- nevents = GetPointerEvents(events, p, type, detail,
- POINTER_ABSOLUTE | POINTER_SCREEN, 0, 3, valuators);
- for (i = 0; i < nevents; i++)
- mieqEnqueue(p, (InternalEvent*)(events + i)->event);
- return;
-
- case EnterNotify:
- case LeaveNotify:
- case KeymapNotify:
- case MappingNotify: /* This is sent because we change the
- * modifier map on the backend/console
- * input device so that we have complete
- * control of the input device LEDs. */
- return;
- default:
- if (type == ProximityIn || type == ProximityOut) {
- if (dmxLocal->sendsCore)
- return; /* Not a core event */
- break;
- }
- if (type >= LASTEvent) {
- if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block))
- dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type);
- } else {
- dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n",
- type, dmxEventName(type));
- }
- return;
- }
-
-}
-
-/** A pointer to this routine is passed to low-level input drivers so
- * that all special keychecking is unified to this file. This function
- * returns 0 if no special keys have been pressed. If the user has
- * requested termination of the DMX server, -1 is returned. If the user
- * has requested a switch to a VT, then the (1-based) number of that VT
- * is returned. */
-int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
-{
- GETDMXINPUTFROMPDEV;
- int vt = 0;
- unsigned short state = 0;
-
- if (dmxLocal->sendsCore)
- state = XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->state);
- else if (dmxLocal->pDevice->key)
- state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state);
-
- if (!dmxLocal->sendsCore) return 0; /* Only for core devices */
-
- DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym,state);
-
- if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0;
-
- switch (keySym) {
- case XK_F1:
- case XK_F2:
- case XK_F3:
- case XK_F4:
- case XK_F5:
- case XK_F6:
- case XK_F7:
- case XK_F8:
- case XK_F9:
- case XK_F10:
- vt = keySym - XK_F1 + 1;
- break;
-
- case XK_F11:
- case XK_F12:
- vt = keySym - XK_F11 + 11;
- break;
-
- case XK_q: /* To avoid confusion */
- case XK_BackSpace:
- case XK_Delete:
- case XK_KP_Delete:
- dmxLog(dmxInfo, "User request for termination\n");
- dispatchException |= DE_TERMINATE;
- return -1; /* Terminate */
- }
-
- if (vt) {
- dmxLog(dmxInfo, "Request to switch to VT %d\n", vt);
- dmxInput->vt_switch_pending = vt;
- return vt;
- }
-
- return 0; /* Do nothing */
-}
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide support and helper functions for enqueing events received by
+ * the low-level input drivers. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_EVENTS_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxevents.h"
+#include "dmxcb.h"
+#include "dmxcommon.h"
+#include "dmxcursor.h"
+#include "dmxmotion.h"
+#include "dmxsigio.h"
+#include "dmxmap.h"
+
+#include <X11/keysym.h>
+#include "opaque.h"
+#include "inputstr.h"
+#include "inpututils.h"
+#include "mipointer.h"
+#include "mi.h"
+#include "exglobals.h"
+
+#include "xkbsrv.h"
+#include "XIstubs.h"
+
+static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
+static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
+ * should move the mouse anyway. */
+
+#if DMX_EVENTS_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#endif
+
+static int dmxApplyFunctions(DMXInputInfo *dmxInput, DMXFunctionType f)
+{
+ int i;
+ int rc = 0;
+
+ for (i = 0; i < dmxInput->numDevs; i+= dmxInput->devs[i]->binding)
+ if (dmxInput->devs[i]->functions)
+ rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f);
+ return rc;
+}
+
+static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
+ int type,
+ KeySym keySym)
+{
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+
+#if 1 /* hack to detect ctrl-alt-q, etc */
+ static int ctrl = 0, alt = 0;
+ /* keep track of ctrl/alt key status */
+ if (type == KeyPress && keySym == 0xffe3) {
+ ctrl = 1;
+ }
+ else if (type == KeyRelease && keySym == 0xffe3) {
+ ctrl = 0;
+ }
+ else if (type == KeyPress && keySym == 0xffe9) {
+ alt = 1;
+ }
+ else if (type == KeyRelease && keySym == 0xffe9) {
+ alt = 0;
+ }
+ if (!ctrl || !alt)
+ return 0;
+#else
+ unsigned short state = 0;
+
+ if (dmxLocal->sendsCore)
+ state = dmxLocalCoreKeyboard->pDevice->key->state;
+ else if (dmxLocal->pDevice->key)
+ state = dmxLocal->pDevice->key->state;
+
+ DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
+ keySym, type == KeyPress ? "press" : "release", state);
+
+ if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
+ return 0;
+#endif
+
+ switch (keySym) {
+ case XK_g:
+ if (type == KeyPress)
+ dmxApplyFunctions(dmxInput, DMX_FUNCTION_GRAB);
+ return 1;
+ case XK_f:
+ if (type == KeyPress)
+ dmxApplyFunctions(dmxInput, DMX_FUNCTION_FINE);
+ return 1;
+ case XK_q:
+ if (type == KeyPress && dmxLocal->sendsCore)
+ if (dmxApplyFunctions(dmxInput, DMX_FUNCTION_TERMINATE)) {
+ dmxLog(dmxInfo, "User request for termination\n");
+ dispatchException |= DE_TERMINATE;
+ }
+ return 1;
+ }
+
+ return 0;
+}
+
+
+DMXScreenInfo *dmxFindFirstScreen(int x, int y)
+{
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ if (dmxOnScreen(x, y, dmxScreen))
+ return dmxScreen;
+ }
+ return NULL;
+}
+
+
+/**
+ * Enqueue a motion event.
+ */
+static void enqueueMotion(DevicePtr pDev, int x, int y)
+{
+ GETDMXLOCALFROMPDEV;
+ DeviceIntPtr p = dmxLocal->pDevice;
+ int i, nevents, valuators[3];
+ EventListPtr events;
+ int detail = 0; /* XXX should this be mask of pressed buttons? */
+ ValuatorMask mask;
+ valuators[0] = x;
+ valuators[1] = y;
+
+ valuator_mask_set_range(&mask, 0, 2, valuators);
+ GetEventList(&events);
+ nevents = GetPointerEvents(events, p, MotionNotify, detail,
+ POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(p, (InternalEvent*)(events + i)->event);
+ return;
+}
+
+
+void
+dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
+{
+ DMXScreenInfo *dmxScreen;
+ DMXInputInfo *dmxInput;
+ ScreenPtr pScreen;
+ int localX;
+ int localY;
+ int i;
+
+ if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
+ return;
+
+ DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
+ x, y, delta, dmxGlobalX, dmxGlobalY);
+
+ dmxGlobalInvalid = 0;
+ dmxGlobalX = x;
+ dmxGlobalY = y;
+
+ if (dmxGlobalX < 0)
+ dmxGlobalX = 0;
+ if (dmxGlobalY < 0)
+ dmxGlobalY = 0;
+ if (dmxGlobalX >= dmxGlobalWidth)
+ dmxGlobalX = dmxGlobalWidth + delta -1;
+ if (dmxGlobalY >= dmxGlobalHeight)
+ dmxGlobalY = dmxGlobalHeight + delta -1;
+
+ if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
+ localX = dmxGlobalX - dmxScreen->rootXOrigin;
+ localY = dmxGlobalY - dmxScreen->rootYOrigin;
+ if ((pScreen = miPointerGetScreen(inputInfo.pointer))
+ && pScreen->myNum == dmxScreen->index) {
+ /* Screen is old screen */
+ if (block)
+ dmxSigioBlock();
+ if (pDev)
+ enqueueMotion(pDev, localX, localY);
+ if (block)
+ dmxSigioUnblock();
+ } else {
+ /* Screen is new */
+ DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n",
+ pScreen->myNum, dmxScreen->index, localX, localY);
+ if (block)
+ dmxSigioBlock();
+ mieqProcessInputEvents();
+ miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
+ localX, localY);
+ if (pDev)
+ enqueueMotion(pDev, localX, localY);
+ if (block)
+ dmxSigioUnblock();
+ }
+#if 00
+ miPointerGetPosition(inputInfo.pointer, &localX, &localY);
+
+ if ((pScreen = miPointerGetScreen(inputInfo.pointer))) {
+ dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin;
+ dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin;
+ ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY,
+ localX, localY);
+ DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d"
+ " on screen index=%d/%d localX=%d localY=%d\n",
+ dmxGlobalX, dmxGlobalY,
+ dmxScreen ? dmxScreen->index : -1, pScreen->myNum,
+ localX, localY);
+ }
+#endif
+ }
+ /* Send updates down to all core input
+ * drivers */
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
+ int j;
+ for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
+ if (!dmxInput->detached
+ && dmxInput->devs[j]->sendsCore
+ && dmxInput->devs[j]->update_position)
+ dmxInput->devs[j]->update_position(dmxInput->devs[j]->private,
+ dmxGlobalX, dmxGlobalY);
+ }
+ if (!dmxScreen) ProcessInputEvents();
+}
+
+
+
+#define DMX_MAX_AXES 32 /* Max axes reported by this routine */
+static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
+ int *v, int firstAxis, int axesCount,
+ DMXMotionType type, DMXBlockType block)
+{
+ DeviceIntPtr pDevice = dmxLocal->pDevice;
+ xEvent xE[2 * DMX_MAX_AXES/6];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *)xE;
+ deviceValuator *xv = (deviceValuator *)xev+1;
+ int thisX = 0;
+ int thisY = 0;
+ int i;
+ int count;
+ EventListPtr events;
+ int nevents;
+ ValuatorMask mask;
+
+ memset(xE, 0, sizeof(xE));
+
+ if (axesCount > DMX_MAX_AXES) axesCount = DMX_MAX_AXES;
+
+ if ((valuator_get_mode(pDevice,0) == Relative) && axesCount == 2) {
+ /* The dmx console is a relative mode
+ * device that sometimes reports
+ * absolute motion. It only has two
+ * axes. */
+ if (type == DMX_RELATIVE) {
+ thisX = -v[0];
+ thisY = -v[1];
+ dmxLocal->lastX += thisX;
+ dmxLocal->lastY += thisY;
+ if (dmxLocal->update_position)
+ dmxLocal->update_position(dmxLocal->private,
+ dmxLocal->lastX, dmxLocal->lastY);
+ } else { /* Convert to relative */
+ if (dmxLocal->lastX || dmxLocal->lastY) {
+ thisX = v[0] - dmxLocal->lastX;
+ thisY = v[1] - dmxLocal->lastY;
+ }
+ dmxLocal->lastX = v[0];
+ dmxLocal->lastY = v[1];
+ }
+ v[0] = thisX;
+ v[1] = thisY;
+ }
+
+ if (axesCount <= 6) {
+ /* Optimize for the common case when
+ * only 1 or 2 axes change. */
+ xev->time = GetTimeInMillis();
+ xev->type = DeviceMotionNotify;
+ xev->detail = 0;
+ xev->deviceid = pDevice->id | MORE_EVENTS;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = pDevice->id;
+ xv->num_valuators = axesCount;
+ xv->first_valuator = firstAxis;
+ switch (xv->num_valuators) {
+ case 6: xv->valuator5 = v[5];
+ case 5: xv->valuator4 = v[4];
+ case 4: xv->valuator3 = v[3];
+ case 3: xv->valuator2 = v[2];
+ case 2: xv->valuator1 = v[1];
+ case 1: xv->valuator0 = v[0];
+ }
+ count = 2;
+ } else {
+ for (i = 0, count = 0; i < axesCount; i += 6) {
+ xev->time = GetTimeInMillis();
+ xev->type = DeviceMotionNotify;
+ xev->detail = 0;
+ xev->deviceid = pDevice->id | MORE_EVENTS;
+ xev += 2;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = pDevice->id;
+ xv->num_valuators = (i+6 >= axesCount ? axesCount - i : 6);
+ xv->first_valuator = firstAxis + i;
+ switch (xv->num_valuators) {
+ case 6: xv->valuator5 = v[i+5];
+ case 5: xv->valuator4 = v[i+4];
+ case 4: xv->valuator3 = v[i+3];
+ case 3: xv->valuator2 = v[i+2];
+ case 2: xv->valuator1 = v[i+1];
+ case 1: xv->valuator0 = v[i+0];
+ }
+ xv += 2;
+ count += 2;
+ }
+ }
+
+ if (block)
+ dmxSigioBlock();
+ valuator_mask_set_range(&mask, firstAxis, axesCount, v);
+ GetEventList(&events);
+ nevents = GetPointerEvents(events, pDevice, MotionNotify, 0,
+ POINTER_ABSOLUTE, &mask);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
+
+ if (block)
+ dmxSigioUnblock();
+}
+
+static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
+ XEvent *e, DMXBlockType block)
+{
+ int type;
+ int event = -1;
+ XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e;
+ XDeviceMotionEvent *me = (XDeviceMotionEvent *)e;
+ DeviceIntPtr pDevice = dmxLocal->pDevice;
+ int valuators[MAX_VALUATORS];
+ EventListPtr events;
+ int nevents, i;
+ ValuatorMask mask;
+
+ if (!e)
+ return -1; /* No extended event passed, cannot handle */
+
+ if ((XID)dmxLocal->deviceId != ke->deviceid) {
+ /* Search for the correct dmxLocal,
+ * since backend and console events are
+ * picked up for the first device on
+ * that X server. */
+ int i;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ dmxLocal = dmxInput->devs[i];
+ if ((XID)dmxLocal->deviceId == ke->deviceid)
+ break;
+ }
+ }
+
+ if ((XID)dmxLocal->deviceId != ke->deviceid
+ || (type = dmxMapLookup(dmxLocal, e->type)) < 0)
+ return -1; /* No mapping, so this event is unhandled */
+
+ switch (type) {
+ case XI_DeviceValuator: event = DeviceValuator; break;
+ case XI_DeviceKeyPress: event = KeyPress; break;
+ case XI_DeviceKeyRelease: event = KeyRelease; break;
+ case XI_DeviceButtonPress: event = ButtonPress; break;
+ case XI_DeviceButtonRelease: event = ButtonRelease; break;
+ case XI_DeviceMotionNotify: event = MotionNotify; break;
+ case XI_DeviceFocusIn: event = DeviceFocusIn; break;
+ case XI_DeviceFocusOut: event = DeviceFocusOut; break;
+ case XI_ProximityIn: event = ProximityIn; break;
+ case XI_ProximityOut: event = ProximityOut; break;
+ case XI_DeviceStateNotify: event = DeviceStateNotify; break;
+ case XI_DeviceMappingNotify: event = DeviceMappingNotify; break;
+ case XI_ChangeDeviceNotify: event = ChangeDeviceNotify; break;
+ case XI_DeviceKeystateNotify: event = DeviceStateNotify; break;
+ case XI_DeviceButtonstateNotify: event = DeviceStateNotify; break;
+ }
+
+#define EXTRACT_VALUATORS(ke, valuators) \
+ valuators[0] = ke->axis_data[0]; \
+ valuators[1] = ke->axis_data[1]; \
+ valuators[2] = ke->axis_data[2]; \
+ valuators[3] = ke->axis_data[3]; \
+ valuators[4] = ke->axis_data[4]; \
+ valuators[5] = ke->axis_data[5]; \
+
+ switch (type) {
+ case XI_DeviceKeyPress:
+ case XI_DeviceKeyRelease:
+ EXTRACT_VALUATORS(ke, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ if (block)
+ dmxSigioBlock();
+ GetEventList(&events);
+ nevents = GetKeyboardValuatorEvents(events, pDevice, event,
+ ke->keycode, &mask);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
+
+ if (block)
+ dmxSigioUnblock();
+ break;
+ case XI_DeviceButtonPress:
+ case XI_DeviceButtonRelease:
+ EXTRACT_VALUATORS(ke, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ if (block)
+ dmxSigioBlock();
+ GetEventList(&events);
+ nevents = GetPointerEvents(events, pDevice, event, ke->keycode,
+ POINTER_ABSOLUTE, &mask);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
+
+ if (block)
+ dmxSigioUnblock();
+ break;
+ case XI_ProximityIn:
+ case XI_ProximityOut:
+ EXTRACT_VALUATORS(ke, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ if (block)
+ dmxSigioBlock();
+ GetEventList(&events);
+ nevents = GetProximityEvents(events, pDevice, event, &mask);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event);
+
+ if (block)
+ dmxSigioUnblock();
+ break;
+
+ break;
+
+ case XI_DeviceMotionNotify:
+ dmxExtMotion(dmxLocal, me->axis_data, me->first_axis, me->axes_count,
+ DMX_ABSOLUTE, block);
+ break;
+ case XI_DeviceFocusIn:
+ case XI_DeviceFocusOut:
+ case XI_DeviceStateNotify:
+ case XI_DeviceMappingNotify:
+ case XI_ChangeDeviceNotify:
+ case XI_DeviceKeystateNotify:
+ case XI_DeviceButtonstateNotify:
+ /* These are ignored, since DMX will
+ * generate its own events of these
+ * types, as necessary.
+
+ * Perhaps ChangeDeviceNotify should
+ * generate an error, because it is
+ * unexpected? */
+ break;
+ case XI_DeviceValuator:
+ default:
+ dmxLog(dmxWarning,
+ "XInput extension event (remote=%d -> zero-based=%d)"
+ " not supported yet\n", e->type, type);
+ return -1;
+ }
+ return 0;
+}
+
+static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
+{
+ ButtonClassPtr b = dmxLocal->pDevice->button;
+
+ if (button > b->numButtons) { /* This shouldn't happen. */
+ dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n",
+ button, b->numButtons);
+ return button;
+ }
+ return b->map[button];
+}
+
+/** Return DMX's notion of the pointer position in the global coordinate
+ * space. */
+void dmxGetGlobalPosition(int *x, int *y)
+{
+ *x = dmxGlobalX;
+ *y = dmxGlobalY;
+}
+
+/** Invalidate the global position for #dmxCoreMotion. */
+void dmxInvalidateGlobalPosition(void)
+{
+ dmxGlobalInvalid = 1;
+}
+
+/** Enqueue a motion event for \a pDev. The \a v vector has length \a
+ * axesCount, and contains values for each of the axes, starting at \a
+ * firstAxes.
+ *
+ * The \a type of the motion may be \a DMX_RELATIVE, \a DMX_ABSOLUTE, or
+ * \a DMX_ABSOLUTE_CONFINED (in the latter case, the pointer will not be
+ * allowed to move outside the global boundaires).
+ *
+ * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
+ * blocked around calls to \a enqueueMotion(). */
+void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
+ DMXMotionType type, DMXBlockType block)
+{
+ GETDMXLOCALFROMPDEV;
+
+ if (!dmxLocal->sendsCore) {
+ dmxExtMotion(dmxLocal, v, firstAxes, axesCount, type, block);
+ return;
+ }
+ if (axesCount == 2) {
+ switch (type) {
+ case DMX_RELATIVE:
+ dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block);
+ break;
+ case DMX_ABSOLUTE:
+ dmxCoreMotion(pDev, v[0], v[1], 0, block);
+ break;
+ case DMX_ABSOLUTE_CONFINED:
+ dmxCoreMotion(pDev, v[0], v[1], -1, block);
+ break;
+ }
+ }
+}
+
+static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
+ KeyCode keyCode)
+{
+ KeySym keysym = NoSymbol;
+ int effectiveGroup;
+ XkbSrvInfoPtr xkbi;
+
+ if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key)
+ goto out;
+
+ xkbi = dmxLocal->pDevice->key->xkbInfo;
+ effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, keyCode);
+
+ if (effectiveGroup == -1)
+ goto out;
+
+ keysym = XkbKeySym(xkbi->desc, keyCode, effectiveGroup);
+ DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
+ keyCode, keysym);
+
+out:
+ return keysym;
+}
+
+static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
+ int tryFirst)
+{
+ /* FIXME: this is quite ineffective, converting to a core map first and
+ * then extracting the info from there. It'd be better to run the actual
+ * xkb map */
+ XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo;
+ KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice);
+ int i;
+
+ /* Optimize for similar maps */
+ if (XkbKeycodeInRange(xkbi->desc, tryFirst)
+ && pKeySyms->map[(tryFirst - xkbi->desc->min_key_code)
+ * pKeySyms->mapWidth] == keySym)
+ return tryFirst;
+
+ for (i = pKeySyms->minKeyCode; i <= pKeySyms->maxKeyCode; i++) {
+ if (pKeySyms->map[(i - pKeySyms->minKeyCode)
+ * pKeySyms->mapWidth] == keySym) {
+ DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to"
+ " keyCode=%d (reverses to core keySym=0x%04x)\n",
+ keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard,i));
+ return i;
+ }
+ }
+ return 0;
+}
+
+static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
+{
+ GETDMXLOCALFROMPDEV;
+ int keyCode;
+
+ if (!dmxLocal->pDevice->key) {
+ dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n",
+ dmxLocal->pDevice->name);
+ return NoSymbol;
+ }
+ if (!keySym)
+ keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
+ if (keySym == NoSymbol)
+ return detail;
+ keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail);
+
+ return keyCode ? keyCode : detail;
+}
+
+/** Enqueue an event from the \a pDev device with the
+ * specified \a type and \a detail. If the event is a KeyPress or
+ * KeyRelease event, then the \a keySym is also specified.
+ *
+ * FIXME: make the code do what the comment says, or remove this comment.
+ * If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
+ * blocked around calls to dmxeqEnqueue(). */
+
+void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
+ XEvent *e, DMXBlockType block)
+{
+ GETDMXINPUTFROMPDEV;
+ xEvent xE;
+ DeviceIntPtr p = dmxLocal->pDevice;
+ int i, nevents, valuators[3];
+ EventListPtr events;
+ ValuatorMask mask;
+
+ DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail);
+
+ switch (type) {
+ case KeyPress:
+ case KeyRelease:
+ if (!keySym)
+ keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
+ if (dmxCheckFunctionKeys(dmxLocal, type, keySym))
+ return;
+ if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
+ xE.u.u.detail = dmxFixup(pDev, detail, keySym);
+
+ GetEventList(&events);
+ /*ErrorF("KEY %d sym %d\n", detail, (int) keySym);*/
+ nevents = GetKeyboardEvents(events, p, type, detail);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(p, (InternalEvent*)(events + i)->event);
+ return;
+
+ case ButtonPress:
+ case ButtonRelease:
+ detail = dmxGetButtonMapping(dmxLocal, detail);
+ valuator_mask_zero(&mask);
+ GetEventList(&events);
+ nevents = GetPointerEvents(events, p, type, detail,
+ POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(p, (InternalEvent*)(events + i)->event);
+ return;
+
+ case MotionNotify:
+ GetEventList(&events);
+ valuators[0] = e->xmotion.x;
+ valuators[1] = e->xmotion.y;
+ valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
+ valuator_mask_set_range(&mask, 0, 3, valuators);
+ nevents = GetPointerEvents(events, p, type, detail,
+ POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(p, (InternalEvent*)(events + i)->event);
+ return;
+
+ case EnterNotify:
+ case LeaveNotify:
+ case KeymapNotify:
+ case MappingNotify: /* This is sent because we change the
+ * modifier map on the backend/console
+ * input device so that we have complete
+ * control of the input device LEDs. */
+ return;
+ default:
+ if (type == ProximityIn || type == ProximityOut) {
+ if (dmxLocal->sendsCore)
+ return; /* Not a core event */
+ break;
+ }
+ if (type >= LASTEvent) {
+ if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block))
+ dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type);
+ } else {
+ dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n",
+ type, dmxEventName(type));
+ }
+ return;
+ }
+
+}
+
+/** A pointer to this routine is passed to low-level input drivers so
+ * that all special keychecking is unified to this file. This function
+ * returns 0 if no special keys have been pressed. If the user has
+ * requested termination of the DMX server, -1 is returned. If the user
+ * has requested a switch to a VT, then the (1-based) number of that VT
+ * is returned. */
+int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
+{
+ GETDMXINPUTFROMPDEV;
+ int vt = 0;
+ unsigned short state = 0;
+
+ if (dmxLocal->sendsCore)
+ state = XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->state);
+ else if (dmxLocal->pDevice->key)
+ state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state);
+
+ if (!dmxLocal->sendsCore) return 0; /* Only for core devices */
+
+ DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym,state);
+
+ if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0;
+
+ switch (keySym) {
+ case XK_F1:
+ case XK_F2:
+ case XK_F3:
+ case XK_F4:
+ case XK_F5:
+ case XK_F6:
+ case XK_F7:
+ case XK_F8:
+ case XK_F9:
+ case XK_F10:
+ vt = keySym - XK_F1 + 1;
+ break;
+
+ case XK_F11:
+ case XK_F12:
+ vt = keySym - XK_F11 + 11;
+ break;
+
+ case XK_q: /* To avoid confusion */
+ case XK_BackSpace:
+ case XK_Delete:
+ case XK_KP_Delete:
+ dmxLog(dmxInfo, "User request for termination\n");
+ dispatchException |= DE_TERMINATE;
+ return -1; /* Terminate */
+ }
+
+ if (vt) {
+ dmxLog(dmxInfo, "Request to switch to VT %d\n", vt);
+ dmxInput->vt_switch_pending = vt;
+ return vt;
+ }
+
+ return 0; /* Do nothing */
+}
diff --git a/xorg-server/hw/dmx/input/dmxinputinit.c b/xorg-server/hw/dmx/input/dmxinputinit.c
index 0ea3e0953..4b10ecb17 100644
--- a/xorg-server/hw/dmx/input/dmxinputinit.c
+++ b/xorg-server/hw/dmx/input/dmxinputinit.c
@@ -476,7 +476,8 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
InitValuatorAxisStruct(pDevice, i, axis_labels[i],
info.minval[i], info.maxval[i],
info.res[i],
- info.minres[i], info.maxres[i]);
+ info.minres[i], info.maxres[i],
+ Relative);
} else if (info.numRelAxes) {
InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
axis_labels,
@@ -486,7 +487,8 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
InitValuatorAxisStruct(pDevice, i, axis_labels[i],
info.minval[i],
info.maxval[i], info.res[i],
- info.minres[i], info.maxres[i]);
+ info.minres[i], info.maxres[i],
+ Relative);
} else if (info.numAbsAxes) {
InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes,
axis_labels,
@@ -497,7 +499,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
axis_labels[i],
info.minval[i], info.maxval[i],
info.res[i], info.minres[i],
- info.maxres[i]);
+ info.maxres[i], Absolute);
}
}
if (info.focusClass) InitFocusClassDeviceStruct(pDevice);
@@ -693,7 +695,6 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
DeviceIntPtr pDevice;
Atom atom;
const char *name = NULL;
- void (*registerProcPtr)(DeviceIntPtr) = NULL;
char *devname;
DMXInputInfo *dmxInput;
@@ -706,22 +707,19 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
dmxLocal->isCore = 1;
dmxLocalCoreKeyboard = dmxLocal;
name = "keyboard";
- registerProcPtr = RegisterKeyboardDevice;
}
if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) {
dmxLocal->isCore = 1;
dmxLocalCorePointer = dmxLocal;
name = "pointer";
- registerProcPtr = RegisterPointerDevice;
}
}
if (!name) {
name = "extension";
- registerProcPtr = RegisterOtherDevice;
}
- if (!name || !registerProcPtr)
+ if (!name)
dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name);
pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE);
@@ -738,8 +736,6 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
pDevice->type = atom;
pDevice->name = devname;
- registerProcPtr(pDevice);
-
if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) {
#if 00 /*BP*/
miRegisterPointerDevice(screenInfo.screens[0], pDevice);
diff --git a/xorg-server/hw/dmx/input/dmxmotion.c b/xorg-server/hw/dmx/input/dmxmotion.c
index d1c79f126..7a4b8a0dc 100644
--- a/xorg-server/hw/dmx/input/dmxmotion.c
+++ b/xorg-server/hw/dmx/input/dmxmotion.c
@@ -125,12 +125,11 @@ void dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
/* Initialize the data from the known
* values (if Absolute) or to zero (if
* Relative) */
- if (pDevice->valuator->mode == Absolute) {
- for (i = 0; i < numAxes; i++)
+ for (i = 0; i < numAxes; i++) {
+ if (pDevice->valuator->axes[i].mode == Absolute)
dmxLocal->history[OFFSET(dmxLocal->tail,i+1)]
= dmxLocal->valuators[i];
- } else {
- for (i = 0; i < numAxes; i++)
+ else
dmxLocal->history[OFFSET(dmxLocal->tail,i+1)] = 0;
}
diff --git a/xorg-server/hw/dmx/input/dmxxinput.c b/xorg-server/hw/dmx/input/dmxxinput.c
index 3d5f32775..b28a80d4d 100644
--- a/xorg-server/hw/dmx/input/dmxxinput.c
+++ b/xorg-server/hw/dmx/input/dmxxinput.c
@@ -51,23 +51,6 @@
#include "dmxinputinit.h"
#include "exevents.h"
-/** Close the input device. This is not required by the XINPUT model
- * that DMX uses. */
-void CloseInputDevice (DeviceIntPtr d, ClientPtr client)
-{
-}
-
-/** This is not required by the XINPUT model that DMX uses. */
-void AddOtherInputDevices(void)
-{
-}
-
-/** Open an input device. This is not required by the XINPUT model that
- * DMX uses. */
-void OpenInputDevice (DeviceIntPtr dev, ClientPtr client, int *status)
-{
-}
-
/** Set device mode to \a mode. This is not implemented. */
int SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
{
diff --git a/xorg-server/hw/kdrive/fake/fake.c b/xorg-server/hw/kdrive/fake/fake.c
index 626b2d25a..21360b16d 100644
--- a/xorg-server/hw/kdrive/fake/fake.c
+++ b/xorg-server/hw/kdrive/fake/fake.c
@@ -215,11 +215,8 @@ fakeUnmapFramebuffer (KdScreenInfo *screen)
{
FakePriv *priv = screen->card->driver;
KdShadowFbFree (screen);
- if (priv->base)
- {
- free (priv->base);
- priv->base = 0;
- }
+ free(priv->base);
+ priv->base = NULL;
return TRUE;
}
diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c
index 0cadbd981..0485dc413 100644
--- a/xorg-server/hw/kdrive/src/kinput.c
+++ b/xorg-server/hw/kdrive/src/kinput.c
@@ -48,6 +48,7 @@
#include "exglobals.h"
#include "eventstr.h"
#include "xserver-properties.h"
+#include "inpututils.h"
#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
@@ -943,10 +944,6 @@ KdAddKeyboard (KdKeyboardInfo *ki)
return !Success;
}
- ki->dixdev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
- ki->dixdev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
- RegisterOtherDevice(ki->dixdev);
-
#ifdef DEBUG
ErrorF("added keyboard %s with dix id %d\n", ki->name, ki->dixdev->id);
#endif
@@ -1014,10 +1011,6 @@ KdAddPointer (KdPointerInfo *pi)
return BadDevice;
}
- pi->dixdev->deviceGrab.ActivateGrab = ActivatePointerGrab;
- pi->dixdev->deviceGrab.DeactivateGrab = DeactivatePointerGrab;
- RegisterOtherDevice(pi->dixdev);
-
for (prev = &kdPointers; *prev; prev = &(*prev)->next);
*prev = pi;
@@ -1975,14 +1968,16 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
{
int nEvents = 0, i = 0;
int valuators[3] = { x, y, z };
+ ValuatorMask mask;
/* TRUE from KdHandlePointerEvent, means 'we swallowed the event'. */
if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel))
return;
+ valuator_mask_set_range(&mask, 0, 3, valuators);
+
GetEventList(&kdEvents);
- nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel,
- 0, 3, valuators);
+ nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, &mask);
for (i = 0; i < nEvents; i++)
KdQueueEvent(pi->dixdev, (InternalEvent *)((kdEvents + i)->event));
}
@@ -2184,30 +2179,6 @@ ProcessInputEvents (void)
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)
diff --git a/xorg-server/hw/vfb/InitInput.c b/xorg-server/hw/vfb/InitInput.c
index 64040c865..aba1a95fb 100644
--- a/xorg-server/hw/vfb/InitInput.c
+++ b/xorg-server/hw/vfb/InitInput.c
@@ -138,10 +138,8 @@ InitInput(int argc, char *argv[])
Atom xiclass;
p = AddInputDevice(serverClient, vfbMouseProc, TRUE);
k = AddInputDevice(serverClient, vfbKeybdProc, TRUE);
- RegisterPointerDevice(p);
xiclass = MakeAtom(XI_MOUSE, sizeof(XI_MOUSE) - 1, TRUE);
AssignTypeAndName(p, xiclass, "Xvfb mouse");
- RegisterKeyboardDevice(k);
xiclass = MakeAtom(XI_KEYBOARD, sizeof(XI_KEYBOARD) - 1, TRUE);
AssignTypeAndName(k, xiclass, "Xvfb keyboard");
(void)mieqInit();
diff --git a/xorg-server/hw/xfree86/common/Makefile.am b/xorg-server/hw/xfree86/common/Makefile.am
index 821a2b500..c4067aa62 100644
--- a/xorg-server/hw/xfree86/common/Makefile.am
+++ b/xorg-server/hw/xfree86/common/Makefile.am
@@ -1,95 +1,93 @@
-noinst_LTLIBRARIES = libcommon.la
-
-if XORG_BUS_SPARC
-SBUS_SOURCES = xf86sbusBus.c
-endif
-
-if XV
-XVSOURCES = xf86xv.c xf86xvmc.c
-XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h
-endif
-
-if XF86VIDMODE
-XF86VMODE_SDK = vidmodeproc.h
-endif
-
-if DGA
-DGASOURCES = xf86DGA.c
-endif
-
-XISOURCES = xf86Xinput.c xisb.c
-XISDKINCS = xf86Xinput.h xisb.h
-RANDRSOURCES = xf86RandR.c
-
-BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
-
-MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
-
-xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
- cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
- echo >> $@
-
-BUILT_SOURCES = xf86DefModeSet.c
-
-AM_LDFLAGS = -r
-libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
- xf86Cursor.c $(DGASOURCES) xf86DPMS.c \
- xf86Events.c xf86Globals.c xf86AutoConfig.c \
- xf86Option.c xf86Init.c xf86VGAarbiter.c \
- xf86VidMode.c xf86fbman.c xf86cmap.c \
- xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
- xf86Mode.c xorgHelper.c \
- $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
-nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h
-libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la
-
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
- -I$(srcdir)/../loader -I$(srcdir)/../parser \
- -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
- -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \
- -I$(srcdir)/../modes -I$(srcdir)/../ramdac
-
-sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
- xf86PciInfo.h xf86Priv.h xf86Privstr.h \
- xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
- $(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
- xf86sbusBus.h xf86VGAarbiter.h
-
-DISTCLEANFILES = xf86Build.h
-CLEANFILES = $(BUILT_SOURCES)
-
-EXTRA_DIST = \
- compiler.h \
- fourcc.h \
- scoasm.h \
- vidmodeproc.h \
- xf86.h \
- xf86Bus.h \
- xf86Config.h \
- xf86InPriv.h \
- xf86Module.h \
- xf86Opt.h \
- xf86PciInfo.h \
- xf86Priv.h \
- xf86Privstr.h \
- xf86Xinput.h \
- xf86cmap.h \
- xf86fbman.h \
- xf86pciBus.h \
- xf86str.h \
- xf86xv.h \
- xf86xvmc.h \
- xf86xvpriv.h \
- xisb.h \
- xorgVersion.h \
- $(MODEDEFSOURCES) \
- modeline2c.awk \
- xf86VGAarbiter.h \
- xf86VGAarbiterPriv.h \
- $(DISTKBDSOURCES)
-
-if LNXACPI
-XORG_CFLAGS += -DHAVE_ACPI
-endif
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+noinst_LTLIBRARIES = libcommon.la
+
+if XORG_BUS_SPARC
+SBUS_SOURCES = xf86sbusBus.c
+endif
+
+if XV
+XVSOURCES = xf86xv.c xf86xvmc.c
+XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h
+endif
+
+if XF86VIDMODE
+XF86VMODE_SDK = vidmodeproc.h
+endif
+
+if DGA
+DGASOURCES = xf86DGA.c
+endif
+
+RANDRSOURCES = xf86RandR.c
+
+BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
+
+MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
+
+xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
+ cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
+ echo >> $@
+
+BUILT_SOURCES = xf86DefModeSet.c
+
+AM_LDFLAGS = -r
+libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
+ xf86Cursor.c $(DGASOURCES) xf86DPMS.c \
+ xf86Events.c xf86Globals.c xf86AutoConfig.c \
+ xf86Option.c xf86Init.c xf86VGAarbiter.c \
+ xf86VidMode.c xf86fbman.c xf86cmap.c \
+ xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
+ xf86Mode.c xorgHelper.c \
+ $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
+nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h
+libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+ -I$(srcdir)/../loader -I$(srcdir)/../parser \
+ -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
+ -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \
+ -I$(srcdir)/../modes -I$(srcdir)/../ramdac
+
+sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
+ xf86PciInfo.h xf86Priv.h xf86Privstr.h \
+ xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
+ $(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
+ xf86sbusBus.h xf86VGAarbiter.h
+
+DISTCLEANFILES = xf86Build.h
+CLEANFILES = $(BUILT_SOURCES)
+
+EXTRA_DIST = \
+ compiler.h \
+ fourcc.h \
+ scoasm.h \
+ vidmodeproc.h \
+ xf86.h \
+ xf86Bus.h \
+ xf86Config.h \
+ xf86InPriv.h \
+ xf86Module.h \
+ xf86Opt.h \
+ xf86PciInfo.h \
+ xf86Priv.h \
+ xf86Privstr.h \
+ xf86Xinput.h \
+ xf86cmap.h \
+ xf86fbman.h \
+ xf86pciBus.h \
+ xf86str.h \
+ xf86xv.h \
+ xf86xvmc.h \
+ xf86xvpriv.h \
+ xisb.h \
+ xorgVersion.h \
+ $(MODEDEFSOURCES) \
+ modeline2c.awk \
+ xf86VGAarbiter.h \
+ xf86VGAarbiterPriv.h \
+ $(DISTKBDSOURCES)
+
+if LNXACPI
+XORG_CFLAGS += -DHAVE_ACPI
+endif
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
index b21bcdf47..68653395b 100644
--- a/xorg-server/hw/xfree86/common/xf86.h
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -203,6 +203,7 @@ extern _X_EXPORT pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, po
extern _X_EXPORT int xf86RemoveGeneralHandler(pointer handler);
extern _X_EXPORT void xf86DisableGeneralHandler(pointer handler);
extern _X_EXPORT void xf86EnableGeneralHandler(pointer handler);
+extern _X_EXPORT InputHandlerProc xf86SetConsoleHandler(InputHandlerProc handler, pointer data);
extern _X_EXPORT void xf86InterceptSignals(int *signo);
extern _X_EXPORT void xf86InterceptSigIll(void (*sigillhandler)(void));
extern _X_EXPORT Bool xf86EnableVTSwitch(Bool new);
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index faeda92ee..7d930f0fe 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -63,7 +63,6 @@
#include "xf86pciBus.h"
#include "xf86Xinput.h"
-extern DeviceAssocRec mouse_assoc;
#include "xkbsrv.h"
@@ -136,7 +135,7 @@ static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen,
static Bool configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor);
static Bool configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device,
Bool active);
-static Bool configInput(IDevPtr inputp, XF86ConfInputPtr conf_input,
+static Bool configInput(InputInfoPtr pInfo, XF86ConfInputPtr conf_input,
MessageType from);
static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
static Bool addDefaultModes(MonPtr monitorp);
@@ -445,8 +444,8 @@ xf86InputDriverlistFromConfig(void)
{
int count = 0;
char **modulearray;
- IDevPtr* idp;
-
+ InputInfoPtr *idp;
+
/*
* make sure the config file has been parsed and that we have a
* ModulePath set; if no ModulePath was given, use the default
@@ -504,7 +503,6 @@ fixup_video_driver_list(char **drivers)
static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL };
char **end, **drv;
char *x;
- char **ati, **atimisc;
int i;
/* walk to the end of the list */
@@ -743,8 +741,6 @@ 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 },
{ FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
@@ -955,13 +951,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
#endif
- /* AllowEmptyInput is automatically true if we're hotplugging */
- xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
- xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
+ /* if we're not hotplugging, force some input devices to exist */
+ xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
- /* AEI on? Then we're not using kbd, so use the evdev rules set. */
+ /* when forcing input devices, we use kbd. otherwise evdev, so use the
+ * evdev rules set. */
#if defined(linux)
- if (xf86Info.allowEmptyInput)
+ if (!xf86Info.forceInputDevices)
set.rules = "evdev";
#endif
XkbSetRulesDflts(&set);
@@ -1093,12 +1089,12 @@ Bool xf86DRI2Enabled(void)
static Bool
checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
{
- IDevPtr corePointer = NULL, coreKeyboard = NULL;
+ InputInfoPtr corePointer = NULL, coreKeyboard = NULL;
Bool foundPointer = FALSE, foundKeyboard = FALSE;
const char *pointerMsg = NULL, *keyboardMsg = NULL;
- IDevPtr *devs, /* iterator */
+ InputInfoPtr *devs, /* iterator */
indp;
- IDevRec Pointer, Keyboard;
+ InputInfoRec Pointer, Keyboard;
XF86ConfInputPtr confInput;
XF86ConfInputRec defPtr, defKbd;
int count = 0;
@@ -1113,49 +1109,27 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* remove the core attribute from the later ones.
*/
for (devs = servlayoutp->inputs; devs && *devs; devs++) {
- pointer opt1 = NULL, opt2 = NULL;
indp = *devs;
- if (indp->commonOptions &&
- xf86CheckBoolOption(indp->commonOptions, "CorePointer", FALSE)) {
- opt1 = indp->commonOptions;
- }
- if (indp->extraOptions &&
- xf86CheckBoolOption(indp->extraOptions, "CorePointer", FALSE)) {
- opt2 = indp->extraOptions;
- }
- if (opt1 || opt2) {
+ if (indp->options &&
+ xf86CheckBoolOption(indp->options, "CorePointer", FALSE)) {
if (!corePointer) {
corePointer = indp;
} else {
- if (opt1)
- xf86ReplaceBoolOption(opt1, "CorePointer", FALSE);
- if (opt2)
- xf86ReplaceBoolOption(opt2, "CorePointer", FALSE);
+ xf86ReplaceBoolOption(indp->options, "CorePointer", FALSE);
xf86Msg(X_WARNING, "Duplicate core pointer devices. "
"Removing core pointer attribute from \"%s\"\n",
- indp->identifier);
+ indp->name);
}
}
- opt1 = opt2 = NULL;
- if (indp->commonOptions &&
- xf86CheckBoolOption(indp->commonOptions, "CoreKeyboard", FALSE)) {
- opt1 = indp->commonOptions;
- }
- if (indp->extraOptions &&
- xf86CheckBoolOption(indp->extraOptions, "CoreKeyboard", FALSE)) {
- opt2 = indp->extraOptions;
- }
- if (opt1 || opt2) {
+ if (indp->options &&
+ xf86CheckBoolOption(indp->options, "CoreKeyboard", FALSE)) {
if (!coreKeyboard) {
coreKeyboard = indp;
} else {
- if (opt1)
- xf86ReplaceBoolOption(opt1, "CoreKeyboard", FALSE);
- if (opt2)
- xf86ReplaceBoolOption(opt2, "CoreKeyboard", FALSE);
+ xf86ReplaceBoolOption(indp->options, "CoreKeyboard", FALSE);
xf86Msg(X_WARNING, "Duplicate core keyboard devices. "
"Removing core keyboard attribute from \"%s\"\n",
- indp->identifier);
+ indp->name);
}
}
count++;
@@ -1182,7 +1156,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (*devs == corePointer)
{
free(*devs);
- *devs = (IDevPtr)0x1; /* ensure we dont skip next loop*/
+ *devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop*/
break;
}
for (; devs && *devs; devs++)
@@ -1200,7 +1174,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 3. First core pointer device. */
- if (!foundPointer && (!xf86Info.allowEmptyInput || implicitLayout)) {
+ if (!foundPointer && (xf86Info.forceInputDevices || implicitLayout)) {
XF86ConfInputPtr p;
for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
@@ -1216,7 +1190,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 4. First pointer with an allowed mouse driver. */
- if (!foundPointer && !xf86Info.allowEmptyInput) {
+ if (!foundPointer && xf86Info.forceInputDevices) {
const char **driver = mousedrivers;
confInput = xf86findInput(CONF_IMPLICIT_POINTER,
xf86configptr->conf_input_lst);
@@ -1233,7 +1207,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 5. Built-in default. */
- if (!foundPointer && !xf86Info.allowEmptyInput) {
+ if (!foundPointer && xf86Info.forceInputDevices) {
memset(&defPtr, 0, sizeof(defPtr));
defPtr.inp_identifier = strdup("<default pointer>");
defPtr.inp_driver = strdup("mouse");
@@ -1249,17 +1223,17 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundPointer) {
count++;
devs = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(IDevPtr));
- devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ (count + 1) * sizeof(InputInfoPtr));
+ devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
*devs[count - 1] = Pointer;
- devs[count - 1]->extraOptions =
+ devs[count - 1]->options =
xf86addNewOption(NULL, xnfstrdup("CorePointer"), NULL);
devs[count] = NULL;
servlayoutp->inputs = devs;
}
}
- if (!foundPointer && !xf86Info.allowEmptyInput) {
+ if (!foundPointer && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
return FALSE;
@@ -1283,7 +1257,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
driver++;
}
}
- if (!found && !xf86Info.allowEmptyInput) {
+ if (!found && xf86Info.forceInputDevices) {
xf86Msg(X_INFO, "No default mouse found, adding one\n");
memset(&defPtr, 0, sizeof(defPtr));
defPtr.inp_identifier = strdup("<default pointer>");
@@ -1293,10 +1267,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundPointer) {
count++;
devs = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(IDevPtr));
- devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ (count + 1) * sizeof(InputInfoPtr));
+ devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
*devs[count - 1] = Pointer;
- devs[count - 1]->extraOptions =
+ devs[count - 1]->options =
xf86addNewOption(NULL, xnfstrdup("AlwaysCore"), NULL);
devs[count] = NULL;
servlayoutp->inputs = devs;
@@ -1324,7 +1298,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (*devs == coreKeyboard)
{
free(*devs);
- *devs = (IDevPtr)0x1; /* ensure we dont skip next loop */
+ *devs = (InputInfoPtr)0x1; /* ensure we dont skip next loop */
break;
}
for (; devs && *devs; devs++)
@@ -1342,7 +1316,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 3. First core keyboard device. */
- if (!foundKeyboard && (!xf86Info.allowEmptyInput || implicitLayout)) {
+ if (!foundKeyboard && (xf86Info.forceInputDevices || implicitLayout)) {
XF86ConfInputPtr p;
for (p = xf86configptr->conf_input_lst; p; p = p->list.next) {
@@ -1358,7 +1332,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */
- if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ if (!foundKeyboard && xf86Info.forceInputDevices) {
confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
xf86configptr->conf_input_lst);
if (!confInput) {
@@ -1373,7 +1347,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
/* 5. Built-in default. */
- if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ if (!foundKeyboard && xf86Info.forceInputDevices) {
memset(&defKbd, 0, sizeof(defKbd));
defKbd.inp_identifier = strdup("<default keyboard>");
defKbd.inp_driver = strdup("kbd");
@@ -1389,17 +1363,17 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundKeyboard) {
count++;
devs = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(IDevPtr));
- devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ (count + 1) * sizeof(InputInfoPtr));
+ devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
*devs[count - 1] = Keyboard;
- devs[count - 1]->extraOptions =
+ devs[count - 1]->options =
xf86addNewOption(NULL, xnfstrdup("CoreKeyboard"), NULL);
devs[count] = NULL;
servlayoutp->inputs = devs;
}
}
- if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ if (!foundKeyboard && xf86Info.forceInputDevices) {
/* This shouldn't happen. */
xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
return FALSE;
@@ -1425,7 +1399,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
"\tUsing the %s.\n", keyboardMsg);
}
- if (xf86Info.allowEmptyInput && !(foundPointer && foundKeyboard)) {
+ if (!xf86Info.forceInputDevices && !(foundPointer && foundKeyboard)) {
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV)
const char *config_backend;
#if defined(CONFIG_HAL)
@@ -1438,8 +1412,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
"reconfigure %s or disable AutoAddDevices.\n",
config_backend, config_backend);
#else
- xf86Msg(X_INFO, "Hotplugging is disabled and no input devices were configured.\n"
- "\tTry disabling AllowEmptyInput.\n");
+ xf86Msg(X_WARNING, "Hotplugging requested but the server was "
+ "compiled without a config backend. "
+ "No input devices were configured, the server "
+ "will start without any input devices.\n");
#endif
}
@@ -1464,7 +1440,7 @@ static Bool
configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
{
XF86ConfInputrefPtr irp;
- IDevPtr *indp;
+ InputInfoPtr *indp;
int count = 0;
/*
@@ -1477,19 +1453,19 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
}
DebugF("Found %d input devices in the layout section %s\n",
count, layout->lay_identifier);
- indp = xnfcalloc((count + 1), sizeof(IDevPtr));
+ indp = xnfcalloc((count + 1), sizeof(InputInfoPtr));
indp[count] = NULL;
irp = layout->lay_input_lst;
count = 0;
while (irp) {
- indp[count] = xnfalloc(sizeof(IDevRec));
+ indp[count] = xnfalloc(sizeof(InputInfoRec));
if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
while(count--)
free(indp[count]);
free(indp);
return FALSE;
}
- indp[count]->extraOptions = irp->iref_option_lst;
+ indp[count]->options = irp->iref_option_lst;
count++;
irp = (XF86ConfInputrefPtr)irp->list.next;
}
@@ -1712,7 +1688,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
MessageType from;
XF86ConfScreenPtr s;
screenLayoutPtr slp;
- IDevPtr *indp;
+ InputInfoPtr *indp;
XF86ConfLayoutRec layout;
if (!servlayoutp)
@@ -1758,7 +1734,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen,
from = X_DEFAULT;
} else {
/* Set up an empty input device list, then look for some core devices. */
- indp = xnfalloc(sizeof(IDevPtr));
+ indp = xnfalloc(sizeof(InputInfoPtr));
*indp = NULL;
servlayoutp->inputs = indp;
}
@@ -2211,7 +2187,6 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
static void
configDRI(XF86ConfDRIPtr drip)
{
- int i;
struct group *grp;
xf86ConfigDRI.group = -1;
@@ -2283,13 +2258,12 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
}
static Bool
-configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
+configInput(InputInfoPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
{
xf86Msg(from, "|-->Input Device \"%s\"\n", conf_input->inp_identifier);
- inputp->identifier = conf_input->inp_identifier;
+ inputp->name = conf_input->inp_identifier;
inputp->driver = conf_input->inp_driver;
- inputp->commonOptions = conf_input->inp_option_lst;
- inputp->extraOptions = NULL;
+ inputp->options = conf_input->inp_option_lst;
inputp->attrs = NULL;
return TRUE;
@@ -2338,12 +2312,13 @@ static void
checkInput(serverLayoutPtr layout, Bool implicit_layout) {
checkCoreInputDevices(layout, implicit_layout);
- /* AllowEmptyInput and the "kbd" and "mouse" drivers are mutually
- * exclusive. Trawl the list for mouse/kbd devices and disable them.
+ /* Unless we're forcing input devices, disable mouse/kbd devices in the
+ * config. Otherwise the same physical device is added multiple times,
+ * leading to duplicate events.
*/
- if (xf86Info.allowEmptyInput && layout->inputs)
+ if (!xf86Info.forceInputDevices && layout->inputs)
{
- IDevPtr *dev = layout->inputs;
+ InputInfoPtr *dev = layout->inputs;
BOOL warned = FALSE;
while(*dev)
@@ -2352,15 +2327,15 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
strcmp((*dev)->driver, "mouse") == 0 ||
strcmp((*dev)->driver, "vmmouse") == 0)
{
- IDevPtr *current;
+ InputInfoPtr *current;
if (!warned)
{
- xf86Msg(X_WARNING, "AllowEmptyInput is on, devices using "
+ xf86Msg(X_WARNING, "Hotplugging is on, devices using "
"drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.\n");
warned = TRUE;
}
- xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->identifier);
+ xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->name);
current = dev;
free(*dev);
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index 87555f31f..004807483 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -600,6 +600,26 @@ xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
return ih;
}
+/**
+ * Set the handler for the console's fd. Replaces (and returns) the previous
+ * handler or NULL, whichever appropriate.
+ * proc may be NULL if the server should not handle events on the console.
+ */
+InputHandlerProc
+xf86SetConsoleHandler(InputHandlerProc proc, pointer data)
+{
+ static InputHandlerProc handler = NULL;
+ InputHandlerProc old_handler = handler;
+
+ if (old_handler)
+ xf86RemoveGeneralHandler(old_handler);
+
+ xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
+ handler = proc;
+
+ return old_handler;
+}
+
static void
removeInputHandler(IHPtr ih)
{
diff --git a/xorg-server/hw/xfree86/common/xf86Globals.c b/xorg-server/hw/xfree86/common/xf86Globals.c
index c8534132a..0b0931408 100644
--- a/xorg-server/hw/xfree86/common/xf86Globals.c
+++ b/xorg-server/hw/xfree86/common/xf86Globals.c
@@ -125,15 +125,14 @@ xf86InfoRec xf86Info = {
#endif
.pmFlag = TRUE,
.log = LogNone,
- .kbdCustomKeycodes = FALSE,
.disableRandR = FALSE,
.randRFrom = X_DEFAULT,
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV)
- .allowEmptyInput = TRUE,
+ .forceInputDevices = FALSE,
.autoAddDevices = TRUE,
.autoEnableDevices = TRUE
#else
- .allowEmptyInput = FALSE,
+ .forceInputDevices = TRUE,
.autoAddDevices = FALSE,
.autoEnableDevices = FALSE
#endif
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index e4d07ec12..abb198690 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -273,72 +273,6 @@ xf86AllocateScrnInfoPrivateIndex(void)
return idx;
}
-/* Allocate a new InputInfoRec and append it to the tail of xf86InputDevs. */
-InputInfoPtr
-xf86AllocateInput(InputDriverPtr drv, int flags)
-{
- InputInfoPtr new, *prev = NULL;
-
- if (!(new = calloc(sizeof(InputInfoRec), 1)))
- return NULL;
-
- new->drv = drv;
- new->module = DuplicateModule(drv->module, NULL);
-
- for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next)
- ;
-
- *prev = new;
- new->next = NULL;
-
- return new;
-}
-
-
-/*
- * Remove an entry from xf86InputDevs. Ideally it should free all allocated
- * data. To do this properly may require a driver hook.
- */
-
-void
-xf86DeleteInput(InputInfoPtr pInp, int flags)
-{
- InputInfoPtr p;
-
- /* First check if the inputdev is valid. */
- if (pInp == NULL)
- return;
-
-#if 0
- /* If a free function is defined, call it here. */
- if (pInp->free)
- pInp->free(pInp, 0);
-#endif
-
- if (pInp->module)
- UnloadModule(pInp->module);
-
- /* This should *really* be handled in drv->UnInit(dev) call instead, but
- * if the driver forgets about it make sure we free it or at least crash
- * with flying colors */
- free(pInp->private);
-
- FreeInputAttributes(pInp->attrs);
-
- /* Remove the entry from the list. */
- if (pInp == xf86InputDevs)
- xf86InputDevs = pInp->next;
- else {
- p = xf86InputDevs;
- while (p && p->next != pInp)
- p = p->next;
- if (p)
- p->next = pInp->next;
- /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
- }
- free(pInp);
-}
-
Bool
xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad)
{
@@ -1247,6 +1181,43 @@ xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
va_end(ap);
}
+/* Print input driver messages in the standard format of
+ <driver>: <device name>: <message> */
+void
+xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
+ va_list args)
+{
+ char *msg;
+
+ msg = Xprintf("%s: %s: %s", dev->drv->driverName, dev->name, format);
+ LogVMessageVerb(type, verb, "%s", msg);
+ free(msg);
+}
+
+/* Print input driver message, with verbose level specified directly */
+void
+xf86IDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
+ ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VIDrvMsgVerb(dev, type, verb, format, ap);
+ va_end(ap);
+}
+
+/* Print input driver messages, with verbose level of 1 (default) */
+void
+xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ xf86VIDrvMsgVerb(dev, type, 1, format, ap);
+ va_end(ap);
+}
+
+
/* Print non-driver messages with verbose level specified directly */
void
xf86MsgVerb(MessageType type, int verb, const char *format, ...)
@@ -2070,7 +2041,7 @@ xf86IsUnblank(int mode)
}
void
-xf86MotionHistoryAllocate(LocalDevicePtr local)
+xf86MotionHistoryAllocate(InputInfoPtr pInfo)
{
- AllocateMotionHistory(local->dev);
+ AllocateMotionHistory(pInfo->dev);
}
diff --git a/xorg-server/hw/xfree86/common/xf86InPriv.h b/xorg-server/hw/xfree86/common/xf86InPriv.h
index 3838d6940..15fef4320 100644
--- a/xorg-server/hw/xfree86/common/xf86InPriv.h
+++ b/xorg-server/hw/xfree86/common/xf86InPriv.h
@@ -1,46 +1,43 @@
-
-/*
- * Copyright (c) 1999 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
-
-#ifndef _xf86InPriv_h
-#define _xf86InPriv_h
-
-/* xf86Globals.c */
-extern InputDriverPtr *xf86InputDriverList;
-extern int xf86NumInputDrivers;
-
-/* xf86Xinput.c */
-int xf86ActivateDevice(InputInfoPtr pInfo);
-
-/* xf86Helper.c */
-InputDriverPtr xf86LookupInputDriver(const char *name);
-
-#endif /* _xf86InPriv_h */
+
+/*
+ * Copyright (c) 1999 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
+
+#ifndef _xf86InPriv_h
+#define _xf86InPriv_h
+
+/* xf86Globals.c */
+extern InputDriverPtr *xf86InputDriverList;
+extern int xf86NumInputDrivers;
+
+/* xf86Helper.c */
+InputDriverPtr xf86LookupInputDriver(const char *name);
+
+#endif /* _xf86InPriv_h */
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index ab5b5a34d..aee1e8e33 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -814,7 +814,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput(int argc, char **argv)
{
- IDevPtr* pDev;
+ InputInfoPtr* pDev;
DeviceIntPtr dev;
xf86Info.vtRequestsPending = FALSE;
diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h
index 266a4dafe..9335e116f 100644
--- a/xorg-server/hw/xfree86/common/xf86Module.h
+++ b/xorg-server/hw/xfree86/common/xf86Module.h
@@ -83,7 +83,7 @@ typedef enum {
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(9, 0)
-#define ABI_XINPUT_VERSION SET_ABI_VERSION(11, 0)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(12, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(4, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
diff --git a/xorg-server/hw/xfree86/common/xf86Opt.h b/xorg-server/hw/xfree86/common/xf86Opt.h
index 3af4b4069..5ce320891 100644
--- a/xorg-server/hw/xfree86/common/xf86Opt.h
+++ b/xorg-server/hw/xfree86/common/xf86Opt.h
@@ -84,6 +84,7 @@ extern _X_EXPORT pointer xf86NewOption(char *name, char *value );
extern _X_EXPORT pointer xf86NextOption(pointer list );
extern _X_EXPORT pointer xf86OptionListCreate(const char **options, int count, int used);
extern _X_EXPORT pointer xf86OptionListMerge(pointer head, pointer tail);
+extern _X_EXPORT pointer xf86OptionListDuplicate(pointer list);
extern _X_EXPORT void xf86OptionListFree(pointer opt);
extern _X_EXPORT char *xf86OptionName(pointer opt);
extern _X_EXPORT char *xf86OptionValue(pointer opt);
diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c
index 8dce3ad0f..97deb1436 100644
--- a/xorg-server/hw/xfree86/common/xf86Option.c
+++ b/xorg-server/hw/xfree86/common/xf86Option.c
@@ -118,58 +118,43 @@ xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts)
}
/*
- * xf86CollectInputOptions collects the options for an InputDevice.
- * This function requires that the following has been initialised:
- *
- * pInfo->conf_idev
- *
- * The extraOpts parameter may optionally contain a list of additional options
- * to include.
- *
- * The order of precedence for options is:
- *
- * extraOpts, pInfo->conf_idev->extraOptions,
- * pInfo->conf_idev->commonOptions, defaultOpts
+ * xf86CollectInputOptions collects extra options for an InputDevice (other
+ * than those added by the config backend).
+ * The options are merged into the existing ones and thus take precedence
+ * over the others.
*/
void
-xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
- pointer extraOpts)
+xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts)
{
- XF86OptionPtr tmp;
- XF86OptionPtr extras = (XF86OptionPtr)extraOpts;
-
- pInfo->options = NULL;
if (defaultOpts) {
- pInfo->options = xf86OptionListCreate(defaultOpts, -1, 0);
- }
- 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 && pInfo->conf_idev->extraOptions) {
- tmp = xf86optionListDup(pInfo->conf_idev->extraOptions);
- if (pInfo->options)
- pInfo->options = xf86optionListMerge(pInfo->options, tmp);
- else
- pInfo->options = tmp;
- }
- if (extras) {
- tmp = xf86optionListDup(extras);
+ XF86OptionPtr tmp =xf86optionListCreate(defaultOpts, -1, 0);
if (pInfo->options)
pInfo->options = xf86optionListMerge(pInfo->options, tmp);
else
pInfo->options = tmp;
}
+}
- if (pInfo->conf_idev && pInfo->conf_idev->attrs) {
- pInfo->attrs = pInfo->conf_idev->attrs;
+/**
+ * Duplicate the option list passed in. The returned pointer will be a newly
+ * allocated option list and must be freed by the caller.
+ */
+pointer
+xf86OptionListDuplicate(pointer options)
+{
+ pointer o = NULL;
+
+ while (options)
+ {
+ o = xf86AddNewOption(o, xf86OptionName(options), xf86OptionValue(options));
+ options = xf86nextOption(options);
}
+
+ return o;
}
+
/* Created for new XInput stuff -- essentially extensions to the parser */
static int
diff --git a/xorg-server/hw/xfree86/common/xf86Privstr.h b/xorg-server/hw/xfree86/common/xf86Privstr.h
index 6138b6bec..66a73d32b 100644
--- a/xorg-server/hw/xfree86/common/xf86Privstr.h
+++ b/xorg-server/hw/xfree86/common/xf86Privstr.h
@@ -96,7 +96,6 @@ typedef struct {
#endif
Bool pmFlag;
Log log;
- Bool kbdCustomKeycodes;
Bool disableRandR;
MessageType randRFrom;
Bool aiglx;
@@ -108,8 +107,7 @@ typedef struct {
MessageType useDefaultFontPathFrom;
Bool ignoreABI;
- Bool allowEmptyInput; /* Allow the server to start with no input
- * devices. */
+ Bool forceInputDevices; /* force xorg.conf or built-in input devices */
Bool autoAddDevices; /* Whether to succeed NIDR, or ignore. */
Bool autoEnableDevices; /* Whether to enable, or let the client
* control. */
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index 3542abd4a..e90268a06 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -59,23 +59,15 @@
#include "xf86Priv.h"
#include "xf86Config.h"
#include "xf86Xinput.h"
-#include "XIstubs.h"
#include "xf86Optrec.h"
-#include "xf86Parser.h"
#include "mipointer.h"
-#include "xf86InPriv.h"
-#include "compiler.h"
#include "extinit.h"
#include "loaderProcs.h"
-#ifdef DPMSExtension
-#include <X11/extensions/dpmsconst.h>
-#include "dpmsproc.h"
-#endif
-
#include "exevents.h" /* AddInputDevice */
#include "exglobals.h"
#include "eventstr.h"
+#include "inpututils.h"
#include <string.h> /* InputClassMatches */
#ifdef HAVE_FNMATCH_H
@@ -85,15 +77,9 @@
#include <sys/utsname.h>
#endif
-#include "extnsionst.h"
-
-#include "windowstr.h" /* screenIsSaved */
-
#include <stdarg.h>
#include <stdint.h> /* for int64_t */
-#include <X11/Xpoll.h>
-
#include "mi.h"
#include <ptrveloc.h> /* dix pointer acceleration */
@@ -105,10 +91,19 @@
#include "xkbsrv.h"
-#include "os.h"
+/* Valuator verification macro */
+#define XI_VERIFY_VALUATORS(num_valuators) \
+ if (num_valuators > MAX_VALUATORS) { \
+ xf86Msg(X_ERROR, "%s: num_valuator %d is greater than" \
+ " MAX_VALUATORS\n", __FUNCTION__, num_valuators); \
+ return; \
+ }
EventListPtr xf86Events = NULL;
+static int
+xf86InputDevicePostInit(DeviceIntPtr dev);
+
/**
* Eval config and modify DeviceVelocityRec accordingly
*/
@@ -203,11 +198,11 @@ static void
ApplyAccelerationSettings(DeviceIntPtr dev){
int scheme, i;
DeviceVelocityPtr pVel;
- LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+ InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
char* schemeStr;
if (dev->valuator && dev->ptrfeed) {
- schemeStr = xf86SetStrOption(local->options, "AccelerationScheme", "");
+ schemeStr = xf86SetStrOption(pInfo->options, "AccelerationScheme", "");
scheme = dev->valuator->accelScheme.number;
@@ -228,15 +223,15 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
if (InitPointerAccelerationScheme(dev, scheme)) {
xf86Msg(X_CONFIG, "%s: (accel) selected scheme %s/%i\n",
- local->name, schemeStr, scheme);
+ pInfo->name, schemeStr, scheme);
} else {
xf86Msg(X_CONFIG, "%s: (accel) could not init scheme %s\n",
- local->name, schemeStr);
+ pInfo->name, schemeStr);
scheme = dev->valuator->accelScheme.number;
}
} else {
xf86Msg(X_CONFIG, "%s: (accel) keeping acceleration scheme %i\n",
- local->name, scheme);
+ pInfo->name, scheme);
}
free(schemeStr);
@@ -245,45 +240,34 @@ ApplyAccelerationSettings(DeviceIntPtr dev){
switch (scheme) {
case PtrAccelPredictable:
pVel = GetDevicePredictableAccelData(dev);
- ProcessVelocityConfiguration (dev, local->name, local->options,
+ ProcessVelocityConfiguration (dev, pInfo->name, pInfo->options,
pVel);
break;
}
- i = xf86SetIntOption(local->options, "AccelerationNumerator",
+ i = xf86SetIntOption(pInfo->options, "AccelerationNumerator",
dev->ptrfeed->ctrl.num);
if (i >= 0)
dev->ptrfeed->ctrl.num = i;
- i = xf86SetIntOption(local->options, "AccelerationDenominator",
+ i = xf86SetIntOption(pInfo->options, "AccelerationDenominator",
dev->ptrfeed->ctrl.den);
if (i > 0)
dev->ptrfeed->ctrl.den = i;
- i = xf86SetIntOption(local->options, "AccelerationThreshold",
+ i = xf86SetIntOption(pInfo->options, "AccelerationThreshold",
dev->ptrfeed->ctrl.threshold);
if (i >= 0)
dev->ptrfeed->ctrl.threshold = i;
xf86Msg(X_CONFIG, "%s: (accel) acceleration factor: %.3f\n",
- local->name, ((float)dev->ptrfeed->ctrl.num)/
+ pInfo->name, ((float)dev->ptrfeed->ctrl.num)/
((float)dev->ptrfeed->ctrl.den));
xf86Msg(X_CONFIG, "%s: (accel) acceleration threshold: %i\n",
- local->name, dev->ptrfeed->ctrl.threshold);
+ pInfo->name, dev->ptrfeed->ctrl.threshold);
}
}
-static Bool
-xf86SendDragEvents(DeviceIntPtr device)
-{
- LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
-
- if (device->button && device->button->buttonsDown > 0)
- return local->flags & XI86_SEND_DRAG_EVENTS;
- else
- return TRUE;
-}
-
/***********************************************************************
*
* xf86ProcessCommonOptions --
@@ -293,27 +277,18 @@ xf86SendDragEvents(DeviceIntPtr device)
***********************************************************************
*/
void
-xf86ProcessCommonOptions(LocalDevicePtr local,
+xf86ProcessCommonOptions(InputInfoPtr pInfo,
pointer list)
{
if (!xf86SetBoolOption(list, "AlwaysCore", 1) ||
!xf86SetBoolOption(list, "SendCoreEvents", 1) ||
!xf86SetBoolOption(list, "CorePointer", 1) ||
!xf86SetBoolOption(list, "CoreKeyboard", 1)) {
- xf86Msg(X_CONFIG, "%s: doesn't report core events\n", local->name);
- } else {
- 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;
+ xf86Msg(X_CONFIG, "%s: doesn't report core events\n", pInfo->name);
} else {
- xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
+ pInfo->flags |= XI86_ALWAYS_CORE;
+ xf86Msg(X_CONFIG, "%s: always reports core events\n", pInfo->name);
}
-
- /* Backwards compatibility. */
- local->history_size = GetMotionHistorySize();
}
/***********************************************************************
@@ -325,86 +300,38 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
* Returns TRUE on success, or FALSE otherwise.
***********************************************************************
*/
-int
-xf86ActivateDevice(LocalDevicePtr local)
+static DeviceIntPtr
+xf86ActivateDevice(InputInfoPtr pInfo)
{
DeviceIntPtr dev;
+ Atom atom;
- if (local->flags & XI86_CONFIGURED) {
- dev = AddInputDevice(serverClient, local->device_control, TRUE);
+ dev = AddInputDevice(serverClient, pInfo->device_control, TRUE);
- if (dev == NULL)
- {
- xf86Msg(X_ERROR, "Too many input devices. Ignoring %s\n",
- local->name);
- local->dev = NULL;
- return FALSE;
- }
-
- 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;
-
- dev->coreEvents = local->flags & XI86_ALWAYS_CORE;
- dev->type = SLAVE;
- dev->spriteInfo->spriteOwner = FALSE;
-
- dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
- dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
-
- RegisterOtherDevice(dev);
- XkbSetExtension(dev, ProcessKeyboardEvent);
-
- if (serverGeneration == 1)
- xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
- local->name, local->type_name);
+ if (dev == NULL)
+ {
+ xf86Msg(X_ERROR, "Too many input devices. Ignoring %s\n",
+ pInfo->name);
+ pInfo->dev = NULL;
+ return NULL;
}
- return TRUE;
-}
+ atom = MakeAtom(pInfo->type_name, strlen(pInfo->type_name), TRUE);
+ AssignTypeAndName(dev, atom, pInfo->name);
+ dev->public.devicePrivate = pInfo;
+ pInfo->dev = dev;
+ dev->coreEvents = pInfo->flags & XI86_ALWAYS_CORE;
+ dev->type = SLAVE;
+ dev->spriteInfo->spriteOwner = FALSE;
-/***********************************************************************
- *
- * Caller: ProcXOpenDevice
- *
- * This is the implementation-dependent routine to open an input device.
- * 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. This entry point is for the latter type of
- * implementation.
- *
- * If the physical device is not already open, do it here. In this case,
- * you need to keep track of the fact that one or more clients has the
- * device open, and physically close it when the last client that has
- * it open does an XCloseDevice.
- *
- * The default implementation is to do nothing (assume all input devices
- * are opened during X server initialization and kept open).
- *
- ***********************************************************************
- */
+ dev->config_info = xf86SetStrOption(pInfo->options, "config_info", NULL);
-void
-OpenInputDevice(DeviceIntPtr dev,
- ClientPtr client,
- int *status)
-{
- if (!dev->inited)
- ActivateDevice(dev, TRUE);
+ if (serverGeneration == 1)
+ xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
+ pInfo->name, pInfo->type_name);
- *status = Success;
-}
-
-void
-CloseInputDevice(DeviceIntPtr dev,
- ClientPtr client)
-{
+ return dev;
}
/****************************************************************************
@@ -423,10 +350,10 @@ CloseInputDevice(DeviceIntPtr dev,
int
SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
{
- LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+ InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
- if (local->switch_mode) {
- return (*local->switch_mode)(client, dev, mode);
+ if (pInfo->switch_mode) {
+ return (*pInfo->switch_mode)(client, dev, mode);
}
else
return BadMatch;
@@ -450,10 +377,10 @@ int
SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
int first_valuator, int num_valuators)
{
- LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate;
+ InputInfoPtr pInfo = (InputInfoPtr) dev->public.devicePrivate;
- if (local->set_device_valuators)
- return (*local->set_device_valuators)(local, valuators, first_valuator,
+ if (pInfo->set_device_valuators)
+ return (*pInfo->set_device_valuators)(pInfo, valuators, first_valuator,
num_valuators);
return BadMatch;
@@ -472,9 +399,9 @@ SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
int
ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
{
- LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
+ InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
- if (!local->control_proc) {
+ if (!pInfo->control_proc) {
switch (control->control) {
case DEVICE_CORE:
return BadMatch;
@@ -488,15 +415,10 @@ ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
}
}
else {
- return (*local->control_proc)(local, control);
+ return (*pInfo->control_proc)(pInfo, control);
}
}
-void
-AddOtherInputDevices(void)
-{
-}
-
/*
* Get the operating system name from uname and store it statically to avoid
* repeating the system call each time MatchOS is checked.
@@ -592,7 +514,7 @@ MatchAttrToken(const char *attr, struct list *patterns,
* statements must match.
*/
static Bool
-InputClassMatches(const XF86ConfInputClassPtr iclass, const IDevPtr idev,
+InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
const InputAttributes *attrs)
{
/* MatchProduct substring */
@@ -672,7 +594,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const IDevPtr idev,
* well as any previous InputClass sections.
*/
static int
-MergeInputClasses(const IDevPtr idev, const InputAttributes *attrs)
+MergeInputClasses(const InputInfoPtr idev, const InputAttributes *attrs)
{
XF86ConfInputClassPtr cl;
XF86OptionPtr classopts;
@@ -697,9 +619,8 @@ MergeInputClasses(const IDevPtr idev, const InputAttributes *attrs)
/* Apply options to device with InputClass settings preferred. */
xf86Msg(X_CONFIG, "%s: Applying InputClass \"%s\"\n",
- idev->identifier, cl->identifier);
- idev->commonOptions = xf86optionListMerge(idev->commonOptions,
- classopts);
+ idev->name, cl->identifier);
+ idev->options = xf86optionListMerge(idev->options, classopts);
}
return Success;
@@ -710,7 +631,7 @@ MergeInputClasses(const IDevPtr idev, const InputAttributes *attrs)
* value of the last matching class and holler when returning TRUE.
*/
static Bool
-IgnoreInputClass(const IDevPtr idev, const InputAttributes *attrs)
+IgnoreInputClass(const InputInfoPtr idev, const InputAttributes *attrs)
{
XF86ConfInputClassPtr cl;
Bool ignore = FALSE;
@@ -727,10 +648,95 @@ IgnoreInputClass(const IDevPtr idev, const InputAttributes *attrs)
if (ignore)
xf86Msg(X_CONFIG, "%s: Ignoring device from InputClass \"%s\"\n",
- idev->identifier, ignore_class);
+ idev->name, ignore_class);
return ignore;
}
+static InputInfoPtr
+xf86AllocateInput(void)
+{
+ InputInfoPtr pInfo;
+
+ pInfo = calloc(sizeof(*pInfo), 1);
+ if (!pInfo)
+ return NULL;
+
+ pInfo->fd = -1;
+ pInfo->type_name = "UNKNOWN";
+
+ return pInfo;
+}
+
+/* Append InputInfoRec to the tail of xf86InputDevs. */
+static void
+xf86AddInput(InputDriverPtr drv, InputInfoPtr pInfo)
+{
+ InputInfoPtr *prev = NULL;
+
+ pInfo->drv = drv;
+ pInfo->module = DuplicateModule(drv->module, NULL);
+
+ for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next)
+ ;
+
+ *prev = pInfo;
+ pInfo->next = NULL;
+
+ xf86CollectInputOptions(pInfo, (const char**)drv->default_options);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+}
+
+/*
+ * Remove an entry from xf86InputDevs and free all the device's information.
+ */
+void
+xf86DeleteInput(InputInfoPtr pInp, int flags)
+{
+ /* First check if the inputdev is valid. */
+ if (pInp == NULL)
+ return;
+
+ if (pInp->module)
+ UnloadModule(pInp->module);
+
+ /* This should *really* be handled in drv->UnInit(dev) call instead, but
+ * if the driver forgets about it make sure we free it or at least crash
+ * with flying colors */
+ free(pInp->private);
+
+ FreeInputAttributes(pInp->attrs);
+
+ /* Remove the entry from the list. */
+ if (pInp == xf86InputDevs)
+ xf86InputDevs = pInp->next;
+ else {
+ InputInfoPtr p = xf86InputDevs;
+ while (p && p->next != pInp)
+ p = p->next;
+ if (p)
+ p->next = pInp->next;
+ /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
+ }
+
+ free(pInp->driver);
+ free(pInp->name);
+ xf86optionListFree(pInp->options);
+ free(pInp);
+}
+
+/*
+ * Apply backend-specific initialization. Invoked after ActiveteDevice(),
+ * i.e. after the driver successfully completed DEVICE_INIT and the device
+ * is advertised.
+ * @param dev the device
+ * @return Success or an error code
+ */
+static int
+xf86InputDevicePostInit(DeviceIntPtr dev) {
+ ApplyAccelerationSettings(dev);
+ return Success;
+}
+
/**
* Create a new input device, activate and enable it.
*
@@ -749,21 +755,20 @@ IgnoreInputClass(const IDevPtr idev, const InputAttributes *attrs)
* @return Success or an error code
*/
_X_INTERNAL int
-xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
+xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
{
InputDriverPtr drv = NULL;
- InputInfoPtr pInfo = NULL;
DeviceIntPtr dev = NULL;
int rval;
/* Memory leak for every attached device if we don't
* test if the module is already loaded first */
- drv = xf86LookupInputDriver(idev->driver);
+ drv = xf86LookupInputDriver(pInfo->driver);
if (!drv)
- if (xf86LoadOneModule(idev->driver, NULL))
- drv = xf86LookupInputDriver(idev->driver);
+ if (xf86LoadOneModule(pInfo->driver, NULL))
+ drv = xf86LookupInputDriver(pInfo->driver);
if (!drv) {
- xf86Msg(X_ERROR, "No input driver matching `%s'\n", idev->driver);
+ xf86Msg(X_ERROR, "No input driver matching `%s'\n", pInfo->driver);
rval = BadName;
goto unwind;
}
@@ -776,42 +781,44 @@ xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
goto unwind;
}
- pInfo = drv->PreInit(drv, idev, 0);
+ xf86AddInput(drv, pInfo);
- if (!pInfo) {
- xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n", idev->identifier);
- rval = BadMatch;
- goto unwind;
- }
- else if (!(pInfo->flags & XI86_CONFIGURED)) {
- xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
- idev->identifier);
- rval = BadMatch;
+ rval = drv->PreInit(drv, pInfo, 0);
+
+ if (rval != Success) {
+ xf86Msg(X_ERROR, "PreInit returned %d for \"%s\"\n", rval, pInfo->name);
goto unwind;
}
- if (!xf86ActivateDevice(pInfo))
+ if (!(dev = xf86ActivateDevice(pInfo)))
{
rval = BadAlloc;
goto unwind;
}
- dev = pInfo->dev;
rval = ActivateDevice(dev, TRUE);
if (rval != Success)
{
- xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", idev->identifier);
+ xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
RemoveDevice(dev, TRUE);
goto unwind;
}
+ rval = xf86InputDevicePostInit(dev);
+ if (rval != Success)
+ {
+ xf86Msg(X_ERROR, "Couldn't post-init device \"%s\"\n", pInfo->name);
+ RemoveDevice(dev, TRUE);
+ goto unwind;
+ }
+
/* Enable it if it's properly initialised and we're currently in the VT */
if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)
{
EnableDevice(dev, TRUE);
if (!dev->enabled)
{
- xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", idev->identifier);
+ xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
rval = BadMatch;
goto unwind;
}
@@ -824,7 +831,7 @@ xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
unwind:
if(pInfo) {
- if(drv->UnInit)
+ if(drv && drv->UnInit)
drv->UnInit(drv, pInfo, 0);
else
xf86DeleteInput(pInfo, 0);
@@ -836,23 +843,23 @@ int
NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
DeviceIntPtr *pdev)
{
- IDevRec *idev = NULL;
+ InputInfoPtr pInfo = NULL;
InputOption *option = NULL;
int rval = Success;
int is_auto = 0;
- idev = calloc(sizeof(*idev), 1);
- if (!idev)
+ pInfo = xf86AllocateInput();
+ if (!pInfo)
return BadAlloc;
for (option = options; option; option = option->next) {
if (strcasecmp(option->key, "driver") == 0) {
- if (idev->driver) {
+ if (pInfo->driver) {
rval = BadRequest;
goto unwind;
}
- idev->driver = xstrdup(option->value);
- if (!idev->driver) {
+ pInfo->driver = xstrdup(option->value);
+ if (!pInfo->driver) {
rval = BadAlloc;
goto unwind;
}
@@ -860,12 +867,12 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
if (strcasecmp(option->key, "name") == 0 ||
strcasecmp(option->key, "identifier") == 0) {
- if (idev->identifier) {
+ if (pInfo->name) {
rval = BadRequest;
goto unwind;
}
- idev->identifier = xstrdup(option->value);
- if (!idev->identifier) {
+ pInfo->name = xstrdup(option->value);
+ if (!pInfo->name) {
rval = BadAlloc;
goto unwind;
}
@@ -885,7 +892,7 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
for (option = options; option; option = option->next) {
/* Steal option key/value strings from the provided list.
* We need those strings, the InputOption list doesn't. */
- idev->commonOptions = xf86addNewOption(idev->commonOptions,
+ pInfo->options = xf86addNewOption(pInfo->options,
option->key, option->value);
option->key = NULL;
option->value = NULL;
@@ -893,58 +900,51 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
/* Apply InputClass settings */
if (attrs) {
- if (IgnoreInputClass(idev, attrs)) {
+ if (IgnoreInputClass(pInfo, attrs)) {
rval = BadIDChoice;
goto unwind;
}
- rval = MergeInputClasses(idev, attrs);
+ rval = MergeInputClasses(pInfo, attrs);
if (rval != Success)
goto unwind;
- idev->attrs = DuplicateInputAttributes(attrs);
+ pInfo->attrs = DuplicateInputAttributes(attrs);
}
- if (!idev->driver || !idev->identifier) {
+ if (!pInfo->driver || !pInfo->name) {
xf86Msg(X_INFO, "No input driver/identifier specified (ignoring)\n");
rval = BadRequest;
goto unwind;
}
- if (!idev->identifier) {
+ if (!pInfo->name) {
xf86Msg(X_ERROR, "No device identifier specified (ignoring)\n");
- return BadMatch;
+ rval = BadMatch;
+ goto unwind;
}
- rval = xf86NewInputDevice(idev, pdev,
+ rval = xf86NewInputDevice(pInfo, pdev,
(!is_auto || (is_auto && xf86Info.autoEnableDevices)));
- if (rval == Success)
- return Success;
+
+ return rval;
unwind:
if (is_auto && !xf86Info.autoAddDevices)
xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n");
- free(idev->driver);
- free(idev->identifier);
- xf86optionListFree(idev->commonOptions);
- free(idev);
+ xf86DeleteInput(pInfo, 0);
return rval;
}
void
DeleteInputDeviceRequest(DeviceIntPtr pDev)
{
- LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
+ InputInfoPtr pInfo = (InputInfoPtr) pDev->public.devicePrivate;
InputDriverPtr drv = NULL;
- IDevRec *idev = NULL;
- IDevPtr *it;
Bool isMaster = IsMaster(pDev);
if (pInfo) /* need to get these before RemoveDevice */
- {
drv = pInfo->drv;
- idev = pInfo->conf_idev;
- }
OsBlockSignals();
RemoveDevice(pDev, TRUE);
@@ -955,19 +955,6 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
drv->UnInit(drv, pInfo, 0);
else
xf86DeleteInput(pInfo, 0);
-
- /* devices added through HAL aren't in the config layout */
- it = xf86ConfigLayout.inputs;
- while(*it && *it != idev)
- it++;
-
- if (!(*it)) /* end of list, not in the layout */
- {
- free(idev->driver);
- free(idev->identifier);
- xf86optionListFree(idev->commonOptions);
- free(idev);
- }
}
OsReleaseSignals();
}
@@ -985,16 +972,17 @@ xf86PostMotionEvent(DeviceIntPtr device,
{
va_list var;
int i = 0;
- static int valuators[MAX_VALUATORS];
+ ValuatorMask mask;
XI_VERIFY_VALUATORS(num_valuators);
+ valuator_mask_zero(&mask);
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
- valuators[i] = va_arg(var, int);
+ valuator_mask_set(&mask, first_valuator + i, va_arg(var, int));
va_end(var);
- xf86PostMotionEventP(device, is_absolute, first_valuator, num_valuators, valuators);
+ xf86PostMotionEventM(device, is_absolute, &mask);
}
void
@@ -1002,10 +990,22 @@ xf86PostMotionEventP(DeviceIntPtr device,
int is_absolute,
int first_valuator,
int num_valuators,
- int *valuators)
+ const int *valuators)
+{
+ ValuatorMask mask;
+
+ XI_VERIFY_VALUATORS(num_valuators);
+
+ valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators);
+ xf86PostMotionEventM(device, is_absolute, &mask);
+}
+
+void
+xf86PostMotionEventM(DeviceIntPtr device,
+ int is_absolute,
+ const ValuatorMask *mask)
{
int i = 0, nevents = 0;
- Bool drag = xf86SendDragEvents(device);
DeviceEvent *event;
int flags = 0;
@@ -1014,8 +1014,6 @@ xf86PostMotionEventP(DeviceIntPtr device,
int dx = 0, dy = 0;
#endif
- XI_VERIFY_VALUATORS(num_valuators);
-
if (is_absolute)
flags = POINTER_ABSOLUTE;
else
@@ -1023,19 +1021,20 @@ xf86PostMotionEventP(DeviceIntPtr device,
#if XFreeXDGA
/* The evdev driver may not always send all axes across. */
- if (num_valuators >= 1 && first_valuator <= 1) {
+ if (valuator_mask_isset(mask, 0) ||
+ valuator_mask_isset(mask, 1))
if (miPointerGetScreen(device)) {
index = miPointerGetScreen(device)->myNum;
- if (first_valuator == 0)
+ if (valuator_mask_isset(mask, 0))
{
- dx = valuators[0];
+ dx = valuator_mask_get(mask, 0);
if (is_absolute)
dx -= device->last.valuators[0];
}
- if (first_valuator == 1 || num_valuators >= 2)
+ if (valuator_mask_isset(mask, 1))
{
- dy = valuators[1 - first_valuator];
+ dy = valuator_mask_get(mask, 1);
if (is_absolute)
dy -= device->last.valuators[1];
}
@@ -1043,21 +1042,13 @@ xf86PostMotionEventP(DeviceIntPtr device,
if (DGAStealMotionEvent(device, index, dx, dy))
return;
}
- }
#endif
- nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0,
- flags, first_valuator, num_valuators,
- valuators);
+ nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0, flags, mask);
for (i = 0; i < nevents; i++) {
event = (DeviceEvent*)((xf86Events + i)->event);
- /* Don't post core motion events for devices not registered to send
- * drag events. */
- if (event->header == ET_Internal &&
- (event->type != ET_Motion || drag)) {
- mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
- }
+ mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
}
}
@@ -1070,18 +1061,17 @@ xf86PostProximityEvent(DeviceIntPtr device,
{
va_list var;
int i;
- int valuators[MAX_VALUATORS];
+ ValuatorMask mask;
XI_VERIFY_VALUATORS(num_valuators);
+ valuator_mask_zero(&mask);
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
- valuators[i] = va_arg(var, int);
+ valuator_mask_set(&mask, first_valuator + i, va_arg(var, int));
va_end(var);
- xf86PostProximityEventP(device, is_in, first_valuator, num_valuators,
- valuators);
-
+ xf86PostProximityEventM(device, is_in, &mask);
}
void
@@ -1089,15 +1079,25 @@ xf86PostProximityEventP(DeviceIntPtr device,
int is_in,
int first_valuator,
int num_valuators,
- int *valuators)
+ const int *valuators)
{
- int i, nevents;
+ ValuatorMask mask;
XI_VERIFY_VALUATORS(num_valuators);
+ valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators);
+ xf86PostProximityEventM(device, is_in, &mask);
+}
+
+void
+xf86PostProximityEventM(DeviceIntPtr device,
+ int is_in,
+ const ValuatorMask *mask)
+{
+ int i, nevents;
+
nevents = GetProximityEvents(xf86Events, device,
- is_in ? ProximityIn : ProximityOut,
- first_valuator, num_valuators, valuators);
+ is_in ? ProximityIn : ProximityOut, mask);
for (i = 0; i < nevents; i++)
mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
@@ -1113,19 +1113,19 @@ xf86PostButtonEvent(DeviceIntPtr device,
...)
{
va_list var;
- int valuators[MAX_VALUATORS];
+ ValuatorMask mask;
int i = 0;
XI_VERIFY_VALUATORS(num_valuators);
+ valuator_mask_zero(&mask);
+
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
- valuators[i] = va_arg(var, int);
+ valuator_mask_set(&mask, first_valuator + i, va_arg(var, int));
va_end(var);
- xf86PostButtonEventP(device, is_absolute, button, is_down, first_valuator,
- num_valuators, valuators);
-
+ xf86PostButtonEventM(device, is_absolute, button, is_down, &mask);
}
void
@@ -1135,7 +1135,22 @@ xf86PostButtonEventP(DeviceIntPtr device,
int is_down,
int first_valuator,
int num_valuators,
- int *valuators)
+ const int *valuators)
+{
+ ValuatorMask mask;
+
+ XI_VERIFY_VALUATORS(num_valuators);
+
+ valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators);
+ xf86PostButtonEventM(device, is_absolute, button, is_down, &mask);
+}
+
+void
+xf86PostButtonEventM(DeviceIntPtr device,
+ int is_absolute,
+ int button,
+ int is_down,
+ const ValuatorMask *mask)
{
int i = 0, nevents = 0;
int flags = 0;
@@ -1144,8 +1159,6 @@ xf86PostButtonEventP(DeviceIntPtr device,
int index;
#endif
- XI_VERIFY_VALUATORS(num_valuators);
-
if (is_absolute)
flags = POINTER_ABSOLUTE;
else
@@ -1161,7 +1174,7 @@ xf86PostButtonEventP(DeviceIntPtr device,
nevents = GetPointerEvents(xf86Events, device,
is_down ? ButtonPress : ButtonRelease, button,
- flags, first_valuator, num_valuators, valuators);
+ flags, mask);
for (i = 0; i < nevents; i++)
mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
@@ -1179,18 +1192,18 @@ xf86PostKeyEvent(DeviceIntPtr device,
{
va_list var;
int i = 0;
- static int valuators[MAX_VALUATORS];
+ ValuatorMask mask;
XI_VERIFY_VALUATORS(num_valuators);
+ valuator_mask_zero(&mask);
+
va_start(var, num_valuators);
for (i = 0; i < num_valuators; i++)
- valuators[i] = va_arg(var, int);
+ valuator_mask_set(&mask, first_valuator + i, va_arg(var, int));
va_end(var);
- xf86PostKeyEventP(device, key_code, is_down, is_absolute, first_valuator,
- num_valuators, valuators);
-
+ xf86PostKeyEventM(device, key_code, is_down, is_absolute, &mask);
}
void
@@ -1200,17 +1213,29 @@ xf86PostKeyEventP(DeviceIntPtr device,
int is_absolute,
int first_valuator,
int num_valuators,
- int *valuators)
+ const int *valuators)
{
- int i = 0, nevents = 0;
+ ValuatorMask mask;
XI_VERIFY_VALUATORS(num_valuators);
+ valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators);
+ xf86PostKeyEventM(device, key_code, is_down, is_absolute, &mask);
+}
+
+void
+xf86PostKeyEventM(DeviceIntPtr device,
+ unsigned int key_code,
+ int is_down,
+ int is_absolute,
+ const ValuatorMask *mask)
+{
+ int i = 0, nevents = 0;
+
if (is_absolute) {
nevents = GetKeyboardValuatorEvents(xf86Events, device,
is_down ? KeyPress : KeyRelease,
- key_code, first_valuator,
- num_valuators, valuators);
+ key_code, mask);
}
else {
nevents = GetKeyboardEvents(xf86Events, device,
@@ -1227,10 +1252,13 @@ xf86PostKeyboardEvent(DeviceIntPtr device,
unsigned int key_code,
int is_down)
{
- xf86PostKeyEventP(device, key_code, is_down, 0, 0, 0, NULL);
+ ValuatorMask mask;
+
+ valuator_mask_zero(&mask);
+ xf86PostKeyEventM(device, key_code, is_down, 0, &mask);
}
-LocalDevicePtr
+InputInfoPtr
xf86FirstLocalDevice(void)
{
return xf86InputDevs;
@@ -1286,27 +1314,27 @@ xf86ScaleAxis(int Cx,
* specific like a touch screen.
*/
void
-xf86XInputSetScreen(LocalDevicePtr local,
+xf86XInputSetScreen(InputInfoPtr pInfo,
int screen_number,
int x,
int y)
{
- if (miPointerGetScreen(local->dev) !=
+ if (miPointerGetScreen(pInfo->dev) !=
screenInfo.screens[screen_number]) {
- miPointerSetScreen(local->dev, screen_number, x, y);
+ miPointerSetScreen(pInfo->dev, screen_number, x, y);
}
}
void
xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
- int resolution, int min_res, int max_res)
+ int resolution, int min_res, int max_res, int mode)
{
if (!dev || !dev->valuator)
return;
InitValuatorAxisStruct(dev, axnum, label, minval, maxval, resolution, min_res,
- max_res);
+ max_res, mode);
}
/*
@@ -1324,9 +1352,6 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
dev->last.valuators[1] = dev->valuator->axisVal[1];
}
-
- if(axnum == 0) /* to prevent double invocation */
- ApplyAccelerationSettings(dev);
}
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.h b/xorg-server/hw/xfree86/common/xf86Xinput.h
index 727f26107..15ab82421 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.h
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.h
@@ -59,161 +59,123 @@
#include "XIstubs.h"
/* Input device flags */
-#define XI86_OPEN_ON_INIT 0x01 /* open the device at startup time */
-#define XI86_CONFIGURED 0x02 /* the device has been configured */
#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
/* the device sends Xinput and core pointer events */
#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
-/* if the device is the core pointer or is sending core events, and
- * SEND_DRAG_EVENTS is false, and a buttons is done, then no motion events
- * (mouse drag action) are sent. This is mainly to allow a touch screen to be
- * used with netscape and other browsers which do strange things if the mouse
- * moves between button down and button up. With a touch screen, this motion
- * is common due to the user's finger moving slightly.
- */
-#define XI86_SEND_DRAG_EVENTS 0x08
-#define XI86_CORE_POINTER 0x10 /* device is the core pointer */
-#define XI86_CORE_KEYBOARD 0x20 /* device is the core keyboard */
-#define XI86_POINTER_CAPABLE 0x40 /* capable of being a core pointer */
-#define XI86_KEYBOARD_CAPABLE 0x80 /* capable of being a core keyboard */
-
-#define XI_PRIVATE(dev) \
- (((LocalDevicePtr)((dev)->public.devicePrivate))->private)
-
-/* Valuator verification macro */
-#define XI_VERIFY_VALUATORS(num_valuators) \
- if (num_valuators > MAX_VALUATORS) { \
- xf86Msg(X_ERROR, "%s: num_valuator %d is greater than" \
- " MAX_VALUATORS\n", __FUNCTION__, num_valuators); \
- return; \
- }
-
-/* Stupid API backwards-compatibility. */
-#define TS_Raw 60
-#define TS_Scaled 61
/* This holds the input driver entry and module information. */
typedef struct _InputDriverRec {
int driverVersion;
char * driverName;
void (*Identify)(int flags);
- struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
- IDevPtr dev, int flags);
+ int (*PreInit)(struct _InputDriverRec *drv,
+ struct _InputInfoRec* pInfo, int flags);
void (*UnInit)(struct _InputDriverRec *drv,
- struct _LocalDeviceRec *pInfo,
+ struct _InputInfoRec *pInfo,
int flags);
pointer module;
+ char ** default_options;
} InputDriverRec, *InputDriverPtr;
/* This is to input devices what the ScrnInfoRec is to screens. */
-typedef struct _LocalDeviceRec {
- struct _LocalDeviceRec *next;
+typedef struct _InputInfoRec {
+ struct _InputInfoRec *next;
char * name;
+ char * driver;
+
int flags;
Bool (*device_control)(DeviceIntPtr device, int what);
- void (*read_input)(struct _LocalDeviceRec *local);
- int (*control_proc)(struct _LocalDeviceRec *local,
+ void (*read_input)(struct _InputInfoRec *local);
+ int (*control_proc)(struct _InputInfoRec *local,
xDeviceCtl *control);
- void (*close_proc)(struct _LocalDeviceRec *local);
int (*switch_mode)(ClientPtr client, DeviceIntPtr dev,
int mode);
- Bool (*conversion_proc)(struct _LocalDeviceRec *local,
- int first, int num, int v0,
- int v1, int v2, int v3, int v4,
- int v5, int *x, int *y);
- Bool (*reverse_conversion_proc)(
- struct _LocalDeviceRec *local,
- int x, int y, int *valuators);
int (*set_device_valuators)
- (struct _LocalDeviceRec *local,
+ (struct _InputInfoRec *local,
int *valuators, int first_valuator,
int num_valuators);
int fd;
- Atom atom;
DeviceIntPtr dev;
pointer private;
- int private_flags;
- unsigned int first;
- unsigned int last;
- int old_x;
- int old_y;
char * type_name;
- IntegerFeedbackPtr always_core_feedback;
- IDevPtr conf_idev;
InputDriverPtr drv;
pointer module;
pointer options;
- unsigned int history_size;
InputAttributes *attrs;
-} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
-
-typedef struct _DeviceAssocRec
-{
- char * config_section_name;
- LocalDevicePtr (*device_allocate)(void);
-} DeviceAssocRec, *DeviceAssocPtr;
+} *InputInfoPtr;
/* xf86Globals.c */
-extern _X_EXPORT InputInfoPtr xf86InputDevs;
+extern InputInfoPtr xf86InputDevs;
/* xf86Xinput.c */
extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
int first_valuator, int num_valuators, ...);
extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
- int first_valuator, int num_valuators, int *valuators);
+ int first_valuator, int num_valuators, const int *valuators);
+extern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute,
+ const ValuatorMask *mask);
extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
int first_valuator, int num_valuators, ...);
extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator,
- int num_valuators, int *valuators);
+ int num_valuators, const int *valuators);
+extern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in,
+ const ValuatorMask *mask);
extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button,
int is_down, int first_valuator, int num_valuators,
...);
extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button,
int is_down, int first_valuator, int num_valuators,
- int *valuators);
+ const int *valuators);
+extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute, int button,
+ int is_down, const ValuatorMask *mask);
extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down,
int is_absolute, int first_valuator, int num_valuators,
...);
+extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device, unsigned int key_code, int is_down,
+ int is_absolute, const ValuatorMask *mask);
extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down,
int is_absolute, int first_valuator, int num_valuators,
- int *valuators);
+ const int *valuators);
extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code,
int is_down);
-extern _X_EXPORT int xf86ActivateDevice(LocalDevicePtr local);
-extern _X_EXPORT LocalDevicePtr xf86FirstLocalDevice(void);
+extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void);
extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max, int from_min);
-extern _X_EXPORT void xf86XInputSetScreen(LocalDevicePtr local, int screen_number, int x, int y);
+extern _X_EXPORT void xf86XInputSetScreen(InputInfoPtr pInfo, int screen_number, int x, int y);
extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo, pointer options);
extern _X_EXPORT void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval,
int maxval, int resolution, int min_res,
- int max_res);
+ int max_res, int mode);
extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
/* not exported */
-int xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL is_auto);
+int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto);
/* xf86Helper.c */
extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
-extern _X_EXPORT InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
-extern _X_EXPORT void xf86MotionHistoryAllocate(LocalDevicePtr local);
+extern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo);
+extern _X_EXPORT void xf86IDrvMsgVerb(InputInfoPtr dev,
+ MessageType type, int verb,
+ const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
+extern _X_EXPORT void xf86IDrvMsg(InputInfoPtr dev,
+ MessageType type,
+ const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4);
+extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev,
+ MessageType type,
+ int verb,
+ const char *format,
+ va_list args);
/* xf86Option.c */
-extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
- pointer extraOpts);
-
-
-/* Legacy hatred */
-#define SendCoreEvents 59
-#define DontSendCoreEvents 60
+extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
#endif /* _xf86Xinput_h */
diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h
index 9d52661a7..0b7685012 100644
--- a/xorg-server/hw/xfree86/common/xf86str.h
+++ b/xorg-server/hw/xfree86/common/xf86str.h
@@ -402,14 +402,6 @@ typedef struct {
} GDevRec, *GDevPtr;
typedef struct {
- char * identifier;
- char * driver;
- pointer commonOptions;
- pointer extraOptions;
- InputAttributes *attrs;
-} IDevRec, *IDevPtr;
-
-typedef struct {
int frameX0;
int frameY0;
int virtualX;
@@ -478,11 +470,13 @@ typedef struct _screenlayoutrec {
confScreenPtr refscreen;
} screenLayoutRec, *screenLayoutPtr;
+typedef struct _InputInfoRec InputInfoRec;
+
typedef struct _serverlayoutrec {
char * id;
screenLayoutPtr screens;
GDevPtr inactives;
- IDevPtr* inputs; /* NULL terminated */
+ InputInfoRec** inputs; /* NULL terminated */
pointer options;
} serverLayoutRec, *serverLayoutPtr;
diff --git a/xorg-server/hw/xfree86/doc/devel/Registry b/xorg-server/hw/xfree86/doc/devel/Registry
index 1fec230e8..613b50c7b 100644
--- a/xorg-server/hw/xfree86/doc/devel/Registry
+++ b/xorg-server/hw/xfree86/doc/devel/Registry
@@ -1,409 +1,408 @@
-This is the XFree86 driver/module registry. To avoid name space clashes and
-to maintain some consistency between drivers the important name spaces are
-maintained here.
-
-1. Module Names.
-
-Each module is required to have a unique name. Registered names are:
-
-GLcore
-acecad
-afb
-apm
-ark
-ati
-atimisc
-bitmap
-bt8xx
-calcomp
-cfb
-cfb16
-cfb24
-cfb32
-chips
-cirrus
-citron
-cyrix
-dbe
-ddc
-digitaledge
-dmc
-dri
-drm
-dynapro
-elo2300
-elographics
-extmod
-fb
-fbdev
-fbdevhw
-fi12x6
-freetype
-glide
-glint
-glx
-hyperpen
-i128
-i2c
-i740
-i810
-imstt
-int10
-joystick
-keyboard
-layer
-magellan
-magictouch
-mfb
-mga
-microtouch
-mouse
-msp34xx
-mutouch
-neomagic
-newport
-nv
-pcidata
-penmount
-pex5
-r128
-radeon
-rac
-ramdac
-record
-rendition
-s3
-s3virge
-savage
-shadow
-shadowfb
-siliconmotion
-sis
-spaceorb
-speedo
-summa
-sunbw2
-suncg14
-suncg3
-suncg6
-sunffb
-sunleo
-suntcx
-tdfx
-tga
-trident
-tseng
-type1
-v4l
-vbe
-vesa
-vga
-vgahw
-vmware
-void
-wacom
-xaa
-xf1bpp
-xf24_32bpp
-xf4bpp
-xf8_16bpp
-xf8_32bpp
-xf8_32wid
-xie
-xtrap
-xtt
-
-2. External Module Object Symbols.
-
-Each module is required to use a unique prefix or prefixes for all of
-its externally visible symbols. They should be unique without regard to
-case. Registered prefixes are:
-
-ati
-bt8xx
-cfb
-chips
-fi12x6
-glide
-glint
-mfb
-mga
-msp34xx
-neo
-permedia
-tseng
-vga
-vgahw
-vmware
-xaa
-xf1bpp
-xf4bpp
-
-3. Chipset Names.
-
-Each video driver is required to use a unique set of chipset names. Case,
-white space and underscore characters are ignored when comparing chipset
-names. All names listed here are in lower case with all white space and
-underscores removed. Registered chipset names are:
-
-ati
-ativga
-ct64200
-ct64300
-ct65520
-ct65525
-ct65530
-ct65535
-ct65540
-ct65545
-ct65546
-ct65548
-ct65550
-ct65554
-ct65555
-ct68554
-ct69000
-et4000
-et4000w32
-et4000w32i
-et4000w32p
-et6000
-et6100
-generic
-ibmvga
-ibm8514
-mach32
-mach64
-mach8
-mga2064w
-mga1064sg
-mga2164w
-mga2164wagp
-neo2070
-neo2090
-neo2093
-neo2097
-neo2160
-neo2200
-tipm2
-vgawonder
-voodoo
-
-4. Option Names.
-
-Option names and their usage should be consistent between drivers.
-Case, white space and underscore characters are ignored when comparing
-option names. The prefix "no" may be added or removed from boolean
-option names. All names listed here are in their preferred user-visible
-form. Some registered option names are:
-
-Types are: B = boolean, O = set/unset (no value), I = integer, S = string,
- A = optional string, F = floating point number Q = frequency
-
-Scopes are: F = global flags, V = video driver, C = common (per screen),
- I = input drivers, X = XAA, Xv = Xv extension, M = misc.
-
-Names currently in use:
-
-Name Type Scope Description
-----------------------------------------------------------------------------
-AllowMouseOpenFail B F ignore mouse dev open failure
-AllowNonLocalModInDev B F allow non-local mod of input devs
-AllowNonLocalXvidtune B F allow non-local VidMode connections
-BlankTime I F Screen saver timeout (min)
-DisableModInDev B F disallow changing input devs
-DisableVidModeExtension B F disable VidMode extension
-DontVTSwitch B F disable Ctrl-Alt-Fn
-DontZap B F disable Ctrl-Alt-BS sequence
-DontZoom B F disable Ctrl-Alt-+/-
-NoTrapSignals B F don't trap signals
-OffTime I F Time before DPMS off mode active (min)
-PciProbe1 O F use PCI probe algorithm 1
-PciProbe2 O F use PCI probe algorithm 2
-PciForceConfig1 O F force PCI config type 1
-PciForceConfig2 O F force PCI config type 2
-Pixmap I F depth 24 pixmap size (24 or 32)
-StandbyTime I F Time before DPMS standby active (min)
-SuspendTime I F Time before DPMS suspend mode active (min)
-
-BackingStore B C Enable backing store
-DDC B C Enable/disable DDC
-DDC1 B C Enable/disable DDC1
-DDC2 B C Enable/disable DDC2
-DPMS O C Enable DPMS
-MTRR B C Enable/disable setting MTRRs
-
-BaudRate I I Serial port baud rate
-ButtonNumber I I Button number (for touch screen?)
-ButtonThreshold I I ??
-ClearDTR O I Clear serial port DTR
-ClearRTS O I Clear serial port RTS
-DataBits I I Serial port data bits
-DemandLoad O I ??
-Device S I Device file name
-DeviceName S I Input device name
-FlowControl S I Serial flow control ("xon", "none")
-HistorySize I I ??
-MaxX I I Maximum X coordinate
-MaxY I I Maximum Y coordinate
-MinX I I Minimum X coordinate
-MinY I I Minimum Y coordinate
-Parity S I Serial port parity ("odd", "even", "none")
-ReportDelay I I ??
-ReportingMode S I may be "raw" or "scaled"
-ScreenNumber I I Screen number (for touch screen)
-SendCoreEvents B I Send core events
-SendDragEvents B I Send drag events
-StopBits I I Serial port stop bits
-SwapXY B I Swap the X and Y axes
-UntouchDelay I I ??
-Vmin I I Tty VMIN
-Vtime I I Tty VTIME
-
-
-18BitBus B V ??
-8Plus16 B V Enable depth 8 + depth 16 with overlay
-8Plus24 B V Enable depth 8 + depth 24 with overlay
-BlockWrite B V Enable/disable block write
-ColorKey I V Set the color key for overlay modes
-CompositeSync B V Composite sync
-CRTDisplay B V Force display on CRT, not LCD
-CRTScreen B V Display on CRT, not LCD (Obsolete)
-EarlyRasPrecharge O V Early RAS pre-charge
-FastDRAM O V Fast DRAM
-FifoAggressive O V Aggressive FIFO setting
-FifoConservative O V Conservative FIFO setting
-FifoModerate O V Moderate FIFO setting
-FireGL3000 B V Card is Diamond FireGL3000
-FixPanelSize B V ??
-FPClock8 Q V Flat panel clock for 8bpp fb (MHz)
-FPClock16 Q V Flat panel clock for 16bpp fb (MHz)
-FPClock24 Q V Flat panel clock for 24bpp fb (MHz)
-FPClock32 Q V Flat panel clock for 32bpp fb (MHz)
-FPMVRAM O V Fast page mode VRAM
-FramebufferWC B V Enable/disable WC for the framebuffer
-GlideDevice I V Selects which Voodoo board to use
-HiBitHigh O V High clock bit default to set
-HiBitLow O V High clock bit default to cleared
-HWClocks B V Enable/disable HW clocks
-HWCursor B V Enable/disable HW cursor
-LateRasPrecharge O V Late RAS pre-charge
-Legend O V Card is Legend ET4000
-LCDCenter B V Enable/disable centering for LCD displays
-Linear B V Enable/disable linear framebuffer
-MCLK Q V Specify the current MCLK value (MHz)
-MedDRAM B V Medium speed DRAM
-MemCfg1 I V ??
-MemCfg2 I V ??
-MGASDRAM B V Mga card has SDRAM
-MMIO B V Enable/disable memory mapped I/O
-MMIOCache B V Enable/Disable MMIO cache
-MuxThreshold I V Multiplexing threshold (kHz)
-NoAccel B V Disable/enable acceleration
-NoClockChip B V ??
-NoStretch B V Disable/enable stretching for LCD displays
-OnAtExit B V Leave video signal on when exiting server
-OverclockMem B V Enable memory overclocking
-Overlay A V Enable multi-depth/overlay. An optional
- string "M,N" may be specified, where
- M, N are the depths.
-PanelDisplay B V Force display on LCD
-PciBurst B V Enable/disable PCI burst mode
-PciRetry B V Enable/disable PCI retries
-ProbeClocks B V Force probe for non-programmable clocks
-ReferenceClock Q V Clock generator reference frequency
-RGBbits I V Number of significant bits per rgb
-Rotate S V Rotate the virtual display (CW or CCW)
-SetLCDClk Q V Set LCD clock (MHz)
-SetMclk Q V Set Memory Clock (MHz)
-ShadowFB B V Enable shadow framebuffer layer
-ShowCache B V Enable viewing of offscreen memory
-ShowOverscan O V Set the overscan area to a visible colour
-SlowDRAM O V Slow DRAM
-SlowEDODRAM O V Slow EDO DRAM
-STN B V STN screen type (??)
-SWCursor B V Enable/disable SW cursor
-SuspendHack B V ??
-SyncOnGreen B V Enable/disable sync on green
-TurboQueue B V Enable/disable turbo queue
-UseFBDev B V Use the fbdev driver interface
-UseModeLine B V Use Modeline (??)
-W32Interleave B V ??
-
-Buffers I Xv Number of buffers
-Device S Xv Device file name
-Expose B Xv Disable occlusion clipping (see DESIGN)
-FramesPerSec I Xv Max. refresh frequency
-
-XAA options. All are of type "O" and scope "X", and are self-explanatory
-
-XaaNoColor8x8PatternFillRect
-XaaNoColor8x8PatternFillTrap
-XaaNoCPUToScreenColorExpandFill
-XaaNoDashedBresenhamLine
-XaaNoDashedTwoPointLine
-XaaNoScreenToScreenCopy
-XaaNoImageReadRect
-XaaNoImageWriteRect
-XaaNoMono8x8PatternFillRect
-XaaNoMono8x8PatternFillTrap
-XaaNoOffscreenPixmaps
-XaaNoPixmapCache
-XaaNoScanlineCPUToScreenColorExpandFill
-XaaNoScanlineImageWriteRect
-XaaNoScreenToScreenColorExpandFill
-XaaNoSolidBresenhamLine
-XaaNoSolidFillRect
-XaaNoSolidFillTrap
-XaaNoSolidHorVertLine
-XaaNoSolidTwoPointLine
-
-
-Names used in previous versions:
-
-16Clocks
-8Clocks
-ClkDiv2
-EDO VRAM
-ExternDisp
-ExtFramBuf
-FastVRAM
-FavorBitBlt
-InternDisp
-NoBitBlt
-NoFontCache
-NoImageBlt
-NoMemAccess
-NoPciDisconnect
-NoPixmapCache
-NoProgramClocks
-NoSplitXfer
-OverrideBIOS
-OverrideValidateMode
-ProgLcdModeRegs
-ProgLcdModeStretch
-SlowDRAMrefresh
-SlowVRAM
-SwapHiBit
-
-
-5. Ramdac Names.
-
-Ramdac names should be consistent between drivers. Case, white space
-and underscore characters are ignored when comparing ramdac names. All
-names listed here are in lower case with all white space and underscores
-removed.
-
-
-6. Clock Chip Names.
-
-Clock chip names should be consistent between drivers. Case, white
-space and underscore characters are ignored when comparing clock chip
-names. All names listed here are in lower case with all white space
-and underscores removed.
-
-
-
-
-
-$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.18 2002/04/06 18:31:09 tsi Exp $
+This is the XFree86 driver/module registry. To avoid name space clashes and
+to maintain some consistency between drivers the important name spaces are
+maintained here.
+
+1. Module Names.
+
+Each module is required to have a unique name. Registered names are:
+
+GLcore
+acecad
+afb
+apm
+ark
+ati
+atimisc
+bitmap
+bt8xx
+calcomp
+cfb
+cfb16
+cfb24
+cfb32
+chips
+cirrus
+citron
+cyrix
+dbe
+ddc
+digitaledge
+dmc
+dri
+drm
+dynapro
+elo2300
+elographics
+extmod
+fb
+fbdev
+fbdevhw
+fi12x6
+freetype
+glide
+glint
+glx
+hyperpen
+i128
+i2c
+i740
+i810
+imstt
+int10
+joystick
+keyboard
+layer
+magellan
+magictouch
+mfb
+mga
+microtouch
+mouse
+msp34xx
+mutouch
+neomagic
+newport
+nv
+pcidata
+penmount
+pex5
+r128
+radeon
+rac
+ramdac
+record
+rendition
+s3
+s3virge
+savage
+shadow
+shadowfb
+siliconmotion
+sis
+spaceorb
+speedo
+summa
+sunbw2
+suncg14
+suncg3
+suncg6
+sunffb
+sunleo
+suntcx
+tdfx
+tga
+trident
+tseng
+type1
+v4l
+vbe
+vesa
+vga
+vgahw
+vmware
+void
+wacom
+xaa
+xf1bpp
+xf24_32bpp
+xf4bpp
+xf8_16bpp
+xf8_32bpp
+xf8_32wid
+xie
+xtrap
+xtt
+
+2. External Module Object Symbols.
+
+Each module is required to use a unique prefix or prefixes for all of
+its externally visible symbols. They should be unique without regard to
+case. Registered prefixes are:
+
+ati
+bt8xx
+cfb
+chips
+fi12x6
+glide
+glint
+mfb
+mga
+msp34xx
+neo
+permedia
+tseng
+vga
+vgahw
+vmware
+xaa
+xf1bpp
+xf4bpp
+
+3. Chipset Names.
+
+Each video driver is required to use a unique set of chipset names. Case,
+white space and underscore characters are ignored when comparing chipset
+names. All names listed here are in lower case with all white space and
+underscores removed. Registered chipset names are:
+
+ati
+ativga
+ct64200
+ct64300
+ct65520
+ct65525
+ct65530
+ct65535
+ct65540
+ct65545
+ct65546
+ct65548
+ct65550
+ct65554
+ct65555
+ct68554
+ct69000
+et4000
+et4000w32
+et4000w32i
+et4000w32p
+et6000
+et6100
+generic
+ibmvga
+ibm8514
+mach32
+mach64
+mach8
+mga2064w
+mga1064sg
+mga2164w
+mga2164wagp
+neo2070
+neo2090
+neo2093
+neo2097
+neo2160
+neo2200
+tipm2
+vgawonder
+voodoo
+
+4. Option Names.
+
+Option names and their usage should be consistent between drivers.
+Case, white space and underscore characters are ignored when comparing
+option names. The prefix "no" may be added or removed from boolean
+option names. All names listed here are in their preferred user-visible
+form. Some registered option names are:
+
+Types are: B = boolean, O = set/unset (no value), I = integer, S = string,
+ A = optional string, F = floating point number Q = frequency
+
+Scopes are: F = global flags, V = video driver, C = common (per screen),
+ I = input drivers, X = XAA, Xv = Xv extension, M = misc.
+
+Names currently in use:
+
+Name Type Scope Description
+----------------------------------------------------------------------------
+AllowMouseOpenFail B F ignore mouse dev open failure
+AllowNonLocalModInDev B F allow non-local mod of input devs
+AllowNonLocalXvidtune B F allow non-local VidMode connections
+BlankTime I F Screen saver timeout (min)
+DisableModInDev B F disallow changing input devs
+DisableVidModeExtension B F disable VidMode extension
+DontVTSwitch B F disable Ctrl-Alt-Fn
+DontZap B F disable Ctrl-Alt-BS sequence
+DontZoom B F disable Ctrl-Alt-+/-
+NoTrapSignals B F don't trap signals
+OffTime I F Time before DPMS off mode active (min)
+PciProbe1 O F use PCI probe algorithm 1
+PciProbe2 O F use PCI probe algorithm 2
+PciForceConfig1 O F force PCI config type 1
+PciForceConfig2 O F force PCI config type 2
+Pixmap I F depth 24 pixmap size (24 or 32)
+StandbyTime I F Time before DPMS standby active (min)
+SuspendTime I F Time before DPMS suspend mode active (min)
+
+BackingStore B C Enable backing store
+DDC B C Enable/disable DDC
+DDC1 B C Enable/disable DDC1
+DDC2 B C Enable/disable DDC2
+DPMS O C Enable DPMS
+MTRR B C Enable/disable setting MTRRs
+
+BaudRate I I Serial port baud rate
+ButtonNumber I I Button number (for touch screen?)
+ButtonThreshold I I ??
+ClearDTR O I Clear serial port DTR
+ClearRTS O I Clear serial port RTS
+DataBits I I Serial port data bits
+DemandLoad O I ??
+Device S I Device file name
+DeviceName S I Input device name
+FlowControl S I Serial flow control ("xon", "none")
+HistorySize I I ??
+MaxX I I Maximum X coordinate
+MaxY I I Maximum Y coordinate
+MinX I I Minimum X coordinate
+MinY I I Minimum Y coordinate
+Parity S I Serial port parity ("odd", "even", "none")
+ReportDelay I I ??
+ReportingMode S I may be "raw" or "scaled"
+ScreenNumber I I Screen number (for touch screen)
+SendCoreEvents B I Send core events
+StopBits I I Serial port stop bits
+SwapXY B I Swap the X and Y axes
+UntouchDelay I I ??
+Vmin I I Tty VMIN
+Vtime I I Tty VTIME
+
+
+18BitBus B V ??
+8Plus16 B V Enable depth 8 + depth 16 with overlay
+8Plus24 B V Enable depth 8 + depth 24 with overlay
+BlockWrite B V Enable/disable block write
+ColorKey I V Set the color key for overlay modes
+CompositeSync B V Composite sync
+CRTDisplay B V Force display on CRT, not LCD
+CRTScreen B V Display on CRT, not LCD (Obsolete)
+EarlyRasPrecharge O V Early RAS pre-charge
+FastDRAM O V Fast DRAM
+FifoAggressive O V Aggressive FIFO setting
+FifoConservative O V Conservative FIFO setting
+FifoModerate O V Moderate FIFO setting
+FireGL3000 B V Card is Diamond FireGL3000
+FixPanelSize B V ??
+FPClock8 Q V Flat panel clock for 8bpp fb (MHz)
+FPClock16 Q V Flat panel clock for 16bpp fb (MHz)
+FPClock24 Q V Flat panel clock for 24bpp fb (MHz)
+FPClock32 Q V Flat panel clock for 32bpp fb (MHz)
+FPMVRAM O V Fast page mode VRAM
+FramebufferWC B V Enable/disable WC for the framebuffer
+GlideDevice I V Selects which Voodoo board to use
+HiBitHigh O V High clock bit default to set
+HiBitLow O V High clock bit default to cleared
+HWClocks B V Enable/disable HW clocks
+HWCursor B V Enable/disable HW cursor
+LateRasPrecharge O V Late RAS pre-charge
+Legend O V Card is Legend ET4000
+LCDCenter B V Enable/disable centering for LCD displays
+Linear B V Enable/disable linear framebuffer
+MCLK Q V Specify the current MCLK value (MHz)
+MedDRAM B V Medium speed DRAM
+MemCfg1 I V ??
+MemCfg2 I V ??
+MGASDRAM B V Mga card has SDRAM
+MMIO B V Enable/disable memory mapped I/O
+MMIOCache B V Enable/Disable MMIO cache
+MuxThreshold I V Multiplexing threshold (kHz)
+NoAccel B V Disable/enable acceleration
+NoClockChip B V ??
+NoStretch B V Disable/enable stretching for LCD displays
+OnAtExit B V Leave video signal on when exiting server
+OverclockMem B V Enable memory overclocking
+Overlay A V Enable multi-depth/overlay. An optional
+ string "M,N" may be specified, where
+ M, N are the depths.
+PanelDisplay B V Force display on LCD
+PciBurst B V Enable/disable PCI burst mode
+PciRetry B V Enable/disable PCI retries
+ProbeClocks B V Force probe for non-programmable clocks
+ReferenceClock Q V Clock generator reference frequency
+RGBbits I V Number of significant bits per rgb
+Rotate S V Rotate the virtual display (CW or CCW)
+SetLCDClk Q V Set LCD clock (MHz)
+SetMclk Q V Set Memory Clock (MHz)
+ShadowFB B V Enable shadow framebuffer layer
+ShowCache B V Enable viewing of offscreen memory
+ShowOverscan O V Set the overscan area to a visible colour
+SlowDRAM O V Slow DRAM
+SlowEDODRAM O V Slow EDO DRAM
+STN B V STN screen type (??)
+SWCursor B V Enable/disable SW cursor
+SuspendHack B V ??
+SyncOnGreen B V Enable/disable sync on green
+TurboQueue B V Enable/disable turbo queue
+UseFBDev B V Use the fbdev driver interface
+UseModeLine B V Use Modeline (??)
+W32Interleave B V ??
+
+Buffers I Xv Number of buffers
+Device S Xv Device file name
+Expose B Xv Disable occlusion clipping (see DESIGN)
+FramesPerSec I Xv Max. refresh frequency
+
+XAA options. All are of type "O" and scope "X", and are self-explanatory
+
+XaaNoColor8x8PatternFillRect
+XaaNoColor8x8PatternFillTrap
+XaaNoCPUToScreenColorExpandFill
+XaaNoDashedBresenhamLine
+XaaNoDashedTwoPointLine
+XaaNoScreenToScreenCopy
+XaaNoImageReadRect
+XaaNoImageWriteRect
+XaaNoMono8x8PatternFillRect
+XaaNoMono8x8PatternFillTrap
+XaaNoOffscreenPixmaps
+XaaNoPixmapCache
+XaaNoScanlineCPUToScreenColorExpandFill
+XaaNoScanlineImageWriteRect
+XaaNoScreenToScreenColorExpandFill
+XaaNoSolidBresenhamLine
+XaaNoSolidFillRect
+XaaNoSolidFillTrap
+XaaNoSolidHorVertLine
+XaaNoSolidTwoPointLine
+
+
+Names used in previous versions:
+
+16Clocks
+8Clocks
+ClkDiv2
+EDO VRAM
+ExternDisp
+ExtFramBuf
+FastVRAM
+FavorBitBlt
+InternDisp
+NoBitBlt
+NoFontCache
+NoImageBlt
+NoMemAccess
+NoPciDisconnect
+NoPixmapCache
+NoProgramClocks
+NoSplitXfer
+OverrideBIOS
+OverrideValidateMode
+ProgLcdModeRegs
+ProgLcdModeStretch
+SlowDRAMrefresh
+SlowVRAM
+SwapHiBit
+
+
+5. Ramdac Names.
+
+Ramdac names should be consistent between drivers. Case, white space
+and underscore characters are ignored when comparing ramdac names. All
+names listed here are in lower case with all white space and underscores
+removed.
+
+
+6. Clock Chip Names.
+
+Clock chip names should be consistent between drivers. Case, white
+space and underscore characters are ignored when comparing clock chip
+names. All names listed here are in lower case with all white space
+and underscores removed.
+
+
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.18 2002/04/06 18:31:09 tsi Exp $
diff --git a/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre
index 8d09862b3..6547d38aa 100644
--- a/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -558,9 +558,6 @@ Default: off.
This tells the mousedrv(__drivermansuffix__) and vmmouse(__drivermansuffix__)
drivers to not report failure if the mouse device can't be opened/initialised.
It has no effect on the evdev(__drivermansuffix__) or other drivers.
-The previous functionality of allowing the server to start up even if
-the mouse device can't be opened/initialised is now handled by the
-AllowEmptyInput option.
Default: false.
.TP 7
.BI "Option \*qVTSysReq\*q \*q" boolean \*q
@@ -677,12 +674,6 @@ default.
Allow modules built for a different, potentially incompatible version of
the X server to load. Disabled by default.
.TP 7
-.BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q
-If enabled, don't add the standard keyboard and mouse drivers, if there are no
-input devices in the config file. Enabled by default if AutoAddDevices and
-AutoEnableDevices is enabled, otherwise disabled.
-If AllowEmptyInput is on, devices using the kbd, mouse or vmmouse driver are ignored.
-.TP 7
.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q
If this option is disabled, then no devices will be added from HAL events.
Enabled by default.
@@ -938,9 +929,6 @@ default. Devices with
disabled will be \*qfloating\*q and only accessible by clients employing the
X Input extension. This option controls the startup behavior only, a device
may be reattached or set floating at runtime.
-.TP 7
-.BI "Option \*qSendDragEvents\*q \*q" boolean \*q
-Send core events while dragging. Enabled by default.
.PP
For pointing devices, the following options control how the pointer
is accelerated or decelerated with respect to physical device motion. Most of
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index 9bf838e6c..578773a5a 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -828,11 +828,14 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
* is moved to a crtc with a lower refresh rate, or a crtc that just
* got enabled.
*/
- if (!(*ds->GetMSC)(pDraw, &ust, &current_msc))
- pPriv->last_swap_target = 0;
+ if (ds->GetMSC) {
+ if (!(*ds->GetMSC)(pDraw, &ust, &current_msc))
+ pPriv->last_swap_target = 0;
- if (current_msc < pPriv->last_swap_target)
- pPriv->last_swap_target = current_msc;
+ if (current_msc < pPriv->last_swap_target)
+ pPriv->last_swap_target = current_msc;
+
+ }
/*
* Swap target for this swap is last swap target + swap interval since
diff --git a/xorg-server/hw/xfree86/loader/sdksyms.sh b/xorg-server/hw/xfree86/loader/sdksyms.sh
index ca1474371..6c45ec45e 100644
--- a/xorg-server/hw/xfree86/loader/sdksyms.sh
+++ b/xorg-server/hw/xfree86/loader/sdksyms.sh
@@ -19,7 +19,6 @@ cat > sdksyms.c << EOF
#include "mipict.h"
#include "glyphstr.h"
#include "picturestr.h"
-#include "renderedge.h"
/* fb/Makefile.am -- module */
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index beb9be66e..d421a942f 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -2964,8 +2964,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
int size;
#endif
- if (output->MonInfo != NULL)
- free(output->MonInfo);
+ free(output->MonInfo);
output->MonInfo = edid_mon;
diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c
index f846d60ea..655857597 100644
--- a/xorg-server/hw/xfree86/modes/xf86Rotate.c
+++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c
@@ -168,7 +168,7 @@ xf86CrtcDamageShadow (xf86CrtcPtr crtc)
if (damage_box.x2 > pScreen->width) damage_box.x2 = pScreen->width;
if (damage_box.y2 > pScreen->height) damage_box.y2 = pScreen->height;
RegionInit(&damage_region, &damage_box, 1);
- DamageRegionAppend (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
&damage_region);
RegionUninit(&damage_region);
crtc->shadowClear = TRUE;
diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
index 029d3a989..a0a3b2758 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c
@@ -124,8 +124,17 @@ xf86EnableIO()
FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno));
return FALSE;
}
+#if 0
+ /*
+ * Trapping disabled for now, as some VBIOSes (mga-g450 notably) use these
+ * ports, and the int10 wrapper is not emulating them. (Note that it's
+ * effectively what happens in the Linux variant too, as iopl() is used
+ * there, making the ioperm() meaningless.)
+ *
+ * Reenable this when int10 gets fixed. */
ioperm(0x40,4,0); /* trap access to the timer chip */
ioperm(0x60,4,0); /* trap access to the keyboard controller */
+#endif
return TRUE;
}
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
index 687483113..7be65dcf9 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_init.c
@@ -277,9 +277,7 @@ xf86OpenConsole(void)
tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
/* need to keep the buffer clean, else the kernel gets angry */
- if (xf86Info.allowEmptyInput)
- console_handler = xf86AddGeneralHandler(xf86Info.consoleFd,
- drain_console, NULL);
+ xf86SetConsoleHandler(drain_console, NULL);
/* we really should have a InitOSInputDevices() function instead
* of Init?$#*&Device(). So I just place it here */
diff --git a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
index 8aa2506a9..0311bdf15 100644
--- a/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
+++ b/xorg-server/hw/xfree86/os-support/linux/lnx_video.c
@@ -530,6 +530,8 @@ xf86EnableIO(void)
return FALSE;
}
# if !defined(__alpha__)
+ /* XXX: this is actually not trapping anything because of iopl(3)
+ * above */
ioperm(0x40,4,0); /* trap access to the timer chip */
ioperm(0x60,4,0); /* trap access to the keyboard controller */
# endif
diff --git a/xorg-server/hw/xfree86/x86emu/ops.c b/xorg-server/hw/xfree86/x86emu/ops.c
index 740a3a58d..c0cfbd8c1 100644
--- a/xorg-server/hw/xfree86/x86emu/ops.c
+++ b/xorg-server/hw/xfree86/x86emu/ops.c
@@ -9691,15 +9691,23 @@ Handles opcode 0xe9
****************************************************************************/
static void x86emuOp_jump_near_IMM(u8 X86EMU_UNUSED(op1))
{
- int ip;
+ u32 ip;
START_OF_INSTR();
DECODE_PRINTF("JMP\t");
- ip = (s16)fetch_word_imm();
- ip += (s16)M.x86.R_IP;
- DECODE_PRINTF2("%04x\n", (u16)ip);
- TRACE_AND_STEP();
- M.x86.R_IP = (u16)ip;
+ if (M.x86.mode & SYSMODE_PREFIX_DATA) {
+ ip = (u32)fetch_long_imm();
+ ip += (u32)M.x86.R_EIP;
+ DECODE_PRINTF2("%08x\n", (u32)ip);
+ TRACE_AND_STEP();
+ M.x86.R_EIP = (u32)ip;
+ } else {
+ ip = (s16)fetch_word_imm();
+ ip += (s16)M.x86.R_IP;
+ DECODE_PRINTF2("%04x\n", (u16)ip);
+ TRACE_AND_STEP();
+ M.x86.R_IP = (u16)ip;
+ }
DECODE_CLEAR_SEGOVR();
END_OF_INSTR();
}
diff --git a/xorg-server/hw/xnest/Events.c b/xorg-server/hw/xnest/Events.c
index 88970bbe0..6b8edf143 100644
--- a/xorg-server/hw/xnest/Events.c
+++ b/xorg-server/hw/xnest/Events.c
@@ -25,6 +25,7 @@ is" without express or implied warranty.
#include "windowstr.h"
#include "servermd.h"
#include "inputstr.h"
+#include "inpututils.h"
#include "mi.h"
@@ -117,6 +118,7 @@ xnestCollectEvents(void)
{
XEvent X;
int i, n, valuators[2];
+ ValuatorMask mask;
ScreenPtr pScreen;
GetEventList(&xnestEvents);
@@ -133,19 +135,21 @@ xnestCollectEvents(void)
break;
case ButtonPress:
+ valuator_mask_set_range(&mask, 0, 0, NULL);
xnestUpdateModifierState(X.xkey.state);
lastEventTime = GetTimeInMillis();
n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress,
- X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ X.xbutton.button, POINTER_RELATIVE, &mask);
for (i = 0; i < n; i++)
mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
break;
case ButtonRelease:
+ valuator_mask_set_range(&mask, 0, 0, NULL);
xnestUpdateModifierState(X.xkey.state);
lastEventTime = GetTimeInMillis();
n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease,
- X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
+ X.xbutton.button, POINTER_RELATIVE, &mask);
for (i = 0; i < n; i++)
mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
break;
@@ -153,9 +157,10 @@ xnestCollectEvents(void)
case MotionNotify:
valuators[0] = X.xmotion.x;
valuators[1] = X.xmotion.y;
+ valuator_mask_set_range(&mask, 0, 2, valuators);
lastEventTime = GetTimeInMillis();
n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
- 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ 0, POINTER_ABSOLUTE, &mask);
for (i = 0; i < n; i++)
mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
break;
@@ -186,9 +191,10 @@ xnestCollectEvents(void)
NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x, X.xcrossing.y);
valuators[0] = X.xcrossing.x;
valuators[1] = X.xcrossing.y;
+ valuator_mask_set_range(&mask, 0, 2, valuators);
lastEventTime = GetTimeInMillis();
n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
- 0, POINTER_ABSOLUTE, 0, 2, valuators);
+ 0, POINTER_ABSOLUTE, &mask);
for (i = 0; i < n; i++)
mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event);
xnestDirectInstallColormaps(pScreen);
diff --git a/xorg-server/hw/xquartz/darwin.c b/xorg-server/hw/xquartz/darwin.c
index 7814967b8..f217f4c33 100644
--- a/xorg-server/hw/xquartz/darwin.c
+++ b/xorg-server/hw/xquartz/darwin.c
@@ -314,10 +314,9 @@ static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), NAXES,
axes_labels);
- pPointer->valuator->mode = Absolute; // Relative
InitAbsoluteClassDeviceStruct(pPointer);
-// InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
-// InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+// InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
+// InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
break;
case DEVICE_ON:
pPointer->public.on = TRUE;
@@ -362,15 +361,14 @@ static int DarwinTabletProc(DeviceIntPtr pPointer, int what) {
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), NAXES,
axes_labels);
- pPointer->valuator->mode = Absolute; // Relative
InitProximityClassDeviceStruct(pPointer);
InitAbsoluteClassDeviceStruct(pPointer);
- InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 3, axes_labels[3], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 4, axes_labels[4], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 3, axes_labels[3], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 4, axes_labels[4], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1, Absolute);
// pPointer->use = IsXExtensionDevice;
break;
case DEVICE_ON:
@@ -468,7 +466,6 @@ void InitInput( int argc, char **argv )
XkbSetRulesDflts(&rmlvo);
darwinKeyboard = AddInputDevice(serverClient, DarwinKeybdProc, TRUE);
- RegisterKeyboardDevice( darwinKeyboard );
darwinKeyboard->name = strdup("keyboard");
/* here's the snippet from the current gdk sources:
@@ -486,19 +483,15 @@ void InitInput( int argc, char **argv )
*/
darwinPointer = AddInputDevice(serverClient, DarwinMouseProc, TRUE);
- RegisterPointerDevice( darwinPointer );
darwinPointer->name = strdup("pointer");
darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
- RegisterPointerDevice( darwinTabletStylus );
darwinTabletStylus->name = strdup("pen");
darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
- RegisterPointerDevice( darwinTabletCursor );
darwinTabletCursor->name = strdup("cursor");
darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
- RegisterPointerDevice( darwinTabletEraser );
darwinTabletEraser->name = strdup("eraser");
darwinTabletCurrent = darwinTabletStylus;
diff --git a/xorg-server/hw/xquartz/darwinEvents.c b/xorg-server/hw/xquartz/darwinEvents.c
index a00c89ecd..ec320b3a5 100644
--- a/xorg-server/hw/xquartz/darwinEvents.c
+++ b/xorg-server/hw/xquartz/darwinEvents.c
@@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group.
#include "windowstr.h"
#include "pixmapstr.h"
#include "inputstr.h"
+#include "inpututils.h"
#include "eventstr.h"
#include "mi.h"
#include "scrnintstr.h"
@@ -464,8 +465,10 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
darwinEvents_lock(); {
+ ValuatorMask mask;
+ valuator_mask_set_range(&mask, 0, (pDev == darwinTabletCurrent) ? 5 : 2, valuators);
num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button,
- POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators);
+ POINTER_ABSOLUTE, &mask);
for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event);
if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
@@ -507,8 +510,9 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f);
darwinEvents_lock(); {
- num_events = GetProximityEvents(darwinEvents, pDev, ev_type,
- 0, 5, valuators);
+ ValuatorMask mask;
+ valuator_mask_set_range(&mask, 0, 5, valuators);
+ num_events = GetProximityEvents(darwinEvents, pDev, ev_type, &mask);
for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event);
if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
diff --git a/xorg-server/hw/xquartz/darwinXinput.c b/xorg-server/hw/xquartz/darwinXinput.c
index 958c7cdd4..85ce9d608 100644
--- a/xorg-server/hw/xquartz/darwinXinput.c
+++ b/xorg-server/hw/xquartz/darwinXinput.c
@@ -82,78 +82,6 @@ CloseInputDevice(DeviceIntPtr d, ClientPtr client)
DEBUG_LOG("CloseInputDevice(%p, %p)\n", d, client);
}
-/***********************************************************************
- *
- * 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(void)
-{
- /**********************************************************************
- for each uninitialized device, do something like:
-
- DeviceIntPtr dev;
- DeviceProc deviceProc;
- pointer private;
-
- dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
- dev->public.devicePrivate = private;
- RegisterOtherDevice(dev);
- dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
- ************************************************************************/
- DEBUG_LOG("AddOtherInputDevices\n");
-}
-
-/***********************************************************************
- *
- * Caller: ProcXOpenDevice
- *
- * This is the implementation-dependent routine to open an input device.
- * 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. This entry point is for the latter type of
- * implementation.
- *
- * If the physical device is not already open, do it here. In this case,
- * you need to keep track of the fact that one or more clients has the
- * device open, and physically close it when the last client that has
- * it open does an XCloseDevice.
- *
- * The default implementation is to do nothing (assume all input devices
- * are opened during X server initialization and kept open).
- *
- */
-
-void
-OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
-{
- DEBUG_LOG("OpenInputDevice(%p, %p, %p)\n", dev, client, status);
-}
-
/****************************************************************************
*
* Caller: ProcXSetDeviceMode
diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c
index c09610c62..5f51fc457 100644
--- a/xorg-server/hw/xwin/InitInput.c
+++ b/xorg-server/hw/xwin/InitInput.c
@@ -122,10 +122,6 @@ InitInput (int argc, char *argv[])
g_pwinPointer = AddInputDevice (serverClient, winMouseProc, TRUE);
g_pwinKeyboard = AddInputDevice (serverClient, winKeybdProc, TRUE);
-
- RegisterPointerDevice (g_pwinPointer);
- RegisterKeyboardDevice (g_pwinKeyboard);
-
g_pwinPointer->name = strdup("Windows mouse");
g_pwinKeyboard->name = strdup("Windows keyboard");
diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c
index 8b265c70b..a7234a6cd 100644
--- a/xorg-server/hw/xwin/glx/indirect.c
+++ b/xorg-server/hw/xwin/glx/indirect.c
@@ -682,10 +682,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
unsigned int buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
if (buffer_size > 0)
{
- if (screen->base.GLXextensions != NULL)
- {
- free(screen->base.GLXextensions);
- }
+ free(screen->base.GLXextensions);
screen->base.GLXextensions = xnfalloc(buffer_size);
__glXGetExtensionString(screen->glx_enable_bits, screen->base.GLXextensions);
diff --git a/xorg-server/hw/xwin/wincmap.c b/xorg-server/hw/xwin/wincmap.c
index 9da03888d..6cb037243 100644
--- a/xorg-server/hw/xwin/wincmap.c
+++ b/xorg-server/hw/xwin/wincmap.c
@@ -1,674 +1,671 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, 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, 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 XFREE86 PROJECT 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 XFree86 Project
- *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 XFree86 Project.
- *
- * Authors: Dakshinamurthy Karra
- * Suhaib M Siddiqi
- * Peter Busch
- * Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-
-/*
- * Local prototypes
- */
-
-static int
-winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps);
-
-static void
-winStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs);
-
-static void
-winInstallColormap (ColormapPtr pmap);
-
-static void
-winUninstallColormap (ColormapPtr pmap);
-
-static void
-winResolveColor (unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual);
-
-static Bool
-winCreateColormap (ColormapPtr pmap);
-
-static void
-winDestroyColormap (ColormapPtr pmap);
-
-static Bool
-winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap);
-
-static Bool
-winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap);
-
-
-/*
- * Set screen functions for colormaps
- */
-
-void
-winSetColormapFunctions (ScreenPtr pScreen)
-{
- pScreen->CreateColormap = winCreateColormap;
- pScreen->DestroyColormap = winDestroyColormap;
- pScreen->InstallColormap = winInstallColormap;
- pScreen->UninstallColormap = winUninstallColormap;
- pScreen->ListInstalledColormaps = winListInstalledColormaps;
- pScreen->StoreColors = winStoreColors;
- pScreen->ResolveColor = winResolveColor;
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-/*
- * Walk the list of installed colormaps, filling the pmaps list
- * with the resource ids of the installed maps, and return
- * a count of the total number of installed maps.
- */
-static int
-winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps)
-{
- winScreenPriv(pScreen);
-
- /*
- * There will only be one installed colormap, so we only need
- * to return one id, and the count of installed maps will always
- * be one.
- */
- *pmaps = pScreenPriv->pcmapInstalled->mid;
- return 1;
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-/* See Programming Windows - p. 663 */
-static void
-winInstallColormap (ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- winScreenPriv(pScreen);
- ColormapPtr oldpmap = pScreenPriv->pcmapInstalled;
-
-#if CYGDEBUG
- winDebug ("winInstallColormap\n");
-#endif
-
- /* Did the colormap actually change? */
- if (pColormap != oldpmap)
- {
-#if CYGDEBUG
- winDebug ("winInstallColormap - Colormap has changed, attempt "
- "to install.\n");
-#endif
-
- /* Was there a previous colormap? */
- if (oldpmap != (ColormapPtr) None)
- {
- /* There was a previous colormap; tell clients it is gone */
- WalkTree (pColormap->pScreen, TellLostMap, (char *)&oldpmap->mid);
- }
-
- /* Install new colormap */
- pScreenPriv->pcmapInstalled = pColormap;
- WalkTree (pColormap->pScreen, TellGainedMap, (char *)&pColormap->mid);
-
- /* Call the engine specific colormap install procedure */
- if (!((*pScreenPriv->pwinInstallColormap) (pColormap)))
- {
- winErrorFVerb (2, "winInstallColormap - Screen specific colormap install "
- "procedure failed. Continuing, but colors may be "
- "messed up from now on.\n");
- }
- }
-
- /* Save a pointer to the newly installed colormap */
- pScreenPriv->pcmapInstalled = pColormap;
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-static void
-winUninstallColormap (ColormapPtr pmap)
-{
- winScreenPriv(pmap->pScreen);
- ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
-
-#if CYGDEBUG
- winDebug ("winUninstallColormap\n");
-#endif
-
- /* Is the colormap currently installed? */
- if (pmap != curpmap)
- {
- /* Colormap not installed, nothing to do */
- return;
- }
-
- /* Clear the installed colormap flag */
- pScreenPriv->pcmapInstalled = NULL;
-
- /*
- * NOTE: The default colormap does not get "uninstalled" before
- * it is destroyed.
- */
-
- /* Install the default cmap in place of the cmap to be uninstalled */
- if (pmap->mid != pmap->pScreen->defColormap)
- {
- dixLookupResourceByType((pointer) &curpmap, pmap->pScreen->defColormap,
- RT_COLORMAP, NullClient, DixUnknownAccess);
- (*pmap->pScreen->InstallColormap) (curpmap);
- }
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-static void
-winStoreColors (ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs)
-{
- ScreenPtr pScreen = pmap->pScreen;
- winScreenPriv(pScreen);
- winCmapPriv(pmap);
- int i;
- unsigned short nRed, nGreen, nBlue;
-
-#if CYGDEBUG
- if (ndef != 1)
- winDebug ("winStoreColors - ndef: %d\n",
- ndef);
-#endif
-
- /* Save the new colors in the colormap privates */
- for (i = 0; i < ndef; ++i)
- {
- /* Adjust the colors from the X color spec to the Windows color spec */
- nRed = pdefs[i].red >> 8;
- nGreen = pdefs[i].green >> 8;
- nBlue = pdefs[i].blue >> 8;
-
- /* Copy the colors to a palette entry table */
- pCmapPriv->peColors[pdefs[0].pixel + i].peRed = nRed;
- pCmapPriv->peColors[pdefs[0].pixel + i].peGreen = nGreen;
- pCmapPriv->peColors[pdefs[0].pixel + i].peBlue = nBlue;
-
- /* Copy the colors to a RGBQUAD table */
- pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbRed = nRed;
- pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbGreen = nGreen;
- pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbBlue = nBlue;
-
-#if CYGDEBUG
- winDebug ("winStoreColors - nRed %d nGreen %d nBlue %d\n",
- nRed, nGreen, nBlue);
-#endif
- }
-
- /* Call the engine specific store colors procedure */
- if (!((pScreenPriv->pwinStoreColors) (pmap, ndef, pdefs)))
- {
- winErrorFVerb (2, "winStoreColors - Engine cpecific color storage procedure "
- "failed. Continuing, but colors may be messed up from now "
- "on.\n");
- }
-}
-
-
-/* See Porting Layer Definition - p. 30 */
-static void
-winResolveColor (unsigned short *pred,
- unsigned short *pgreen,
- unsigned short *pblue,
- VisualPtr pVisual)
-{
-#if CYGDEBUG
- winDebug ("winResolveColor ()\n");
-#endif
-
- miResolveColor (pred, pgreen, pblue, pVisual);
-}
-
-
-/* See Porting Layer Definition - p. 29 */
-static Bool
-winCreateColormap (ColormapPtr pmap)
-{
- winPrivCmapPtr pCmapPriv = NULL;
- ScreenPtr pScreen = pmap->pScreen;
- winScreenPriv(pScreen);
-
-#if CYGDEBUG
- winDebug ("winCreateColormap\n");
-#endif
-
- /* Allocate colormap privates */
- if (!winAllocateCmapPrivates (pmap))
- {
- ErrorF ("winCreateColorma - Couldn't allocate cmap privates\n");
- return FALSE;
- }
-
- /* Get a pointer to the newly allocated privates */
- pCmapPriv = winGetCmapPriv (pmap);
-
- /*
- * FIXME: This is some evil hackery to help in handling some X clients
- * that expect the top pixel to be white. This "help" only lasts until
- * some client overwrites the top colormap entry.
- *
- * We don't want to actually allocate the top entry, as that causes
- * problems with X clients that need 7 planes (128 colors) in the default
- * colormap, such as Magic 7.1.
- */
- pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbRed = 255;
- pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbGreen = 255;
- pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbBlue = 255;
- pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peRed = 255;
- pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peGreen = 255;
- pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peBlue = 255;
-
- /* Call the engine specific colormap initialization procedure */
- if (!((*pScreenPriv->pwinCreateColormap) (pmap)))
- {
- ErrorF ("winCreateColormap - Engine specific colormap creation "
- "procedure failed. Aborting.\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-/* See Porting Layer Definition - p. 29, 30 */
-static void
-winDestroyColormap (ColormapPtr pColormap)
-{
- winScreenPriv(pColormap->pScreen);
- winCmapPriv(pColormap);
-
- /* Call the engine specific colormap destruction procedure */
- if (!((*pScreenPriv->pwinDestroyColormap) (pColormap)))
- {
- winErrorFVerb (2, "winDestroyColormap - Engine specific colormap destruction "
- "procedure failed. Continuing, but it is possible that memory "
- "was leaked, or that colors will be messed up from now on.\n");
- }
-
- /* Free the colormap privates */
- free (pCmapPriv);
- winSetCmapPriv (pColormap, NULL);
-
-#if CYGDEBUG
- winDebug ("winDestroyColormap - Returning\n");
-#endif
-}
-
-
-/*
- * Internal function to load the palette used by the Shadow DIB
- */
-
-static Bool
-winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap)
-{
- winScreenPriv(pScreen);
- int i;
- Pixel pixel; /* Pixel == CARD32 */
- CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
- UINT uiColorsRetrieved = 0;
- RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
-
- /* Get the color table for the screen */
- uiColorsRetrieved = GetDIBColorTable (pScreenPriv->hdcScreen,
- 0,
- WIN_NUM_PALETTE_ENTRIES,
- rgbColors);
- if (uiColorsRetrieved == 0)
- {
- ErrorF ("winGetPaletteDIB - Could not retrieve screen color table\n");
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug ("winGetPaletteDIB - Retrieved %d colors from DIB\n",
- uiColorsRetrieved);
-#endif
-
- /* Set the DIB color table to the default screen palette */
- if (SetDIBColorTable (pScreenPriv->hdcShadow,
- 0,
- uiColorsRetrieved,
- rgbColors) == 0)
- {
- ErrorF ("winGetPaletteDIB - SetDIBColorTable () failed\n");
- return FALSE;
- }
-
- /* Alloc each color in the DIB color table */
- for (i = 0; i < uiColorsRetrieved; ++i)
- {
- pixel = i;
-
- /* Extract the color values for current palette entry */
- nRed = rgbColors[i].rgbRed << 8;
- nGreen = rgbColors[i].rgbGreen << 8;
- nBlue = rgbColors[i].rgbBlue << 8;
-
-#if CYGDEBUG
- winDebug ("winGetPaletteDIB - Allocating a color: %d; "
- "%d %d %d\n",
- pixel, nRed, nGreen, nBlue);
-#endif
-
- /* Allocate a entry in the X colormap */
- if (AllocColor (pcmap,
- &nRed,
- &nGreen,
- &nBlue,
- &pixel,
- 0) != Success)
- {
- ErrorF ("winGetPaletteDIB - AllocColor () failed, pixel %d\n",
- i);
- return FALSE;
- }
-
- if (i != pixel
- || nRed != rgbColors[i].rgbRed
- || nGreen != rgbColors[i].rgbGreen
- || nBlue != rgbColors[i].rgbBlue)
- {
- winDebug ("winGetPaletteDIB - Got: %d; "
- "%d %d %d\n",
- (int) pixel, nRed, nGreen, nBlue);
- }
-
- /* FIXME: Not sure that this bit is needed at all */
- pcmap->red[i].co.local.red = nRed;
- pcmap->red[i].co.local.green = nGreen;
- pcmap->red[i].co.local.blue = nBlue;
- }
-
- /* System is using a colormap */
- /* Set the black and white pixel indices */
- pScreen->whitePixel = uiColorsRetrieved - 1;
- pScreen->blackPixel = 0;
-
- return TRUE;
-}
-
-
-/*
- * Internal function to load the standard system palette being used by DD
- */
-
-static Bool
-winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
-{
- int i;
- Pixel pixel; /* Pixel == CARD32 */
- CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
- UINT uiSystemPaletteEntries;
- LPPALETTEENTRY ppeColors = NULL;
- HDC hdc = NULL;
-
- /* Get a DC to obtain the default palette */
- hdc = GetDC (NULL);
- if (hdc == NULL)
- {
- ErrorF ("winGetPaletteDD - Couldn't get a DC\n");
- return FALSE;
- }
-
- /* Get the number of entries in the system palette */
- uiSystemPaletteEntries = GetSystemPaletteEntries (hdc,
- 0, 0, NULL);
- if (uiSystemPaletteEntries == 0)
- {
- ErrorF ("winGetPaletteDD - Unable to determine number of "
- "system palette entries\n");
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug ("winGetPaletteDD - uiSystemPaletteEntries %d\n",
- uiSystemPaletteEntries);
-#endif
-
- /* Allocate palette entries structure */
- ppeColors = malloc (uiSystemPaletteEntries * sizeof (PALETTEENTRY));
- if (ppeColors == NULL)
- {
- ErrorF ("winGetPaletteDD - malloc () for colormap failed\n");
- return FALSE;
- }
-
- /* Get system palette entries */
- GetSystemPaletteEntries (hdc,
- 0, uiSystemPaletteEntries, ppeColors);
-
- /* Allocate an X colormap entry for every system palette entry */
- for (i = 0; i < uiSystemPaletteEntries; ++i)
- {
- pixel = i;
-
- /* Extract the color values for current palette entry */
- nRed = ppeColors[i].peRed << 8;
- nGreen = ppeColors[i].peGreen << 8;
- nBlue = ppeColors[i].peBlue << 8;
-#if CYGDEBUG
- winDebug ("winGetPaletteDD - Allocating a color: %d; "
- "%d %d %d\n",
- pixel, nRed, nGreen, nBlue);
-#endif
- if (AllocColor (pcmap,
- &nRed,
- &nGreen,
- &nBlue,
- &pixel,
- 0) != Success)
- {
- ErrorF ("winGetPaletteDD - AllocColor () failed, pixel %d\n",
- i);
- free (ppeColors);
- ppeColors = NULL;
- return FALSE;
- }
-
- pcmap->red[i].co.local.red = nRed;
- pcmap->red[i].co.local.green = nGreen;
- pcmap->red[i].co.local.blue = nBlue;
- }
-
- /* System is using a colormap */
- /* Set the black and white pixel indices */
- pScreen->whitePixel = uiSystemPaletteEntries - 1;
- pScreen->blackPixel = 0;
-
- /* Free colormap */
- if (ppeColors != NULL)
- {
- free (ppeColors);
- ppeColors = NULL;
- }
-
- /* Free the DC */
- if (hdc != NULL)
- {
- ReleaseDC (NULL, hdc);
- hdc = NULL;
- }
-
- return TRUE;
-}
-
-
-/*
- * Install the standard fb colormap, or the GDI colormap,
- * depending on the current screen depth.
- */
-
-Bool
-winCreateDefColormap (ScreenPtr pScreen)
-{
- winScreenPriv(pScreen);
- winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- unsigned short zero = 0, ones = 0xFFFF;
- VisualPtr pVisual = pScreenPriv->pRootVisual;
- ColormapPtr pcmap = NULL;
- Pixel wp, bp;
-
-#if CYGDEBUG
- winDebug ("winCreateDefColormap\n");
-#endif
-
- /* Use standard fb colormaps for non palettized color modes */
- if (pScreenInfo->dwBPP > 8)
- {
- winDebug ("winCreateDefColormap - Deferring to " \
- "fbCreateDefColormap ()\n");
- return fbCreateDefColormap (pScreen);
- }
-
- /*
- * AllocAll for non-Dynamic visual classes,
- * AllocNone for Dynamic visual classes.
- */
-
- /*
- * Dynamic visual classes allow the colors of the color map
- * to be changed by clients.
- */
-
-#if CYGDEBUG
- winDebug ("winCreateDefColormap - defColormap: %d\n",
- pScreen->defColormap);
-#endif
-
- /* Allocate an X colormap, owned by client 0 */
- if (CreateColormap (pScreen->defColormap,
- pScreen,
- pVisual,
- &pcmap,
- (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
- 0) != Success)
- {
- ErrorF ("winCreateDefColormap - CreateColormap failed\n");
- return FALSE;
- }
- if (pcmap == NULL)
- {
- ErrorF ("winCreateDefColormap - Colormap could not be created\n");
- return FALSE;
- }
-
-#if CYGDEBUG
- winDebug ("winCreateDefColormap - Created a colormap\n");
-#endif
-
- /* Branch on the visual class */
- if (!(pVisual->class & DynamicClass))
- {
- /* Branch on engine type */
- if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI)
- {
- /* Load the colors being used by the Shadow DIB */
- if (!winGetPaletteDIB (pScreen, pcmap))
- {
- ErrorF ("winCreateDefColormap - Couldn't get DIB colors\n");
- return FALSE;
- }
- }
- else
- {
- /* Load the colors from the default system palette */
- if (!winGetPaletteDD (pScreen, pcmap))
- {
- ErrorF ("winCreateDefColormap - Couldn't get colors "
- "for DD\n");
- return FALSE;
- }
- }
- }
- else
- {
- wp = pScreen->whitePixel;
- bp = pScreen->blackPixel;
-
- /* Allocate a black and white pixel */
- if ((AllocColor (pcmap, &ones, &ones, &ones, &wp, 0) !=
- Success)
- ||
- (AllocColor (pcmap, &zero, &zero, &zero, &bp, 0) !=
- Success))
- {
- ErrorF ("winCreateDefColormap - Couldn't allocate bp or wp\n");
- return FALSE;
- }
-
- pScreen->whitePixel = wp;
- pScreen->blackPixel = bp;
-
-#if 0
- /* Have to reserve first 10 and last ten pixels in DirectDraw windowed */
- if (pScreenInfo->dwEngine != WIN_SERVER_SHADOW_GDI)
- {
- int k;
- Pixel p;
-
- for (k = 1; k < 10; ++k)
- {
- p = k;
- if (AllocColor (pcmap, &ones, &ones, &ones, &p, 0) != Success)
- FatalError ("Foo!\n");
- }
-
- for (k = 245; k < 255; ++k)
- {
- p = k;
- if (AllocColor (pcmap, &zero, &zero, &zero, &p, 0) != Success)
- FatalError ("Baz!\n");
- }
- }
-#endif
- }
-
- /* Install the created colormap */
- (*pScreen->InstallColormap)(pcmap);
-
-#if CYGDEBUG
- winDebug ("winCreateDefColormap - Returning\n");
-#endif
-
- return TRUE;
-}
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, 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, 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 XFREE86 PROJECT 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 XFree86 Project
+ *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 XFree86 Project.
+ *
+ * Authors: Dakshinamurthy Karra
+ * Suhaib M Siddiqi
+ * Peter Busch
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * Local prototypes
+ */
+
+static int
+winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps);
+
+static void
+winStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs);
+
+static void
+winInstallColormap (ColormapPtr pmap);
+
+static void
+winUninstallColormap (ColormapPtr pmap);
+
+static void
+winResolveColor (unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue,
+ VisualPtr pVisual);
+
+static Bool
+winCreateColormap (ColormapPtr pmap);
+
+static void
+winDestroyColormap (ColormapPtr pmap);
+
+static Bool
+winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap);
+
+static Bool
+winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap);
+
+
+/*
+ * Set screen functions for colormaps
+ */
+
+void
+winSetColormapFunctions (ScreenPtr pScreen)
+{
+ pScreen->CreateColormap = winCreateColormap;
+ pScreen->DestroyColormap = winDestroyColormap;
+ pScreen->InstallColormap = winInstallColormap;
+ pScreen->UninstallColormap = winUninstallColormap;
+ pScreen->ListInstalledColormaps = winListInstalledColormaps;
+ pScreen->StoreColors = winStoreColors;
+ pScreen->ResolveColor = winResolveColor;
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+/*
+ * Walk the list of installed colormaps, filling the pmaps list
+ * with the resource ids of the installed maps, and return
+ * a count of the total number of installed maps.
+ */
+static int
+winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps)
+{
+ winScreenPriv(pScreen);
+
+ /*
+ * There will only be one installed colormap, so we only need
+ * to return one id, and the count of installed maps will always
+ * be one.
+ */
+ *pmaps = pScreenPriv->pcmapInstalled->mid;
+ return 1;
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+/* See Programming Windows - p. 663 */
+static void
+winInstallColormap (ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ winScreenPriv(pScreen);
+ ColormapPtr oldpmap = pScreenPriv->pcmapInstalled;
+
+#if CYGDEBUG
+ winDebug ("winInstallColormap\n");
+#endif
+
+ /* Did the colormap actually change? */
+ if (pColormap != oldpmap)
+ {
+#if CYGDEBUG
+ winDebug ("winInstallColormap - Colormap has changed, attempt "
+ "to install.\n");
+#endif
+
+ /* Was there a previous colormap? */
+ if (oldpmap != (ColormapPtr) None)
+ {
+ /* There was a previous colormap; tell clients it is gone */
+ WalkTree (pColormap->pScreen, TellLostMap, (char *)&oldpmap->mid);
+ }
+
+ /* Install new colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+ WalkTree (pColormap->pScreen, TellGainedMap, (char *)&pColormap->mid);
+
+ /* Call the engine specific colormap install procedure */
+ if (!((*pScreenPriv->pwinInstallColormap) (pColormap)))
+ {
+ winErrorFVerb (2, "winInstallColormap - Screen specific colormap install "
+ "procedure failed. Continuing, but colors may be "
+ "messed up from now on.\n");
+ }
+ }
+
+ /* Save a pointer to the newly installed colormap */
+ pScreenPriv->pcmapInstalled = pColormap;
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+static void
+winUninstallColormap (ColormapPtr pmap)
+{
+ winScreenPriv(pmap->pScreen);
+ ColormapPtr curpmap = pScreenPriv->pcmapInstalled;
+
+#if CYGDEBUG
+ winDebug ("winUninstallColormap\n");
+#endif
+
+ /* Is the colormap currently installed? */
+ if (pmap != curpmap)
+ {
+ /* Colormap not installed, nothing to do */
+ return;
+ }
+
+ /* Clear the installed colormap flag */
+ pScreenPriv->pcmapInstalled = NULL;
+
+ /*
+ * NOTE: The default colormap does not get "uninstalled" before
+ * it is destroyed.
+ */
+
+ /* Install the default cmap in place of the cmap to be uninstalled */
+ if (pmap->mid != pmap->pScreen->defColormap)
+ {
+ dixLookupResourceByType((pointer) &curpmap, pmap->pScreen->defColormap,
+ RT_COLORMAP, NullClient, DixUnknownAccess);
+ (*pmap->pScreen->InstallColormap) (curpmap);
+ }
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+static void
+winStoreColors (ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ winScreenPriv(pScreen);
+ winCmapPriv(pmap);
+ int i;
+ unsigned short nRed, nGreen, nBlue;
+
+#if CYGDEBUG
+ if (ndef != 1)
+ winDebug ("winStoreColors - ndef: %d\n",
+ ndef);
+#endif
+
+ /* Save the new colors in the colormap privates */
+ for (i = 0; i < ndef; ++i)
+ {
+ /* Adjust the colors from the X color spec to the Windows color spec */
+ nRed = pdefs[i].red >> 8;
+ nGreen = pdefs[i].green >> 8;
+ nBlue = pdefs[i].blue >> 8;
+
+ /* Copy the colors to a palette entry table */
+ pCmapPriv->peColors[pdefs[0].pixel + i].peRed = nRed;
+ pCmapPriv->peColors[pdefs[0].pixel + i].peGreen = nGreen;
+ pCmapPriv->peColors[pdefs[0].pixel + i].peBlue = nBlue;
+
+ /* Copy the colors to a RGBQUAD table */
+ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbRed = nRed;
+ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbGreen = nGreen;
+ pCmapPriv->rgbColors[pdefs[0].pixel + i].rgbBlue = nBlue;
+
+#if CYGDEBUG
+ winDebug ("winStoreColors - nRed %d nGreen %d nBlue %d\n",
+ nRed, nGreen, nBlue);
+#endif
+ }
+
+ /* Call the engine specific store colors procedure */
+ if (!((pScreenPriv->pwinStoreColors) (pmap, ndef, pdefs)))
+ {
+ winErrorFVerb (2, "winStoreColors - Engine cpecific color storage procedure "
+ "failed. Continuing, but colors may be messed up from now "
+ "on.\n");
+ }
+}
+
+
+/* See Porting Layer Definition - p. 30 */
+static void
+winResolveColor (unsigned short *pred,
+ unsigned short *pgreen,
+ unsigned short *pblue,
+ VisualPtr pVisual)
+{
+#if CYGDEBUG
+ winDebug ("winResolveColor ()\n");
+#endif
+
+ miResolveColor (pred, pgreen, pblue, pVisual);
+}
+
+
+/* See Porting Layer Definition - p. 29 */
+static Bool
+winCreateColormap (ColormapPtr pmap)
+{
+ winPrivCmapPtr pCmapPriv = NULL;
+ ScreenPtr pScreen = pmap->pScreen;
+ winScreenPriv(pScreen);
+
+#if CYGDEBUG
+ winDebug ("winCreateColormap\n");
+#endif
+
+ /* Allocate colormap privates */
+ if (!winAllocateCmapPrivates (pmap))
+ {
+ ErrorF ("winCreateColorma - Couldn't allocate cmap privates\n");
+ return FALSE;
+ }
+
+ /* Get a pointer to the newly allocated privates */
+ pCmapPriv = winGetCmapPriv (pmap);
+
+ /*
+ * FIXME: This is some evil hackery to help in handling some X clients
+ * that expect the top pixel to be white. This "help" only lasts until
+ * some client overwrites the top colormap entry.
+ *
+ * We don't want to actually allocate the top entry, as that causes
+ * problems with X clients that need 7 planes (128 colors) in the default
+ * colormap, such as Magic 7.1.
+ */
+ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbRed = 255;
+ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbGreen = 255;
+ pCmapPriv->rgbColors[WIN_NUM_PALETTE_ENTRIES - 1].rgbBlue = 255;
+ pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peRed = 255;
+ pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peGreen = 255;
+ pCmapPriv->peColors[WIN_NUM_PALETTE_ENTRIES - 1].peBlue = 255;
+
+ /* Call the engine specific colormap initialization procedure */
+ if (!((*pScreenPriv->pwinCreateColormap) (pmap)))
+ {
+ ErrorF ("winCreateColormap - Engine specific colormap creation "
+ "procedure failed. Aborting.\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+/* See Porting Layer Definition - p. 29, 30 */
+static void
+winDestroyColormap (ColormapPtr pColormap)
+{
+ winScreenPriv(pColormap->pScreen);
+ winCmapPriv(pColormap);
+
+ /* Call the engine specific colormap destruction procedure */
+ if (!((*pScreenPriv->pwinDestroyColormap) (pColormap)))
+ {
+ winErrorFVerb (2, "winDestroyColormap - Engine specific colormap destruction "
+ "procedure failed. Continuing, but it is possible that memory "
+ "was leaked, or that colors will be messed up from now on.\n");
+ }
+
+ /* Free the colormap privates */
+ free (pCmapPriv);
+ winSetCmapPriv (pColormap, NULL);
+
+#if CYGDEBUG
+ winDebug ("winDestroyColormap - Returning\n");
+#endif
+}
+
+
+/*
+ * Internal function to load the palette used by the Shadow DIB
+ */
+
+static Bool
+winGetPaletteDIB (ScreenPtr pScreen, ColormapPtr pcmap)
+{
+ winScreenPriv(pScreen);
+ int i;
+ Pixel pixel; /* Pixel == CARD32 */
+ CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
+ UINT uiColorsRetrieved = 0;
+ RGBQUAD rgbColors[WIN_NUM_PALETTE_ENTRIES];
+
+ /* Get the color table for the screen */
+ uiColorsRetrieved = GetDIBColorTable (pScreenPriv->hdcScreen,
+ 0,
+ WIN_NUM_PALETTE_ENTRIES,
+ rgbColors);
+ if (uiColorsRetrieved == 0)
+ {
+ ErrorF ("winGetPaletteDIB - Could not retrieve screen color table\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winGetPaletteDIB - Retrieved %d colors from DIB\n",
+ uiColorsRetrieved);
+#endif
+
+ /* Set the DIB color table to the default screen palette */
+ if (SetDIBColorTable (pScreenPriv->hdcShadow,
+ 0,
+ uiColorsRetrieved,
+ rgbColors) == 0)
+ {
+ ErrorF ("winGetPaletteDIB - SetDIBColorTable () failed\n");
+ return FALSE;
+ }
+
+ /* Alloc each color in the DIB color table */
+ for (i = 0; i < uiColorsRetrieved; ++i)
+ {
+ pixel = i;
+
+ /* Extract the color values for current palette entry */
+ nRed = rgbColors[i].rgbRed << 8;
+ nGreen = rgbColors[i].rgbGreen << 8;
+ nBlue = rgbColors[i].rgbBlue << 8;
+
+#if CYGDEBUG
+ winDebug ("winGetPaletteDIB - Allocating a color: %d; "
+ "%d %d %d\n",
+ pixel, nRed, nGreen, nBlue);
+#endif
+
+ /* Allocate a entry in the X colormap */
+ if (AllocColor (pcmap,
+ &nRed,
+ &nGreen,
+ &nBlue,
+ &pixel,
+ 0) != Success)
+ {
+ ErrorF ("winGetPaletteDIB - AllocColor () failed, pixel %d\n",
+ i);
+ return FALSE;
+ }
+
+ if (i != pixel
+ || nRed != rgbColors[i].rgbRed
+ || nGreen != rgbColors[i].rgbGreen
+ || nBlue != rgbColors[i].rgbBlue)
+ {
+ winDebug ("winGetPaletteDIB - Got: %d; "
+ "%d %d %d\n",
+ (int) pixel, nRed, nGreen, nBlue);
+ }
+
+ /* FIXME: Not sure that this bit is needed at all */
+ pcmap->red[i].co.local.red = nRed;
+ pcmap->red[i].co.local.green = nGreen;
+ pcmap->red[i].co.local.blue = nBlue;
+ }
+
+ /* System is using a colormap */
+ /* Set the black and white pixel indices */
+ pScreen->whitePixel = uiColorsRetrieved - 1;
+ pScreen->blackPixel = 0;
+
+ return TRUE;
+}
+
+
+/*
+ * Internal function to load the standard system palette being used by DD
+ */
+
+static Bool
+winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
+{
+ int i;
+ Pixel pixel; /* Pixel == CARD32 */
+ CARD16 nRed, nGreen, nBlue; /* CARD16 == unsigned short */
+ UINT uiSystemPaletteEntries;
+ LPPALETTEENTRY ppeColors = NULL;
+ HDC hdc = NULL;
+
+ /* Get a DC to obtain the default palette */
+ hdc = GetDC (NULL);
+ if (hdc == NULL)
+ {
+ ErrorF ("winGetPaletteDD - Couldn't get a DC\n");
+ return FALSE;
+ }
+
+ /* Get the number of entries in the system palette */
+ uiSystemPaletteEntries = GetSystemPaletteEntries (hdc,
+ 0, 0, NULL);
+ if (uiSystemPaletteEntries == 0)
+ {
+ ErrorF ("winGetPaletteDD - Unable to determine number of "
+ "system palette entries\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winGetPaletteDD - uiSystemPaletteEntries %d\n",
+ uiSystemPaletteEntries);
+#endif
+
+ /* Allocate palette entries structure */
+ ppeColors = malloc (uiSystemPaletteEntries * sizeof (PALETTEENTRY));
+ if (ppeColors == NULL)
+ {
+ ErrorF ("winGetPaletteDD - malloc () for colormap failed\n");
+ return FALSE;
+ }
+
+ /* Get system palette entries */
+ GetSystemPaletteEntries (hdc,
+ 0, uiSystemPaletteEntries, ppeColors);
+
+ /* Allocate an X colormap entry for every system palette entry */
+ for (i = 0; i < uiSystemPaletteEntries; ++i)
+ {
+ pixel = i;
+
+ /* Extract the color values for current palette entry */
+ nRed = ppeColors[i].peRed << 8;
+ nGreen = ppeColors[i].peGreen << 8;
+ nBlue = ppeColors[i].peBlue << 8;
+#if CYGDEBUG
+ winDebug ("winGetPaletteDD - Allocating a color: %d; "
+ "%d %d %d\n",
+ pixel, nRed, nGreen, nBlue);
+#endif
+ if (AllocColor (pcmap,
+ &nRed,
+ &nGreen,
+ &nBlue,
+ &pixel,
+ 0) != Success)
+ {
+ ErrorF ("winGetPaletteDD - AllocColor () failed, pixel %d\n",
+ i);
+ free (ppeColors);
+ ppeColors = NULL;
+ return FALSE;
+ }
+
+ pcmap->red[i].co.local.red = nRed;
+ pcmap->red[i].co.local.green = nGreen;
+ pcmap->red[i].co.local.blue = nBlue;
+ }
+
+ /* System is using a colormap */
+ /* Set the black and white pixel indices */
+ pScreen->whitePixel = uiSystemPaletteEntries - 1;
+ pScreen->blackPixel = 0;
+
+ /* Free colormap */
+ free(ppeColors);
+ ppeColors = NULL;
+
+ /* Free the DC */
+ if (hdc != NULL)
+ {
+ ReleaseDC (NULL, hdc);
+ hdc = NULL;
+ }
+
+ return TRUE;
+}
+
+
+/*
+ * Install the standard fb colormap, or the GDI colormap,
+ * depending on the current screen depth.
+ */
+
+Bool
+winCreateDefColormap (ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
+ unsigned short zero = 0, ones = 0xFFFF;
+ VisualPtr pVisual = pScreenPriv->pRootVisual;
+ ColormapPtr pcmap = NULL;
+ Pixel wp, bp;
+
+#if CYGDEBUG
+ winDebug ("winCreateDefColormap\n");
+#endif
+
+ /* Use standard fb colormaps for non palettized color modes */
+ if (pScreenInfo->dwBPP > 8)
+ {
+ winDebug ("winCreateDefColormap - Deferring to " \
+ "fbCreateDefColormap ()\n");
+ return fbCreateDefColormap (pScreen);
+ }
+
+ /*
+ * AllocAll for non-Dynamic visual classes,
+ * AllocNone for Dynamic visual classes.
+ */
+
+ /*
+ * Dynamic visual classes allow the colors of the color map
+ * to be changed by clients.
+ */
+
+#if CYGDEBUG
+ winDebug ("winCreateDefColormap - defColormap: %d\n",
+ pScreen->defColormap);
+#endif
+
+ /* Allocate an X colormap, owned by client 0 */
+ if (CreateColormap (pScreen->defColormap,
+ pScreen,
+ pVisual,
+ &pcmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
+ 0) != Success)
+ {
+ ErrorF ("winCreateDefColormap - CreateColormap failed\n");
+ return FALSE;
+ }
+ if (pcmap == NULL)
+ {
+ ErrorF ("winCreateDefColormap - Colormap could not be created\n");
+ return FALSE;
+ }
+
+#if CYGDEBUG
+ winDebug ("winCreateDefColormap - Created a colormap\n");
+#endif
+
+ /* Branch on the visual class */
+ if (!(pVisual->class & DynamicClass))
+ {
+ /* Branch on engine type */
+ if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI)
+ {
+ /* Load the colors being used by the Shadow DIB */
+ if (!winGetPaletteDIB (pScreen, pcmap))
+ {
+ ErrorF ("winCreateDefColormap - Couldn't get DIB colors\n");
+ return FALSE;
+ }
+ }
+ else
+ {
+ /* Load the colors from the default system palette */
+ if (!winGetPaletteDD (pScreen, pcmap))
+ {
+ ErrorF ("winCreateDefColormap - Couldn't get colors "
+ "for DD\n");
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
+
+ /* Allocate a black and white pixel */
+ if ((AllocColor (pcmap, &ones, &ones, &ones, &wp, 0) !=
+ Success)
+ ||
+ (AllocColor (pcmap, &zero, &zero, &zero, &bp, 0) !=
+ Success))
+ {
+ ErrorF ("winCreateDefColormap - Couldn't allocate bp or wp\n");
+ return FALSE;
+ }
+
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
+
+#if 0
+ /* Have to reserve first 10 and last ten pixels in DirectDraw windowed */
+ if (pScreenInfo->dwEngine != WIN_SERVER_SHADOW_GDI)
+ {
+ int k;
+ Pixel p;
+
+ for (k = 1; k < 10; ++k)
+ {
+ p = k;
+ if (AllocColor (pcmap, &ones, &ones, &ones, &p, 0) != Success)
+ FatalError ("Foo!\n");
+ }
+
+ for (k = 245; k < 255; ++k)
+ {
+ p = k;
+ if (AllocColor (pcmap, &zero, &zero, &zero, &p, 0) != Success)
+ FatalError ("Baz!\n");
+ }
+ }
+#endif
+ }
+
+ /* Install the created colormap */
+ (*pScreen->InstallColormap)(pcmap);
+
+#if CYGDEBUG
+ winDebug ("winCreateDefColormap - Returning\n");
+#endif
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c
index d6cb109ea..e0c07809c 100644
--- a/xorg-server/hw/xwin/winmouse.c
+++ b/xorg-server/hw/xwin/winmouse.c
@@ -235,13 +235,15 @@ winMouseButtonsSendEvent (int iEventType, int iButton)
{
EventListPtr events;
int i, nevents;
+ ValuatorMask mask;
if (g_winMouseButtonMap)
iButton = g_winMouseButtonMap[iButton];
+ valuator_mask_zero(&mask);
GetEventList(&events);
nevents = GetPointerEvents(events, g_pwinPointer, iEventType, iButton,
- POINTER_RELATIVE, 0, 0, NULL);
+ POINTER_RELATIVE, &mask);
for (i = 0; i < nevents; i++)
mieqEnqueue(g_pwinPointer, (InternalEvent*)events[i].event);
@@ -366,15 +368,17 @@ void winEnqueueMotion(int x, int y)
{
int i, nevents;
int valuators[2];
+ ValuatorMask mask;
EventListPtr events;
miPointerSetPosition(g_pwinPointer, &x, &y);
valuators[0] = x;
valuators[1] = y;
+ valuator_mask_set_range(&mask, 0, 2, valuators);
GetEventList(&events);
nevents = GetPointerEvents(events, g_pwinPointer, MotionNotify, 0,
- POINTER_ABSOLUTE | POINTER_SCREEN, 0, 2, valuators);
+ POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
for (i = 0; i < nevents; i++)
mieqEnqueue(g_pwinPointer, (InternalEvent*)events[i].event);
diff --git a/xorg-server/hw/xwin/winpixmap.c b/xorg-server/hw/xwin/winpixmap.c
index 050c71a7f..82b6bbb5c 100644
--- a/xorg-server/hw/xwin/winpixmap.c
+++ b/xorg-server/hw/xwin/winpixmap.c
@@ -1,235 +1,232 @@
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, 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, 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 XFREE86 PROJECT 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 XFree86 Project
- *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 XFree86 Project.
- *
- * Authors: drewry, september 1986
- * Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-
-/*
- * Local prototypes
- */
-
-#if 0
-static void
-winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw);
-
-static void
-winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh);
-
-static void
-winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
- int xrot, int yrot);
-#endif
-
-
-/* See Porting Layer Definition - p. 34 */
-/* See mfb/mfbpixmap.c - mfbCreatePixmap() */
-PixmapPtr
-winCreatePixmapNativeGDI (ScreenPtr pScreen,
- int iWidth, int iHeight,
- int iDepth, unsigned usage_hint)
-{
- winPrivPixmapPtr pPixmapPriv = NULL;
- PixmapPtr pPixmap = NULL;
-
- /* Allocate pixmap memory */
- pPixmap = AllocatePixmap (pScreen, 0);
- if (!pPixmap)
- {
- ErrorF ("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
- return NullPixmap;
- }
-
-#if CYGDEBUG
- winDebug ("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
- iWidth, iHeight, iDepth, usage_hint,
- PixmapBytePad (iWidth, iDepth));
-#endif
-
- /* Setup pixmap values */
- pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
- pPixmap->drawable.pScreen = pScreen;
- pPixmap->drawable.depth = iDepth;
- pPixmap->drawable.bitsPerPixel = BitsPerPixel (iDepth);
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = iWidth;
- pPixmap->drawable.height = iHeight;
- pPixmap->devKind = 0;
- pPixmap->refcnt = 1;
- pPixmap->devPrivate.ptr = NULL;
- pPixmap->usage_hint = usage_hint;
-
- /* Pixmap privates are allocated by AllocatePixmap */
- pPixmapPriv = winGetPixmapPriv (pPixmap);
-
- /* Initialize pixmap privates */
- pPixmapPriv->hBitmap = NULL;
- pPixmapPriv->hdcSelected = NULL;
- pPixmapPriv->pbBits = NULL;
- pPixmapPriv->dwScanlineBytes = PixmapBytePad (iWidth, iDepth);
-
- /* Check for zero width or height pixmaps */
- if (iWidth == 0 || iHeight == 0)
- {
- /* Don't allocate a real pixmap, just set fields and return */
- return pPixmap;
- }
-
- /* Create a DIB for the pixmap */
- pPixmapPriv->hBitmap = winCreateDIBNativeGDI (iWidth, iHeight, iDepth,
- &pPixmapPriv->pbBits,
- (BITMAPINFO **) &pPixmapPriv->pbmih);
-
-#if CYGDEBUG
- winDebug ("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " \
- "screen: %08x\n",
- pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen);
-#endif
-
- return pPixmap;
-}
-
-
-/*
- * See Porting Layer Definition - p. 35
- *
- * See mfb/mfbpixmap.c - mfbDestroyPixmap()
- */
-
-Bool
-winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
-{
- winPrivPixmapPtr pPixmapPriv = NULL;
-
-#if CYGDEBUG
- winDebug ("winDestroyPixmapNativeGDI ()\n");
-#endif
-
- /* Bail early if there is not a pixmap to destroy */
- if (pPixmap == NULL)
- {
- ErrorF ("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
- return TRUE;
- }
-
- /* Get a handle to the pixmap privates */
- pPixmapPriv = winGetPixmapPriv (pPixmap);
-
-#if CYGDEBUG
- winDebug ("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
- pPixmapPriv->hBitmap);
-#endif
-
- /* Decrement reference count, return if nonzero */
- --pPixmap->refcnt;
- if (pPixmap->refcnt != 0)
- return TRUE;
-
- /* Free GDI bitmap */
- if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap);
-
- /* Free the bitmap info header memory */
- if (pPixmapPriv->pbmih != NULL)
- {
- free (pPixmapPriv->pbmih);
- pPixmapPriv->pbmih = NULL;
- }
-
- /* Free the pixmap memory */
- free (pPixmap);
- pPixmap = NULL;
-
- return TRUE;
-}
-
-
-/*
- * Not used yet
- */
-
-Bool
-winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
- int iWidth, int iHeight,
- int iDepth,
- int iBitsPerPixel,
- int devKind,
- pointer pPixData)
-{
- FatalError ("winModifyPixmapHeaderNativeGDI ()\n");
- return TRUE;
-}
-
-
-#if 0
-/*
- * Not used yet.
- * See cfb/cfbpixmap.c
- */
-
-static void
-winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw)
-{
- ErrorF ("winXRotatePixmap()\n");
- /* fill in this function, look at CFB */
-}
-
-
-/*
- * Not used yet.
- * See cfb/cfbpixmap.c
- */
-static void
-winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh)
-{
- ErrorF ("winYRotatePixmap()\n");
- /* fill in this function, look at CFB */
-}
-
-
-/*
- * Not used yet.
- * See cfb/cfbpixmap.c
- */
-
-static void
-winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
- int xrot, int yrot)
-{
- ErrorF ("winCopyRotatePixmap()\n");
- /* fill in this function, look at CFB */
-}
-#endif
+/*
+ *Copyright (C) 1994-2000 The XFree86 Project, 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, 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 XFREE86 PROJECT 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 XFree86 Project
+ *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 XFree86 Project.
+ *
+ * Authors: drewry, september 1986
+ * Harold L Hunt II
+ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include "win.h"
+
+
+/*
+ * Local prototypes
+ */
+
+#if 0
+static void
+winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw);
+
+static void
+winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh);
+
+static void
+winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
+ int xrot, int yrot);
+#endif
+
+
+/* See Porting Layer Definition - p. 34 */
+/* See mfb/mfbpixmap.c - mfbCreatePixmap() */
+PixmapPtr
+winCreatePixmapNativeGDI (ScreenPtr pScreen,
+ int iWidth, int iHeight,
+ int iDepth, unsigned usage_hint)
+{
+ winPrivPixmapPtr pPixmapPriv = NULL;
+ PixmapPtr pPixmap = NULL;
+
+ /* Allocate pixmap memory */
+ pPixmap = AllocatePixmap (pScreen, 0);
+ if (!pPixmap)
+ {
+ ErrorF ("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
+ return NullPixmap;
+ }
+
+#if CYGDEBUG
+ winDebug ("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
+ iWidth, iHeight, iDepth, usage_hint,
+ PixmapBytePad (iWidth, iDepth));
+#endif
+
+ /* Setup pixmap values */
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = iDepth;
+ pPixmap->drawable.bitsPerPixel = BitsPerPixel (iDepth);
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = iWidth;
+ pPixmap->drawable.height = iHeight;
+ pPixmap->devKind = 0;
+ pPixmap->refcnt = 1;
+ pPixmap->devPrivate.ptr = NULL;
+ pPixmap->usage_hint = usage_hint;
+
+ /* Pixmap privates are allocated by AllocatePixmap */
+ pPixmapPriv = winGetPixmapPriv (pPixmap);
+
+ /* Initialize pixmap privates */
+ pPixmapPriv->hBitmap = NULL;
+ pPixmapPriv->hdcSelected = NULL;
+ pPixmapPriv->pbBits = NULL;
+ pPixmapPriv->dwScanlineBytes = PixmapBytePad (iWidth, iDepth);
+
+ /* Check for zero width or height pixmaps */
+ if (iWidth == 0 || iHeight == 0)
+ {
+ /* Don't allocate a real pixmap, just set fields and return */
+ return pPixmap;
+ }
+
+ /* Create a DIB for the pixmap */
+ pPixmapPriv->hBitmap = winCreateDIBNativeGDI (iWidth, iHeight, iDepth,
+ &pPixmapPriv->pbBits,
+ (BITMAPINFO **) &pPixmapPriv->pbmih);
+
+#if CYGDEBUG
+ winDebug ("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " \
+ "screen: %08x\n",
+ pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen);
+#endif
+
+ return pPixmap;
+}
+
+
+/*
+ * See Porting Layer Definition - p. 35
+ *
+ * See mfb/mfbpixmap.c - mfbDestroyPixmap()
+ */
+
+Bool
+winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
+{
+ winPrivPixmapPtr pPixmapPriv = NULL;
+
+#if CYGDEBUG
+ winDebug ("winDestroyPixmapNativeGDI ()\n");
+#endif
+
+ /* Bail early if there is not a pixmap to destroy */
+ if (pPixmap == NULL)
+ {
+ ErrorF ("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
+ return TRUE;
+ }
+
+ /* Get a handle to the pixmap privates */
+ pPixmapPriv = winGetPixmapPriv (pPixmap);
+
+#if CYGDEBUG
+ winDebug ("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
+ pPixmapPriv->hBitmap);
+#endif
+
+ /* Decrement reference count, return if nonzero */
+ --pPixmap->refcnt;
+ if (pPixmap->refcnt != 0)
+ return TRUE;
+
+ /* Free GDI bitmap */
+ if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap);
+
+ /* Free the bitmap info header memory */
+ free(pPixmapPriv->pbmih);
+ pPixmapPriv->pbmih = NULL;
+
+ /* Free the pixmap memory */
+ free (pPixmap);
+ pPixmap = NULL;
+
+ return TRUE;
+}
+
+
+/*
+ * Not used yet
+ */
+
+Bool
+winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
+ int iWidth, int iHeight,
+ int iDepth,
+ int iBitsPerPixel,
+ int devKind,
+ pointer pPixData)
+{
+ FatalError ("winModifyPixmapHeaderNativeGDI ()\n");
+ return TRUE;
+}
+
+
+#if 0
+/*
+ * Not used yet.
+ * See cfb/cfbpixmap.c
+ */
+
+static void
+winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw)
+{
+ ErrorF ("winXRotatePixmap()\n");
+ /* fill in this function, look at CFB */
+}
+
+
+/*
+ * Not used yet.
+ * See cfb/cfbpixmap.c
+ */
+static void
+winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh)
+{
+ ErrorF ("winYRotatePixmap()\n");
+ /* fill in this function, look at CFB */
+}
+
+
+/*
+ * Not used yet.
+ * See cfb/cfbpixmap.c
+ */
+
+static void
+winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
+ int xrot, int yrot)
+{
+ ErrorF ("winCopyRotatePixmap()\n");
+ /* fill in this function, look at CFB */
+}
+#endif