xnest: switch to using EventList rather than xEvents.

This commit is contained in:
Peter Hutterer 2008-06-08 23:14:20 +09:30
parent 34429d16d3
commit c68ca0c7b2
2 changed files with 10 additions and 11 deletions

View File

@ -43,7 +43,7 @@ is" without express or implied warranty.
CARD32 lastEventTime = 0; CARD32 lastEventTime = 0;
extern xEvent *xnestEvents; extern EventList *xnestEvents;
void void
ProcessInputEvents() ProcessInputEvents()
@ -106,10 +106,11 @@ xnestQueueKeyEvent(int type, unsigned int keycode)
{ {
int i, n; int i, n;
GetEventList(&xnestEvents);
lastEventTime = GetTimeInMillis(); lastEventTime = GetTimeInMillis();
n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode); n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
mieqEnqueue(xnestKeyboardDevice, xnestEvents + i); mieqEnqueue(xnestKeyboardDevice, (xnestEvents + i)->event);
} }
void void
@ -119,6 +120,7 @@ xnestCollectEvents(void)
xEvent x; xEvent x;
int i, n, valuators[2]; int i, n, valuators[2];
ScreenPtr pScreen; ScreenPtr pScreen;
GetEventList(&xnestEvents);
while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) { while (XCheckIfEvent(xnestDisplay, &X, xnestNotExposurePredicate, NULL)) {
switch (X.type) { switch (X.type) {
@ -138,7 +140,7 @@ xnestCollectEvents(void)
n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress, n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress,
X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL); X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
mieqEnqueue(xnestPointerDevice, xnestEvents + i); mieqEnqueue(xnestPointerDevice, (xnestEvents + i)->event);
break; break;
case ButtonRelease: case ButtonRelease:
@ -147,7 +149,7 @@ xnestCollectEvents(void)
n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease, n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease,
X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL); X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
mieqEnqueue(xnestPointerDevice, xnestEvents + i); mieqEnqueue(xnestPointerDevice, (xnestEvents + i)->event);
break; break;
case MotionNotify: case MotionNotify:
@ -157,7 +159,7 @@ xnestCollectEvents(void)
n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
0, POINTER_ABSOLUTE, 0, 2, valuators); 0, POINTER_ABSOLUTE, 0, 2, valuators);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
mieqEnqueue(xnestPointerDevice, xnestEvents + i); mieqEnqueue(xnestPointerDevice, (xnestEvents + i)->event);
break; break;
case FocusIn: case FocusIn:
@ -190,7 +192,7 @@ xnestCollectEvents(void)
n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify,
0, POINTER_ABSOLUTE, 0, 2, valuators); 0, POINTER_ABSOLUTE, 0, 2, valuators);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
mieqEnqueue(xnestPointerDevice, xnestEvents + i); mieqEnqueue(xnestPointerDevice, (xnestEvents + i)->event);
xnestDirectInstallColormaps(pScreen); xnestDirectInstallColormaps(pScreen);
} }
} }

View File

@ -45,7 +45,7 @@ is" without express or implied warranty.
Bool xnestDoFullGeneration = True; Bool xnestDoFullGeneration = True;
xEvent *xnestEvents = NULL; EventList *xnestEvents = NULL;
void void
InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
@ -92,10 +92,7 @@ InitInput(int argc, char *argv[])
xnestPointerDevice = AddInputDevice(serverClient, xnestPointerProc, TRUE); xnestPointerDevice = AddInputDevice(serverClient, xnestPointerProc, TRUE);
xnestKeyboardDevice = AddInputDevice(serverClient, xnestKeyboardProc, TRUE); xnestKeyboardDevice = AddInputDevice(serverClient, xnestKeyboardProc, TRUE);
if (!xnestEvents) GetEventList(&xnestEvents);
xnestEvents = (xEvent *) xcalloc(sizeof(xEvent), GetMaximumEventsNum());
if (!xnestEvents)
FatalError("couldn't allocate room for events\n");
RegisterPointerDevice(xnestPointerDevice); RegisterPointerDevice(xnestPointerDevice);
RegisterKeyboardDevice(xnestKeyboardDevice); RegisterKeyboardDevice(xnestKeyboardDevice);