2003-11-14 16:54:54 +01:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright 1993, 1998 The Open Group
|
|
|
|
|
|
|
|
Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
the above copyright notice appear in all copies and that both that
|
|
|
|
copyright notice and this permission notice appear in supporting
|
|
|
|
documentation.
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included
|
|
|
|
in all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of The Open Group shall
|
|
|
|
not be used in advertising or otherwise to promote the sale, use or
|
|
|
|
other dealings in this Software without prior written authorization
|
|
|
|
from The Open Group.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
#include <stddef.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "windowstr.h"
|
|
|
|
#include "resource.h"
|
2007-02-23 19:20:43 +01:00
|
|
|
#include "privates.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "gcstruct.h"
|
2007-09-06 22:55:51 +02:00
|
|
|
#include "cursorstr.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "colormapst.h"
|
2005-05-22 03:12:49 +02:00
|
|
|
#include "inputstr.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2008-06-13 22:39:40 +02:00
|
|
|
struct _Private {
|
2008-09-13 01:11:53 +02:00
|
|
|
int state;
|
|
|
|
pointer value;
|
2008-06-13 22:39:40 +02:00
|
|
|
};
|
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
typedef struct _PrivateDesc {
|
2007-08-16 22:10:44 +02:00
|
|
|
DevPrivateKey key;
|
2007-02-23 19:20:43 +01:00
|
|
|
unsigned size;
|
|
|
|
CallbackListPtr initfuncs;
|
|
|
|
CallbackListPtr deletefuncs;
|
2007-03-01 21:00:02 +01:00
|
|
|
} PrivateDescRec;
|
2007-02-23 19:20:43 +01:00
|
|
|
|
2008-09-13 01:11:53 +02:00
|
|
|
#define PRIV_MAX 256
|
|
|
|
#define PRIV_STEP 16
|
|
|
|
|
2007-02-23 19:20:43 +01:00
|
|
|
/* list of all allocated privates */
|
2008-09-13 01:11:53 +02:00
|
|
|
static PrivateDescRec items[PRIV_MAX];
|
|
|
|
static int nextPriv;
|
2007-03-01 21:00:02 +01:00
|
|
|
|
2008-09-13 01:11:53 +02:00
|
|
|
static PrivateDescRec *
|
2007-08-16 21:30:25 +02:00
|
|
|
findItem(const DevPrivateKey key)
|
2007-03-01 21:00:02 +01:00
|
|
|
{
|
2008-09-13 01:11:53 +02:00
|
|
|
if (!*key) {
|
|
|
|
if (nextPriv >= PRIV_MAX)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
items[nextPriv].key = key;
|
|
|
|
*key = nextPriv;
|
|
|
|
nextPriv++;
|
2007-03-01 21:00:02 +01:00
|
|
|
}
|
2008-09-13 01:11:53 +02:00
|
|
|
|
|
|
|
return items + *key;
|
|
|
|
}
|
|
|
|
|
|
|
|
static _X_INLINE int
|
|
|
|
privateExists(PrivateRec **privates, const DevPrivateKey key)
|
|
|
|
{
|
|
|
|
return *key && *privates &&
|
|
|
|
(*privates)[0].state > *key &&
|
|
|
|
(*privates)[*key].state;
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2007-03-08 18:13:18 +01:00
|
|
|
* Request pre-allocated space.
|
2007-02-23 19:20:43 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-08-16 21:30:25 +02:00
|
|
|
dixRequestPrivate(const DevPrivateKey key, unsigned size)
|
2007-02-23 19:20:43 +01:00
|
|
|
{
|
2007-03-01 21:00:02 +01:00
|
|
|
PrivateDescRec *item = findItem(key);
|
2008-09-13 01:11:53 +02:00
|
|
|
if (!item)
|
|
|
|
return FALSE;
|
|
|
|
if (size > item->size)
|
2007-03-01 21:00:02 +01:00
|
|
|
item->size = size;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2007-02-23 19:20:43 +01:00
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
/*
|
|
|
|
* Allocate a private and attach it to an existing object.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
pointer *
|
2007-08-16 21:30:25 +02:00
|
|
|
dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
|
2007-03-01 21:00:02 +01:00
|
|
|
{
|
|
|
|
PrivateDescRec *item = findItem(key);
|
2008-09-13 01:11:53 +02:00
|
|
|
PrivateCallbackRec calldata;
|
2007-03-01 21:00:02 +01:00
|
|
|
PrivateRec *ptr;
|
2008-09-13 01:11:53 +02:00
|
|
|
pointer value;
|
|
|
|
int oldsize, newsize;
|
|
|
|
|
|
|
|
newsize = (*key / PRIV_STEP + 1) * PRIV_STEP;
|
2007-02-23 19:20:43 +01:00
|
|
|
|
2008-09-13 01:11:53 +02:00
|
|
|
/* resize or init privates array */
|
|
|
|
if (!item)
|
2007-03-01 21:00:02 +01:00
|
|
|
return NULL;
|
2008-09-13 01:11:53 +02:00
|
|
|
|
|
|
|
/* initialize privates array if necessary */
|
|
|
|
if (!*privates) {
|
|
|
|
ptr = xcalloc(newsize, sizeof(*ptr));
|
|
|
|
if (!ptr)
|
|
|
|
return NULL;
|
|
|
|
*privates = ptr;
|
|
|
|
(*privates)[0].state = newsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
oldsize = (*privates)[0].state;
|
|
|
|
|
|
|
|
/* resize privates array if necessary */
|
|
|
|
if (*key >= oldsize) {
|
|
|
|
ptr = xrealloc(*privates, newsize * sizeof(*ptr));
|
|
|
|
if (!ptr)
|
|
|
|
return NULL;
|
|
|
|
memset(ptr + oldsize, 0, (newsize - oldsize) * sizeof(*ptr));
|
|
|
|
*privates = ptr;
|
|
|
|
(*privates)[0].state = newsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize slot */
|
|
|
|
ptr = *privates + *key;
|
|
|
|
ptr->state = 1;
|
|
|
|
if (item->size) {
|
|
|
|
value = xcalloc(item->size, 1);
|
|
|
|
if (!value)
|
|
|
|
return NULL;
|
|
|
|
ptr->value = value;
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|
2008-09-13 01:11:53 +02:00
|
|
|
|
|
|
|
calldata.key = key;
|
|
|
|
calldata.value = &ptr->value;
|
|
|
|
CallCallbacks(&item->initfuncs, &calldata);
|
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
return &ptr->value;
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|
|
|
|
|
2008-06-13 22:39:40 +02:00
|
|
|
/*
|
|
|
|
* Look up a private pointer.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
pointer
|
2008-06-13 22:39:40 +02:00
|
|
|
dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key)
|
|
|
|
{
|
|
|
|
pointer *ptr;
|
|
|
|
|
2008-09-13 01:11:53 +02:00
|
|
|
if (privateExists(privates, key))
|
|
|
|
return (*privates)[*key].value;
|
2008-06-13 22:39:40 +02:00
|
|
|
|
|
|
|
ptr = dixAllocatePrivate(privates, key);
|
|
|
|
return ptr ? *ptr : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Look up the address of a private pointer.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
pointer *
|
2008-06-13 22:39:40 +02:00
|
|
|
dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key)
|
|
|
|
{
|
2008-09-13 01:11:53 +02:00
|
|
|
if (privateExists(privates, key))
|
|
|
|
return &(*privates)[*key].value;
|
2008-06-13 22:39:40 +02:00
|
|
|
|
|
|
|
return dixAllocatePrivate(privates, key);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set a private pointer.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2008-06-13 22:39:40 +02:00
|
|
|
dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val)
|
|
|
|
{
|
|
|
|
top:
|
2008-09-13 01:11:53 +02:00
|
|
|
if (privateExists(privates, key)) {
|
|
|
|
(*privates)[*key].value = val;
|
|
|
|
return TRUE;
|
2008-06-13 22:39:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!dixAllocatePrivate(privates, key))
|
|
|
|
return FALSE;
|
|
|
|
goto top;
|
|
|
|
}
|
|
|
|
|
2007-02-23 19:20:43 +01:00
|
|
|
/*
|
2007-03-01 21:00:02 +01:00
|
|
|
* Called to free privates at object deletion time.
|
2007-02-23 19:20:43 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-03-01 21:00:02 +01:00
|
|
|
dixFreePrivates(PrivateRec *privates)
|
2007-02-23 19:20:43 +01:00
|
|
|
{
|
2008-09-13 01:11:53 +02:00
|
|
|
int i;
|
2007-02-23 19:20:43 +01:00
|
|
|
PrivateCallbackRec calldata;
|
|
|
|
|
2008-09-13 01:11:53 +02:00
|
|
|
if (privates)
|
|
|
|
for (i = 1; i < privates->state; i++)
|
|
|
|
if (privates[i].state) {
|
|
|
|
/* call the delete callbacks */
|
|
|
|
calldata.key = items[i].key;
|
|
|
|
calldata.value = &privates[i].value;
|
|
|
|
CallCallbacks(&items[i].deletefuncs, &calldata);
|
|
|
|
|
|
|
|
/* free pre-allocated memory */
|
|
|
|
if (items[i].size)
|
|
|
|
xfree(privates[i].value);
|
|
|
|
}
|
|
|
|
|
|
|
|
xfree(privates);
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Callback registration
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-08-16 21:30:25 +02:00
|
|
|
dixRegisterPrivateInitFunc(const DevPrivateKey key,
|
2007-02-23 19:20:43 +01:00
|
|
|
CallbackProcPtr callback, pointer data)
|
|
|
|
{
|
2007-03-01 21:00:02 +01:00
|
|
|
PrivateDescRec *item = findItem(key);
|
2008-09-13 01:11:53 +02:00
|
|
|
if (!item)
|
|
|
|
return FALSE;
|
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
return AddCallback(&item->initfuncs, callback, data);
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-08-16 21:30:25 +02:00
|
|
|
dixRegisterPrivateDeleteFunc(const DevPrivateKey key,
|
2007-02-23 19:20:43 +01:00
|
|
|
CallbackProcPtr callback, pointer data)
|
|
|
|
{
|
2007-03-01 21:00:02 +01:00
|
|
|
PrivateDescRec *item = findItem(key);
|
2008-09-13 01:11:53 +02:00
|
|
|
if (!item)
|
|
|
|
return FALSE;
|
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
return AddCallback(&item->deletefuncs, callback, data);
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|
|
|
|
|
2007-03-01 21:00:02 +01:00
|
|
|
/* Table of devPrivates offsets */
|
2007-09-06 22:55:51 +02:00
|
|
|
static const int offsetDefaults[] = {
|
|
|
|
-1, /* RT_NONE */
|
|
|
|
offsetof(WindowRec, devPrivates), /* RT_WINDOW */
|
|
|
|
offsetof(PixmapRec, devPrivates), /* RT_PIXMAP */
|
|
|
|
offsetof(GC, devPrivates), /* RT_GC */
|
|
|
|
-1, /* RT_FONT */
|
|
|
|
offsetof(CursorRec, devPrivates), /* RT_CURSOR */
|
|
|
|
offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */
|
|
|
|
-1, /* RT_CMAPENTRY */
|
|
|
|
-1, /* RT_OTHERCLIENT */
|
|
|
|
-1 /* RT_PASSIVEGRAB */
|
|
|
|
};
|
|
|
|
|
|
|
|
static int *offsets = NULL;
|
|
|
|
static int offsetsSize = 0;
|
2007-02-23 19:20:43 +01:00
|
|
|
|
|
|
|
/*
|
2007-03-01 21:00:02 +01:00
|
|
|
* Specify where the devPrivates field is located in a structure type
|
2007-02-23 19:20:43 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-09-06 22:55:51 +02:00
|
|
|
dixRegisterPrivateOffset(RESTYPE type, int offset)
|
2007-02-23 19:20:43 +01:00
|
|
|
{
|
2007-03-01 21:00:02 +01:00
|
|
|
type = type & TypeMask;
|
|
|
|
|
|
|
|
/* resize offsets table if necessary */
|
|
|
|
while (type >= offsetsSize) {
|
2007-03-08 18:13:36 +01:00
|
|
|
unsigned i = offsetsSize * 2 * sizeof(int);
|
2007-09-06 22:55:51 +02:00
|
|
|
offsets = (int *)xrealloc(offsets, i);
|
2007-03-01 21:00:02 +01:00
|
|
|
if (!offsets) {
|
|
|
|
offsetsSize = 0;
|
2007-02-23 19:20:43 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
2007-03-08 18:13:36 +01:00
|
|
|
for (i=offsetsSize; i < 2*offsetsSize; i++)
|
|
|
|
offsets[i] = -1;
|
2007-03-01 21:00:02 +01:00
|
|
|
offsetsSize *= 2;
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|
2007-03-01 21:00:02 +01:00
|
|
|
|
|
|
|
offsets[type] = offset;
|
2007-02-23 19:20:43 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-03-01 21:00:02 +01:00
|
|
|
dixLookupPrivateOffset(RESTYPE type)
|
2007-02-23 19:20:43 +01:00
|
|
|
{
|
2007-03-01 21:00:02 +01:00
|
|
|
type = type & TypeMask;
|
|
|
|
assert(type < offsetsSize);
|
|
|
|
return offsets[type];
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|
2007-03-01 21:00:02 +01:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-03-01 21:00:02 +01:00
|
|
|
dixResetPrivates(void)
|
2007-02-23 19:20:43 +01:00
|
|
|
{
|
2008-09-13 01:11:53 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/* reset private descriptors */
|
|
|
|
for (i = 1; i < nextPriv; i++) {
|
|
|
|
*items[i].key = 0;
|
|
|
|
DeleteCallbackList(&items[i].initfuncs);
|
|
|
|
DeleteCallbackList(&items[i].deletefuncs);
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|
2008-09-13 01:11:53 +02:00
|
|
|
nextPriv = 1;
|
|
|
|
|
|
|
|
/* reset offsets */
|
2007-03-01 21:00:02 +01:00
|
|
|
if (offsets)
|
|
|
|
xfree(offsets);
|
2007-09-06 22:55:51 +02:00
|
|
|
offsetsSize = sizeof(offsetDefaults);
|
2009-01-22 08:11:16 +01:00
|
|
|
offsets = xalloc(offsetsSize);
|
2007-09-06 22:55:51 +02:00
|
|
|
offsetsSize /= sizeof(int);
|
2007-03-01 21:00:02 +01:00
|
|
|
if (!offsets)
|
|
|
|
return FALSE;
|
2007-09-06 22:55:51 +02:00
|
|
|
memcpy(offsets, offsetDefaults, sizeof(offsetDefaults));
|
|
|
|
return TRUE;
|
2007-02-23 19:20:43 +01:00
|
|
|
}
|