diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2009-11-02 19:50:49 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-08-13 15:15:20 +0100 |
commit | 6925fa1ea6d434151cf803a84754421f3037dfac (patch) | |
tree | 762d6afb37a92cf627c4da0482364c9a59028761 | |
parent | 71af1f71c0492c365707c6b3810f94642ff39352 (diff) |
Replace DDXBEFORERESET with a more general way of doing DDX-specific hooks
Replace DDXBEFORERESET, which was introduced for the sole benefit of XWin
in commit 048045a9, with a slightly more general way of doing DDX-specific
hooks, still for the sole benefit of XWin :-)
Use a structure of function pointers, which can be initialized as required
by the specific DDX
Add DDXMAIN to control if the DIX calls ddxMain(), which can be used by
the DDX to initialize ddxHooks as required.
Provide a ddxMain() in the XWin DDX which initializes the ddxBeforeReset
hook.
Unfortunately, this retains the behaviour that all DDX built at the same
time must provide that function, whether they need it or not, but there
doesn't seem to be a clean way around that.
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | dix/dispatch.c | 8 | ||||
-rw-r--r-- | dix/globals.c | 3 | ||||
-rw-r--r-- | dix/main.c | 4 | ||||
-rw-r--r-- | hw/dmx/dmxinit.c | 4 | ||||
-rw-r--r-- | hw/vfb/InitOutput.c | 6 | ||||
-rw-r--r-- | hw/xnest/Init.c | 5 | ||||
-rw-r--r-- | hw/xwin/InitOutput.c | 11 | ||||
-rw-r--r-- | include/ddxhooks.h | 36 | ||||
-rw-r--r-- | include/dix-config.h.in | 4 | ||||
-rw-r--r-- | include/os.h | 4 |
11 files changed, 71 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac index 1f4eb348d..bdba07f4d 100644 --- a/configure.ac +++ b/configure.ac @@ -1904,7 +1904,11 @@ if test "x$XWIN" = xyes; then fi AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF]) - AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ]) + AC_DEFINE(DDXMAIN, 1, [Use ddxMain]) + if test "x$XF86VIDMODE" = xyes; then + AC_MSG_NOTICE([Disabling XF86VidMode extension]) + XF86VIDMODE=no + fi fi AM_CONDITIONAL(XWIN, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes]) diff --git a/dix/dispatch.c b/dix/dispatch.c index 0e5aced1a..d5cfcd2cd 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -130,6 +130,7 @@ int ProcInitialConnection(); #include "inputstr.h" #include "xkbsrv.h" #include "site.h" +#include "ddxhooks.h" #ifdef XSERVER_DTRACE #include "registry.h" @@ -457,9 +458,10 @@ Dispatch(void) } dispatchException &= ~DE_PRIORITYCHANGE; } -#if defined(DDXBEFORERESET) - ddxBeforeReset (); -#endif + + if (ddxHooks.ddxBeforeReset) + ddxHooks.ddxBeforeReset(); + KillAllClients(); free(clientReady); dispatchException &= ~DE_RESET; diff --git a/dix/globals.c b/dix/globals.c index b12856994..e23bd2bdb 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -60,6 +60,7 @@ SOFTWARE. #include "site.h" #include "dixstruct.h" #include "os.h" +#include "ddxhooks.h" ScreenInfo screenInfo; KeybdCtrl defaultKeyboardControl = { @@ -133,3 +134,5 @@ char *display; char *ConnectionInfo; CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND; + +DdxHooks ddxHooks; diff --git a/dix/main.c b/dix/main.c index 47a932f15..a1cb0e915 100644 --- a/dix/main.c +++ b/dix/main.c @@ -139,6 +139,10 @@ int main(int argc, char *argv[], char *envp[]) display = "0"; +#ifdef DDXMAIN + ddxMain(); +#endif + InitRegions(); pixman_disable_out_of_bounds_workaround(); diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c index 075553208..7a1bf4daa 100644 --- a/hw/dmx/dmxinit.c +++ b/hw/dmx/dmxinit.c @@ -842,8 +842,8 @@ void AbortDDX(void) } } -#ifdef DDXBEFORERESET -void ddxBeforeReset(void) +#ifdef DDXMAIN +void ddxMain(void) { } #endif diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index e10973480..af7d662df 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -223,10 +223,10 @@ OsVendorFatalError(void) { } -#if defined(DDXBEFORERESET) -void ddxBeforeReset(void) +#ifdef DDXMAIN +void +ddxMain(void) { - return; } #endif diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c index 8a90cc65e..cf3128033 100644 --- a/hw/xnest/Init.c +++ b/hw/xnest/Init.c @@ -146,9 +146,8 @@ void OsVendorFatalError(void) return; } -#if defined(DDXBEFORERESET) -void ddxBeforeReset(void) +#ifdef DDXMAIN +void ddxMain(void) { - return; } #endif diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 73cc263bd..a86e452e1 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -57,6 +57,7 @@ typedef HRESULT (*SHGETFOLDERPATHPROC)( LPTSTR pszPath ); #endif +#include "ddxhooks.h" /* @@ -195,13 +196,12 @@ ddxPushProviders(void) #endif } -#if defined(DDXBEFORERESET) /* * Called right before KillAllClients when the server is going to reset, * allows us to shutdown our seperate threads cleanly. */ -void +static void ddxBeforeReset (void) { winDebug ("ddxBeforeReset - Hello\n"); @@ -210,8 +210,13 @@ ddxBeforeReset (void) winClipboardShutdown (); #endif } -#endif +void +ddxMain(void) +{ + /* Initialize DDX-specific hooks */ + ddxHooks.ddxBeforeReset = ddxBeforeReset; +} /* See Porting Layer Definition - p. 57 */ void diff --git a/include/ddxhooks.h b/include/ddxhooks.h new file mode 100644 index 000000000..40c87fa70 --- /dev/null +++ b/include/ddxhooks.h @@ -0,0 +1,36 @@ +/* + Copyright © 2009 Jon TURNEY + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +*/ + +#ifndef DDXHOOKS_H +#define DDXHOOKS_H + +struct _DdxHooks +{ + void (*ddxBeforeReset)(void); +}; + +typedef struct _DdxHooks DdxHooks; + +extern DdxHooks ddxHooks; + +#endif /* DDXHOOKS_H */ diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 6a332642b..ed17e0478 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -36,8 +36,8 @@ /* Use OsVendorVErrorF */ #undef DDXOSVERRORF -/* Use ddxBeforeReset */ -#undef DDXBEFORERESET +/* Use ddxMain */ +#undef DDXMAIN /* Build DPMS extension */ #undef DPMSExtension diff --git a/include/os.h b/include/os.h index efa202c6c..df5b8790e 100644 --- a/include/os.h +++ b/include/os.h @@ -83,9 +83,7 @@ typedef struct _NewClientRec *NewClientPtr; #include <stdio.h> #include <stdarg.h> -#ifdef DDXBEFORERESET -extern void ddxBeforeReset (void); -#endif +extern void ddxMain(void); #ifdef DDXOSVERRORF extern _X_EXPORT void (*OsVendorVErrorFProc)(const char *, va_list args); |