Compare commits

...

6 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 65ca0f6a4f HACK 2025-07-02 16:56:57 +02:00
Enrico Weigelt, metux IT consult 26b3537499 Revert "dix: AllocColor() dont fire Xace hook when looking up color at root window"
This reverts commit 912c0c1f76d6cf54864bdd9eda872a19281f65d6.
2025-07-02 16:52:39 +02:00
Enrico Weigelt, metux IT consult 27364a0cc5 dix: AllocColor() dont fire Xace hook when looking up color at root window
This is creating false alarms that are complicated to catch, thus passing
NULL client so the Xace hook in dixLookupResourceByType() doesn't fire here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-02 16:52:39 +02:00
Enrico Weigelt, metux IT consult 658d811257 dix: move screen destruction loop into dixFreeAllScreens()
Consolidate the screen destruction code in its own function and
so move it out of the big main loop.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-02 16:52:38 +02:00
stefan11111 922a22b6ef kdrive: ephyr: initialize OS specific callback vectors
These will be used by subsequent commits for generic Kdrive
functions calling back into the OS specific parts

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-07-02 15:45:07 +02:00
stefan11111 a750176ce7 kdrive: add KdOsInit
Kdrive X servers used to do the OS-speciffic init part using KdOsInit.
This was changed in modern Xorg because Xephyr is the only kdrive
X server there, so there was no need to keep this generic.
Since we want to eventually add Xfbdev, we need to add this back.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-07-02 15:45:07 +02:00
9 changed files with 105 additions and 43 deletions

View File

@ -261,10 +261,9 @@ ProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
if (rc != Success)
return rc;
rc = dixLookupProperty(&pProp, pWin, stuff->property, client,
DixGetAttrAccess);
if (rc != Success)
return rc;
pProp = dixLookupProperty(pWin, stuff->property, client, DixGetAttrAccess);
if (!pProp)
return BadMatch;
obj = dixLookupPrivate(&pProp->devPrivates, privKey);
return SELinuxSendContextReply(client, obj->sid);

View File

@ -689,4 +689,6 @@ static inline ClientPtr dixLookupXIDOwner(XID xid)
return NullClient;
}
void dixFreeAllScreens(void);
#endif /* _XSERVER_DIX_PRIV_H */

View File

@ -317,20 +317,8 @@ dix_main(int argc, char *argv[], char *envp[])
screenInfo.screens[i]->root = NullWindow;
CloseDownDevices();
CloseDownEvents();
for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
dixFreeScreen(screenInfo.gpuscreens[i]);
screenInfo.numGPUScreens = i;
}
memset(&screenInfo.numGPUScreens, 0, sizeof(screenInfo.numGPUScreens));
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
dixFreeScreen(screenInfo.screens[i]);
screenInfo.numScreens = i;
}
memset(&screenInfo.screens, 0, sizeof(screenInfo.numGPUScreens));
dixFreeAllScreens();
ReleaseClientIds(serverClient);
dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);

View File

@ -92,23 +92,22 @@ PrintPropertys(WindowPtr pWin)
}
#endif
int
dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName,
ClientPtr client, Mask access_mode)
PropertyPtr dixLookupProperty(WindowPtr pWin, Atom propertyName,
ClientPtr client, Mask access_mode)
{
PropertyPtr pProp;
int rc = BadMatch;
client->errorValue = propertyName;
for (pProp = pWin->properties; pProp; pProp = pProp->next)
if (pProp->propertyName == propertyName)
break;
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
if (pProp->propertyName == propertyName) {
if (XaceHookPropertyAccess(client, pWin, &pProp, access_mode) != Success)
return NULL;
return pProp;
}
if (pProp)
rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode);
*result = pProp;
return rc;
return NULL;
}
static void
@ -223,6 +222,7 @@ ProcRotateProperties(ClientPtr client)
if (rc != Success)
goto out;
}
props[i] = pProp;
saved[i] = *pProp;
@ -333,7 +333,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
access_mode = (mode == PropModeReplace) ? DixWriteAccess : DixBlendAccess;
/* first see if property already exists */
rc = dixLookupProperty(&pProp, pWin, property, pClient, access_mode);
pProp = dixLookupProperty(pWin, property, pClient, access_mode);
if (rc == BadMatch) { /* just add to list */
if (!MakeWindowOptional(pWin))
@ -365,7 +365,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
pProp->next = pWin->properties;
pWin->properties = pProp;
}
else if (rc == Success) {
else {
/* To append or prepend to a property the request format and type
must match those of the already defined property. The
existing format and type are irrelevant when using the mode
@ -427,8 +427,6 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
return rc;
}
}
else
return rc;
if (sendevent) {
deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp);
@ -444,8 +442,8 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
PropertyPtr pProp, prevProp;
int rc;
rc = dixLookupProperty(&pProp, pWin, propName, client, DixDestroyAccess);
if (rc == BadMatch)
pProp = dixLookupProperty(pWin, propName, client, DixDestroyAccess);
if (!pProp)
return Success; /* Succeed if property does not exist */
if (rc == Success) {
@ -467,7 +465,19 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
free(pProp->data);
dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
}
return rc;
else {
/* Need to traverse to find the previous element */
prevProp = pWin->optional->userProps;
while (prevProp->next != pProp)
prevProp = prevProp->next;
prevProp->next = pProp->next;
}
deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp);
free(pProp->data);
dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
return Success;
}
void

View File

@ -94,8 +94,8 @@ typedef struct _PropertyFilterParam {
extern CallbackListPtr PropertyFilterCallback;
int dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom proprty,
ClientPtr pClient, Mask access_mode);
PropertyPtr dixLookupProperty(WindowPtr pWin, Atom proprty,
ClientPtr pClient, Mask access_mode);
void DeleteAllWindowProperties(WindowPtr pWin);

View File

@ -10,7 +10,7 @@
#include "include/screenint.h"
#include "include/scrnintstr.h"
void dixFreeScreen(ScreenPtr pScreen)
static void dixFreeScreen(ScreenPtr pScreen)
{
if (!pScreen)
return;
@ -27,3 +27,18 @@ void dixFreeScreen(ScreenPtr pScreen)
DeleteCallbackList(&pScreen->hookPixmapDestroy);
free(pScreen);
}
void dixFreeAllScreens(void)
{
for (int i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
dixFreeScreen(screenInfo.gpuscreens[i]);
screenInfo.numGPUScreens = i;
}
memset(&screenInfo.numGPUScreens, 0, sizeof(screenInfo.numGPUScreens));
for (int i = screenInfo.numScreens - 1; i >= 0; i--) {
dixFreeScreen(screenInfo.screens[i]);
screenInfo.numScreens = i;
}
memset(&screenInfo.screens, 0, sizeof(screenInfo.numGPUScreens));
}

View File

@ -370,6 +370,23 @@ ddxProcessArgument(int argc, char **argv, int i)
return KdProcessArgument(argc, argv, i);
}
static int
EphyrInit(void)
{
/*
* make sure at least one screen
* has been added to the system.
*/
if (!KdCardInfoLast()) {
processScreenArg("640x480", NULL);
}
return hostx_init();
}
KdOsFuncs EphyrOsFuncs = {
.Init = EphyrInit,
};
void
OsVendorInit(void)
{
@ -381,12 +398,7 @@ OsVendorInit(void)
if (hostx_want_host_cursor())
ephyrFuncs.initCursor = &ephyrCursorInit;
if (serverGeneration == 1) {
if (!KdCardInfoLast()) {
processScreenArg("640x480", NULL);
}
hostx_init();
}
KdOsInit(&EphyrOsFuncs);
}
KdCardFuncs ephyrFuncs = {

View File

@ -91,6 +91,14 @@ const char *kdGlobalXkbLayout = NULL;
const char *kdGlobalXkbVariant = NULL;
const char *kdGlobalXkbOptions = NULL;
/*
* Carry arguments from InitOutput through driver initialization
* to KdScreenInit
*/
KdOsFuncs *kdOsFuncs = NULL;
void
KdDisableScreen(ScreenPtr pScreen)
{
@ -517,6 +525,19 @@ KdProcessArgument(int argc, char **argv, int i)
return 0;
}
void
KdOsInit(KdOsFuncs * pOsFuncs)
{
kdOsFuncs = pOsFuncs;
if (pOsFuncs) {
if (serverGeneration == 1) {
KdDoSwitchCmd("start");
if (pOsFuncs->Init)
(*pOsFuncs->Init) ();
}
}
}
static Bool
KdAllocatePrivates(ScreenPtr pScreen)
{

View File

@ -278,6 +278,16 @@ int KdAddConfigKeyboard(char *pointer);
int KdAddKeyboard(KdKeyboardInfo * ki);
void KdRemoveKeyboard(KdKeyboardInfo * ki);
typedef struct _KdOsFuncs {
int (*Init) (void); /* Only called when the X server is started, when serverGeneration == 1 */
void (*Enable) (void);
Bool (*SpecialKey) (KeySym);
void (*Disable) (void);
void (*Fini) (void);
void (*pollEvents) (void);
void (*Bell) (int, int, int);
} KdOsFuncs;
typedef struct _KdPointerMatrix {
int matrix[2][3];
} KdPointerMatrix;
@ -289,6 +299,8 @@ extern DevPrivateKeyRec kdScreenPrivateKeyRec;
extern Bool kdEmulateMiddleButton;
extern Bool kdDisableZaphod;
extern KdOsFuncs *kdOsFuncs;
#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
#define KdSetScreenPriv(pScreen,v) \
@ -345,6 +357,9 @@ void
int
KdProcessArgument(int argc, char **argv, int i);
void
KdOsInit(KdOsFuncs * pOsFuncs);
void
KdOsAddInputDrivers(void);