compat-api.h revision b27e1915
1b27e1915Smrg/*
2b27e1915Smrg * Copyright 2012 Red Hat, Inc.
3b27e1915Smrg *
4b27e1915Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5b27e1915Smrg * copy of this software and associated documentation files (the "Software"),
6b27e1915Smrg * to deal in the Software without restriction, including without limitation
7b27e1915Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b27e1915Smrg * and/or sell copies of the Software, and to permit persons to whom the
9b27e1915Smrg * Software is furnished to do so, subject to the following conditions:
10b27e1915Smrg *
11b27e1915Smrg * The above copyright notice and this permission notice (including the next
12b27e1915Smrg * paragraph) shall be included in all copies or substantial portions of the
13b27e1915Smrg * Software.
14b27e1915Smrg *
15b27e1915Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16b27e1915Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17b27e1915Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18b27e1915Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19b27e1915Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20b27e1915Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21b27e1915Smrg * DEALINGS IN THE SOFTWARE.
22b27e1915Smrg *
23b27e1915Smrg * Author: Dave Airlie <airlied@redhat.com>
24b27e1915Smrg */
25b27e1915Smrg
26b27e1915Smrg/* this file provides API compat between server post 1.13 and pre it,
27b27e1915Smrg   it should be reused inside as many drivers as possible */
28b27e1915Smrg#ifndef COMPAT_API_H
29b27e1915Smrg#define COMPAT_API_H
30b27e1915Smrg
31b27e1915Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
32b27e1915Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
33b27e1915Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
34b27e1915Smrg#endif
35b27e1915Smrg
36b27e1915Smrg#ifndef XF86_HAS_SCRN_CONV
37b27e1915Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
38b27e1915Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
39b27e1915Smrg#endif
40b27e1915Smrg
41b27e1915Smrg#ifndef XF86_SCRN_INTERFACE
42b27e1915Smrg
43b27e1915Smrg#define SCRN_ARG_TYPE int
44b27e1915Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
45b27e1915Smrg
46b27e1915Smrg#define SCREEN_ARG_TYPE int
47b27e1915Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
48b27e1915Smrg
49b27e1915Smrg#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
50b27e1915Smrg
51b27e1915Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
52b27e1915Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
53b27e1915Smrg
54b27e1915Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
55b27e1915Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
56b27e1915Smrg
57b27e1915Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
58b27e1915Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
59b27e1915Smrg
60b27e1915Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
61b27e1915Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
62b27e1915Smrg
63b27e1915Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
64b27e1915Smrg
65b27e1915Smrg#define VT_FUNC_ARGS_DECL int arg, int flags
66b27e1915Smrg#define VT_FUNC_ARGS pScrn->scrnIndex, 0
67b27e1915Smrg
68b27e1915Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
69b27e1915Smrg#else
70b27e1915Smrg#define SCRN_ARG_TYPE ScrnInfoPtr
71b27e1915Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
72b27e1915Smrg
73b27e1915Smrg#define SCREEN_ARG_TYPE ScreenPtr
74b27e1915Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
75b27e1915Smrg
76b27e1915Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
77b27e1915Smrg
78b27e1915Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
79b27e1915Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
80b27e1915Smrg
81b27e1915Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
82b27e1915Smrg#define CLOSE_SCREEN_ARGS pScreen
83b27e1915Smrg
84b27e1915Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
85b27e1915Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
86b27e1915Smrg
87b27e1915Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
88b27e1915Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m
89b27e1915Smrg
90b27e1915Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
91b27e1915Smrg
92b27e1915Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
93b27e1915Smrg#define VT_FUNC_ARGS pScrn
94b27e1915Smrg
95b27e1915Smrg#define XF86_SCRN_ARG(x) (x)
96b27e1915Smrg
97b27e1915Smrg#endif
98b27e1915Smrg
99b27e1915Smrg#endif
100