aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/dmx/input/dmxevents.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
committermarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
commit0f834b91a4768673833ab4917e87d86c237bb1a6 (patch)
tree363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/hw/dmx/input/dmxevents.c
parentfc72edebf875378459368c5383d9023730cbca54 (diff)
downloadvcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/hw/dmx/input/dmxevents.c')
-rw-r--r--xorg-server/hw/dmx/input/dmxevents.c412
1 files changed, 239 insertions, 173 deletions
diff --git a/xorg-server/hw/dmx/input/dmxevents.c b/xorg-server/hw/dmx/input/dmxevents.c
index 41bc4bf2d..f73480824 100644
--- a/xorg-server/hw/dmx/input/dmxevents.c
+++ b/xorg-server/hw/dmx/input/dmxevents.c
@@ -61,9 +61,9 @@
#include "xkbsrv.h"
#include "XIstubs.h"
-static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
-static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
- * should move the mouse anyway. */
+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)
@@ -85,25 +85,26 @@ static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
#define DMXDBG7(f,a,b,c,d,e,g,h)
#endif
-static int dmxApplyFunctions(DMXInputInfo *dmxInput, DMXFunctionType f)
+static int
+dmxApplyFunctions(DMXInputInfo * dmxInput, DMXFunctionType f)
{
int i;
int rc = 0;
- for (i = 0; i < dmxInput->numDevs; i+= dmxInput->devs[i]->binding)
+ 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)
+static int
+dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal, int type, KeySym keySym)
{
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
-#if 1 /* hack to detect ctrl-alt-q, etc */
+#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;
@@ -126,11 +127,11 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
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))
+ if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask))
return 0;
#endif
@@ -151,34 +152,36 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
}
return 1;
}
-
+
return 0;
}
-
-DMXScreenInfo *dmxFindFirstScreen(int x, int y)
+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)
+static void
+enqueueMotion(DevicePtr pDev, int x, int y)
{
GETDMXLOCALFROMPDEV;
DeviceIntPtr p = dmxLocal->pDevice;
int valuators[3];
- int detail = 0; /* XXX should this be mask of pressed buttons? */
+ int detail = 0; /* XXX should this be mask of pressed buttons? */
ValuatorMask mask;
+
valuators[0] = x;
valuators[1] = y;
@@ -188,50 +191,50 @@ static void enqueueMotion(DevicePtr pDev, int x, int y)
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;
+ 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;
+ dmxGlobalX = x;
+ dmxGlobalY = y;
if (dmxGlobalX < 0)
dmxGlobalX = 0;
if (dmxGlobalY < 0)
dmxGlobalY = 0;
if (dmxGlobalX >= dmxGlobalWidth)
- dmxGlobalX = dmxGlobalWidth + delta -1;
+ dmxGlobalX = dmxGlobalWidth + delta - 1;
if (dmxGlobalY >= dmxGlobalHeight)
- dmxGlobalY = dmxGlobalHeight + delta -1;
-
+ 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 */
+ /* Screen is old screen */
if (block)
dmxSigioBlock();
if (pDev)
- enqueueMotion(pDev, localX, localY);
+ enqueueMotion(pDev, localX, localY);
if (block)
dmxSigioUnblock();
- } else {
- /* Screen is new */
+ }
+ else {
+ /* Screen is new */
DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n",
pScreen->myNum, dmxScreen->index, localX, localY);
if (block)
@@ -240,7 +243,7 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
localX, localY);
if (pDev)
- enqueueMotion(pDev, localX, localY);
+ enqueueMotion(pDev, localX, localY);
if (block)
dmxSigioUnblock();
}
@@ -260,10 +263,11 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
}
#endif
}
- /* Send updates down to all core input
- * drivers */
+ /* 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
@@ -271,34 +275,35 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
dmxInput->devs[j]->update_position(dmxInput->devs[j]->private,
dmxGlobalX, dmxGlobalY);
}
- if (!dmxScreen) ProcessInputEvents();
+ 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)
+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 count;
- ValuatorMask mask;
+ 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 count;
+ ValuatorMask mask;
memset(xE, 0, sizeof(xE));
- if (axesCount > DMX_MAX_AXES) axesCount = DMX_MAX_AXES;
+ 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 ((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];
@@ -307,7 +312,8 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
if (dmxLocal->update_position)
dmxLocal->update_position(dmxLocal->private,
dmxLocal->lastX, dmxLocal->lastY);
- } else { /* Convert to relative */
+ }
+ else { /* Convert to relative */
if (dmxLocal->lastX || dmxLocal->lastY) {
thisX = v[0] - dmxLocal->lastX;
thisY = v[1] - dmxLocal->lastY;
@@ -320,110 +326,155 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
}
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 {
+ /* 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 {
int i;
+
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);
+ 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];
+ 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;
+ xv += 2;
+ count += 2;
}
}
if (block)
dmxSigioBlock();
valuator_mask_set_range(&mask, firstAxis, axesCount, v);
- QueuePointerEvents(pDevice, MotionNotify, 0,
- POINTER_ABSOLUTE, &mask);
+ QueuePointerEvents(pDevice, MotionNotify, 0, POINTER_ABSOLUTE, &mask);
if (block)
dmxSigioUnblock();
}
-static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
- XEvent *e, DMXBlockType block)
+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];
- ValuatorMask mask;
+ int type;
+ int event = -1;
+ XDeviceKeyEvent *ke = (XDeviceKeyEvent *) e;
+ XDeviceMotionEvent *me = (XDeviceMotionEvent *) e;
+ DeviceIntPtr pDevice = dmxLocal->pDevice;
+ int valuators[MAX_VALUATORS];
+ ValuatorMask mask;
if (!e)
- return -1; /* No extended event passed, cannot handle */
+ 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. */
+ 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)
+ if ((XID) dmxLocal->deviceId == ke->deviceid)
break;
}
}
- if ((XID)dmxLocal->deviceId != ke->deviceid
+ if ((XID) dmxLocal->deviceId != ke->deviceid
|| (type = dmxMapLookup(dmxLocal, e->type)) < 0)
- return -1; /* No mapping, so this event is unhandled */
+ 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;
+ 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) \
@@ -438,7 +489,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_DeviceKeyPress:
case XI_DeviceKeyRelease:
EXTRACT_VALUATORS(ke, valuators);
- valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count,
+ valuators);
if (block)
dmxSigioBlock();
QueueKeyboardEvents(pDevice, event, ke->keycode, &mask);
@@ -448,7 +500,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_DeviceButtonPress:
case XI_DeviceButtonRelease:
EXTRACT_VALUATORS(ke, valuators);
- valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count,
+ valuators);
if (block)
dmxSigioBlock();
QueuePointerEvents(pDevice, event, ke->keycode,
@@ -459,7 +512,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_ProximityIn:
case XI_ProximityOut:
EXTRACT_VALUATORS(ke, valuators);
- valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count,
+ valuators);
if (block)
dmxSigioBlock();
QueueProximityEvents(pDevice, event, &mask);
@@ -480,13 +534,13 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_ChangeDeviceNotify:
case XI_DeviceKeystateNotify:
case XI_DeviceButtonstateNotify:
- /* These are ignored, since DMX will
- * generate its own events of these
- * types, as necessary.
+ /* 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? */
+ * Perhaps ChangeDeviceNotify should
+ * generate an error, because it is
+ * unexpected? */
break;
case XI_DeviceValuator:
default:
@@ -498,11 +552,12 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
return 0;
}
-static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
+static int
+dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
{
ButtonClassPtr b = dmxLocal->pDevice->button;
- if (button > b->numButtons) { /* This shouldn't happen. */
+ if (button > b->numButtons) { /* This shouldn't happen. */
dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n",
button, b->numButtons);
return button;
@@ -512,14 +567,16 @@ static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
/** Return DMX's notion of the pointer position in the global coordinate
* space. */
-void dmxGetGlobalPosition(int *x, int *y)
+void
+dmxGetGlobalPosition(int *x, int *y)
{
*x = dmxGlobalX;
*y = dmxGlobalY;
}
/** Invalidate the global position for #dmxCoreMotion. */
-void dmxInvalidateGlobalPosition(void)
+void
+dmxInvalidateGlobalPosition(void)
{
dmxGlobalInvalid = 1;
}
@@ -534,8 +591,9 @@ void dmxInvalidateGlobalPosition(void)
*
* 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)
+void
+dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
+ DMXMotionType type, DMXBlockType block)
{
GETDMXLOCALFROMPDEV;
@@ -558,8 +616,8 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
}
}
-static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
- KeyCode keyCode)
+static KeySym
+dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal, KeyCode keyCode)
{
KeySym keysym = NoSymbol;
int effectiveGroup;
@@ -578,21 +636,21 @@ static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
keyCode, keysym);
-out:
+ out:
return keysym;
}
-static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
- int tryFirst)
+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;
+ int i;
- /* Optimize for similar maps */
+ /* Optimize for similar maps */
if (XkbKeycodeInRange(xkbi->desc, tryFirst)
&& pKeySyms->map[(tryFirst - xkbi->desc->min_key_code)
* pKeySyms->mapWidth] == keySym)
@@ -603,18 +661,19 @@ static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
* pKeySyms->mapWidth] == keySym) {
DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to"
" keyCode=%d (reverses to core keySym=0x%04x)\n",
- keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard,i));
+ keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard, i));
return i;
}
}
return 0;
}
-static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
+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);
@@ -636,9 +695,10 @@ static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
* 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)
+
+void
+dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
+ XEvent * e, DMXBlockType block)
{
GETDMXINPUTFROMPDEV;
xEvent xE;
@@ -658,7 +718,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
xE.u.u.detail = dmxFixup(pDev, detail, keySym);
- /*ErrorF("KEY %d sym %d\n", detail, (int) keySym);*/
+ /*ErrorF("KEY %d sym %d\n", detail, (int) keySym); */
QueueKeyboardEvents(p, type, detail, NULL);
return;
@@ -673,7 +733,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
case MotionNotify:
valuators[0] = e->xmotion.x;
valuators[1] = e->xmotion.y;
- valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
+ valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
valuator_mask_set_range(&mask, 0, 3, valuators);
QueuePointerEvents(p, type, detail,
POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
@@ -682,7 +742,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
case EnterNotify:
case LeaveNotify:
case KeymapNotify:
- case MappingNotify: /* This is sent because we change the
+ 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. */
@@ -690,13 +750,14 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
default:
if (type == ProximityIn || type == ProximityOut) {
if (dmxLocal->sendsCore)
- return; /* Not a core event */
+ return; /* Not a core event */
break;
}
if (type >= LASTEvent) {
if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block))
dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type);
- } else {
+ }
+ else {
dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n",
type, dmxEventName(type));
}
@@ -711,23 +772,28 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
* 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)
+int
+dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
{
GETDMXINPUTFROMPDEV;
- int vt = 0;
+ int vt = 0;
unsigned short state = 0;
if (dmxLocal->sendsCore)
- state = XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->state);
+ 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 */
+ 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;
- 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:
@@ -747,7 +813,7 @@ int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
vt = keySym - XK_F11 + 11;
break;
- case XK_q: /* To avoid confusion */
+ case XK_q: /* To avoid confusion */
case XK_BackSpace:
case XK_Delete:
case XK_KP_Delete: