summaryrefslogtreecommitdiff
path: root/test/xi2
diff options
context:
space:
mode:
Diffstat (limited to 'test/xi2')
-rw-r--r--test/xi2/protocol-common.c18
-rw-r--r--test/xi2/protocol-common.h10
-rw-r--r--test/xi2/protocol-xigetclientpointer.c6
-rw-r--r--test/xi2/protocol-xisetclientpointer.c4
4 files changed, 26 insertions, 12 deletions
diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index 330749970..2d0bc3699 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -32,6 +32,7 @@
#include "protocol-common.h"
struct devices devices;
+ScreenRec screen;
WindowRec root;
WindowRec window;
@@ -49,11 +50,16 @@ static void fake_init_sprite(DeviceIntPtr dev)
sprite->spriteTrace = xcalloc(sprite->spriteTraceSize, sizeof(WindowPtr));
sprite->spriteTraceGood = 1;
sprite->spriteTrace[0] = &root;
- sprite->hot.x = 100;
- sprite->hot.y = 200;
- sprite->hotPhys.x = 100;
- sprite->hotPhys.y = 200;
+ sprite->hot.x = SPRITE_X;
+ sprite->hot.y = SPRITE_Y;
+ sprite->hotPhys.x = sprite->hot.x;
+ sprite->hotPhys.y = sprite->hot.y;
sprite->win = &window;
+ sprite->hotPhys.pScreen = &screen;
+ sprite->physLimits.x1 = 0;
+ sprite->physLimits.y1 = 0;
+ sprite->physLimits.x2 = screen.width;
+ sprite->physLimits.y2 = screen.height;
}
/**
@@ -132,10 +138,9 @@ void init_window(WindowPtr window, WindowPtr parent, int id)
/* Needed for the screen setup, otherwise we crash during sprite initialization */
static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
+static Bool set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event) { return TRUE; };
void init_simple(void)
{
- static ScreenRec screen;
-
screenInfo.arraySize = MAXSCREENS;
screenInfo.numScreens = 1;
screenInfo.screens[0] = &screen;
@@ -145,6 +150,7 @@ void init_simple(void)
screen.width = 640;
screen.height = 480;
screen.DeviceCursorInitialize = device_cursor_init;
+ screen.SetCursorPosition = set_cursor_pos;
dixResetPrivates();
XInputExtensionInit();
diff --git a/test/xi2/protocol-common.h b/test/xi2/protocol-common.h
index 1ab35c92e..afa08780c 100644
--- a/test/xi2/protocol-common.h
+++ b/test/xi2/protocol-common.h
@@ -66,6 +66,12 @@ extern int BadDevice;
#define ROOT_WINDOW_ID 0x10
/* default client window id */
#define CLIENT_WINDOW_ID 0x100001
+/* invalid window ID. use for BadWindow checks. */
+#define INVALID_WINDOW_ID 0x111111
+/* initial fake sprite position */
+#define SPRITE_X 100
+#define SPRITE_Y 200
+
/* Various structs used throughout the tests */
@@ -98,6 +104,10 @@ extern void *userdata;
void (*reply_handler)(ClientPtr client, int len, char *data, void *userdata);
/**
+ * The default screen used for the windows. Initialized by init_simple().
+ */
+extern ScreenRec screen;
+/**
* Semi-initialized root window. initialized by init().
*/
extern WindowRec root;
diff --git a/test/xi2/protocol-xigetclientpointer.c b/test/xi2/protocol-xigetclientpointer.c
index d4923f304..6b4d04957 100644
--- a/test/xi2/protocol-xigetclientpointer.c
+++ b/test/xi2/protocol-xigetclientpointer.c
@@ -41,8 +41,6 @@
#include "protocol-common.h"
#include <glib.h>
-#define FAKE_WINDOW_ID 12345
-
struct {
int cp_is_set;
DeviceIntPtr dev;
@@ -123,8 +121,8 @@ static void test_XIGetClientPointer(void)
client_request = init_client(request.length, &request);
- g_test_message("Testing invalid window 12345");
- request.win = FAKE_WINDOW_ID;
+ g_test_message("Testing invalid window");
+ request.win = INVALID_WINDOW_ID;
request_XIGetClientPointer(&client_request, &request, BadWindow);
test_data.cp_is_set = FALSE;
diff --git a/test/xi2/protocol-xisetclientpointer.c b/test/xi2/protocol-xisetclientpointer.c
index e72d0160d..2e638eea7 100644
--- a/test/xi2/protocol-xisetclientpointer.c
+++ b/test/xi2/protocol-xisetclientpointer.c
@@ -127,8 +127,8 @@ static void test_XISetClientPointer(void)
request_XISetClientPointer(&request, Success);
g_assert(client_request.clientPtr->id == 2);
- g_test_message("Testing invalid window 12345");
- request.win = 12345;
+ g_test_message("Testing invalid window");
+ request.win = INVALID_WINDOW_ID;
request.deviceid = devices.vcp->id;
request_XISetClientPointer(&request, BadWindow);