VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.9.0/protocol-common.h@ 62425

最後變更 在這個檔案從62425是 32163,由 vboxsync 提交於 14 年 前

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

  • 屬性 svn:eol-style 設為 native
檔案大小: 5.0 KB
 
1/**
2 * Copyright © 2009 Red Hat, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#ifdef HAVE_DIX_CONFIG_H
25#include <dix-config.h>
26#endif
27
28#include "scrnintstr.h"
29#include "windowstr.h"
30#include "scrnintstr.h"
31#include "exevents.h"
32
33#ifndef PROTOCOL_COMMON_H
34#define PROTOCOL_COMMON_H
35
36extern int BadDevice;
37
38/* Check default values in a reply */
39#define reply_check_defaults(rep, len, type) \
40 { \
41 g_assert((len) >= sz_x##type##Reply); \
42 g_assert((rep)->repType == X_Reply); \
43 g_assert((rep)->RepType == X_##type); \
44 g_assert((rep)->sequenceNumber == CLIENT_SEQUENCE); \
45 g_assert((rep)->length >= (sz_x##type##Reply - 32)/4); \
46 }
47
48/* initialise default values for request */
49#define request_init(req, type) \
50 { \
51 (req)->reqType = 128; /* doesn't matter */ \
52 (req)->ReqType = X_##type; \
53 (req)->length = (sz_x##type##Req >> 2); \
54 }
55
56
57/* Various defines used in the tests. Some tests may use different values
58 * than these defaults */
59/* default client index */
60#define CLIENT_INDEX 1
61/* default client mask for resources and windows */
62#define CLIENT_MASK ((CLIENT_INDEX) << CLIENTOFFSET)
63/* default client sequence number for replies */
64#define CLIENT_SEQUENCE 0x100
65/* default root window id */
66#define ROOT_WINDOW_ID 0x10
67/* default client window id */
68#define CLIENT_WINDOW_ID 0x100001
69/* invalid window ID. use for BadWindow checks. */
70#define INVALID_WINDOW_ID 0x111111
71/* initial fake sprite position */
72#define SPRITE_X 100
73#define SPRITE_Y 200
74
75
76/* Various structs used throughout the tests */
77
78
79/* The default devices struct, contains one pointer + keyboard and the
80 * matching master devices. Initialize with init_devices() if needed. */
81struct devices {
82 DeviceIntPtr vcp;
83 DeviceIntPtr vck;
84 DeviceIntPtr mouse;
85 DeviceIntPtr kbd;
86
87 int num_devices;
88 int num_master_devices;
89} devices;
90
91/**
92 * The set of default devices available in all tests if necessary.
93 */
94extern struct devices devices;
95
96/**
97 * test-specific userdata, passed into the reply handler.
98 */
99extern void *userdata;
100/**
101 * The reply handler called from WriteToClient. Set this handler if you need
102 * to check the reply values.
103 */
104void (*reply_handler)(ClientPtr client, int len, char *data, void *userdata);
105
106/**
107 * The default screen used for the windows. Initialized by init_simple().
108 */
109extern ScreenRec screen;
110/**
111 * Semi-initialized root window. initialized by init().
112 */
113extern WindowRec root;
114/**
115 * Semi-initialized top-level window. initialized by init().
116 */
117extern WindowRec window;
118
119/* various simple functions for quick setup */
120/**
121 * Initialize the above struct with default devices and return the struct.
122 * Usually not needed if you call ::init_simple.
123 */
124struct devices init_devices(void);
125/**
126 * Init a mostly zeroed out client with default values for index and mask.
127 */
128ClientRec init_client(int request_len, void *request_data);
129/**
130 * Init a mostly zeroed out window with the given window ID.
131 * Usually not needed if you call ::init_simple which sets up root and
132 * window.
133 */
134void init_window(WindowPtr window, WindowPtr parent, int id);
135/**
136 * Create a very simple setup that provides the minimum values for most
137 * tests, including a screen, the root and client window and the default
138 * device setup.
139 */
140void init_simple(void);
141
142/* Declarations for various overrides in the test files. */
143void __wrap_WriteToClient(ClientPtr client, int len, void *data);
144int __wrap_XISetEventMask(DeviceIntPtr dev, WindowPtr win, int len, unsigned char* mask);
145int __wrap_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access);
146int __real_dixLookupWindow(WindowPtr *win, XID id, ClientPtr client, Mask access);
147Bool __wrap_AddResource(XID id, RESTYPE type, pointer value);
148int __wrap_dixLookupClient(ClientPtr *c, XID id, ClientPtr client, Mask access);
149int __real_dixLookupClient(ClientPtr *c, XID id, ClientPtr client, Mask access);
150
151
152#endif /* PROTOCOL_COMMON_H */
153
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette