[PATCH xserver 2/3] kdrive: Remove KdOsFuncs

Adam Jackson ajax at redhat.com
Fri Mar 24 19:58:54 UTC 2017


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

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/kdrive/ephyr/Makefile.am |  1 -
 hw/kdrive/ephyr/ephyr.h     |  2 --
 hw/kdrive/ephyr/ephyrinit.c |  5 ++++-
 hw/kdrive/ephyr/os.c        | 48 -------------------------------------------
 hw/kdrive/src/kdrive.c      | 50 +++------------------------------------------
 hw/kdrive/src/kdrive.h      | 14 -------------
 hw/kdrive/src/kinput.c      | 16 +++------------
 7 files changed, 10 insertions(+), 126 deletions(-)
 delete mode 100644 hw/kdrive/ephyr/os.c

diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index f4bd060..d12559b 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -54,7 +54,6 @@ Xephyr_SOURCES = \
 	ephyr.h \
 	ephyrlog.h \
 	ephyr_draw.c \
-	os.c \
 	ephyrinit.c \
 	ephyrcursor.c \
 	hostx.c \
diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index b48a21c..d44dbc1 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -192,8 +192,6 @@ extern KdPointerDriver EphyrMouseDriver;
 
 extern KdKeyboardDriver EphyrKeyboardDriver;
 
-extern KdOsFuncs EphyrOsFuncs;
-
 extern Bool ephyrCursorInit(ScreenPtr pScreen);
 
 extern int ephyrBufferHeight(KdScreenInfo * screen);
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 383fa9f..4870f16 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -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 = {
diff --git a/hw/kdrive/ephyr/os.c b/hw/kdrive/ephyr/os.c
deleted file mode 100644
index 12bbc54..0000000
--- a/hw/kdrive/ephyr/os.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- *          Authored by Matthew Allum <mallum at 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,
-};
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index e746f3a..cd46556 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -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;
-    }
+    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) ();
-            }
+            kdEnabled = FALSE;
         }
     }
 
@@ -923,11 +883,7 @@ KdScreenInit(ScreenPtr pScreen, int argc, char **argv)
     /*
      * Enable the hardware
      */
-    if (!kdEnabled) {
-        kdEnabled = TRUE;
-        if (kdOsFuncs->Enable)
-            (*kdOsFuncs->Enable) ();
-    }
+    kdEnabled = TRUE;
 
     if (screen->mynum == card->selected) {
         if (card->cfuncs->preserve)
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 99e7203..ad7d1c7 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -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))
@@ -367,9 +356,6 @@ int
  KdProcessArgument(int argc, char **argv, int i);
 
 void
- KdOsInit(KdOsFuncs * pOsFuncs);
-
-void
  KdOsAddInputDrivers(void);
 
 void
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 57ec59c..8ab8c24 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -392,14 +392,9 @@ 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);
-        }
+    for (ki = kdKeyboards; ki; ki = ki->next) {
+        if (ki->dixdev->coreEvents)
+            KdRingBell(ki, volume, pitch, duration);
     }
 }
 
@@ -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);
 }
-- 
2.9.3



More information about the xorg-devel mailing list