xserver: Branch 'mpx' - 3 commits

Peter Hutterer whot at kemper.freedesktop.org
Thu Jan 11 05:37:22 EET 2007


 Changelog                      |  569 -----------------------------------------
 Xi/exglobals.h                 |    2 
 Xi/extinit.c                   |   52 +++
 Xi/querydp.c                   |    2 
 dix/events.c                   |   85 ++++--
 hw/xfree86/common/xf86Xinput.c |    2 
 include/extinit.h              |   12 
 mi/mieq.c                      |    5 
 8 files changed, 126 insertions(+), 603 deletions(-)

New commits:
diff-tree 5e2f8dee6331645fcbd2734c43698eb4f9c5b116 (from ea82333dc1799a7e013205adbc89874bc8d273cb)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Jan 11 14:05:39 2007 +1030

    mi:	remove core pointer special handling. No event has core pointer as
    	device now.
    
    dix:    zero pSprite memory, stop segfaults on server restart.

diff --git a/dix/events.c b/dix/events.c
index 23fb1ec..0380ad1 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2172,7 +2172,7 @@ void ReinitializeRootWindow(WindowPtr wi
                 REGION_TRANSLATE(pSprite->screen, &pSprite->Reg2,    xoff, yoff);
 
             /* FIXME: if we call ConfineCursorToWindow, must we do anything else? */
-            if ((grab = inputInfo.pointer->grab) && grab->confineTo) {
+            if ((grab = pDev->grab) && grab->confineTo) {
                 if (grab->confineTo->drawable.pScreen 
                         != pSprite->hotPhys.pScreen)
                     pSprite->hotPhys.x = pSprite->hotPhys.y = 0;
@@ -3902,6 +3902,7 @@ ProcGrabPointer(ClientPtr client)
 	    oldCursor = grab->cursor;
 	}
 	tempGrab.cursor = cursor;
+        /* FIXME: refcnt?? */
 	tempGrab.resource = client->clientAsMask;
 	tempGrab.ownerEvents = stuff->ownerEvents;
 	tempGrab.eventMask = stuff->eventMask;
@@ -3958,7 +3959,7 @@ ProcChangeActivePointerGrab(ClientPtr cl
     grab->cursor = newCursor;
     if (newCursor)
 	newCursor->refcnt++;
-    PostNewCursor(inputInfo.pointer);
+    PostNewCursor(device);
     if (oldCursor)
 	FreeCursor(oldCursor, (Cursor)0);
     grab->eventMask = stuff->eventMask;
@@ -4213,6 +4214,7 @@ InitSprite(DeviceIntPtr pDev, Bool hasCu
         SpritePtr pSprite = (SpritePtr)xalloc(sizeof(SpriteRec));
         if (!pSprite)
             FatalError("failed to allocate sprite struct");
+        memset(pSprite, 0, sizeof(SpriteRec));
         pSprite->hot.pScreen = pSprite->hotPhys.pScreen = (ScreenPtr)NULL;
         pSprite->win = NullWindow;
         pSprite->current = NullCursor;
diff --git a/mi/mieq.c b/mi/mieq.c
index 49bf867..0744e6c 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -235,10 +235,7 @@ mieqProcessInputEvents()
              * Use dev to get the correct processing function but supply
              *  e->pDev to pass the correct device 
              */
-            if (e->pDev->isMPDev)
-                dev->public.processInputProc(e->event, e->pDev, e->nevents);
-            else
-                dev->public.processInputProc(e->event, dev, e->nevents);
+            dev->public.processInputProc(e->event, e->pDev, e->nevents);
         }
 
         /* Update the sprite now. Next event may be from different device. */
diff-tree ea82333dc1799a7e013205adbc89874bc8d273cb (from a7ab7932938820a795bb6fb8e0444e0824433b99)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Jan 10 14:52:13 2007 +1030

    Xi:     add missing call for SProcXChangeDeviceCursor
    	add DeviceEnterNotify and DeviceLeaveNotify
    	fix: QueryDevicePointer crashed if called with keyboard device

diff --git a/Changelog b/Changelog
deleted file mode 100644
index 17ee9c5..0000000
--- a/Changelog
+++ /dev/null
@@ -1,575 +0,0 @@
-== 08.01.06 ==
-Xi:     Adding ChangeDeviceCursor request
-
-Files:
-	dix/window.c
-	dix/events.c
-	include/window.h
-	include/windowstr.h
-	Xi/extinit.c
-	Xi/chdevcur.c
-	Xi/chdevcur.h
-	Xi/Makefile.am
-
-____________________________________________________________
-
-xfree86:  fix XI86_SHARED_POINTER flag setting 
-
-File:
-	hw/xfree86/common/xf86Xinput.c
-
-== 20.12.06 ==
-xfree86: Changing "IsMPDevice" to "SharedPointer" option. Devices will default 
-	 to MP devices.
-
-Xi:	Adding QueryDevicePointer request/reply
-	Adding WarpDevicePointer request/reply
-
-Files: 
-	hw/xfree86/common/xf86Xinput.c
-	hw/xfree86/common/xf86Cursor.c
-	hw/xfree86/common/xf86Xinput.h
-	Xi/extinit.c
-	Xi/querydp.c
-	Xi/querydp.h
-	Xi/Makefile.am
-	Xi/warpdevp.c
-	Xi/warpdevp.h
-	dix/cursor.c
-	dix/events.c
-	dix/dix.h
-
-Note: This commit requires libXi additions to use the new functions.
-
-____________________________________________________________
-
-xfree86:  fix xf86ActivateDevice(): only set to MP device if not a keyboard
-
-Files:
-	hw/xfree86/common/xf86Xinput.c
-	include/extinit.h
-	Xi/extinit.c
-
-____________________________________________________________
-removing MPX extension files
-
-Files:
-	mpx/
-	include/mpxevents.h
-	include/mpxextinit.h
-
-____________________________________________________________
-xfree86: fix xf86ProcessCommonOptions() core and shared pointer assignment
-
-Files:
-	hw/xfree86/common/xf86Xinput.c
-
-TAG: mpx-0.3.0
-
-
-== 18.12.06 ==
-mi:     removing MPX ifdefs
-	global sprite renaming in mipointer and misprite
-	fixed: multiple remove cursor call in miSpriteInstallColormap
-	fixed: wrong core pointer usage in miSpriteStoreColors
-
-dix:    bugfix in CheckCursorConfinement
-	removing MPX ifdefs
-	removing MPX event generation (using Xi solely now)
-	bugfix GrabDevice: uninitialized field in grab struct caused segfault
-
-xfree86: removing MPX fdefs
-
-Xi:     removing MPX protocol events
-
-Files:
-	include/inputstr.h
-	mi/midispcur.c
-	mi/mieq.c
-	mi/mipointer.c
-	mi/misprite.c
-	dix/events.c
-	dix/cursor.c
-	dix/devices.c
-	hw/xfree86/common/xf86Events.c
-	hw/xfree86/common/xf86Input.h
-	Xi/exevents.c
-
-____________________________________________________________
-
-Cleaning up #ifdef MPX from remaining files, removing it from configure.ac.
-Removing building mpx extension from Makefile.am
-
-Files:
-	Makefile.am
-	configure.ac
-	hw/xfree86/ramdac/xf86HWCurs.c
-	include/dix-config.h.in
-	include/dix.h
-	include/globals.h
-	include/xorg-server.h.in
-	mi/mieq.c
-	mi/miinitext.c
-	mi/mipointer.c
-	os/utils.c
-
-== 12.12.06 ==
-dix:    Moving SpriteRec into DeviceIntRec
-	removing global sprite structure
-	beginning to remove MPX ifdefs
-
-xnest:  Fix to make xnest compile again 
-
-Files:
-	dix/getevents.c
-	dix/events.c
-	dix/devices.c
-	hw/xfree86/common/xf86Xinput.c
-	include/cursor.h
-	include/dix.h
-	include/dixevents.h
-	include/input.h
-	include/inputstr.h
-	XTrap/xtrapdi.c
-	Xext/xtest.c
-	hw/xnest/Events.c
-	record/record.c
-
-== 05.12.06 ==
-Xi:     adding MPX checks to ProcessOtherEvents
-
-mpx:    adding QueryPointer request and reply
-	adjusting names of requests to Xlib compatible naming (xMPX*** instead of
-	mpx***)
-
-
-Files:
-	Xi/exevents.c
-	mpx/Makefile.am
-	mpx/extinit.c
-	mpx/getevbase.c
-	mpx/getvers.c
-	mpx/queryptr.c
-	mpx/queryptr.h
-	mpx/selectev.c
-	mpx/listdev.h
-	mpx/listdev.c
-	include/mpxextinit.h
-
-____________________________________________________________
-
-Merging from master
-
-____________________________________________________________
-
-Ironing some glitches caused by the merge
-
-Files:
-	Xi/exevents.c
-	randr/rrpointer.c
-	dix/events.c
-
-
-== 01.12.06 ==
-
-mpx:    SelectEvents and GetEventBase requests. 
-	Some renaming and cleaning up in extinit.c
-	MPXLastEvent added 
-
-Xi:	ShouldFreeInputMask() from XI is not static any more, used in mpx
-
-dix:	GetPointerEvents() allocates MPX event for MPX devices.
-	DeliverDeviceEvents() caters for MPX devices.
-
-
-Files:
-	configure.ac
-	mpx/Makefile.am
-	mpx/extinit.c
-	mpx/getvers.c
-	mpx/getevbase.c
-	mpx/getevbase.h
-	mpx/listdev.c
-	mpx/listdev.h
-	mpx/mpxglobals.h
-	mpx/selectev.c
-	mpx/selectev.h
-	mpx/mpxevents.h
-	Xi/exevents.c
-	dix/events.c
-	dix/getevents.c
-	include/mpxevents.h
-	include/mpxextinit.h
-
-
-== 30.11.06
-mpx:    Adding ListDevices request. Minor changes, using
-	MPXRestoreExtensionEvents() when resetting.
-
-Files:
-	mpx/Makefile.am
-	mpx/extinit.c
-	mpx/listdev.c
-	mpx/listdev.h
-	mpx/mpxextinit.h
-
-
-== 29.11.06 ==
-mpx:    Infrastructure for MPX extension, GetExtensionVersion request works.
-
-Files:
-	mpx/
-	mpx/Makefile.am
-	mpx/extinit.c
-	mpx/getvers.c
-	mpx/getvers.h
-	mpxglobals.h
-	mpx/selectev.c
-	configure.ac
-	Makefile.am
-	os/utils.c
-	mi/miinitext.c
-	include/globals.h
-
-== 28.11.06 ==
-mi:     Bugfix: FreeCursor ignores negative refcounts.
-
-mieq:   Bugfix: Motion notifies did overwrite DeviceMotionNotifies
-
-Files:
-	dix/cursor.c
-	mi/mieq.c
-
-____________________________________________________________
-
-dix:	missing parameter to SetCursorPosition in CheckMotion ifndef MPX
-
-mi:	missing include in misprite.c ifndef MPX
-
-Files:
-	dix/events.c
-	mi/misprite.c
-
-
-== 27.11.06 ==
-mi:     free allocated memory in miDCCloseScreen and in miDCInitialize in case
-	of errors.
-	Some copyright notices.
-	misprite.c passes DeviceIntPtr around and down to DC (previously
-	miCursorInfoPtr and the plain device id).
-	Large cleanup in misprite.c to avoid code duplication.
-
-Files:
-	mi/midispcur.c
-	mi/misprite.c
-	mi/misprite.h
-
-____________________________________________________________
-
-mi:     mipointer.c cleanup, reducing code duplication, using MPHasCursor(),
-	removing IsMPDev()
-
-Files:
-	mi/mipointer.c
-
-____________________________________________________________
-
-mi:     malloc checks for misprite and midispcur, code cleanup
-	removed IsMPDev()
-
-Files:
-	mi/misprite.c
-	mi/mipointer.c
-	mi/midispcur.c
-	dix/events.c
-
-
-== 23.11.06 ==
-mi:	closing memory leak, miPointer is freed in miPointerCloseScreen
-	bugfix: uninitialized pPointer in miPointerGetPosition ifndef MPX
-	adding DeviceIntPtr parameter to ScreenRec's cursor functions.
-	cleanup of miPointer code to use same scheme in each function
-
-dix:	MPHasCursor() function determines checking whether to invoke
-	cursor rendering.
-
-animcur: adding DeviceIntPtr parameter to cursor functions but animcur relies
-	 on the core pointer right now.
-
-xfixes: adding DeviceIntPtr parameter to cursor functions but xfixes relies on
-	the core pointer right now.
-
-rac:	adding DeviceIntPtr parameter to cursor functions but RAC relies on
-	the core pointer right now.
-
-ramdac:	adding DeviceIntPtr parameter to cursor functions but ramdac relies on
-	the core pointer right now.
-
-Files:
-	mi/mipointer.c
-	mi/mipointer.h
-	mi/micursor.c
-	mi/mi.h
-	mi/mieq.c
-	include/cursor.h
-	include/inputstr.h
-	include/scrnintstr.h
-	include/dix.h
-	dix/events.c
-	dix/cursor.c
-	Xext/xtest.c
-	render/animcur.c
-	xfixes/cursor.c
-	XTrap/xtrapddmi.c
-	xkb/ddxFakeMtn.c
-	hw/xfree86/common/xf86Cursor.c
-	hw/xfree86/common/xf86RandR.c
-	hw/xfree86/rac/xf86RAC.c
-	hw/xfree86/ramdac/xf86Cursor.c
-	hw/xfree86/dri/dri.c
-
-
-== 22.11.06 ==
-
-mi:     added DevToSprite() conversion function
-        fixed miSpriteRealize to use passed pDev argument instead of looping.
-
-dix:    changed sprite dependency and added MPX functionality to parts of
-        events.c (XineramaChangeToCursor, XineramaCheckPhysLimits,
-        XineramaConstrainCursor)
-
-Xi:	fix: accessing other->buttons for keyboard segfaulted the server
-
-Files:
-        mi/misprite.c
-        mi/mipointer.c
-        dix/events.c
-        Xi/exevents.c
-
-____________________________________________________________
-
-dix	GetSpriteWindow() adjusted for MPX
-	added device dependency for MPX to DoEnterLeaveEvents,
-	EnterLeaveEvents, EnterNotifies, LeaveNotifies and
-	FixUpEventFromWindow.
-
-Files:
-        Xext/security.c
-        Xi/exevents.c
-        xkb/ddxFakeMtn.c
-        dix/events.c
-        include/dix.h
-
-____________________________________________________________
-
-dix:	DeliverEventsToWindow adjusted for MPX
-
-mi:     sprite debugging disabled
-
-Files:	
-        dix/events.c
-        Xi/exevents.c
-        mi/misprite.c
-        include/dix.h
-
-
-== 21.11.06 ==
-mi:     added MPX to miSpriteReportDamage
-        added id field to miCursorInfoPtr, required to pass through to miDC
-        core pointer uses mpCursors array as well.
-        added miDCBufferRec for future use with MPX
-
-Files:
-        mi/midispcur.c
-        mi/misprite.c
-        mi/mispritest.h
-
-TAG: MPX_BEFORE_MIDC_API_BREAK
-
-____________________________________________________________
-
-mi:     added device ID to miSpriteCursorFuncRec functions
-        added MPX code to midispcur.c
-
-
-Files:
-        mi/midispcur.c
-        mi/misprite.c
-        mi/mispritest.h
-
-BUG:   Core pointer changes whenever MPX cursor changes shape.
-
-____________________________________________________________
-
-mi:	constrain MPX cursors to screen 
-
-Files:
-	dix/events.c
-	mi/mipointer.c
-	include/scrnintstr.h
-
-TAG:   MPX_BEFORE_DIX_API_BREAK
-
-
-____________________________________________________________
-
-dix:    moved sprite from static to be pointer of type SpritePtr
-	added SpriteRecs for MPX devices
-	changed sprite dependency and added MPX functionality to parts 
-	of events.c (ConfineToShape, PostNewCursor, XineramaCheckMotion,
-	CheckMotion, XineramaChangeToCursor, ChangeToCursor, CheckPhysLimits,
-	PointerConfinedToScreen) 
-	added DeviceIntRec param to GetSpritePosition(). This required some
-	minor changes in ddx, xtest, xkb and xfixes.
-
-mi:	changed miPointer to pointer instead of static struct.
-
-Files:
-        dix/events.c
-        dix/exevents.c
-        Xext/xtest.c
-        ddx/ddxFakeBtn.c
-        ddx/ddxFakeMtn.c
-        ddx/ddxDevBtn.c
-        xkb/xkbActions.c
-        xfixes/cursor.c
-	mi/mieq.c
-
-____________________________________________________________
-
-dix:	WindowsRestructured() calls CheckMotion() on all devices
-
-mi:	core pointer was checked twice in miSpriteReportDamage,
-	miSpriteInstallColormap, miSpriteStoreColors, miSpriteSaveDoomedAreas
-	and miSpriteRealiseCursor 
-	using damage bug (see comment in file) to avoid artefacts
-
-Files:
-	dix/events.c
-	mi/misprite.c
-	mi/mispritest.h
-
-== 20.11.06 ==
-
-mi:     moved core pointer information from miSpriteScreenRec into a
-        miCursorInfoRec.
-        bugfix in mipointer, semicolon after preprocessor statement
-
-Files:
-        mi/mispritest.h
-        mi/misprite.c
-        mi/mipointer.c
-
-____________________________________________________________
-
-mi:     added MPX to miSprite functions. 
-
-Files:
-        mi/mispritest.h
-        mi/misprite.c
-        mi/mipointer.c
-        dix/events.c
-
-NOTE: This version will render multiple cursors but with an artefact each time
-when devices alternate.
-
-== 17.11.06 ==
-dix:    moved isMPdev field to end of _DeviceIntRec structure
-
-mi:     
-        added miMPPointers array to mipointer.c
-        added DeviceIntPtr to all miPointerSpriteFuncs. Coming from miPointer
-        we use inputInfo.pointer as standard value. ABI BREAK!
-
-ramdac: 
-        forcing failed HW Cursor initialisation. MPX needs software rendering.
-        changes to use new miPointerSpriteFunc (this required externing
-        inputInfo, should probably be fixed at a later point).
-
-
-RAC: changes to use new miPointerSpriteFuncs.
-
-Files: 
-        include/inputstr.h
-        mi/mipointer.c
-        mi/mipointer.h
-        mi/misprite.c
-        hw/xfree86/ramdac/xf86HWCurs.c
-        hw/xfree86/ramdac/xf86Cursor.c
-        hw/xfree86/rac/xf86RAC.c
-
-____________________________________________________________
-
-mi:
-        added miCursorInfoRec to contain info of the MPX cursors.
-        calling miUpdatePointerSprite() from event queue for MPX devices.
-        adding device-specific processing to miPointer*() functions.
-
-dix:    Call to SetCursorPosition in CheckMotion() temporarily disabled.
-
-xfree86/common: call to miPointerUpdateSprite() disabled, is done from the EQ 
-
-NOTE: This build will not display cursor images. 
-BUG: The second mouse does to take correct x coordinates.
-
-Files:
-        mi/mispritestr.h
-        mi/misprite.c
-        mi/mipointer.c
-        mi/mipointer.h
-        mi/mieq.c
-        dix/events.c
-        hw/xfree86/common/xf86Events.c
-
-
-== 16.11.06 ==
-dix: 
-        merge with code cleanup from master
-        GetPointerEvents treats events in the same way as XINPUT devices when flag
-        has POINTER_MULTIPOINTER set.
-
-xfree86/common:
-    added XI86_MP_DEVICE flag and parsing in xf86ProcessCommonOptions
-    added POINTER_MULTIPOINTER define. Is used in xf86PostMotionEvent and
-    xf86PostButtonEvent for the flags that are passed into GetPointerEvents()
-
-global:
-    added flags to configure.ac to enable/disable MPX define
-    added flags to dix-config.h.in to #define MPX
-
-Files:
-        dix/getevents.c
-        hw/xfree86/common/xf86Xinput.c
-        hw/xfree86/common/xf86Xinput.h
-        include/input.h
-        configure.ac
-        include/dix-config.h.in
-
-____________________________________________________________
-
-dix:    added isMPdev field to _DeviceIntRec, is used in GetPointerEvents()
-
-mieq:   avoid merging events from different devices in mieqEnqueue()
-
-xfree86/common
-        isMPdev field used from xf86ActivateDevice(), xf86PostMotionEvent()
-        and xf86PostButtonEvent()
-
-Files:
-        dix/getevents.c
-        hw/xfree86/common/xf86Xinput.c
-        include/inputstr.h
-        mi/mieq.c
-
-____________________________________________________________
-
-mieq:  EQ processing handles MP devices 
-
-global: MPX define added to xorg-server.h.in
-
-xfree86/common: small fix to avoid byte overflow
-
-Files:
-        mi/mieq.c
-        hw/xfree86/common/xf86Xinput.c
-        include/xserver-config.h.in
diff --git a/Xi/exglobals.h b/Xi/exglobals.h
index 3afd1bb..bc4a60d 100644
--- a/Xi/exglobals.h
+++ b/Xi/exglobals.h
@@ -70,6 +70,8 @@ extern int DeviceButtonStateNotify;
 extern int DeviceMappingNotify;
 extern int ChangeDeviceNotify;
 extern int DevicePresenceNotify;
+extern int DeviceEnterNotify;
+extern int DeviceLeaveNotify;
 
 extern int RT_INPUTCLIENT;
 
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 82bed50..8948e6c 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -170,6 +170,8 @@ Mask DeviceOwnerGrabButtonMask;
 Mask DeviceButtonGrabMask;
 Mask DeviceButtonMotionMask;
 Mask DevicePresenceNotifyMask;
+Mask DeviceEnterWindowMask;
+Mask DeviceLeaveWindowMask;
 
 int DeviceValuator;
 int DeviceKeyPress;
@@ -187,6 +189,8 @@ int DeviceButtonStateNotify;
 int DeviceMappingNotify;
 int ChangeDeviceNotify;
 int DevicePresenceNotify;
+int DeviceEnterNotify;
+int DeviceLeaveNotify;
 
 int RT_INPUTCLIENT;
 
@@ -251,6 +255,8 @@ XInputExtensionInit(void)
 	EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
 	EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
 	EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
+	EventSwapVector[DeviceEnterNotify] = SEventIDispatch;
+	EventSwapVector[DeviceLeaveNotify] = SEventIDispatch;
     } else {
 	FatalError("IExtensionInit: AddExtensions failed\n");
     }
@@ -436,6 +442,8 @@ SProcIDispatch(register ClientPtr client
 	return (SProcXQueryDevicePointer(client));
     else if (stuff->data == X_WarpDevicePointer)
 	return (SProcXWarpDevicePointer(client));
+    else if (stuff->data == X_ChangeDeviceCursor)
+        return (SProcXChangeDeviceCursor(client));
     else {
 	SendErrorToClient(client, IReqCode, stuff->data, 0, BadRequest);
     }
@@ -566,6 +574,10 @@ SEventIDispatch(xEvent * from, xEvent * 
 	DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
     else if (type == ChangeDeviceNotify)
 	DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
+    else if (type == DeviceEnterNotify)
+        DO_SWAP(SDeviceEnterNotifyEvent, deviceEnterNotify);
+    else if (type == DeviceLeaveNotify)
+        DO_SWAP(SDeviceLeaveNotifyEvent, deviceLeaveNotify);
     else {
 	FatalError("XInputExtension: Impossible event!\n");
     }
@@ -671,6 +683,31 @@ SDevicePresenceNotifyEvent (devicePresen
     swaps(&to->control, n);
 }
 
+void SDeviceEnterNotifyEvent (deviceEnterNotify *from, deviceEnterNotify *to)
+{
+    register char n;
+
+    *to = *from;
+    swaps(&to->sequenceNumber,n);
+    swapl(&to->time, n);
+}
+
+void SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to)
+{
+    register char n;
+
+    *to = *from;
+    swaps(&to->sequenceNumber,n);
+    swapl(&to->time, n);
+    swapl(&to->root, n);
+    swapl(&to->event, n);
+    swapl(&to->child, n);
+    swaps(&to->rootX, n);
+    swaps(&to->rootY, n);
+    swaps(&to->eventX, n);
+    swaps(&to->eventY, n);
+}
+
 /************************************************************************
  *
  * This function sets up extension event types and masks.
@@ -698,6 +735,8 @@ FixExtensionEvents(ExtensionEntry * extE
     DeviceKeyStateNotify = ChangeDeviceNotify + 1;
     DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
     DevicePresenceNotify = DeviceButtonStateNotify + 1;
+    DeviceEnterNotify = DevicePresenceNotify + 1;
+    DeviceLeaveNotify = DeviceEnterNotify + 1;
 
     event_base[KeyClass] = DeviceKeyPress;
     event_base[ButtonClass] = DeviceButtonPress;
@@ -773,6 +812,15 @@ FixExtensionEvents(ExtensionEntry * extE
 
     DevicePresenceNotifyMask = GetNextExtEventMask();
     SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
+
+    DeviceEnterWindowMask = GetNextExtEventMask();
+    SetMaskForExtEvent(DeviceEnterWindowMask, DeviceEnterNotify);
+    AllowPropagateSuppress(DeviceEnterWindowMask);
+
+    DeviceLeaveWindowMask = GetNextExtEventMask();
+    SetMaskForExtEvent(DeviceLeaveWindowMask, DeviceLeaveNotify);
+    AllowPropagateSuppress(DeviceLeaveWindowMask);
+
     SetEventInfo(0, _noExtensionEvent);
 }
 
@@ -814,6 +862,8 @@ RestoreExtensionEvents(void)
     DeviceKeyStateNotify = 13;
     DeviceButtonStateNotify = 13;
     DevicePresenceNotify = 14;
+    DeviceEnterNotify = 15;
+    DeviceLeaveNotify = 16;
 
     BadDevice = 0;
     BadEvent = 1;
@@ -852,6 +902,8 @@ IResetProc(ExtensionEntry * unused)
     EventSwapVector[DeviceMappingNotify] = NotImplemented;
     EventSwapVector[ChangeDeviceNotify] = NotImplemented;
     EventSwapVector[DevicePresenceNotify] = NotImplemented;
+    EventSwapVector[DeviceEnterNotify] = NotImplemented;
+    EventSwapVector[DeviceLeaveNotify] = NotImplemented;
     RestoreExtensionEvents();
 }
 
diff --git a/Xi/querydp.c b/Xi/querydp.c
index 04323e4..c1ba2ee 100644
--- a/Xi/querydp.c
+++ b/Xi/querydp.c
@@ -84,7 +84,7 @@ ProcXQueryDevicePointer(register ClientP
     REQUEST_SIZE_MATCH(xQueryDevicePointerReq);
 
     pDev = LookupDeviceIntRec(stuff->deviceid);
-    if (pDev == NULL) {
+    if (pDev == NULL || pDev->valuator == NULL) {
         SendErrorToClient(client, IReqCode, X_QueryDevicePointer,
                 stuff->deviceid, BadDevice); 
         return Success;
diff --git a/dix/events.c b/dix/events.c
index 3c11723..23fb1ec 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3322,13 +3322,17 @@ EnterLeaveEvent(
     register WindowPtr pWin,
     Window child)
 {
-    xEvent		event;
+    xEvent              event;
     register DeviceIntPtr keybd = inputInfo.keyboard;
     WindowPtr		focus;
     register DeviceIntPtr mouse = pDev;
     register GrabPtr	grab = mouse->grab;
     Mask		mask;
 
+    deviceEnterNotify   *devEnterLeave;
+    int                 mskidx;
+    OtherInputMasks     *inputMasks;
+
     if ((pWin == mouse->valuator->motionHintWindow) &&
 	(detail != NotifyInferior))
 	mouse->valuator->motionHintWindow = NullWindow;
@@ -3342,33 +3346,35 @@ EnterLeaveEvent(
     {
 	mask = pWin->eventMask | wOtherEventMasks(pWin);
     }
-    if (mask & filters[type])
-    {
-	event.u.u.type = type;
-	event.u.u.detail = detail;
-	event.u.enterLeave.time = currentTime.milliseconds;
-	event.u.enterLeave.rootX = pDev->pSprite->hot.x;
-	event.u.enterLeave.rootY = pDev->pSprite->hot.y;
-	/* Counts on the same initial structure of crossing & button events! */
-	FixUpEventFromWindow(mouse, &event, pWin, None, FALSE);
-	/* Enter/Leave events always set child */
-	event.u.enterLeave.child = child;
-	event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ?
-					    ELFlagSameScreen : 0;
+
+    event.u.u.type = type;
+    event.u.u.detail = detail;
+    event.u.enterLeave.time = currentTime.milliseconds;
+    event.u.enterLeave.rootX = pDev->pSprite->hot.x;
+    event.u.enterLeave.rootY = pDev->pSprite->hot.y;
+    /* Counts on the same initial structure of crossing & button events! */
+    FixUpEventFromWindow(mouse, &event, pWin, None, FALSE);
+    /* Enter/Leave events always set child */
+    event.u.enterLeave.child = child;
+    event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ?
+        ELFlagSameScreen : 0;
 #ifdef XKB
-	if (!noXkbExtension) {
-	    event.u.enterLeave.state = mouse->button->state & 0x1f00;
-	    event.u.enterLeave.state |= 
-			XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
-	} else
+    if (!noXkbExtension) {
+        event.u.enterLeave.state = mouse->button->state & 0x1f00;
+        event.u.enterLeave.state |= 
+            XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
+    } else
 #endif
-	event.u.enterLeave.state = keybd->key->state | mouse->button->state;
-	event.u.enterLeave.mode = mode;
-	focus = keybd->focus->win;
-	if ((focus != NoneWin) &&
-	    ((pWin == focus) || (focus == PointerRootWin) ||
-	     IsParent(focus, pWin)))
-	    event.u.enterLeave.flags |= ELFlagFocus;
+        event.u.enterLeave.state = keybd->key->state | mouse->button->state;
+    event.u.enterLeave.mode = mode;
+    focus = keybd->focus->win;
+    if ((focus != NoneWin) &&
+            ((pWin == focus) || (focus == PointerRootWin) ||
+             IsParent(focus, pWin)))
+        event.u.enterLeave.flags |= ELFlagFocus;
+
+    if (mask & filters[type])
+    {
 	if (grab)
 	    (void)TryClientEvents(rClient(grab), &event, 1, mask,
 				  filters[type], grab);
@@ -3376,6 +3382,27 @@ EnterLeaveEvent(
 	    (void)DeliverEventsToWindow(pDev, pWin, &event, 1, filters[type],
 					NullGrab, 0);
     }
+
+    devEnterLeave = (deviceEnterNotify*)&event;
+    devEnterLeave->type = (type == EnterNotify) ? DeviceEnterNotify :
+        DeviceLeaveNotify;
+    devEnterLeave->type = (type == EnterNotify) ? DeviceEnterNotify :
+        DeviceLeaveNotify;
+    devEnterLeave->deviceid = pDev->id;
+    mskidx = pDev->id;
+    inputMasks = wOtherInputMasks(pWin);
+    if (inputMasks && 
+       (filters[devEnterLeave->type] & inputMasks->deliverableEvents[mskidx]))
+    {
+        if (grab)
+            (void)TryClientEvents(rClient(grab), (xEvent*)devEnterLeave, 1,
+                                  mask, filters[devEnterLeave->type], grab);
+	else
+	    (void)DeliverEventsToWindow(pDev, pWin, (xEvent*)devEnterLeave, 
+                                        1, filters[devEnterLeave->type], 
+                                        NullGrab, pDev->id);
+    }
+
     if ((type == EnterNotify) && (mask & KeymapStateMask))
     {
 	xKeymapEvent ke;
diff --git a/include/extinit.h b/include/extinit.h
index 5546b21..6cf7bf7 100644
--- a/include/extinit.h
+++ b/include/extinit.h
@@ -110,6 +110,18 @@ SDevicePresenceNotifyEvent (
        );
 
 void
+SDeviceEnterNotifyEvent (
+        deviceEnterNotify * /* from */,
+        deviceEnterNotify * /* to */
+        );
+
+void
+SDeviceLeaveNotifyEvent (
+        deviceLeaveNotify * /* from */,
+        deviceLeaveNotify * /* to */
+        );
+
+void
 FixExtensionEvents (
 	ExtensionEntry 	*      /* extEntry */
 	);
diff-tree a7ab7932938820a795bb6fb8e0444e0824433b99 (from 95e1a88050dde61e9b2407428042a43e47b46e18)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Mon Jan 8 17:31:16 2007 +1030

    xfree86:  fix XI86_SHARED_POINTER flag setting

diff --git a/Changelog b/Changelog
index 431e008..17ee9c5 100644
--- a/Changelog
+++ b/Changelog
@@ -11,6 +11,12 @@ Files:
 	Xi/chdevcur.h
 	Xi/Makefile.am
 
+____________________________________________________________
+
+xfree86:  fix XI86_SHARED_POINTER flag setting 
+
+File:
+	hw/xfree86/common/xf86Xinput.c
 
 == 20.12.06 ==
 xfree86: Changing "IsMPDevice" to "SharedPointer" option. Devices will default 
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index fd2a451..dc07b3f 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -134,7 +134,7 @@ xf86ProcessCommonOptions(LocalDevicePtr 
     }
 
     if (xf86SetBoolOption(list, "SharedPointer", 0)) {
-        local->flags &= ~XI86_SHARED_POINTER;
+        local->flags |= XI86_SHARED_POINTER;
         xf86Msg(X_CONFIG, "%s: is shared device\n", local->name);
     } 
 



More information about the xorg-commit mailing list