aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/eventconvert.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-04 13:54:03 +0000
committermarha <marha@users.sourceforge.net>2011-03-04 13:54:03 +0000
commit0a5888393c68f6f7db86206d1f277232db18240b (patch)
tree9afe740e7b124ea8d2125ef7be0d42760d3b8e6a /xorg-server/dix/eventconvert.c
parent56950d7bed70ee82186f44f9333537cdbb33c448 (diff)
downloadvcxsrv-0a5888393c68f6f7db86206d1f277232db18240b.tar.gz
vcxsrv-0a5888393c68f6f7db86206d1f277232db18240b.tar.bz2
vcxsrv-0a5888393c68f6f7db86206d1f277232db18240b.zip
xserver xkeyboard-config mesa git update 4 Marc 2011
Diffstat (limited to 'xorg-server/dix/eventconvert.c')
-rw-r--r--xorg-server/dix/eventconvert.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/xorg-server/dix/eventconvert.c b/xorg-server/dix/eventconvert.c
index dd1ca460b..760729beb 100644
--- a/xorg-server/dix/eventconvert.c
+++ b/xorg-server/dix/eventconvert.c
@@ -97,8 +97,12 @@ EventIsKeyRepeat(xEvent *event)
* @return Success or the matching error code.
*/
int
-EventToCore(InternalEvent *event, xEvent *core)
+EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
{
+ xEvent *core = NULL;
+ int count = 0;
+ int ret = BadImplementation;
+
switch(event->any.type)
{
case ET_Motion:
@@ -108,7 +112,10 @@ EventToCore(InternalEvent *event, xEvent *core)
* present */
if (!BitIsOn(e->valuators.mask, 0) &&
!BitIsOn(e->valuators.mask, 1))
- return BadMatch;
+ {
+ ret = BadMatch;
+ goto out;
+ }
}
/* fallthrough */
case ET_ButtonPress:
@@ -119,9 +126,15 @@ EventToCore(InternalEvent *event, xEvent *core)
DeviceEvent *e = &event->device_event;
if (e->detail.key > 0xFF)
- return BadMatch;
-
- memset(core, 0, sizeof(xEvent));
+ {
+ ret = BadMatch;
+ goto out;
+ }
+
+ core = calloc(1, sizeof(*core));
+ if (!core)
+ return BadAlloc;
+ count = 1;
core->u.u.type = e->type - ET_KeyPress + KeyPress;
core->u.u.detail = e->detail.key & 0xFF;
core->u.keyButtonPointer.time = e->time;
@@ -129,7 +142,10 @@ EventToCore(InternalEvent *event, xEvent *core)
core->u.keyButtonPointer.rootY = e->root_y;
core->u.keyButtonPointer.state = e->corestate;
core->u.keyButtonPointer.root = e->root;
- EventSetKeyRepeatFlag(core, (e->type == ET_KeyPress && e->key_repeat));
+ EventSetKeyRepeatFlag(core,
+ (e->type == ET_KeyPress &&
+ e->key_repeat));
+ ret = Success;
}
break;
case ET_ProximityIn:
@@ -139,13 +155,18 @@ EventToCore(InternalEvent *event, xEvent *core)
case ET_RawButtonPress:
case ET_RawButtonRelease:
case ET_RawMotion:
- return BadMatch;
+ ret = BadMatch;
+ goto out;
default:
/* XXX: */
ErrorF("[dix] EventToCore: Not implemented yet \n");
- return BadImplementation;
+ ret = BadImplementation;
}
- return Success;
+
+out:
+ *core_out = core;
+ *count_out = count;
+ return ret;
}
/**