~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to xkb/ddxFakeMtn.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XdotOrg: xserver/xorg/xkb/ddxFakeMtn.c,v 1.5 2005/07/03 07:02:09 daniels Exp $ */
 
2
/* $Xorg: ddxFakeMtn.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */
 
3
/************************************************************
 
4
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
 
5
 
 
6
Permission to use, copy, modify, and distribute this
 
7
software and its documentation for any purpose and without
 
8
fee is hereby granted, provided that the above copyright
 
9
notice appear in all copies and that both that copyright
 
10
notice and this permission notice appear in supporting
 
11
documentation, and that the name of Silicon Graphics not be 
 
12
used in advertising or publicity pertaining to distribution 
 
13
of the software without specific prior written permission.
 
14
Silicon Graphics makes no representation about the suitability 
 
15
of this software for any purpose. It is provided "as is"
 
16
without any express or implied warranty.
 
17
 
 
18
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
 
19
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
 
20
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
 
21
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
 
22
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
 
23
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
 
24
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
 
25
THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
26
 
 
27
********************************************************/
 
28
/* $XFree86: xc/programs/Xserver/xkb/ddxFakeMtn.c,v 1.5 2003/09/13 16:39:01 dawes Exp $ */
 
29
 
 
30
#ifdef HAVE_DIX_CONFIG_H
 
31
#include <dix-config.h>
 
32
#endif
 
33
 
 
34
#include <stdio.h>
 
35
#define NEED_EVENTS 1
 
36
#include <X11/X.h>
 
37
#include <X11/Xproto.h>
 
38
#include <X11/keysym.h>
 
39
#include "inputstr.h"
 
40
#include "scrnintstr.h"
 
41
#include "windowstr.h"
 
42
#include <X11/extensions/XKBsrv.h>
 
43
#include <X11/extensions/XI.h>
 
44
 
 
45
#ifdef PANORAMIX
 
46
#include "panoramiX.h"
 
47
#include "panoramiXsrv.h"
 
48
#endif
 
49
 
 
50
#include "mipointer.h"
 
51
#include "mipointrst.h"
 
52
 
 
53
void
 
54
XkbDDXFakePointerMotion(unsigned flags,int x,int y)
 
55
{
 
56
int                oldX,oldY;
 
57
ScreenPtr          pScreen, oldScreen;
 
58
 
 
59
    GetSpritePosition(&oldX, &oldY);
 
60
    pScreen = oldScreen = GetSpriteWindow()->drawable.pScreen;
 
61
 
 
62
#ifdef PANORAMIX
 
63
    if (!noPanoramiXExtension) {
 
64
        BoxRec box;
 
65
        int i;
 
66
 
 
67
        if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
 
68
                                                            oldX, oldY, &box)) {
 
69
            FOR_NSCREENS(i) {
 
70
                if(i == pScreen->myNum)
 
71
                    continue;
 
72
                if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
 
73
                                   oldX, oldY, &box)) {
 
74
                    pScreen = screenInfo.screens[i];
 
75
                    break;
 
76
                }
 
77
            }
 
78
        }
 
79
        oldScreen = pScreen;
 
80
 
 
81
        if (flags&XkbSA_MoveAbsoluteX)
 
82
             oldX=  x;
 
83
        else oldX+= x;
 
84
        if (flags&XkbSA_MoveAbsoluteY)
 
85
             oldY=  y;
 
86
        else oldY+= y;
 
87
 
 
88
        if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
 
89
                                                            oldX, oldY, &box)) {
 
90
            FOR_NSCREENS(i) {
 
91
                if(i == pScreen->myNum)
 
92
                    continue;
 
93
                if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
 
94
                                   oldX, oldY, &box)) {
 
95
                    pScreen = screenInfo.screens[i];
 
96
                    break;
 
97
                }
 
98
            }
 
99
        }
 
100
        oldX -= panoramiXdataPtr[pScreen->myNum].x;
 
101
        oldY -= panoramiXdataPtr[pScreen->myNum].y;
 
102
    }
 
103
    else
 
104
#endif
 
105
    {
 
106
        if (flags&XkbSA_MoveAbsoluteX)
 
107
             oldX=  x;
 
108
        else oldX+= x;
 
109
        if (flags&XkbSA_MoveAbsoluteY)
 
110
             oldY=  y;
 
111
        else oldY+= y;
 
112
 
 
113
#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr)) 
 
114
        (*(GetScreenPrivate(oldScreen))->screenFuncs->CursorOffScreen)
 
115
            (&pScreen, &oldX, &oldY);
 
116
    }
 
117
 
 
118
    if (pScreen != oldScreen)
 
119
        NewCurrentScreen(pScreen, oldX, oldY);
 
120
    if (pScreen->SetCursorPosition)
 
121
        (*pScreen->SetCursorPosition)(pScreen, oldX, oldY, TRUE);
 
122
}