kdrive: Remove KdOsFuncs

Only the Init slot was used, and Xephyr can just as easily do that
initialization directly.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2017-03-24 15:58:54 -04:00
parent c0375dced3
commit c42311a9d7
7 changed files with 10 additions and 126 deletions

View File

@ -54,7 +54,6 @@ Xephyr_SOURCES = \
ephyr.h \ ephyr.h \
ephyrlog.h \ ephyrlog.h \
ephyr_draw.c \ ephyr_draw.c \
os.c \
ephyrinit.c \ ephyrinit.c \
ephyrcursor.c \ ephyrcursor.c \
hostx.c \ hostx.c \

View File

@ -192,8 +192,6 @@ extern KdPointerDriver EphyrMouseDriver;
extern KdKeyboardDriver EphyrKeyboardDriver; extern KdKeyboardDriver EphyrKeyboardDriver;
extern KdOsFuncs EphyrOsFuncs;
extern Bool ephyrCursorInit(ScreenPtr pScreen); extern Bool ephyrCursorInit(ScreenPtr pScreen);
extern int ephyrBufferHeight(KdScreenInfo * screen); extern int ephyrBufferHeight(KdScreenInfo * screen);

View File

@ -374,7 +374,10 @@ OsVendorInit(void)
if (hostx_want_host_cursor()) if (hostx_want_host_cursor())
ephyrFuncs.initCursor = &ephyrCursorInit; ephyrFuncs.initCursor = &ephyrCursorInit;
KdOsInit(&EphyrOsFuncs); if (!KdCardInfoLast()) {
processScreenArg("640x480", NULL);
}
hostx_init();
} }
KdCardFuncs ephyrFuncs = { KdCardFuncs ephyrFuncs = {

View File

@ -1,48 +0,0 @@
/*
* Xephyr - A kdrive X server thats runs in a host X window.
* Authored by Matthew Allum <mallum@o-hand.com>
*
* Copyright © 2004 Nokia
*
* 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, and that the name of Nokia not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Nokia makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "ephyr.h"
extern void processScreenArg(const char *screen_size, char *parent_id);
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,
};

View File

@ -90,13 +90,6 @@ const char *kdGlobalXkbOptions = NULL;
static Bool kdCaughtSignal = FALSE; static Bool kdCaughtSignal = FALSE;
/*
* Carry arguments from InitOutput through driver initialization
* to KdScreenInit
*/
KdOsFuncs *kdOsFuncs;
void void
KdDisableScreen(ScreenPtr pScreen) KdDisableScreen(ScreenPtr pScreen)
{ {
@ -162,12 +155,8 @@ static void
KdDisableScreens(void) KdDisableScreens(void)
{ {
KdSuspend(); KdSuspend();
if (kdEnabled) {
if (kdOsFuncs->Disable)
(*kdOsFuncs->Disable) ();
kdEnabled = FALSE; kdEnabled = FALSE;
} }
}
Bool Bool
KdEnableScreen(ScreenPtr pScreen) KdEnableScreen(ScreenPtr pScreen)
@ -198,13 +187,6 @@ void
AbortDDX(enum ExitCode error) AbortDDX(enum ExitCode error)
{ {
KdDisableScreens(); KdDisableScreens();
if (kdOsFuncs) {
if (kdEnabled && kdOsFuncs->Disable)
(*kdOsFuncs->Disable) ();
if (kdOsFuncs->Fini)
(*kdOsFuncs->Fini) ();
KdDoSwitchCmd("stop");
}
if (kdCaughtSignal) if (kdCaughtSignal)
OsAbort(); OsAbort();
@ -560,24 +542,6 @@ KdProcessArgument(int argc, char **argv, int i)
return 0; return 0;
} }
/*
* These are getting tossed in here until I can think of where
* they really belong
*/
void
KdOsInit(KdOsFuncs * pOsFuncs)
{
kdOsFuncs = pOsFuncs;
if (pOsFuncs) {
if (serverGeneration == 1) {
KdDoSwitchCmd("start");
if (pOsFuncs->Init)
(*pOsFuncs->Init) ();
}
}
}
static Bool static Bool
KdAllocatePrivates(ScreenPtr pScreen) KdAllocatePrivates(ScreenPtr pScreen)
{ {
@ -668,11 +632,7 @@ KdCloseScreen(ScreenPtr pScreen)
* Clean up OS when last card is closed * Clean up OS when last card is closed
*/ */
if (card == kdCardInfo) { if (card == kdCardInfo) {
if (kdEnabled) {
kdEnabled = FALSE; kdEnabled = FALSE;
if (kdOsFuncs->Disable)
(*kdOsFuncs->Disable) ();
}
} }
} }
@ -923,11 +883,7 @@ KdScreenInit(ScreenPtr pScreen, int argc, char **argv)
/* /*
* Enable the hardware * Enable the hardware
*/ */
if (!kdEnabled) {
kdEnabled = TRUE; kdEnabled = TRUE;
if (kdOsFuncs->Enable)
(*kdOsFuncs->Enable) ();
}
if (screen->mynum == card->selected) { if (screen->mynum == card->selected) {
if (card->cfuncs->preserve) if (card->cfuncs->preserve)

View File

@ -288,16 +288,6 @@ int KdAddConfigKeyboard(char *pointer);
int KdAddKeyboard(KdKeyboardInfo * ki); int KdAddKeyboard(KdKeyboardInfo * ki);
void KdRemoveKeyboard(KdKeyboardInfo * ki); void KdRemoveKeyboard(KdKeyboardInfo * ki);
typedef struct _KdOsFuncs {
int (*Init) (void);
void (*Enable) (void);
Bool (*SpecialKey) (KeySym);
void (*Disable) (void);
void (*Fini) (void);
void (*pollEvents) (void);
void (*Bell) (int, int, int);
} KdOsFuncs;
typedef struct _KdPointerMatrix { typedef struct _KdPointerMatrix {
int matrix[2][3]; int matrix[2][3];
} KdPointerMatrix; } KdPointerMatrix;
@ -308,7 +298,6 @@ extern DevPrivateKeyRec kdScreenPrivateKeyRec;
extern Bool kdEmulateMiddleButton; extern Bool kdEmulateMiddleButton;
extern Bool kdDisableZaphod; extern Bool kdDisableZaphod;
extern KdOsFuncs *kdOsFuncs;
#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \ #define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey)) dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
@ -366,9 +355,6 @@ void
int int
KdProcessArgument(int argc, char **argv, int i); KdProcessArgument(int argc, char **argv, int i);
void
KdOsInit(KdOsFuncs * pOsFuncs);
void void
KdOsAddInputDrivers(void); KdOsAddInputDrivers(void);

View File

@ -392,16 +392,11 @@ DDXRingBell(int volume, int pitch, int duration)
{ {
KdKeyboardInfo *ki = NULL; KdKeyboardInfo *ki = NULL;
if (kdOsFuncs->Bell) {
(*kdOsFuncs->Bell) (volume, pitch, duration);
}
else {
for (ki = kdKeyboards; ki; ki = ki->next) { for (ki = kdKeyboards; ki; ki = ki->next) {
if (ki->dixdev->coreEvents) if (ki->dixdev->coreEvents)
KdRingBell(ki, volume, pitch, duration); KdRingBell(ki, volume, pitch, duration);
} }
} }
}
static void static void
KdSetLeds(KdKeyboardInfo * ki, int leds) KdSetLeds(KdKeyboardInfo * ki, int leds)
@ -1773,11 +1768,6 @@ KdBlockHandler(ScreenPtr pScreen, void *timeo)
myTimeout = ms; myTimeout = ms;
} }
} }
/* if we need to poll for events, do that */
if (kdOsFuncs->pollEvents) {
(*kdOsFuncs->pollEvents) ();
myTimeout = 20;
}
if (myTimeout > 0) if (myTimeout > 0)
AdjustWaitForDelay(timeo, myTimeout); AdjustWaitForDelay(timeo, myTimeout);
} }