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>
This commit is contained in:
stefan11111 2025-06-30 13:50:11 +03:00 committed by Enrico Weigelt, metux IT consult
parent fc9bd6b175
commit a46fd9f16e
2 changed files with 36 additions and 0 deletions

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);