diff options
Diffstat (limited to 'mi')
-rw-r--r-- | mi/mi.h | 2 | ||||
-rw-r--r-- | mi/midispcur.c | 2 | ||||
-rw-r--r-- | mi/mieq.c | 142 | ||||
-rw-r--r-- | mi/miinitext.c | 8 | ||||
-rw-r--r-- | mi/miscrinit.c | 4 |
5 files changed, 76 insertions, 82 deletions
@@ -224,7 +224,7 @@ extern _X_EXPORT void mieqProcessInputEvents( extern DeviceIntPtr CopyGetMasterEvent( DeviceIntPtr /* sdev */, InternalEvent* /* original */, - EventListPtr /* mlist */ + InternalEvent* /* copy */ ); /** diff --git a/mi/midispcur.c b/mi/midispcur.c index 7b3ce292e..3fb7e02b5 100644 --- a/mi/midispcur.c +++ b/mi/midispcur.c @@ -51,7 +51,7 @@ in this Software without prior written authorization from The Open Group. # include "picturestr.h" #endif -# include "inputstr.h" /* for MAX_DEVICES */ +# include "inputstr.h" /* per-screen private data */ static int miDCScreenKeyIndex; @@ -51,11 +51,11 @@ in this Software without prior written authorization from The Open Group. # include <X11/extensions/geproto.h> # include "extinit.h" # include "exglobals.h" +# include "eventstr.h" #ifdef DPMSExtension # include "dpmsproc.h" -# define DPMS_SERVER -# include <X11/extensions/dpms.h> +# include <X11/extensions/dpmsconst.h> #endif #define QUEUE_SIZE 512 @@ -78,7 +78,6 @@ typedef struct _EventQueue { } EventQueueRec, *EventQueuePtr; static EventQueueRec miEventQueue; -static EventListPtr masterEvents; /* for use in mieqProcessInputEvents */ #ifdef XQUARTZ #include <pthread.h> @@ -117,16 +116,6 @@ mieqInit(void) miEventQueue.events[i].events = evlist; } - /* XXX: mE is just 1 event long, if we have Motion + Valuator they are - * squashed into the first event to make passing it into the event - * processing handlers easier. This should be fixed when the processing - * handlers switch to EventListPtr instead of xEvent */ - masterEvents = InitEventList(1); - if (!masterEvents) - FatalError("Could not allocated MD event queue.\n"); - SetMinimumEventSize(masterEvents, 1, - (1 + MAX_VALUATOR_EVENTS) * sizeof(xEvent)); - SetInputCheck(&miEventQueue.head, &miEventQueue.tail); return TRUE; } @@ -170,26 +159,26 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e) if (isMotion && isMotion == miEventQueue.lastMotion && oldtail != miEventQueue.head) { - oldtail = (oldtail - 1) % QUEUE_SIZE; + oldtail = (oldtail - 1) % QUEUE_SIZE; } else { - static int stuck = 0; - /* Toss events which come in late. Usually this means your server's + static int stuck = 0; + /* Toss events which come in late. Usually this means your server's * stuck in an infinite loop somewhere, but SIGIO is still getting * handled. */ - if (((oldtail + 1) % QUEUE_SIZE) == miEventQueue.head) { - if (!stuck) { + if (((oldtail + 1) % QUEUE_SIZE) == miEventQueue.head) { + if (!stuck) { ErrorF("[mi] EQ overflowing. The server is probably stuck " "in an infinite loop.\n"); - xorg_backtrace(); - stuck = 1; - } + xorg_backtrace(); + stuck = 1; + } #ifdef XQUARTZ - pthread_mutex_unlock(&miEventQueueMutex); + pthread_mutex_unlock(&miEventQueueMutex); #endif - return; + return; } - stuck = 0; + stuck = 0; } evlen = e->any.length; @@ -218,7 +207,7 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e) e->any.time = miEventQueue.lastEventTime; miEventQueue.lastEventTime = ((InternalEvent*)evt->event)->any.time; - miEventQueue.events[oldtail].pScreen = EnqueueScreen(pDev); + miEventQueue.events[oldtail].pScreen = pDev ? EnqueueScreen(pDev) : NULL; miEventQueue.events[oldtail].pDev = pDev; miEventQueue.lastMotion = isMotion; @@ -236,7 +225,7 @@ mieqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX) #endif EnqueueScreen(pDev) = pScreen; if (fromDIX) - DequeueScreen(pDev) = pScreen; + DequeueScreen(pDev) = pScreen; #ifdef XQUARTZ pthread_mutex_unlock(&miEventQueueMutex); #endif @@ -278,10 +267,14 @@ ChangeDeviceID(DeviceIntPtr dev, InternalEvent* event) event->device.deviceid = dev->id; break; #if XFreeXDGA - case ET_DGAEvent: - break; + case ET_DGAEvent: + break; #endif - case ET_Raw: + case ET_RawKeyPress: + case ET_RawKeyRelease: + case ET_RawButtonPress: + case ET_RawButtonRelease: + case ET_RawMotion: event->raw.deviceid = dev->id; break; default: @@ -313,16 +306,15 @@ FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev, * Copy the given event into master. * @param sdev The slave device the original event comes from * @param original The event as it came from the EQ - * @param master The event after being copied + * @param copy The event after being copied * @return The master device or NULL if the device is a floating slave. */ DeviceIntPtr CopyGetMasterEvent(DeviceIntPtr sdev, - InternalEvent* original, EventListPtr mlist) + InternalEvent* original, InternalEvent *copy) { DeviceIntPtr mdev; int len = original->any.length; - InternalEvent *mevent; CHECKEVENT(original); @@ -347,15 +339,9 @@ CopyGetMasterEvent(DeviceIntPtr sdev, break; } - - if (mlist->evlen < len) - SetMinimumEventSize(mlist, 1, len); - - mevent = (InternalEvent*)mlist->event; - - memcpy(mevent, original, len); - ChangeDeviceID(mdev, mevent); - FixUpEventForMaster(mdev, sdev, original, mevent); + memcpy(copy, original, len); + ChangeDeviceID(mdev, copy); + FixUpEventForMaster(mdev, sdev, original, copy); return mdev; } @@ -374,45 +360,55 @@ mieqProcessDeviceEvent(DeviceIntPtr dev, mieqHandler handler; int x = 0, y = 0; DeviceIntPtr master; + InternalEvent mevent; /* master event */ CHECKEVENT(event); /* Custom event handler */ handler = miEventQueue.handlers[event->any.type]; - if (screen && screen != DequeueScreen(dev) && !handler) { - /* Assumption - screen switching can only occur on motion events. */ - DequeueScreen(dev) = screen; - x = event->device.root_x; - y = event->device.root_y; - NewCurrentScreen (dev, DequeueScreen(dev), x, y); + switch (event->any.type) { + /* Catch events that include valuator information and check if they + * are changing the screen */ + case ET_Motion: + case ET_KeyPress: + case ET_KeyRelease: + case ET_ButtonPress: + case ET_ButtonRelease: + if (dev && screen && screen != DequeueScreen(dev) && !handler) { + DequeueScreen(dev) = screen; + x = event->device.root_x; + y = event->device.root_y; + NewCurrentScreen (dev, DequeueScreen(dev), x, y); + } + break; + default: + break; } - else { - master = CopyGetMasterEvent(dev, event, masterEvents); + master = CopyGetMasterEvent(dev, event, &mevent); - /* If someone's registered a custom event handler, let them - * steal it. */ - if (handler) - { - handler(DequeueScreen(dev)->myNum, event, dev); - if (master) - { - master->u.lastSlave = dev; - handler(DequeueScreen(master)->myNum, - (InternalEvent*)masterEvents->event, master); - } - } else - { - /* process slave first, then master */ - dev->public.processInputProc(event, dev); - - /* Check for the SD's master in case the device got detached - * during event processing */ - if (master && dev->u.master) - master->public.processInputProc( - (InternalEvent*)masterEvents->event, - master); - } + if (master) + master->u.lastSlave = dev; + + /* If someone's registered a custom event handler, let them + * steal it. */ + if (handler) + { + int screenNum = dev && DequeueScreen(dev) ? DequeueScreen(dev)->myNum : (screen ? screen->myNum : 0); + handler(screenNum, event, dev); + /* Check for the SD's master in case the device got detached + * during event processing */ + if (master && dev->u.master) + handler(screenNum, &mevent, master); + } else + { + /* process slave first, then master */ + dev->public.processInputProc(event, dev); + + /* Check for the SD's master in case the device got detached + * during event processing */ + if (master && dev->u.master) + master->public.processInputProc(&mevent, master); } } @@ -454,7 +450,7 @@ mieqProcessInputEvents(void) pthread_mutex_unlock(&miEventQueueMutex); #endif - master = (!IsMaster(dev) && dev->u.master) ? dev->u.master : NULL; + master = (dev && !IsMaster(dev) && dev->u.master) ? dev->u.master : NULL; if (screenIsSaved == SCREEN_SAVER_ON) dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); diff --git a/mi/miinitext.c b/mi/miinitext.c index 9520957ee..7f59126a4 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -156,17 +156,15 @@ typedef void (*InitExtension)(INITARGS); #endif #ifdef MITSHM -#define _XSHM_SERVER_ -#include <X11/extensions/shmstr.h> +#include <X11/extensions/shm.h> #endif #ifdef XTEST -#define _XTEST_SERVER_ -#include <X11/extensions/XTest.h> +#include <X11/extensions/xtestconst.h> #endif #include <X11/extensions/XKB.h> #ifdef XCSECURITY #include "securitysrv.h" -#include <X11/extensions/securstr.h> +#include <X11/extensions/secur.h> #endif #ifdef XSELINUX #include "xselinux.h" diff --git a/mi/miscrinit.c b/mi/miscrinit.c index fe768f4a9..96113d65d 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -39,8 +39,8 @@ from The Open Group. #include "dix.h" #include "miline.h" #ifdef MITSHM -#define _XSHM_SERVER_ -#include <X11/extensions/XShm.h> +#include <X11/extensions/shm.h> +#include "shmint.h" #endif /* We use this structure to propogate some information from miScreenInit to |