diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-02-03 09:56:19 +1030 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-02-18 18:46:01 +1030 |
commit | 3fe64d8d271aea0863bf01b0376f3eceec0c90b5 (patch) | |
tree | 8953d8bbd54c777d5439724fcc6b073f7e9a610c /hw/kdrive | |
parent | 09a8fc5c7a79ca22fc23224bb544f2e709681f3f (diff) |
Move input event list initialisation and storage from DDX to DIX.
Rather than letting the DDX allocate the events, allocate them once in the DIX
and just pass it around when needed.
DDX should call GetEventList() to obtain this list and then pass it into
Get{Pointer|Keyboard}Events.
Diffstat (limited to 'hw/kdrive')
-rw-r--r-- | hw/kdrive/src/kinput.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 5b1dc5cdc..78b44199e 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -65,7 +65,7 @@ static struct KdConfigDevice *kdConfigPointers = NULL; static KdKeyboardDriver *kdKeyboardDrivers = NULL; static KdPointerDriver *kdPointerDrivers = NULL; -static xEvent *kdEvents = NULL; +static EventListPtr *kdEvents = NULL; static Bool kdInputEnabled; static Bool kdOffScreen; @@ -1391,11 +1391,6 @@ KdInitInput (void) ErrorF("Failed to add keyboard!\n"); } - if (!kdEvents) - kdEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - if (!kdEvents) - FatalError("Couldn't allocate event buffer\n"); - mieqInit(); } @@ -1984,6 +1979,7 @@ KdReleaseAllKeys (void) key++) { if (IsKeyDown(ki, key)) { KdHandleKeyboardEvent(ki, KeyRelease, key); + kdEvents = GetEventList(); nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key); for (i = 0; i < nEvents; i++) KdQueueEvent (ki->dixdev, kdEvents + i); @@ -2048,9 +2044,10 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, KdHandleKeyboardEvent(ki, type, key_code); } + kdEvents = GetEventList(); nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code); for (i = 0; i < nEvents; i++) - KdQueueEvent(ki->dixdev, kdEvents + i); + KdQueueEvent(ki->dixdev, kdEvents); } else { ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n", @@ -2148,8 +2145,9 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z, if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel)) return; - nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, 0, 3, - valuators); + kdEvents = GetEventList(); + nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, + 0, 3, valuators); for (i = 0; i < nEvents; i++) KdQueueEvent(pi->dixdev, kdEvents + i); } |