summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-25 22:12:02 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-25 22:12:02 -0700
commit66792aff9562a3cd69576739e4dae116edb31efd (patch)
tree436a2730158f80e30407ca0abce66911f86482c9
parenta2494e6fe3168b03f2ebc7d584db0256657c891f (diff)
Fix vuidMouseAdjustFrame to build with Xorg 1.13 ABI
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--COPYING1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/compat-api.h98
-rw-r--r--src/sun_mouse.c18
4 files changed, 110 insertions, 8 deletions
diff --git a/COPYING b/COPYING
index 844bdb1..d834c59 100644
--- a/COPYING
+++ b/COPYING
@@ -1,5 +1,6 @@
Copyright (c) 2004-2005, 2008-2010, Oracle and/or its affiliates.
All rights reserved.
+Copyright 2012 Red Hat, Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/src/Makefile.am b/src/Makefile.am
index 910949e..aad8d0e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,6 +39,7 @@ OS_SRCS = bsd_mouse.c hurd_mouse.c lnx_mouse.c sun_mouse.c
mouse.h \
pnp.c \
mousePriv.h \
+ compat-api.h \
@OS_MOUSE_NAME@_mouse.c
EXTRA_DIST = $(OS_SRCS)
diff --git a/src/compat-api.h b/src/compat-api.h
new file mode 100644
index 0000000..d4d3882
--- /dev/null
+++ b/src/compat-api.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ * Author: Dave Airlie <airlied@redhat.com>
+ */
+
+/* this file provides API compat between server post 1.13 and pre it,
+ it should be reused inside as many drivers as possible */
+#ifndef COMPAT_API_H
+#define COMPAT_API_H
+
+#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
+#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
+#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
+#endif
+
+#ifndef XF86_HAS_SCRN_CONV
+#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
+#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
+#endif
+
+#ifndef XF86_SCRN_INTERFACE
+
+#define SCRN_ARG_TYPE int
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
+
+#define SCREEN_ARG_TYPE int
+#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
+
+#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
+
+#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
+
+#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
+#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
+
+#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
+#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
+
+#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
+#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
+
+#define FREE_SCREEN_ARGS_DECL int arg, int flags
+
+#define VT_FUNC_ARGS_DECL int arg, int flags
+#define VT_FUNC_ARGS pScrn->scrnIndex, 0
+
+#define SCRN_OR_INDEX_ARG(x) ((x)->scrnIndex)
+#else
+#define SCRN_ARG_TYPE ScrnInfoPtr
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
+
+#define SCREEN_ARG_TYPE ScreenPtr
+#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
+
+#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
+
+#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
+
+#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
+#define CLOSE_SCREEN_ARGS pScreen
+
+#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
+#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
+
+#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
+#define SWITCH_MODE_ARGS(arg, m) arg, m
+#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
+
+#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
+#define VT_FUNC_ARGS pScrn
+
+#define SCRN_OR_INDEX_ARG(x) (x)
+
+#endif
+
+#endif
diff --git a/src/sun_mouse.c b/src/sun_mouse.c
index fe27400..db1a4ae 100644
--- a/src/sun_mouse.c
+++ b/src/sun_mouse.c
@@ -112,8 +112,10 @@ static int vuidMouseProc(DeviceIntPtr pPointer, int what);
static void vuidReadInput(InputInfoPtr pInfo);
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
+# include "compat-api.h"
+
static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse);
-static void vuidMouseAdjustFrame(int index, int x, int y, int flags);
+static void vuidMouseAdjustFrame(ADJUST_FRAME_ARGS_DECL);
static int vuidMouseGeneration = 0;
@@ -429,19 +431,19 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse)
}
}
-static void vuidMouseAdjustFrame(int index, int x, int y, int flags)
+static void vuidMouseAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[index];
- ScreenPtr pScreen = pScrn->pScreen;
+ SCRN_INFO_PTR(arg);
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
xf86AdjustFrameProc *wrappedAdjustFrame
= (xf86AdjustFrameProc *) vuidMouseGetScreenPrivate(pScreen);
VuidMsePtr m;
ScreenPtr ptrCurScreen;
- if(wrappedAdjustFrame) {
- pScrn->AdjustFrame = wrappedAdjustFrame;
- (*pScrn->AdjustFrame)(index, x, y, flags);
- pScrn->AdjustFrame = vuidMouseAdjustFrame;
+ if (wrappedAdjustFrame) {
+ pScrn->AdjustFrame = wrappedAdjustFrame;
+ (*pScrn->AdjustFrame)(ADJUST_FRAME_ARGS(pScrn, x, y));
+ pScrn->AdjustFrame = vuidMouseAdjustFrame;
}
for (m = vuidMouseList; m != NULL ; m = m->next) {