xserver-multidpi/mi/mipointer.c

753 lines
24 KiB
C
Raw Permalink Normal View History

2003-11-14 16:54:54 +01:00
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/**
* @file
* This file contains functions to move the pointer on the screen and/or
* restrict its movement. These functions are divided into two sets:
* Screen-specific functions that are used as function pointers from other
* parts of the server (and end up heavily wrapped by e.g. animcur and
* xfixes):
* miPointerConstrainCursor
* miPointerCursorLimits
* miPointerDisplayCursor
* miPointerRealizeCursor
* miPointerUnrealizeCursor
* miPointerSetCursorPosition
* miRecolorCursor
* miPointerDeviceInitialize
* miPointerDeviceCleanup
* If wrapped, these are the last element in the wrapping chain. They may
* call into sprite-specific code through further function pointers though.
*
* The second type of functions are those that are directly called by the
* DIX, DDX and some drivers.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "mi.h"
#include "scrnintstr.h"
#include "mipointrst.h"
#include "cursorstr.h"
#include "dixstruct.h"
#include "inputstr.h"
#include "inpututils.h"
#include "eventstr.h"
2003-11-14 16:54:54 +01:00
typedef struct {
ScreenPtr pScreen; /* current screen */
ScreenPtr pSpriteScreen; /* screen containing current sprite */
CursorPtr pCursor; /* current cursor */
CursorPtr pSpriteCursor; /* cursor on screen */
BoxRec limits; /* current constraints */
Bool confined; /* pointer can't change screens */
int x, y; /* hot spot location */
int devx, devy; /* sprite position */
Bool generateEvent; /* generate an event during warping? */
} miPointerRec, *miPointerPtr;
DevPrivateKeyRec miPointerScreenKeyRec;
2003-11-14 16:54:54 +01:00
#define GetScreenPrivate(s) ((miPointerScreenPtr) \
dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey))
2003-11-14 16:54:54 +01:00
#define SetupScreen(s) miPointerScreenPtr pScreenPriv = GetScreenPrivate(s)
DevPrivateKeyRec miPointerPrivKeyRec;
2003-11-14 16:54:54 +01:00
#define MIPOINTER(dev) \
(IsFloating(dev) ? \
(miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \
(miPointerPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miPointerPrivKey))
static Bool miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor);
static Bool miPointerUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor);
static Bool miPointerDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor);
2006-11-21 05:16:00 +01:00
static void miPointerConstrainCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
BoxPtr pBox);
static void miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor, BoxPtr pHotBox,
BoxPtr pTopLeftBox);
static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y, Bool generateEvent);
api: rework the X server driver API to avoid global arrays. This is a squash merge containing all the API changes, as well as the video ABI bump. Its been squashed to make bisection easier. Full patch log below: commit b202738bbf0c5a1c1172767119c2c71f1e7f8070 Author: Aaron Plattner <aplattner@nvidia.com> Date: Mon May 14 15:16:11 2012 -0700 xfree86: Bump video ABI to 13.0 The ABI was broken by changes to convert from screen index numbers to ScreenPtr / ScrnInfoPtr in various structures and function signatures. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 3d5f7d9f8d408bcad3f83277d255f25d3b0edbf3 Author: Dave Airlie <airlied@redhat.com> Date: Thu May 24 10:56:57 2012 +0100 xf86: xf86ClearEntityListForScreen should take a pScrn When adding GPU screens this make life easier. (also fix comment, as pointed out by Alan) Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dave Airlie <airlied@redhat.com> commit afee8b5ab4501597ecc1ade34124d7ca227ab055 Author: Dave Airlie <airlied@redhat.com> Date: Thu May 24 07:07:32 2012 +0100 xf86i2c: add pscrn for drivers to use This just adds a pScrn pointer into the struct for the drivers to use instead of scrnIndex. Mostly scrnIndex is used for logging, but some drivers use it to lookup xf86Screens, so let them stash a pScrn instead. Removing the scrnIndex is a bit more involved and I'm not sure its worth the effort. Doing i2c in the X server is legacy code as far as I'm concerned. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit ea5092f1f679691d187f1eee9427e6057beec56e Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 19:25:20 2012 +0100 dix/gc: consolidate GC object creation in one place The standard GC create and scratch GC create were 90% the same really, and I have a need in the future for creating GC objects without the other bits, so wanted to avoid a third copy. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 3d91482ea9b4883e64e496f2768168e0ffa21ba1 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 10:24:06 2012 +0100 xf86: add a define to denote the new non-index interfaces are being used This can be used by drivers to provide compatible APIs. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 37c3ae3e6cd4f3dedc72f371096d6743f8f99df3 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 15:09:12 2012 +0100 dix: make Create/Free scratch pixmaps take a ScreenPtr While technically an API/ABI change I doubt anyone uses it, but it helps in splitting screens up. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 75f2062a3fe94f04764ecc7d2ff2fbbeccb9da60 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 14:57:55 2012 +0100 xf86/xv: remove scrnIndexfrom xf86FindXvOptions. Move this interface to taking an ScrnInfoPtr. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit f80c2374f40ea7b2ee0556e2e76cc07406f3d843 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 14:53:59 2012 +0100 xf86: make xf86DeleteScreen take a ScrnInfoPtr (v2) stop passing indices into this function. v2: drop flags argument. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 58824e414f35682435f15bfe6c4b656bd90b9235 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 14:48:09 2012 +0100 xf86: fix xf86IsScreenPrimary interface to take a pScrn (API/ABI) Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 6b4fc1f9d391bcdf7ca288766e49bce60f4635cd Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:18:59 2012 +0100 xserver: convert block/wakeup handlers to passing ScreenPtr (ABI/API) (v2) Instead of passing an index, pass the actual ScreenPtr. This allows more moving towards not abusing xf86Screens + screenInfo. v2: drop the blockData/wakeupData args as per ajax's suggestion., fix docs. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 790d003de20fb47674420a24dadd92412d78620d Author: Dave Airlie <airlied@gmail.com> Date: Wed Apr 11 09:53:14 2012 +0100 xf86/common: remove some more pScrn->pScreen uses remove some more conversions that appeared after api cleanups. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit aac85e18d1dd093f2cad6bd29375e40bd7af0b8f Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 16:34:53 2012 +0100 ddc: change API to take ScrnInfoPtr (v2) This removes all xf86Screens usage from ddc code, it modifies the API for some functions to avoid taking indices. v2: address Alan's comments about dropping DDC2Init parameter. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit fe3f57b6eaf6860a33876a54f9439f69578f03a5 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 16:31:26 2012 +0100 vbe: don't use index for VBEInterpretPanelID (API) Remove use of xf86screens from vbe module. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit abf1965f4ed91529036d3fdb470d6a3ce6f29675 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 16:25:11 2012 +0100 int10/vbe: don't use xf86Screens. (ABI) (v3) Pass the ScrnInfoPtr instead of the index in the int10 struct. This saves us using it to dereference xf86Screens. v2: address Alan's comment to fix struct alignment. v3: squash in all the int10 fixes, test the vm86 code builds, after comments by Keith. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 23cca612b4fb5efc33683c7624b803b457387e3d Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:30:18 2012 +0100 xserver: drop index argument to ScreenInit (ABI/API) (v2) This drops the index argument, its the same as pScreen->myNum, and its the last major index abuse I can find. v2: address Alan's review - update docs, fix xwin/xnest/darwin Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 40d360e2d7e832407f3ed64e3a02c27ecc89a960 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:23:01 2012 +0100 xf86: migrate PointerMoved from index to ScrnInfoPtr (ABI/API) This migrates PointerMoved from an index to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit aa60a2f38679d0eeb979a9c2648c9bc771409bf9 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:20:46 2012 +0100 xf86: migrate PMEvent to a ScrnInfoPtr (ABI/API) This migrates the PMEvent from index to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit d3f28ef44371ed4a039ffc5dd7eb6408d1269ba2 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:18:30 2012 +0100 xf86: migrate SetDGAMode from index to ScrnInfoPtr (ABI/API) This migrates the SetDGAMode callback from an index to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit baf5e4818a74f2b68c3dfdcc56f54322351039a0 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:14:11 2012 +0100 xf86: migrate ChangeGamma from index to ScrnInfoPtr (ABI/API) (v2) This migrates the ChangeGamma interface to avoid passing a index. v2: fix xf86RandR12.c + xf86cmap.c call Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 51e5f90ada929d6b23176090badbb42fdb3fa550 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:11:09 2012 +0100 xf86/exa: migrate index to screen types for EnableDisableFBAccess (ABI/API) The EXA interface migrates to ScreenPtr, and the xf86 interface migrated to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 94f1f21d17e86f96d4a54292a399160950087675 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:02:11 2012 +0100 xf86: migrate ValidMode callback to ScrnInfoPtr (ABI/API) This migrates the ValidMode to passing a ScrnInfoPtr instead of an index. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 3f8f18198fed4f39ec805b508a3482e91eea26b2 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:59:46 2012 +0100 xf86: migrate SwitchMode to taking ScrnInfoPtr (ABI/API) (v2) This migrate the SwitchMode interface to take a ScrnInfoPtr instead of an index. v2: drop flags. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit d06a038a5c49328ab3a8d969d24f9fcd22c63202 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:50:37 2012 +0100 xf86: move AdjustFrame to passing ScrnInfoPtr (ABI/API) (v2) This converts AdjustFrame code paths to passing a ScrnInfoPtr instead of an integer index. v2: drop flags args. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 53d2f8608ffd4090d08e7d5cf2e92fb954959b90 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:41:27 2012 +0100 xf86: modify FreeScreen callback to take pScrn instead of index. (ABI/API) (v2) Another index->pScrn conversion. v2: drop flags arg. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 60db37c0b247052e0f5c54b1921fe58a3609c2e3 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:35:41 2012 +0100 xf86: change EnterVT/LeaveVT to take a ScrnInfoPtr (ABI/API break) (v2) This modifies the EnterVT/LeaveVT interfaces to take a ScrnInfoPtr instead of an index into xf86Screens. This allows dropping more public dereferences of the xf86Screens and screenInfo. v2: drop flags args as suggested by Keith, fix docs. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 06729dbbc804a20242e6499f446acb5d94023c3c Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:04:59 2012 +0100 xserver: remove index from CloseScreen (API/ABI breakage) This drops the index from the CloseScreen callback, its always been useless really, since the pScreen contains it. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 14:22:18 +02:00
static Bool miPointerCloseScreen(ScreenPtr pScreen);
static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
static void miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x,
int y);
2003-11-14 16:54:54 +01:00
static InternalEvent *mipointermove_events; /* for WarpPointer MotionNotifies */
Bool
miPointerInitialize(ScreenPtr pScreen,
miPointerSpriteFuncPtr spriteFuncs,
miPointerScreenFuncPtr screenFuncs, Bool waitForUpdate)
2003-11-14 16:54:54 +01:00
{
miPointerScreenPtr pScreenPriv;
2003-11-14 16:54:54 +01:00
if (!dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
if (!dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0))
return FALSE;
pScreenPriv = malloc(sizeof(miPointerScreenRec));
2003-11-14 16:54:54 +01:00
if (!pScreenPriv)
return FALSE;
2003-11-14 16:54:54 +01:00
pScreenPriv->spriteFuncs = spriteFuncs;
pScreenPriv->screenFuncs = screenFuncs;
pScreenPriv->waitForUpdate = waitForUpdate;
2003-11-14 17:49:22 +01:00
pScreenPriv->showTransparent = FALSE;
2003-11-14 16:54:54 +01:00
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miPointerCloseScreen;
dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, pScreenPriv);
2003-11-14 16:54:54 +01:00
/*
* set up screen cursor method table
*/
pScreen->ConstrainCursor = miPointerConstrainCursor;
pScreen->CursorLimits = miPointerCursorLimits;
pScreen->DisplayCursor = miPointerDisplayCursor;
pScreen->RealizeCursor = miPointerRealizeCursor;
pScreen->UnrealizeCursor = miPointerUnrealizeCursor;
pScreen->SetCursorPosition = miPointerSetCursorPosition;
pScreen->RecolorCursor = miRecolorCursor;
pScreen->DeviceCursorInitialize = miPointerDeviceInitialize;
pScreen->DeviceCursorCleanup = miPointerDeviceCleanup;
mipointermove_events = NULL;
2003-11-14 16:54:54 +01:00
return TRUE;
}
/**
* Destroy screen-specific information.
*
* @param index Screen index of the screen in screenInfo.screens[]
* @param pScreen The actual screen pointer
*/
2003-11-14 16:54:54 +01:00
static Bool
api: rework the X server driver API to avoid global arrays. This is a squash merge containing all the API changes, as well as the video ABI bump. Its been squashed to make bisection easier. Full patch log below: commit b202738bbf0c5a1c1172767119c2c71f1e7f8070 Author: Aaron Plattner <aplattner@nvidia.com> Date: Mon May 14 15:16:11 2012 -0700 xfree86: Bump video ABI to 13.0 The ABI was broken by changes to convert from screen index numbers to ScreenPtr / ScrnInfoPtr in various structures and function signatures. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 3d5f7d9f8d408bcad3f83277d255f25d3b0edbf3 Author: Dave Airlie <airlied@redhat.com> Date: Thu May 24 10:56:57 2012 +0100 xf86: xf86ClearEntityListForScreen should take a pScrn When adding GPU screens this make life easier. (also fix comment, as pointed out by Alan) Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dave Airlie <airlied@redhat.com> commit afee8b5ab4501597ecc1ade34124d7ca227ab055 Author: Dave Airlie <airlied@redhat.com> Date: Thu May 24 07:07:32 2012 +0100 xf86i2c: add pscrn for drivers to use This just adds a pScrn pointer into the struct for the drivers to use instead of scrnIndex. Mostly scrnIndex is used for logging, but some drivers use it to lookup xf86Screens, so let them stash a pScrn instead. Removing the scrnIndex is a bit more involved and I'm not sure its worth the effort. Doing i2c in the X server is legacy code as far as I'm concerned. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit ea5092f1f679691d187f1eee9427e6057beec56e Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 19:25:20 2012 +0100 dix/gc: consolidate GC object creation in one place The standard GC create and scratch GC create were 90% the same really, and I have a need in the future for creating GC objects without the other bits, so wanted to avoid a third copy. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 3d91482ea9b4883e64e496f2768168e0ffa21ba1 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 10:24:06 2012 +0100 xf86: add a define to denote the new non-index interfaces are being used This can be used by drivers to provide compatible APIs. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 37c3ae3e6cd4f3dedc72f371096d6743f8f99df3 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 15:09:12 2012 +0100 dix: make Create/Free scratch pixmaps take a ScreenPtr While technically an API/ABI change I doubt anyone uses it, but it helps in splitting screens up. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 75f2062a3fe94f04764ecc7d2ff2fbbeccb9da60 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 14:57:55 2012 +0100 xf86/xv: remove scrnIndexfrom xf86FindXvOptions. Move this interface to taking an ScrnInfoPtr. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit f80c2374f40ea7b2ee0556e2e76cc07406f3d843 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 14:53:59 2012 +0100 xf86: make xf86DeleteScreen take a ScrnInfoPtr (v2) stop passing indices into this function. v2: drop flags argument. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 58824e414f35682435f15bfe6c4b656bd90b9235 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 14:48:09 2012 +0100 xf86: fix xf86IsScreenPrimary interface to take a pScrn (API/ABI) Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 6b4fc1f9d391bcdf7ca288766e49bce60f4635cd Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:18:59 2012 +0100 xserver: convert block/wakeup handlers to passing ScreenPtr (ABI/API) (v2) Instead of passing an index, pass the actual ScreenPtr. This allows more moving towards not abusing xf86Screens + screenInfo. v2: drop the blockData/wakeupData args as per ajax's suggestion., fix docs. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 790d003de20fb47674420a24dadd92412d78620d Author: Dave Airlie <airlied@gmail.com> Date: Wed Apr 11 09:53:14 2012 +0100 xf86/common: remove some more pScrn->pScreen uses remove some more conversions that appeared after api cleanups. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit aac85e18d1dd093f2cad6bd29375e40bd7af0b8f Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 16:34:53 2012 +0100 ddc: change API to take ScrnInfoPtr (v2) This removes all xf86Screens usage from ddc code, it modifies the API for some functions to avoid taking indices. v2: address Alan's comments about dropping DDC2Init parameter. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit fe3f57b6eaf6860a33876a54f9439f69578f03a5 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 16:31:26 2012 +0100 vbe: don't use index for VBEInterpretPanelID (API) Remove use of xf86screens from vbe module. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit abf1965f4ed91529036d3fdb470d6a3ce6f29675 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 16:25:11 2012 +0100 int10/vbe: don't use xf86Screens. (ABI) (v3) Pass the ScrnInfoPtr instead of the index in the int10 struct. This saves us using it to dereference xf86Screens. v2: address Alan's comment to fix struct alignment. v3: squash in all the int10 fixes, test the vm86 code builds, after comments by Keith. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 23cca612b4fb5efc33683c7624b803b457387e3d Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:30:18 2012 +0100 xserver: drop index argument to ScreenInit (ABI/API) (v2) This drops the index argument, its the same as pScreen->myNum, and its the last major index abuse I can find. v2: address Alan's review - update docs, fix xwin/xnest/darwin Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 40d360e2d7e832407f3ed64e3a02c27ecc89a960 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:23:01 2012 +0100 xf86: migrate PointerMoved from index to ScrnInfoPtr (ABI/API) This migrates PointerMoved from an index to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit aa60a2f38679d0eeb979a9c2648c9bc771409bf9 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:20:46 2012 +0100 xf86: migrate PMEvent to a ScrnInfoPtr (ABI/API) This migrates the PMEvent from index to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit d3f28ef44371ed4a039ffc5dd7eb6408d1269ba2 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:18:30 2012 +0100 xf86: migrate SetDGAMode from index to ScrnInfoPtr (ABI/API) This migrates the SetDGAMode callback from an index to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit baf5e4818a74f2b68c3dfdcc56f54322351039a0 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:14:11 2012 +0100 xf86: migrate ChangeGamma from index to ScrnInfoPtr (ABI/API) (v2) This migrates the ChangeGamma interface to avoid passing a index. v2: fix xf86RandR12.c + xf86cmap.c call Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 51e5f90ada929d6b23176090badbb42fdb3fa550 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:11:09 2012 +0100 xf86/exa: migrate index to screen types for EnableDisableFBAccess (ABI/API) The EXA interface migrates to ScreenPtr, and the xf86 interface migrated to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 94f1f21d17e86f96d4a54292a399160950087675 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:02:11 2012 +0100 xf86: migrate ValidMode callback to ScrnInfoPtr (ABI/API) This migrates the ValidMode to passing a ScrnInfoPtr instead of an index. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 3f8f18198fed4f39ec805b508a3482e91eea26b2 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:59:46 2012 +0100 xf86: migrate SwitchMode to taking ScrnInfoPtr (ABI/API) (v2) This migrate the SwitchMode interface to take a ScrnInfoPtr instead of an index. v2: drop flags. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit d06a038a5c49328ab3a8d969d24f9fcd22c63202 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:50:37 2012 +0100 xf86: move AdjustFrame to passing ScrnInfoPtr (ABI/API) (v2) This converts AdjustFrame code paths to passing a ScrnInfoPtr instead of an integer index. v2: drop flags args. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 53d2f8608ffd4090d08e7d5cf2e92fb954959b90 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:41:27 2012 +0100 xf86: modify FreeScreen callback to take pScrn instead of index. (ABI/API) (v2) Another index->pScrn conversion. v2: drop flags arg. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 60db37c0b247052e0f5c54b1921fe58a3609c2e3 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:35:41 2012 +0100 xf86: change EnterVT/LeaveVT to take a ScrnInfoPtr (ABI/API break) (v2) This modifies the EnterVT/LeaveVT interfaces to take a ScrnInfoPtr instead of an index into xf86Screens. This allows dropping more public dereferences of the xf86Screens and screenInfo. v2: drop flags args as suggested by Keith, fix docs. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 06729dbbc804a20242e6499f446acb5d94023c3c Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:04:59 2012 +0100 xserver: remove index from CloseScreen (API/ABI breakage) This drops the index from the CloseScreen callback, its always been useless really, since the pScreen contains it. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 14:22:18 +02:00
miPointerCloseScreen(ScreenPtr pScreen)
2003-11-14 16:54:54 +01:00
{
SetupScreen(pScreen);
2003-11-14 16:54:54 +01:00
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free((void *) pScreenPriv);
FreeEventList(mipointermove_events, GetMaximumEventsNum());
mipointermove_events = NULL;
api: rework the X server driver API to avoid global arrays. This is a squash merge containing all the API changes, as well as the video ABI bump. Its been squashed to make bisection easier. Full patch log below: commit b202738bbf0c5a1c1172767119c2c71f1e7f8070 Author: Aaron Plattner <aplattner@nvidia.com> Date: Mon May 14 15:16:11 2012 -0700 xfree86: Bump video ABI to 13.0 The ABI was broken by changes to convert from screen index numbers to ScreenPtr / ScrnInfoPtr in various structures and function signatures. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 3d5f7d9f8d408bcad3f83277d255f25d3b0edbf3 Author: Dave Airlie <airlied@redhat.com> Date: Thu May 24 10:56:57 2012 +0100 xf86: xf86ClearEntityListForScreen should take a pScrn When adding GPU screens this make life easier. (also fix comment, as pointed out by Alan) Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dave Airlie <airlied@redhat.com> commit afee8b5ab4501597ecc1ade34124d7ca227ab055 Author: Dave Airlie <airlied@redhat.com> Date: Thu May 24 07:07:32 2012 +0100 xf86i2c: add pscrn for drivers to use This just adds a pScrn pointer into the struct for the drivers to use instead of scrnIndex. Mostly scrnIndex is used for logging, but some drivers use it to lookup xf86Screens, so let them stash a pScrn instead. Removing the scrnIndex is a bit more involved and I'm not sure its worth the effort. Doing i2c in the X server is legacy code as far as I'm concerned. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit ea5092f1f679691d187f1eee9427e6057beec56e Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 19:25:20 2012 +0100 dix/gc: consolidate GC object creation in one place The standard GC create and scratch GC create were 90% the same really, and I have a need in the future for creating GC objects without the other bits, so wanted to avoid a third copy. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 3d91482ea9b4883e64e496f2768168e0ffa21ba1 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 10:24:06 2012 +0100 xf86: add a define to denote the new non-index interfaces are being used This can be used by drivers to provide compatible APIs. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 37c3ae3e6cd4f3dedc72f371096d6743f8f99df3 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 15:09:12 2012 +0100 dix: make Create/Free scratch pixmaps take a ScreenPtr While technically an API/ABI change I doubt anyone uses it, but it helps in splitting screens up. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 75f2062a3fe94f04764ecc7d2ff2fbbeccb9da60 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 14:57:55 2012 +0100 xf86/xv: remove scrnIndexfrom xf86FindXvOptions. Move this interface to taking an ScrnInfoPtr. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit f80c2374f40ea7b2ee0556e2e76cc07406f3d843 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 14:53:59 2012 +0100 xf86: make xf86DeleteScreen take a ScrnInfoPtr (v2) stop passing indices into this function. v2: drop flags argument. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 58824e414f35682435f15bfe6c4b656bd90b9235 Author: Dave Airlie <airlied@redhat.com> Date: Wed May 23 14:48:09 2012 +0100 xf86: fix xf86IsScreenPrimary interface to take a pScrn (API/ABI) Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 6b4fc1f9d391bcdf7ca288766e49bce60f4635cd Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:18:59 2012 +0100 xserver: convert block/wakeup handlers to passing ScreenPtr (ABI/API) (v2) Instead of passing an index, pass the actual ScreenPtr. This allows more moving towards not abusing xf86Screens + screenInfo. v2: drop the blockData/wakeupData args as per ajax's suggestion., fix docs. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 790d003de20fb47674420a24dadd92412d78620d Author: Dave Airlie <airlied@gmail.com> Date: Wed Apr 11 09:53:14 2012 +0100 xf86/common: remove some more pScrn->pScreen uses remove some more conversions that appeared after api cleanups. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit aac85e18d1dd093f2cad6bd29375e40bd7af0b8f Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 16:34:53 2012 +0100 ddc: change API to take ScrnInfoPtr (v2) This removes all xf86Screens usage from ddc code, it modifies the API for some functions to avoid taking indices. v2: address Alan's comments about dropping DDC2Init parameter. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit fe3f57b6eaf6860a33876a54f9439f69578f03a5 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 16:31:26 2012 +0100 vbe: don't use index for VBEInterpretPanelID (API) Remove use of xf86screens from vbe module. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit abf1965f4ed91529036d3fdb470d6a3ce6f29675 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 16:25:11 2012 +0100 int10/vbe: don't use xf86Screens. (ABI) (v3) Pass the ScrnInfoPtr instead of the index in the int10 struct. This saves us using it to dereference xf86Screens. v2: address Alan's comment to fix struct alignment. v3: squash in all the int10 fixes, test the vm86 code builds, after comments by Keith. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 23cca612b4fb5efc33683c7624b803b457387e3d Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:30:18 2012 +0100 xserver: drop index argument to ScreenInit (ABI/API) (v2) This drops the index argument, its the same as pScreen->myNum, and its the last major index abuse I can find. v2: address Alan's review - update docs, fix xwin/xnest/darwin Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 40d360e2d7e832407f3ed64e3a02c27ecc89a960 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:23:01 2012 +0100 xf86: migrate PointerMoved from index to ScrnInfoPtr (ABI/API) This migrates PointerMoved from an index to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit aa60a2f38679d0eeb979a9c2648c9bc771409bf9 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:20:46 2012 +0100 xf86: migrate PMEvent to a ScrnInfoPtr (ABI/API) This migrates the PMEvent from index to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit d3f28ef44371ed4a039ffc5dd7eb6408d1269ba2 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:18:30 2012 +0100 xf86: migrate SetDGAMode from index to ScrnInfoPtr (ABI/API) This migrates the SetDGAMode callback from an index to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit baf5e4818a74f2b68c3dfdcc56f54322351039a0 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:14:11 2012 +0100 xf86: migrate ChangeGamma from index to ScrnInfoPtr (ABI/API) (v2) This migrates the ChangeGamma interface to avoid passing a index. v2: fix xf86RandR12.c + xf86cmap.c call Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 51e5f90ada929d6b23176090badbb42fdb3fa550 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:11:09 2012 +0100 xf86/exa: migrate index to screen types for EnableDisableFBAccess (ABI/API) The EXA interface migrates to ScreenPtr, and the xf86 interface migrated to ScrnInfoPtr. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 94f1f21d17e86f96d4a54292a399160950087675 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 15:02:11 2012 +0100 xf86: migrate ValidMode callback to ScrnInfoPtr (ABI/API) This migrates the ValidMode to passing a ScrnInfoPtr instead of an index. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 3f8f18198fed4f39ec805b508a3482e91eea26b2 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:59:46 2012 +0100 xf86: migrate SwitchMode to taking ScrnInfoPtr (ABI/API) (v2) This migrate the SwitchMode interface to take a ScrnInfoPtr instead of an index. v2: drop flags. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit d06a038a5c49328ab3a8d969d24f9fcd22c63202 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:50:37 2012 +0100 xf86: move AdjustFrame to passing ScrnInfoPtr (ABI/API) (v2) This converts AdjustFrame code paths to passing a ScrnInfoPtr instead of an integer index. v2: drop flags args. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 53d2f8608ffd4090d08e7d5cf2e92fb954959b90 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:41:27 2012 +0100 xf86: modify FreeScreen callback to take pScrn instead of index. (ABI/API) (v2) Another index->pScrn conversion. v2: drop flags arg. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 60db37c0b247052e0f5c54b1921fe58a3609c2e3 Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:35:41 2012 +0100 xf86: change EnterVT/LeaveVT to take a ScrnInfoPtr (ABI/API break) (v2) This modifies the EnterVT/LeaveVT interfaces to take a ScrnInfoPtr instead of an index into xf86Screens. This allows dropping more public dereferences of the xf86Screens and screenInfo. v2: drop flags args as suggested by Keith, fix docs. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com> commit 06729dbbc804a20242e6499f446acb5d94023c3c Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:04:59 2012 +0100 xserver: remove index from CloseScreen (API/ABI breakage) This drops the index from the CloseScreen callback, its always been useless really, since the pScreen contains it. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 14:22:18 +02:00
return (*pScreen->CloseScreen) (pScreen);
2003-11-14 16:54:54 +01:00
}
/*
* DIX/DDX interface routines
*/
static Bool
miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
2003-11-14 16:54:54 +01:00
{
SetupScreen(pScreen);
return (*pScreenPriv->spriteFuncs->RealizeCursor) (pDev, pScreen, pCursor);
2003-11-14 16:54:54 +01:00
}
static Bool
miPointerUnrealizeCursor(DeviceIntPtr pDev,
ScreenPtr pScreen, CursorPtr pCursor)
2003-11-14 16:54:54 +01:00
{
SetupScreen(pScreen);
return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen,
pCursor);
2003-11-14 16:54:54 +01:00
}
static Bool
miPointerDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
2003-11-14 16:54:54 +01:00
{
miPointerPtr pPointer;
2008-05-28 04:57:07 +02:00
/* return for keyboards */
if (!IsPointerDevice(pDev))
return FALSE;
pPointer = MIPOINTER(pDev);
pPointer->pCursor = pCursor;
pPointer->pScreen = pScreen;
miPointerUpdateSprite(pDev);
2003-11-14 16:54:54 +01:00
return TRUE;
}
/**
* Set up the constraints for the given device. This function does not
* actually constrain the cursor but merely copies the given box to the
* internal constraint storage.
*
* @param pDev The device to constrain to the box
* @param pBox The rectangle to constrain the cursor to
* @param pScreen Used for copying screen confinement
*/
2003-11-14 16:54:54 +01:00
static void
miPointerConstrainCursor(DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
2003-11-14 16:54:54 +01:00
{
miPointerPtr pPointer;
pPointer = MIPOINTER(pDev);
pPointer->limits = *pBox;
pPointer->confined = PointerConfinedToScreen(pDev);
2003-11-14 16:54:54 +01:00
}
/**
* Should calculate the box for the given cursor, based on screen and the
* confinement given. But we assume that whatever box is passed in is valid
* anyway.
*
* @param pDev The device to calculate the cursor limits for
* @param pScreen The screen the confinement happens on
* @param pCursor The screen the confinement happens on
* @param pHotBox The confinement box for the cursor
* @param[out] pTopLeftBox The new confinement box, always *pHotBox.
*/
2003-11-14 16:54:54 +01:00
static void
2008-05-28 04:57:07 +02:00
miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
BoxPtr pHotBox, BoxPtr pTopLeftBox)
2003-11-14 16:54:54 +01:00
{
*pTopLeftBox = *pHotBox;
}
/**
* Set the device's cursor position to the x/y position on the given screen.
* Generates and event if required.
*
* This function is called from:
* - sprite init code to place onto initial position
* - the various WarpPointer implementations (core, XI, Xinerama, dmx,…)
* - during the cursor update path in CheckMotion
* - in the Xinerama part of NewCurrentScreen
* - when a RandR/RandR1.2 mode was applied (it may have moved the pointer, so
* it's set back to the original pos)
*
* @param pDev The device to move
* @param pScreen The screen the device is on
* @param x The x coordinate in per-screen coordinates
* @param y The y coordinate in per-screen coordinates
* @param generateEvent True if the pointer movement should generate an
* event.
*
* @return TRUE in all cases
*/
2003-11-14 16:54:54 +01:00
static Bool
2008-05-28 04:57:07 +02:00
miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y, Bool generateEvent)
2003-11-14 16:54:54 +01:00
{
SetupScreen(pScreen);
miPointerPtr pPointer = MIPOINTER(pDev);
pPointer->generateEvent = generateEvent;
2003-11-14 16:54:54 +01:00
if (pScreen->ConstrainCursorHarder)
pScreen->ConstrainCursorHarder(pDev, pScreen, Absolute, &x, &y);
2003-11-14 16:54:54 +01:00
/* device dependent - must pend signal and call miPointerWarpCursor */
(*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y);
2003-11-14 16:54:54 +01:00
if (!generateEvent)
miPointerUpdateSprite(pDev);
2003-11-14 16:54:54 +01:00
return TRUE;
}
void
miRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScr,
CursorPtr pCurs, Bool displayed)
{
/*
* This is guaranteed to correct any color-dependent state which may have
* been bound up in private state created by RealizeCursor
*/
pScr->UnrealizeCursor(pDev, pScr, pCurs);
pScr->RealizeCursor(pDev, pScr, pCurs);
if (displayed)
pScr->DisplayCursor(pDev, pScr, pCurs);
}
/**
* Set up sprite information for the device.
* This function will be called once for each device after it is initialized
* in the DIX.
*
* @param pDev The newly created device
* @param pScreen The initial sprite scree.
2008-05-28 04:57:07 +02:00
*/
static Bool
2008-05-28 04:57:07 +02:00
miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
miPointerPtr pPointer;
SetupScreen(pScreen);
pPointer = malloc(sizeof(miPointerRec));
if (!pPointer)
return FALSE;
pPointer->pScreen = NULL;
pPointer->pSpriteScreen = NULL;
pPointer->pCursor = NULL;
pPointer->pSpriteCursor = NULL;
pPointer->limits.x1 = 0;
pPointer->limits.x2 = 32767;
pPointer->limits.y1 = 0;
pPointer->limits.y2 = 32767;
pPointer->confined = FALSE;
pPointer->x = 0;
pPointer->y = 0;
pPointer->generateEvent = FALSE;
if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize) (pDev, pScreen))) {
free(pPointer);
return FALSE;
}
dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, pPointer);
return TRUE;
}
/**
* Clean up after device.
* This function will be called once before the device is freed in the DIX
*
* @param pDev The device to be removed from the server
* @param pScreen Current screen of the device
*/
static void
2008-05-28 04:57:07 +02:00
miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
2009-01-11 08:42:57 +01:00
SetupScreen(pScreen);
if (!IsMaster(pDev) && !IsFloating(pDev))
return;
(*pScreenPriv->spriteFuncs->DeviceCursorCleanup) (pDev, pScreen);
free(dixLookupPrivate(&pDev->devPrivates, miPointerPrivKey));
dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, NULL);
}
/**
* Warp the pointer to the given position on the given screen. May generate
* an event, depending on whether we're coming from miPointerSetPosition.
*
* Once signals are ignored, the WarpCursor function can call this
*
* @param pDev The device to warp
* @param pScreen Screen to warp on
* @param x The x coordinate in per-screen coordinates
* @param y The y coordinate in per-screen coordinates
*/
2003-11-14 16:54:54 +01:00
void
miPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
2003-11-14 16:54:54 +01:00
{
miPointerPtr pPointer;
BOOL changedScreen = FALSE;
2009-01-11 08:42:57 +01:00
pPointer = MIPOINTER(pDev);
2003-11-14 16:54:54 +01:00
if (pPointer->pScreen != pScreen) {
mieqSwitchScreen(pDev, pScreen, TRUE);
changedScreen = TRUE;
}
2003-11-14 16:54:54 +01:00
if (pPointer->generateEvent)
miPointerMove(pDev, pScreen, x, y);
2003-11-14 16:54:54 +01:00
else
miPointerMoveNoEvent(pDev, pScreen, x, y);
/* Don't call USFS if we use Xinerama, otherwise the root window is
* updated to the second screen, and we never receive any events.
* (FDO bug #18668) */
if (changedScreen
#ifdef PANORAMIX
&& noPanoramiXExtension
#endif
)
UpdateSpriteForScreen(pDev, pScreen);
2003-11-14 16:54:54 +01:00
}
/**
* Synchronize the sprite with the cursor.
2003-11-14 16:54:54 +01:00
*
* @param pDev The device to sync
2003-11-14 16:54:54 +01:00
*/
void
miPointerUpdateSprite(DeviceIntPtr pDev)
2003-11-14 16:54:54 +01:00
{
ScreenPtr pScreen;
miPointerScreenPtr pScreenPriv;
CursorPtr pCursor;
int x, y, devx, devy;
miPointerPtr pPointer;
2003-11-14 16:54:54 +01:00
if (!pDev || !pDev->coreEvents)
return;
pPointer = MIPOINTER(pDev);
if (!pPointer)
return;
pScreen = pPointer->pScreen;
if (!pScreen)
return;
x = pPointer->x;
y = pPointer->y;
devx = pPointer->devx;
devy = pPointer->devy;
pScreenPriv = GetScreenPrivate(pScreen);
2003-11-14 16:54:54 +01:00
/*
* if the cursor has switched screens, disable the sprite
* on the old screen
*/
if (pScreen != pPointer->pSpriteScreen) {
if (pPointer->pSpriteScreen) {
miPointerScreenPtr pOldPriv;
pOldPriv = GetScreenPrivate(pPointer->pSpriteScreen);
if (pPointer->pCursor) {
(*pOldPriv->spriteFuncs->SetCursor)
(pDev, pPointer->pSpriteScreen, NullCursor, 0, 0);
}
(*pOldPriv->screenFuncs->CrossScreen) (pPointer->pSpriteScreen,
FALSE);
}
(*pScreenPriv->screenFuncs->CrossScreen) (pScreen, TRUE);
(*pScreenPriv->spriteFuncs->SetCursor)
(pDev, pScreen, pPointer->pCursor, x, y);
pPointer->devx = x;
pPointer->devy = y;
pPointer->pSpriteCursor = pPointer->pCursor;
pPointer->pSpriteScreen = pScreen;
2003-11-14 16:54:54 +01:00
}
/*
* if the cursor has changed, display the new one
*/
else if (pPointer->pCursor != pPointer->pSpriteCursor) {
pCursor = pPointer->pCursor;
if (!pCursor ||
(pCursor->bits->emptyMask && !pScreenPriv->showTransparent))
pCursor = NullCursor;
(*pScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, pCursor, x, y);
pPointer->devx = x;
pPointer->devy = y;
pPointer->pSpriteCursor = pPointer->pCursor;
2003-11-14 16:54:54 +01:00
}
else if (x != devx || y != devy) {
pPointer->devx = x;
pPointer->devy = y;
if (pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
(*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
2003-11-14 16:54:54 +01:00
}
}
/**
* Invalidate the current sprite and force it to be reloaded on next cursor setting
* operation
*
* @param pDev The device to invalidate the sprite fore
*/
void
miPointerInvalidateSprite(DeviceIntPtr pDev)
{
miPointerPtr pPointer;
pPointer = MIPOINTER(pDev);
pPointer->pSpriteCursor = (CursorPtr) 1;
}
/**
* Set the device to the coordinates on the given screen.
*
* @param pDev The device to move
* @param screen_no Index of the screen to move to
* @param x The x coordinate in per-screen coordinates
* @param y The y coordinate in per-screen coordinates
*/
void
miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
2003-11-14 17:49:22 +01:00
{
ScreenPtr pScreen;
miPointerPtr pPointer;
pPointer = MIPOINTER(pDev);
2003-11-14 17:49:22 +01:00
pScreen = screenInfo.screens[screen_no];
mieqSwitchScreen(pDev, pScreen, FALSE);
NewCurrentScreen(pDev, pScreen, x, y);
pPointer->limits.x2 = pScreen->width;
pPointer->limits.y2 = pScreen->height;
2003-11-14 17:49:22 +01:00
}
/**
* @return The current screen of the given device or NULL.
*/
ScreenPtr
miPointerGetScreen(DeviceIntPtr pDev)
{
miPointerPtr pPointer = MIPOINTER(pDev);
return (pPointer) ? pPointer->pScreen : NULL;
}
2003-11-14 16:54:54 +01:00
/* Controls whether the cursor image should be updated immediately when
moved (FALSE) or if something else will be responsible for updating
it later (TRUE). Returns current setting.
Caller is responsible for calling OsBlockSignal first.
*/
Bool
miPointerSetWaitForUpdate(ScreenPtr pScreen, Bool wait)
{
SetupScreen(pScreen);
Bool prevWait = pScreenPriv->waitForUpdate;
pScreenPriv->waitForUpdate = wait;
return prevWait;
}
2007-03-25 23:56:32 +02:00
/* Move the pointer on the current screen, and update the sprite. */
static void
miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
2007-03-25 23:56:32 +02:00
{
miPointerPtr pPointer;
2007-03-25 23:56:32 +02:00
SetupScreen(pScreen);
pPointer = MIPOINTER(pDev);
/* Hack: We mustn't call into ->MoveCursor for anything but the
* VCP, as this may cause a non-HW rendered cursor to be rendered while
* not holding the input lock. This would race with building the command
* buffer for other rendering.
*/
if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer
&&!pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen) {
pPointer->devx = x;
pPointer->devy = y;
if (pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
(*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
2007-03-25 23:56:32 +02:00
}
pPointer->x = x;
pPointer->y = y;
pPointer->pScreen = pScreen;
2007-03-25 23:56:32 +02:00
}
/**
* Set the devices' cursor position to the given x/y position.
*
* This function is called during the pointer update path in
* GetPointerEvents and friends (and the same in the xwin DDX).
*
* The coordinates provided are always absolute. The parameter mode whether
* it was relative or absolute movement that landed us at those coordinates.
*
* If the cursor was constrained by a barrier, ET_Barrier* events may be
* generated and appended to the InternalEvent list provided.
*
* @param pDev The device to move
* @param mode Movement mode (Absolute or Relative)
* @param[in,out] screenx The x coordinate in desktop coordinates
* @param[in,out] screeny The y coordinate in desktop coordinates
* @param[in,out] nevents The number of events in events (before/after)
* @param[in,out] events The list of events before/after being constrained
*/
ScreenPtr
miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx,
double *screeny,
int *nevents, InternalEvent* events)
2003-11-14 16:54:54 +01:00
{
miPointerScreenPtr pScreenPriv;
ScreenPtr pScreen;
ScreenPtr newScreen;
int x, y;
Bool switch_screen = FALSE;
Bool should_constrain_barriers = FALSE;
int i;
2003-11-14 16:54:54 +01:00
miPointerPtr pPointer;
pPointer = MIPOINTER(pDev);
pScreen = pPointer->pScreen;
x = trunc(*screenx);
y = trunc(*screeny);
switch_screen = !point_on_screen(pScreen, x, y);
/* Switch to per-screen coordinates for CursorOffScreen and
* Pointer->limits */
x -= pScreen->x;
y -= pScreen->y;
should_constrain_barriers = (mode == Relative);
if (should_constrain_barriers) {
/* coordinates after clamped to a barrier */
int constrained_x, constrained_y;
int current_x, current_y; /* current position in per-screen coord */
current_x = MIPOINTER(pDev)->x - pScreen->x;
current_y = MIPOINTER(pDev)->y - pScreen->y;
input_constrain_cursor(pDev, pScreen,
current_x, current_y, x, y,
&constrained_x, &constrained_y,
nevents, events);
x = constrained_x;
y = constrained_y;
}
if (switch_screen) {
pScreenPriv = GetScreenPrivate(pScreen);
if (!pPointer->confined) {
newScreen = pScreen;
(*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y);
if (newScreen != pScreen) {
pScreen = newScreen;
mieqSwitchScreen(pDev, pScreen, FALSE);
/* Smash the confine to the new screen */
pPointer->limits.x2 = pScreen->width;
pPointer->limits.y2 = pScreen->height;
}
}
2003-11-14 16:54:54 +01:00
}
/* Constrain the sprite to the current limits. */
if (x < pPointer->limits.x1)
x = pPointer->limits.x1;
if (x >= pPointer->limits.x2)
x = pPointer->limits.x2 - 1;
if (y < pPointer->limits.y1)
y = pPointer->limits.y1;
if (y >= pPointer->limits.y2)
y = pPointer->limits.y2 - 1;
if (pScreen->ConstrainCursorHarder)
pScreen->ConstrainCursorHarder(pDev, pScreen, mode, &x, &y);
if (pPointer->x != x || pPointer->y != y || pPointer->pScreen != pScreen)
miPointerMoveNoEvent(pDev, pScreen, x, y);
/* check if we generated any barrier events and if so, update root x/y
* to the fully constrained coords */
if (should_constrain_barriers) {
for (i = 0; i < *nevents; i++) {
if (events[i].any.type == ET_BarrierHit ||
events[i].any.type == ET_BarrierLeave) {
events[i].barrier_event.root_x = x;
events[i].barrier_event.root_y = y;
}
}
}
/* Convert to desktop coordinates again */
x += pScreen->x;
y += pScreen->y;
/* In the event we actually change screen or we get confined, we just
* drop the float component on the floor
* FIXME: only drop remainder for ConstrainCursorHarder, not for screen
* crossings */
if (x != trunc(*screenx))
*screenx = x;
if (y != trunc(*screeny))
*screeny = y;
return pScreen;
2003-11-14 16:54:54 +01:00
}
/**
* Get the current position of the device in desktop coordinates.
*
* @param x Return value for the current x coordinate in desktop coordinates.
* @param y Return value for the current y coordinate in desktop coordinates.
*/
void
miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
2003-11-14 16:54:54 +01:00
{
*x = MIPOINTER(pDev)->x;
*y = MIPOINTER(pDev)->y;
2003-11-14 16:54:54 +01:00
}
/**
* Move the device's pointer to the x/y coordinates on the given screen.
* This function generates and enqueues pointer events.
*
* @param pDev The device to move
* @param pScreen The screen the device is on
* @param x The x coordinate in per-screen coordinates
* @param y The y coordinate in per-screen coordinates
*/
void
miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
int i, nevents;
int valuators[2];
ValuatorMask mask;
miPointerMoveNoEvent(pDev, pScreen, x, y);
/* generate motion notify */
valuators[0] = x;
valuators[1] = y;
if (!mipointermove_events) {
mipointermove_events = InitEventList(GetMaximumEventsNum());
if (!mipointermove_events) {
FatalError("Could not allocate event store.\n");
return;
}
}
valuator_mask_set_range(&mask, 0, 2, valuators);
nevents = GetPointerEvents(mipointermove_events, pDev, MotionNotify, 0,
POINTER_SCREEN | POINTER_ABSOLUTE |
POINTER_NORAW, &mask);
input_lock();
for (i = 0; i < nevents; i++)
mieqEnqueue(pDev, &mipointermove_events[i]);
input_unlock();
}