summaryrefslogtreecommitdiff
path: root/xkb/ddxFakeMtn.c
diff options
context:
space:
mode:
Diffstat (limited to 'xkb/ddxFakeMtn.c')
-rw-r--r--xkb/ddxFakeMtn.c92
1 files changed, 77 insertions, 15 deletions
diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c
index 04a8c80e9..c92f2f1da 100644
--- a/xkb/ddxFakeMtn.c
+++ b/xkb/ddxFakeMtn.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/xkb/ddxFakeMtn.c,v 1.4 2001/01/17 22:37:14 dawes Exp $ */
#include <stdio.h>
#define NEED_EVENTS 1
@@ -36,12 +37,28 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XKBsrv.h"
#include "XI.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
+#include "mipointer.h"
+#include "mipointrst.h"
+
extern WindowPtr GetSpriteWindow(
#if NeedFunctionPrototypes
void
#endif
);
+extern void NewCurrentScreen(
+#if NeedFunctionPrototypes
+ ScreenPtr /* newScreen */,
+ int /* x */,
+ int /* y */
+#endif
+);
+
void
#if NeedFunctionPrototypes
XkbDDXFakePointerMotion(unsigned flags,int x,int y)
@@ -52,25 +69,70 @@ XkbDDXFakePointerMotion(flags,x,y)
int y;
#endif
{
-ScreenPtr pScreen;
int oldX,oldY;
+ScreenPtr pScreen, oldScreen;
- pScreen= GetSpriteWindow()->drawable.pScreen;
- GetSpritePosition(&oldX,&oldY);
- if (flags&XkbSA_MoveAbsoluteX)
- oldX= x;
- else oldX+= x;
- if (flags&XkbSA_MoveAbsoluteY)
- oldY= y;
- else oldY+= y;
+ GetSpritePosition(&oldX, &oldY);
+ pScreen = oldScreen = GetSpriteWindow()->drawable.pScreen;
- if (oldX<0) oldX= 0;
- else if (oldX>=pScreen->width) oldX= pScreen->width-1;
- if (oldY<0) oldY= 0;
- else if (oldY>=pScreen->height) oldY= pScreen->height-1;
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ BoxRec box;
+ int i;
+ if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
+ oldX, oldY, &box)) {
+ FOR_NSCREENS(i) {
+ if(i == pScreen->myNum)
+ continue;
+ if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
+ oldX, oldY, &box)) {
+ pScreen = screenInfo.screens[i];
+ break;
+ }
+ }
+ }
+ oldScreen = pScreen;
+
+ if (flags&XkbSA_MoveAbsoluteX)
+ oldX= x;
+ else oldX+= x;
+ if (flags&XkbSA_MoveAbsoluteY)
+ oldY= y;
+ else oldY+= y;
+
+ if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
+ oldX, oldY, &box)) {
+ FOR_NSCREENS(i) {
+ if(i == pScreen->myNum)
+ continue;
+ if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
+ oldX, oldY, &box)) {
+ pScreen = screenInfo.screens[i];
+ break;
+ }
+ }
+ }
+ oldX -= panoramiXdataPtr[pScreen->myNum].x;
+ oldY -= panoramiXdataPtr[pScreen->myNum].y;
+ }
+ else
+#endif
+ {
+ if (flags&XkbSA_MoveAbsoluteX)
+ oldX= x;
+ else oldX+= x;
+ if (flags&XkbSA_MoveAbsoluteY)
+ oldY= y;
+ else oldY+= y;
+
+#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr))
+ (*(GetScreenPrivate(oldScreen))->screenFuncs->CursorOffScreen)
+ (&pScreen, &oldX, &oldY);
+ }
+
+ if (pScreen != oldScreen)
+ NewCurrentScreen(pScreen, oldX, oldY);
if (pScreen->SetCursorPosition)
(*pScreen->SetCursorPosition)(pScreen, oldX, oldY, TRUE);
- return;
}
-