Xi: Add support for sourceid in the device classes.

This commit is contained in:
Peter Hutterer 2009-06-07 19:43:11 +10:00
parent d230742ea8
commit 01241b4247
5 changed files with 27 additions and 0 deletions

View File

@ -199,6 +199,8 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
if (device == master) if (device == master)
return; return;
mk->sourceid = device->id;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
mk->modifierKeyCount[i] = dk->modifierKeyCount[i]; mk->modifierKeyCount[i] = dk->modifierKeyCount[i];
@ -470,6 +472,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
FatalError("[Xi] no memory for trace.\n"); FatalError("[Xi] no memory for trace.\n");
memcpy(to->focus->trace, from->focus->trace, memcpy(to->focus->trace, from->focus->trace,
from->focus->traceSize * sizeof(WindowPtr)); from->focus->traceSize * sizeof(WindowPtr));
to->focus->sourceid = from->id;
} }
} else if (to->focus) } else if (to->focus)
{ {
@ -546,6 +549,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo)); memcpy(v->axes, from->valuator->axes, v->numAxes * sizeof(AxisInfo));
v->axisVal = (int*)(v->axes + from->valuator->numAxes); v->axisVal = (int*)(v->axes + from->valuator->numAxes);
v->sourceid = from->id;
} else if (to->valuator && !from->valuator) } else if (to->valuator && !from->valuator)
{ {
ClassesPtr classes; ClassesPtr classes;
@ -582,6 +586,8 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
sizeof(XkbAction)); sizeof(XkbAction));
} else } else
xfree(to->button->xkb_acts); xfree(to->button->xkb_acts);
to->button->sourceid = from->id;
} else if (to->button && !from->button) } else if (to->button && !from->button)
{ {
ClassesPtr classes; ClassesPtr classes;
@ -606,6 +612,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
classes->proximity = NULL; classes->proximity = NULL;
} }
memcpy(to->proximity, from->proximity, sizeof(ProximityClassRec)); memcpy(to->proximity, from->proximity, sizeof(ProximityClassRec));
to->proximity->sourceid = from->id;
} else if (to->proximity) } else if (to->proximity)
{ {
ClassesPtr classes; ClassesPtr classes;
@ -630,6 +637,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
classes->absolute = NULL; classes->absolute = NULL;
} }
memcpy(to->absolute, from->absolute, sizeof(AbsoluteClassRec)); memcpy(to->absolute, from->absolute, sizeof(AbsoluteClassRec));
to->absolute->sourceid = from->id;
} else if (to->absolute) } else if (to->absolute)
{ {
ClassesPtr classes; ClassesPtr classes;
@ -1127,6 +1135,7 @@ InitProximityClassDeviceStruct(DeviceIntPtr dev)
proxc = (ProximityClassPtr) xalloc(sizeof(ProximityClassRec)); proxc = (ProximityClassPtr) xalloc(sizeof(ProximityClassRec));
if (!proxc) if (!proxc)
return FALSE; return FALSE;
proxc->sourceid = dev->id;
dev->proximity = proxc; dev->proximity = proxc;
return TRUE; return TRUE;
} }

View File

@ -231,6 +231,7 @@ ListButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info)
info->type = ButtonClass; info->type = ButtonClass;
info->num_buttons = dev->button->numButtons; info->num_buttons = dev->button->numButtons;
info->length = 2 + info->num_buttons; info->length = 2 + info->num_buttons;
info->sourceid = dev->button->sourceid;
/** XXX: button labels */ /** XXX: button labels */
@ -245,6 +246,7 @@ SwapButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info)
int i; int i;
swaps(&info->type, n); swaps(&info->type, n);
swaps(&info->length, n); swaps(&info->length, n);
swaps(&info->sourceid, n);
for (i = 0, btn = (Atom*)&info[1]; i < info->num_buttons; i++, btn++) for (i = 0, btn = (Atom*)&info[1]; i < info->num_buttons; i++, btn++)
swaps(btn, n); swaps(btn, n);
@ -266,6 +268,7 @@ ListKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
info->type = KeyClass; info->type = KeyClass;
info->num_keycodes = xkb->max_key_code - xkb->min_key_code + 1; info->num_keycodes = xkb->max_key_code - xkb->min_key_code + 1;
info->length = 2 + info->num_keycodes; info->length = 2 + info->num_keycodes;
info->sourceid = dev->key->sourceid;
kc = (uint32_t*)&info[1]; kc = (uint32_t*)&info[1];
for (i = xkb->min_key_code; i <= xkb->max_key_code; i++, kc++) for (i = xkb->min_key_code; i <= xkb->max_key_code; i++, kc++)
@ -282,6 +285,7 @@ SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
int i; int i;
swaps(&info->type, n); swaps(&info->type, n);
swaps(&info->length, n); swaps(&info->length, n);
swaps(&info->sourceid, n);
for (i = 0, key = (uint32_t*)&info[1]; i < info->num_keycodes; i++, key++) for (i = 0, key = (uint32_t*)&info[1]; i < info->num_keycodes; i++, key++)
swapl(key, n); swapl(key, n);
@ -309,6 +313,7 @@ ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber)
info->resolution = v->axes[axisnumber].resolution; info->resolution = v->axes[axisnumber].resolution;
info->number = axisnumber; info->number = axisnumber;
info->mode = v->mode; /* Server doesn't have per-axis mode yet */ info->mode = v->mode; /* Server doesn't have per-axis mode yet */
info->sourceid = v->sourceid;
return info->length * 4; return info->length * 4;
} }
@ -325,6 +330,7 @@ SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
swapl(&info->max.integral, n); swapl(&info->max.integral, n);
swapl(&info->max.frac, n); swapl(&info->max.frac, n);
swaps(&info->number, n); swaps(&info->number, n);
swaps(&info->sourceid, n);
} }
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment) int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)

View File

@ -1143,6 +1143,7 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
if (!butc) if (!butc)
return FALSE; return FALSE;
butc->numButtons = numButtons; butc->numButtons = numButtons;
butc->sourceid = dev->id;
for (i = 1; i <= numButtons; i++) for (i = 1; i <= numButtons; i++)
butc->map[i] = map[i]; butc->map[i] = map[i];
dev->button = butc; dev->button = butc;
@ -1173,6 +1174,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
if (!valc) if (!valc)
return FALSE; return FALSE;
valc->sourceid = dev->id;
valc->motion = NULL; valc->motion = NULL;
valc->first_motion = 0; valc->first_motion = 0;
valc->last_motion = 0; valc->last_motion = 0;
@ -1300,6 +1302,8 @@ InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
abs->following = 0; abs->following = 0;
abs->screen = 0; abs->screen = 0;
abs->sourceid = dev->id;
dev->absolute = abs; dev->absolute = abs;
return TRUE; return TRUE;
@ -1319,6 +1323,7 @@ InitFocusClassDeviceStruct(DeviceIntPtr dev)
focc->trace = (WindowPtr *)NULL; focc->trace = (WindowPtr *)NULL;
focc->traceSize = 0; focc->traceSize = 0;
focc->traceGood = 0; focc->traceGood = 0;
focc->sourceid = dev->id;
dev->focus = focc; dev->focus = focc;
return TRUE; return TRUE;
} }

View File

@ -202,6 +202,7 @@ typedef struct _GrabRec {
} GrabRec; } GrabRec;
typedef struct _KeyClassRec { typedef struct _KeyClassRec {
int sourceid;
CARD8 down[DOWN_LENGTH]; CARD8 down[DOWN_LENGTH];
CARD8 postdown[DOWN_LENGTH]; CARD8 postdown[DOWN_LENGTH];
int modifierKeyCount[8]; int modifierKeyCount[8];
@ -224,6 +225,7 @@ typedef struct _ValuatorAccelerationRec {
} ValuatorAccelerationRec, *ValuatorAccelerationPtr; } ValuatorAccelerationRec, *ValuatorAccelerationPtr;
typedef struct _ValuatorClassRec { typedef struct _ValuatorClassRec {
int sourceid;
int numMotionEvents; int numMotionEvents;
int first_motion; int first_motion;
int last_motion; int last_motion;
@ -239,6 +241,7 @@ typedef struct _ValuatorClassRec {
} ValuatorClassRec, *ValuatorClassPtr; } ValuatorClassRec, *ValuatorClassPtr;
typedef struct _ButtonClassRec { typedef struct _ButtonClassRec {
int sourceid;
CARD8 numButtons; CARD8 numButtons;
CARD8 buttonsDown; /* number of buttons currently down CARD8 buttonsDown; /* number of buttons currently down
This counts logical buttons, not This counts logical buttons, not
@ -254,6 +257,7 @@ typedef struct _ButtonClassRec {
} ButtonClassRec, *ButtonClassPtr; } ButtonClassRec, *ButtonClassPtr;
typedef struct _FocusClassRec { typedef struct _FocusClassRec {
int sourceid;
WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */ WindowPtr win; /* May be set to a int constant (e.g. PointerRootWin)! */
int revert; int revert;
TimeStamp time; TimeStamp time;
@ -263,10 +267,12 @@ typedef struct _FocusClassRec {
} FocusClassRec, *FocusClassPtr; } FocusClassRec, *FocusClassPtr;
typedef struct _ProximityClassRec { typedef struct _ProximityClassRec {
int sourceid;
char pad; char pad;
} ProximityClassRec, *ProximityClassPtr; } ProximityClassRec, *ProximityClassPtr;
typedef struct _AbsoluteClassRec { typedef struct _AbsoluteClassRec {
int sourceid;
/* Calibration. */ /* Calibration. */
int min_x; int min_x;
int max_x; int max_x;

View File

@ -522,6 +522,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
ErrorF("XKB: Failed to allocate key class\n"); ErrorF("XKB: Failed to allocate key class\n");
return False; return False;
} }
dev->key->sourceid = dev->id;
dev->kbdfeed = xcalloc(1, sizeof(*dev->kbdfeed)); dev->kbdfeed = xcalloc(1, sizeof(*dev->kbdfeed));
if (!dev->kbdfeed) { if (!dev->kbdfeed) {