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:
		
							parent
							
								
									c0375dced3
								
							
						
					
					
						commit
						c42311a9d7
					
				| 
						 | 
				
			
			@ -54,7 +54,6 @@ Xephyr_SOURCES = \
 | 
			
		|||
	ephyr.h \
 | 
			
		||||
	ephyrlog.h \
 | 
			
		||||
	ephyr_draw.c \
 | 
			
		||||
	os.c \
 | 
			
		||||
	ephyrinit.c \
 | 
			
		||||
	ephyrcursor.c \
 | 
			
		||||
	hostx.c \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -192,8 +192,6 @@ extern KdPointerDriver EphyrMouseDriver;
 | 
			
		|||
 | 
			
		||||
extern KdKeyboardDriver EphyrKeyboardDriver;
 | 
			
		||||
 | 
			
		||||
extern KdOsFuncs EphyrOsFuncs;
 | 
			
		||||
 | 
			
		||||
extern Bool ephyrCursorInit(ScreenPtr pScreen);
 | 
			
		||||
 | 
			
		||||
extern int ephyrBufferHeight(KdScreenInfo * screen);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -374,7 +374,10 @@ OsVendorInit(void)
 | 
			
		|||
    if (hostx_want_host_cursor())
 | 
			
		||||
        ephyrFuncs.initCursor = &ephyrCursorInit;
 | 
			
		||||
 | 
			
		||||
    KdOsInit(&EphyrOsFuncs);
 | 
			
		||||
    if (!KdCardInfoLast()) {
 | 
			
		||||
        processScreenArg("640x480", NULL);
 | 
			
		||||
    }
 | 
			
		||||
    hostx_init();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
KdCardFuncs ephyrFuncs = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -90,13 +90,6 @@ const char *kdGlobalXkbOptions = NULL;
 | 
			
		|||
 | 
			
		||||
static Bool kdCaughtSignal = FALSE;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Carry arguments from InitOutput through driver initialization
 | 
			
		||||
 * to KdScreenInit
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
KdOsFuncs *kdOsFuncs;
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
KdDisableScreen(ScreenPtr pScreen)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -162,11 +155,7 @@ static void
 | 
			
		|||
KdDisableScreens(void)
 | 
			
		||||
{
 | 
			
		||||
    KdSuspend();
 | 
			
		||||
    if (kdEnabled) {
 | 
			
		||||
        if (kdOsFuncs->Disable)
 | 
			
		||||
            (*kdOsFuncs->Disable) ();
 | 
			
		||||
    kdEnabled = FALSE;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Bool
 | 
			
		||||
| 
						 | 
				
			
			@ -198,13 +187,6 @@ void
 | 
			
		|||
AbortDDX(enum ExitCode error)
 | 
			
		||||
{
 | 
			
		||||
    KdDisableScreens();
 | 
			
		||||
    if (kdOsFuncs) {
 | 
			
		||||
        if (kdEnabled && kdOsFuncs->Disable)
 | 
			
		||||
            (*kdOsFuncs->Disable) ();
 | 
			
		||||
        if (kdOsFuncs->Fini)
 | 
			
		||||
            (*kdOsFuncs->Fini) ();
 | 
			
		||||
        KdDoSwitchCmd("stop");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (kdCaughtSignal)
 | 
			
		||||
        OsAbort();
 | 
			
		||||
| 
						 | 
				
			
			@ -560,24 +542,6 @@ KdProcessArgument(int argc, char **argv, int i)
 | 
			
		|||
    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
 | 
			
		||||
KdAllocatePrivates(ScreenPtr pScreen)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -668,11 +632,7 @@ KdCloseScreen(ScreenPtr pScreen)
 | 
			
		|||
         * Clean up OS when last card is closed
 | 
			
		||||
         */
 | 
			
		||||
        if (card == kdCardInfo) {
 | 
			
		||||
            if (kdEnabled) {
 | 
			
		||||
            kdEnabled = FALSE;
 | 
			
		||||
                if (kdOsFuncs->Disable)
 | 
			
		||||
                    (*kdOsFuncs->Disable) ();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -923,11 +883,7 @@ KdScreenInit(ScreenPtr pScreen, int argc, char **argv)
 | 
			
		|||
    /*
 | 
			
		||||
     * Enable the hardware
 | 
			
		||||
     */
 | 
			
		||||
    if (!kdEnabled) {
 | 
			
		||||
    kdEnabled = TRUE;
 | 
			
		||||
        if (kdOsFuncs->Enable)
 | 
			
		||||
            (*kdOsFuncs->Enable) ();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (screen->mynum == card->selected) {
 | 
			
		||||
        if (card->cfuncs->preserve)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -288,16 +288,6 @@ int KdAddConfigKeyboard(char *pointer);
 | 
			
		|||
int KdAddKeyboard(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 {
 | 
			
		||||
    int matrix[2][3];
 | 
			
		||||
} KdPointerMatrix;
 | 
			
		||||
| 
						 | 
				
			
			@ -308,7 +298,6 @@ extern DevPrivateKeyRec kdScreenPrivateKeyRec;
 | 
			
		|||
 | 
			
		||||
extern Bool kdEmulateMiddleButton;
 | 
			
		||||
extern Bool kdDisableZaphod;
 | 
			
		||||
extern KdOsFuncs *kdOsFuncs;
 | 
			
		||||
 | 
			
		||||
#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
 | 
			
		||||
    dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
 | 
			
		||||
| 
						 | 
				
			
			@ -366,9 +355,6 @@ void
 | 
			
		|||
int
 | 
			
		||||
 KdProcessArgument(int argc, char **argv, int i);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
 KdOsInit(KdOsFuncs * pOsFuncs);
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
 KdOsAddInputDrivers(void);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -392,15 +392,10 @@ DDXRingBell(int volume, int pitch, int duration)
 | 
			
		|||
{
 | 
			
		||||
    KdKeyboardInfo *ki = NULL;
 | 
			
		||||
 | 
			
		||||
    if (kdOsFuncs->Bell) {
 | 
			
		||||
        (*kdOsFuncs->Bell) (volume, pitch, duration);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
    for (ki = kdKeyboards; ki; ki = ki->next) {
 | 
			
		||||
        if (ki->dixdev->coreEvents)
 | 
			
		||||
            KdRingBell(ki, volume, pitch, duration);
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
| 
						 | 
				
			
			@ -1773,11 +1768,6 @@ KdBlockHandler(ScreenPtr pScreen, void *timeo)
 | 
			
		|||
                myTimeout = ms;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /* if we need to poll for events, do that */
 | 
			
		||||
    if (kdOsFuncs->pollEvents) {
 | 
			
		||||
        (*kdOsFuncs->pollEvents) ();
 | 
			
		||||
        myTimeout = 20;
 | 
			
		||||
    }
 | 
			
		||||
    if (myTimeout > 0)
 | 
			
		||||
        AdjustWaitForDelay(timeo, myTimeout);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue