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(SProcXTestGetVersion);
|
||||||
static DISPATCH_PROC(SProcXTestGrabControl);
|
static DISPATCH_PROC(SProcXTestGrabControl);
|
||||||
|
|
||||||
|
Bool
|
||||||
|
XTestInitPrivates(void)
|
||||||
|
{
|
||||||
|
return dixRegisterPrivateKey(&XTestDevicePrivateKeyRec, PRIVATE_DEVICE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XTestExtensionInit(INITARGS)
|
XTestExtensionInit(INITARGS)
|
||||||
{
|
{
|
||||||
if (!dixRegisterPrivateKey(&XTestDevicePrivateKeyRec, PRIVATE_DEVICE, 0))
|
if (!XTestInitPrivates())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AddExtension(XTestExtensionName, 0, 0,
|
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 InitCoreDevices(void);
|
||||||
extern void InitXTestDevices(void);
|
extern void InitXTestDevices(void);
|
||||||
|
extern Bool XTestInitPrivates(void);
|
||||||
|
|
||||||
extern _X_EXPORT DeviceIntPtr AddInputDevice(
|
extern _X_EXPORT DeviceIntPtr AddInputDevice(
|
||||||
ClientPtr /*client*/,
|
ClientPtr /*client*/,
|
||||||
|
|
|
@ -321,6 +321,8 @@ extern _X_EXPORT int XkbProcessArguments(
|
||||||
int /* i */
|
int /* i */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
extern _X_EXPORT Bool XkbInitPrivates(void);
|
||||||
|
|
||||||
extern _X_EXPORT void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc);
|
extern _X_EXPORT void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc);
|
||||||
|
|
||||||
extern _X_EXPORT void XkbFreeCompatMap(
|
extern _X_EXPORT void XkbFreeCompatMap(
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "extinit.h" /* for XInputExtensionInit */
|
#include "extinit.h" /* for XInputExtensionInit */
|
||||||
|
#include "exglobals.h"
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include "protocol-common.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 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
|
* we can share them across multiple test runs and don't have to worry
|
||||||
* about freeing them after each test run. */
|
* about freeing them after each test run. */
|
||||||
PrivateRec *privates = client.devPrivates;
|
|
||||||
|
|
||||||
client.index = CLIENT_INDEX;
|
client.index = CLIENT_INDEX;
|
||||||
client.clientAsMask = CLIENT_MASK;
|
client.clientAsMask = CLIENT_MASK;
|
||||||
|
@ -115,7 +115,7 @@ ClientRec init_client(int len, void *data)
|
||||||
client.req_len = len;
|
client.req_len = len;
|
||||||
|
|
||||||
client.requestBuffer = data;
|
client.requestBuffer = data;
|
||||||
client.devPrivates = privates;
|
dixAllocatePrivates(&client.devPrivates, PRIVATE_CLIENT);
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +136,9 @@ void init_window(WindowPtr window, WindowPtr parent, int id)
|
||||||
g_assert(window->optional);
|
g_assert(window->optional);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern DevPrivateKeyRec miPointerScreenKeyRec;
|
||||||
|
extern DevPrivateKeyRec miPointerPrivKeyRec;
|
||||||
|
|
||||||
/* Needed for the screen setup, otherwise we crash during sprite initialization */
|
/* Needed for the screen setup, otherwise we crash during sprite initialization */
|
||||||
static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
|
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; }
|
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();
|
dixResetPrivates();
|
||||||
InitAtoms();
|
InitAtoms();
|
||||||
|
XkbInitPrivates();
|
||||||
|
XTestInitPrivates();
|
||||||
|
dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec));
|
||||||
|
dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0);
|
||||||
|
dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0);
|
||||||
XInputExtensionInit();
|
XInputExtensionInit();
|
||||||
|
|
||||||
init_window(&root, NULL, ROOT_WINDOW_ID);
|
init_window(&root, NULL, ROOT_WINDOW_ID);
|
||||||
init_window(&window, &root, CLIENT_WINDOW_ID);
|
init_window(&window, &root, CLIENT_WINDOW_ID);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "exevents.h"
|
#include "exevents.h"
|
||||||
|
#include "xkbsrv.h"
|
||||||
#include "xserver-properties.h"
|
#include "xserver-properties.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
@ -59,6 +60,9 @@ static void xtest_init_devices(void)
|
||||||
dixResetPrivates();
|
dixResetPrivates();
|
||||||
InitAtoms();
|
InitAtoms();
|
||||||
|
|
||||||
|
XkbInitPrivates();
|
||||||
|
XTestInitPrivates();
|
||||||
|
|
||||||
/* this also inits the xtest devices */
|
/* this also inits the xtest devices */
|
||||||
InitCoreDevices();
|
InitCoreDevices();
|
||||||
|
|
||||||
|
|
|
@ -6707,7 +6707,7 @@ XkbExtensionInit(void)
|
||||||
if (!RT_XKBCLIENT)
|
if (!RT_XKBCLIENT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, 0))
|
if (!XkbInitPrivates())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors,
|
if ((extEntry = AddExtension(XkbName, XkbNumberEvents, XkbNumberErrors,
|
||||||
|
|
|
@ -63,6 +63,11 @@ xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
|
||||||
backupproc,xkbUnwrapProc);
|
backupproc,xkbUnwrapProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
XkbInitPrivates(void)
|
||||||
|
{
|
||||||
|
return dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
|
XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user