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>
This commit is contained in:
parent
f03be727d6
commit
bc26665661
|
@ -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,
|
||||
|
|
|
@ -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*/,
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user