diff options
author | Keith Packard <keithp@keithp.com> | 2010-06-06 20:45:53 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-06-06 21:24:04 -0700 |
commit | bc26665661565918af484ccd17caad951010df60 (patch) | |
tree | 1f922d9d23c3b43974714c0df0715a467a231a5d | |
parent | f03be727d647183a2176355ad0ac9a6735067be9 (diff) |
Initialize private keys in test suite
Make sure all of the private keys used by the test code are
initialized before being used.
Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Robert Hooker <sarvatt@ubuntu.com>
-rw-r--r-- | Xext/xtest.c | 8 | ||||
-rw-r--r-- | include/input.h | 1 | ||||
-rw-r--r-- | include/xkbsrv.h | 2 | ||||
-rw-r--r-- | test/xi2/protocol-common.c | 13 | ||||
-rw-r--r-- | test/xtest.c | 4 | ||||
-rw-r--r-- | xkb/xkb.c | 2 | ||||
-rw-r--r-- | xkb/xkbActions.c | 5 |
7 files changed, 31 insertions, 4 deletions
diff --git a/Xext/xtest.c b/Xext/xtest.c index 0a6b1c531..6ee8430e8 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -99,10 +99,16 @@ static DISPATCH_PROC(SProcXTestFakeInput); static DISPATCH_PROC(SProcXTestGetVersion); static DISPATCH_PROC(SProcXTestGrabControl); +Bool +XTestInitPrivates(void) +{ + return dixRegisterPrivateKey(&XTestDevicePrivateKeyRec, PRIVATE_DEVICE, 0); +} + void XTestExtensionInit(INITARGS) { - if (!dixRegisterPrivateKey(&XTestDevicePrivateKeyRec, PRIVATE_DEVICE, 0)) + if (!XTestInitPrivates()) return; AddExtension(XTestExtensionName, 0, 0, diff --git a/include/input.h b/include/input.h index c68a28441..3b29855f1 100644 --- a/include/input.h +++ b/include/input.h @@ -237,6 +237,7 @@ extern int key_is_down(DeviceIntPtr pDev, int key_code, int type); extern void InitCoreDevices(void); extern void InitXTestDevices(void); +extern Bool XTestInitPrivates(void); extern _X_EXPORT DeviceIntPtr AddInputDevice( ClientPtr /*client*/, diff --git a/include/xkbsrv.h b/include/xkbsrv.h index 7c92f6491..5847e6395 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -321,6 +321,8 @@ extern _X_EXPORT int XkbProcessArguments( int /* i */ ); +extern _X_EXPORT Bool XkbInitPrivates(void); + extern _X_EXPORT void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); extern _X_EXPORT void XkbFreeCompatMap( diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c index fd93e15da..ad18042f9 100644 --- a/test/xi2/protocol-common.c +++ b/test/xi2/protocol-common.c @@ -27,6 +27,7 @@ #include <stdint.h> #include "extinit.h" /* for XInputExtensionInit */ +#include "exglobals.h" #include <glib.h> #include "protocol-common.h" @@ -107,7 +108,6 @@ ClientRec init_client(int len, void *data) /* we store the privates now and reassign it after the memset. this way * we can share them across multiple test runs and don't have to worry * about freeing them after each test run. */ - PrivateRec *privates = client.devPrivates; client.index = CLIENT_INDEX; client.clientAsMask = CLIENT_MASK; @@ -115,7 +115,7 @@ ClientRec init_client(int len, void *data) client.req_len = len; client.requestBuffer = data; - client.devPrivates = privates; + dixAllocatePrivates(&client.devPrivates, PRIVATE_CLIENT); return client; } @@ -136,6 +136,9 @@ void init_window(WindowPtr window, WindowPtr parent, int id) g_assert(window->optional); } +extern DevPrivateKeyRec miPointerScreenKeyRec; +extern DevPrivateKeyRec miPointerPrivKeyRec; + /* 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; } @@ -153,7 +156,13 @@ void init_simple(void) dixResetPrivates(); InitAtoms(); + XkbInitPrivates(); + XTestInitPrivates(); + dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)); + dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0); + dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0); XInputExtensionInit(); + init_window(&root, NULL, ROOT_WINDOW_ID); init_window(&window, &root, CLIENT_WINDOW_ID); diff --git a/test/xtest.c b/test/xtest.c index cc1188d7d..af75f0c90 100644 --- a/test/xtest.c +++ b/test/xtest.c @@ -30,6 +30,7 @@ #include "inputstr.h" #include "scrnintstr.h" #include "exevents.h" +#include "xkbsrv.h" #include "xserver-properties.h" #include <glib.h> @@ -59,6 +60,9 @@ static void xtest_init_devices(void) dixResetPrivates(); InitAtoms(); + XkbInitPrivates(); + XTestInitPrivates(); + /* this also inits the xtest devices */ InitCoreDevices(); @@ -6707,7 +6707,7 @@ XkbExtensionInit(void) if (!RT_XKBCLIENT) return; - if (!dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, 0)) + if (!XkbInitPrivates()) return; if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors, diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index afc44ac44..c5030d04d 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -63,6 +63,11 @@ xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, backupproc,xkbUnwrapProc); } +Bool +XkbInitPrivates(void) +{ + return dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, 0); +} void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc) |