diff options
280 files changed, 4649 insertions, 5825 deletions
diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am index 8184f605f..cd1130d61 100644 --- a/GL/glx/Makefile.am +++ b/GL/glx/Makefile.am @@ -14,7 +14,6 @@ AM_CFLAGS = \ -I@MESA_SOURCE@/src/mesa/glapi \ -I@MESA_SOURCE@/src/mesa/main \ -DXFree86Server \ - -DNO_LIBCWRAPPER \ @GLX_DEFINES@ # none yet diff --git a/GL/mesa/X/Makefile.am b/GL/mesa/X/Makefile.am index 45345a7e3..056d31ab5 100644 --- a/GL/mesa/X/Makefile.am +++ b/GL/mesa/X/Makefile.am @@ -20,13 +20,11 @@ INCLUDES = -I@MESA_SOURCE@/include \ AM_CFLAGS = \ $(DIX_CFLAGS) \ -DXFree86Server \ - @GLX_DEFINES@ \ - -DXFree86Server + @GLX_DEFINES@ libX_la_SOURCES = xf86glx.c \ xf86glx_util.c \ - xf86glx_util.h \ - xf86glxint.h + xf86glx_util.h nodist_libX_la_SOURCES = \ xm_api.c \ diff --git a/GL/mesa/X/xf86glx.c b/GL/mesa/X/xf86glx.c index 47c87f6d9..6fffdeb1f 100644 --- a/GL/mesa/X/xf86glx.c +++ b/GL/mesa/X/xf86glx.c @@ -37,40 +37,19 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif #include <string.h> -#include <regionstr.h> -#include <resource.h> -#include <GL/gl.h> -#include <GL/glxint.h> -#include <GL/glxtokens.h> -#include <scrnintstr.h> -#include <windowstr.h> -#include <config.h> + +#include <GL/xmesa.h> +#include <GL/internal/glcore.h> #include <glxserver.h> #include <glxscreens.h> #include <glxdrawable.h> #include <glxcontext.h> -#include <glxext.h> #include <glxutil.h> -#include "context.h" #include "xmesaP.h" -#include "context.h" #include "glcontextmodes.h" #include "os.h" -/* - * This define is for the glcore.h header file. - * If you add it here, then make sure you also add it in - * ../../../glx/Imakefile. - */ -#if 0 -#define DEBUG -#include <GL/internal/glcore.h> -#undef DEBUG -#else -#include <GL/internal/glcore.h> -#endif - typedef struct __GLXMESAscreen __GLXMESAscreen; typedef struct __GLXMESAcontext __GLXMESAcontext; typedef struct __GLXMESAdrawable __GLXMESAdrawable; @@ -218,8 +197,7 @@ __glXMesaContextCopy(__GLXcontext *baseDst, __GLXMESAcontext *dst = (__GLXMESAcontext *) baseDst; __GLXMESAcontext *src = (__GLXMESAcontext *) baseSrc; - _mesa_copy_context(&src->xmesa->mesa, &dst->xmesa->mesa, mask); - return GL_TRUE; + return XMesaCopyContext(src->xmesa, dst->xmesa, mask); } static int @@ -227,7 +205,7 @@ __glXMesaContextForceCurrent(__GLXcontext *baseContext) { __GLXMESAcontext *context = (__GLXMESAcontext *) baseContext; - GlxSetRenderTables (context->xmesa->mesa.CurrentDispatch); + /* GlxSetRenderTables() call for XGL moved in XMesaForceCurrent() */ return XMesaForceCurrent(context->xmesa); } diff --git a/GL/mesa/X/xf86glx_util.c b/GL/mesa/X/xf86glx_util.c index ffb528003..6af773f53 100644 --- a/GL/mesa/X/xf86glx_util.c +++ b/GL/mesa/X/xf86glx_util.c @@ -37,8 +37,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <stdlib.h> -#include <gcstruct.h> -#include "pixmapstr.h" #include "xf86glx_util.h" #include <X11/Xmd.h> diff --git a/GL/mesa/X/xf86glxint.h b/GL/mesa/X/xf86glxint.h deleted file mode 100644 index 8c7e91327..000000000 --- a/GL/mesa/X/xf86glxint.h +++ /dev/null @@ -1,45 +0,0 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -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, sub license, 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin <kevin@precisioninsight.com> - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _XF86GLXINT_H_ -#define _XF86GLXINT_H_ - -#include <miscstruct.h> -#include <GL/gl.h> -#include <GL/xmesa.h> - -#endif /* _XF86GLXINT_H_ */ diff --git a/GL/mesa/main/Makefile.am b/GL/mesa/main/Makefile.am index 20b79351e..2b838e903 100644 --- a/GL/mesa/main/Makefile.am +++ b/GL/mesa/main/Makefile.am @@ -68,6 +68,7 @@ nodist_libmain_la_SOURCES = accum.c \ rastpos.c \ rbadaptors.c \ renderbuffer.c \ + shaders.c \ state.c \ stencil.c \ texcompress.c \ diff --git a/GL/mesa/shader/Makefile.am b/GL/mesa/shader/Makefile.am index 3519545ed..abde27513 100644 --- a/GL/mesa/shader/Makefile.am +++ b/GL/mesa/shader/Makefile.am @@ -27,8 +27,13 @@ nodist_libshader_la_SOURCES = \ atifragshader.c \ nvfragparse.c \ nvprogram.c \ - nvvertexec.c \ - nvvertparse.c \ + nvvertparse.c \ + prog_debug.c \ + prog_execute.c \ + prog_instruction.c \ + prog_parameter.c \ + prog_print.c \ program.c \ - shaderobjects.c \ - shaderobjects_3dlabs.c + programopt.c \ + prog_statevars.c \ + shader_api.c diff --git a/GL/mesa/shader/slang/Makefile.am b/GL/mesa/shader/slang/Makefile.am index 04001c4ba..7f0cd649e 100644 --- a/GL/mesa/shader/slang/Makefile.am +++ b/GL/mesa/shader/slang/Makefile.am @@ -18,23 +18,23 @@ INCLUDES = -I@MESA_SOURCE@/include \ -I../.. \ -I$(top_srcdir)/hw/xfree86/os-support -nodist_libslang_la_SOURCES = slang_analyse.c \ - slang_assemble_assignment.c \ - slang_assemble.c \ - slang_assemble_conditional.c \ - slang_assemble_constructor.c \ - slang_assemble_typeinfo.c \ +nodist_libslang_la_SOURCES = slang_builtin.c \ + slang_codegen.c \ slang_compile.c \ slang_compile_function.c \ slang_compile_operation.c \ slang_compile_struct.c \ slang_compile_variable.c \ - slang_execute.c \ - slang_execute_x86.c \ - slang_export.c \ - slang_library_texsample.c \ + slang_emit.c \ + slang_ir.c \ + slang_label.c \ slang_library_noise.c \ slang_link.c \ + slang_log.c \ slang_preprocess.c \ + slang_print.c \ + slang_simplify.c \ slang_storage.c \ - slang_utility.c + slang_typeinfo.c \ + slang_utility.c \ + slang_vartable.c diff --git a/GL/mesa/swrast/Makefile.am b/GL/mesa/swrast/Makefile.am index 5ed657631..bffb1e7c1 100644 --- a/GL/mesa/swrast/Makefile.am +++ b/GL/mesa/swrast/Makefile.am @@ -23,7 +23,6 @@ nodist_libswrast_la_SOURCES = s_aaline.c \ s_aatriangle.c \ s_accum.c \ s_alpha.c \ - s_arbshader.c \ s_atifragshader.c \ s_bitmap.c \ s_blend.c \ @@ -35,11 +34,11 @@ nodist_libswrast_la_SOURCES = s_aaline.c \ s_drawpix.c \ s_feedback.c \ s_fog.c \ + s_fragprog.c \ s_imaging.c \ s_lines.c \ s_logic.c \ s_masking.c \ - s_nvfragprog.c \ s_points.c \ s_readpix.c \ s_span.c \ diff --git a/GL/mesa/tnl/Makefile.am b/GL/mesa/tnl/Makefile.am index 5d9bdb1e6..84301d3d8 100644 --- a/GL/mesa/tnl/Makefile.am +++ b/GL/mesa/tnl/Makefile.am @@ -23,7 +23,6 @@ nodist_libtnl_la_SOURCES = t_context.c \ t_pipeline.c \ t_vb_arbprogram.c \ t_vb_arbprogram_sse.c \ - t_vb_arbshader.c \ t_vb_cull.c \ t_vb_fog.c \ t_vb_light.c \ diff --git a/Xext/appgroup.c b/Xext/appgroup.c index bb7a73ce1..7bd205587 100644 --- a/Xext/appgroup.c +++ b/Xext/appgroup.c @@ -116,8 +116,7 @@ int XagAppGroupFree( return Success; } -/* static */ -void XagClientStateChange( +static void XagClientStateChange( CallbackListPtr* pcbl, pointer nulldata, pointer calldata) @@ -172,21 +171,6 @@ void XagClientStateChange( } } -void -XagExtensionInit(INITARGS) -{ - if (AddExtension (XAGNAME, - 0, - XagNumberErrors, - ProcXagDispatch, - SProcXagDispatch, - XagResetProc, - StandardMinorOpcode)) { - RT_APPGROUP = CreateNewResourceType (XagAppGroupFree); - XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL); - } -} - /*ARGSUSED*/ static void XagResetProc( @@ -393,8 +377,7 @@ int AttrValidate( return client->noClientException; } -/* static */ -int ProcXagCreate ( +static int ProcXagCreate ( register ClientPtr client) { REQUEST (xXagCreateReq); @@ -425,8 +408,7 @@ int ProcXagCreate ( return client->noClientException; } -/* static */ -int ProcXagDestroy( +static int ProcXagDestroy( register ClientPtr client) { AppGroupPtr pAppGrp; @@ -743,18 +725,7 @@ XID XagId( return (client->appgroup ? client->appgroup->appgroupId : 0); } -void XagGetDeltaInfo( - ClientPtr client, - CARD32* buf) -{ - *buf++ = (CARD32) client->appgroup->default_root; - *buf++ = (CARD32) client->appgroup->root_visual; - *buf++ = (CARD32) client->appgroup->default_colormap; - *buf++ = (CARD32) client->appgroup->black_pixel; - *buf = (CARD32) client->appgroup->white_pixel; -} - -void XagCallClientStateChange( +static void XagCallClientStateChange( CallbackListPtr *pcbl, pointer nulldata, pointer calldata) @@ -785,3 +756,18 @@ void XagCallClientStateChange( XagClientStateChange (NULL, NULL, (pointer)&clientinfo); } } + +void +XagExtensionInit(INITARGS) +{ + if (AddExtension (XAGNAME, + 0, + XagNumberErrors, + ProcXagDispatch, + SProcXagDispatch, + XagResetProc, + StandardMinorOpcode)) { + RT_APPGROUP = CreateNewResourceType (XagAppGroupFree); + XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL); + } +} diff --git a/Xext/appgroup.h b/Xext/appgroup.h index a875068fc..778da5de6 100644 --- a/Xext/appgroup.h +++ b/Xext/appgroup.h @@ -50,12 +50,6 @@ extern ClientPtr XagLeader( ClientPtr /* client */ ); -extern void XagCallClientStateChange( - CallbackListPtr * /* pcbl */, - pointer /* nulldata */, - pointer /* calldata */ -); - extern Bool XagIsControlledRoot ( ClientPtr /* client */, WindowPtr /* pParent */ @@ -65,22 +59,6 @@ extern XID XagId ( ClientPtr /* client */ ); -extern void XagGetDeltaInfo ( - ClientPtr /* client */, - CARD32* /* buf */ -); - -extern void XagClientStateChange( - CallbackListPtr* pcbl, - pointer nulldata, - pointer calldata); - -extern int ProcXagCreate ( - register ClientPtr client); - -extern int ProcXagDestroy( - register ClientPtr client); - _XFUNCPROTOEND #endif /* _APPGROUP_SRV_H_ */ diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 85f591356..95df04320 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -77,7 +77,7 @@ int PanoramiXPixHeight = 0; _X_EXPORT int PanoramiXNumScreens = 0; _X_EXPORT PanoramiXData *panoramiXdataPtr = NULL; -RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL}; +static RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL}; static int PanoramiXNumDepths; static DepthPtr PanoramiXDepths; @@ -109,7 +109,6 @@ static void PanoramiXResetProc(ExtensionEntry*); #include "panoramiXh.h" int (* SavedProcVector[256]) (ClientPtr client) = { NULL, }; -ScreenInfo *GlobalScrInfo = NULL; static int PanoramiXGCIndex = -1; static int PanoramiXScreenIndex = -1; @@ -135,7 +134,7 @@ static void XineramaChangeClip(GCPtr, int, pointer, int); static void XineramaDestroyClip(GCPtr); static void XineramaCopyClip(GCPtr, GCPtr); -GCFuncs XineramaGCFuncs = { +static GCFuncs XineramaGCFuncs = { XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC, XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip }; @@ -168,7 +167,7 @@ XineramaCloseScreen (int i, ScreenPtr pScreen) return (*pScreen->CloseScreen) (i, pScreen); } -Bool +static Bool XineramaCreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; @@ -330,8 +329,6 @@ XineramaDestroyClip(GCPtr pGC) Xinerama_GC_FUNC_EPILOGUE (pGC); } - - _X_EXPORT int XineramaDeleteResource(pointer data, XID id) { @@ -339,32 +336,11 @@ XineramaDeleteResource(pointer data, XID id) return 1; } - -static Bool -XineramaFindIDOnAnyScreen(pointer resource, XID id, pointer privdata) -{ - PanoramiXRes *res = (PanoramiXRes*)resource; - int j; - - FOR_NSCREENS(j) - if(res->info[j].id == *((XID*)privdata)) return TRUE; - - return FALSE; -} - -PanoramiXRes * -PanoramiXFindIDOnAnyScreen(RESTYPE type, XID id) -{ - return LookupClientResourceComplex(clients[CLIENT_ID(id)], type, - XineramaFindIDOnAnyScreen, &id); -} - typedef struct { int screen; int id; } PanoramiXSearchData; - static Bool XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata) { @@ -389,23 +365,6 @@ PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen) XineramaFindIDByScrnum, &data); } -WindowPtr -PanoramiXChangeWindow(int ScrnNum, WindowPtr pWin) -{ - int num = pWin->drawable.pScreen->myNum; - - if(num != ScrnNum) { - PanoramiXRes *win; - - win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, num); - - if (win) - pWin = (WindowPtr) LookupIDByType(win->info[ScrnNum].id, RT_WINDOW); - } - - return pWin; -} - typedef struct _connect_callback_list { void (*func)(void); struct _connect_callback_list *next; @@ -496,7 +455,6 @@ void PanoramiXExtensionInit(int argc, char *argv[]) if (noPanoramiXExtension) return; - GlobalScrInfo = &screenInfo; /* For debug visibility */ PanoramiXNumScreens = screenInfo.numScreens; if (PanoramiXNumScreens == 1) { /* Only 1 screen */ noPanoramiXExtension = TRUE; diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h index 7b3339204..3ad90fa84 100644 --- a/Xext/panoramiX.h +++ b/Xext/panoramiX.h @@ -94,18 +94,6 @@ typedef struct { (a).root = WindowTable[0]->drawable.id; \ } -#define FORCE_WIN(a) { \ - if ((win = PanoramiXFindIDOnAnyScreen(XRT_WINDOW, a))) { \ - (a) = win->info[0].id; /* Real ID */ \ - } \ -} - -#define FORCE_CMAP(a) { \ - if ((win = PanoramiXFindIDOnAnyScreen(XRT_COLORMAP, a))) { \ - (a) = win->info[0].id; /* Real ID */ \ - } \ -} - #define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared) #define SKIP_FAKE_WINDOW(a) if(!LookupIDByType(a, XRT_WINDOW)) return diff --git a/Xext/panoramiXh.h b/Xext/panoramiXh.h index 6cee650ac..1a76a45cd 100644 --- a/Xext/panoramiXh.h +++ b/Xext/panoramiXh.h @@ -19,10 +19,10 @@ extern int PanoramiXGetGeometry(ClientPtr client); extern int PanoramiXTranslateCoords(ClientPtr client); extern int PanoramiXCreatePixmap(ClientPtr client); extern int PanoramiXFreePixmap(ClientPtr client); -extern int PanoramiXCreateGC(ClientPtr client); extern int PanoramiXChangeGC(ClientPtr client); extern int PanoramiXCopyGC(ClientPtr client); extern int PanoramiXCopyColormapAndFree(ClientPtr client); +extern int PanoramiXCreateGC(ClientPtr client); extern int PanoramiXSetDashes(ClientPtr client); extern int PanoramiXSetClipRectangles(ClientPtr client); extern int PanoramiXFreeGC(ClientPtr client); @@ -64,7 +64,6 @@ PROC_EXTERN(ProcPanoramiXGetScreenSize); PROC_EXTERN(ProcXineramaQueryScreens); PROC_EXTERN(ProcXineramaIsActive); -extern Bool XineramaCreateGC(GCPtr pGC); extern int SProcPanoramiXDispatch(ClientPtr client); @@ -72,6 +71,4 @@ extern char *ConnectionInfo; extern int connBlockScreenStart; extern xConnSetupPrefix connSetupPrefix; -extern ScreenInfo *GlobalScrInfo; extern int (* SavedProcVector[256]) (ClientPtr client); - diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h index bb032cfae..ae9024418 100644 --- a/Xext/panoramiXsrv.h +++ b/Xext/panoramiXsrv.h @@ -12,14 +12,11 @@ extern int PanoramiXNumScreens; extern PanoramiXData *panoramiXdataPtr; extern int PanoramiXPixWidth; extern int PanoramiXPixHeight; -extern RegionRec PanoramiXScreenRegion; extern XID *PanoramiXVisualTable; extern void PanoramiXConsolidate(void); extern Bool PanoramiXCreateConnectionBlock(void); extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int); -extern PanoramiXRes * PanoramiXFindIDOnAnyScreen(RESTYPE, XID); -extern WindowPtr PanoramiXChangeWindow(int, WindowPtr); extern Bool XineramaRegisterConnectionBlockCallback(void (*func)(void)); extern int XineramaDeleteResource(pointer, XID); diff --git a/Xext/saver.c b/Xext/saver.c index 7e3ebf408..a9f1dd36c 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -66,7 +66,7 @@ static unsigned char ScreenSaverReqCode = 0; #endif static int ScreenSaverEventBase = 0; -extern DISPATCH_PROC(ProcScreenSaverQueryInfo); +static DISPATCH_PROC(ProcScreenSaverQueryInfo); static DISPATCH_PROC(ProcScreenSaverDispatch); static DISPATCH_PROC(ProcScreenSaverQueryVersion); static DISPATCH_PROC(ProcScreenSaverSelectInput); @@ -774,7 +774,7 @@ ProcScreenSaverQueryVersion (client) return (client->noClientException); } -int +static int ProcScreenSaverQueryInfo (client) register ClientPtr client; { diff --git a/Xext/security.c b/Xext/security.c index e9d2875fd..18ab496b9 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -77,7 +77,7 @@ typedef struct { #define AUTHID(client) \ (((SecurityClientStateRec*)STATEPTR(client))->authId) -CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */ +static CallbackListPtr SecurityValidateGroupCallback = NULL; RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */ diff --git a/Xext/securitysrv.h b/Xext/securitysrv.h index 7c6f432fe..67d864e2e 100644 --- a/Xext/securitysrv.h +++ b/Xext/securitysrv.h @@ -72,15 +72,6 @@ typedef struct { struct _OtherClients *eventClients; /* clients wanting events */ } SecurityAuthorizationRec, *SecurityAuthorizationPtr; -/* The following callback is called when a GenerateAuthorization request - * is processed to sanity check the group argument. The call data will - * be a pointer to a SecurityValidateGroupInfoRec (below). - * Functions registered on this callback are expected to examine the - * group and set the valid field to TRUE if they recognize the group as a - * legitimate group. If they don't recognize it, they should not change the - * valid field. - */ -extern CallbackListPtr SecurityValidateGroupCallback; typedef struct { XID group; /* the group that was sent in GenerateAuthorization */ Bool valid; /* did anyone recognize it? if so, set to TRUE */ diff --git a/Xext/xace.c b/Xext/xace.c index 6fc5c12ee..63856315c 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -37,10 +37,10 @@ CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0}; * from guessing extension major opcodes and using the extension even though * the extension can't be listed or queried. */ -int (*UntrustedProcVector[256])( +static int (*UntrustedProcVector[256])( ClientPtr /*client*/ ); -int (*SwappedUntrustedProcVector[256])( +static int (*SwappedUntrustedProcVector[256])( ClientPtr /*client*/ ); diff --git a/Xext/xace.h b/Xext/xace.h index 7231b04bc..4143cd42f 100644 --- a/Xext/xace.h +++ b/Xext/xace.h @@ -82,16 +82,6 @@ extern int XaceHook( /* From the original Security extension... */ -/* Proc vectors for untrusted clients, swapped and unswapped versions. - * These are the same as the normal proc vectors except that extensions - * that haven't declared themselves secure will have ProcBadRequest plugged - * in for their major opcode dispatcher. This prevents untrusted clients - * from guessing extension major opcodes and using the extension even though - * the extension can't be listed or queried. - */ -extern int (*UntrustedProcVector[256])(ClientPtr client); -extern int (*SwappedUntrustedProcVector[256])(ClientPtr client); - extern void XaceCensorImage( ClientPtr client, RegionPtr pVisibleRegion, diff --git a/Xext/xevie.c b/Xext/xevie.c index e979e7e4d..7922913ba 100644 --- a/Xext/xevie.c +++ b/Xext/xevie.c @@ -52,7 +52,7 @@ of the copyright holder. #include "inputstr.h" #include "windowstr.h" #include "cursorstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "../os/osdep.h" @@ -105,7 +105,7 @@ typedef struct { } xevieKeycQueueRec, *xevieKeycQueuePtr; #define KEYC_QUEUE_SIZE 100 -xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}}; +static xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}}; static int keycqHead = 0, keycqTail = 0; static int ProcDispatch (ClientPtr), SProcDispatch (ClientPtr); diff --git a/Xi/allowev.c b/Xi/allowev.c index c9e4c87d2..449d8811a 100644 --- a/Xi/allowev.c +++ b/Xi/allowev.c @@ -76,9 +76,9 @@ SOFTWARE. */ int -SProcXAllowDeviceEvents(register ClientPtr client) +SProcXAllowDeviceEvents(ClientPtr client) { - register char n; + char n; REQUEST(xAllowDeviceEventsReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ SProcXAllowDeviceEvents(register ClientPtr client) */ int -ProcXAllowDeviceEvents(register ClientPtr client) +ProcXAllowDeviceEvents(ClientPtr client) { TimeStamp time; DeviceIntPtr thisdev; diff --git a/Xi/chdevcur.c b/Xi/chdevcur.c index fc4b0e01d..e69a26613 100644 --- a/Xi/chdevcur.c +++ b/Xi/chdevcur.c @@ -59,9 +59,9 @@ from the author. */ int -SProcXChangeDeviceCursor(register ClientPtr client) +SProcXChangeDeviceCursor(ClientPtr client) { - register char n; + char n; REQUEST(xChangeDeviceCursorReq); swaps(&stuff->length, n); @@ -69,7 +69,7 @@ SProcXChangeDeviceCursor(register ClientPtr client) return (ProcXChangeDeviceCursor(client)); } -int ProcXChangeDeviceCursor(register ClientPtr client) +int ProcXChangeDeviceCursor(ClientPtr client) { int err; WindowPtr pWin = NULL; diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index 899015a02..def3b702d 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXChangeDeviceControl(register ClientPtr client) +SProcXChangeDeviceControl(ClientPtr client) { - register char n; + char n; REQUEST(xChangeDeviceControlReq); swaps(&stuff->length, n); @@ -287,7 +287,7 @@ void SRepXChangeDeviceControl(ClientPtr client, int size, xChangeDeviceControlReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c index d0acc593b..2e0e13cad 100644 --- a/Xi/chgfctl.c +++ b/Xi/chgfctl.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXChangeFeedbackControl(register ClientPtr client) +SProcXChangeFeedbackControl(ClientPtr client) { - register char n; + char n; REQUEST(xChangeFeedbackControlReq); swaps(&stuff->length, n); @@ -89,141 +89,17 @@ SProcXChangeFeedbackControl(register ClientPtr client) return (ProcXChangeFeedbackControl(client)); } -/*********************************************************************** - * - * Change the control attributes. - * - */ - -int -ProcXChangeFeedbackControl(ClientPtr client) -{ - unsigned len; - DeviceIntPtr dev; - KbdFeedbackPtr k; - PtrFeedbackPtr p; - IntegerFeedbackPtr i; - StringFeedbackPtr s; - BellFeedbackPtr b; - LedFeedbackPtr l; - - REQUEST(xChangeFeedbackControlReq); - REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); - - len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, - BadDevice); - return Success; - } - - switch (stuff->feedbackid) { - case KbdFeedbackClass: - if (len != (sizeof(xKbdFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (k = dev->kbdfeed; k; k = k->next) - if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) { - ChangeKbdFeedback(client, dev, stuff->mask, k, - (xKbdFeedbackCtl *) & stuff[1]); - return Success; - } - break; - case PtrFeedbackClass: - if (len != (sizeof(xPtrFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (p = dev->ptrfeed; p; p = p->next) - if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) { - ChangePtrFeedback(client, dev, stuff->mask, p, - (xPtrFeedbackCtl *) & stuff[1]); - return Success; - } - break; - case StringFeedbackClass: - { - register char n; - xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]); - - if (client->swapped) { - swaps(&f->num_keysyms, n); - } - if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (s = dev->stringfeed; s; s = s->next) - if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) { - ChangeStringFeedback(client, dev, stuff->mask, s, - (xStringFeedbackCtl *) & stuff[1]); - return Success; - } - break; - } - case IntegerFeedbackClass: - if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (i = dev->intfeed; i; i = i->next) - if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) { - ChangeIntegerFeedback(client, dev, stuff->mask, i, - (xIntegerFeedbackCtl *) & stuff[1]); - return Success; - } - break; - case LedFeedbackClass: - if (len != (sizeof(xLedFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (l = dev->leds; l; l = l->next) - if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) { - ChangeLedFeedback(client, dev, stuff->mask, l, - (xLedFeedbackCtl *) & stuff[1]); - return Success; - } - break; - case BellFeedbackClass: - if (len != (sizeof(xBellFeedbackCtl) >> 2)) { - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, - 0, BadLength); - return Success; - } - for (b = dev->bell; b; b = b->next) - if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) { - ChangeBellFeedback(client, dev, stuff->mask, b, - (xBellFeedbackCtl *) & stuff[1]); - return Success; - } - break; - default: - break; - } - - SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); - return Success; -} - /****************************************************************************** * * This procedure changes KbdFeedbackClass data. * */ -int +static int ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, KbdFeedbackPtr k, xKbdFeedbackCtl * f) { - register char n; + char n; KeybdCtrl kctrl; int t; int key = DO_ALL; @@ -351,11 +227,11 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, * */ -int +static int ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, PtrFeedbackPtr p, xPtrFeedbackCtl * f) { - register char n; + char n; PtrCtrl pctrl; /* might get BadValue part way through */ if (client->swapped) { @@ -422,12 +298,12 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, * */ -int +static int ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, IntegerFeedbackPtr i, xIntegerFeedbackCtl * f) { - register char n; + char n; if (client->swapped) { swaps(&f->length, n); @@ -445,13 +321,13 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev, * */ -int +static int ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, StringFeedbackPtr s, xStringFeedbackCtl * f) { - register char n; - register long *p; + char n; + long *p; int i, j; KeySym *syms, *sup_syms; @@ -495,12 +371,12 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, * */ -int +static int ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, BellFeedbackPtr b, xBellFeedbackCtl * f) { - register char n; + char n; int t; BellCtrl bctrl; /* might get BadValue part way through */ @@ -560,11 +436,11 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev, * */ -int +static int ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, LedFeedbackPtr l, xLedFeedbackCtl * f) { - register char n; + char n; LedCtrl lctrl; /* might get BadValue part way through */ if (client->swapped) { @@ -585,3 +461,128 @@ ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask, return Success; } + +/*********************************************************************** + * + * Change the control attributes. + * + */ + +int +ProcXChangeFeedbackControl(ClientPtr client) +{ + unsigned len; + DeviceIntPtr dev; + KbdFeedbackPtr k; + PtrFeedbackPtr p; + IntegerFeedbackPtr i; + StringFeedbackPtr s; + BellFeedbackPtr b; + LedFeedbackPtr l; + + REQUEST(xChangeFeedbackControlReq); + REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); + + len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); + dev = LookupDeviceIntRec(stuff->deviceid); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, + BadDevice); + return Success; + } + + switch (stuff->feedbackid) { + case KbdFeedbackClass: + if (len != (sizeof(xKbdFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (k = dev->kbdfeed; k; k = k->next) + if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) { + ChangeKbdFeedback(client, dev, stuff->mask, k, + (xKbdFeedbackCtl *) & stuff[1]); + return Success; + } + break; + case PtrFeedbackClass: + if (len != (sizeof(xPtrFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (p = dev->ptrfeed; p; p = p->next) + if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) { + ChangePtrFeedback(client, dev, stuff->mask, p, + (xPtrFeedbackCtl *) & stuff[1]); + return Success; + } + break; + case StringFeedbackClass: + { + char n; + xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]); + + if (client->swapped) { + swaps(&f->num_keysyms, n); + } + if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (s = dev->stringfeed; s; s = s->next) + if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) { + ChangeStringFeedback(client, dev, stuff->mask, s, + (xStringFeedbackCtl *) & stuff[1]); + return Success; + } + break; + } + case IntegerFeedbackClass: + if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (i = dev->intfeed; i; i = i->next) + if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) { + ChangeIntegerFeedback(client, dev, stuff->mask, i, + (xIntegerFeedbackCtl *) & stuff[1]); + return Success; + } + break; + case LedFeedbackClass: + if (len != (sizeof(xLedFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (l = dev->leds; l; l = l->next) + if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) { + ChangeLedFeedback(client, dev, stuff->mask, l, + (xLedFeedbackCtl *) & stuff[1]); + return Success; + } + break; + case BellFeedbackClass: + if (len != (sizeof(xBellFeedbackCtl) >> 2)) { + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, + 0, BadLength); + return Success; + } + for (b = dev->bell; b; b = b->next) + if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) { + ChangeBellFeedback(client, dev, stuff->mask, b, + (xBellFeedbackCtl *) & stuff[1]); + return Success; + } + break; + default: + break; + } + + SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch); + return Success; +} + diff --git a/Xi/chgfctl.h b/Xi/chgfctl.h index 81e1153ec..cfa9fc6b0 100644 --- a/Xi/chgfctl.h +++ b/Xi/chgfctl.h @@ -36,46 +36,4 @@ int SProcXChangeFeedbackControl(ClientPtr /* client */ int ProcXChangeFeedbackControl(ClientPtr /* client */ ); -int ChangeKbdFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - KbdFeedbackPtr /* k */ , - xKbdFeedbackCtl * /* f */ - ); - -int ChangePtrFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - PtrFeedbackPtr /* p */ , - xPtrFeedbackCtl * /* f */ - ); - -int ChangeIntegerFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - IntegerFeedbackPtr /* i */ , - xIntegerFeedbackCtl * /* f */ - ); - -int ChangeStringFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - StringFeedbackPtr /* s */ , - xStringFeedbackCtl * /* f */ - ); - -int ChangeBellFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - BellFeedbackPtr /* b */ , - xBellFeedbackCtl * /* f */ - ); - -int ChangeLedFeedback(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - unsigned long /* mask */ , - LedFeedbackPtr /* l */ , - xLedFeedbackCtl * /* f */ - ); - #endif /* CHGFCTL_H */ diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c index 8134b4060..2cf8225b3 100644 --- a/Xi/chgkbd.c +++ b/Xi/chgkbd.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXChangeKeyboardDevice(register ClientPtr client) +SProcXChangeKeyboardDevice(ClientPtr client) { - register char n; + char n; REQUEST(xChangeKeyboardDeviceReq); swaps(&stuff->length, n); @@ -96,7 +96,7 @@ SProcXChangeKeyboardDevice(register ClientPtr client) */ int -ProcXChangeKeyboardDevice(register ClientPtr client) +ProcXChangeKeyboardDevice(ClientPtr client) { REQUEST(xChangeKeyboardDeviceReq); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c index 047b899ed..eac520fd4 100644 --- a/Xi/chgkmap.c +++ b/Xi/chgkmap.c @@ -76,11 +76,11 @@ SOFTWARE. */ int -SProcXChangeDeviceKeyMapping(register ClientPtr client) +SProcXChangeDeviceKeyMapping(ClientPtr client) { - register char n; - register long *p; - register int i, count; + char n; + long *p; + int i, count; REQUEST(xChangeDeviceKeyMappingReq); swaps(&stuff->length, n); @@ -101,7 +101,7 @@ SProcXChangeDeviceKeyMapping(register ClientPtr client) */ int -ProcXChangeDeviceKeyMapping(register ClientPtr client) +ProcXChangeDeviceKeyMapping(ClientPtr client) { int ret; unsigned len; diff --git a/Xi/chgprop.c b/Xi/chgprop.c index bab4597b8..59a93c60b 100644 --- a/Xi/chgprop.c +++ b/Xi/chgprop.c @@ -78,11 +78,11 @@ SOFTWARE. */ int -SProcXChangeDeviceDontPropagateList(register ClientPtr client) +SProcXChangeDeviceDontPropagateList(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xChangeDeviceDontPropagateListReq); swaps(&stuff->length, n); @@ -104,7 +104,7 @@ SProcXChangeDeviceDontPropagateList(register ClientPtr client) */ int -ProcXChangeDeviceDontPropagateList(register ClientPtr client) +ProcXChangeDeviceDontPropagateList(ClientPtr client) { int i, rc; WindowPtr pWin; diff --git a/Xi/chgptr.c b/Xi/chgptr.c index 22c8a5f5e..a94906866 100644 --- a/Xi/chgptr.c +++ b/Xi/chgptr.c @@ -82,9 +82,9 @@ SOFTWARE. */ int -SProcXChangePointerDevice(register ClientPtr client) +SProcXChangePointerDevice(ClientPtr client) { - register char n; + char n; REQUEST(xChangePointerDeviceReq); swaps(&stuff->length, n); @@ -99,7 +99,7 @@ SProcXChangePointerDevice(register ClientPtr client) */ int -ProcXChangePointerDevice(register ClientPtr client) +ProcXChangePointerDevice(ClientPtr client) { REQUEST(xChangePointerDeviceReq); REQUEST_SIZE_MATCH(xChangePointerDeviceReq); diff --git a/Xi/chgptr.h b/Xi/chgptr.h index fb3b5cc39..2d8ab66e5 100644 --- a/Xi/chgptr.h +++ b/Xi/chgptr.h @@ -45,12 +45,4 @@ void SendEventToAllWindows(DeviceIntPtr /* dev */ , int /* count */ ); -void FindInterestedChildren( /* FIXME: could be static? */ - DeviceIntPtr /* dev */ , - WindowPtr /* p1 */ , - Mask /* mask */ , - xEvent * /* ev */ , - int /* count */ - ); - #endif /* CHGPTR_H */ diff --git a/Xi/chpkpair.c b/Xi/chpkpair.c index 8e79a7502..fcbdcdf2e 100644 --- a/Xi/chpkpair.c +++ b/Xi/chpkpair.c @@ -60,9 +60,9 @@ from the author. * */ -int SProcXChangePointerKeyboardPairing(register ClientPtr client) +int SProcXChangePointerKeyboardPairing(ClientPtr client) { - register char n; + char n; REQUEST(xChangePointerKeyboardPairingReq); swaps(&stuff->length, n); @@ -70,7 +70,7 @@ int SProcXChangePointerKeyboardPairing(register ClientPtr client) } int -ProcXChangePointerKeyboardPairing(register ClientPtr client) +ProcXChangePointerKeyboardPairing(ClientPtr client) { DeviceIntPtr pPointer, pKeyboard; int ret; diff --git a/Xi/closedev.c b/Xi/closedev.c index 7bdd3730f..8aebe1043 100644 --- a/Xi/closedev.c +++ b/Xi/closedev.c @@ -77,9 +77,9 @@ SOFTWARE. */ int -SProcXCloseDevice(register ClientPtr client) +SProcXCloseDevice(ClientPtr client) { - register char n; + char n; REQUEST(xCloseDeviceReq); swaps(&stuff->length, n); @@ -89,42 +89,29 @@ SProcXCloseDevice(register ClientPtr client) /*********************************************************************** * - * This procedure closes an input device. + * Clear out event selections and passive grabs from a window for the + * specified device. * */ -int -ProcXCloseDevice(register ClientPtr client) +static void +DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) { - int i; - WindowPtr pWin, p1; - DeviceIntPtr d; - - REQUEST(xCloseDeviceReq); - REQUEST_SIZE_MATCH(xCloseDeviceReq); - - d = LookupDeviceIntRec(stuff->deviceid); - if (d == NULL) { - SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice); - return Success; - } - - if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client)) - (*d->deviceGrab.DeactivateGrab) (d); /* release active grab */ + InputClientsPtr others; + OtherInputMasks *pOthers; + GrabPtr grab, next; - /* Remove event selections from all windows for events from this device - * and selected by this client. - * Delete passive grabs from all windows for this device. */ + if ((pOthers = wOtherInputMasks(pWin)) != 0) + for (others = pOthers->inputClients; others; others = others->next) + if (SameClient(others, client)) + others->mask[dev->id] = NoEventMask; - for (i = 0; i < screenInfo.numScreens; i++) { - pWin = WindowTable[i]; - DeleteDeviceEvents(d, pWin, client); - p1 = pWin->firstChild; - DeleteEventsFromChildren(d, p1, client); + for (grab = wPassiveGrabs(pWin); grab; grab = next) { + next = grab->next; + if ((grab->device == dev) && + (client->clientAsMask == CLIENT_BITS(grab->resource))) + FreeResource(grab->resource, RT_NONE); } - - CloseInputDevice(d, client); - return Success; } /*********************************************************************** @@ -134,7 +121,7 @@ ProcXCloseDevice(register ClientPtr client) * */ -void +static void DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) { WindowPtr p2; @@ -149,27 +136,40 @@ DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) /*********************************************************************** * - * Clear out event selections and passive grabs from a window for the - * specified device. + * This procedure closes an input device. * */ -void -DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) +int +ProcXCloseDevice(ClientPtr client) { - InputClientsPtr others; - OtherInputMasks *pOthers; - GrabPtr grab, next; + int i; + WindowPtr pWin, p1; + DeviceIntPtr d; - if ((pOthers = wOtherInputMasks(pWin)) != 0) - for (others = pOthers->inputClients; others; others = others->next) - if (SameClient(others, client)) - others->mask[dev->id] = NoEventMask; + REQUEST(xCloseDeviceReq); + REQUEST_SIZE_MATCH(xCloseDeviceReq); - for (grab = wPassiveGrabs(pWin); grab; grab = next) { - next = grab->next; - if ((grab->device == dev) && - (client->clientAsMask == CLIENT_BITS(grab->resource))) - FreeResource(grab->resource, RT_NONE); + d = LookupDeviceIntRec(stuff->deviceid); + if (d == NULL) { + SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice); + return Success; } + + if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client)) + (*d->deviceGrab.DeactivateGrab) (d); /* release active grab */ + + /* Remove event selections from all windows for events from this device + * and selected by this client. + * Delete passive grabs from all windows for this device. */ + + for (i = 0; i < screenInfo.numScreens; i++) { + pWin = WindowTable[i]; + DeleteDeviceEvents(d, pWin, client); + p1 = pWin->firstChild; + DeleteEventsFromChildren(d, p1, client); + } + + CloseInputDevice(d, client); + return Success; } diff --git a/Xi/closedev.h b/Xi/closedev.h index 6853d5002..400aaa60b 100644 --- a/Xi/closedev.h +++ b/Xi/closedev.h @@ -36,14 +36,4 @@ int SProcXCloseDevice(ClientPtr /* client */ int ProcXCloseDevice(ClientPtr /* client */ ); -void DeleteEventsFromChildren(DeviceIntPtr /* dev */ , - WindowPtr /* p1 */ , - ClientPtr /* client */ - ); - -void DeleteDeviceEvents(DeviceIntPtr /* dev */ , - WindowPtr /* pWin */ , - ClientPtr /* client */ - ); - #endif /* CLOSEDEV_H */ diff --git a/Xi/devbell.c b/Xi/devbell.c index b11238620..ba873c7c7 100644 --- a/Xi/devbell.c +++ b/Xi/devbell.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXDeviceBell(register ClientPtr client) +SProcXDeviceBell(ClientPtr client) { - register char n; + char n; REQUEST(xDeviceBellReq); swaps(&stuff->length, n); @@ -91,7 +91,7 @@ SProcXDeviceBell(register ClientPtr client) */ int -ProcXDeviceBell(register ClientPtr client) +ProcXDeviceBell(ClientPtr client) { DeviceIntPtr dev; KbdFeedbackPtr k; diff --git a/Xi/exevents.c b/Xi/exevents.c index 3e3f15a1d..26f3640b7 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -319,7 +319,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count) _X_EXPORT int InitProximityClassDeviceStruct(DeviceIntPtr dev) { - register ProximityClassPtr proxc; + ProximityClassPtr proxc; proxc = (ProximityClassPtr) xalloc(sizeof(ProximityClassRec)); if (!proxc) @@ -332,7 +332,7 @@ _X_EXPORT void InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval, int resolution, int min_res, int max_res) { - register AxisInfoPtr ax; + AxisInfoPtr ax; if (!dev || !dev->valuator) return; @@ -409,7 +409,7 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v, void DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, - register WindowPtr pWin) + WindowPtr pWin) { deviceFocus event; @@ -734,9 +734,9 @@ MakeInputMasks(WindowPtr pWin) void RecalculateDeviceDeliverableEvents(WindowPtr pWin) { - register InputClientsPtr others; + InputClientsPtr others; struct _OtherInputMasks *inputMasks; /* default: NULL */ - register WindowPtr pChild, tmp; + WindowPtr pChild, tmp; int i; pChild = pWin; @@ -770,9 +770,9 @@ RecalculateDeviceDeliverableEvents(WindowPtr pWin) } int -InputClientGone(register WindowPtr pWin, XID id) +InputClientGone(WindowPtr pWin, XID id) { - register InputClientsPtr other, prev; + InputClientsPtr other, prev; if (!wOtherInputMasks(pWin)) return (Success); @@ -870,7 +870,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, int SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map) { - register int i; + int i; ButtonClassPtr b = dev->button; if (b == NULL) @@ -896,7 +896,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen, { KeyCode *map = NULL; int inputMapLen; - register int i; + int i; *k = dev->key; if (*k == NULL) @@ -1025,33 +1025,7 @@ ChangeKeyMapping(ClientPtr client, return client->noClientException; } -void -DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) -{ - int i; - DeviceIntPtr dev; - InputClientsPtr ic; - struct _OtherInputMasks *inputMasks; - - for (dev = inputInfo.devices; dev; dev = dev->next) { - if (dev == inputInfo.pointer || dev == inputInfo.keyboard) - continue; - DeleteDeviceFromAnyExtEvents(pWin, dev); - } - - for (dev = inputInfo.off_devices; dev; dev = dev->next) - DeleteDeviceFromAnyExtEvents(pWin, dev); - - if (freeResources) - while ((inputMasks = wOtherInputMasks(pWin)) != 0) { - ic = inputMasks->inputClients; - for (i = 0; i < EMASKSIZE; i++) - inputMasks->dontPropagateMask[i] = 0; - FreeResource(ic->resource, RT_NONE); - } -} - -void +static void DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) { WindowPtr parent; @@ -1116,6 +1090,32 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev) dev->valuator->motionHintWindow = NullWindow; } +void +DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources) +{ + int i; + DeviceIntPtr dev; + InputClientsPtr ic; + struct _OtherInputMasks *inputMasks; + + for (dev = inputInfo.devices; dev; dev = dev->next) { + if (dev == inputInfo.pointer || dev == inputInfo.keyboard) + continue; + DeleteDeviceFromAnyExtEvents(pWin, dev); + } + + for (dev = inputInfo.off_devices; dev; dev = dev->next) + DeleteDeviceFromAnyExtEvents(pWin, dev); + + if (freeResources) + while ((inputMasks = wOtherInputMasks(pWin)) != 0) { + ic = inputMasks->inputClients; + for (i = 0; i < EMASKSIZE; i++) + inputMasks->dontPropagateMask[i] = 0; + FreeResource(ic->resource, RT_NONE); + } +} + int MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) { @@ -1169,10 +1169,10 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, } } -Mask +static Mask DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) { - register InputClientsPtr other; + InputClientsPtr other; if (!wOtherInputMasks(pWin)) return 0; @@ -1185,7 +1185,7 @@ DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client) } void -MaybeStopDeviceHint(register DeviceIntPtr dev, ClientPtr client) +MaybeStopDeviceHint(DeviceIntPtr dev, ClientPtr client) { WindowPtr pWin; GrabPtr grab = dev->deviceGrab.grab; @@ -1254,7 +1254,7 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents) * */ -void +static void FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask, xEvent * ev, int count) { diff --git a/Xi/exglobals.h b/Xi/exglobals.h index 811375e25..8fcd907a3 100644 --- a/Xi/exglobals.h +++ b/Xi/exglobals.h @@ -37,7 +37,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. extern int IReqCode; extern int BadDevice; -extern int BadEvent; extern int BadMode; extern int DeviceBusy; extern int BadClass; @@ -46,7 +45,6 @@ extern Mask DevicePointerMotionMask; extern Mask DevicePointerMotionHintMask; extern Mask DeviceFocusChangeMask; extern Mask DeviceStateNotifyMask; -extern Mask ChangeDeviceNotifyMask; extern Mask DeviceMappingNotifyMask; extern Mask DeviceOwnerGrabButtonMask; extern Mask DeviceButtonGrabMask; diff --git a/Xi/extinit.c b/Xi/extinit.c index 971617ebb..9d921fa07 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -127,7 +127,7 @@ int ExtEventIndex; Mask ExtValidMasks[EMASKSIZE]; Mask ExtExclusiveMasks[EMASKSIZE]; -struct dev_type +static struct dev_type { Atom type; char *name; @@ -163,7 +163,7 @@ XExtEventInfo EventInfo[32]; int IReqCode = 0; int BadDevice = 0; -int BadEvent = 1; +static int BadEvent = 1; int BadMode = 2; int DeviceBusy = 3; int BadClass = 4; @@ -172,7 +172,7 @@ Mask DevicePointerMotionMask; Mask DevicePointerMotionHintMask; Mask DeviceFocusChangeMask; Mask DeviceStateNotifyMask; -Mask ChangeDeviceNotifyMask; +static Mask ChangeDeviceNotifyMask; Mask DeviceMappingNotifyMask; Mask DeviceOwnerGrabButtonMask; Mask DeviceButtonGrabMask; @@ -225,54 +225,6 @@ static XExtensionVersion thisversion = { XI_Present, XI_Add_DevicePresenceNotify_Minor }; -/********************************************************************** - * - * IExtensionInit - initialize the input extension. - * - * Called from InitExtensions in main() or from QueryExtension() if the - * extension is dynamically loaded. - * - * This extension has several events and errors. - * - */ - -void -XInputExtensionInit(void) -{ - ExtensionEntry *extEntry; - - extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, - SProcIDispatch, IResetProc, StandardMinorOpcode); - if (extEntry) { - IReqCode = extEntry->base; - AllExtensionVersions[IReqCode - 128] = thisversion; - MakeDeviceTypeAtoms(); - RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); - FixExtensionEvents(extEntry); - ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; - EventSwapVector[DeviceValuator] = SEventIDispatch; - EventSwapVector[DeviceKeyPress] = SEventIDispatch; - EventSwapVector[DeviceKeyRelease] = SEventIDispatch; - EventSwapVector[DeviceButtonPress] = SEventIDispatch; - EventSwapVector[DeviceButtonRelease] = SEventIDispatch; - EventSwapVector[DeviceMotionNotify] = SEventIDispatch; - EventSwapVector[DeviceFocusIn] = SEventIDispatch; - EventSwapVector[DeviceFocusOut] = SEventIDispatch; - EventSwapVector[ProximityIn] = SEventIDispatch; - EventSwapVector[ProximityOut] = SEventIDispatch; - EventSwapVector[DeviceStateNotify] = SEventIDispatch; - EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; - EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; - EventSwapVector[DeviceMappingNotify] = SEventIDispatch; - EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; - EventSwapVector[DeviceEnterNotify] = SEventIDispatch; - EventSwapVector[DeviceLeaveNotify] = SEventIDispatch; - EventSwapVector[PointerKeyboardPairingChangedNotify] = SEventIDispatch; - } else { - FatalError("IExtensionInit: AddExtensions failed\n"); - } -} - /************************************************************************* * * ProcIDispatch - main dispatch routine for requests to this extension. @@ -280,8 +232,8 @@ XInputExtensionInit(void) * */ -int -ProcIDispatch(register ClientPtr client) +static int +ProcIDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data == X_GetExtensionVersion) @@ -391,8 +343,8 @@ ProcIDispatch(register ClientPtr client) * */ -int -SProcIDispatch(register ClientPtr client) +static int +SProcIDispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data == X_GetExtensionVersion) @@ -505,7 +457,7 @@ SProcIDispatch(register ClientPtr client) if (rep->RepType == X_##code) \ SRepX##code (client, len, (x##code##Reply *) rep) -void +static void SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) /* All we look at is the type field */ { /* This is common to all replies */ @@ -580,78 +532,17 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) } } -/***************************************************************************** - * - * SEventIDispatch - * - * Swap any events defined in this extension. - */ -#define DO_SWAP(func,type) func ((type *)from, (type *)to) - -void -SEventIDispatch(xEvent * from, xEvent * to) -{ - int type = from->u.u.type & 0177; - - if (type == DeviceValuator) - DO_SWAP(SEventDeviceValuator, deviceValuator); - else if (type == DeviceKeyPress) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceKeyRelease) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceButtonPress) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceButtonRelease) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceMotionNotify) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceFocusIn) - DO_SWAP(SEventFocus, deviceFocus); - else if (type == DeviceFocusOut) - DO_SWAP(SEventFocus, deviceFocus); - else if (type == ProximityIn) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == ProximityOut) { - SKeyButtonPtrEvent(from, to); - to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; - } else if (type == DeviceStateNotify) - DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); - else if (type == DeviceKeyStateNotify) - DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); - else if (type == DeviceButtonStateNotify) - DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); - else if (type == DeviceMappingNotify) - DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); - else if (type == ChangeDeviceNotify) - DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); - else if (type == DeviceEnterNotify) - DO_SWAP(SDeviceEnterNotifyEvent, deviceEnterNotify); - else if (type == DeviceLeaveNotify) - DO_SWAP(SDeviceLeaveNotifyEvent, deviceLeaveNotify); - else if (type == PointerKeyboardPairingChangedNotify) - DO_SWAP(SPointerKeyboardPairingChangedNotifyEvent, pairingChangedNotify); - else { - FatalError("XInputExtension: Impossible event!\n"); - } -} - /************************************************************************ * * This function swaps the DeviceValuator event. * */ -void +static void SEventDeviceValuator(deviceValuator * from, deviceValuator * to) { - register char n; - register int i; + char n; + int i; INT32 *ip B32; *to = *from; @@ -663,10 +554,10 @@ SEventDeviceValuator(deviceValuator * from, deviceValuator * to) } } -void +static void SEventFocus(deviceFocus * from, deviceFocus * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); @@ -674,11 +565,11 @@ SEventFocus(deviceFocus * from, deviceFocus * to) swapl(&to->window, n); } -void +static void SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) { - register int i; - register char n; + int i; + char n; INT32 *ip B32; *to = *from; @@ -690,50 +581,50 @@ SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to) } } -void +static void SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from, deviceKeyStateNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); } -void +static void SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from, deviceButtonStateNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); } -void +static void SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); swapl(&to->time, n); } -void +static void SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); swapl(&to->time, n); } -void +static void SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber,n); @@ -741,18 +632,20 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to swaps(&to->control, n); } -void SDeviceEnterNotifyEvent (deviceEnterNotify *from, deviceEnterNotify *to) +static void +SDeviceEnterNotifyEvent (deviceEnterNotify *from, deviceEnterNotify *to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber,n); swapl(&to->time, n); } -void SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to) +static void +SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber,n); @@ -766,23 +659,117 @@ void SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to) swaps(&to->eventY, n); } -void SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify *from, +static void +SPointerKeyboardPairingChangedNotifyEvent (pairingChangedNotify *from, pairingChangedNotify *to) { - register char n; + char n; *to = *from; swaps(&to->sequenceNumber, n); swapl(&to->time, n); } +/************************************************************************** + * + * Allow the specified event to have its propagation suppressed. + * The default is to not allow suppression of propagation. + * + */ + +static void +AllowPropagateSuppress(Mask mask) +{ + int i; + + for (i = 0; i < MAX_DEVICES; i++) + PropagateMask[i] |= mask; +} + +/************************************************************************** + * + * Return the next available extension event mask. + * + */ + +static Mask +GetNextExtEventMask(void) +{ + int i; + Mask mask = lastExtEventMask; + + if (lastExtEventMask == 0) { + FatalError("GetNextExtEventMask: no more events are available."); + } + lastExtEventMask <<= 1; + + for (i = 0; i < MAX_DEVICES; i++) + ExtValidMasks[i] |= mask; + return mask; +} + +/************************************************************************** + * + * Record an event mask where there is no unique corresponding event type. + * We can't call SetMaskForEvent, since that would clobber the existing + * mask for that event. MotionHint and ButtonMotion are examples. + * + * Since extension event types will never be less than 64, we can use + * 0-63 in the EventInfo array as the "type" to be used to look up this + * mask. This means that the corresponding macros such as + * DevicePointerMotionHint must have access to the same constants. + * + */ + +static void +SetEventInfo(Mask mask, int constant) +{ + EventInfo[ExtEventIndex].mask = mask; + EventInfo[ExtEventIndex++].type = constant; +} + +/************************************************************************** + * + * Allow the specified event to be restricted to being selected by one + * client at a time. + * The default is to allow more than one client to select the event. + * + */ + +static void +SetExclusiveAccess(Mask mask) +{ + int i; + + for (i = 0; i < MAX_DEVICES; i++) + ExtExclusiveMasks[i] |= mask; +} + +/************************************************************************** + * + * Assign the specified mask to the specified event. + * + */ + +static void +SetMaskForExtEvent(Mask mask, int event) +{ + + EventInfo[ExtEventIndex].mask = mask; + EventInfo[ExtEventIndex++].type = event; + + if ((event < LASTEvent) || (event >= 128)) + FatalError("MaskForExtensionEvent: bogus event number"); + SetMaskForEvent(mask, event); +} + /************************************************************************ * * This function sets up extension event types and masks. * */ -void +static void FixExtensionEvents(ExtensionEntry * extEntry) { Mask mask; @@ -905,7 +892,7 @@ FixExtensionEvents(ExtensionEntry * extEntry) * */ -void +static void RestoreExtensionEvents(void) { int i; @@ -956,7 +943,7 @@ RestoreExtensionEvents(void) * */ -void +static void IResetProc(ExtensionEntry * unused) { @@ -989,7 +976,7 @@ IResetProc(ExtensionEntry * unused) * */ -Bool +_X_EXPORT Bool DeviceIsPointerType(DeviceIntPtr dev) { if (dev_type[1].type == dev->type) @@ -1019,7 +1006,7 @@ AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name) * */ -void +static void MakeDeviceTypeAtoms(void) { int i; @@ -1052,95 +1039,113 @@ LookupDeviceIntRec(CARD8 id) return NULL; } -/************************************************************************** - * - * Allow the specified event to be restricted to being selected by one - * client at a time. - * The default is to allow more than one client to select the event. - * - */ - -void -SetExclusiveAccess(Mask mask) -{ - int i; - - for (i = 0; i < MAX_DEVICES; i++) - ExtExclusiveMasks[i] |= mask; -} - -/************************************************************************** - * - * Allow the specified event to have its propagation suppressed. - * The default is to not allow suppression of propagation. - * - */ - -void -AllowPropagateSuppress(Mask mask) -{ - int i; - - for (i = 0; i < MAX_DEVICES; i++) - PropagateMask[i] |= mask; -} - -/************************************************************************** +/***************************************************************************** * - * Return the next available extension event mask. + * SEventIDispatch * + * Swap any events defined in this extension. */ +#define DO_SWAP(func,type) func ((type *)from, (type *)to) -Mask -GetNextExtEventMask(void) +static void +SEventIDispatch(xEvent * from, xEvent * to) { - int i; - Mask mask = lastExtEventMask; + int type = from->u.u.type & 0177; - if (lastExtEventMask == 0) { - FatalError("GetNextExtEventMask: no more events are available."); + if (type == DeviceValuator) + DO_SWAP(SEventDeviceValuator, deviceValuator); + else if (type == DeviceKeyPress) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceKeyRelease) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceButtonPress) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceButtonRelease) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceMotionNotify) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceFocusIn) + DO_SWAP(SEventFocus, deviceFocus); + else if (type == DeviceFocusOut) + DO_SWAP(SEventFocus, deviceFocus); + else if (type == ProximityIn) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == ProximityOut) { + SKeyButtonPtrEvent(from, to); + to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1; + } else if (type == DeviceStateNotify) + DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify); + else if (type == DeviceKeyStateNotify) + DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify); + else if (type == DeviceButtonStateNotify) + DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify); + else if (type == DeviceMappingNotify) + DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify); + else if (type == ChangeDeviceNotify) + DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify); + else if (type == DevicePresenceNotify) + DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify); + else if (type == DeviceEnterNotify) + DO_SWAP(SDeviceEnterNotifyEvent, deviceEnterNotify); + else if (type == DeviceLeaveNotify) + DO_SWAP(SDeviceLeaveNotifyEvent, deviceLeaveNotify); + else if (type == PointerKeyboardPairingChangedNotify) + DO_SWAP(SPointerKeyboardPairingChangedNotifyEvent, pairingChangedNotify); + else { + FatalError("XInputExtension: Impossible event!\n"); } - lastExtEventMask <<= 1; - - for (i = 0; i < MAX_DEVICES; i++) - ExtValidMasks[i] |= mask; - return mask; } -/************************************************************************** - * - * Assign the specified mask to the specified event. +/********************************************************************** * - */ - -void -SetMaskForExtEvent(Mask mask, int event) -{ - - EventInfo[ExtEventIndex].mask = mask; - EventInfo[ExtEventIndex++].type = event; - - if ((event < LASTEvent) || (event >= 128)) - FatalError("MaskForExtensionEvent: bogus event number"); - SetMaskForEvent(mask, event); -} - -/************************************************************************** + * IExtensionInit - initialize the input extension. * - * Record an event mask where there is no unique corresponding event type. - * We can't call SetMaskForEvent, since that would clobber the existing - * mask for that event. MotionHint and ButtonMotion are examples. + * Called from InitExtensions in main() or from QueryExtension() if the + * extension is dynamically loaded. * - * Since extension event types will never be less than 64, we can use - * 0-63 in the EventInfo array as the "type" to be used to look up this - * mask. This means that the corresponding macros such as - * DevicePointerMotionHint must have access to the same constants. + * This extension has several events and errors. * */ void -SetEventInfo(Mask mask, int constant) +XInputExtensionInit(void) { - EventInfo[ExtEventIndex].mask = mask; - EventInfo[ExtEventIndex++].type = constant; + ExtensionEntry *extEntry; + + extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, + SProcIDispatch, IResetProc, StandardMinorOpcode); + if (extEntry) { + IReqCode = extEntry->base; + AllExtensionVersions[IReqCode - 128] = thisversion; + MakeDeviceTypeAtoms(); + RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); + FixExtensionEvents(extEntry); + ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; + EventSwapVector[DeviceValuator] = SEventIDispatch; + EventSwapVector[DeviceKeyPress] = SEventIDispatch; + EventSwapVector[DeviceKeyRelease] = SEventIDispatch; + EventSwapVector[DeviceButtonPress] = SEventIDispatch; + EventSwapVector[DeviceButtonRelease] = SEventIDispatch; + EventSwapVector[DeviceMotionNotify] = SEventIDispatch; + EventSwapVector[DeviceFocusIn] = SEventIDispatch; + EventSwapVector[DeviceFocusOut] = SEventIDispatch; + EventSwapVector[ProximityIn] = SEventIDispatch; + EventSwapVector[ProximityOut] = SEventIDispatch; + EventSwapVector[DeviceStateNotify] = SEventIDispatch; + EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; + EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; + EventSwapVector[DeviceMappingNotify] = SEventIDispatch; + EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; + EventSwapVector[DeviceEnterNotify] = SEventIDispatch; + EventSwapVector[DeviceLeaveNotify] = SEventIDispatch; + EventSwapVector[PointerKeyboardPairingChangedNotify] = SEventIDispatch; + } else { + FatalError("IExtensionInit: AddExtensions failed\n"); + } } diff --git a/Xi/getbmap.c b/Xi/getbmap.c index 32874764b..5e8cf07fb 100644 --- a/Xi/getbmap.c +++ b/Xi/getbmap.c @@ -74,9 +74,9 @@ SOFTWARE. */ int -SProcXGetDeviceButtonMapping(register ClientPtr client) +SProcXGetDeviceButtonMapping(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceButtonMappingReq); swaps(&stuff->length, n); @@ -90,7 +90,7 @@ SProcXGetDeviceButtonMapping(register ClientPtr client) */ int -ProcXGetDeviceButtonMapping(register ClientPtr client) +ProcXGetDeviceButtonMapping(ClientPtr client) { DeviceIntPtr dev; xGetDeviceButtonMappingReply rep; @@ -136,7 +136,7 @@ void SRepXGetDeviceButtonMapping(ClientPtr client, int size, xGetDeviceButtonMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getdctl.c b/Xi/getdctl.c index d738ef83b..88f061ee0 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceControl(register ClientPtr client) +SProcXGetDeviceControl(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceControlReq); swaps(&stuff->length, n); @@ -88,116 +88,15 @@ SProcXGetDeviceControl(register ClientPtr client) /*********************************************************************** * - * Get the state of the specified device control. - * - */ - -int -ProcXGetDeviceControl(ClientPtr client) -{ - int total_length = 0; - char *buf, *savbuf; - register DeviceIntPtr dev; - xGetDeviceControlReply rep; - - REQUEST(xGetDeviceControlReq); - REQUEST_SIZE_MATCH(xGetDeviceControlReq); - - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice); - return Success; - } - - rep.repType = X_Reply; - rep.RepType = X_GetDeviceControl; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - switch (stuff->control) { - case DEVICE_RESOLUTION: - if (!dev->valuator) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, - BadMatch); - return Success; - } - total_length = sizeof(xDeviceResolutionState) + - (3 * sizeof(int) * dev->valuator->numAxes); - break; - case DEVICE_ABS_CALIB: - if (!dev->absolute) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, - BadMatch); - return Success; - } - - total_length = sizeof(xDeviceAbsCalibCtl); - break; - case DEVICE_ABS_AREA: - if (!dev->absolute) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, - BadMatch); - return Success; - } - - total_length = sizeof(xDeviceAbsAreaCtl); - break; - case DEVICE_CORE: - total_length = sizeof(xDeviceCoreCtl); - break; - case DEVICE_ENABLE: - total_length = sizeof(xDeviceEnableCtl); - break; - default: - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue); - return Success; - } - - buf = (char *)xalloc(total_length); - if (!buf) { - SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc); - return Success; - } - savbuf = buf; - - switch (stuff->control) { - case DEVICE_RESOLUTION: - CopySwapDeviceResolution(client, dev->valuator, buf, total_length); - break; - case DEVICE_ABS_CALIB: - CopySwapDeviceAbsCalib(client, dev->absolute, buf); - break; - case DEVICE_ABS_AREA: - CopySwapDeviceAbsArea(client, dev->absolute, buf); - break; - case DEVICE_CORE: - CopySwapDeviceCore(client, dev, buf); - break; - case DEVICE_ENABLE: - CopySwapDeviceEnable(client, dev, buf); - break; - default: - break; - } - - rep.length = (total_length + 3) >> 2; - WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep); - WriteToClient(client, total_length, savbuf); - xfree(savbuf); - return Success; -} - -/*********************************************************************** - * * This procedure copies DeviceResolution data, swapping if necessary. * */ -void +static void CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, int length) { - register char n; + char n; AxisInfoPtr a; xDeviceResolutionState *r; int i, *iptr; @@ -225,10 +124,10 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf, } } -void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, +static void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, char *buf) { - register char n; + char n; xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf; calib->control = DEVICE_ABS_CALIB; @@ -256,10 +155,10 @@ void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts, } } -void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, +static void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, char *buf) { - register char n; + char n; xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf; area->control = DEVICE_ABS_AREA; @@ -283,9 +182,9 @@ void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts, } } -void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) +static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) { - register char n; + char n; xDeviceCoreState *c = (xDeviceCoreState *) buf; c->control = DEVICE_CORE; @@ -300,9 +199,9 @@ void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) } } -void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) +static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) { - register char n; + char n; xDeviceEnableState *e = (xDeviceEnableState *) buf; e->control = DEVICE_ENABLE; @@ -316,7 +215,6 @@ void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) } } - /*********************************************************************** * * This procedure writes the reply for the xGetDeviceControl function, @@ -327,9 +225,110 @@ void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) void SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); WriteToClient(client, size, (char *)rep); } + +/*********************************************************************** + * + * Get the state of the specified device control. + * + */ + +int +ProcXGetDeviceControl(ClientPtr client) +{ + int total_length = 0; + char *buf, *savbuf; + DeviceIntPtr dev; + xGetDeviceControlReply rep; + + REQUEST(xGetDeviceControlReq); + REQUEST_SIZE_MATCH(xGetDeviceControlReq); + + dev = LookupDeviceIntRec(stuff->deviceid); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice); + return Success; + } + + rep.repType = X_Reply; + rep.RepType = X_GetDeviceControl; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + switch (stuff->control) { + case DEVICE_RESOLUTION: + if (!dev->valuator) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, + BadMatch); + return Success; + } + total_length = sizeof(xDeviceResolutionState) + + (3 * sizeof(int) * dev->valuator->numAxes); + break; + case DEVICE_ABS_CALIB: + if (!dev->absolute) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, + BadMatch); + return Success; + } + + total_length = sizeof(xDeviceAbsCalibCtl); + break; + case DEVICE_ABS_AREA: + if (!dev->absolute) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, + BadMatch); + return Success; + } + + total_length = sizeof(xDeviceAbsAreaCtl); + break; + case DEVICE_CORE: + total_length = sizeof(xDeviceCoreCtl); + break; + case DEVICE_ENABLE: + total_length = sizeof(xDeviceEnableCtl); + break; + default: + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue); + return Success; + } + + buf = (char *)xalloc(total_length); + if (!buf) { + SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc); + return Success; + } + savbuf = buf; + + switch (stuff->control) { + case DEVICE_RESOLUTION: + CopySwapDeviceResolution(client, dev->valuator, buf, total_length); + break; + case DEVICE_ABS_CALIB: + CopySwapDeviceAbsCalib(client, dev->absolute, buf); + break; + case DEVICE_ABS_AREA: + CopySwapDeviceAbsArea(client, dev->absolute, buf); + break; + case DEVICE_CORE: + CopySwapDeviceCore(client, dev, buf); + break; + case DEVICE_ENABLE: + CopySwapDeviceEnable(client, dev, buf); + break; + default: + break; + } + + rep.length = (total_length + 3) >> 2; + WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep); + WriteToClient(client, total_length, savbuf); + xfree(savbuf); + return Success; +} diff --git a/Xi/getdctl.h b/Xi/getdctl.h index 36868d8be..19c189f36 100644 --- a/Xi/getdctl.h +++ b/Xi/getdctl.h @@ -36,30 +36,6 @@ int SProcXGetDeviceControl(ClientPtr /* client */ int ProcXGetDeviceControl(ClientPtr /* client */ ); -void CopySwapDeviceResolution(ClientPtr /* client */ , - ValuatorClassPtr /* v */ , - char * /* buf */ , - int /* length */ - ); - -void CopySwapDeviceAbsCalib (ClientPtr client, - AbsoluteClassPtr dts, - char *buf); - -void CopySwapDeviceAbsArea (ClientPtr client, - AbsoluteClassPtr dts, - char *buf); - -void CopySwapDeviceCore(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - char * /* buf */ - ); - -void CopySwapDeviceEnable(ClientPtr /* client */ , - DeviceIntPtr /* dev */ , - char * /* buf */ - ); - void SRepXGetDeviceControl(ClientPtr /* client */ , int /* size */ , xGetDeviceControlReply * /* rep */ diff --git a/Xi/getfctl.c b/Xi/getfctl.c index 870348fbb..5ca90dbf0 100644 --- a/Xi/getfctl.c +++ b/Xi/getfctl.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetFeedbackControl(register ClientPtr client) +SProcXGetFeedbackControl(ClientPtr client) { - register char n; + char n; REQUEST(xGetFeedbackControlReq); swaps(&stuff->length, n); @@ -86,108 +86,15 @@ SProcXGetFeedbackControl(register ClientPtr client) /*********************************************************************** * - * Get the feedback control state. - * - */ - -int -ProcXGetFeedbackControl(ClientPtr client) -{ - int total_length = 0; - char *buf, *savbuf; - register DeviceIntPtr dev; - KbdFeedbackPtr k; - PtrFeedbackPtr p; - IntegerFeedbackPtr i; - StringFeedbackPtr s; - BellFeedbackPtr b; - LedFeedbackPtr l; - xGetFeedbackControlReply rep; - - REQUEST(xGetFeedbackControlReq); - REQUEST_SIZE_MATCH(xGetFeedbackControlReq); - - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice); - return Success; - } - - rep.repType = X_Reply; - rep.RepType = X_GetFeedbackControl; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.num_feedbacks = 0; - - for (k = dev->kbdfeed; k; k = k->next) { - rep.num_feedbacks++; - total_length += sizeof(xKbdFeedbackState); - } - for (p = dev->ptrfeed; p; p = p->next) { - rep.num_feedbacks++; - total_length += sizeof(xPtrFeedbackState); - } - for (s = dev->stringfeed; s; s = s->next) { - rep.num_feedbacks++; - total_length += sizeof(xStringFeedbackState) + - (s->ctrl.num_symbols_supported * sizeof(KeySym)); - } - for (i = dev->intfeed; i; i = i->next) { - rep.num_feedbacks++; - total_length += sizeof(xIntegerFeedbackState); - } - for (l = dev->leds; l; l = l->next) { - rep.num_feedbacks++; - total_length += sizeof(xLedFeedbackState); - } - for (b = dev->bell; b; b = b->next) { - rep.num_feedbacks++; - total_length += sizeof(xBellFeedbackState); - } - - if (total_length == 0) { - SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch); - return Success; - } - - buf = (char *)xalloc(total_length); - if (!buf) { - SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc); - return Success; - } - savbuf = buf; - - for (k = dev->kbdfeed; k; k = k->next) - CopySwapKbdFeedback(client, k, &buf); - for (p = dev->ptrfeed; p; p = p->next) - CopySwapPtrFeedback(client, p, &buf); - for (s = dev->stringfeed; s; s = s->next) - CopySwapStringFeedback(client, s, &buf); - for (i = dev->intfeed; i; i = i->next) - CopySwapIntegerFeedback(client, i, &buf); - for (l = dev->leds; l; l = l->next) - CopySwapLedFeedback(client, l, &buf); - for (b = dev->bell; b; b = b->next) - CopySwapBellFeedback(client, b, &buf); - - rep.length = (total_length + 3) >> 2; - WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep); - WriteToClient(client, total_length, savbuf); - xfree(savbuf); - return Success; -} - -/*********************************************************************** - * * This procedure copies KbdFeedbackClass data, swapping if necessary. * */ -void +static void CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) { int i; - register char n; + char n; xKbdFeedbackState *k2; k2 = (xKbdFeedbackState *) * buf; @@ -218,10 +125,10 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf) * */ -void +static void CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) { - register char n; + char n; xPtrFeedbackState *p2; p2 = (xPtrFeedbackState *) * buf; @@ -246,10 +153,10 @@ CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf) * */ -void +static void CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf) { - register char n; + char n; xIntegerFeedbackState *i2; i2 = (xIntegerFeedbackState *) * buf; @@ -274,11 +181,11 @@ CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf) * */ -void +static void CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) { int i; - register char n; + char n; xStringFeedbackState *s2; KeySym *kptr; @@ -311,10 +218,10 @@ CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf) * */ -void +static void CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) { - register char n; + char n; xLedFeedbackState *l2; l2 = (xLedFeedbackState *) * buf; @@ -337,10 +244,10 @@ CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf) * */ -void +static void CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf) { - register char n; + char n; xBellFeedbackState *b2; b2 = (xBellFeedbackState *) * buf; @@ -369,10 +276,103 @@ void SRepXGetFeedbackControl(ClientPtr client, int size, xGetFeedbackControlReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); swaps(&rep->num_feedbacks, n); WriteToClient(client, size, (char *)rep); } + +/*********************************************************************** + * + * Get the feedback control state. + * + */ + +int +ProcXGetFeedbackControl(ClientPtr client) +{ + int total_length = 0; + char *buf, *savbuf; + DeviceIntPtr dev; + KbdFeedbackPtr k; + PtrFeedbackPtr p; + IntegerFeedbackPtr i; + StringFeedbackPtr s; + BellFeedbackPtr b; + LedFeedbackPtr l; + xGetFeedbackControlReply rep; + + REQUEST(xGetFeedbackControlReq); + REQUEST_SIZE_MATCH(xGetFeedbackControlReq); + + dev = LookupDeviceIntRec(stuff->deviceid); + if (dev == NULL) { + SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice); + return Success; + } + + rep.repType = X_Reply; + rep.RepType = X_GetFeedbackControl; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.num_feedbacks = 0; + + for (k = dev->kbdfeed; k; k = k->next) { + rep.num_feedbacks++; + total_length += sizeof(xKbdFeedbackState); + } + for (p = dev->ptrfeed; p; p = p->next) { + rep.num_feedbacks++; + total_length += sizeof(xPtrFeedbackState); + } + for (s = dev->stringfeed; s; s = s->next) { + rep.num_feedbacks++; + total_length += sizeof(xStringFeedbackState) + + (s->ctrl.num_symbols_supported * sizeof(KeySym)); + } + for (i = dev->intfeed; i; i = i->next) { + rep.num_feedbacks++; + total_length += sizeof(xIntegerFeedbackState); + } + for (l = dev->leds; l; l = l->next) { + rep.num_feedbacks++; + total_length += sizeof(xLedFeedbackState); + } + for (b = dev->bell; b; b = b->next) { + rep.num_feedbacks++; + total_length += sizeof(xBellFeedbackState); + } + + if (total_length == 0) { + SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch); + return Success; + } + + buf = (char *)xalloc(total_length); + if (!buf) { + SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc); + return Success; + } + savbuf = buf; + + for (k = dev->kbdfeed; k; k = k->next) + CopySwapKbdFeedback(client, k, &buf); + for (p = dev->ptrfeed; p; p = p->next) + CopySwapPtrFeedback(client, p, &buf); + for (s = dev->stringfeed; s; s = s->next) + CopySwapStringFeedback(client, s, &buf); + for (i = dev->intfeed; i; i = i->next) + CopySwapIntegerFeedback(client, i, &buf); + for (l = dev->leds; l; l = l->next) + CopySwapLedFeedback(client, l, &buf); + for (b = dev->bell; b; b = b->next) + CopySwapBellFeedback(client, b, &buf); + + rep.length = (total_length + 3) >> 2; + WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep); + WriteToClient(client, total_length, savbuf); + xfree(savbuf); + return Success; +} diff --git a/Xi/getfctl.h b/Xi/getfctl.h index 7d2d17ab1..0ad58aa2b 100644 --- a/Xi/getfctl.h +++ b/Xi/getfctl.h @@ -36,36 +36,6 @@ int SProcXGetFeedbackControl(ClientPtr /* client */ int ProcXGetFeedbackControl(ClientPtr /* client */ ); -void CopySwapKbdFeedback(ClientPtr /* client */ , - KbdFeedbackPtr /* k */ , - char ** /* buf */ - ); - -void CopySwapPtrFeedback(ClientPtr /* client */ , - PtrFeedbackPtr /* p */ , - char ** /* buf */ - ); - -void CopySwapIntegerFeedback(ClientPtr /* client */ , - IntegerFeedbackPtr /* i */ , - char ** /* buf */ - ); - -void CopySwapStringFeedback(ClientPtr /* client */ , - StringFeedbackPtr /* s */ , - char ** /* buf */ - ); - -void CopySwapLedFeedback(ClientPtr /* client */ , - LedFeedbackPtr /* l */ , - char ** /* buf */ - ); - -void CopySwapBellFeedback(ClientPtr /* client */ , - BellFeedbackPtr /* b */ , - char ** /* buf */ - ); - void SRepXGetFeedbackControl(ClientPtr /* client */ , int /* size */ , xGetFeedbackControlReply * /* rep */ diff --git a/Xi/getfocus.c b/Xi/getfocus.c index 1bcb67321..245b5f1b4 100644 --- a/Xi/getfocus.c +++ b/Xi/getfocus.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceFocus(register ClientPtr client) +SProcXGetDeviceFocus(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceFocusReq); swaps(&stuff->length, n); @@ -138,7 +138,7 @@ ProcXGetDeviceFocus(ClientPtr client) void SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getkmap.c b/Xi/getkmap.c index 041e2c69f..989f3d57d 100644 --- a/Xi/getkmap.c +++ b/Xi/getkmap.c @@ -76,9 +76,9 @@ SOFTWARE. */ int -SProcXGetDeviceKeyMapping(register ClientPtr client) +SProcXGetDeviceKeyMapping(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceKeyMappingReq); swaps(&stuff->length, n); @@ -92,7 +92,7 @@ SProcXGetDeviceKeyMapping(register ClientPtr client) */ int -ProcXGetDeviceKeyMapping(register ClientPtr client) +ProcXGetDeviceKeyMapping(ClientPtr client) { xGetDeviceKeyMappingReply rep; DeviceIntPtr dev; @@ -154,7 +154,7 @@ void SRepXGetDeviceKeyMapping(ClientPtr client, int size, xGetDeviceKeyMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getmmap.c b/Xi/getmmap.c index e664dc910..038937ef7 100644 --- a/Xi/getmmap.c +++ b/Xi/getmmap.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceModifierMapping(register ClientPtr client) +SProcXGetDeviceModifierMapping(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceModifierMappingReq); swaps(&stuff->length, n); @@ -141,7 +141,7 @@ void SRepXGetDeviceModifierMapping(ClientPtr client, int size, xGetDeviceModifierMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getprop.c b/Xi/getprop.c index 058c59514..6fa1986f4 100644 --- a/Xi/getprop.c +++ b/Xi/getprop.c @@ -79,9 +79,9 @@ extern int ExtEventIndex; */ int -SProcXGetDeviceDontPropagateList(register ClientPtr client) +SProcXGetDeviceDontPropagateList(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceDontPropagateListReq); swaps(&stuff->length, n); @@ -97,7 +97,7 @@ SProcXGetDeviceDontPropagateList(register ClientPtr client) */ int -ProcXGetDeviceDontPropagateList(register ClientPtr client) +ProcXGetDeviceDontPropagateList(ClientPtr client) { CARD16 count = 0; int i, rc; @@ -187,7 +187,7 @@ void SRepXGetDeviceDontPropagateList(ClientPtr client, int size, xGetDeviceDontPropagateListReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getselev.c b/Xi/getselev.c index 533c66cd7..9c5f2191c 100644 --- a/Xi/getselev.c +++ b/Xi/getselev.c @@ -77,9 +77,9 @@ SOFTWARE. */ int -SProcXGetSelectedExtensionEvents(register ClientPtr client) +SProcXGetSelectedExtensionEvents(ClientPtr client) { - register char n; + char n; REQUEST(xGetSelectedExtensionEventsReq); swaps(&stuff->length, n); @@ -96,7 +96,7 @@ SProcXGetSelectedExtensionEvents(register ClientPtr client) */ int -ProcXGetSelectedExtensionEvents(register ClientPtr client) +ProcXGetSelectedExtensionEvents(ClientPtr client) { int i, rc, total_length = 0; xGetSelectedExtensionEventsReply rep; @@ -177,7 +177,7 @@ void SRepXGetSelectedExtensionEvents(ClientPtr client, int size, xGetSelectedExtensionEventsReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/getvers.c b/Xi/getvers.c index c5f1750be..b3f4c1c67 100644 --- a/Xi/getvers.c +++ b/Xi/getvers.c @@ -76,9 +76,9 @@ XExtensionVersion AllExtensionVersions[128]; */ int -SProcXGetExtensionVersion(register ClientPtr client) +SProcXGetExtensionVersion(ClientPtr client) { - register char n; + char n; REQUEST(xGetExtensionVersionReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ SProcXGetExtensionVersion(register ClientPtr client) */ int -ProcXGetExtensionVersion(register ClientPtr client) +ProcXGetExtensionVersion(ClientPtr client) { xGetExtensionVersionReply rep; @@ -136,7 +136,7 @@ void SRepXGetExtensionVersion(ClientPtr client, int size, xGetExtensionVersionReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/grabacc.c b/Xi/grabacc.c index db9c9f2ca..59888ee15 100644 --- a/Xi/grabacc.c +++ b/Xi/grabacc.c @@ -93,7 +93,7 @@ void SRepXGrabAccessControl(ClientPtr client, int size, xGrabAccessControlReply* rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/grabdev.c b/Xi/grabdev.c index 3af2346e3..e2809efb1 100644 --- a/Xi/grabdev.c +++ b/Xi/grabdev.c @@ -79,11 +79,11 @@ extern int ExtEventIndex; */ int -SProcXGrabDevice(register ClientPtr client) +SProcXGrabDevice(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xGrabDeviceReq); swaps(&stuff->length, n); @@ -202,7 +202,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count, void SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c index d79a36c8d..0b8a978e7 100644 --- a/Xi/grabdevb.c +++ b/Xi/grabdevb.c @@ -77,11 +77,11 @@ SOFTWARE. */ int -SProcXGrabDeviceButton(register ClientPtr client) +SProcXGrabDeviceButton(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xGrabDeviceButtonReq); swaps(&stuff->length, n); diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c index 1120149d3..297072b6f 100644 --- a/Xi/grabdevk.c +++ b/Xi/grabdevk.c @@ -77,11 +77,11 @@ SOFTWARE. */ int -SProcXGrabDeviceKey(register ClientPtr client) +SProcXGrabDeviceKey(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xGrabDeviceKeyReq); swaps(&stuff->length, n); diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c index 435ab0bfd..cfc7f89f3 100644 --- a/Xi/gtmotion.c +++ b/Xi/gtmotion.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXGetDeviceMotionEvents(register ClientPtr client) +SProcXGetDeviceMotionEvents(ClientPtr client) { - register char n; + char n; REQUEST(xGetDeviceMotionEventsReq); swaps(&stuff->length, n); @@ -162,7 +162,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client) WriteReplyToClient(client, sizeof(xGetDeviceMotionEventsReply), &rep); if (nEvents) { if (client->swapped) { - register char n; + char n; bufptr = coords; for (i = 0; i < nEvents * (axes + 1); i++) { @@ -188,7 +188,7 @@ void SRepXGetDeviceMotionEvents(ClientPtr client, int size, xGetDeviceMotionEventsReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/listdev.c b/Xi/listdev.c index 33266ae4c..a9fd40156 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -77,9 +77,9 @@ SOFTWARE. */ int -SProcXListInputDevices(register ClientPtr client) +SProcXListInputDevices(ClientPtr client) { - register char n; + char n; REQUEST(xListInputDevicesReq); swaps(&stuff->length, n); @@ -88,80 +88,12 @@ SProcXListInputDevices(register ClientPtr client) /*********************************************************************** * - * This procedure lists the input devices available to the server. - * - */ - -int -ProcXListInputDevices(register ClientPtr client) -{ - xListInputDevicesReply rep; - int numdevs = 0; - int namesize = 1; /* need 1 extra byte for strcpy */ - int size = 0; - int total_length; - char *devbuf; - char *classbuf; - char *namebuf; - char *savbuf; - xDeviceInfo *dev; - DeviceIntPtr d; - - REQUEST_SIZE_MATCH(xListInputDevicesReq); - - rep.repType = X_Reply; - rep.RepType = X_ListInputDevices; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - AddOtherInputDevices(); - - SizeDeviceInfo(inputInfo.keyboard, &namesize, &size); - SizeDeviceInfo(inputInfo.pointer, &namesize, &size); - numdevs = 2; - - for (d = inputInfo.devices; d; d = d->next) { - SizeDeviceInfo(d, &namesize, &size); - numdevs++; - } - for (d = inputInfo.off_devices; d; d = d->next) { - SizeDeviceInfo(d, &namesize, &size); - numdevs++; - } - - total_length = numdevs * sizeof(xDeviceInfo) + size + namesize; - devbuf = (char *)xalloc(total_length); - classbuf = devbuf + (numdevs * sizeof(xDeviceInfo)); - namebuf = classbuf + size; - savbuf = devbuf; - - dev = (xDeviceInfoPtr) devbuf; - ListDeviceInfo(client, inputInfo.keyboard, dev++, - &devbuf, &classbuf, &namebuf); - ListDeviceInfo(client, inputInfo.pointer, dev++, - &devbuf, &classbuf, &namebuf); - - for (d = inputInfo.devices; d; d = d->next, dev++) - ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); - for (d = inputInfo.off_devices; d; d = d->next, dev++) - ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); - - rep.ndevices = numdevs; - rep.length = (total_length + 3) >> 2; - WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep); - WriteToClient(client, total_length, savbuf); - xfree(savbuf); - return Success; -} - -/*********************************************************************** - * * This procedure calculates the size of the information to be returned * for an input device. * */ -void +static void SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) { int chunks; @@ -182,32 +114,6 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size) /*********************************************************************** * - * This procedure lists information to be returned for an input device. - * - */ - -void -ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, - char **devbuf, char **classbuf, char **namebuf) -{ - CopyDeviceName(namebuf, d->name); - CopySwapDevice(client, d, 0, devbuf); - if (d->key != NULL) { - CopySwapKeyClass(client, d->key, classbuf); - dev->num_classes++; - } - if (d->button != NULL) { - CopySwapButtonClass(client, d->button, classbuf); - dev->num_classes++; - } - if (d->valuator != NULL) { - dev->num_classes += - CopySwapValuatorClass(client, d->valuator, classbuf); - } -} - -/*********************************************************************** - * * This procedure copies data to the DeviceInfo struct, swapping if necessary. * * We need the extra byte in the allocated buffer, because the trailing null @@ -216,7 +122,7 @@ ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, * */ -void +static void CopyDeviceName(char **namebuf, char *name) { char *nameptr = (char *)*namebuf; @@ -233,15 +139,37 @@ CopyDeviceName(char **namebuf, char *name) /*********************************************************************** * + * This procedure copies ButtonClass information, swapping if necessary. + * + */ + +static void +CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf) +{ + char n; + xButtonInfoPtr b2; + + b2 = (xButtonInfoPtr) * buf; + b2->class = ButtonClass; + b2->length = sizeof(xButtonInfo); + b2->num_buttons = b->numButtons; + if (client->swapped) { + swaps(&b2->num_buttons, n); /* macro - braces are required */ + } + *buf += sizeof(xButtonInfo); +} + +/*********************************************************************** + * * This procedure copies data to the DeviceInfo struct, swapping if necessary. * */ -void -CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, +static void +CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf) { - register char n; + char n; xDeviceInfoPtr dev; dev = (xDeviceInfoPtr) * buf; @@ -271,10 +199,10 @@ CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes, * */ -void -CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) +static void +CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf) { - register char n; + char n; xKeyInfoPtr k2; k2 = (xKeyInfoPtr) * buf; @@ -291,28 +219,6 @@ CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf) /*********************************************************************** * - * This procedure copies ButtonClass information, swapping if necessary. - * - */ - -void -CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) -{ - register char n; - xButtonInfoPtr b2; - - b2 = (xButtonInfoPtr) * buf; - b2->class = ButtonClass; - b2->length = sizeof(xButtonInfo); - b2->num_buttons = b->numButtons; - if (client->swapped) { - swaps(&b2->num_buttons, n); /* macro - braces are required */ - } - *buf += sizeof(xButtonInfo); -} - -/*********************************************************************** - * * This procedure copies ValuatorClass information, swapping if necessary. * * Devices may have up to 255 valuators. The length of a ValuatorClass is @@ -323,11 +229,11 @@ CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf) * */ -int -CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) +static int +CopySwapValuatorClass(ClientPtr client, ValuatorClassPtr v, char **buf) { int i, j, axes, t_axes; - register char n; + char n; xValuatorInfoPtr v2; AxisInfo *a; xAxisInfoPtr a2; @@ -368,6 +274,100 @@ CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) /*********************************************************************** * + * This procedure lists information to be returned for an input device. + * + */ + +static void +ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev, + char **devbuf, char **classbuf, char **namebuf) +{ + CopyDeviceName(namebuf, d->name); + CopySwapDevice(client, d, 0, devbuf); + if (d->key != NULL) { + CopySwapKeyClass(client, d->key, classbuf); + dev->num_classes++; + } + if (d->button != NULL) { + CopySwapButtonClass(client, d->button, classbuf); + dev->num_classes++; + } + if (d->valuator != NULL) { + dev->num_classes += + CopySwapValuatorClass(client, d->valuator, classbuf); + } +} + +/*********************************************************************** + * + * This procedure lists the input devices available to the server. + * + */ + +int +ProcXListInputDevices(ClientPtr client) +{ + xListInputDevicesReply rep; + int numdevs = 0; + int namesize = 1; /* need 1 extra byte for strcpy */ + int size = 0; + int total_length; + char *devbuf; + char *classbuf; + char *namebuf; + char *savbuf; + xDeviceInfo *dev; + DeviceIntPtr d; + + REQUEST_SIZE_MATCH(xListInputDevicesReq); + + rep.repType = X_Reply; + rep.RepType = X_ListInputDevices; + rep.length = 0; + rep.sequenceNumber = client->sequence; + + AddOtherInputDevices(); + + SizeDeviceInfo(inputInfo.keyboard, &namesize, &size); + SizeDeviceInfo(inputInfo.pointer, &namesize, &size); + numdevs = 2; + + for (d = inputInfo.devices; d; d = d->next) { + SizeDeviceInfo(d, &namesize, &size); + numdevs++; + } + for (d = inputInfo.off_devices; d; d = d->next) { + SizeDeviceInfo(d, &namesize, &size); + numdevs++; + } + + total_length = numdevs * sizeof(xDeviceInfo) + size + namesize; + devbuf = (char *)xalloc(total_length); + classbuf = devbuf + (numdevs * sizeof(xDeviceInfo)); + namebuf = classbuf + size; + savbuf = devbuf; + + dev = (xDeviceInfoPtr) devbuf; + ListDeviceInfo(client, inputInfo.keyboard, dev++, + &devbuf, &classbuf, &namebuf); + ListDeviceInfo(client, inputInfo.pointer, dev++, + &devbuf, &classbuf, &namebuf); + + for (d = inputInfo.devices; d; d = d->next, dev++) + ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); + for (d = inputInfo.off_devices; d; d = d->next, dev++) + ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf); + + rep.ndevices = numdevs; + rep.length = (total_length + 3) >> 2; + WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep); + WriteToClient(client, total_length, savbuf); + xfree(savbuf); + return Success; +} + +/*********************************************************************** + * * This procedure writes the reply for the XListInputDevices function, * if the client and server have a different byte ordering. * @@ -376,7 +376,7 @@ CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf) void SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/listdev.h b/Xi/listdev.h index bdd67ce70..db376decf 100644 --- a/Xi/listdev.h +++ b/Xi/listdev.h @@ -36,44 +36,6 @@ int SProcXListInputDevices(ClientPtr /* client */ int ProcXListInputDevices(ClientPtr /* client */ ); -void SizeDeviceInfo(DeviceIntPtr /* d */ , - int * /* namesize */ , - int * /* size */ - ); - -void ListDeviceInfo(ClientPtr /* client */ , - DeviceIntPtr /* d */ , - xDeviceInfoPtr /* dev */ , - char ** /* devbuf */ , - char ** /* classbuf */ , - char ** /* namebuf */ - ); - -void CopyDeviceName(char ** /* namebuf */ , - char * /* name */ - ); - -void CopySwapDevice(ClientPtr /* client */ , - DeviceIntPtr /* d */ , - int /* num_classes */ , - char ** /* buf */ - ); - -void CopySwapKeyClass(ClientPtr /* client */ , - KeyClassPtr /* k */ , - char ** /* buf */ - ); - -void CopySwapButtonClass(ClientPtr /* client */ , - ButtonClassPtr /* b */ , - char ** /* buf */ - ); - -int CopySwapValuatorClass(ClientPtr /* client */ , - ValuatorClassPtr /* v */ , - char ** /* buf */ - ); - void SRepXListInputDevices(ClientPtr /* client */ , int /* size */ , xListInputDevicesReply * /* rep */ diff --git a/Xi/opendev.c b/Xi/opendev.c index 636106815..4b7b6a64f 100644 --- a/Xi/opendev.c +++ b/Xi/opendev.c @@ -79,9 +79,9 @@ extern CARD8 event_base[]; */ int -SProcXOpenDevice(register ClientPtr client) +SProcXOpenDevice(ClientPtr client) { - register char n; + char n; REQUEST(xOpenDeviceReq); swaps(&stuff->length, n); @@ -95,7 +95,7 @@ SProcXOpenDevice(register ClientPtr client) */ int -ProcXOpenDevice(register ClientPtr client) +ProcXOpenDevice(ClientPtr client) { xInputClassInfo evbase[numInputClasses]; Bool enableit = FALSE; @@ -179,7 +179,7 @@ ProcXOpenDevice(register ClientPtr client) void SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/querydp.c b/Xi/querydp.c index af93fed2f..d2ed0b80a 100644 --- a/Xi/querydp.c +++ b/Xi/querydp.c @@ -62,9 +62,9 @@ from the author. */ int -SProcXQueryDevicePointer(register ClientPtr client) +SProcXQueryDevicePointer(ClientPtr client) { - register char n; + char n; REQUEST(xQueryDevicePointerReq); swaps(&stuff->length, n); @@ -72,7 +72,7 @@ SProcXQueryDevicePointer(register ClientPtr client) } int -ProcXQueryDevicePointer(register ClientPtr client) +ProcXQueryDevicePointer(ClientPtr client) { int rc; xQueryDevicePointerReply rep; @@ -158,7 +158,7 @@ void SRepXQueryDevicePointer(ClientPtr client, int size, xQueryDevicePointerReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/queryst.c b/Xi/queryst.c index c4cc5a2e6..972cd2c80 100644 --- a/Xi/queryst.c +++ b/Xi/queryst.c @@ -58,9 +58,9 @@ from The Open Group. */ int -SProcXQueryDeviceState(register ClientPtr client) +SProcXQueryDeviceState(ClientPtr client) { - register char n; + char n; REQUEST(xQueryDeviceStateReq); swaps(&stuff->length, n); @@ -74,9 +74,9 @@ SProcXQueryDeviceState(register ClientPtr client) */ int -ProcXQueryDeviceState(register ClientPtr client) +ProcXQueryDeviceState(ClientPtr client) { - register char n; + char n; int i; int num_classes = 0; int total_length = 0; @@ -187,7 +187,7 @@ ProcXQueryDeviceState(register ClientPtr client) void SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/selectev.c b/Xi/selectev.c index 8c893ca1e..d52db1b81 100644 --- a/Xi/selectev.c +++ b/Xi/selectev.c @@ -128,11 +128,11 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win, */ int -SProcXSelectExtensionEvent(register ClientPtr client) +SProcXSelectExtensionEvent(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; REQUEST(xSelectExtensionEventReq); swaps(&stuff->length, n); @@ -154,7 +154,7 @@ SProcXSelectExtensionEvent(register ClientPtr client) */ int -ProcXSelectExtensionEvent(register ClientPtr client) +ProcXSelectExtensionEvent(ClientPtr client) { int ret; int i; diff --git a/Xi/sendexev.c b/Xi/sendexev.c index c2763bb22..eac9abe14 100644 --- a/Xi/sendexev.c +++ b/Xi/sendexev.c @@ -80,11 +80,11 @@ extern int lastEvent; /* Defined in extension.c */ */ int -SProcXSendExtensionEvent(register ClientPtr client) +SProcXSendExtensionEvent(ClientPtr client) { - register char n; - register long *p; - register int i; + char n; + long *p; + int i; xEvent eventT; xEvent *eventP; EventSwapPtr proc; @@ -119,7 +119,7 @@ SProcXSendExtensionEvent(register ClientPtr client) */ int -ProcXSendExtensionEvent(register ClientPtr client) +ProcXSendExtensionEvent(ClientPtr client) { int ret; DeviceIntPtr dev; diff --git a/Xi/setbmap.c b/Xi/setbmap.c index 14b1689f5..bdfa513dd 100644 --- a/Xi/setbmap.c +++ b/Xi/setbmap.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXSetDeviceButtonMapping(register ClientPtr client) +SProcXSetDeviceButtonMapping(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceButtonMappingReq); swaps(&stuff->length, n); @@ -94,7 +94,7 @@ SProcXSetDeviceButtonMapping(register ClientPtr client) */ int -ProcXSetDeviceButtonMapping(register ClientPtr client) +ProcXSetDeviceButtonMapping(ClientPtr client) { int ret; xSetDeviceButtonMappingReply rep; @@ -149,7 +149,7 @@ void SRepXSetDeviceButtonMapping(ClientPtr client, int size, xSetDeviceButtonMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/setdval.c b/Xi/setdval.c index ce9b02d2f..61b98c790 100644 --- a/Xi/setdval.c +++ b/Xi/setdval.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXSetDeviceValuators(register ClientPtr client) +SProcXSetDeviceValuators(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceValuatorsReq); swaps(&stuff->length, n); @@ -91,7 +91,7 @@ SProcXSetDeviceValuators(register ClientPtr client) */ int -ProcXSetDeviceValuators(register ClientPtr client) +ProcXSetDeviceValuators(ClientPtr client) { DeviceIntPtr dev; xSetDeviceValuatorsReply rep; @@ -152,7 +152,7 @@ void SRepXSetDeviceValuators(ClientPtr client, int size, xSetDeviceValuatorsReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/setfocus.c b/Xi/setfocus.c index 59fe0768c..aaf88ce6f 100644 --- a/Xi/setfocus.c +++ b/Xi/setfocus.c @@ -78,9 +78,9 @@ SOFTWARE. */ int -SProcXSetDeviceFocus(register ClientPtr client) +SProcXSetDeviceFocus(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceFocusReq); swaps(&stuff->length, n); @@ -97,10 +97,10 @@ SProcXSetDeviceFocus(register ClientPtr client) */ int -ProcXSetDeviceFocus(register ClientPtr client) +ProcXSetDeviceFocus(ClientPtr client) { int ret; - register DeviceIntPtr dev; + DeviceIntPtr dev; REQUEST(xSetDeviceFocusReq); REQUEST_SIZE_MATCH(xSetDeviceFocusReq); diff --git a/Xi/setmmap.c b/Xi/setmmap.c index 645f246bd..00784995a 100644 --- a/Xi/setmmap.c +++ b/Xi/setmmap.c @@ -76,9 +76,9 @@ SOFTWARE. */ int -SProcXSetDeviceModifierMapping(register ClientPtr client) +SProcXSetDeviceModifierMapping(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceModifierMappingReq); swaps(&stuff->length, n); @@ -145,7 +145,7 @@ void SRepXSetDeviceModifierMapping(ClientPtr client, int size, xSetDeviceModifierMappingReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/setmode.c b/Xi/setmode.c index ff5a3bcfc..00d340055 100644 --- a/Xi/setmode.c +++ b/Xi/setmode.c @@ -75,9 +75,9 @@ SOFTWARE. */ int -SProcXSetDeviceMode(register ClientPtr client) +SProcXSetDeviceMode(ClientPtr client) { - register char n; + char n; REQUEST(xSetDeviceModeReq); swaps(&stuff->length, n); @@ -91,7 +91,7 @@ SProcXSetDeviceMode(register ClientPtr client) */ int -ProcXSetDeviceMode(register ClientPtr client) +ProcXSetDeviceMode(ClientPtr client) { DeviceIntPtr dev; xSetDeviceModeReply rep; @@ -139,7 +139,7 @@ ProcXSetDeviceMode(register ClientPtr client) void SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep) { - register char n; + char n; swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); diff --git a/Xi/stubs.c b/Xi/stubs.c index e2ed1ceff..ed041b815 100644 --- a/Xi/stubs.c +++ b/Xi/stubs.c @@ -168,7 +168,7 @@ OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) */ int -SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode) +SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) { return BadMatch; } @@ -186,7 +186,7 @@ SetDeviceMode(register ClientPtr client, DeviceIntPtr dev, int mode) */ int -SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev, +SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, int *valuators, int first_valuator, int num_valuators) { return BadMatch; @@ -201,7 +201,7 @@ SetDeviceValuators(register ClientPtr client, DeviceIntPtr dev, */ int -ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev, +ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control) { switch (control->control) { diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c index a028a228f..b2b71694d 100644 --- a/Xi/ungrdev.c +++ b/Xi/ungrdev.c @@ -74,9 +74,9 @@ SOFTWARE. */ int -SProcXUngrabDevice(register ClientPtr client) +SProcXUngrabDevice(ClientPtr client) { - register char n; + char n; REQUEST(xUngrabDeviceReq); swaps(&stuff->length, n); @@ -92,7 +92,7 @@ SProcXUngrabDevice(register ClientPtr client) */ int -ProcXUngrabDevice(register ClientPtr client) +ProcXUngrabDevice(ClientPtr client) { DeviceIntPtr dev; GrabPtr grab; diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c index b75916f42..5e0a66328 100644 --- a/Xi/ungrdevb.c +++ b/Xi/ungrdevb.c @@ -80,9 +80,9 @@ SOFTWARE. */ int -SProcXUngrabDeviceButton(register ClientPtr client) +SProcXUngrabDeviceButton(ClientPtr client) { - register char n; + char n; REQUEST(xUngrabDeviceButtonReq); swaps(&stuff->length, n); diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c index e8c006ae6..7b06d6e09 100644 --- a/Xi/ungrdevk.c +++ b/Xi/ungrdevk.c @@ -80,9 +80,9 @@ SOFTWARE. */ int -SProcXUngrabDeviceKey(register ClientPtr client) +SProcXUngrabDeviceKey(ClientPtr client) { - register char n; + char n; REQUEST(xUngrabDeviceKeyReq); swaps(&stuff->length, n); diff --git a/Xi/warpdevp.c b/Xi/warpdevp.c index 8df7e14db..82d71d524 100644 --- a/Xi/warpdevp.c +++ b/Xi/warpdevp.c @@ -59,9 +59,9 @@ from the author. */ int -SProcXWarpDevicePointer(register ClientPtr client) +SProcXWarpDevicePointer(ClientPtr client) { - register char n; + char n; REQUEST(xWarpDevicePointerReq); swaps(&stuff->length, n); @@ -69,7 +69,7 @@ SProcXWarpDevicePointer(register ClientPtr client) } int -ProcXWarpDevicePointer(register ClientPtr client) +ProcXWarpDevicePointer(ClientPtr client) { int err; int x, y; @@ -78,27 +78,6 @@ extern void afbDoBitblt( unsigned long /*planemask*/ ); -extern RegionPtr afbBitBlt( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - GCPtr /*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/, - void (*doBitBlt)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ - ), - unsigned long /*planemask*/ -); - extern RegionPtr afbCopyArea( DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, @@ -111,27 +90,6 @@ extern RegionPtr afbCopyArea( int /*dsty*/ ); -extern RegionPtr afbCopyPlane( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - GCPtr/*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/, - unsigned long /*plane*/ -); - -extern void afbCopy1ToN( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ -); /* afbbltC.c */ extern void afbDoBitbltCopy( @@ -273,23 +231,6 @@ extern Bool afbInitializeColormap( ColormapPtr /*pmap*/ ); -extern int afbExpandDirectColors( - ColormapPtr /*pmap*/, - int /*ndefs*/, - xColorItem * /*indefs*/, - xColorItem * /*outdefs*/ -); - -extern Bool afbCreateDefColormap( - ScreenPtr /*pScreen*/ -); - -extern Bool afbSetVisualTypes( - int /*depth*/, - int /*visuals*/, - int /*bitsPerRGB*/ -); - extern Bool afbInitVisuals( VisualPtr * /*visualp*/, DepthPtr * /*depthp*/, @@ -410,16 +351,6 @@ extern Bool afbCreateGC( GCPtr /*pGC*/ ); -extern void afbValidateGC( - GCPtr /*pGC*/, - unsigned long /*changes*/, - DrawablePtr /*pDrawable*/ -); - -extern void afbDestroyGC( - GCPtr /*pGC*/ -); - extern void afbReduceRop( int /*alu*/, Pixel /*src*/, @@ -428,19 +359,6 @@ extern void afbReduceRop( unsigned char * /*rrops*/ ); -extern void afbReduceOpaqueStipple ( - Pixel /*fg*/, - Pixel /*bg*/, - unsigned long /*planemask*/, - int /*depth*/, - unsigned char * /*rrops*/ -); - -extern void afbComputeCompositeClip( - GCPtr /*pGC*/, - DrawablePtr /*pDrawable*/ -); - /* afbgetsp.c */ extern void afbGetSpans( @@ -588,14 +506,6 @@ extern Bool afbDestroyPixmap( PixmapPtr /*pPixmap*/ ); -extern PixmapPtr afbCopyPixmap( - PixmapPtr /*pSrc*/ -); - -extern void afbPadPixmap( - PixmapPtr /*pPixmap*/ -); - extern void afbXRotatePixmap( PixmapPtr /*pPix*/, int /*rw*/ @@ -637,20 +547,9 @@ extern void afbPushPixels( int /*xOrg*/, int /*yOrg*/ ); -/* afbscrclse.c */ -extern Bool afbCloseScreen( - int /*index*/, - ScreenPtr /*pScreen*/ -); /* afbscrinit.c */ -extern Bool afbAllocatePrivates( - ScreenPtr /*pScreen*/, - int * /*pWinIndex*/, - int * /*pGCIndex*/ -); - extern Bool afbScreenInit( ScreenPtr /*pScreen*/, pointer /*pbits*/, @@ -661,15 +560,6 @@ extern Bool afbScreenInit( int /*width*/ ); -extern PixmapPtr afbGetWindowPixmap( - WindowPtr /*pWin*/ -); - -extern void afbSetWindowPixmap( - WindowPtr /*pWin*/, - PixmapPtr /*pPix*/ -); - /* afbseg.c */ extern void afbSegmentSS( @@ -687,20 +577,6 @@ extern void afbSegmentSD( ); /* afbsetsp.c */ -extern void afbSetScanline( - int /*y*/, - int /*xOrigin*/, - int /*xStart*/, - int /*xEnd*/, - PixelType * /*psrc*/, - int /*alu*/, - PixelType * /*pdstBase*/, - int /*widthDst*/, - int /*sizeDst*/, - int /*depthDst*/, - int /*sizeSrc*/ -); - extern void afbSetSpans( DrawablePtr /*pDrawable*/, GCPtr /*pGC*/, diff --git a/afb/afbbitblt.c b/afb/afbbitblt.c index 594e987a8..2e416e356 100644 --- a/afb/afbbitblt.c +++ b/afb/afbbitblt.c @@ -67,9 +67,6 @@ SOFTWARE. #include "afb.h" #include "maskbits.h" - -static unsigned char afbRropsOS[AFB_MAX_DEPTH]; - /* CopyArea and CopyPlane for a monchrome frame buffer @@ -126,34 +123,7 @@ afbDoBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXP typedef void (*afb_blit_func) (DrawablePtr, DrawablePtr, int, RegionPtr, DDXPointPtr, unsigned long); -RegionPtr -afbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - afb_blit_func doBitBlt; - - switch (pGC->alu) { - case GXcopy: - doBitBlt = afbDoBitbltCopy; - break; - case GXxor: - doBitBlt = afbDoBitbltXor; - break; - case GXcopyInverted: - doBitBlt = afbDoBitbltCopyInverted; - break; - case GXor: - doBitBlt = afbDoBitbltOr; - break; - default: - doBitBlt = afbDoBitbltGeneral; - break; - } - - return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, - width, height, dstx, dsty, doBitBlt, pGC->planemask)); -} - -RegionPtr +static RegionPtr afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, afb_blit_func doBitBlt, long unsigned int planemask) { RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ @@ -346,102 +316,28 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, } RegionPtr -afbCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, long unsigned int plane) +afbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { - int alu; - RegionPtr prgnExposed = NULL; - unsigned long old_planemask; - - if (pDstDrawable->depth == 1) { - old_planemask = pGC->planemask; - pGC->planemask = plane; - if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0) { - prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty); - } else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) { - unsigned char rop; - - afbReduceRop(pGC->alu, pGC->fgPixel, 1, 1, &rop); - alu = pGC->alu; - pGC->alu = rop; - prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, - dsty); - pGC->alu = alu; - } else { /* need to invert the src */ - alu = pGC->alu; - pGC->alu = afbInverseAlu[alu]; - prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, - dsty); - pGC->alu = alu; - } - pGC->planemask = old_planemask; - } else { - int free_pixmap = FALSE; - PixmapPtr pBitmap = (PixmapPtr)pSrcDrawable; - ScreenPtr pScreen = pSrcDrawable->pScreen; - GCPtr pGC1 = NULL; - - if (pSrcDrawable == pDstDrawable || - pSrcDrawable->type == DRAWABLE_WINDOW || pSrcDrawable->depth != 1) { - /* Copy a plane from source drawable to a tmp 1-bit deep pixmap */ - /* XXX: Range check width and height */ - pBitmap = (*pScreen->CreatePixmap)(pScreen, width, height, 1); - - if (!pBitmap) - return(NULL); - pGC1 = GetScratchGC(1, pScreen); - if (!pGC1) { - (*pScreen->DestroyPixmap)(pBitmap); - return(NULL); - } - ValidateGC((DrawablePtr)pBitmap, pGC1); - (void)afbBitBlt(pSrcDrawable, (DrawablePtr)pBitmap, pGC1, srcx, srcy, - width, height, 0, 0, afbDoBitbltCopy, plane); - free_pixmap = TRUE; - } -#if 0 - else { - /* XXX: could cope with N-deep pixmap source case without using tmp - * src bitmap by setting up a scratch pixmap header and fiddle - * around with the pbits pointer. - */ - } -#endif - afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask, - pGC->depth, afbRropsOS); - (void)afbBitBlt((DrawablePtr)pBitmap, pDstDrawable, pGC, 0, 0, width, - height, dstx, dsty, afbCopy1ToN, pGC->planemask); - if (free_pixmap) { - (*pScreen->DestroyPixmap)(pBitmap); - FreeScratchGC(pGC1); - } + afb_blit_func doBitBlt; - if (pGC->fExpose) - prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, - srcy, width, height, dstx, dsty, - plane); + switch (pGC->alu) { + case GXcopy: + doBitBlt = afbDoBitbltCopy; + break; + case GXxor: + doBitBlt = afbDoBitbltXor; + break; + case GXcopyInverted: + doBitBlt = afbDoBitbltCopyInverted; + break; + case GXor: + doBitBlt = afbDoBitbltOr; + break; + default: + doBitBlt = afbDoBitbltGeneral; + break; } - return prgnExposed; -} -void -afbCopy1ToN(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, long unsigned int planemask) -{ - int numRects = REGION_NUM_RECTS(prgnDst); - BoxPtr pbox = REGION_RECTS(prgnDst); - int r; - - for (r = 0; r < numRects; r++, pbox++, pptSrc++) { - int dx = pptSrc->x; - int dy = pptSrc->y; - - if (alu == GXcopy) - afbOpaqueStippleAreaCopy(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx, dy, - afbRropsOS, planemask); - else - afbOpaqueStippleAreaGeneral(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx, - dy, afbRropsOS, planemask); - } + return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, + width, height, dstx, dsty, doBitBlt, pGC->planemask)); } diff --git a/afb/afbcmap.c b/afb/afbcmap.c index e3b95fbec..9608a3653 100644 --- a/afb/afbcmap.c +++ b/afb/afbcmap.c @@ -70,24 +70,6 @@ afbInitializeColormap(register ColormapPtr pmap) return miInitializeColormap(pmap); } -int -afbExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs) -{ - return miExpandDirectColors(pmap, ndef, indefs, outdefs); -} - -Bool -afbCreateDefColormap(ScreenPtr pScreen) -{ - return miCreateDefColormap(pScreen); -} - -Bool -afbSetVisualTypes(int depth, int visuals, int bitsPerRGB) -{ - return miSetVisualTypes(depth, visuals, bitsPerRGB, -1); -} - /* * Given a list of formats for a screen, create a list * of visuals and depths for the screen which correspond to diff --git a/afb/afbgc.c b/afb/afbgc.c index 03475dda5..59c09e097 100644 --- a/afb/afbgc.c +++ b/afb/afbgc.c @@ -69,6 +69,9 @@ SOFTWARE. #include "maskbits.h" +static void afbDestroyGC(GCPtr); +static void afbValidateGC(GCPtr, unsigned long, DrawablePtr); + static GCFuncs afbFuncs = { afbValidateGC, miChangeGC, @@ -102,6 +105,33 @@ static GCOps afbGCOps = { afbPushPixels }; +static void +afbReduceOpaqueStipple(PixelType fg, PixelType bg, unsigned long planemask, + int depth, unsigned char *rop) +{ + register int d; + register Pixel mask = 1; + + bg ^= fg; + + for (d = 0; d < depth; d++, mask <<= 1) { + if (!(planemask & mask)) + rop[d] = RROP_NOP; + else if (!(bg & mask)) { + /* Both fg and bg have a 0 or 1 in this plane */ + if (fg & mask) + rop[d] = RROP_WHITE; + else + rop[d] = RROP_BLACK; + } else { + /* Both fg and bg have different bits on this plane */ + if (fg & mask) + rop[d] = RROP_COPY; + else + rop[d] = RROP_INVERT; + } + } +} Bool afbCreateGC(pGC) @@ -136,6 +166,95 @@ afbCreateGC(pGC) return TRUE; } +static void +afbComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable) +{ + if (pDrawable->type == DRAWABLE_WINDOW) { + WindowPtr pWin = (WindowPtr) pDrawable; + RegionPtr pregWin; + Bool freeTmpClip, freeCompClip; + + if (pGC->subWindowMode == IncludeInferiors) { + pregWin = NotClippedByChildren(pWin); + freeTmpClip = TRUE; + } else { + pregWin = &pWin->clipList; + freeTmpClip = FALSE; + } + freeCompClip = pGC->freeCompClip; + + /* + * if there is no client clip, we can get by with just keeping the + * pointer we got, and remembering whether or not should destroy (or + * maybe re-use) it later. this way, we avoid unnecessary copying of + * regions. (this wins especially if many clients clip by children + * and have no client clip.) + */ + if (pGC->clientClipType == CT_NONE) { + if (freeCompClip) + REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); + pGC->pCompositeClip = pregWin; + pGC->freeCompClip = freeTmpClip; + } else { + /* + * we need one 'real' region to put into the composite clip. if + * pregWin the current composite clip are real, we can get rid of + * one. if pregWin is real and the current composite clip isn't, + * use pregWin for the composite clip. if the current composite + * clip is real and pregWin isn't, use the current composite + * clip. if neither is real, create a new region. + */ + + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, + pDrawable->x + pGC->clipOrg.x, + pDrawable->y + pGC->clipOrg.y); + + if (freeCompClip) { + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin, + pGC->clientClip); + if (freeTmpClip) + REGION_DESTROY(pGC->pScreen, pregWin); + } else if (freeTmpClip) { + REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip); + pGC->pCompositeClip = pregWin; + } else { + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0); + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, + pregWin, pGC->clientClip); + } + pGC->freeCompClip = TRUE; + REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, + -(pDrawable->x + pGC->clipOrg.x), + -(pDrawable->y + pGC->clipOrg.y)); + } + } /* end of composite clip for a window */ + else { + BoxRec pixbounds; + + /* XXX should we translate by drawable.x/y here ? */ + pixbounds.x1 = 0; + pixbounds.y1 = 0; + pixbounds.x2 = pDrawable->width; + pixbounds.y2 = pDrawable->height; + + if (pGC->freeCompClip) { + REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds); + } else { + pGC->freeCompClip = TRUE; + pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1); + } + + if (pGC->clientClipType == CT_REGION) { + REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x, + -pGC->clipOrg.y); + REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, + pGC->pCompositeClip, pGC->clientClip); + REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x, + pGC->clipOrg.y); + } + } /* end of composite clip for pixmap */ +} /* end afbComputeCompositeClip */ + /* Clipping conventions if the drawable is a window CT_REGION ==> pCompositeClip really is the composite @@ -147,7 +266,7 @@ afbCreateGC(pGC) */ /*ARGSUSED*/ -void +static void afbValidateGC(pGC, changes, pDrawable) register GCPtr pGC; unsigned long changes; @@ -434,7 +553,7 @@ afbValidateGC(pGC, changes, pDrawable) } /* end of new_fill */ } -void +static void afbDestroyGC(pGC) GCPtr pGC; { @@ -445,58 +564,6 @@ afbDestroyGC(pGC) miDestroyGCOps(pGC->ops); } -/* table to map alu(src, dst) to alu(~src, dst) */ -int afbInverseAlu[16] = { - GXclear, - GXandInverted, - GXnor, - GXcopyInverted, - GXand, - GXnoop, - GXequiv, - GXorInverted, - GXandReverse, - GXxor, - GXinvert, - GXnand, - GXcopy, - GXor, - GXorReverse, - GXset -}; - -void -afbReduceOpaqueStipple(fg, bg, planemask, depth, rop) -register PixelType fg; -register PixelType bg; -register unsigned long planemask; -int depth; -register unsigned char *rop; -{ - register int d; - register Pixel mask = 1; - - bg ^= fg; - - for (d = 0; d < depth; d++, mask <<= 1) { - if (!(planemask & mask)) - rop[d] = RROP_NOP; - else if (!(bg & mask)) { - /* Both fg and bg have a 0 or 1 in this plane */ - if (fg & mask) - rop[d] = RROP_WHITE; - else - rop[d] = RROP_BLACK; - } else { - /* Both fg and bg have different bits on this plane */ - if (fg & mask) - rop[d] = RROP_COPY; - else - rop[d] = RROP_INVERT; - } - } -} - void afbReduceRop(alu, src, planemask, depth, rop) register int alu; @@ -615,94 +682,3 @@ afbReduceRop(alu, src, planemask, depth, rop) } } } - -void -afbComputeCompositeClip(pGC, pDrawable) - GCPtr pGC; - DrawablePtr pDrawable; -{ - if (pDrawable->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDrawable; - RegionPtr pregWin; - Bool freeTmpClip, freeCompClip; - - if (pGC->subWindowMode == IncludeInferiors) { - pregWin = NotClippedByChildren(pWin); - freeTmpClip = TRUE; - } else { - pregWin = &pWin->clipList; - freeTmpClip = FALSE; - } - freeCompClip = pGC->freeCompClip; - - /* - * if there is no client clip, we can get by with just keeping the - * pointer we got, and remembering whether or not should destroy (or - * maybe re-use) it later. this way, we avoid unnecessary copying of - * regions. (this wins especially if many clients clip by children - * and have no client clip.) - */ - if (pGC->clientClipType == CT_NONE) { - if (freeCompClip) - REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); - pGC->pCompositeClip = pregWin; - pGC->freeCompClip = freeTmpClip; - } else { - /* - * we need one 'real' region to put into the composite clip. if - * pregWin the current composite clip are real, we can get rid of - * one. if pregWin is real and the current composite clip isn't, - * use pregWin for the composite clip. if the current composite - * clip is real and pregWin isn't, use the current composite - * clip. if neither is real, create a new region. - */ - - REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, - pDrawable->x + pGC->clipOrg.x, - pDrawable->y + pGC->clipOrg.y); - - if (freeCompClip) { - REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin, - pGC->clientClip); - if (freeTmpClip) - REGION_DESTROY(pGC->pScreen, pregWin); - } else if (freeTmpClip) { - REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip); - pGC->pCompositeClip = pregWin; - } else { - pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0); - REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, - pregWin, pGC->clientClip); - } - pGC->freeCompClip = TRUE; - REGION_TRANSLATE(pGC->pScreen, pGC->clientClip, - -(pDrawable->x + pGC->clipOrg.x), - -(pDrawable->y + pGC->clipOrg.y)); - } - } /* end of composite clip for a window */ - else { - BoxRec pixbounds; - - /* XXX should we translate by drawable.x/y here ? */ - pixbounds.x1 = 0; - pixbounds.y1 = 0; - pixbounds.x2 = pDrawable->width; - pixbounds.y2 = pDrawable->height; - - if (pGC->freeCompClip) { - REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds); - } else { - pGC->freeCompClip = TRUE; - pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1); - } - - if (pGC->clientClipType == CT_REGION) { - REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x, - -pGC->clipOrg.y); - REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, - pGC->pCompositeClip, pGC->clientClip); - REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x, - pGC->clipOrg.y); - } - } /* end of composite clip for pixmap */ -} /* end afbComputeCompositeClip */ diff --git a/afb/afbimage.c b/afb/afbimage.c index c82bb3668..81f49730a 100644 --- a/afb/afbimage.c +++ b/afb/afbimage.c @@ -42,39 +42,8 @@ afbPutImage(pDraw, pGC, depth, x, y, width, height, leftPad, format, pImage) (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, width, height, x, y, 1); else { -#if 0 - /* XXX: bit plane order wronge ! */ - pPixmap->drawable.depth = 1; - pPixmap->drawable.bitsPerPixel = 1; - - switch (pGC->alu) { - case GXcopy: - doBitBlt = afbDoBitbltCopy; - break; - case GXxor: - doBitBlt = afbDoBitbltXor; - break; - case GXcopyInverted: - doBitBlt = afbDoBitbltCopyInverted; - break; - case GXor: - doBitBlt = afbDoBitbltOr; - break; - default: - doBitBlt = afbDoBitbltGeneral; - break; - } - - for (plane = (1L << (pPixmap->drawable.depth - 1)); plane; - plane >>= 1) { - (void)afbBitBlt((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, - width, height, x, y, doBitBlt, plane); - /* pDraw->devKind += sizeDst; */ - } -#else (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0, width, height, x, y); -#endif } pGC->fExpose = TRUE; diff --git a/afb/afbpixmap.c b/afb/afbpixmap.c index 6a3a48518..77ba53513 100644 --- a/afb/afbpixmap.c +++ b/afb/afbpixmap.c @@ -118,9 +118,8 @@ afbDestroyPixmap(pPixmap) } -PixmapPtr -afbCopyPixmap(pSrc) - register PixmapPtr pSrc; +static PixmapPtr +afbCopyPixmap(PixmapPtr pSrc) { register PixmapPtr pDst; int size; @@ -148,9 +147,8 @@ afbCopyPixmap(pSrc) zero out area to be filled with replicate left shift and or in original as many times as needed */ -void -afbPadPixmap(pPixmap) - PixmapPtr pPixmap; +static void +afbPadPixmap(PixmapPtr pPixmap) { register int width = pPixmap->drawable.width; register int h; diff --git a/afb/afbscrinit.c b/afb/afbscrinit.c index 2b0867fda..7cb742345 100644 --- a/afb/afbscrinit.c +++ b/afb/afbscrinit.c @@ -77,7 +77,7 @@ int afbScreenPrivateIndex; static unsigned long afbGeneration = 0; -BSFuncRec afbBSFuncRec = { +static BSFuncRec afbBSFuncRec = { afbSaveAreas, afbRestoreAreas, (BackingStoreSetClipmaskRgnProcPtr) 0, @@ -85,7 +85,7 @@ BSFuncRec afbBSFuncRec = { (BackingStoreGetSpansPixmapProcPtr) 0, }; -Bool +static Bool afbCloseScreen(int index, ScreenPtr pScreen) { int d; @@ -119,7 +119,29 @@ afbCreateScreenResources(ScreenPtr pScreen) return(retval); } -Bool +static PixmapPtr +afbGetWindowPixmap(WindowPtr pWin) +{ +#ifdef PIXMAP_PER_WINDOW + return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr); +#else + ScreenPtr pScreen = pWin->drawable.pScreen; + + return (* pScreen->GetScreenPixmap)(pScreen); +#endif +} + +static void +afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix) +{ +#ifdef PIXMAP_PER_WINDOW + pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix; +#else + (* pWin->drawable.pScreen->SetScreenPixmap)(pPix); +#endif +} + +static Bool afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex) { if (afbGeneration != serverGeneration) { @@ -216,25 +238,3 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i return TRUE; } - -PixmapPtr -afbGetWindowPixmap(WindowPtr pWin) -{ -#ifdef PIXMAP_PER_WINDOW - return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr); -#else - ScreenPtr pScreen = pWin->drawable.pScreen; - - return (* pScreen->GetScreenPixmap)(pScreen); -#endif -} - -void -afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix) -{ -#ifdef PIXMAP_PER_WINDOW - pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix; -#else - (* pWin->drawable.pScreen->SetScreenPixmap)(pPix); -#endif -} diff --git a/afb/afbsetsp.c b/afb/afbsetsp.c index adc726620..cb36dba99 100644 --- a/afb/afbsetsp.c +++ b/afb/afbsetsp.c @@ -73,20 +73,10 @@ SOFTWARE. * boxes, we may not want to start grabbing bits at psrc but at some offset * further on.) */ -void -afbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, - sizeDst, depthDst, sizeSrc) - int y; - int xOrigin; /* where this scanline starts */ - int xStart; /* first bit to use from scanline */ - int xEnd; /* last bit to use from scanline + 1 */ - register PixelType *psrc; - register int alu; /* raster op */ - PixelType *pdstBase; /* start of the drawable */ - int widthDst; /* width of drawable in words */ - int sizeDst; - int depthDst; - int sizeSrc; +static void +afbSetScanline(int y, int xOrigin, int xStart, int xEnd, PixelType *psrc, + int alu, PixelType *pdstBase, int widthDst, int sizeDst, + int depthDst, int sizeSrc) { int w; /* width of scanline in bits */ register PixelType *pdst; /* where to put the bits */ diff --git a/composite/compalloc.c b/composite/compalloc.c index 5bbf0a279..ce1ef7d80 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -48,7 +48,7 @@ #include "compint.h" -void +static void compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) { WindowPtr pWin = (WindowPtr) closure; diff --git a/composite/compext.c b/composite/compext.c index 13936fa18..ba37e7d1f 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -50,10 +50,10 @@ #include "compint.h" static CARD8 CompositeReqCode; -int CompositeClientPrivateIndex; +static int CompositeClientPrivateIndex; RESTYPE CompositeClientWindowType; RESTYPE CompositeClientSubwindowsType; -RESTYPE CompositeClientOverlayType; +static RESTYPE CompositeClientOverlayType; static void deleteCompOverlayClient (CompOverlayClientPtr pOcToDel, ScreenPtr pScreen); @@ -423,7 +423,7 @@ createOverlayWindow (ScreenPtr pScreen) return pWin; } -int +static int ProcCompositeGetOverlayWindow (ClientPtr client) { REQUEST(xCompositeGetOverlayWindowReq); @@ -477,7 +477,7 @@ ProcCompositeGetOverlayWindow (ClientPtr client) return client->noClientException; } -int +static int ProcCompositeReleaseOverlayWindow (ClientPtr client) { REQUEST(xCompositeReleaseOverlayWindowReq); @@ -515,7 +515,7 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client) return client->noClientException; } -int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { +static int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { ProcCompositeQueryVersion, ProcCompositeRedirectWindow, ProcCompositeRedirectSubwindows, @@ -625,7 +625,7 @@ SProcCompositeNameWindowPixmap (ClientPtr client) return (*ProcCompositeVector[stuff->compositeReqType]) (client); } -int +static int SProcCompositeGetOverlayWindow (ClientPtr client) { int n; @@ -637,7 +637,7 @@ SProcCompositeGetOverlayWindow (ClientPtr client) return (*ProcCompositeVector[stuff->compositeReqType]) (client); } -int +static int SProcCompositeReleaseOverlayWindow (ClientPtr client) { int n; @@ -649,7 +649,7 @@ SProcCompositeReleaseOverlayWindow (ClientPtr client) return (*ProcCompositeVector[stuff->compositeReqType]) (client); } -int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { +static int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = { SProcCompositeQueryVersion, SProcCompositeRedirectWindow, SProcCompositeRedirectSubwindows, @@ -678,6 +678,30 @@ CompositeExtensionInit (void) ExtensionEntry *extEntry; int s; + for (s = 0; s < screenInfo.numScreens; s++) { + ScreenPtr pScreen = screenInfo.screens[s]; + VisualPtr vis; + + /* Composite on 8bpp pseudocolor root windows appears to fail, so + * just disable it on anything pseudocolor for safety. + */ + for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++) + ; + if ((vis->class | DynamicClass) == PseudoColor) + return; + + /* Ensure that Render is initialized, which is required for automatic + * compositing. + */ + if (GetPictureScreenIfSet(pScreen) == NULL) + return; + } + /* Xinerama's rewriting of window drawing before Composite gets to it + * breaks Composite. + */ + if (!noPanoramiXExtension) + return; + CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow); if (!CompositeClientWindowType) return; diff --git a/composite/compinit.c b/composite/compinit.c index 1d5cc7b04..27261dcad 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -51,7 +51,7 @@ int CompScreenPrivateIndex; int CompWindowPrivateIndex; int CompSubwindowsPrivateIndex; -int CompGeneration; +static int CompGeneration; static Bool diff --git a/composite/compint.h b/composite/compint.h index 3958b3b31..0bd55a9a6 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -171,9 +171,6 @@ extern RESTYPE CompositeClientSubwindowsType; * compalloc.c */ -void -compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure); - Bool compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update); @@ -292,18 +289,6 @@ compWindowUpdate (WindowPtr pWin); void deleteCompOverlayClientsForScreen (ScreenPtr pScreen); -int -ProcCompositeGetOverlayWindow (ClientPtr client); - -int -ProcCompositeReleaseOverlayWindow (ClientPtr client); - -int -SProcCompositeGetOverlayWindow (ClientPtr client); - -int -SProcCompositeReleaseOverlayWindow (ClientPtr client); - WindowPtr CompositeRealChildHead (WindowPtr pWin); diff --git a/configure.ac b/configure.ac index 09cf583c1..bd6bbebcc 100644 --- a/configure.ac +++ b/configure.ac @@ -852,10 +852,6 @@ AC_DEFINE(DAMAGE,1,[Support Damage extension]) DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la' DAMAGE_INC='-I$(top_srcdir)/damageext' MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la' -dnl damage (may) need the composite wrapper when composite is enabled -if test "$COMPOSITE" = yes; then - MIEXT_DAMAGE_LIB="$MIEXT_DAMAGE_LIB "'$(top_builddir)/miext/cw/libcw.la' -fi MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage' AC_DEFINE(XINPUT, 1, [Support X Input extension]) @@ -1412,6 +1408,8 @@ return 0;} fi if test "${OS_MINOR}" -lt 8 ; then solaris_usl_console="yes" + else + XORG_CFLAGS="$XORG_CFLAGS -DXF86PM" fi ;; *) diff --git a/damageext/damageext.c b/damageext/damageext.c index 739d20f09..57a7bce09 100755 --- a/damageext/damageext.c +++ b/damageext/damageext.c @@ -28,12 +28,12 @@ #include "damageextint.h" -unsigned char DamageReqCode; -int DamageEventBase; -int DamageErrorBase; -int DamageClientPrivateIndex; -RESTYPE DamageExtType; -RESTYPE DamageExtWinType; +static unsigned char DamageReqCode; +static int DamageEventBase; +static int DamageErrorBase; +static int DamageClientPrivateIndex; +static RESTYPE DamageExtType; +static RESTYPE DamageExtWinType; /* Version of the damage extension supported by the server, as opposed to the * DAMAGE_* defines from damageproto for what version the proto header @@ -319,7 +319,7 @@ static const int version_requests[] = { #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) -int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = { +static int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ ProcDamageQueryVersion, ProcDamageCreate, @@ -408,7 +408,7 @@ SProcDamageAdd (ClientPtr client) return (*ProcDamageVector[stuff->damageReqType]) (client); } -int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = { +static int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ SProcDamageQueryVersion, SProcDamageCreate, @@ -478,7 +478,7 @@ FreeDamageExtWin (pointer value, XID wid) return Success; } -void +static void SDamageNotifyEvent (xDamageNotifyEvent *from, xDamageNotifyEvent *to) { diff --git a/damageext/damageextint.h b/damageext/damageextint.h index 6f14e4e97..1ed07de83 100644 --- a/damageext/damageextint.h +++ b/damageext/damageextint.h @@ -44,13 +44,6 @@ #include "damage.h" #include "xfixes.h" -extern unsigned char DamageReqCode; -extern int DamageEventBase; -extern int DamageErrorBase; -extern int DamageClientPrivateIndex; -extern RESTYPE DamageExtType; -extern RESTYPE DamageExtWinType; - typedef struct _DamageClient { CARD32 major_version; CARD32 minor_version; @@ -67,9 +60,6 @@ typedef struct _DamageExt { XID id; } DamageExtRec, *DamageExtPtr; -extern int (*ProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr); -extern int (*SProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr); - #define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \ pDamageExt = SecurityLookupIDByType (client, rid, DamageExtType, mode); \ if (!pDamageExt) { \ @@ -79,10 +69,6 @@ extern int (*SProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr); } void -SDamageNotifyEvent (xDamageNotifyEvent *from, - xDamageNotifyEvent *to); - -void DamageExtSetCritical (ClientPtr pClient, Bool critical); #endif /* _DAMAGEEXTINT_H_ */ @@ -82,36 +82,6 @@ static Bool firstRegistrationPass = TRUE; /****************************************************************************** * - * DBE DIX Procedure: DbeValidateBuffer - * - * Description: - * - * This function is called from VALIDATE_DRAWABLE_AND_GC and from - * various places in dispatch.c if the server has been compiled with - * the flags -DNEED_DBE_BUF_BITS and -DNEED_DBE_BUF_VALIDATE. - * When pWin->dstBuffer changes, this function will be called with pWin - * as the first argument, the drawable ID that was specified as the - * second argument (could be a back buffer id), and True for the third - * argument. - * When pWin->srcBuffer changes, the third argument will be False, and - * the first two arguments are as described for dstBuffer. - * - * This function should prepare the hardware to access the specified - * buffer for reads (if dstbuf is False) or writes (if dstbuf is True). - * - *****************************************************************************/ - -void -DbeValidateBuffer(WindowPtr pWin, XID drawID, Bool dstbuf) -{ - DbeScreenPrivPtr pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin); - if (pDbeScreenPriv->ValidateBuffer) - (*pDbeScreenPriv->ValidateBuffer)(pWin, drawID, dstbuf); -} - - -/****************************************************************************** - * * DBE DIX Procedure: DbeRegisterFunction * * Description: @@ -317,7 +287,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens) pDbeScreenPriv->EndIdiom = NULL; pDbeScreenPriv->WinPrivDelete = NULL; pDbeScreenPriv->ResetProc = NULL; - pDbeScreenPriv->ValidateBuffer = NULL; (*nStubbedScreens)++; diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h index 460cc7564..835074c75 100644 --- a/dbe/dbestruct.h +++ b/dbe/dbestruct.h @@ -221,11 +221,6 @@ typedef struct _DbeScreenPrivRec void (*ResetProc)( ScreenPtr /*pScreen*/ ); - void (*ValidateBuffer)( - WindowPtr /*pWin*/, - XID /*bufId*/, - Bool /*dstbuffer*/ -); /* Device-specific private information. */ diff --git a/dbe/midbe.c b/dbe/midbe.c index e687b98b7..014e365ce 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -59,21 +59,12 @@ #include <stdio.h> -/* DEFINES */ - - -/* TYPEDEFS */ - - -/* GLOBALS */ - static int miDbePrivPrivGeneration = 0; static int miDbeWindowPrivPrivIndex = -1; -RESTYPE dbeDrawableResType; -RESTYPE dbeWindowPrivResType; -int dbeScreenPrivIndex = -1; -int dbeWindowPrivIndex = -1; - +static RESTYPE dbeDrawableResType; +static RESTYPE dbeWindowPrivResType; +static int dbeScreenPrivIndex = -1; +static int dbeWindowPrivIndex = -1; /****************************************************************************** @@ -768,11 +759,6 @@ miDbeResetProc(ScreenPtr pScreen) } /* miDbeResetProc() */ -static void -miDbeNopValidateBuffer(WindowPtr pWin, XID bufId, Bool dstbuffer) -{ -} - /****************************************************************************** * @@ -830,9 +816,6 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) pDbeScreenPriv->ResetProc = miDbeResetProc; pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete; - /* The mi implementation doesn't need buffer validation. */ - pDbeScreenPriv->ValidateBuffer = miDbeNopValidateBuffer; - return(TRUE); } /* miDbeInit() */ diff --git a/dix/devices.c b/dix/devices.c index 724ef982d..411188d8f 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -67,7 +67,7 @@ SOFTWARE. #define XKB_IN_SERVER #endif #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #include "xace.h" @@ -79,7 +79,8 @@ SOFTWARE. #include "exglobals.h" #include "exevents.h" -int CoreDevicePrivatesIndex = 0, CoreDevicePrivatesGeneration = -1; +int CoreDevicePrivatesIndex = 0; +static int CoreDevicePrivatesGeneration = -1; /* The client that is allowed to change pointer-keyboard pairings. */ static ClientPtr pairingClient = NULL; @@ -994,16 +995,16 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc) } -LedCtrl defaultLedControl = { +static LedCtrl defaultLedControl = { DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0}; -BellCtrl defaultBellControl = { +static BellCtrl defaultBellControl = { DEFAULT_BELL, DEFAULT_BELL_PITCH, DEFAULT_BELL_DURATION, 0}; -IntegerCtrl defaultIntegerControl = { +static IntegerCtrl defaultIntegerControl = { DEFAULT_INT_RESOLUTION, DEFAULT_INT_MIN_VALUE, DEFAULT_INT_MAX_VALUE, diff --git a/dix/dispatch.c b/dix/dispatch.c index b42b675f5..25987b6d1 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -143,7 +143,7 @@ int ProcInitialConnection(); #define XKB_IN_SERVER #endif #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef XSERVER_DTRACE @@ -297,9 +297,8 @@ long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE; long SmartScheduleTime; -ClientPtr SmartLastClient; -int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; -int SmartScheduleClient(int *clientReady, int nready); +static ClientPtr SmartLastClient; +static int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1]; #ifdef SMART_DEBUG long SmartLastPrint; @@ -308,7 +307,7 @@ long SmartLastPrint; void Dispatch(void); void InitProcVectors(void); -int +static int SmartScheduleClient (int *clientReady, int nready) { ClientPtr pClient; @@ -834,7 +833,7 @@ ProcCirculateWindow(ClientPtr client) return(client->noClientException); } -int +static int GetGeometry(ClientPtr client, xGetGeometryReply *rep) { DrawablePtr pDraw; @@ -1804,8 +1803,6 @@ ProcCopyArea(ClientPtr client) else pSrc = pDst; - SET_DBE_SRCBUF(pSrc, stuff->srcDrawable); - pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY, stuff->width, stuff->height, stuff->dstX, stuff->dstY); @@ -1848,8 +1845,6 @@ ProcCopyPlane(ClientPtr client) else psrcDraw = pdstDraw; - SET_DBE_SRCBUF(psrcDraw, stuff->srcDrawable); - /* Check to see if stuff->bitPlane has exactly ONE good bit set */ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) || (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) @@ -2157,8 +2152,7 @@ ProcPutImage(ClientPtr client) return (client->noClientException); } - -int +static int DoGetImage(ClientPtr client, int format, Drawable drawable, int x, int y, int width, int height, Mask planemask, xGetImageReply **im_return) @@ -2210,8 +2204,6 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, xgi.visual = None; } - SET_DBE_SRCBUF(pDraw, drawable); - xgi.type = X_Reply; xgi.sequenceNumber = client->sequence; xgi.depth = pDraw->depth; @@ -3383,6 +3375,28 @@ ProcChangeAccessControl(ClientPtr client) return (result); } +/********************* + * CloseDownRetainedResources + * + * Find all clients that are gone and have terminated in RetainTemporary + * and destroy their resources. + *********************/ + +static void +CloseDownRetainedResources(void) +{ + int i; + ClientPtr client; + + for (i=1; i<currentMaxClients; i++) + { + client = clients[i]; + if (client && (client->closeDownMode == RetainTemporary) + && (client->clientGone)) + CloseDownClient(client); + } +} + int ProcKillClient(ClientPtr client) { @@ -3653,28 +3667,6 @@ KillAllClients() } } -/********************* - * CloseDownRetainedResources - * - * Find all clients that are gone and have terminated in RetainTemporary - * and destroy their resources. - *********************/ - -void -CloseDownRetainedResources() -{ - int i; - ClientPtr client; - - for (i=1; i<currentMaxClients; i++) - { - client = clients[i]; - if (client && (client->closeDownMode == RetainTemporary) - && (client->clientGone)) - CloseDownClient(client); - } -} - extern int clientPrivateLen; extern unsigned *clientPrivateSizes; extern unsigned totalClientSize; diff --git a/dix/dixutils.c b/dix/dixutils.c index c0728da71..44d82c944 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -882,9 +882,7 @@ static CallbackFuncsRec default_cbfuncs = _DeleteCallbackList }; -/* ===== Public Procedures ===== */ - -Bool +static Bool CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) { CallbackListPtr cbl; @@ -916,6 +914,8 @@ CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) return TRUE; } +/* ===== Public Procedures ===== */ + _X_EXPORT Bool AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) { diff --git a/dix/events.c b/dix/events.c index c482f5c74..de8ff9b6b 100644 --- a/dix/events.c +++ b/dix/events.c @@ -139,7 +139,7 @@ of the copyright holder. #ifdef XKB #include <X11/extensions/XKBproto.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); #endif @@ -162,7 +162,7 @@ extern Mask xevieFilters[128]; extern int xevieEventSent; extern int xevieKBEventSent; int xeviegrabState = 0; -xEvent *xeviexE; +static xEvent *xeviexE; #endif #include <X11/extensions/XIproto.h> diff --git a/dix/extension.c b/dix/extension.c index dc1a76f3a..88dff15e2 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -66,8 +66,6 @@ SOFTWARE. #define LAST_EVENT 128 #define LAST_ERROR 255 -ScreenProcEntry AuxillaryScreenProcs[MAXSCREENS]; - static ExtensionEntry **extensions = (ExtensionEntry **)NULL; int lastEvent = EXTENSION_EVENT_BASE; @@ -298,21 +296,8 @@ CloseDownExtensions() extensions = (ExtensionEntry **)NULL; lastEvent = EXTENSION_EVENT_BASE; lastError = FirstExtensionError; - for (i=0; i<MAXSCREENS; i++) - { - ScreenProcEntry *spentry = &AuxillaryScreenProcs[i]; - - while (spentry->num) - { - spentry->num--; - xfree(spentry->procList[spentry->num].name); - } - xfree(spentry->procList); - spentry->procList = (ProcEntryPtr)NULL; - } } - int ProcQueryExtension(ClientPtr client) { @@ -406,72 +391,6 @@ ProcListExtensions(ClientPtr client) return(client->noClientException); } - -ExtensionLookupProc -LookupProc(char *name, GCPtr pGC) -{ - int i; - ScreenProcEntry *spentry; - spentry = &AuxillaryScreenProcs[pGC->pScreen->myNum]; - if (spentry->num) - { - for (i = 0; i < spentry->num; i++) - if (strcmp(name, spentry->procList[i].name) == 0) - return(spentry->procList[i].proc); - } - return (ExtensionLookupProc)NULL; -} - -Bool -RegisterProc(char *name, GC *pGC, ExtensionLookupProc proc) -{ - return RegisterScreenProc(name, pGC->pScreen, proc); -} - -Bool -RegisterScreenProc(char *name, ScreenPtr pScreen, ExtensionLookupProc proc) -{ - ScreenProcEntry *spentry; - ProcEntryPtr procEntry = (ProcEntryPtr)NULL; - char *newname; - int i; - - spentry = &AuxillaryScreenProcs[pScreen->myNum]; - /* first replace duplicates */ - if (spentry->num) - { - for (i = 0; i < spentry->num; i++) - if (strcmp(name, spentry->procList[i].name) == 0) - { - procEntry = &spentry->procList[i]; - break; - } - } - if (procEntry) - procEntry->proc = proc; - else - { - newname = (char *)xalloc(strlen(name)+1); - if (!newname) - return FALSE; - procEntry = (ProcEntryPtr) - xrealloc(spentry->procList, - sizeof(ProcEntryRec) * (spentry->num+1)); - if (!procEntry) - { - xfree(newname); - return FALSE; - } - spentry->procList = procEntry; - procEntry += spentry->num; - procEntry->name = newname; - strcpy(newname, name); - procEntry->proc = proc; - spentry->num++; - } - return TRUE; -} - #ifdef XSERVER_DTRACE void LoadExtensionNames(char **RequestNames) { int i; @@ -69,7 +69,7 @@ extern FontPtr defaultFont; static Bool CreateDefaultTile(GCPtr pGC); -unsigned char DefaultDash[2] = {4, 4}; +static unsigned char DefaultDash[2] = {4, 4}; _X_EXPORT void ValidateGC(DrawablePtr pDraw, GC *pGC) @@ -907,17 +907,6 @@ FreeGC(pointer value, XID gid) return(Success); } -void -SetGCMask(GCPtr pGC, Mask selectMask, Mask newDataMask) -{ - pGC->stateChanges = (~selectMask & pGC->stateChanges) | - (selectMask & newDataMask); - if (selectMask & newDataMask) - pGC->serialNumber |= GC_CHANGE_SERIAL_BIT; -} - - - /* CreateScratchGC(pScreen, depth) like CreateGC, but doesn't do the default tile or stipple, since we can't create them without already having a GC. any code diff --git a/dix/getevents.c b/dix/getevents.c index e95caddd7..d446a2d3c 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -50,7 +50,7 @@ #ifdef XKB #include <X11/extensions/XKBproto.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies); #endif diff --git a/dix/resource.c b/dix/resource.c index 7092b2fdb..a5a7eed80 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -246,7 +246,7 @@ CreateNewResourceClass() return next; } -ClientResourceRec clientTable[MAXCLIENTS]; +static ClientResourceRec clientTable[MAXCLIENTS]; /***************** * InitClientResources diff --git a/dix/swaprep.c b/dix/swaprep.c index 6f4b277d9..7d3251ae3 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -317,7 +317,7 @@ SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep) (void)WriteToClient(pClient, size, (char *) pRep); } -void +static void SwapTimecoord(xTimecoord* pCoord) { char n; @@ -584,7 +584,7 @@ SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep (void)WriteToClient(pClient, size, (char *) pRep); } -void +static void SwapRGB(xrgb *prgb) { char n; @@ -1159,6 +1159,58 @@ SKeymapNotifyEvent(xEvent *from, xEvent *to) *to = *from; } +static void +SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT) +{ + cpswapl(pConnSetup->release, pConnSetupT->release); + cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); + cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); + cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); + cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); + cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); + pConnSetupT->minKeyCode = pConnSetup->minKeyCode; + pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; + pConnSetupT->numRoots = pConnSetup->numRoots; + pConnSetupT->numFormats = pConnSetup->numFormats; + pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; + pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; + pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; + pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; +} + +static void +SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT) +{ + cpswapl(pRoot->windowId, pRootT->windowId); + cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); + cpswapl(pRoot->whitePixel, pRootT->whitePixel); + cpswapl(pRoot->blackPixel, pRootT->blackPixel); + cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); + cpswaps(pRoot->pixWidth, pRootT->pixWidth); + cpswaps(pRoot->pixHeight, pRootT->pixHeight); + cpswaps(pRoot->mmWidth, pRootT->mmWidth); + cpswaps(pRoot->mmHeight, pRootT->mmHeight); + cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); + cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); + cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); + pRootT->backingStore = pRoot->backingStore; + pRootT->saveUnders = pRoot->saveUnders; + pRootT->rootDepth = pRoot->rootDepth; + pRootT->nDepths = pRoot->nDepths; +} + +static void +SwapVisual(xVisualType *pVis, xVisualType *pVisT) +{ + cpswapl(pVis->visualID, pVisT->visualID); + pVisT->class = pVis->class; + pVisT->bitsPerRGB = pVis->bitsPerRGB; + cpswaps(pVis->colormapEntries, pVisT->colormapEntries); + cpswapl(pVis->redMask, pVisT->redMask); + cpswapl(pVis->greenMask, pVisT->greenMask); + cpswapl(pVis->blueMask, pVisT->blueMask); +} + _X_EXPORT void SwapConnSetupInfo( char *pInfo, @@ -1210,7 +1262,6 @@ SwapConnSetupInfo( } } - void WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) { @@ -1227,58 +1278,6 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) DEALLOCATE_LOCAL(pInfoTBase); } -void -SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT) -{ - cpswapl(pConnSetup->release, pConnSetupT->release); - cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); - cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); - cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); - cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); - cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); - pConnSetupT->minKeyCode = pConnSetup->minKeyCode; - pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; - pConnSetupT->numRoots = pConnSetup->numRoots; - pConnSetupT->numFormats = pConnSetup->numFormats; - pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; - pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; - pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; - pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; -} - -void -SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT) -{ - cpswapl(pRoot->windowId, pRootT->windowId); - cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); - cpswapl(pRoot->whitePixel, pRootT->whitePixel); - cpswapl(pRoot->blackPixel, pRootT->blackPixel); - cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); - cpswaps(pRoot->pixWidth, pRootT->pixWidth); - cpswaps(pRoot->pixHeight, pRootT->pixHeight); - cpswaps(pRoot->mmWidth, pRootT->mmWidth); - cpswaps(pRoot->mmHeight, pRootT->mmHeight); - cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); - cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); - cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); - pRootT->backingStore = pRoot->backingStore; - pRootT->saveUnders = pRoot->saveUnders; - pRootT->rootDepth = pRoot->rootDepth; - pRootT->nDepths = pRoot->nDepths; -} - -void -SwapVisual(xVisualType *pVis, xVisualType *pVisT) -{ - cpswapl(pVis->visualID, pVisT->visualID); - pVisT->class = pVis->class; - pVisT->bitsPerRGB = pVis->bitsPerRGB; - cpswaps(pVis->colormapEntries, pVisT->colormapEntries); - cpswapl(pVis->redMask, pVisT->redMask); - cpswapl(pVis->greenMask, pVisT->greenMask); - cpswapl(pVis->blueMask, pVisT->blueMask); -} - _X_EXPORT void SwapConnSetupPrefix(xConnSetupPrefix *pcspFrom, xConnSetupPrefix *pcspTo) { diff --git a/dix/window.c b/dix/window.c index f0d4cf8ce..4e553193e 100644 --- a/dix/window.c +++ b/dix/window.c @@ -307,10 +307,6 @@ SetWindowToDefaults(WindowPtr pWin) pWin->deliverableEvents = 0; pWin->dontPropagate = 0; pWin->forcedBS = FALSE; -#ifdef NEED_DBE_BUF_BITS - pWin->srcBuffer = DBE_FRONT_BUFFER; - pWin->dstBuffer = DBE_FRONT_BUFFER; -#endif #ifdef COMPOSITE pWin->redirectDraw = 0; #endif @@ -557,7 +553,7 @@ InitRootWindow(WindowPtr pWin) * window from which the region came. */ -void +static void ClippedRegionFromBox(WindowPtr pWin, RegionPtr Rgn, int x, int y, int w, int h) @@ -854,6 +850,46 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, } static void +DisposeWindowOptional (WindowPtr pWin) +{ + if (!pWin->optional) + return; + /* + * everything is peachy. Delete the optional record + * and clean up + */ + if (pWin->optional->cursor) + { + FreeCursor (pWin->optional->cursor, (Cursor)0); + pWin->cursorIsNone = FALSE; + } + else + pWin->cursorIsNone = TRUE; + + if (pWin->optional->deviceCursors) + { + DevCursorList pList; + DevCursorList pPrev; + pList = pWin->optional->deviceCursors; + while(pList) + { + if (pList->cursor) + FreeCursor(pList->cursor, (XID)0); + pPrev = pList; + pList = pList->next; + xfree(pPrev); + } + pWin->optional->deviceCursors = NULL; + } + + xfree(pWin->optional->access.perm); + xfree(pWin->optional->access.deny); + + xfree (pWin->optional); + pWin->optional = NULL; +} + +static void FreeWindowResources(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -2721,6 +2757,30 @@ RealizeTree(WindowPtr pWin) } } +static WindowPtr windowDisableMapUnmapEvents; + +void +DisableMapUnmapEvents(WindowPtr pWin) +{ + assert (windowDisableMapUnmapEvents == NULL); + + windowDisableMapUnmapEvents = pWin; +} + +void +EnableMapUnmapEvents(WindowPtr pWin) +{ + assert (windowDisableMapUnmapEvents != NULL); + + windowDisableMapUnmapEvents = NULL; +} + +static Bool +MapUnmapEventsEnabled(WindowPtr pWin) +{ + return pWin != windowDisableMapUnmapEvents; +} + /***** * MapWindow * If some other client has selected SubStructureReDirect on the parent @@ -3221,21 +3281,6 @@ HandleSaveSet(ClientPtr client) /** * - * \param x,y in root - * \param box "return" value - */ -Bool -VisibleBoundingBoxFromPoint(WindowPtr pWin, int x, int y, BoxPtr box) -{ - if (!pWin->realized) - return (FALSE); - if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->clipList, x, y, box)) - return(TRUE); - return(FALSE); -} - -/** - * * \param x,y in root */ Bool @@ -3342,30 +3387,6 @@ SendVisibilityNotify(WindowPtr pWin) DeliverEvents(pWin, &event, 1, NullWindow); } -static WindowPtr windowDisableMapUnmapEvents; - -void -DisableMapUnmapEvents(WindowPtr pWin) -{ - assert (windowDisableMapUnmapEvents == NULL); - - windowDisableMapUnmapEvents = pWin; -} - -void -EnableMapUnmapEvents(WindowPtr pWin) -{ - assert (windowDisableMapUnmapEvents != NULL); - - windowDisableMapUnmapEvents = NULL; -} - -Bool -MapUnmapEventsEnabled(WindowPtr pWin) -{ - return pWin != windowDisableMapUnmapEvents; -} - #define RANDOM_WIDTH 32 #ifndef NOLOGOHACK @@ -3738,61 +3759,6 @@ MakeWindowOptional (WindowPtr pWin) return TRUE; } -void -DisposeWindowOptional (WindowPtr pWin) -{ - if (!pWin->optional) - return; - /* - * everything is peachy. Delete the optional record - * and clean up - */ - /* - * TOG changed this code to: - * - * if (pWin->cursorIsNone == FALSE) - * FreeCursor (pWin->optional->cursor, (Cursor)0); - * pWin->cursorIsNone = TRUE; - * - * This is blatently wrong; windows without optionals can have - * two different cursor values, either None or sharing their - * parents cursor. This difference is controlled by the - * cursorIsNone value; when TRUE, the window has no cursor, - * when false, it shares its cursor with its parent; TOG - * made it impossible for a window to have a cursor without - * an optional record. - */ - if (pWin->optional->cursor) - { - FreeCursor (pWin->optional->cursor, (Cursor)0); - pWin->cursorIsNone = FALSE; - } - else - pWin->cursorIsNone = TRUE; - - if (pWin->optional->deviceCursors) - { - DevCursorList pList; - DevCursorList pPrev; - pList = pWin->optional->deviceCursors; - while(pList) - { - if (pList->cursor) - FreeCursor(pList->cursor, (XID)0); - pPrev = pList; - pList = pList->next; - xfree(pPrev); - } - pWin->optional->deviceCursors = NULL; - } - - xfree(pWin->optional->access.perm); - xfree(pWin->optional->access.deny); - - xfree (pWin->optional); - pWin->optional = NULL; -} - /* * Changes the cursor struct for the given device and the given window. * A cursor that does not have a device cursor set will use whatever the @@ -3807,9 +3773,10 @@ DisposeWindowOptional (WindowPtr pWin) * Assumption: If there is a node for a device in the list, the device has a * cursor. If the cursor is set to None, it is inherited by the parent. */ -int ChangeWindowDeviceCursor(register WindowPtr pWin, - DeviceIntPtr pDev, - CursorPtr pCursor) +_X_EXPORT int +ChangeWindowDeviceCursor(WindowPtr pWin, + DeviceIntPtr pDev, + CursorPtr pCursor) { DevCursNodePtr pNode, pPrev; CursorPtr pOldCursor = NULL; @@ -3905,7 +3872,8 @@ int ChangeWindowDeviceCursor(register WindowPtr pWin, } /* Get device cursor for given device or None if none is set */ -CursorPtr WindowGetDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev) +_X_EXPORT CursorPtr +WindowGetDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev) { DevCursorList pList; @@ -4001,7 +3969,6 @@ WindowParentHasDeviceCursor(WindowPtr pWin, return FALSE; } - #ifndef NOLOGOHACK static void DrawLogo(WindowPtr pWin) @@ -668,10 +668,6 @@ exaDriverInit (ScreenPtr pScreen, } #endif -#ifdef COMPOSITE - miDisableCompositeWrapper(pScreen); -#endif - #ifdef MITSHM /* Re-register with the MI funcs, which don't allow shared pixmaps. * Shared pixmaps are almost always a performance loss for us, but this diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am index 17d27ed39..41dc5d210 100644 --- a/hw/dmx/Makefile.am +++ b/hw/dmx/Makefile.am @@ -2,7 +2,6 @@ DIST_SUBDIRS = input config glxProxy examples doc SUBDIRS = input config examples bin_PROGRAMS = Xdmx -noinst_LIBRARIES = libfbcmap.a if XINERAMA PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c @@ -17,6 +16,9 @@ GLX_INCS = -I$(top_srcdir)/hw/xfree86/dixmods/extmod \ GLX_DEFS = @GL_CFLAGS@ endif +# It's essential that fbcmap.c be compiled with this flag for DMX to work!! +DMX_CFLAGS = -DXFree86Server=1 + if BUILDDOCS SUBDIRS += doc endif @@ -26,11 +28,9 @@ AM_CFLAGS = \ $(DIX_CFLAGS) \ $(GLX_INCS) \ $(GLX_DEFS) \ + $(DMX_CFLAGS) \ @DMXMODULES_CFLAGS@ -libfbcmap_a_SOURCES = libfbcmap.a -libfbcmap_a_CFLAGS = $(AM_CFLAGS) -DXFree86Server - Xdmx_SOURCES = dmx.c \ dmxcb.c \ dmxcb.h \ @@ -76,6 +76,7 @@ Xdmx_SOURCES = dmx.c \ dmxwindow.c \ dmxwindow.h \ $(top_srcdir)/mi/miinitext.c \ + $(top_srcdir)/fb/fbcmap.c \ $(GLX_SRCS) @@ -89,7 +90,6 @@ Xdmx_LDADD = $(XORG_CORE_LIBS) \ $(GLX_LIBS) \ input/libdmxinput.a \ config/libdmxconfig.a \ - libfbcmap.a \ @DMXMODULES_LIBS@ # Man page diff --git a/hw/dmx/dmxclient.h b/hw/dmx/dmxclient.h index 586b82990..657a1275f 100644 --- a/hw/dmx/dmxclient.h +++ b/hw/dmx/dmxclient.h @@ -126,7 +126,7 @@ typedef XID KeySym64; #undef KeySym #endif -/* These are in exglobals.h, but that conflicts with X11/extensions/XKBsrv.h */ +/* These are in exglobals.h, but that conflicts with xkbsrv.h */ extern int ProximityIn; extern int ProximityOut; extern int DeviceValuator; @@ -144,7 +144,7 @@ extern int ChangeDeviceNotify; #ifndef XKB_IN_SERVER #define XKB_IN_SERVER #endif -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #undef XPointer #endif #include <X11/extensions/XIproto.h> diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c index e74a05215..a7d9378b0 100644 --- a/hw/dmx/dmxcursor.c +++ b/hw/dmx/dmxcursor.c @@ -130,14 +130,16 @@ static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) int globalX; int globalY; - if (screenInfo.numScreens == 1) return FALSE; + if (screenInfo.numScreens == 1) + return FALSE; /* On current screen? */ dmxScreen = &dmxScreens[(*ppScreen)->myNum]; if (localX >= 0 && localX < dmxScreen->rootWidth && localY >= 0 - && localY < dmxScreen->rootHeight) return FALSE; + && localY < dmxScreen->rootHeight) + return FALSE; /* Convert to global coordinate space */ globalX = dmxScreen->rootXOrigin + localX; @@ -162,7 +164,8 @@ static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth && globalY >= dmxScreen->rootYOrigin && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) { - if (dmxScreen->index == (*ppScreen)->myNum) return FALSE; + if (dmxScreen->index == (*ppScreen)->myNum) + return FALSE; *ppScreen = screenInfo.screens[dmxScreen->index]; *x = globalX - dmxScreen->rootXOrigin; *y = globalY - dmxScreen->rootYOrigin; @@ -179,7 +182,12 @@ static void dmxCrossScreen(ScreenPtr pScreen, Bool entering) static void dmxWarpCursor(ScreenPtr pScreen, int x, int y) { DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y); +#if 11 /*BP*/ + /* This call is depracated. Replace with???? */ miPointerWarpCursor(pScreen, x, y); +#else + pScreen->SetCursorPosition(pScreen, x, y, FALSE); +#endif } miPointerScreenFuncRec dmxPointerCursorFuncs = @@ -187,7 +195,7 @@ miPointerScreenFuncRec dmxPointerCursorFuncs = dmxCursorOffScreen, dmxCrossScreen, dmxWarpCursor, - dmxeqEnqueue, + dmxeqEnqueue, /*XXX incompatible type/function! */ dmxeqSwitchScreen }; @@ -198,7 +206,8 @@ static int *dmxSLCreate(void) int *list = malloc(dmxNumScreens * sizeof(*list)); int i; - for (i = 0; i < dmxNumScreens; i++) list[i] = 1; + for (i = 0; i < dmxNumScreens; i++) + list[i] = 1; return list; } @@ -212,7 +221,9 @@ static void dmxSLFree(int *list) static int dmxSLFindNext(int *list) { int i; - for (i = 0; i < dmxNumScreens; i++) if (list[i]) return i; + for (i = 0; i < dmxNumScreens; i++) + if (list[i]) + return i; return -1; } @@ -225,7 +236,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) int changed = 0; for (i = 0; i < dmxNumScreens; i++) { - if (!screensLeft[i]) continue; + if (!screensLeft[i]) + continue; screen = &dmxScreens[i]; switch (screen->where) { case PosAbsolute: @@ -235,14 +247,16 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) break; case PosRelative: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->whereX; dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->whereY; ++changed, screensLeft[i] = 0; break; case PosRightOf: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; pScreen = screenInfo.screens[ref]; dixScreenOrigins[i].x = dixScreenOrigins[ref].x + pScreen->width; dixScreenOrigins[i].y = dixScreenOrigins[ref].y; @@ -250,7 +264,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) break; case PosLeftOf: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; pScreen = screenInfo.screens[i]; dixScreenOrigins[i].x = dixScreenOrigins[ref].x - pScreen->width; dixScreenOrigins[i].y = dixScreenOrigins[ref].y; @@ -258,7 +273,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) break; case PosBelow: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; pScreen = screenInfo.screens[ref]; dixScreenOrigins[i].x = dixScreenOrigins[ref].x; dixScreenOrigins[i].y = dixScreenOrigins[ref].y + pScreen->height; @@ -266,7 +282,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft) break; case PosAbove: ref = screen->whereRefScreen; - if (screensLeft[ref]) break; + if (screensLeft[ref]) + break; pScreen = screenInfo.screens[i]; dixScreenOrigins[i].x = dixScreenOrigins[ref].x; dixScreenOrigins[i].y = dixScreenOrigins[ref].y - pScreen->height; @@ -308,8 +325,10 @@ static void dmxComputeScreenOrigins(void) minX = dixScreenOrigins[0].x; minY = dixScreenOrigins[0].y; for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */ - if (dixScreenOrigins[i].x < minX) minX = dixScreenOrigins[i].x; - if (dixScreenOrigins[i].y < minY) minY = dixScreenOrigins[i].y; + if (dixScreenOrigins[i].x < minX) + minX = dixScreenOrigins[i].x; + if (dixScreenOrigins[i].y < minY) + minY = dixScreenOrigins[i].y; } if (minX || minY) { for (i = 0; i < dmxNumScreens; i++) { @@ -411,28 +430,36 @@ int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen) static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b) { if (dmxOnScreen(a->rootXOrigin, - a->rootYOrigin, b)) return 1; + a->rootYOrigin, b)) + return 1; if (dmxOnScreen(a->rootXOrigin, - a->rootYOrigin + a->scrnWidth, b)) return 1; + a->rootYOrigin + a->scrnWidth, b)) + return 1; if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, - a->rootYOrigin, b)) return 1; + a->rootYOrigin, b)) + return 1; if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, - a->rootYOrigin + a->scrnWidth, b)) return 1; + a->rootYOrigin + a->scrnWidth, b)) + return 1; if (dmxOnScreen(b->rootXOrigin, - b->rootYOrigin, a)) return 1; + b->rootYOrigin, a)) + return 1; if (dmxOnScreen(b->rootXOrigin, - b->rootYOrigin + b->scrnWidth, a)) return 1; + b->rootYOrigin + b->scrnWidth, a)) + return 1; if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, - b->rootYOrigin, a)) return 1; + b->rootYOrigin, a)) + return 1; if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, - b->rootYOrigin + b->scrnWidth, a)) return 1; + b->rootYOrigin + b->scrnWidth, a)) + return 1; return 0; } @@ -476,7 +503,8 @@ static void *dmxTestSameDisplay(DMXScreenInfo *a, void *closure) { DMXScreenInfo *b = closure; - if (a == b) return a; + if (a == b) + return a; return NULL; } @@ -489,14 +517,16 @@ void dmxInitOverlap(void) int i, j; DMXScreenInfo *a, *b, *pt; - for (i = 0; i < dmxNumScreens; i++) dmxScreens[i].over = NULL; + for (i = 0; i < dmxNumScreens; i++) + dmxScreens[i].over = NULL; for (i = 0; i < dmxNumScreens; i++) { a = &dmxScreens[i]; for (j = i+1; j < dmxNumScreens; j++) { b = &dmxScreens[j]; - if (b->over) continue; + if (b->over) + continue; if (dmxDoesOverlap(a, b)) { DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n", @@ -510,7 +540,8 @@ void dmxInitOverlap(void) for (i = 0; i < dmxNumScreens; i++) { a = &dmxScreens[i]; - if (!a->over) continue; + if (!a->over) + continue; /* Flag all pairs that are on same display */ for (pt = a->over; pt != a; pt = pt->over) { @@ -521,7 +552,8 @@ void dmxInitOverlap(void) * screens that mutually overlap on the backend display, * so we call dmxDoesOverlap, which is stricter than the * ->over set. */ - if (!dmxDoesOverlap(a, pt)) continue; + if (!dmxDoesOverlap(a, pt)) + continue; a->cursorNotShared = 1; pt->cursorNotShared = 1; dmxLog(dmxInfo, @@ -731,9 +763,11 @@ static Bool dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) return _dmxRealizeCursor(pScreen, pCursor); for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursorNotShared) continue; + if (pt->cursorNotShared) + continue; _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor); - if (pt == start) break; + if (pt == start) + break; } return TRUE; } @@ -747,9 +781,11 @@ static Bool dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) return _dmxUnrealizeCursor(pScreen, pCursor); for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursorNotShared) continue; + if (pt->cursorNotShared) + continue; _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor); - if (pt == start) break; + if (pt == start) + break; } return TRUE; } @@ -758,10 +794,13 @@ static CursorPtr dmxFindCursor(DMXScreenInfo *start) { DMXScreenInfo *pt; - if (!start || !start->over) return GetSpriteCursor(); + if (!start || !start->over) + return GetSpriteCursor(); for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursor) return pt->cursor; - if (pt == start) break; + if (pt->cursor) + return pt->cursor; + if (pt == start) + break; } return GetSpriteCursor(); } @@ -769,7 +808,12 @@ static CursorPtr dmxFindCursor(DMXScreenInfo *start) /** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This * function is usually called via #dmxPointerSpriteFuncs, except during * reconfiguration when the cursor is repositioned to force an update on - * newley overlapping screens and on screens that no longer overlap. */ + * newley overlapping screens and on screens that no longer overlap. + * + * The coords (x,y) are in global coord space. We'll loop over the + * back-end screens and see if they contain the global coord. If so, call + * _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen. + */ void dmxMoveCursor(ScreenPtr pScreen, int x, int y) { DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; @@ -783,7 +827,8 @@ void dmxMoveCursor(ScreenPtr pScreen, int x, int y) } for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursorNotShared) continue; + if (pt->cursorNotShared) + continue; if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { if (/* pt != start && */ !pt->cursorVisible) { if (!pt->cursor) { @@ -811,7 +856,8 @@ void dmxMoveCursor(ScreenPtr pScreen, int x, int y) x + start->rootXOrigin - pt->rootXOrigin, y + start->rootYOrigin - pt->rootYOrigin); } - if (pt == start) break; + if (pt == start) + break; } } @@ -843,7 +889,7 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) gx = start->rootXOrigin + x; gy = start->rootYOrigin + y; if (x && y && (GX != gx || GY != gy)) - dmxCoreMotion(gx, gy, 0, DMX_NO_BLOCK); + dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK); if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) { _dmxSetCursor(pScreen, pCursor, x, y); @@ -851,7 +897,8 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) } for (pt = start->over; /* condition at end of loop */; pt = pt->over) { - if (pt->cursorNotShared) continue; + if (pt->cursorNotShared) + continue; if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { _dmxSetCursor(screenInfo.screens[pt->index], pCursor, x + start->rootXOrigin - pt->rootXOrigin, @@ -861,7 +908,8 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) x + start->rootXOrigin - pt->rootXOrigin, y + start->rootYOrigin - pt->rootYOrigin); } - if (pt == start) break; + if (pt == start) + break; } } @@ -896,8 +944,13 @@ void dmxCheckCursor(void) pScreen = screenInfo.screens[dmxScreen->index]; if (!dmxOnScreen(x, y, dmxScreen)) { +#if 00 if (firstScreen && i == miPointerCurrentScreen()->myNum) miPointerSetNewScreen(firstScreen->index, x, y); +#else + if (firstScreen && i == miPointerGetScreen(inputInfo.pointer)->myNum) + miPointerSetScreen(inputInfo.pointer, firstScreen->index, x, y); +#endif _dmxSetCursor(pScreen, NULL, x - dmxScreen->rootXOrigin, y - dmxScreen->rootYOrigin); diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c index 37f458356..f47899c2f 100644 --- a/hw/dmx/dmxinput.c +++ b/hw/dmx/dmxinput.c @@ -49,6 +49,7 @@ #include "inputstr.h" #include "input.h" +#include "mi.h" /** Returns TRUE if the key is a valid modifier. For PC-class * keyboards, all keys can be used as modifiers, so return TRUE @@ -75,6 +76,8 @@ void InitInput(int argc, char **argv) dmxLog(dmxWarning, "Use keyboard/mouse pair with the first -input\n"); dmxLog(dmxFatal, "At least one core keyboard/mouse pair required\n"); } + + mieqInit(); } /** Called from dix/dispatch.c in Dispatch() whenever input events diff --git a/hw/dmx/dmxinput.h b/hw/dmx/dmxinput.h index 59fa823d3..3fb587086 100644 --- a/hw/dmx/dmxinput.h +++ b/hw/dmx/dmxinput.h @@ -154,7 +154,7 @@ typedef enum { extern void dmxGetGlobalPosition(int *x, int *y); extern DMXScreenInfo *dmxFindFirstScreen(int x, int y); -extern void dmxCoreMotion(int x, int y, int delta, +extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block); /* Support for dynamic addition of inputs. This functions is defined in diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c index 8985a1b1d..7efb2eebe 100644 --- a/hw/dmx/input/dmxbackend.c +++ b/hw/dmx/input/dmxbackend.c @@ -242,7 +242,11 @@ static int dmxBackendOffscreen(int screen, int x, int y) void dmxBackendUpdatePosition(pointer private, int x, int y) { GETPRIVFROMPRIVATE; +#if 00 /*BP*/ int screen = miPointerCurrentScreen()->myNum; +#else + int screen = miPointerGetScreen(inputInfo.pointer)->myNum; +#endif DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen]; int oldRelative = priv->relative; int topscreen = dmxBackendFindOverlapping(priv, screen, x, y); @@ -391,6 +395,7 @@ void dmxBackendCollectEvents(DevicePtr pDev, } break; case MotionNotify: +#if 001 /*BP*/ DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)" " newscreen=%d: %d %d (e=%d; last=%d,%d)\n", dmxScreen->index, priv->myScreen, @@ -443,12 +448,25 @@ void dmxBackendCollectEvents(DevicePtr pDev, (dmxScreen->rootYOrigin + X.xmotion.y - dmxScreen->rootY)); } +#else + /* + ErrorF("motion %d, %d, %d\n", + X.xmotion.x, X.xmotion.y, X.xmotion.state); + */ + enqueue(priv->mou, X.type, 0/*X.xbutton.button*/, 0, &X, block); +#endif break; case KeyPress: case KeyRelease: enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); break; +#if 11/*BP*/ + case ButtonPress: + case ButtonRelease: + ErrorF("press/release at %d, %d\n", X.xbutton.x, X.xbutton.y); + /* fall-through */ +#endif default: /* Pass the whole event here, because * this may be an extension event. */ diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 5316f0fdc..fae2049b3 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -56,6 +56,7 @@ #include "opaque.h" #include "inputstr.h" #include "mipointer.h" +#include "mi.h" #ifdef XINPUT #include "XIstubs.h" @@ -190,7 +191,135 @@ DMXScreenInfo *dmxFindFirstScreen(int x, int y) return NULL; } -void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) + +#if 11/*BP*/ + +static void enqueueMotion(DevicePtr pDev, int x, int y) +{ + GETDMXINPUTFROMPDEV; + DeviceIntPtr p = dmxLocal->pDevice; + int i, nevents, valuators[3]; + xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + int detail = 0; + + valuators[0] = x; + valuators[1] = y; + valuators[2] = detail; + nevents = GetPointerEvents(events, + /*pDev*/p, + MotionNotify, + detail, + POINTER_ABSOLUTE, + 0, 2, valuators); + ErrorF("MOTION2 %d, %d n = %d\n", valuators[0], valuators[1], nevents); + /* + ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n", + detail, e->xmotion.state, + valuators[0], valuators[1], valuators[2], + nevents); + */ + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; +} + + +static void +dmxCoreMotion2(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) +{ + DMXScreenInfo *dmxScreen; + DMXInputInfo *dmxInput; + ScreenPtr pScreen; + int localX; + int localY; + int i; + + if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return; + + DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", + x, y, delta, dmxGlobalX, dmxGlobalY); + + dmxGlobalInvalid = 0; + dmxGlobalX = x; + dmxGlobalY = y; + + if (dmxGlobalX < 0) dmxGlobalX = 0; + if (dmxGlobalY < 0) dmxGlobalY = 0; + if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; + if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; + + ErrorF("Global Pos: %d, %d\n", dmxGlobalX, dmxGlobalY); + + if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { + localX = dmxGlobalX - dmxScreen->rootXOrigin; + localY = dmxGlobalY - dmxScreen->rootYOrigin; + if ((pScreen = miPointerGetScreen(inputInfo.pointer)) + && pScreen->myNum == dmxScreen->index) { + /* Screen is old screen */ + if (block) + dmxSigioBlock(); +#if 000 + miPointerSetPosition(inputInfo.pointer, &localX, &localY, + GetTimeInMillis()); +#else + if (pDev) + enqueueMotion(pDev, localX, localY); +#endif + if (block) + dmxSigioUnblock(); + } else { + /* Screen is new */ + DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n", + pScreen->myNum, dmxScreen->index, localX, localY); + if (block) + dmxSigioBlock(); + dmxeqProcessInputEvents(); + miPointerSetScreen(inputInfo.pointer, dmxScreen->index, + localX, localY); +#if 000 + miPointerSetPosition(inputInfo.pointer, &localX, &localY, + GetTimeInMillis()); +#else + if (pDev) + enqueueMotion(pDev, localX, localY); +#endif + if (block) + dmxSigioUnblock(); + } +#if 00 + miPointerGetPosition(inputInfo.pointer, &localX, &localY); + + if ((pScreen = miPointerGetScreen(inputInfo.pointer))) { + dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; + dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; + ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY, + localX, localY); + DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" + " on screen index=%d/%d localX=%d localY=%d\n", + dmxGlobalX, dmxGlobalY, + dmxScreen ? dmxScreen->index : -1, pScreen->myNum, + localX, localY); + } +#endif + } + /* Send updates down to all core input + * drivers */ + for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { + int j; + + for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding) + if (!dmxInput->detached + && dmxInput->devs[j]->sendsCore + && dmxInput->devs[j]->update_position) + dmxInput->devs[j]->update_position(dmxInput->devs[j]->private, + dmxGlobalX, dmxGlobalY); + } + if (!dmxScreen) ProcessInputEvents(); +} +#endif + +void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) { DMXScreenInfo *dmxScreen; DMXInputInfo *dmxInput; @@ -199,6 +328,11 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) int localY; int i; +#if 11/*BP*/ + dmxCoreMotion2(pDev, x, y, delta, block); + return; +#endif + if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return; DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", @@ -213,14 +347,25 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; + ErrorF("Global Pos: %d, %d\n", dmxGlobalX, dmxGlobalY); + if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { localX = dmxGlobalX - dmxScreen->rootXOrigin; localY = dmxGlobalY - dmxScreen->rootYOrigin; +#if 00 /*BP*/ if ((pScreen = miPointerCurrentScreen()) +#else + if ((pScreen = miPointerGetScreen(inputInfo.pointer)) +#endif && pScreen->myNum == dmxScreen->index) { /* Screen is old screen */ if (block) dmxSigioBlock(); +#if 00 /*BP*/ miPointerAbsoluteCursor(localX, localY, GetTimeInMillis()); +#else + miPointerSetPosition(inputInfo.pointer, &localX, &localY, + GetTimeInMillis()); +#endif if (block) dmxSigioUnblock(); } else { /* Screen is new */ @@ -228,15 +373,31 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) pScreen->myNum, dmxScreen->index, localX, localY); if (block) dmxSigioBlock(); dmxeqProcessInputEvents(); +#if 00 /*BP*/ miPointerSetNewScreen(dmxScreen->index, localX, localY); miPointerAbsoluteCursor(localX, localY, GetTimeInMillis()); +#else + miPointerSetScreen(inputInfo.pointer, dmxScreen->index, + localX, localY); + miPointerSetPosition(inputInfo.pointer, &localX, &localY, + GetTimeInMillis()); +#endif if (block) dmxSigioUnblock(); } +#if 00 /*BP*/ miPointerPosition(&localX, &localY); +#else + miPointerGetPosition(inputInfo.pointer, &localX, &localY); +#endif +#if 00 /*BP*/ if ((pScreen = miPointerCurrentScreen())) { +#else + if ((pScreen = miPointerGetScreen(inputInfo.pointer))) { +#endif dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; + ErrorF("Global is now %d, %d\n", dmxGlobalX, dmxGlobalY); DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" " on screen index=%d/%d localX=%d localY=%d\n", dmxGlobalX, dmxGlobalY, @@ -259,6 +420,8 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block) if (!dmxScreen) ProcessInputEvents(); } + + #ifdef XINPUT #define DMX_MAX_AXES 32 /* Max axes reported by this routine */ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, @@ -508,12 +671,18 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount, return; } #endif - if (axesCount == 2) switch (type) { - case DMX_RELATIVE: dmxCoreMotion(dmxGlobalX - v[0], - dmxGlobalY - v[1], - 0, block); break; - case DMX_ABSOLUTE: dmxCoreMotion(v[0], v[1], 0, block); break; - case DMX_ABSOLUTE_CONFINED: dmxCoreMotion(v[0], v[1], -1, block); break; + if (axesCount == 2) { + switch (type) { + case DMX_RELATIVE: + dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block); + break; + case DMX_ABSOLUTE: + dmxCoreMotion(pDev, v[0], v[1], 0, block); + break; + case DMX_ABSOLUTE_CONFINED: + dmxCoreMotion(pDev, v[0], v[1], -1, block); + break; + } } } @@ -604,16 +773,90 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, return; if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) xE.u.u.detail = dmxFixup(pDev, detail, keySym); +#if 11/*BP*/ + { + DeviceIntPtr p = dmxLocal->pDevice; + int i, nevents; + xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + nevents = GetKeyboardEvents(events, + /*pDev*/p, + /*KeyPress*/type, + /*n*/detail); + ErrorF("KEY %d n=%d\n", detail, nevents); + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; + } +#endif break; case ButtonPress: case ButtonRelease: +#if 00 /*BP*/ detail = dmxGetButtonMapping(dmxLocal, detail); +#else + { + DeviceIntPtr p = dmxLocal->pDevice; + int i, nevents, valuators[3]; + xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + + valuators[0] = e->xbutton.x; + valuators[1] = e->xbutton.y; + /* + valuators[0] = dmxGlobalX; + valuators[1] = dmxGlobalY; + */ + valuators[2] = e->xbutton.button; + nevents = GetPointerEvents(events, + /*pDev*/p, + /*KeyPress*/type, + detail, + POINTER_ABSOLUTE, + 0, 2/*3*/, valuators); + + ErrorF("BUTTON %d, %d %d n=%d\n", + valuators[0], valuators[1], valuators[2], nevents); + + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; + } +#endif break; case MotionNotify: /* All MotionNotify events should be sent via dmxCoreMotion and * dmxExtMotion -- no input driver should build motion events by * hand. */ +#if 00 /*BP*/ dmxLog(dmxError, "dmxEnqueueXEvent: MotionNotify not allowed here\n"); +#else + { + DeviceIntPtr p = dmxLocal->pDevice; + int i, nevents, valuators[3]; + xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + valuators[0] = e->xmotion.x; + valuators[1] = e->xmotion.y; + valuators[2] = e->xmotion.state; + nevents = GetPointerEvents(events, + /*pDev*/p, + /*KeyPress*/type, + detail, + POINTER_ABSOLUTE, + 0, 3, valuators); + ErrorF("MOTION %d, %d n = %d\n", valuators[0], valuators[1], nevents); + /* + ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n", + detail, e->xmotion.state, + valuators[0], valuators[1], valuators[2], + nevents); + */ + for (i = 0; i < nevents; i++) + mieqEnqueue(p, events + i); + xfree(events); + return; + } +#endif break; /* Always ignore these events */ case EnterNotify: @@ -623,6 +866,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, * modifier map on the backend/console * input device so that we have complete * control of the input device LEDs. */ + ErrorF("Enter/Leave/Keymap/Mapping\n"); return; default: #ifdef XINPUT @@ -652,7 +896,16 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, if (!dmxLocal->sendsCore) dmxEnqueueExtEvent(dmxLocal, &xE, block); else #endif +#if 00 /*BP*/ dmxeqEnqueue(&xE); +#else + /* never get here! */ + if (0) { + DeviceIntPtr p = dmxLocal->pDevice; + ErrorF("enque %d\n", type); + mieqEnqueue(p, &xE); + } +#endif } /** A pointer to this routine is passed to low-level input drivers so diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index 0519d2b72..cf680517f 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -72,6 +72,7 @@ #include "input.h" #include "mipointer.h" #include "windowstr.h" +#include "mi.h" #ifdef XINPUT #include <X11/extensions/XI.h> @@ -222,6 +223,57 @@ static DMXLocalInputInfoRec DMXLocalDevices[] = { { NULL } /* Must be last */ }; + +#if 11 /*BP*/ +void +DDXRingBell(int volume, int pitch, int duration) +{ + /* NO-OP */ +} + +/* taken from kdrive/src/kinput.c: */ +static void +dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) +{ +#if 0 + KdKeyboardInfo *ki; + + for (ki = kdKeyboards; ki; ki = ki->next) { + if (ki->dixdev && ki->dixdev->id == pDevice->id) + break; + } + + if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver) + return; + + KdSetLeds(ki, ctrl->leds); + ki->bellPitch = ctrl->bell_pitch; + ki->bellDuration = ctrl->bell_duration; +#endif +} + +/* taken from kdrive/src/kinput.c: */ +static void +dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something) +{ +#if 0 + KeybdCtrl *ctrl = arg; + KdKeyboardInfo *ki = NULL; + + for (ki = kdKeyboards; ki; ki = ki->next) { + if (ki->dixdev && ki->dixdev->id == pDev->id) + break; + } + + if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver) + return; + + KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration); +#endif +} + +#endif /*BP*/ + static void _dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal, PtrCtrl *ctrl) { @@ -420,14 +472,24 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) memset(&info, 0, sizeof(info)); switch (what) { case DEVICE_INIT: - if (dmxLocal->init) dmxLocal->init(pDev); - if (dmxLocal->get_info) dmxLocal->get_info(pDev, &info); + if (dmxLocal->init) + dmxLocal->init(pDev); + if (dmxLocal->get_info) + dmxLocal->get_info(pDev, &info); if (info.keyboard) { /* XKEYBOARD makes this a special case */ dmxKeyboardOn(pDevice, &info); break; } if (info.keyClass) { +#if 00 /*BP*/ InitKeyClassDeviceStruct(pDevice, &info.keySyms, info.modMap); +#else + DevicePtr pDev = (DevicePtr) pDevice; + InitKeyboardDeviceStruct(pDev, + &info.keySyms, + info.modMap, + dmxBell, dmxKbdCtrl); +#endif } if (info.buttonClass) { InitButtonClassDeviceStruct(pDevice, info.numButtons, info.map); @@ -435,13 +497,19 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) if (info.valuatorClass) { if (info.numRelAxes && dmxLocal->sendsCore) { InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, +#if 00 /*BP*/ miPointerGetMotionEvents, miPointerGetMotionBufferSize(), +#else + GetMotionHistory, + GetMaximumEventsNum(), +#endif Relative); + ErrorF("MOTION BUFFER SIZE %d\n", GetMaximumEventsNum()); #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - info.maxval[0], info.res[0], + 1280/*info.maxval[0]*/, info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numRelAxes) { @@ -452,7 +520,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numRelAxes; i++) InitValuatorAxisStruct(pDevice, i, info.minval[0], - info.maxval[0], info.res[0], + 1280/*info.maxval[0]*/, info.res[0], info.minres[0], info.maxres[0]); #endif } else if (info.numAbsAxes) { @@ -463,7 +531,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what) #ifdef XINPUT for (i = 0; i < info.numAbsAxes; i++) InitValuatorAxisStruct(pDevice, i+info.numRelAxes, - info.minval[i+1], info.maxval[i+1], + info.minval[i+1], 1280/*info.maxval[i+1]*/, info.res[i+1], info.minres[i+1], info.maxres[i+1]); #endif @@ -520,12 +588,27 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput) { int i; + /* + ErrorF("%s\n", __FUNCTION__); + */ + dmxeqProcessInputEvents(); +#if 00 /*BP*/ miPointerUpdate(); - if (dmxInput->detached) return; +#endif + if (dmxInput->detached) + return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->process_input) + if (dmxInput->devs[i]->process_input) { +#if 11 /*BP*/ + miPointerUpdateSprite(dmxInput->devs[i]->pDevice); +#endif dmxInput->devs[i]->process_input(dmxInput->devs[i]->private); + } + +#if 11 /*BP*/ + mieqProcessInputEvents(); +#endif } static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput, @@ -553,7 +636,8 @@ static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput, } #endif - if (dmxInput->detached) return; + if (dmxInput->detached) + return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->update_info) dmxInput->devs[i]->update_info(dmxInput->devs[i]->private, @@ -564,7 +648,8 @@ static void dmxCollectAll(DMXInputInfo *dmxInput) { int i; - if (dmxInput->detached) return; + if (dmxInput->detached) + return; for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) if (dmxInput->devs[i]->collect_events) dmxInput->devs[i]->collect_events(&dmxInput->devs[i] @@ -661,7 +746,8 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal) char *devname; DMXInputInfo *dmxInput; - if (!dmxLocal) return NULL; + if (!dmxLocal) + return NULL; dmxInput = &dmxInputs[dmxLocal->inputIdx]; if (dmxLocal->sendsCore) { @@ -710,8 +796,13 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal) registerProcPtr(pDevice); - if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) + if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) { +#if 00 /*BP*/ miRegisterPointerDevice(screenInfo.screens[0], pDevice); +#else + /* Nothing? dmxDeviceOnOff() should get called to init, right? */ +#endif + } if (dmxLocal->create_private) dmxLocal->private = dmxLocal->create_private(pDevice); diff --git a/hw/dmx/input/dmxxinput.c b/hw/dmx/input/dmxxinput.c index 81d1cfbe6..ad2a77c9c 100644 --- a/hw/dmx/input/dmxxinput.c +++ b/hw/dmx/input/dmxxinput.c @@ -99,9 +99,13 @@ int ChangePointerDevice(DeviceIntPtr old_dev, } dmxLocalNew->savedMotionProc = new_dev->valuator->GetMotionProc; dmxLocalNew->savedMotionEvents = new_dev->valuator->numMotionEvents; +#if 00 /*BP*/ new_dev->valuator->GetMotionProc = miPointerGetMotionEvents; new_dev->valuator->numMotionEvents = miPointerGetMotionBufferSize(); - +#else + new_dev->valuator->GetMotionProc = GetMotionHistory; + new_dev->valuator->numMotionEvents = GetMaximumEventsNum(); +#endif /* Switch our notion of core pointer */ dmxLocalOld->isCore = 0; dmxLocalOld->sendsCore = dmxLocalOld->savedSendsCore; diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c index 97cc3077e..b09492b89 100644 --- a/hw/dmx/input/lnx-keyboard.c +++ b/hw/dmx/input/lnx-keyboard.c @@ -164,7 +164,9 @@ #include <sys/kd.h> #include <termios.h> #include "atKeynames.h" +#if 00 #include "xf86Keymap.h" +#endif #include <linux/keyboard.h> #define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) @@ -800,7 +802,12 @@ static void kbdLinuxReadKernelMapping(int fd, KeySymsPtr pKeySyms) tbl[2] = 8; /* alt */ tbl[3] = tbl[2] | 1; +#if 00/*BP*/ k = map+GLYPHS_PER_KEY; +#else + ErrorF("kbdLinuxReadKernelMapping() is broken/no-op'd\n"); + return; +#endif maxkey = NUM_AT2LNX; for (i = 0; i < maxkey; ++i) { @@ -927,8 +934,13 @@ static void kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) char type; int i; +#if 00/*BP*/ mapCopy = xalloc(sizeof(map)); memcpy(mapCopy, map, sizeof(map)); +#else + ErrorF("kbdLinuxGetMap() is broken/no-op'd\n"); + return; +#endif kbdLinuxReadKernelMapping(priv->fd, pKeySyms); diff --git a/hw/kdrive/ati/ati_dma.c b/hw/kdrive/ati/ati_dma.c index f75ff12e7..70b86d36c 100644 --- a/hw/kdrive/ati/ati_dma.c +++ b/hw/kdrive/ati/ati_dma.c @@ -788,7 +788,7 @@ ATIPseudoDMAInit(ScreenPtr pScreen) atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & R200_CSQ_CNT_PRIMARY_MASK; MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN); - } if (atic->is_radeon) { + } else if (atic->is_radeon) { MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL, RADEON_CSQ_PRIPIO_INDDIS); atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 8310f6590..4a212e304 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -81,7 +81,7 @@ ddxUseMsg (void) ErrorF("-host-cursor Re-use exisiting X host server cursor\n"); ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n"); ErrorF("-grayscale Simulate 8bit grayscale\n"); - ErrorF("-fakexa Simulate acceleration using software rendering\n"); + ErrorF("-fakexa Simulate acceleration using software rendering\n"); ErrorF("\n"); exit(1); diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 23fede246..20440dc2c 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -42,7 +42,7 @@ #endif #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #include <X11/extensions/XI.h> diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 7617bf78a..9740b0732 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1791,6 +1791,15 @@ convertRange2Host(int entityIndex, resRange *pRange) } } +static void +xf86ConvertListToHost(int entityIndex, resPtr list) +{ + while (list) { + convertRange2Host(entityIndex, &list->val); + list = list->next; + } +} + /* * xf86RegisterResources() -- attempts to register listed resources. * If list is NULL it tries to obtain resources implicitly. Function @@ -2836,18 +2845,7 @@ xf86IsSubsetOf(resRange range, resPtr list) return ret; } -Bool -xf86IsListSubsetOf(resPtr list, resPtr BaseList) -{ - while (list) { - if (! xf86IsSubsetOf(list->val,BaseList)) - return FALSE; - list = list->next; - } - return TRUE; -} - -resPtr +static resPtr findIntersect(resRange Range, resPtr list) { resRange range; @@ -3071,15 +3069,6 @@ xf86NoSharedResources(int screenIndex,resType res) return TRUE; } -void -xf86ConvertListToHost(int entityIndex, resPtr list) -{ - while (list) { - convertRange2Host(entityIndex, &list->val); - list = list->next; - } -} - _X_EXPORT void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg) { diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h index b638e9026..8d7195994 100644 --- a/hw/xfree86/common/xf86Bus.h +++ b/hw/xfree86/common/xf86Bus.h @@ -141,12 +141,9 @@ int xf86AllocateEntity(void); BusType StringToBusType(const char* busID, const char **retID); memType ChkConflict(resRange *rgp, resPtr res, xf86State state); Bool xf86IsSubsetOf(resRange range, resPtr list); -Bool xf86IsListSubsetOf(resPtr list, resPtr BaseList); resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type); -resPtr findIntersect(resRange Range, resPtr list); resPtr xf86FindIntersect(resRange Range, resPtr list); void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated); -void xf86ConvertListToHost(int entityIndex, resPtr list); #endif /* _XF86_BUS_H */ diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 2981e173c..66e6b055b 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -75,7 +75,7 @@ extern DeviceAssocRec mouse_assoc; #ifdef XKB #undef XKB_IN_SERVER #define XKB_IN_SERVER -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef RENDER @@ -538,25 +538,6 @@ xf86DriverlistFromCompile(void) return driverlist; } - -char ** -xf86InputDriverlistFromCompile(void) -{ - static char **driverlist = NULL; - static Bool generated = FALSE; - - /* This string is modified in-place */ - static char drivernames[] = IDRIVERS; - - if (!generated) { - generated = TRUE; - driverlist = GenerateDriverlist("input", drivernames); - } - - return driverlist; -} - - /* * xf86ConfigError -- * Print a READABLE ErrorMessage!!! All information that is @@ -2502,17 +2483,8 @@ xf86HandleConfigFile(Bool autoconfig) return CONFIG_OK; } - -/* These make the equivalent parser functions visible to the common layer. */ -Bool -xf86PathIsAbsolute(const char *path) -{ - return (xf86pathIsAbsolute(path) != 0); -} - Bool xf86PathIsSafe(const char *path) { return (xf86pathIsSafe(path) != 0); } - diff --git a/hw/xfree86/common/xf86Config.h b/hw/xfree86/common/xf86Config.h index 0786ec6fe..3787ba21e 100644 --- a/hw/xfree86/common/xf86Config.h +++ b/hw/xfree86/common/xf86Config.h @@ -53,7 +53,6 @@ char ** xf86ModulelistFromConfig(pointer **); char ** xf86DriverlistFromConfig(void); char ** xf86DriverlistFromCompile(void); char ** xf86InputDriverlistFromConfig(void); -char ** xf86InputDriverlistFromCompile(void); Bool xf86BuiltinInputDriver(const char *); ConfigStatus xf86HandleConfigFile(Bool); diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index f71486c9d..4b482dfdc 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -68,7 +68,7 @@ static int nDevToConfig = 0, CurrentDriver; _X_EXPORT xf86MonPtr ConfiguredMonitor; Bool xf86DoConfigurePass1 = TRUE; -Bool foundMouse = FALSE; +static Bool foundMouse = FALSE; #if defined(__UNIXOS2__) #define DFLT_MOUSE_DEV "mouse$" diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 9a24040af..e588e9a8f 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -43,7 +43,7 @@ #include "servermd.h" #include "micmap.h" #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #include "xf86Xinput.h" @@ -51,11 +51,14 @@ static unsigned long DGAGeneration = 0; static int DGAScreenIndex = -1; +static int mieq_installed = 0; static Bool DGACloseScreen(int i, ScreenPtr pScreen); static void DGADestroyColormap(ColormapPtr pmap); static void DGAInstallColormap(ColormapPtr pmap); static void DGAUninstallColormap(ColormapPtr pmap); +static void DGAHandleEvent(int screen_num, xEvent *event, + DeviceIntPtr device, int nevents); static void DGACopyModeInfo( @@ -96,7 +99,6 @@ typedef struct { Bool grabKeyboard; } DGAScreenRec, *DGAScreenPtr; - _X_EXPORT Bool DGAInit( ScreenPtr pScreen, @@ -146,7 +148,6 @@ DGAInit( modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; #endif - pScreen->devPrivates[DGAScreenIndex].ptr = (pointer)pScreenPriv; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = DGACloseScreen; @@ -157,11 +158,6 @@ DGAInit( pScreenPriv->UninstallColormap = pScreen->UninstallColormap; pScreen->UninstallColormap = DGAUninstallColormap; - /* - * This is now set in InitOutput(). - * - pScrn->SetDGAMode = xf86SetDGAMode; - */ return TRUE; } @@ -247,12 +243,22 @@ FreeMarkedVisuals(ScreenPtr pScreen) } } - static Bool DGACloseScreen(int i, ScreenPtr pScreen) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + if (XDGAEventBase) { + OsBlockSignals(); + ProcessInputEvents(); + mieqSetHandler(*XDGAEventBase + MotionNotify, NULL); + mieqSetHandler(*XDGAEventBase + ButtonPress, NULL); + mieqSetHandler(*XDGAEventBase + ButtonRelease, NULL); + mieqSetHandler(*XDGAEventBase + KeyPress, NULL); + mieqSetHandler(*XDGAEventBase + KeyRelease, NULL); + OsReleaseSignals(); + } + FreeMarkedVisuals(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; @@ -462,6 +468,15 @@ DGASetInputMode(int index, Bool keyboard, Bool mouse) { pScreenPriv->grabMouse = mouse; pScreenPriv->grabKeyboard = keyboard; + + if (!mieq_installed) { + mieqSetHandler(*XDGAEventBase + MotionNotify, DGAHandleEvent); + mieqSetHandler(*XDGAEventBase + ButtonPress, DGAHandleEvent); + mieqSetHandler(*XDGAEventBase + ButtonRelease, DGAHandleEvent); + mieqSetHandler(*XDGAEventBase + KeyPress, DGAHandleEvent); + mieqSetHandler(*XDGAEventBase + KeyRelease, DGAHandleEvent); + mieq_installed = 1; + } } } @@ -903,21 +918,93 @@ DGAVTSwitch(void) return TRUE; } +Bool +DGAStealKeyEvent(int index, int key_code, int is_down) +{ + DGAScreenPtr pScreenPriv; + dgaEvent de; + + if(DGAScreenIndex < 0) /* no DGA */ + return FALSE; + + pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); -/* We have the power to steal or modify events that are about to get queued */ + if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */ + return FALSE; + + de.u.u.type = *XDGAEventBase + (is_down ? KeyPress : KeyRelease); + de.u.u.detail = key_code; + de.u.event.time = GetTimeInMillis(); + mieqEnqueue (inputInfo.keyboard, (xEvent *) &de); + + return TRUE; +} + +static int DGAMouseX, DGAMouseY; Bool -DGAStealKeyEvent(int index, xEvent *e) +DGAStealMotionEvent(int index, int dx, int dy) { -} + DGAScreenPtr pScreenPriv; + dgaEvent de; -static int DGAMouseX, DGAMouseY; + if(DGAScreenIndex < 0) /* no DGA */ + return FALSE; + + pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); + + if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */ + return FALSE; + + DGAMouseX += dx; + if (DGAMouseX < 0) + DGAMouseX = 0; + else if (DGAMouseX > screenInfo.screens[index]->width) + DGAMouseX = screenInfo.screens[index]->width; + DGAMouseY += dy; + if (DGAMouseY < 0) + DGAMouseY = 0; + else if (DGAMouseY > screenInfo.screens[index]->height) + DGAMouseY = screenInfo.screens[index]->height; + de.u.u.type = *XDGAEventBase + MotionNotify; + de.u.u.detail = 0; + de.u.event.time = GetTimeInMillis(); + de.u.event.dx = dx; + de.u.event.dy = dy; + de.u.event.pad1 = DGAMouseX; + de.u.event.pad2 = DGAMouseY; + mieqEnqueue (inputInfo.pointer, (xEvent *) &de); + return TRUE; +} Bool -DGAStealMouseEvent(int index, xEvent *e, int dx, int dy) +DGAStealButtonEvent(int index, int button, int is_down) { + DGAScreenPtr pScreenPriv; + dgaEvent de; + + if (DGAScreenIndex < 0) + return FALSE; + + pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); + + if (!pScreenPriv || !pScreenPriv->grabMouse) + return FALSE; + + de.u.u.type = *XDGAEventBase + (is_down ? ButtonPress : ButtonRelease); + de.u.u.detail = button; + de.u.event.time = GetTimeInMillis(); + de.u.event.dx = 0; + de.u.event.dy = 0; + de.u.event.pad1 = DGAMouseX; + de.u.event.pad2 = DGAMouseY; + mieqEnqueue (inputInfo.pointer, (xEvent *) &de); + + return TRUE; } +/* We have the power to steal or modify events that are about to get queued */ + Bool DGAIsDgaEvent (xEvent *e) { @@ -1128,39 +1215,6 @@ DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse) } } -Bool -DGADeliverEvent (ScreenPtr pScreen, xEvent *e) -{ - dgaEvent *de = (dgaEvent *) e; - DGAScreenPtr pScreenPriv; - int coreEquiv; - - /* no DGA */ - if (DGAScreenIndex < 0 || XDGAEventBase == 0) - return FALSE; - pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - - /* DGA not initialized on this screen */ - if (!pScreenPriv) - return FALSE; - - coreEquiv = de->u.u.type - *XDGAEventBase; - /* Not a DGA event */ - if (coreEquiv < KeyPress || coreEquiv > MotionNotify) - return FALSE; - - switch (coreEquiv) { - case KeyPress: - case KeyRelease: - DGAProcessKeyboardEvent (pScreen, de, inputInfo.keyboard); - break; - default: - DGAProcessPointerEvent (pScreen, de, inputInfo.pointer); - break; - } - return TRUE; -} - _X_EXPORT Bool DGAOpenFramebuffer( int index, @@ -1219,3 +1273,35 @@ DGAGetOldDGAMode(int index) return 0; } +static void +DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents) +{ + dgaEvent *de = (dgaEvent *) event; + ScreenPtr pScreen = screenInfo.screens[screen_num]; + DGAScreenPtr pScreenPriv; + int coreEquiv; + + /* no DGA */ + if (DGAScreenIndex < 0 || XDGAEventBase == 0) + return; + pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); + + /* DGA not initialized on this screen */ + if (!pScreenPriv) + return; + + coreEquiv = de->u.u.type - *XDGAEventBase; + /* Not a DGA event; shouldn't happen, but you never know. */ + if (coreEquiv < KeyPress || coreEquiv > MotionNotify) + return; + + switch (coreEquiv) { + case KeyPress: + case KeyRelease: + DGAProcessKeyboardEvent (pScreen, de, inputInfo.keyboard); + break; + default: + DGAProcessPointerEvent (pScreen, de, inputInfo.pointer); + break; + } +} diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index a91f6b34e..84588996d 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -126,9 +126,9 @@ extern Bool noXkbExtension; */ #ifdef USE_VT_SYSREQ -Bool VTSysreqToggle = FALSE; +static Bool VTSysreqToggle = FALSE; #endif /* !USE_VT_SYSREQ */ -Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for +_X_EXPORT Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for *BSD and for avoiding VT switches when using the DRI automatic full screen mode.*/ diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index 9b23710bb..b41fe6e5f 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -146,7 +146,6 @@ _X_EXPORT confDRIRec xf86ConfigDRI = {0, }; XF86ConfigPtr xf86configptr = NULL; Bool xf86Resetting = FALSE; Bool xf86Initialising = FALSE; -Bool xf86ProbeFailed = FALSE; Bool xf86DoProbe = FALSE; Bool xf86DoConfigure = FALSE; DriverPtr *xf86DriverList = NULL; diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 93c89fd5f..913735bc9 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -2981,3 +2981,16 @@ xf86IsUnblank(int mode) return TRUE; } } + +_X_EXPORT void +xf86MotionHistoryAllocate(LocalDevicePtr local) +{ + AllocateMotionHistory(local->dev); +} + +_X_EXPORT int +xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start, + unsigned long stop, ScreenPtr pScreen) +{ + return GetMotionHistory(pDev, buff, start, stop, pScreen); +} diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 281183960..8e644c433 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -84,7 +84,7 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 2) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(2, 0) #define ABI_XINPUT_VERSION SET_ABI_VERSION(1, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 5) diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 9279dbd7b..59ce8da86 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -100,7 +100,6 @@ extern int xf86NumModuleInfos; extern int xf86NumDrivers; extern Bool xf86Resetting; extern Bool xf86Initialising; -extern Bool xf86ProbeFailed; extern int xf86NumScreens; extern pciVideoPtr *xf86PciVideoInfo; extern xf86CurrentAccessRec xf86CurrentAccess; @@ -155,7 +154,6 @@ extern int pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag); /* xf86Config.c */ -Bool xf86PathIsAbsolute(const char *path); Bool xf86PathIsSafe(const char *path); /* xf86DefaultModes */ diff --git a/hw/xfree86/common/xf86XKB.c b/hw/xfree86/common/xf86XKB.c index 399eb02d9..b805885bd 100644 --- a/hw/xfree86/common/xf86XKB.c +++ b/hw/xfree86/common/xf86XKB.c @@ -73,7 +73,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define XF86_OS_PRIVS #include "xf86_OSlib.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> void xf86InitXkb(void) diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 2c740018c..cc98a0cb2 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -99,6 +99,10 @@ #include "mi.h" +#ifdef XFreeXDGA +#include "dgaproc.h" +#endif + xEvent *xf86Events = NULL; static Bool @@ -142,6 +146,9 @@ xf86ProcessCommonOptions(LocalDevicePtr local, } else { xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name); } + + /* Backwards compatibility. */ + local->history_size = GetMotionHistorySize(); } /*********************************************************************** @@ -440,10 +447,12 @@ xf86PostMotionEvent(DeviceIntPtr device, { va_list var; int i = 0, nevents = 0; + int dx, dy; Bool drag = xf86SendDragEvents(device); int *valuators = NULL; int flags = 0; xEvent *xE = NULL; + int index; if (is_absolute) flags = POINTER_ABSOLUTE; @@ -457,6 +466,24 @@ xf86PostMotionEvent(DeviceIntPtr device, valuators[i] = va_arg(var, int); va_end(var); +#if XFreeXDGA + if (first_valuator == 0 && num_valuators >= 2) { + if (miPointerGetScreen(inputInfo.pointer)) { + index = miPointerGetScreen(inputInfo.pointer)->myNum; + if (is_absolute) { + dx = valuators[0] - device->valuator->lastx; + dy = valuators[1] - device->valuator->lasty; + } + else { + dx = valuators[0]; + dy = valuators[1]; + } + if (DGAStealMotionEvent(index, dx, dy)) + goto out; + } + } +#endif + if (!xf86Events) xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); if (!xf86Events) @@ -475,6 +502,7 @@ xf86PostMotionEvent(DeviceIntPtr device, } } +out: xfree(valuators); } @@ -521,13 +549,15 @@ xf86PostButtonEvent(DeviceIntPtr device, va_list var; int *valuators = NULL; int i = 0, nevents = 0; - int flags = 0; - - if (is_absolute) - flags = POINTER_ABSOLUTE; - else - flags = POINTER_RELATIVE; + int index; +#if XFreeXDGA + if (miPointerGetScreen(inputInfo.pointer)) { + index = miPointerGetScreen(inputInfo.pointer)->myNum; + if (DGAStealButtonEvent(index, button, is_down)) + return; + } +#endif valuators = xcalloc(sizeof(int), num_valuators); va_start(var, num_valuators); @@ -542,7 +572,7 @@ xf86PostButtonEvent(DeviceIntPtr device, nevents = GetPointerEvents(xf86Events, device, is_down ? ButtonPress : ButtonRelease, button, - flags, + (is_absolute) ? POINTER_ABSOLUTE : POINTER_RELATIVE, first_valuator, num_valuators, valuators); for (i = 0; i < nevents; i++) @@ -602,6 +632,15 @@ xf86PostKeyboardEvent(DeviceIntPtr device, int is_down) { int nevents = 0, i = 0; + int index; + +#if XFreeXDGA + if (miPointerGetScreen(inputInfo.pointer)) { + index = miPointerGetScreen(inputInfo.pointer)->myNum; + if (DGAStealKeyEvent(index, key_code, is_down)) + return; + } +#endif if (!xf86Events) xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h index 4eaf8fc6d..60f9ec337 100644 --- a/hw/xfree86/common/xf86Xinput.h +++ b/hw/xfree86/common/xf86Xinput.h @@ -87,6 +87,9 @@ #define XI_PRIVATE(dev) \ (((LocalDevicePtr)((dev)->public.devicePrivate))->private) +/* Stupid API backwards-compatibility. */ +#define TS_Raw 60 +#define TS_Scaled 61 #ifdef XINPUT /* This holds the input driver entry and module information. */ @@ -145,6 +148,7 @@ typedef struct _LocalDeviceRec { InputDriverPtr drv; pointer module; pointer options; + unsigned int history_size; } LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr; typedef struct _DeviceAssocRec @@ -192,6 +196,10 @@ InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags); InputDriverPtr xf86LookupInputDriver(const char *name); InputInfoPtr xf86LookupInput(const char *name); void xf86DeleteInput(InputInfoPtr pInp, int flags); +void xf86MotionHistoryAllocate(LocalDevicePtr local); +int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff, + unsigned long start, unsigned long stop, + ScreenPtr pScreen); /* xf86Option.c */ void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts, diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index 3e908b86a..2b097d2db 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -110,7 +110,7 @@ static void xf86XVAdjustFrame(int index, int x, int y, int flags); static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int); -int XF86XVWindowIndex = -1; +static int XF86XVWindowIndex = -1; int XF86XvScreenIndex = -1; static unsigned long XF86XVGeneration = 0; static unsigned long PortResource = 0; diff --git a/hw/xfree86/ddc/edid_modes.c b/hw/xfree86/ddc/edid_modes.c index cfc8ddc13..926bc8921 100644 --- a/hw/xfree86/ddc/edid_modes.c +++ b/hw/xfree86/ddc/edid_modes.c @@ -107,6 +107,19 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, { DisplayModePtr Mode; + /* + * Refuse to create modes that are insufficiently large. 64 is a random + * number, maybe the spec says something about what the minimum is. In + * particular I see this frequently with _old_ EDID, 1.0 or so, so maybe + * our parser is just being too aggresive there. + */ + if (timing->h_active < 64 || timing->v_active < 64) { + xf86DrvMsg(scrnIndex, X_INFO, + "%s: Ignoring tiny %dx%d mode\n", __func__, + timing->h_active, timing->v_active); + return NULL; + } + /* We don't do stereo */ if (timing->stereo) { xf86DrvMsg(scrnIndex, X_INFO, diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index 4ce585c9f..21984bc04 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -15,52 +15,6 @@ static const OptionInfoRec *DDCAvailableOptions(void *unused); -#if DDC_MODULE - -static MODULESETUPPROTO(ddcSetup); - -static XF86ModuleVersionInfo ddcVersRec = -{ - "ddc", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -_X_EXPORT XF86ModuleData ddcModuleData = { &ddcVersRec, ddcSetup, NULL }; - -ModuleInfoRec DDC = { - 1, - "DDC", - NULL, - 0, - DDCAvailableOptions, -}; - -static pointer -ddcSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - - if (!setupDone) { - setupDone = TRUE; - xf86AddModuleInfo(&DDC, module); - } - /* - * The return value must be non-NULL on success even though there - * is no TearDownProc. - */ - return (pointer)1; -} - -#endif - #define RETRIES 4 static unsigned char *EDIDRead_DDC1( @@ -337,6 +291,12 @@ DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len) unsigned char *R_Buffer; int i; + /* + * Slow down the bus so that older monitors don't + * miss things. + */ + pBus->RiseFallTime = 20; + if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) { dev = xf86CreateI2CDevRec(); dev->DevName = "ddc2"; @@ -344,7 +304,6 @@ DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len) dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */ dev->StartTimeout = 550; dev->BitTimeout = 40; - dev->ByteTimeout = 40; dev->AcknTimeout = 40; dev->pI2CBus = pBus; diff --git a/hw/xfree86/dixmods/extmod/dgaproc.h b/hw/xfree86/dixmods/extmod/dgaproc.h index 5e424afb2..aaea4e20c 100644 --- a/hw/xfree86/dixmods/extmod/dgaproc.h +++ b/hw/xfree86/dixmods/extmod/dgaproc.h @@ -120,8 +120,9 @@ int DGAGetOldDGAMode(int Index); int DGAGetModeInfo(int Index, XDGAModePtr mode, int num); Bool DGAVTSwitch(void); -Bool DGAStealMouseEvent(int Index, xEvent *e, int dx, int dy); -Bool DGAStealKeyEvent(int Index, xEvent *e); +Bool DGAStealButtonEvent(int Index, int button, int is_down); +Bool DGAStealMotionEvent(int Index, int dx, int dy); +Bool DGAStealKeyEvent(int Index, int key_code, int is_down); Bool DGAIsDgaEvent (xEvent *e); Bool DGADeliverEvent (ScreenPtr pScreen, xEvent *e); diff --git a/hw/xfree86/dixmods/glxmodule.c b/hw/xfree86/dixmods/glxmodule.c index 401707abc..5384f434b 100644 --- a/hw/xfree86/dixmods/glxmodule.c +++ b/hw/xfree86/dixmods/glxmodule.c @@ -95,8 +95,8 @@ __glXMesaProxyScreenProbe(ScreenPtr pScreen) static __GLXprovider *provider; if (provider == NULL) { - GLcore = LoadSubModuleLocal(glxModule, "GLcore", NULL, NULL, NULL, NULL, - NULL, NULL); + GLcore = LoadSubModule(glxModule, "GLcore", NULL, NULL, NULL, NULL, + NULL, NULL); if (GLcore == NULL) return NULL; diff --git a/hw/xfree86/dixmods/xkbKillSrv.c b/hw/xfree86/dixmods/xkbKillSrv.c index 415873ad0..b3399db4a 100644 --- a/hw/xfree86/dixmods/xkbKillSrv.c +++ b/hw/xfree86/dixmods/xkbKillSrv.c @@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #include "xf86.h" diff --git a/hw/xfree86/dixmods/xkbPrivate.c b/hw/xfree86/dixmods/xkbPrivate.c index e6d4f0fc0..e0cd21739 100644 --- a/hw/xfree86/dixmods/xkbPrivate.c +++ b/hw/xfree86/dixmods/xkbPrivate.c @@ -12,7 +12,7 @@ #include <X11/X.h> #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "xf86.h" diff --git a/hw/xfree86/dixmods/xkbVT.c b/hw/xfree86/dixmods/xkbVT.c index a1cdc7016..e6d69e2eb 100644 --- a/hw/xfree86/dixmods/xkbVT.c +++ b/hw/xfree86/dixmods/xkbVT.c @@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #include "xf86.h" diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index bbba21112..cc60d0754 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -1004,12 +1004,22 @@ The .B Identifier entry specifies the unique name for this monitor. The .B Monitor -section provides information about the specifications of the monitor, -monitor-specific +section may be used to provide information about the specifications of the +monitor, monitor-specific .BR Options , -and information about the video modes to use with the monitor. Specifying -video modes is optional because the server now has a built-in list of -VESA standard modes. When modes are specified explicitly in the +and information about the video modes to use with the monitor. +.PP +With RandR 1.2-enabled drivers, monitor sections are tied to specific outputs +of the video card. Each output has a name, and the server will look for a +Monitor named +.B \*qMonitor-outputname\*q +for configuration of that output (for example, +.B \*qMonitor-VGA\*q +for a VGA output) +.PP +Specifying video modes is optional because the server will use the DDC or other +information provided by the monitor to automatically configure the list of +modes available. When modes are specified explicitly in the .B Monitor section (with the .BR Modes , @@ -1017,7 +1027,8 @@ section (with the or .B UseModes keywords), built-in modes with the same names are not included. Built-in -modes with different names are, however, still implicitly included. +modes with different names are, however, still implicitly included, when they +meet the requirements of the monitor. .PP The entries that may be used in .B Monitor @@ -1214,6 +1225,62 @@ monitors do not require it. The default is off. This optional entry specifies the vertical refresh rate that the server should aim for when selecting video modes. Without this option, the default is to prefer modes with higher refresh rates. +.TP 7 +.BI "Option " "\*qPreferredMode\*q " \*qstring\*q +This optional entry specifies a mode to be marked as the preferred initial mode +of the monitor. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qPosition\*q " "\*qx y\*q" +This optional entry specifies the position of the monitor within the X +screen. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qLeftOf\*q " \*qmonitor\*q +This optional entry specifies that the monitor should be positioned to the +left of the monitor of the given name. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qRightOf\*q " \*qmonitor\*q +This optional entry specifies that the monitor should be positioned to the +right of the monitor of the given name. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qAbove\*q " \*qmonitor\*q +This optional entry specifies that the monitor should be positioned above the +monitor of the given name. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qBelow\*q " \*qmonitor\*q +This optional entry specifies that the monitor should be positioned below the +monitor of the given name. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qEnable\*q " \*qbool\*q +This optional entry specifies whether the monitor should be turned on +at startup. By default, the server will attempt to enable all connected +monitors. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qMinClock\*q " \*qfrequency\*q +This optional entry specifies the minimum dot clock, in kHz, that is supported +by the monitor. +.TP 7 +.BI "Option " "\*qMaxClock\*q " \*qfrequency\*q +This optional entry specifies the maximum dot clock, in kHz, that is supported +by the monitor. +.TP 7 +.BI "Option " "\*qIgnore\*q " \*qbool\*q +This optional entry specifies that the monitor should be ignored entirely, +and not reported through RandR. This is useful if the hardware reports the +presence of outputs that don't exist. +(RandR 1.2-supporting drivers only) +.TP 7 +.BI "Option " "\*qRotate\*q " \*qrotation\*q +This optional entry specifies the initial rotation of the given monitor. +Valid values for rotation are \*qnormal\*q, \*qleft\*q, \*qright\*q, and +\*qinverted\*q. +(RandR 1.2-supporting drivers only) .SH MODES SECTION The config file may have multiple diff --git a/hw/xfree86/i2c/xf86i2cmodule.c b/hw/xfree86/i2c/xf86i2cmodule.c deleted file mode 100644 index 3c6d313c7..000000000 --- a/hw/xfree86/i2c/xf86i2cmodule.c +++ /dev/null @@ -1,36 +0,0 @@ -/* (c) Itai Nahshon - * - * This code is derived from and inspired by the I2C driver - * from the Linux kernel. - * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de> - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" - -static MODULESETUPPROTO(i2cSetup); - -static XF86ModuleVersionInfo i2cVersRec = -{ - "i2c", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 2, 0, - ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -_X_EXPORT XF86ModuleData i2cModuleData = { &i2cVersRec, i2cSetup, NULL }; - -static pointer -i2cSetup(pointer module, pointer opts, int *errmaj, int *errmin) { -/* ErrorF("i2cSetup\n"); */ - return (pointer)1; -} diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index 594bf4377..5d06b05c7 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -86,7 +86,7 @@ #endif #include "selection.h" #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval; #endif diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c index ddd624c2a..774a4c4a0 100644 --- a/hw/xfree86/loader/loader.c +++ b/hw/xfree86/loader/loader.c @@ -189,101 +189,6 @@ _LoaderListPop(int handle) return 0; } -/* - * _LoaderHandleToName() will return the name of the first module with a - * given handle. This requires getting the last module on the LIFO with - * the given handle. - */ -char * -_LoaderHandleToName(int handle) -{ - loaderPtr item = listHead; - loaderPtr aritem = NULL; - loaderPtr lastitem = NULL; - - if (handle < 0) { - return "(built-in)"; - } - while (item) { - if (item->handle == handle) { - if (strchr(item->name, ':') == NULL) - aritem = item; - else - lastitem = item; - } - item = item->next; - } - - if (aritem) - return aritem->name; - - if (lastitem) - return lastitem->name; - - return 0; -} - -/* - * _LoaderHandleToCanonicalName() will return the cname of the first module - * with a given handle. This requires getting the last module on the LIFO with - * the given handle. - */ -char * -_LoaderHandleToCanonicalName(int handle) -{ - loaderPtr item = listHead; - loaderPtr lastitem = NULL; - - if (handle < 0) { - return "(built-in)"; - } - while (item) { - if (item->handle == handle) { - lastitem = item; - } - item = item->next; - } - - if (lastitem) - return lastitem->cname; - - return NULL; -} - -/* - * _LoaderModuleToName() will return the name of the first module with a - * given handle. This requires getting the last module on the LIFO with - * the given handle. - */ -char * -_LoaderModuleToName(int module) -{ - loaderPtr item = listHead; - loaderPtr aritem = NULL; - loaderPtr lastitem = NULL; - - if (module < 0) { - return "(built-in)"; - } - while (item) { - if (item->module == module) { - if (strchr(item->name, ':') == NULL) - aritem = item; - else - lastitem = item; - } - item = item->next; - } - - if (aritem) - return aritem->name; - - if (lastitem) - return lastitem->name; - - return 0; -} - /* These four are just ABI stubs */ _X_EXPORT void LoaderRefSymbols(const char *sym0, ...) @@ -450,35 +355,14 @@ LoaderUnload(int handle) return 0; } -void -LoaderDuplicateSymbol(const char *symbol, const int handle) -{ - ErrorF("Duplicate symbol %s in %s\n", symbol, - listHead ? listHead->name : "(built-in)"); - ErrorF("Also defined in %s\n", _LoaderHandleToName(handle)); - FatalError("Module load failure\n"); -} - unsigned long LoaderOptions = 0; void -LoaderResetOptions(void) -{ - LoaderOptions = 0; -} - -void LoaderSetOptions(unsigned long opts) { LoaderOptions |= opts; } -void -LoaderClearOptions(unsigned long opts) -{ - LoaderOptions &= ~opts; -} - _X_EXPORT int LoaderGetABIVersion(const char *abiclass) { diff --git a/hw/xfree86/loader/loaderProcs.h b/hw/xfree86/loader/loaderProcs.h index ecbd6762d..b71ad4590 100644 --- a/hw/xfree86/loader/loaderProcs.h +++ b/hw/xfree86/loader/loaderProcs.h @@ -97,9 +97,6 @@ void LoadFont(FontModule *); void UnloadModule(ModuleDescPtr); void UnloadSubModule(ModuleDescPtr); void UnloadDriver(ModuleDescPtr); -void FreeModuleDesc(ModuleDescPtr mod); -ModuleDescPtr NewModuleDesc(const char *); -ModuleDescPtr AddSibling(ModuleDescPtr head, ModuleDescPtr new); void LoaderSetPath(const char *path); void LoaderSortExtensions(void); @@ -108,7 +105,6 @@ unsigned long LoaderGetModuleVersion(ModuleDescPtr mod); void LoaderResetOptions(void); void LoaderSetOptions(unsigned long); -void LoaderClearOptions(unsigned long); /* Options for LoaderSetOptions */ #define LDR_OPT_ABI_MISMATCH_NONFATAL 0x0001 diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index c220d8a61..db12da466 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -745,6 +745,13 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data, return TRUE; } +static ModuleDescPtr +AddSibling(ModuleDescPtr head, ModuleDescPtr new) +{ + new->sib = head; + return (new); +} + _X_EXPORT ModuleDescPtr LoadSubModule(ModuleDescPtr parent, const char *module, const char **subdirlist, const char **patternlist, @@ -775,35 +782,28 @@ LoadSubModule(ModuleDescPtr parent, const char *module, return submod; } -ModuleDescPtr -LoadSubModuleLocal(ModuleDescPtr parent, const char *module, - const char **subdirlist, const char **patternlist, - pointer options, const XF86ModReqInfo * modreq, - int *errmaj, int *errmin) +static ModuleDescPtr +NewModuleDesc(const char *name) { - ModuleDescPtr submod; - - xf86MsgVerb(X_INFO, 3, "Loading local sub module \"%s\"\n", module); + ModuleDescPtr mdp = xalloc(sizeof(ModuleDesc)); - if (PathIsAbsolute(module)) - { - xf86Msg(X_ERROR, - "LoadSubModule: Absolute module path not permitted: \"%s\"\n", - module); - if (errmaj) - *errmaj = LDR_BADUSAGE; - if (errmin) - *errmin = 0; - return NULL; + if (mdp) { + mdp->child = NULL; + mdp->sib = NULL; + mdp->parent = NULL; + mdp->demand_next = NULL; + mdp->name = xstrdup(name); + mdp->filename = NULL; + mdp->identifier = NULL; + mdp->client_id = 0; + mdp->in_use = 0; + mdp->handle = -1; + mdp->SetupProc = NULL; + mdp->TearDownProc = NULL; + mdp->TearDownData = NULL; } - submod = doLoadModule(module, NULL, subdirlist, patternlist, options, - modreq, errmaj, errmin, 0); - if (submod && submod != (ModuleDescPtr) 1) { - parent->child = AddSibling(parent->child, submod); - submod->parent = parent; - } - return submod; + return (mdp); } _X_EXPORT ModuleDescPtr @@ -869,7 +869,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, for (cim = compiled_in_modules; *cim; cim++) if (!strcmp (module, *cim)) { - xf86MsgVerb(X_INFO, 3, "Module alread ybuilt-in"); + xf86MsgVerb(X_INFO, 3, "Module already built-in\n"); return (ModuleDescPtr) 1; } @@ -1099,26 +1099,12 @@ LoadModule(const char *module, const char *path, const char **subdirlist, modreq, errmaj, errmin, LD_FLAG_GLOBAL); } -ModuleDescPtr -LoadDriver(const char *module, const char *path, int handle, pointer options, - int *errmaj, int *errmin) -{ - return LoadModule(module, path, NULL, NULL, options, NULL, errmaj, - errmin); -} - void UnloadModule(ModuleDescPtr mod) { UnloadModuleOrDriver(mod); } -void -UnloadDriver(ModuleDescPtr mod) -{ - UnloadModuleOrDriver(mod); -} - static void UnloadModuleOrDriver(ModuleDescPtr mod) { @@ -1168,7 +1154,7 @@ UnloadSubModule(ModuleDescPtr mod) xfree(mod); } -void +static void FreeModuleDesc(ModuleDescPtr head) { ModuleDescPtr sibs, prev; @@ -1177,7 +1163,7 @@ FreeModuleDesc(ModuleDescPtr head) return; /* * only free it if it's not marked as in use. In use means that it may - * be unloaded someday, and UnloadModule or UnloadDriver will free it + * be unloaded someday, and UnloadModule will free it */ if (head->in_use) return; @@ -1192,38 +1178,6 @@ FreeModuleDesc(ModuleDescPtr head) } } -ModuleDescPtr -NewModuleDesc(const char *name) -{ - ModuleDescPtr mdp = xalloc(sizeof(ModuleDesc)); - - if (mdp) { - mdp->child = NULL; - mdp->sib = NULL; - mdp->parent = NULL; - mdp->demand_next = NULL; - mdp->name = xstrdup(name); - mdp->filename = NULL; - mdp->identifier = NULL; - mdp->client_id = 0; - mdp->in_use = 0; - mdp->handle = -1; - mdp->SetupProc = NULL; - mdp->TearDownProc = NULL; - mdp->TearDownData = NULL; - } - - return (mdp); -} - -ModuleDescPtr -AddSibling(ModuleDescPtr head, ModuleDescPtr new) -{ - new->sib = head; - return (new); - -} - static void RemoveChild(ModuleDescPtr child) { diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c index 46d6a024d..78ae10e02 100644 --- a/hw/xfree86/loader/misym.c +++ b/hw/xfree86/loader/misym.c @@ -208,9 +208,6 @@ _X_HIDDEN void *miLookupTab[] = { #ifdef RENDER SYMFUNC(miGlyphExtents) #endif -#ifdef COMPOSITE - SYMFUNC(miDisableCompositeWrapper) -#endif #ifdef DAMAGE SYMFUNC(DamageDamageRegion) #endif diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index bc7c8148b..5175f01f9 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -1170,6 +1170,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMVAR(pciNumBuses) /* modes */ + SYMVAR(xf86CrtcConfigPrivateIndex) SYMFUNC(xf86CrtcConfigInit) SYMFUNC(xf86CrtcConfigPrivateIndex) SYMFUNC(xf86CrtcCreate) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 1a4292092..7d86b6606 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -312,7 +312,13 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, { xf86OutputPtr output = xf86_config->output[i]; if (output->crtc == crtc) + { output->funcs->commit(output); +#ifdef RANDR_12_INTERFACE + if (output->randr_output) + RRPostPendingProperties (output->randr_output); +#endif + } } /* XXX free adjustedmode */ @@ -566,6 +572,36 @@ xf86CrtcCreateScreenResources (ScreenPtr screen) } /* + * Clean up config on server reset + */ +static Bool +xf86CrtcCloseScreen (int index, ScreenPtr screen) +{ + ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int o, c; + + screen->CloseScreen = config->CloseScreen; + + xf86RotateCloseScreen (screen); + + for (o = 0; o < config->num_output; o++) + { + xf86OutputPtr output = config->output[o]; + + output->crtc = NULL; + output->randr_output = NULL; + } + for (c = 0; c < config->num_crtc; c++) + { + xf86CrtcPtr crtc = config->crtc[c]; + + crtc->randr_crtc = NULL; + } + return screen->CloseScreen (index, screen); +} + +/* * Called at ScreenInit time to set up */ Bool @@ -596,6 +632,10 @@ xf86CrtcScreenInit (ScreenPtr screen) /* Wrap CreateScreenResources so we can initialize the RandR code */ config->CreateScreenResources = screen->CreateScreenResources; screen->CreateScreenResources = xf86CrtcCreateScreenResources; + + config->CloseScreen = screen->CloseScreen; + screen->CloseScreen = xf86CrtcCloseScreen; + return TRUE; } @@ -1555,6 +1595,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) { crtc->desiredMode = *mode; crtc->desiredRotation = output->initial_rotation; + crtc->desiredX = output->initial_x; + crtc->desiredY = output->initial_y; crtc->enabled = TRUE; crtc->x = output->initial_x; crtc->y = output->initial_y; @@ -1779,7 +1821,12 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) if (!xf86CrtcSetMode (crtc, crtc_mode, rotation, 0, 0)) ok = FALSE; else + { crtc->desiredMode = *crtc_mode; + crtc->desiredRotation = rotation; + crtc->desiredX = 0; + crtc->desiredY = 0; + } } xf86DisableUnusedFunctions(pScrn); return ok; @@ -1889,7 +1936,7 @@ xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len) if (data_len != 0) { RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8, - PropModeReplace, data_len, data, FALSE); + PropModeReplace, data_len, data, FALSE, TRUE); } else { RRDeleteOutputProperty(output->randr_output, edid_atom); } diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index b7515928e..42daf6079 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -544,6 +544,8 @@ typedef struct _xf86CrtcConfig { CreateScreenResourcesProcPtr CreateScreenResources; + CloseScreenProcPtr CloseScreen; + /* Cursor information */ xf86CursorInfoPtr cursor_info; CursorPtr cursor; @@ -593,6 +595,12 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, Bool xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation); +/* + * Clean up rotation during CloseScreen + */ +void +xf86RotateCloseScreen (ScreenPtr pScreen); + /** * Return whether any output is assigned to the crtc */ diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index c4cf6870b..7a8ec1935 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -197,6 +197,19 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, { DisplayModePtr Mode; + /* + * Refuse to create modes that are insufficiently large. 64 is a random + * number, maybe the spec says something about what the minimum is. In + * particular I see this frequently with _old_ EDID, 1.0 or so, so maybe + * our parser is just being too aggresive there. + */ + if (timing->h_active < 64 || timing->v_active < 64) { + xf86DrvMsg(scrnIndex, X_INFO, + "%s: Ignoring tiny %dx%d mode\n", __func__, + timing->h_active, timing->v_active); + return NULL; + } + /* We don't do stereo */ if (timing->stereo) { xf86DrvMsg(scrnIndex, X_INFO, diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 5e8225e54..13437a5a5 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -557,6 +557,56 @@ xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y) } #if RANDR_12_INTERFACE + +#define FLAG_BITS (RR_HSyncPositive | \ + RR_HSyncNegative | \ + RR_VSyncPositive | \ + RR_VSyncNegative | \ + RR_Interlace | \ + RR_DoubleScan | \ + RR_CSync | \ + RR_CSyncPositive | \ + RR_CSyncNegative | \ + RR_HSkewPresent | \ + RR_BCast | \ + RR_PixelMultiplex | \ + RR_DoubleClock | \ + RR_ClockDivideBy2) + +static Bool +xf86RandRModeMatches (RRModePtr randr_mode, + DisplayModePtr mode) +{ +#if 0 + if (match_name) + { + /* check for same name */ + int len = strlen (mode->name); + if (randr_mode->mode.nameLength != len) return FALSE; + if (memcmp (randr_mode->name, mode->name, len) != 0) return FALSE; + } +#endif + + /* check for same timings */ + if (randr_mode->mode.dotClock / 1000 != mode->Clock) return FALSE; + if (randr_mode->mode.width != mode->HDisplay) return FALSE; + if (randr_mode->mode.hSyncStart != mode->HSyncStart) return FALSE; + if (randr_mode->mode.hSyncEnd != mode->HSyncEnd) return FALSE; + if (randr_mode->mode.hTotal != mode->HTotal) return FALSE; + if (randr_mode->mode.hSkew != mode->HSkew) return FALSE; + if (randr_mode->mode.height != mode->VDisplay) return FALSE; + if (randr_mode->mode.vSyncStart != mode->VSyncStart) return FALSE; + if (randr_mode->mode.vSyncEnd != mode->VSyncEnd) return FALSE; + if (randr_mode->mode.vTotal != mode->VTotal) return FALSE; + + /* check for same flags (using only the XF86 valid flag bits) */ + if ((randr_mode->mode.modeFlags & FLAG_BITS) != (mode->Flags & FLAG_BITS)) + return FALSE; + + /* everything matches */ + return TRUE; +} + static Bool xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc) { @@ -595,12 +645,15 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc) * We make copies of modes, so pointer equality * isn't sufficient */ - for (j = 0; j < randr_output->numModes; j++) + for (j = 0; j < randr_output->numModes + randr_output->numUserModes; j++) { - DisplayModePtr outMode = randr_output->modes[j]->devPrivate; - if (xf86ModesEqual(mode, outMode)) + RRModePtr m = (j < randr_output->numModes ? + randr_output->modes[j] : + randr_output->userModes[j-randr_output->numModes]); + + if (xf86RandRModeMatches (m, mode)) { - randr_mode = randr_output->modes[j]; + randr_mode = m; break; } } @@ -612,6 +665,39 @@ xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc) return ret; } +/* + * Convert a RandR mode to a DisplayMode + */ +static void +xf86RandRModeConvert (ScrnInfoPtr scrn, + RRModePtr randr_mode, + DisplayModePtr mode) +{ + mode->prev = NULL; + mode->next = NULL; + mode->name = NULL; + mode->status = MODE_OK; + mode->type = 0; + + mode->Clock = randr_mode->mode.dotClock / 1000; + + mode->HDisplay = randr_mode->mode.width; + mode->HSyncStart = randr_mode->mode.hSyncStart; + mode->HSyncEnd = randr_mode->mode.hSyncEnd; + mode->HTotal = randr_mode->mode.hTotal; + mode->HSkew = randr_mode->mode.hSkew; + + mode->VDisplay = randr_mode->mode.height; + mode->VSyncStart = randr_mode->mode.vSyncStart; + mode->VSyncEnd = randr_mode->mode.vSyncEnd; + mode->VTotal = randr_mode->mode.vTotal; + mode->VScan = 0; + + mode->Flags = randr_mode->mode.modeFlags & FLAG_BITS; + + xf86SetModeCrtc (mode, scrn->adjustFlags); +} + static Bool xf86RandR12CrtcSet (ScreenPtr pScreen, RRCrtcPtr randr_crtc, @@ -625,16 +711,15 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcPtr crtc = randr_crtc->devPrivate; - DisplayModePtr mode = randr_mode ? randr_mode->devPrivate : NULL; Bool changed = FALSE; int o, ro; xf86CrtcPtr *save_crtcs; Bool save_enabled = crtc->enabled; save_crtcs = ALLOCATE_LOCAL(config->num_crtc * sizeof (xf86CrtcPtr)); - if ((mode != NULL) != crtc->enabled) + if ((randr_mode != NULL) != crtc->enabled) changed = TRUE; - else if (mode && !xf86ModesEqual (&crtc->mode, mode)) + else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode)) changed = TRUE; if (rotation != crtc->rotation) @@ -668,11 +753,14 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, /* XXX need device-independent mode setting code through an API */ if (changed) { - crtc->enabled = mode != NULL; + crtc->enabled = randr_mode != NULL; - if (mode) + if (randr_mode) { - if (!xf86CrtcSetMode (crtc, mode, rotation, x, y)) + DisplayModeRec mode; + + xf86RandRModeConvert (pScrn, randr_mode, &mode); + if (!xf86CrtcSetMode (crtc, &mode, rotation, x, y)) { crtc->enabled = save_enabled; for (o = 0; o < config->num_output; o++) @@ -686,7 +774,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, /* * Save the last successful setting for EnterVT */ - crtc->desiredMode = *mode; + crtc->desiredMode = mode; crtc->desiredRotation = rotation; crtc->desiredX = x; crtc->desiredY = y; @@ -729,6 +817,26 @@ xf86RandR12OutputSetProperty (ScreenPtr pScreen, return output->funcs->set_property(output, property, value); } +static Bool +xf86RandR12OutputValidateMode (ScreenPtr pScreen, + RROutputPtr randr_output, + RRModePtr randr_mode) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + xf86OutputPtr output = randr_output->devPrivate; + DisplayModeRec mode; + + xf86RandRModeConvert (pScrn, randr_mode, &mode); + if (output->funcs->mode_valid (output, &mode) != MODE_OK) + return FALSE; + return TRUE; +} + +static void +xf86RandR12ModeDestroy (ScreenPtr pScreen, RRModePtr randr_mode) +{ +} + /** * Given a list of xf86 modes and a RandR Output object, construct * RandR modes and assign them to the output @@ -775,7 +883,6 @@ xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes) rrmode = RRModeGet (&modeInfo, mode->name); if (rrmode) { - rrmode->devPrivate = mode; rrmodes[nmode++] = rrmode; npreferred += pref; } @@ -905,8 +1012,7 @@ xf86RandR12CreateObjects12 (ScreenPtr pScreen) { xf86CrtcPtr crtc = config->crtc[c]; - crtc->randr_crtc = RRCrtcCreate (crtc); - RRCrtcAttachScreen (crtc->randr_crtc, pScreen); + crtc->randr_crtc = RRCrtcCreate (pScreen, crtc); RRCrtcGammaSetSize (crtc->randr_crtc, 256); } /* @@ -916,13 +1022,13 @@ xf86RandR12CreateObjects12 (ScreenPtr pScreen) { xf86OutputPtr output = config->output[o]; - output->randr_output = RROutputCreate (output->name, + output->randr_output = RROutputCreate (pScreen, output->name, strlen (output->name), output); - RROutputAttachScreen (output->randr_output, pScreen); if (output->funcs->create_resources != NULL) output->funcs->create_resources(output); + RRPostPendingProperties (output->randr_output); } return TRUE; } @@ -959,6 +1065,8 @@ xf86RandR12Init12 (ScreenPtr pScreen) rp->rrCrtcSet = xf86RandR12CrtcSet; rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma; rp->rrOutputSetProperty = xf86RandR12OutputSetProperty; + rp->rrOutputValidateMode = xf86RandR12OutputValidateMode; + rp->rrModeDestroy = xf86RandR12ModeDestroy; rp->rrSetConfig = NULL; pScrn->PointerMoved = xf86RandR12PointerMoved; if (!xf86RandR12CreateObjects12 (pScreen)) diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index e82b69e1b..e8fafd073 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -321,36 +321,68 @@ xf86RotateWakeupHandler(pointer data, int i, pointer LastSelectMask) { } -Bool -xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) +static void +xf86RotateDestroy (xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); ScreenPtr pScreen = pScrn->pScreen; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + int c; - if (rotation == RR_Rotate_0) + /* Free memory from rotation */ + if (crtc->rotatedPixmap || crtc->rotatedData) { - /* Free memory from rotation */ + crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData); + crtc->rotatedPixmap = NULL; + crtc->rotatedData = NULL; + } + + for (c = 0; c < xf86_config->num_crtc; c++) if (crtc->rotatedPixmap || crtc->rotatedData) - { - crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData); - crtc->rotatedPixmap = NULL; - crtc->rotatedData = NULL; - } + return; - if (xf86_config->rotation_damage) + /* + * Clean up damage structures when no crtcs are rotated + */ + if (xf86_config->rotation_damage) + { + /* Free damage structure */ + if (xf86_config->rotation_damage_registered) { - /* Free damage structure */ DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable, xf86_config->rotation_damage); xf86_config->rotation_damage_registered = FALSE; - DamageDestroy (xf86_config->rotation_damage); - xf86_config->rotation_damage = NULL; - /* Free block/wakeup handler */ - RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler, - xf86RotateWakeupHandler, - (pointer) pScreen); } + DamageDestroy (xf86_config->rotation_damage); + xf86_config->rotation_damage = NULL; + /* Free block/wakeup handler */ + RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler, + xf86RotateWakeupHandler, + (pointer) pScreen); + } +} + +void +xf86RotateCloseScreen (ScreenPtr screen) +{ + ScrnInfoPtr scrn = xf86Screens[screen->myNum]; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + int c; + + for (c = 0; c < xf86_config->num_crtc; c++) + xf86RotateDestroy (xf86_config->crtc[c]); +} + +Bool +xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) +{ + ScrnInfoPtr pScrn = crtc->scrn; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + ScreenPtr pScreen = pScrn->pScreen; + + if (rotation == RR_Rotate_0) + { + xf86RotateDestroy (crtc); } else { diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c index 4c4af4c24..a459d5d70 100644 --- a/hw/xfree86/os-support/shared/libc_wrapper.c +++ b/hw/xfree86/os-support/shared/libc_wrapper.c @@ -628,7 +628,7 @@ typedef struct _xf86_file_ { char* fname; } XF86FILE_priv; -XF86FILE_priv stdhnd[3] = { +static XF86FILE_priv stdhnd[3] = { { 0, XF86FILE_magic, NULL, "$stdinp$" }, { 0, XF86FILE_magic, NULL, "$stdout$" }, { 0, XF86FILE_magic, NULL, "$stderr$" } diff --git a/hw/xfree86/parser/DRI.c b/hw/xfree86/parser/DRI.c index dc75cd23f..18644bcc7 100644 --- a/hw/xfree86/parser/DRI.c +++ b/hw/xfree86/parser/DRI.c @@ -48,7 +48,21 @@ static xf86ConfigSymTabRec DRITab[] = #define CLEANUP xf86freeBuffersList -XF86ConfBuffersPtr +static void +xf86freeBuffersList (XF86ConfBuffersPtr ptr) +{ + XF86ConfBuffersPtr prev; + + while (ptr) { + TestFree (ptr->buf_flags); + TestFree (ptr->buf_comment); + prev = ptr; + ptr = ptr->list.next; + xf86conffree (prev); + } +} + +static XF86ConfBuffersPtr xf86parseBuffers (void) { int token; @@ -169,18 +183,3 @@ xf86freeDRI (XF86ConfDRIPtr ptr) TestFree (ptr->dri_comment); xf86conffree (ptr); } - -void -xf86freeBuffersList (XF86ConfBuffersPtr ptr) -{ - XF86ConfBuffersPtr prev; - - while (ptr) { - TestFree (ptr->buf_flags); - TestFree (ptr->buf_comment); - prev = ptr; - ptr = ptr->list.next; - xf86conffree (prev); - } -} - diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c index 7ab70d1a8..4adea1ade 100644 --- a/hw/xfree86/parser/Flags.c +++ b/hw/xfree86/parser/Flags.c @@ -441,15 +441,6 @@ xf86uLongToString(unsigned long i) return s; } -void -xf86debugListOptions(XF86OptionPtr Options) -{ - while (Options) { - ErrorF("Option: %s Value: %s\n",Options->opt_name,Options->opt_val); - Options = Options->list.next; - } -} - XF86OptionPtr xf86parseOption(XF86OptionPtr head) { diff --git a/hw/xfree86/parser/Layout.c b/hw/xfree86/parser/Layout.c index b9f4e9e6a..5d1348acb 100644 --- a/hw/xfree86/parser/Layout.c +++ b/hw/xfree86/parser/Layout.c @@ -382,24 +382,7 @@ xf86printLayoutSection (FILE * cf, XF86ConfLayoutPtr ptr) } } -void -xf86freeLayoutList (XF86ConfLayoutPtr ptr) -{ - XF86ConfLayoutPtr prev; - - while (ptr) - { - TestFree (ptr->lay_identifier); - TestFree (ptr->lay_comment); - xf86freeAdjacencyList (ptr->lay_adjacency_lst); - xf86freeInputrefList (ptr->lay_input_lst); - prev = ptr; - ptr = ptr->list.next; - xf86conffree (prev); - } -} - -void +static void xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr) { XF86ConfAdjacencyPtr prev; @@ -419,7 +402,7 @@ xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr) } -void +static void xf86freeInputrefList (XF86ConfInputrefPtr ptr) { XF86ConfInputrefPtr prev; @@ -435,6 +418,23 @@ xf86freeInputrefList (XF86ConfInputrefPtr ptr) } +void +xf86freeLayoutList (XF86ConfLayoutPtr ptr) +{ + XF86ConfLayoutPtr prev; + + while (ptr) + { + TestFree (ptr->lay_identifier); + TestFree (ptr->lay_comment); + xf86freeAdjacencyList (ptr->lay_adjacency_lst); + xf86freeInputrefList (ptr->lay_input_lst); + prev = ptr; + ptr = ptr->list.next; + xf86conffree (prev); + } +} + #define CheckScreen(str, ptr)\ if (str[0] != '\0') \ { \ diff --git a/hw/xfree86/parser/Module.c b/hw/xfree86/parser/Module.c index f3ed9d19f..81eff18ae 100644 --- a/hw/xfree86/parser/Module.c +++ b/hw/xfree86/parser/Module.c @@ -83,7 +83,7 @@ static xf86ConfigSymTabRec ModuleTab[] = #define CLEANUP xf86freeModules -XF86LoadPtr +static XF86LoadPtr xf86parseModuleSubSection (XF86LoadPtr head, char *name) { int token; diff --git a/hw/xfree86/parser/Monitor.c b/hw/xfree86/parser/Monitor.c index 9dd0b1b1c..4bff4b23b 100644 --- a/hw/xfree86/parser/Monitor.c +++ b/hw/xfree86/parser/Monitor.c @@ -124,7 +124,21 @@ static xf86ConfigSymTabRec ModeTab[] = #define CLEANUP xf86freeModeLineList -XF86ConfModeLinePtr +static void +xf86freeModeLineList (XF86ConfModeLinePtr ptr) +{ + XF86ConfModeLinePtr prev; + while (ptr) + { + TestFree (ptr->ml_identifier); + TestFree (ptr->ml_comment); + prev = ptr; + ptr = ptr->list.next; + xf86conffree (prev); + } +} + +static XF86ConfModeLinePtr xf86parseModeLine (void) { int token; @@ -253,7 +267,7 @@ xf86parseModeLine (void) return (ptr); } -XF86ConfModeLinePtr +static XF86ConfModeLinePtr xf86parseVerboseMode (void) { int token, token2; @@ -830,20 +844,6 @@ xf86freeModesList (XF86ConfModesPtr ptr) } } -void -xf86freeModeLineList (XF86ConfModeLinePtr ptr) -{ - XF86ConfModeLinePtr prev; - while (ptr) - { - TestFree (ptr->ml_identifier); - TestFree (ptr->ml_comment); - prev = ptr; - ptr = ptr->list.next; - xf86conffree (prev); - } -} - XF86ConfMonitorPtr xf86findMonitor (const char *ident, XF86ConfMonitorPtr p) { diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c index b7a64b035..79e1d24ef 100644 --- a/hw/xfree86/parser/Screen.c +++ b/hw/xfree86/parser/Screen.c @@ -83,7 +83,7 @@ static xf86ConfigSymTabRec DisplayTab[] = #define CLEANUP xf86freeDisplayList -XF86ConfDisplayPtr +static XF86ConfDisplayPtr xf86parseDisplaySubSection (void) { int token; diff --git a/hw/xfree86/parser/Vendor.c b/hw/xfree86/parser/Vendor.c index 3e9358b3b..d1e608067 100644 --- a/hw/xfree86/parser/Vendor.c +++ b/hw/xfree86/parser/Vendor.c @@ -75,7 +75,7 @@ static xf86ConfigSymTabRec VendorSubTab[] = #define CLEANUP xf86freeVendorSubList -XF86ConfVendSubPtr +static XF86ConfVendSubPtr xf86parseVendorSubSection (void) { int has_ident = FALSE; @@ -242,16 +242,3 @@ xf86freeVendorSubList (XF86ConfVendSubPtr ptr) xf86conffree (prev); } } - -XF86ConfVendorPtr -xf86findVendor (const char *name, XF86ConfVendorPtr list) -{ - while (list) - { - if (xf86nameCompare (list->vnd_identifier, name) == 0) - return (list); - list = list->list.next; - } - return (NULL); -} - diff --git a/hw/xfree86/parser/Video.c b/hw/xfree86/parser/Video.c index fa0ff7833..a8912cf44 100644 --- a/hw/xfree86/parser/Video.c +++ b/hw/xfree86/parser/Video.c @@ -74,7 +74,23 @@ static xf86ConfigSymTabRec VideoPortTab[] = #define CLEANUP xf86freeVideoPortList -XF86ConfVideoPortPtr +static void +xf86freeVideoPortList (XF86ConfVideoPortPtr ptr) +{ + XF86ConfVideoPortPtr prev; + + while (ptr) + { + TestFree (ptr->vp_identifier); + TestFree (ptr->vp_comment); + xf86optionListFree (ptr->vp_option_lst); + prev = ptr; + ptr = ptr->list.next; + xf86conffree (prev); + } +} + +static XF86ConfVideoPortPtr xf86parseVideoPortSubSection (void) { int has_ident = FALSE; @@ -266,22 +282,6 @@ xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr) } } -void -xf86freeVideoPortList (XF86ConfVideoPortPtr ptr) -{ - XF86ConfVideoPortPtr prev; - - while (ptr) - { - TestFree (ptr->vp_identifier); - TestFree (ptr->vp_comment); - xf86optionListFree (ptr->vp_option_lst); - prev = ptr; - ptr = ptr->list.next; - xf86conffree (prev); - } -} - XF86ConfVideoAdaptorPtr xf86findVideoAdaptor (const char *ident, XF86ConfVideoAdaptorPtr p) { diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h index 0b989054b..3c9ce7a83 100644 --- a/hw/xfree86/parser/configProcs.h +++ b/hw/xfree86/parser/configProcs.h @@ -49,30 +49,23 @@ int xf86validateInput (XF86ConfigPtr p); XF86ConfLayoutPtr xf86parseLayoutSection(void); void xf86printLayoutSection(FILE *cf, XF86ConfLayoutPtr ptr); void xf86freeLayoutList(XF86ConfLayoutPtr ptr); -void xf86freeAdjacencyList(XF86ConfAdjacencyPtr ptr); -void xf86freeInputrefList(XF86ConfInputrefPtr ptr); int xf86validateLayout(XF86ConfigPtr p); /* Module.c */ -XF86LoadPtr xf86parseModuleSubSection(XF86LoadPtr head, char *name); XF86ConfModulePtr xf86parseModuleSection(void); void xf86printModuleSection(FILE *cf, XF86ConfModulePtr ptr); XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type, XF86OptionPtr opts); void xf86freeModules(XF86ConfModulePtr ptr); /* Monitor.c */ -XF86ConfModeLinePtr xf86parseModeLine(void); -XF86ConfModeLinePtr xf86parseVerboseMode(void); XF86ConfMonitorPtr xf86parseMonitorSection(void); XF86ConfModesPtr xf86parseModesSection(void); void xf86printMonitorSection(FILE *cf, XF86ConfMonitorPtr ptr); void xf86printModesSection(FILE *cf, XF86ConfModesPtr ptr); void xf86freeMonitorList(XF86ConfMonitorPtr ptr); void xf86freeModesList(XF86ConfModesPtr ptr); -void xf86freeModeLineList(XF86ConfModeLinePtr ptr); int xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen); /* Pointer.c */ XF86ConfInputPtr xf86parsePointerSection(void); /* Screen.c */ -XF86ConfDisplayPtr xf86parseDisplaySubSection(void); XF86ConfScreenPtr xf86parseScreenSection(void); void xf86printScreenSection(FILE *cf, XF86ConfScreenPtr ptr); void xf86freeScreenList(XF86ConfScreenPtr ptr); @@ -82,34 +75,25 @@ void xf86freeModeList(XF86ModePtr ptr); int xf86validateScreen(XF86ConfigPtr p); /* Vendor.c */ XF86ConfVendorPtr xf86parseVendorSection(void); -XF86ConfVendSubPtr xf86parseVendorSubSection (void); void xf86freeVendorList(XF86ConfVendorPtr p); void xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr); void xf86freeVendorSubList (XF86ConfVendSubPtr ptr); /* Video.c */ -XF86ConfVideoPortPtr xf86parseVideoPortSubSection(void); XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void); void xf86printVideoAdaptorSection(FILE *cf, XF86ConfVideoAdaptorPtr ptr); void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr); -void xf86freeVideoPortList(XF86ConfVideoPortPtr ptr); -/* read.c */ -int xf86validateConfig(XF86ConfigPtr p); /* scan.c */ -unsigned int xf86strToUL(char *str); int xf86getToken(xf86ConfigSymTabRec *tab); int xf86getSubToken(char **comment); int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab); void xf86unGetToken(int token); char *xf86tokenString(void); void xf86parseError(char *format, ...); -void xf86parseWarning(char *format, ...); void xf86validationError(char *format, ...); void xf86setSection(char *section); int xf86getStringToken(xf86ConfigSymTabRec *tab); /* write.c */ /* DRI.c */ -XF86ConfBuffersPtr xf86parseBuffers (void); -void xf86freeBuffersList (XF86ConfBuffersPtr ptr); XF86ConfDRIPtr xf86parseDRISection (void); void xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr); void xf86freeDRI (XF86ConfDRIPtr ptr); diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c index b6b3bc377..9f79696ac 100644 --- a/hw/xfree86/parser/read.c +++ b/hw/xfree86/parser/read.c @@ -73,6 +73,25 @@ static xf86ConfigSymTabRec TopLevelTab[] = #define CLEANUP xf86freeConfig +/* + * This function resolves name references and reports errors if the named + * objects cannot be found. + */ +static int +xf86validateConfig (XF86ConfigPtr p) +{ + if (!xf86validateDevice (p)) + return FALSE; + if (!xf86validateScreen (p)) + return FALSE; + if (!xf86validateInput (p)) + return FALSE; + if (!xf86validateLayout (p)) + return FALSE; + + return (TRUE); +} + XF86ConfigPtr xf86readConfigFile (void) { @@ -219,25 +238,6 @@ xf86readConfigFile (void) #undef CLEANUP /* - * This function resolves name references and reports errors if the named - * objects cannot be found. - */ -int -xf86validateConfig (XF86ConfigPtr p) -{ - if (!xf86validateDevice (p)) - return FALSE; - if (!xf86validateScreen (p)) - return FALSE; - if (!xf86validateInput (p)) - return FALSE; - if (!xf86validateLayout (p)) - return FALSE; - - return (TRUE); -} - -/* * adds an item to the end of the linked list. Any record whose first field * is a GenericListRec can be cast to this type and used with this function. * A pointer to the head of the list is returned to handle the addition of diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index f81c45afe..68e7ec650 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -116,7 +116,7 @@ extern char *__XOS2RedirRoot(char *path); * A portable, but restricted, version of strtoul(). It only understands * hex, octal, and decimal. But it's good enough for our needs. */ -unsigned int +static unsigned int xf86strToUL (char *str) { int base = 10; @@ -922,20 +922,6 @@ xf86parseError (char *format,...) } void -xf86parseWarning (char *format,...) -{ - va_list ap; - - ErrorF ("Parse warning on line %d of section %s in file %s\n\t", - configLineNo, configSection, configPath); - va_start (ap, format); - VErrorF (format, ap); - va_end (ap); - - ErrorF ("\n"); -} - -void xf86validationError (char *format,...) { va_list ap; diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h index a6829273c..89de97bbb 100644 --- a/hw/xfree86/parser/xf86Parser.h +++ b/hw/xfree86/parser/xf86Parser.h @@ -469,7 +469,6 @@ XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p); XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p); XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p); XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p); -XF86ConfVendorPtr xf86findVendor(const char *name, XF86ConfVendorPtr list); XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, XF86ConfVideoAdaptorPtr p); diff --git a/hw/xfree86/ramdac/xf86RamDacMod.c b/hw/xfree86/ramdac/xf86RamDacMod.c deleted file mode 100644 index b4187a953..000000000 --- a/hw/xfree86/ramdac/xf86RamDacMod.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 1998 by Alan Hourihane, Wigan, England. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * Generic RAMDAC module. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86Module.h" - -static XF86ModuleVersionInfo VersRec = { - "ramdac", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 0, 1, 0, - ABI_CLASS_VIDEODRV, - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData ramdacModuleData = { &VersRec, NULL, NULL }; diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am index 5d529b118..6ed8303a4 100644 --- a/hw/xfree86/xaa/Makefile.am +++ b/hw/xfree86/xaa/Makefile.am @@ -9,6 +9,7 @@ MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c POLYSEG = s-xaaLine.c s-xaaDashLine.c libxaa_la_LDFLAGS = -avoid-version +libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la module_LTLIBRARIES = libxaa.la libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \ diff --git a/hw/xfree86/xaa/xaaDashLine.c b/hw/xfree86/xaa/xaaDashLine.c index 2a94a9e6c..1a4732baa 100644 --- a/hw/xfree86/xaa/xaaDashLine.c +++ b/hw/xfree86/xaa/xaaDashLine.c @@ -35,7 +35,7 @@ XAAPolyLinesDashed( #endif ){ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGCIndex].ptr; + XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr; BoxPtr pboxInit = REGION_RECTS(pGC->pCompositeClip); int nboxInit = REGION_NUM_RECTS(pGC->pCompositeClip); unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c index e22081103..f3434c9f4 100644 --- a/hw/xfree86/xaa/xaaGC.c +++ b/hw/xfree86/xaa/xaaGC.c @@ -38,7 +38,7 @@ Bool XAACreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; - XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGCIndex].ptr); + XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr); Bool ret; XAA_SCREEN_PROLOGUE(pScreen,CreateGC); diff --git a/hw/xfree86/xaa/xaaGCmisc.c b/hw/xfree86/xaa/xaaGCmisc.c index f7bd576f1..a7a3f4081 100644 --- a/hw/xfree86/xaa/xaaGCmisc.c +++ b/hw/xfree86/xaa/xaaGCmisc.c @@ -305,7 +305,7 @@ XAAValidatePolylines( DrawablePtr pDraw ) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGCIndex].ptr; + XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr; if(pGC->lineStyle == LineSolid) changes &= ~GCDashList; if(!changes) return; diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c index 1542fc26e..529dbd151 100644 --- a/hw/xfree86/xaa/xaaInit.c +++ b/hw/xfree86/xaa/xaaInit.c @@ -42,14 +42,9 @@ static int XAASetDGAMode(int index, int num, DGADevicePtr devRet); static void XAAEnableDisableFBAccess (int index, Bool enable); static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask); -/* - * XXX These three should be static, but that breaks ABI compat with XF4.4 - * and Xorg 6.7.0 modules. DO NOT use them in new code, you should never - * be setting them, and you've got Get functions below. - */ -int XAAScreenIndex = -1; -int XAAGCIndex = -1; -int XAAPixmapIndex = -1; +static int XAAScreenIndex = -1; +static int XAAGCIndex = -1; +static int XAAPixmapIndex = -1; static unsigned long XAAGeneration = 0; @@ -227,6 +222,14 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS) miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4); +#ifdef COMPOSITE + /* Initialize the composite wrapper. This needs to happen after the + * wrapping above (so it comes before us), but before all other extensions, + * so it doesn't confuse them. (particularly damage). + */ + miInitializeCompositeWrapper(pScreen); +#endif + return TRUE; } diff --git a/hw/xfree86/xaa/xaaLineMisc.c b/hw/xfree86/xaa/xaaLineMisc.c index d786737af..537b08b97 100644 --- a/hw/xfree86/xaa/xaaLineMisc.c +++ b/hw/xfree86/xaa/xaaLineMisc.c @@ -64,7 +64,7 @@ void XAAComputeDash(GCPtr pGC) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGCIndex].ptr; + XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr; Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE; int PatternLength = 0; unsigned char* DashPtr = (unsigned char*)pGC->dash; diff --git a/hw/xfree86/xaa/xaaWrapper.c b/hw/xfree86/xaa/xaaWrapper.c index 5b525684a..6d8107b61 100644 --- a/hw/xfree86/xaa/xaaWrapper.c +++ b/hw/xfree86/xaa/xaaWrapper.c @@ -522,7 +522,7 @@ void XAASync(ScreenPtr pScreen) { XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr) pScreen->devPrivates[XAAGetScreenIndex()].ptr; XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec; if(infoRec->NeedToSync) { diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h index 7210d8492..c365a7de3 100644 --- a/hw/xfree86/xaa/xaalocal.h +++ b/hw/xfree86/xaa/xaalocal.h @@ -1640,9 +1640,6 @@ XAAGetPixelFromRGBA ( extern GCOps XAAFallbackOps; extern GCOps *XAAGetFallbackOps(void); extern GCFuncs XAAGCFuncs; -extern int XAAScreenIndex; /* XXX DONTUSE */ -extern int XAAGCIndex; /* XXX DONTUSE */ -extern int XAAPixmapIndex; /* XXX DONTUSE */ extern int XAAGetScreenIndex(void); extern int XAAGetGCIndex(void); extern int XAAGetPixmapIndex(void); diff --git a/hw/xfree86/xf4bpp/Makefile.am b/hw/xfree86/xf4bpp/Makefile.am index 8fddb6b6a..5eab92f6f 100644 --- a/hw/xfree86/xf4bpp/Makefile.am +++ b/hw/xfree86/xf4bpp/Makefile.am @@ -20,7 +20,6 @@ libxf4bpp_la_SOURCES = \ ppcPixmap.c \ ppcPntWin.c \ ppcPolyPnt.c \ - ppcPolyRec.c \ ppcQuery.c \ ppcRslvC.c \ ppcSetSp.c \ diff --git a/hw/xfree86/xf4bpp/offscreen.c b/hw/xfree86/xf4bpp/offscreen.c index f35bde7dd..654be829d 100644 --- a/hw/xfree86/xf4bpp/offscreen.c +++ b/hw/xfree86/xf4bpp/offscreen.c @@ -301,25 +301,6 @@ DoMono } void -xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes ) -WindowPtr pWin; /* GJA */ -unsigned char *data; -int x, y, w, h ; -unsigned long int fg ; -int alu ; -unsigned long int planes; -{ - - if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) ) - return ; - - DoMono( pWin, w, x, y, (const unsigned char *) data, h, - w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0, alu, - (int)planes, (int)fg) ; - -} - -void xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc ) WindowPtr pWin; /* GJA */ register PixmapPtr const pStipple ; diff --git a/hw/xfree86/xf4bpp/ppcGC.c b/hw/xfree86/xf4bpp/ppcGC.c index 8153051f0..81441efd7 100644 --- a/hw/xfree86/xf4bpp/ppcGC.c +++ b/hw/xfree86/xf4bpp/ppcGC.c @@ -90,10 +90,9 @@ SOFTWARE. | GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT \ | GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode ) +static void xf4bppValidateGC(GCPtr, unsigned long, DrawablePtr); +static void xf4bppDestroyGC(GC *); -/* GJA -- we modified the following function to get rid of - * the records in file vgaData.c - */ static GCFuncs vgaGCFuncs = { xf4bppValidateGC, (void (*)(GCPtr, unsigned long))NoopDDA, @@ -196,7 +195,7 @@ register GCPtr pGC ; return TRUE ; } -void +static void xf4bppDestroyGC( pGC ) register GC *pGC ; @@ -292,7 +291,7 @@ return 0 ; CT_other ==> pCompositeClip is the pixmap bounding box */ -void +static void xf4bppValidateGC( pGC, changes, pDrawable ) GCPtr pGC; unsigned long changes; diff --git a/hw/xfree86/xf4bpp/ppcPolyRec.c b/hw/xfree86/xf4bpp/ppcPolyRec.c deleted file mode 100644 index d7f866232..000000000 --- a/hw/xfree86/xf4bpp/ppcPolyRec.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright IBM Corporation 1987,1988,1989 - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * 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 IBM not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * IBM 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. - * -*/ -/*********************************************************** - -Copyright (c) 1987 X Consortium - -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 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 -X CONSORTIUM 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. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -******************************************************************/ -/* $XConsortium: ppcPolyRec.c /main/4 1996/02/21 17:58:11 kaleb $ */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf4bpp.h" - -void -xf4bppPolyRectangle(pDraw, pGC, nrects, pRects) - DrawablePtr pDraw; - GCPtr pGC; - int nrects; - xRectangle *pRects; -{ - int i; - xRectangle *pR = pRects; - xRectangle *tmprects, *tmprectsinit; - int lw, fs, ss; - - if ( ! ( tmprectsinit = tmprects = (xRectangle *)ALLOCATE_LOCAL( ( sizeof ( xRectangle ) * nrects ) << 2 ) ) ) - return; - - lw = pGC->lineWidth; - ss = lw >> 1; /* skinny side of line */ - fs = ( lw + 1 ) >> 1; /* fat side of line */ - - for (i=0; i<nrects; i++) - { - tmprects->x = pR->x - ss; - tmprects->y = pR->y - ss; - tmprects->width = pR->width + lw; - tmprects->height = lw; - tmprects++; - - tmprects->x = pR->x - ss; - tmprects->y = pR->y + fs; - tmprects->width = lw; - tmprects->height = pR->height - lw; - tmprects++; - - tmprects->x = pR->x + pR->width - ss; - tmprects->y = pR->y + fs; - tmprects->width = lw; - tmprects->height = pR->height - lw; - tmprects++; - - tmprects->x = pR->x - ss; - tmprects->y = pR->y + pR->height - ss; - tmprects->width = pR->width + lw; - tmprects->height = lw; - tmprects++; - - pR++; - } - - (* pGC->ops->PolyFillRect)( pDraw, pGC, nrects << 2, tmprectsinit ); - - DEALLOCATE_LOCAL( tmprectsinit ); - return ; -} diff --git a/hw/xfree86/xf4bpp/xf4bpp.h b/hw/xfree86/xf4bpp/xf4bpp.h index 8d2da35a5..01512a8fb 100644 --- a/hw/xfree86/xf4bpp/xf4bpp.h +++ b/hw/xfree86/xf4bpp/xf4bpp.h @@ -149,14 +149,6 @@ void xf4bppTilePixmapFS( Bool xf4bppCreateGC( GCPtr ); -void xf4bppDestroyGC( - GC * -); -void xf4bppValidateGC( - GCPtr, - unsigned long, - DrawablePtr -); /* ppcGetSp.c */ void xf4bppGetSpans( diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c index b374bf580..5fd23f568 100644 --- a/hw/xgl/egl/kinput.c +++ b/hw/xgl/egl/kinput.c @@ -41,7 +41,7 @@ #ifdef XKB #define XKB_IN_SERVER -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif static DeviceIntPtr pKdKeyboard, pKdPointer; diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c index 57cb84702..92974f0d4 100644 --- a/hw/xgl/glx/xglx.c +++ b/hw/xgl/glx/xglx.c @@ -50,7 +50,7 @@ #ifdef XKB #include <X11/extensions/XKB.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBconfig.h> extern Bool diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c index 57f3a688f..1ec0609d9 100644 --- a/hw/xnest/Display.c +++ b/hw/xnest/Display.c @@ -39,7 +39,7 @@ XVisualInfo *xnestVisuals; int xnestNumVisuals; int xnestDefaultVisualIndex; Colormap *xnestDefaultColormaps; -int xnestNumDefaultColormaps; +static int xnestNumDefaultColormaps; int *xnestDepths; int xnestNumDepths; XPixmapFormatValues *xnestPixmapFormats; diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c index 0dacae70b..bb3cb1376 100644 --- a/hw/xnest/Keyboard.c +++ b/hw/xnest/Keyboard.c @@ -36,7 +36,7 @@ is" without express or implied warranty. #ifdef XKB #include <X11/extensions/XKB.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBconfig.h> extern Bool diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index e6870e702..e66b4f743 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -49,7 +49,7 @@ Window xnestScreenSaverWindows[MAXSCREENS]; extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); #endif -int xnestScreenGeneration = -1; +static int xnestScreenGeneration = -1; ScreenPtr xnestScreen(Window window) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 39a5eda7f..9457c9cc7 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -44,7 +44,7 @@ from The Open Group. #include <mntent.h> #endif #if defined(XKB) && defined(WIN32) -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef RELOCATE_PROJECTROOT #include <shlobj.h> diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c index e3d18083e..2c1877172 100644 --- a/hw/xwin/winconfig.c +++ b/hw/xwin/winconfig.c @@ -40,7 +40,7 @@ #ifndef XKB_IN_SERVER #define XKB_IN_SERVER #endif -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef XWIN_XF86CONFIG diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index 164e39160..d574f2053 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -44,7 +44,7 @@ #ifndef XKB_IN_SERVER #define XKB_IN_SERVER #endif -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif static Bool g_winKeyState[NUM_KEYCODES]; diff --git a/include/dix.h b/include/dix.h index 44862ad23..2ad6c77fa 100644 --- a/include/dix.h +++ b/include/dix.h @@ -81,59 +81,6 @@ SOFTWARE. return(BadIDChoice);\ } -/* - * We think that most hardware implementations of DBE will want - * LookupID*(dbe_back_buffer_id) to return the window structure that the - * id is a back buffer for. Since both front and back buffers will - * return the same structure, you need to be able to distinguish - * somewhere what kind of buffer (front/back) was being asked for, so - * that ddx can render to the right place. That's the problem that the - * following code solves. Note: we couldn't embed this in the LookupID* - * functions because the VALIDATE_DRAWABLE_AND_GC macro often circumvents - * those functions by checking a one-element cache. That's why we're - * mucking with VALIDATE_DRAWABLE_AND_GC. - * - * If you put -DNEED_DBE_BUF_BITS into PervasiveDBEDefines, the window - * structure will have two additional bits defined, srcBuffer and - * dstBuffer, and their values will be maintained via the macros - * SET_DBE_DSTBUF and SET_DBE_SRCBUF (below). If you also - * put -DNEED_DBE_BUF_VALIDATE into PervasiveDBEDefines, the function - * DbeValidateBuffer will be called any time the bits change to give you - * a chance to do some setup. See the DBE code for more details on this - * function. We put in these levels of conditionality so that you can do - * just what you need to do, and no more. If neither of these defines - * are used, the bits won't be there, and VALIDATE_DRAWABLE_AND_GC will - * be unchanged. dpw - */ - -#if defined(NEED_DBE_BUF_BITS) -#define SET_DBE_DSTBUF(_pDraw, _drawID) \ - SET_DBE_BUF(_pDraw, _drawID, dstBuffer, TRUE) -#define SET_DBE_SRCBUF(_pDraw, _drawID) \ - SET_DBE_BUF(_pDraw, _drawID, srcBuffer, FALSE) -#if defined (NEED_DBE_BUF_VALIDATE) -#define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ - if (_pDraw->type == DRAWABLE_WINDOW)\ - {\ - int thisbuf = (_pDraw->id == _drawID);\ - if (thisbuf != ((WindowPtr)_pDraw)->_whichBuffer)\ - {\ - ((WindowPtr)_pDraw)->_whichBuffer = thisbuf;\ - DbeValidateBuffer((WindowPtr)_pDraw, _drawID, _dstbuf);\ - }\ - } -#else /* want buffer bits, but don't need to call DbeValidateBuffer */ -#define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \ - if (_pDraw->type == DRAWABLE_WINDOW)\ - {\ - ((WindowPtr)_pDraw)->_whichBuffer = (_pDraw->id == _drawID);\ - } -#endif /* NEED_DBE_BUF_VALIDATE */ -#else /* don't want buffer bits in window */ -#define SET_DBE_DSTBUF(_pDraw, _drawID) /**/ -#define SET_DBE_SRCBUF(_pDraw, _drawID) /**/ -#endif /* NEED_DBE_BUF_BITS */ - #define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, pGC, client)\ if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\ (client->lastDrawableID != drawID))\ @@ -158,7 +105,6 @@ SOFTWARE. pGC = client->lastGC;\ pDraw = client->lastDrawable;\ }\ - SET_DBE_DSTBUF(pDraw, drawID);\ if (pGC->serialNumber != pDraw->serialNumber)\ ValidateGC(pDraw, pGC); @@ -220,8 +166,6 @@ extern int dixDestroyPixmap( pointer /*value*/, XID /*pid*/); -extern void CloseDownRetainedResources(void); - extern void InitClient( ClientPtr /*client*/, int /*i*/, @@ -243,25 +187,10 @@ extern void DeleteWindowFromAnySelections( extern void MarkClientException( ClientPtr /*client*/); -extern int GetGeometry( - ClientPtr /*client*/, - xGetGeometryReply* /* wa */); - extern int SendConnSetup( ClientPtr /*client*/, char* /*reason*/); -extern int DoGetImage( - ClientPtr /*client*/, - int /*format*/, - Drawable /*drawable*/, - int /*x*/, - int /*y*/, - int /*width*/, - int /*height*/, - Mask /*planemask*/, - xGetImageReply ** /*im_return*/); - #if defined(DDXBEFORERESET) extern void ddxBeforeReset (void); #endif @@ -669,10 +598,6 @@ typedef struct _CallbackProcs { DeleteCallbackListProcPtr DeleteCallbackList; } CallbackFuncsRec, *CallbackFuncsPtr; -extern Bool CreateCallbackList( - CallbackListPtr * /*pcbl*/, - CallbackFuncsPtr /*cbfuncs*/); - extern Bool AddCallback( CallbackListPtr * /*pcbl*/, CallbackProcPtr /*callback*/, diff --git a/include/exevents.h b/include/exevents.h index 7fbaddbb5..69d4abc4c 100644 --- a/include/exevents.h +++ b/include/exevents.h @@ -148,10 +148,6 @@ extern void DeleteWindowFromAnyExtEvents( WindowPtr /* pWin */, Bool /* freeResources */); -extern void DeleteDeviceFromAnyExtEvents( - WindowPtr /* pWin */, - DeviceIntPtr /* dev */); - extern int MaybeSendDeviceMotionNotifyHint ( deviceKeyButtonPointer * /* pEvents */, Mask /* mask */); @@ -164,11 +160,6 @@ extern void CheckDeviceGrabAndHintWindow ( ClientPtr /* client */, Mask /* deliveryMask */); -extern Mask DeviceEventMaskForClient( - DeviceIntPtr /* dev */, - WindowPtr /* pWin */, - ClientPtr /* client */); - extern void MaybeStopDeviceHint( DeviceIntPtr /* dev */, ClientPtr /* client */); @@ -179,13 +170,6 @@ extern int DeviceEventSuppressForWindow( Mask /* mask */, int /* maskndx */); -void FindInterestedChildren( - DeviceIntPtr /* dev */, - WindowPtr /* p1 */, - Mask /* mask */, - xEvent * /* ev */, - int /* count */); - void SendEventToAllWindows( DeviceIntPtr /* dev */, Mask /* mask */, diff --git a/include/extinit.h b/include/extinit.h index 7a12b1be9..d008651ce 100644 --- a/include/extinit.h +++ b/include/extinit.h @@ -37,111 +37,6 @@ XInputExtensionInit( void ); - -int -ProcIDispatch ( - ClientPtr /* client */ - ); - -int -SProcIDispatch( - ClientPtr /* client */ - ); - -void -SReplyIDispatch ( - ClientPtr /* client */, - int /* len */, - xGrabDeviceReply * /* rep */ - ); - -void -SEventIDispatch ( - xEvent * /* from */, - xEvent * /* to */ - ); - -void -SEventDeviceValuator ( - deviceValuator * /* from */, - deviceValuator * /* to */ - ); - -void -SEventFocus ( - deviceFocus * /* from */, - deviceFocus * /* to */ - ); - -void -SDeviceStateNotifyEvent ( - deviceStateNotify * /* from */, - deviceStateNotify * /* to */ - ); - -void -SDeviceKeyStateNotifyEvent ( - deviceKeyStateNotify * /* from */, - deviceKeyStateNotify * /* to */ - ); - -void -SDeviceButtonStateNotifyEvent ( - deviceButtonStateNotify * /* from */, - deviceButtonStateNotify * /* to */ - ); - -void -SChangeDeviceNotifyEvent ( - changeDeviceNotify * /* from */, - changeDeviceNotify * /* to */ - ); - -void -SDeviceMappingNotifyEvent ( - deviceMappingNotify * /* from */, - deviceMappingNotify * /* to */ - ); - -void -SDevicePresenceNotifyEvent ( - devicePresenceNotify * /* from */, - devicePresenceNotify * /* to */ - ); - -void -SDeviceEnterNotifyEvent ( - deviceEnterNotify * /* from */, - deviceEnterNotify * /* to */ - ); - -void -SDeviceLeaveNotifyEvent ( - deviceLeaveNotify * /* from */, - deviceLeaveNotify * /* to */ - ); - -void -SPointerKeyboardPairingChangedNotifyEvent ( - pairingChangedNotify * /* from */, - pairingChangedNotify * /* to */ - ); - -void -FixExtensionEvents ( - ExtensionEntry * /* extEntry */ - ); - -void -RestoreExtensionEvents ( - void - ); - -void -IResetProc( - ExtensionEntry * /* unused */ - ); - Bool DeviceIsPointerType( DeviceIntPtr dev @@ -154,41 +49,9 @@ AssignTypeAndName ( char * /* name */ ); -void -MakeDeviceTypeAtoms ( - void -); - DeviceIntPtr LookupDeviceIntRec ( CARD8 /* id */ ); -void -SetExclusiveAccess ( - Mask /* mask */ - ); - -void -AllowPropagateSuppress ( - Mask /* mask */ - ); - -Mask -GetNextExtEventMask ( - void -); - -void -SetMaskForExtEvent( - Mask /* mask */, - int /* event */ - ); - -void -SetEventInfo( - Mask /* mask */, - int /* constant */ - ); - #endif /* EXTINIT_H */ diff --git a/include/extnsionst.h b/include/extnsionst.h index 38d4bd7d9..28ae1d539 100644 --- a/include/extnsionst.h +++ b/include/extnsionst.h @@ -85,32 +85,11 @@ extern void NotImplemented ( /* FIXME: this may move to another file... */ xEvent *, xEvent *); -typedef void (* ExtensionLookupProc)( -#ifdef EXTENSION_PROC_ARGS - EXTENSION_PROC_ARGS -#else - /* args no longer indeterminate */ - char *name, - GCPtr pGC -#endif -); - -typedef struct _ProcEntry { - char *name; - ExtensionLookupProc proc; -} ProcEntryRec, *ProcEntryPtr; - -typedef struct _ScreenProcEntry { - int num; - ProcEntryPtr procList; -} ScreenProcEntry; - #define SetGCVector(pGC, VectorElement, NewRoutineAddress, Atom) \ pGC->VectorElement = NewRoutineAddress; #define GetGCValue(pGC, GCElement) (pGC->GCElement) - extern ExtensionEntry *AddExtension( char* /*name*/, int /*NumEvents*/, @@ -128,20 +107,6 @@ extern Bool AddExtensionAlias( extern ExtensionEntry *CheckExtension(const char *extname); extern ExtensionEntry *GetExtensionEntry(int major); -extern ExtensionLookupProc LookupProc( - char* /*name*/, - GCPtr /*pGC*/); - -extern Bool RegisterProc( - char* /*name*/, - GCPtr /*pGC*/, - ExtensionLookupProc /*proc*/); - -extern Bool RegisterScreenProc( - char* /*name*/, - ScreenPtr /*pScreen*/, - ExtensionLookupProc /*proc*/); - extern void DeclareExtensionSecurity( char * /*extname*/, Bool /*secure*/); diff --git a/include/gc.h b/include/gc.h index 6c7add620..3b7e38e02 100644 --- a/include/gc.h +++ b/include/gc.h @@ -126,11 +126,6 @@ extern int FreeGC( pointer /*pGC*/, XID /*gid*/); -extern void SetGCMask( - GCPtr /*pGC*/, - Mask /*selectMask*/, - Mask /*newDataMask*/); - extern GCPtr CreateScratchGC( ScreenPtr /*pScreen*/, unsigned /*depth*/); diff --git a/include/globals.h b/include/globals.h index 821b12bdb..e23ce7798 100644 --- a/include/globals.h +++ b/include/globals.h @@ -44,10 +44,6 @@ extern Bool DPMSCapableFlag; #endif #ifdef PANORAMIX -extern Bool PanoramiXMapped; -extern Bool PanoramiXVisibilityNotifySent; -extern Bool PanoramiXWindowExposureSent; -extern Bool PanoramiXOneExposeRequest; extern Bool PanoramiXExtensionDisabledHack; #endif diff --git a/include/inputstr.h b/include/inputstr.h index d4ba81158..d8d12d732 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -63,7 +63,7 @@ SOFTWARE. #define EMASKSIZE MAX_DEVICES -extern int CoreDevicePrivatesIndex, CoreDevicePrivatesGeneration; +extern int CoreDevicePrivatesIndex; /* Kludge: OtherClients and InputClients must be compatible, see code */ diff --git a/include/os.h b/include/os.h index d4eed220f..7399436fb 100644 --- a/include/os.h +++ b/include/os.h @@ -348,12 +348,6 @@ extern void InitAuthorization(char * /*filename*/); extern void RegisterAuthorizations(void); -extern XID AuthorizationToID ( - unsigned short name_length, - char *name, - unsigned short data_length, - char *data); - extern int AuthorizationFromID ( XID id, unsigned short *name_lenp, @@ -402,14 +396,6 @@ extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/); extern void ddxUseMsg(void); -/* - * idiom processing stuff - */ - -extern xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore); - -extern void SkipRequests(xReqPtr req, ClientPtr client, int numskipped); - /* int ReqLen(xReq *req, ClientPtr client) * Given a pointer to a *complete* request, return its length in bytes. * Note that if the request is a big request (as defined in the Big diff --git a/include/swaprep.h b/include/swaprep.h index 8a9dcf036..bebd3a814 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -91,9 +91,6 @@ extern void SQueryPointerReply( int /* size */, xQueryPointerReply * /* pRep */); -extern void SwapTimecoord( - xTimecoord * /* pCoord */); - extern void SwapTimeCoordWrite( ClientPtr /* pClient */, int /* size */, @@ -174,9 +171,6 @@ extern void SAllocColorPlanesReply( int /* size */, xAllocColorPlanesReply * /* pRep */); -extern void SwapRGB( - xrgb * /* prgb */); - extern void SQColorsExtend( ClientPtr /* pClient */, int /* size */, @@ -255,18 +249,6 @@ extern void WriteSConnectionInfo( unsigned long /* size */, char * /* pInfo */); -extern void SwapConnSetup( - xConnSetup * /* pConnSetup */, - xConnSetup * /* pConnSetupT */); - -extern void SwapWinRoot( - xWindowRoot * /* pRoot */, - xWindowRoot * /* pRootT */); - -extern void SwapVisual( - xVisualType * /* pVis */, - xVisualType * /* pVisT */); - extern void SwapConnSetupPrefix( xConnSetupPrefix * /* pcspFrom */, xConnSetupPrefix * /* pcspTo */); diff --git a/include/window.h b/include/window.h index 8f2522cbb..87118e3b0 100644 --- a/include/window.h +++ b/include/window.h @@ -97,14 +97,6 @@ extern Bool CreateRootWindow( extern void InitRootWindow( WindowPtr /*pWin*/); -extern void ClippedRegionFromBox( - WindowPtr /*pWin*/, - RegionPtr /*Rgn*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/); - typedef WindowPtr (* RealChildHeadProc) (WindowPtr pWin); void RegisterRealChildHeadProc (RealChildHeadProc proc); @@ -218,12 +210,6 @@ extern void UnmapSubwindows( extern void HandleSaveSet( ClientPtr /*client*/); -extern Bool VisibleBoundingBoxFromPoint( - WindowPtr /*pWin*/, - int /*x*/, - int /*y*/, - BoxPtr /*box*/); - extern Bool PointInWindowIsVisible( WindowPtr /*pWin*/, int /*x*/, @@ -248,9 +234,6 @@ extern void CheckWindowOptionalNeed( extern Bool MakeWindowOptional( WindowPtr /*pWin*/); -extern void DisposeWindowOptional( - WindowPtr /*pWin*/); - extern WindowPtr MoveWindowInStack( WindowPtr /*pWin*/, WindowPtr /*pNextSib*/); @@ -284,7 +267,5 @@ extern void DisableMapUnmapEvents( WindowPtr /* pWin */ ); extern void EnableMapUnmapEvents( WindowPtr /* pWin */ ); -extern Bool MapUnmapEventsEnabled( - WindowPtr /* pWin */ ); #endif /* WINDOW_H */ diff --git a/include/windowstr.h b/include/windowstr.h index 882f8a524..95954a7c3 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -146,12 +146,6 @@ typedef struct _Window { unsigned viewable:1; /* realized && InputOutput */ unsigned dontPropagate:3;/* index into DontPropagateMasks */ unsigned forcedBS:1; /* system-supplied backingStore */ -#ifdef NEED_DBE_BUF_BITS -#define DBE_FRONT_BUFFER 1 -#define DBE_BACK_BUFFER 0 - unsigned dstBuffer:1; /* destination buffer for rendering */ - unsigned srcBuffer:1; /* source buffer for rendering */ -#endif #ifdef COMPOSITE unsigned redirectDraw:1; /* rendering is redirected from here */ #endif diff --git a/include/xkbsrv.h b/include/xkbsrv.h new file mode 100644 index 000000000..5edee539b --- /dev/null +++ b/include/xkbsrv.h @@ -0,0 +1,1022 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, 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 Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifndef _XKBSRV_H_ +#define _XKBSRV_H_ + +#ifdef XKB_IN_SERVER +#define XkbAllocClientMap SrvXkbAllocClientMap +#define XkbAllocServerMap SrvXkbAllocServerMap +#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey +#define XkbCopyKeyTypes SrvXkbCopyKeyTypes +#define XkbFreeClientMap SrvXkbFreeClientMap +#define XkbFreeServerMap SrvXkbFreeServerMap +#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols +#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey +#define XkbResizeKeyActions SrvXkbResizeKeyActions +#define XkbResizeKeySyms SrvXkbResizeKeySyms +#define XkbResizeKeyType SrvXkbResizeKeyType +#define XkbAllocCompatMap SrvXkbAllocCompatMap +#define XkbAllocControls SrvXkbAllocControls +#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps +#define XkbAllocKeyboard SrvXkbAllocKeyboard +#define XkbAllocNames SrvXkbAllocNames +#define XkbFreeCompatMap SrvXkbFreeCompatMap +#define XkbFreeKeyboard SrvXkbFreeKeyboard +#define XkbFreeNames SrvXkbFreeNames +#define XkbLatchModifiers SrvXkbLatchModifiers +#define XkbLatchGroup SrvXkbLatchGroup +#define XkbVirtualModsToReal SrvXkbVirtualModsToReal +#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange +#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges +#endif + +#include <X11/extensions/XKBstr.h> +#include <X11/extensions/XKBproto.h> +#include "inputstr.h" + +typedef struct _XkbInterest { + DeviceIntPtr dev; + ClientPtr client; + XID resource; + struct _XkbInterest * next; + CARD16 extDevNotifyMask; + CARD16 stateNotifyMask; + CARD16 namesNotifyMask; + CARD32 ctrlsNotifyMask; + CARD8 compatNotifyMask; + BOOL bellNotifyMask; + BOOL actionMessageMask; + CARD16 accessXNotifyMask; + CARD32 iStateNotifyMask; + CARD32 iMapNotifyMask; + CARD16 altSymsNotifyMask; + CARD32 autoCtrls; + CARD32 autoCtrlValues; +} XkbInterestRec,*XkbInterestPtr; + +typedef struct _XkbRadioGroup { + CARD8 flags; + CARD8 nMembers; + CARD8 dfltDown; + CARD8 currentDown; + CARD8 members[XkbRGMaxMembers]; +} XkbRadioGroupRec, *XkbRadioGroupPtr; + +typedef struct _XkbEventCause { + CARD8 kc; + CARD8 event; + CARD8 mjr; + CARD8 mnr; + ClientPtr client; +} XkbEventCauseRec,*XkbEventCausePtr; +#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\ + (c)->mjr= (c)->mnr= 0; \ + (c)->client= NULL; } +#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\ + (c)->mjr= (j),(c)->mnr= (n);\ + (c)->client= (cl); } +#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl) +#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl) +#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0) + +#define _OFF_TIMER 0 +#define _KRG_WARN_TIMER 1 +#define _KRG_TIMER 2 +#define _SK_TIMEOUT_TIMER 3 +#define _ALL_TIMEOUT_TIMER 4 + +#define _BEEP_NONE 0 +#define _BEEP_FEATURE_ON 1 +#define _BEEP_FEATURE_OFF 2 +#define _BEEP_FEATURE_CHANGE 3 +#define _BEEP_SLOW_WARN 4 +#define _BEEP_SLOW_PRESS 5 +#define _BEEP_SLOW_ACCEPT 6 +#define _BEEP_SLOW_REJECT 7 +#define _BEEP_SLOW_RELEASE 8 +#define _BEEP_STICKY_LATCH 9 +#define _BEEP_STICKY_LOCK 10 +#define _BEEP_STICKY_UNLOCK 11 +#define _BEEP_LED_ON 12 +#define _BEEP_LED_OFF 13 +#define _BEEP_LED_CHANGE 14 +#define _BEEP_BOUNCE_REJECT 15 + +typedef struct _XkbSrvInfo { + XkbStateRec prev_state; + XkbStateRec state; + XkbDescPtr desc; + + DeviceIntPtr device; + KbdCtrlProcPtr kbdProc; + + XkbRadioGroupPtr radioGroups; + CARD8 nRadioGroups; + CARD8 clearMods; + CARD8 setMods; + INT16 groupChange; + + CARD16 dfltPtrDelta; + + double mouseKeysCurve; + double mouseKeysCurveFactor; + INT16 mouseKeysDX; + INT16 mouseKeysDY; + CARD8 mouseKeysFlags; + Bool mouseKeysAccel; + CARD8 mouseKeysCounter; + + CARD8 lockedPtrButtons; + CARD8 shiftKeyCount; + KeyCode mouseKey; + KeyCode inactiveKey; + KeyCode slowKey; + KeyCode repeatKey; + CARD8 krgTimerActive; + CARD8 beepType; + CARD8 beepCount; + + CARD32 flags; + CARD32 lastPtrEventTime; + CARD32 lastShiftEventTime; + OsTimerPtr beepTimer; + OsTimerPtr mouseKeyTimer; + OsTimerPtr slowKeysTimer; + OsTimerPtr bounceKeysTimer; + OsTimerPtr repeatKeyTimer; + OsTimerPtr krgTimer; +} XkbSrvInfoRec, *XkbSrvInfoPtr; + +#define XkbSLI_IsDefault (1L<<0) +#define XkbSLI_HasOwnState (1L<<1) + +typedef struct _XkbSrvLedInfo { + CARD16 flags; + CARD16 class; + CARD16 id; + union { + KbdFeedbackPtr kf; + LedFeedbackPtr lf; + } fb; + + CARD32 physIndicators; + CARD32 autoState; + CARD32 explicitState; + CARD32 effectiveState; + + CARD32 mapsPresent; + CARD32 namesPresent; + XkbIndicatorMapPtr maps; + Atom * names; + + CARD32 usesBase; + CARD32 usesLatched; + CARD32 usesLocked; + CARD32 usesEffective; + CARD32 usesCompat; + CARD32 usesControls; + + CARD32 usedComponents; +} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr; + +/* + * Settings for xkbClientFlags field (used by DIX) + * These flags _must_ not overlap with XkbPCF_* + */ +#define _XkbClientInitialized (1<<15) + +#define _XkbWantsDetectableAutoRepeat(c)\ + ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask) + +/* + * Settings for flags field + */ +#define _XkbStateNotifyInProgress (1<<0) + +typedef struct +{ + ProcessInputProc processInputProc; + ProcessInputProc realInputProc; + DeviceUnwrapProc unwrapProc; +} xkbDeviceInfoRec, *xkbDeviceInfoPtr; + +#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \ + if (device->public.processInputProc == device->public.realInputProc)\ + device->public.processInputProc = proc; \ + oldprocs->processInputProc = \ + oldprocs->realInputProc = device->public.realInputProc; \ + device->public.realInputProc = proc; \ + oldprocs->unwrapProc = device->unwrapProc; \ + device->unwrapProc = unwrapproc; + +#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \ + device->public.processInputProc = oldprocs->processInputProc; \ + device->public.realInputProc = oldprocs->realInputProc; \ + device->unwrapProc = oldprocs->unwrapProc; + +#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr) + +/***====================================================================***/ + + +/***====================================================================***/ + +#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask) +#define XkbAllFilteredEventsMask \ + (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask) + +/***====================================================================***/ + +extern int XkbReqCode; +extern int XkbEventBase; +extern int XkbDisableLockActions; +extern char * XkbBaseDirectory; +extern char * XkbBinDirectory; +extern char * XkbInitialMap; +extern unsigned int XkbXIUnsupported; + +extern Bool noXkbExtension; + +extern pointer XkbLastRepeatEvent; + +extern CARD32 xkbDebugFlags; + +#define _XkbAlloc(s) xalloc((s)) +#define _XkbCalloc(n,s) Xcalloc((n)*(s)) +#define _XkbRealloc(o,s) Xrealloc((o),(s)) +#define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t))) +#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t))) +#define _XkbTypedRealloc(o,n,t) \ + ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t)) +#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) +#define _XkbFree(p) Xfree(p) + +#define _XkbLibError(c,l,d) \ + { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } +#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) +#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) +#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) + +extern int DeviceKeyPress,DeviceKeyRelease; +extern int DeviceButtonPress,DeviceButtonRelease; + +#ifdef XINPUT +#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) +#define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) +#else +#define _XkbIsPressEvent(t) ((t)==KeyPress) +#define _XkbIsReleaseEvent(t) ((t)==KeyRelease) +#endif + +#define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ + ((k)<=(c)->curKeySyms.maxKeyCode)) +#define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\ + (c)->curKeySyms.minKeyCode+1) + +#define XConvertCase(s,l,u) XkbConvertCase(s,l,u) +#undef IsKeypadKey +#define IsKeypadKey(s) XkbKSIsKeypad(s) + +#define Status int +#define XPointer pointer +#define Display struct _XDisplay + +#ifndef True +#define True 1 +#define False 0 +#endif + +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + +_XFUNCPROTOBEGIN + +extern void XkbUseMsg( + void +); + +extern int XkbProcessArguments( + int /* argc */, + char ** /* argv */, + int /* i */ +); + +extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc); + +extern void XkbFreeCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern void XkbFreeNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern DeviceIntPtr _XkbLookupAnyDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupKeyboard( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupBellDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupLedDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern DeviceIntPtr _XkbLookupButtonDevice( + int /* id */, + int * /* why_rtrn */ +); + +extern XkbDescPtr XkbAllocKeyboard( + void +); + +extern Status XkbAllocClientMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nTypes */ +); + +extern Status XkbAllocServerMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nNewActions */ +); + +extern void XkbFreeClientMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern void XkbFreeServerMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern Status XkbAllocIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern Status XkbAllocCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nInterpret */ +); + +extern Status XkbAllocNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* nTotalRG */, + int /* nTotalAliases */ +); + +extern Status XkbAllocControls( + XkbDescPtr /* xkb */, + unsigned int /* which*/ +); + +extern Status XkbCopyKeyTypes( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */, + int /* num_types */ +); + +extern Status XkbResizeKeyType( + XkbDescPtr /* xkb */, + int /* type_ndx */, + int /* map_count */, + Bool /* want_preserve */, + int /* new_num_lvls */ +); + +extern void XkbFreeKeyboard( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeDesc */ +); + +extern void XkbSetActionKeyMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* mods */ +); + +extern Bool XkbCheckActionVMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* changed */ +); + +extern unsigned int XkbMaskForVMask( + XkbDescPtr /* xkb */, + unsigned int /* vmask */ +); + +extern Bool XkbVirtualModsToReal( + XkbDescPtr /* xkb */, + unsigned int /* virtua_mask */, + unsigned int * /* mask_rtrn */ +); + +extern unsigned int XkbAdjustGroup( + int /* group */, + XkbControlsPtr /* ctrls */ +); + +extern KeySym *XkbResizeKeySyms( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern XkbAction *XkbResizeKeyActions( + XkbDescPtr /* xkb */, + int /* key */, + int /* needed */ +); + +extern void XkbUpdateKeyTypesFromCore( + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */ +); + +extern void XkbUpdateDescActions( + XkbDescPtr /* xkb */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* changes */ +); + +extern void XkbUpdateActions( + DeviceIntPtr /* pXDev */, + KeyCode /* first */, + CARD8 /* num */, + XkbChangesPtr /* pChanges */, + unsigned int * /* needChecksRtrn */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateCoreDescription( + DeviceIntPtr /* keybd */, + Bool /* resize */ +); + +extern void XkbApplyMappingChange( + DeviceIntPtr /* pXDev */, + CARD8 /* request */, + KeyCode /* firstKey */, + CARD8 /* num */, + ClientPtr /* client */ +); + +extern void XkbSetIndicators( + DeviceIntPtr /* pXDev */, + CARD32 /* affect */, + CARD32 /* values */, + XkbEventCausePtr /* cause */ +); + +extern void XkbUpdateIndicators( + DeviceIntPtr /* keybd */, + CARD32 /* changed */, + Bool /* check_edevs */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo( + DeviceIntPtr /* dev */, + KbdFeedbackPtr /* kf */, + LedFeedbackPtr /* lf */, + unsigned int /* needed_parts */ +); + +extern XkbSrvLedInfoPtr XkbFindSrvLedInfo( + DeviceIntPtr /* dev */, + unsigned int /* class */, + unsigned int /* id */, + unsigned int /* needed_parts */ +); + +extern void XkbApplyLedNameChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_names */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbApplyLedMapChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_maps */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbApplyLedStateChanges( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* changed_leds */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbFlushLedEvents( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + XkbSrvLedInfoPtr /* sli */, + xkbExtensionDeviceNotify * /* ed */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern unsigned int XkbIndicatorsToUpdate( + DeviceIntPtr /* dev */, + unsigned long /* state_changes */, + Bool /* enabled_ctrl_changes */ +); + +extern void XkbComputeDerivedState( + XkbSrvInfoPtr /* xkbi */ +); + +extern void XkbCheckSecondaryEffects( + XkbSrvInfoPtr /* xkbi */, + unsigned int /* which */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void XkbCheckIndicatorMaps( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + unsigned int /* which */ +); + +extern unsigned int XkbStateChangedFlags( + XkbStatePtr /* old */, + XkbStatePtr /* new */ +); + +extern void XkbSendStateNotify( + DeviceIntPtr /* kbd */, + xkbStateNotify * /* pSN */ +); + +extern void XkbSendMapNotify( + DeviceIntPtr /* kbd */, + xkbMapNotify * /* ev */ +); + +extern int XkbComputeControlsNotify( + DeviceIntPtr /* kbd */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */, + xkbControlsNotify * /* pCN */, + Bool /* forceCtrlProc */ +); + +extern void XkbSendControlsNotify( + DeviceIntPtr /* kbd */, + xkbControlsNotify * /* ev */ +); + +extern void XkbSendCompatMapNotify( + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +); + +extern void XkbHandleBell( + BOOL /* force */, + BOOL /* eventOnly */, + DeviceIntPtr /* kbd */, + CARD8 /* percent */, + pointer /* ctrl */, + CARD8 /* class */, + Atom /* name */, + WindowPtr /* pWin */, + ClientPtr /* pClient */ +); + +extern void XkbSendAccessXNotify( + DeviceIntPtr /* kbd */, + xkbAccessXNotify * /* pEv */ +); + +extern void XkbSendNamesNotify( + DeviceIntPtr /* kbd */, + xkbNamesNotify * /* ev */ +); + +extern void XkbSendCompatNotify( + DeviceIntPtr /* kbd */, + xkbCompatMapNotify * /* ev */ +); + +extern void XkbSendActionMessage( + DeviceIntPtr /* kbd */, + xkbActionMessage * /* ev */ +); + +extern void XkbSendExtensionDeviceNotify( + DeviceIntPtr /* kbd */, + ClientPtr /* client */, + xkbExtensionDeviceNotify * /* ev */ +); + +extern void XkbSendNotification( + DeviceIntPtr /* kbd */, + XkbChangesPtr /* pChanges */, + XkbEventCausePtr /* cause */ +); + +extern void XkbProcessKeyboardEvent( + struct _xEvent * /* xE */, + DeviceIntPtr /* keybd */, + int /* count */ +); + +extern void XkbHandleActions( + DeviceIntPtr /* dev */, + DeviceIntPtr /* kbd */, + struct _xEvent * /* xE */, + int /* count */ +); + +extern Bool XkbEnableDisableControls( + XkbSrvInfoPtr /* xkbi */, + unsigned long /* change */, + unsigned long /* newValues */, + XkbChangesPtr /* changes */, + XkbEventCausePtr /* cause */ +); + +extern void AccessXInit( + DeviceIntPtr /* dev */ +); + +extern Bool AccessXFilterPressEvent( + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +); + +extern Bool AccessXFilterReleaseEvent( + register struct _xEvent * /* xE */, + register DeviceIntPtr /* keybd */, + int /* count */ +); + +extern void AccessXCancelRepeatKey( + XkbSrvInfoPtr /* xkbi */, + KeyCode /* key */ +); + +extern void AccessXComputeCurveFactor( + XkbSrvInfoPtr /* xkbi */, + XkbControlsPtr /* ctrls */ +); + +extern XkbInterestPtr XkbFindClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */ +); + +extern XkbInterestPtr XkbAddClientResource( + DevicePtr /* inDev */, + ClientPtr /* client */, + XID /* id */ +); + +extern int XkbRemoveResourceClient( + DevicePtr /* inDev */, + XID /* id */ +); + +extern int XkbDDXInitDevice( + DeviceIntPtr /* dev */ +); + +extern int XkbDDXAccessXBeep( + DeviceIntPtr /* dev */, + unsigned int /* what */, + unsigned int /* which */ +); + +extern void XkbDDXKeyClick( + DeviceIntPtr /* dev */, + int /* keycode */, + int /* synthetic */ +); + +extern int XkbDDXUsesSoftRepeat( + DeviceIntPtr /* dev */ +); + +extern void XkbDDXKeybdCtrlProc( + DeviceIntPtr /* dev */, + KeybdCtrl * /* ctrl */ +); + +extern void XkbDDXChangeControls( + DeviceIntPtr /* dev */, + XkbControlsPtr /* old */, + XkbControlsPtr /* new */ +); + +extern void XkbDDXUpdateDeviceIndicators( + DeviceIntPtr /* dev */, + XkbSrvLedInfoPtr /* sli */, + CARD32 /* newState */ +); + +extern void XkbDDXFakePointerButton( + int /* event */, + int /* button */ +); + +extern void XkbDDXFakePointerMotion( + unsigned int /* flags */, + int /* x */, + int /* y */ +); + +extern void XkbDDXFakeDeviceButton( + DeviceIntPtr /* dev */, + Bool /* press */, + int /* button */ +); + +extern int XkbDDXTerminateServer( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern int XkbDDXSwitchScreen( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern int XkbDDXPrivate( + DeviceIntPtr /* dev */, + KeyCode /* key */, + XkbAction * /* act */ +); + +extern void XkbDisableComputedAutoRepeats( + DeviceIntPtr /* pXDev */, + unsigned int /* key */ +); + +extern void XkbSetRepeatKeys( + DeviceIntPtr /* pXDev */, + int /* key */, + int /* onoff */ +); + +extern int XkbLatchModifiers( + DeviceIntPtr /* pXDev */, + CARD8 /* mask */, + CARD8 /* latches */ +); + +extern int XkbLatchGroup( + DeviceIntPtr /* pXDev */, + int /* group */ +); + +extern void XkbClearAllLatchesAndLocks( + DeviceIntPtr /* dev */, + XkbSrvInfoPtr /* xkbi */, + Bool /* genEv */, + XkbEventCausePtr /* cause */ +); + +extern void XkbSetRulesDflts( + char * /* rulesFile */, + char * /* model */, + char * /* layout */, + char * /* variant */, + char * /* options */ +); + +extern void XkbInitDevice( + DeviceIntPtr /* pXDev */ +); + +extern Bool XkbInitKeyboardDeviceStruct( + DeviceIntPtr /* pXDev */, + XkbComponentNamesPtr /* pNames */, + KeySymsPtr /* pSyms */, + CARD8 /* pMods */[], + BellProcPtr /* bellProc */, + KbdCtrlProcPtr /* ctrlProc */ +); + +extern int SProcXkbDispatch( + ClientPtr /* client */ +); + +extern XkbGeometryPtr XkbLookupNamedGeometry( + DeviceIntPtr /* dev */, + Atom /* name */, + Bool * /* shouldFree */ +); + +extern char * _XkbDupString( + char * /* str */ +); + +extern void XkbConvertCase( + KeySym /* sym */, + KeySym * /* lower */, + KeySym * /* upper */ +); + +extern Status XkbChangeKeycodeRange( + XkbDescPtr /* xkb */, + int /* minKC */, + int /* maxKC */, + XkbChangesPtr /* changes */ +); + +extern int XkbFinishDeviceInit( + DeviceIntPtr /* pXDev */ +); + +extern void XkbFreeSrvLedInfo( + XkbSrvLedInfoPtr /* sli */ +); + +extern void XkbFreeInfo( + XkbSrvInfoPtr /* xkbi */ +); + +extern Status XkbChangeTypesOfKey( + XkbDescPtr /* xkb */, + int /* key */, + int /* nGroups */, + unsigned int /* groups */, + int * /* newTypesIn */, + XkbMapChangesPtr /* changes */ +); + +extern int XkbKeyTypesForCoreSymbols( + XkbDescPtr /* xkb */, + int /* map_width */, + KeySym * /* core_syms */, + unsigned int /* protected */, + int * /* types_inout */, + KeySym * /* xkb_syms_rtrn */ +); + +extern Bool XkbApplyCompatMapToKey( + XkbDescPtr /* xkb */, + KeyCode /* key */, + XkbChangesPtr /* changes */ +); + +extern Bool XkbApplyVirtualModChanges( + XkbDescPtr /* xkb */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +extern void XkbSendNewKeyboardNotify( + DeviceIntPtr /* kbd */, + xkbNewKeyboardNotify * /* pNKN */ +); + +#ifdef XKBSRV_NEED_FILE_FUNCS + +#include <X11/extensions/XKMformat.h> +#include <X11/extensions/XKBfile.h> +#include <X11/extensions/XKBrules.h> + +#define _XkbListKeymaps 0 +#define _XkbListKeycodes 1 +#define _XkbListTypes 2 +#define _XkbListCompat 3 +#define _XkbListSymbols 4 +#define _XkbListGeometry 5 +#define _XkbListNumComponents 6 + +typedef struct _XkbSrvListInfo { + int szPool; + int nPool; + char * pool; + + int maxRtrn; + int nTotal; + + char * pattern[_XkbListNumComponents]; + int nFound[_XkbListNumComponents]; +} XkbSrvListInfoRec,*XkbSrvListInfoPtr; + +extern Status XkbDDXList( + DeviceIntPtr /* dev */, + XkbSrvListInfoPtr /* listing */, + ClientPtr /* client */ +); + +extern unsigned int XkbDDXLoadKeymapByNames( + DeviceIntPtr /* keybd */, + XkbComponentNamesPtr /* names */, + unsigned int /* want */, + unsigned int /* need */, + XkbFileInfoPtr /* finfoRtrn */, + char * /* keymapNameRtrn */, + int /* keymapNameRtrnLen */ +); + +extern Bool XkbDDXNamesFromRules( + DeviceIntPtr /* keybd */, + char * /* rules */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */ +); + +extern Bool XkbDDXApplyConfig( + XPointer /* cfg_in */, + XkbSrvInfoPtr /* xkbi */ +); + +extern XPointer XkbDDXPreloadConfig( + char ** /* rulesFileRtrn */, + XkbRF_VarDefsPtr /* defs */, + XkbComponentNamesPtr /* names */, + DeviceIntPtr /* dev */ +); + +extern int _XkbStrCaseCmp( + char * /* str1 */, + char * /* str2 */ +); + +#endif /* XKBSRV_NEED_FILE_FUNCS */ + +_XFUNCPROTOEND + +#define XkbAtomGetString(d,s) NameForAtom(s) + +#endif /* _XKBSRV_H_ */ @@ -85,18 +85,6 @@ extern RegionPtr miCopyArea( int /*yOut*/ ); -extern void miOpqStipDrawable( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - RegionPtr /*prgnSrc*/, - MiBits * /*pbits*/, - int /*srcx*/, - int /*w*/, - int /*h*/, - int /*dstx*/, - int /*dsty*/ -); - extern RegionPtr miCopyPlane( DrawablePtr /*pSrcDrawable*/, DrawablePtr /*pDstDrawable*/, @@ -145,15 +133,6 @@ extern void miRecolorCursor( /* midash.c */ -extern miDashPtr miDashLine( - int /*npt*/, - DDXPointPtr /*ppt*/, - unsigned int /*nDash*/, - unsigned char * /*pDash*/, - unsigned int /*offset*/, - int * /*pnseg*/ -); - extern void miStepDash( int /*dist*/, int * /*pDashIndex*/, @@ -187,6 +166,9 @@ extern void mieqProcessInputEvents( void ); +typedef void (*mieqHandler)(int, xEventPtr, DeviceIntPtr, int); +void mieqSetHandler(int event, mieqHandler handler); + /* miexpose.c */ extern RegionPtr miHandleExposures( @@ -324,16 +306,6 @@ extern void miPolySegment( /* mipolytext.c */ -extern int miPolyText( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - int /*count*/, - char * /*chars*/, - FontEncoding /*fontEncoding*/ -); - extern int miPolyText8( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, @@ -352,16 +324,6 @@ extern int miPolyText16( unsigned short * /*chars*/ ); -extern int miImageText( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - int /*count*/, - char * /*chars*/, - FontEncoding /*fontEncoding*/ -); - extern void miImageText8( DrawablePtr /*pDraw*/, GCPtr /*pGC*/, @@ -401,10 +363,6 @@ extern Bool miRectAlloc( int /*n*/ ); -extern void miSetExtents( - RegionPtr /*pReg*/ -); - extern int miFindMaxBand( RegionPtr /*prgn*/ ); @@ -415,7 +373,6 @@ extern Bool miValidRegion( ); #endif -extern Bool miRegionDataCopy(RegionPtr dst, RegionPtr src); extern Bool miRegionBroken(RegionPtr pReg); /* miscrinit.c */ @@ -430,11 +387,6 @@ extern Bool miModifyPixmapHeader( pointer /*pPixData*/ ); -extern Bool miCloseScreen( - int /*index*/, - ScreenPtr /*pScreen*/ -); - extern Bool miCreateScreenResources( ScreenPtr /*pScreen*/ ); diff --git a/mi/miarc.c b/mi/miarc.c index 8b6d8c0a9..2bbbb0e7f 100644 --- a/mi/miarc.c +++ b/mi/miarc.c @@ -425,15 +425,8 @@ static unsigned long lrustamp; static arcCacheRec *lastCacheHit = &arcCache[0]; static RESTYPE cacheType; -/* - * External so it can be called when low on memory. - * Call with a zero ID in that case. - */ -/*ARGSUSED*/ -int -miFreeArcCache (data, id) - pointer data; - XID id; +static int +miFreeArcCache (pointer data, XID id) { int k; arcCacheRec *cent; @@ -3136,8 +3129,8 @@ struct finalSpanChunk { static struct finalSpanChunk *chunks; -struct finalSpan * -realAllocSpan () +static struct finalSpan * +realAllocSpan (void) { struct finalSpanChunk *newChunk; struct finalSpan *span; diff --git a/mi/mibitblt.c b/mi/mibitblt.c index e4b14078f..e61855a93 100644 --- a/mi/mibitblt.c +++ b/mi/mibitblt.c @@ -400,13 +400,9 @@ miGetPlane( * Note how the clipped out bits of the bitmap are always the background * color so that the stipple never causes FillRect to draw them. */ -void -miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty) - DrawablePtr pDraw; - GCPtr pGC; - RegionPtr prgnSrc; - MiBits *pbits; - int srcx, w, h, dstx, dsty; +static void +miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc, + MiBits *pbits, int srcx, int w, int h, int dstx, int dsty) { int oldfill, i; unsigned long oldfg; diff --git a/mi/midash.c b/mi/midash.c index 6dd161a39..912fb0389 100644 --- a/mi/midash.c +++ b/mi/midash.c @@ -54,196 +54,6 @@ SOFTWARE. static miDashPtr CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax); -/* return a list of DashRec. there will be an extra -entry at the end holding the last point of the polyline. - this means that the code that actually draws dashes can -get a pair of points for every dash. only the point in the last -dash record is useful; the other fields are not used. - nseg is the number of segments, not the number of points. - -example: - - dash1.start - dash2.start - dash3.start - last-point - -defines a list of segments - (dash1.pt, dash2.pt) - (dash2.pt, dash3.pt) - (dash3.pt, last-point) -and nseg == 3. - -NOTE: - EVEN_DASH == ~ODD_DASH - -NOTE ALSO: - miDashLines may return 0 segments, going from pt[0] to pt[0] with one dash. -*/ - -miDashPtr -miDashLine(npt, ppt, nDash, pDash, offset, pnseg) -int npt; -DDXPointPtr ppt; -unsigned int nDash; -unsigned char *pDash; -unsigned int offset; -int *pnseg; -{ - DDXPointRec pt1, pt2; - int lenCur; /* npt used from this dash */ - int lenMax; /* npt in this dash */ - int iDash = 0; /* index of current dash */ - int which; /* EVEN_DASH or ODD_DASH */ - miDashPtr pseg; /* list of dash segments */ - miDashPtr psegBase; /* start of list */ - int nseg = 0; /* number of dashes so far */ - int nsegMax = 0; /* num segs we can fit in this list */ - - int x, y, len; - int adx, ady, signdx, signdy; - int du, dv, e1, e2, e, base_e = 0; - - lenCur = offset; - which = EVEN_DASH; - while(lenCur >= pDash[iDash]) - { - lenCur -= pDash[iDash]; - iDash++; - if (iDash >= nDash) - iDash = 0; - which = ~which; - } - lenMax = pDash[iDash]; - - psegBase = (miDashPtr)NULL; - pt2 = ppt[0]; /* just in case there is only one point */ - - while(--npt) - { - if (PtEqual(ppt[0], ppt[1])) - { - ppt++; - continue; /* no duplicated points in polyline */ - } - pt1 = *ppt++; - pt2 = *ppt; - - adx = pt2.x - pt1.x; - ady = pt2.y - pt1.y; - signdx = sign(adx); - signdy = sign(ady); - adx = abs(adx); - ady = abs(ady); - - if (adx > ady) - { - du = adx; - dv = ady; - len = adx; - } - else - { - du = ady; - dv = adx; - len = ady; - } - - e1 = dv * 2; - e2 = e1 - 2*du; - e = e1 - du; - x = pt1.x; - y = pt1.y; - - nseg++; - pseg = CheckDashStorage(&psegBase, nseg, &nsegMax); - if (!pseg) - return (miDashPtr)NULL; - pseg->pt = pt1; - pseg->e1 = e1; - pseg->e2 = e2; - base_e = pseg->e = e; - pseg->which = which; - pseg->newLine = 1; - - while (len--) - { - if (adx > ady) - { - /* X_AXIS */ - if (((signdx > 0) && (e < 0)) || - ((signdx <=0) && (e <=0)) - ) - { - e += e1; - } - else - { - y += signdy; - e += e2; - } - x += signdx; - } - else - { - /* Y_AXIS */ - if (((signdx > 0) && (e < 0)) || - ((signdx <=0) && (e <=0)) - ) - { - e +=e1; - } - else - { - x += signdx; - e += e2; - } - y += signdy; - } - - lenCur++; - if (lenCur >= lenMax && (len || npt <= 1)) - { - nseg++; - pseg = CheckDashStorage(&psegBase, nseg, &nsegMax); - if (!pseg) - return (miDashPtr)NULL; - pseg->pt.x = x; - pseg->pt.y = y; - pseg->e1 = e1; - pseg->e2 = e2; - pseg->e = e; - which = ~which; - pseg->which = which; - pseg->newLine = 0; - - /* move on to next dash */ - iDash++; - if (iDash >= nDash) - iDash = 0; - lenMax = pDash[iDash]; - lenCur = 0; - } - } /* while len-- */ - } /* while --npt */ - - if (lenCur == 0 && nseg != 0) - { - nseg--; - which = ~which; - } - *pnseg = nseg; - pseg = CheckDashStorage(&psegBase, nseg+1, &nsegMax); - if (!pseg) - return (miDashPtr)NULL; - pseg->pt = pt2; - pseg->e = base_e; - pseg->which = which; - pseg->newLine = 0; - return psegBase; -} - - #define NSEGDELTA 16 /* returns a pointer to the pseg[nseg-1], growing the storage as @@ -251,8 +61,7 @@ necessary. this interface seems unnecessarily cumbersome. */ -static -miDashPtr +static miDashPtr CheckDashStorage( miDashPtr *ppseg, /* base pointer */ int nseg, /* number of segment we want to write to */ @@ -81,6 +81,7 @@ typedef struct _EventQueue { EventRec events[QUEUE_SIZE]; /* static allocation for signals */ ScreenPtr pEnqueueScreen; /* screen events are being delivered to */ ScreenPtr pDequeueScreen; /* screen events are being dispatched to */ + mieqHandler handlers[128]; /* custom event handler */ } EventQueueRec, *EventQueuePtr; static EventQueueRec miEventQueue; @@ -88,11 +89,15 @@ static EventQueueRec miEventQueue; Bool mieqInit() { + int i; + miEventQueue.head = miEventQueue.tail = 0; miEventQueue.lastEventTime = GetTimeInMillis (); miEventQueue.lastMotion = FALSE; miEventQueue.pEnqueueScreen = screenInfo.screens[0]; miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen; + for (i = 0; i < 128; i++) + miEventQueue.handlers[i] = NULL; SetInputCheck(&miEventQueue.head, &miEventQueue.tail); return TRUE; } @@ -188,6 +193,16 @@ mieqSwitchScreen(ScreenPtr pScreen, Bool fromDIX) miEventQueue.pDequeueScreen = pScreen; } +void +mieqSetHandler(int event, mieqHandler handler) +{ + if (handler && miEventQueue.handlers[event]) + ErrorF("mieq: warning: overriding existing handler %p with %p for " + "event %d\n", miEventQueue.handlers[event], handler, event); + + miEventQueue.handlers[event] = handler; +} + /* Call this from ProcessInputEvents(). */ void mieqProcessInputEvents() @@ -225,6 +240,15 @@ mieqProcessInputEvents() else ++miEventQueue.head; + /* If someone's registered a custom event handler, let them + * steal it. */ + if (miEventQueue.handlers[e->event->u.u.type]) { + miEventQueue.handlers[e->event->u.u.type](miEventQueue.pDequeueScreen->myNum, + e->event, dev, + e->nevents); + return; + } + /* If this is a core event, make sure our keymap, et al, is * changed to suit. */ if (e->event[0].u.u.type == KeyPress || diff --git a/mi/mifillarc.c b/mi/mifillarc.c index 46c073851..c561b1f5b 100644 --- a/mi/mifillarc.c +++ b/mi/mifillarc.c @@ -107,10 +107,8 @@ miFillArcSetup(arc, info) } } -void -miFillArcDSetup(arc, info) - xArc *arc; - miFillArcDRec *info; +static void +miFillArcDSetup(xArc *arc, miFillArcDRec *info) { /* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */ /* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */ @@ -188,15 +186,9 @@ miGetArcEdge( } } -void -miEllipseAngleToSlope (angle, width, height, dxp, dyp, d_dxp, d_dyp) - int angle; - int width; - int height; - int *dxp; - int *dyp; - double *d_dxp; - double *d_dyp; +static void +miEllipseAngleToSlope (int angle, int width, int height, int *dxp, int *dyp, + double *d_dxp, double *d_dyp) { int dx, dy; double d_dx, d_dy, scale; diff --git a/mi/mifillarc.h b/mi/mifillarc.h index 53f6f23ea..3e3bb9858 100644 --- a/mi/mifillarc.h +++ b/mi/mifillarc.h @@ -176,35 +176,11 @@ typedef struct _miArcSlice { #define miFillInArcLower(slw) (((iny + dy) != 0) && \ ((slw > 1) || (ine != inxk))) -extern int miFreeArcCache( - pointer /*data*/, - XID /*id*/ -); - -extern struct finalSpan *realAllocSpan( - void -); - extern void miFillArcSetup( xArc * /*arc*/, miFillArcRec * /*info*/ ); -extern void miFillArcDSetup( - xArc * /*arc*/, - miFillArcDRec * /*info*/ -); - -extern void miEllipseAngleToSlope( - int /*angle*/, - int /*width*/, - int /*height*/, - int * /*dxp*/, - int * /*dyp*/, - double * /*d_dxp*/, - double * /*d_dyp*/ -); - extern void miFillArcSliceSetup( xArc * /*arc*/, miArcSliceRec * /*slice*/, diff --git a/mi/mioverlay.c b/mi/mioverlay.c index 5724a6fed..9701001d6 100644 --- a/mi/mioverlay.c +++ b/mi/mioverlay.c @@ -54,8 +54,8 @@ typedef struct { } miOverlayScreenRec, *miOverlayScreenPtr; static unsigned long miOverlayGeneration = 0; -int miOverlayWindowIndex = -1; -int miOverlayScreenIndex = -1; +static int miOverlayWindowIndex = -1; +static int miOverlayScreenIndex = -1; static void RebuildTree(WindowPtr); static Bool HasUnderlayChildren(WindowPtr); diff --git a/mi/mipointer.c b/mi/mipointer.c index 3c09064c7..863a4052a 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -1,9 +1,4 @@ /* - * mipointer.c - */ - - -/* Copyright 1989, 1998 The Open Group @@ -467,6 +462,30 @@ miPointerAbsoluteCursor (int x, int y, unsigned long time) miPointerSetPosition(inputInfo.pointer, &x, &y, time); } +/* Move the pointer on the current screen, and update the sprite. */ +static void +miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, + unsigned long time) +{ + int valuators[2]; + miPointerPtr pPointer = MIPOINTER(pDev); + SetupScreen(pScreen); + + + if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) + && !pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen) + { + pPointer->devx = x; + pPointer->devy = y; + if(!pPointer->pCursor->bits->emptyMask) + (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y); + } + + pPointer->x = x; + pPointer->y = y; + pPointer->pScreen = pScreen; +} + _X_EXPORT void miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time) { @@ -561,27 +580,3 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, unsigned long for (i = 0; i < nevents; i++) mieqEnqueue(inputInfo.pointer, &events[i]); } - -/* Move the pointer on the current screen, and update the sprite. */ -void -miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, - unsigned long time) -{ - int valuators[2]; - miPointerPtr pPointer = MIPOINTER(pDev); - SetupScreen(pScreen); - - - if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) - && !pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen) - { - pPointer->devx = x; - pPointer->devy = y; - if(!pPointer->pCursor->bits->emptyMask) - (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y); - } - - pPointer->x = x; - pPointer->y = y; - pPointer->pScreen = pScreen; -} diff --git a/mi/mipointer.h b/mi/mipointer.h index 541e89bdf..c4834139a 100644 --- a/mi/mipointer.h +++ b/mi/mipointer.h @@ -1,10 +1,4 @@ /* - * mipointer.h - * - */ - - -/* Copyright 1989, 1998 The Open Group @@ -178,15 +172,6 @@ extern void miPointerSetPosition( extern void miPointerUpdateSprite( DeviceIntPtr pDev); -/* Moves the sprite to x, y on the current screen, and updates the event - * history. */ -extern void miPointerMoved( - DeviceIntPtr pDev, - ScreenPtr pScreen, - int x, - int y, - unsigned long time); - extern int miPointerScreenIndex; #endif /* MIPOINTER_H */ diff --git a/mi/mipoly.h b/mi/mipoly.h index 8e04f6737..c1bab4943 100644 --- a/mi/mipoly.h +++ b/mi/mipoly.h @@ -180,14 +180,6 @@ typedef struct _ScanLineListBlock { /* mipolyutil.c */ -extern Bool miInsertEdgeInET( - EdgeTable * /*ET*/, - EdgeTableEntry * /*ETE*/, - int /*scanline*/, - ScanLineListBlock ** /*SLLBlock*/, - int * /*iSLLBlock*/ -); - extern Bool miCreateETandAET( int /*count*/, DDXPointPtr /*pts*/, diff --git a/mi/mipolytext.c b/mi/mipolytext.c index 6af02e046..82b16f7d2 100644 --- a/mi/mipolytext.c +++ b/mi/mipolytext.c @@ -66,30 +66,6 @@ SOFTWARE. #include "dixfontstr.h" #include "mi.h" -int -miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding) - DrawablePtr pDraw; - GCPtr pGC; - int x, y; - int count; - char *chars; - FontEncoding fontEncoding; -{ - unsigned long n, i; - int w; - CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ - - GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, - fontEncoding, &n, charinfo); - w = 0; - for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; - if (n != 0) - (*pGC->ops->PolyGlyphBlt)( - pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); - return x+w; -} - - _X_EXPORT int miPolyText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; @@ -112,7 +88,6 @@ miPolyText8(pDraw, pGC, x, y, count, chars) return x+w; } - _X_EXPORT int miPolyText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; @@ -136,31 +111,6 @@ miPolyText16(pDraw, pGC, x, y, count, chars) return x+w; } - -int -miImageText(pDraw, pGC, x, y, count, chars, fontEncoding) - DrawablePtr pDraw; - GCPtr pGC; - int x, y; - int count; - char *chars; - FontEncoding fontEncoding; -{ - unsigned long n, i; - FontPtr font = pGC->font; - int w; - CharInfoPtr charinfo[255]; - - GetGlyphs(font, (unsigned long)count, (unsigned char *)chars, - fontEncoding, &n, charinfo); - w = 0; - for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth; - if (n !=0 ) - (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); - return x+w; -} - - _X_EXPORT void miImageText8(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; @@ -179,7 +129,6 @@ miImageText8(pDraw, pGC, x, y, count, chars) (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font)); } - _X_EXPORT void miImageText16(pDraw, pGC, x, y, count, chars) DrawablePtr pDraw; diff --git a/mi/mipolyutil.c b/mi/mipolyutil.c index fe72e557f..6ec860a25 100644 --- a/mi/mipolyutil.c +++ b/mi/mipolyutil.c @@ -73,13 +73,9 @@ SOFTWARE. * bucket. Finally, we can insert it. * */ -Bool -miInsertEdgeInET(ET, ETE, scanline, SLLBlock, iSLLBlock) - EdgeTable *ET; - EdgeTableEntry *ETE; - int scanline; - ScanLineListBlock **SLLBlock; - int *iSLLBlock; +static Bool +miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline, + ScanLineListBlock **SLLBlock, int *iSLLBlock) { EdgeTableEntry *start, *prev; ScanLineList *pSLL, *pPrevSLL; diff --git a/mi/miregion.c b/mi/miregion.c index 542209982..e980ad18e 100644 --- a/mi/miregion.c +++ b/mi/miregion.c @@ -221,7 +221,7 @@ _X_EXPORT BoxRec miEmptyBox = {0, 0, 0, 0}; _X_EXPORT RegDataRec miEmptyData = {0, 0}; RegDataRec miBrokenData = {0, 0}; -RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData }; +static RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData }; _X_EXPORT void miPrintRegion(rgn) @@ -913,7 +913,7 @@ miRegionOp( * *----------------------------------------------------------------------- */ -void +static void miSetExtents (pReg) RegionPtr pReg; { @@ -2182,35 +2182,6 @@ miTranslateRegion(pReg, x, y) } } -Bool -miRegionDataCopy( - RegionPtr dst, - RegionPtr src) -{ - good(dst); - good(src); - if (dst->data) - return TRUE; - if (dst == src) - return TRUE; - if (!src->data || !src->data->size) - { - xfreeData(dst); - dst->data = (RegDataPtr)NULL; - return TRUE; - } - if (!dst->data || (dst->data->size < src->data->numRects)) - { - xfreeData(dst); - dst->data = xallocData(src->data->numRects); - if (!dst->data) - return miRegionBreak (dst); - } - dst->data->size = src->data->size; - dst->data->numRects = src->data->numRects; - return TRUE; -} - _X_EXPORT void miRegionReset(pReg, pBox) RegionPtr pReg; diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 7922cb66e..cc40cbede 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -126,12 +126,8 @@ miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, return TRUE; } - -/*ARGSUSED*/ -Bool -miCloseScreen (iScreen, pScreen) - int iScreen; - ScreenPtr pScreen; +static Bool +miCloseScreen (int iScreen, ScreenPtr pScreen) { return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate)); } @@ -312,7 +308,7 @@ miAllocateGCPrivateIndex() } _X_EXPORT int miZeroLineScreenIndex; -unsigned int miZeroLineGeneration = 0; +static unsigned int miZeroLineGeneration = 0; _X_EXPORT void miSetZeroLineBias(pScreen, bias) diff --git a/mi/mispans.c b/mi/mispans.c index 61d72e46c..530d9dff2 100644 --- a/mi/mispans.c +++ b/mi/mispans.c @@ -78,9 +78,7 @@ void miInitSpanGroup(spanGroup) #define YMIN(spans) (spans->points[0].y) #define YMAX(spans) (spans->points[spans->count-1].y) -void miSubtractSpans (spanGroup, sub) - SpanGroup *spanGroup; - Spans *sub; +static void miSubtractSpans (SpanGroup *spanGroup, Spans *sub) { int i, subCount, spansCount; int ymin, ymax, xmin, xmax; @@ -364,9 +362,8 @@ static int UniquifySpansX( return (newWidths - startNewWidths) + 1; } /* UniquifySpansX */ -void -miDisposeSpanGroup (spanGroup) - SpanGroup *spanGroup; +static void +miDisposeSpanGroup (SpanGroup *spanGroup) { int i; Spans *spans; @@ -538,24 +535,3 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup) spanGroup->ymin = MAXSHORT; spanGroup->ymax = MINSHORT; } - - -void miFillSpanGroup(pDraw, pGC, spanGroup) - DrawablePtr pDraw; - GCPtr pGC; - SpanGroup *spanGroup; -{ - int i; - Spans *spans; - - for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) { - (*pGC->ops->FillSpans) - (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE); - xfree(spans->points); - xfree(spans->widths); - } - - spanGroup->count = 0; - spanGroup->ymin = MAXSHORT; - spanGroup->ymax = MINSHORT; -} /* FillSpanGroup */ diff --git a/mi/mispans.h b/mi/mispans.h index 5b141afe2..258b29279 100644 --- a/mi/mispans.h +++ b/mi/mispans.h @@ -71,13 +71,6 @@ extern void miAppendSpans( Spans * /*spans*/ ); -/* Paint a span group, possibly with some overlap */ -extern void miFillSpanGroup( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - SpanGroup * /*spanGroup*/ -); - /* Paint a span group, insuring that each pixel is painted at most once */ extern void miFillUniqueSpanGroup( DrawablePtr /*pDraw*/, @@ -90,15 +83,6 @@ extern void miFreeSpanGroup( SpanGroup * /*spanGroup*/ ); -extern void miSubtractSpans( - SpanGroup * /*spanGroup*/, - Spans * /*sub*/ -); - -extern void miDisposeSpanGroup( - SpanGroup * /*spanGroup*/ -); - extern int miClipSpans( RegionPtr /*prgnDst*/, DDXPointPtr /*ppt*/, diff --git a/mi/miwideline.c b/mi/miwideline.c index 7f99aca51..08e4aa33e 100644 --- a/mi/miwideline.c +++ b/mi/miwideline.c @@ -67,17 +67,11 @@ static void miLineArc(DrawablePtr pDraw, GCPtr pGC, * spans-based polygon filler */ -void -miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height, - left, right, left_count, right_count) - DrawablePtr pDrawable; - GCPtr pGC; - unsigned long pixel; - SpanDataPtr spanData; - int y; /* start y coordinate */ - int overall_height; /* height of entire segment */ - PolyEdgePtr left, right; - int left_count, right_count; +static void +miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, + SpanDataPtr spanData, int y, int overall_height, + PolyEdgePtr left, PolyEdgePtr right, + int left_count, int right_count) { int left_x = 0, left_e = 0; int left_stepx = 0; @@ -873,11 +867,8 @@ miLineArcD ( return (pts - points); } -int -miRoundJoinFace (face, edge, leftEdge) - LineFacePtr face; - PolyEdgePtr edge; - Bool *leftEdge; +static int +miRoundJoinFace (LineFacePtr face, PolyEdgePtr edge, Bool *leftEdge) { int y; int dx, dy; @@ -1114,16 +1105,10 @@ miLineArc ( } } -void -miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg, isInt) - DrawablePtr pDrawable; - GCPtr pGC; - unsigned long pixel; - SpanDataPtr spanData; - LineFacePtr face; - Bool isLeft; - double xorg, yorg; - Bool isInt; +static void +miLineProjectingCap (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, + SpanDataPtr spanData, LineFacePtr face, Bool isLeft, + double xorg, double yorg, Bool isInt) { int xorgi = 0, yorgi = 0; int lw; @@ -1506,11 +1491,8 @@ miWideSegment ( } } -SpanDataPtr -miSetupSpanData (pGC, spanData, npt) - GCPtr pGC; - SpanDataPtr spanData; - int npt; +static SpanDataPtr +miSetupSpanData (GCPtr pGC, SpanDataPtr spanData, int npt) { if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu)) return (SpanDataPtr) NULL; @@ -1520,11 +1502,8 @@ miSetupSpanData (pGC, spanData, npt) return spanData; } -void -miCleanupSpanData (pDrawable, pGC, spanData) - DrawablePtr pDrawable; - GCPtr pGC; - SpanDataPtr spanData; +static void +miCleanupSpanData (DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData) { if (pGC->lineStyle == LineDoubleDash) { diff --git a/mi/miwideline.h b/mi/miwideline.h index 8cfa63008..9d1aa03cb 100644 --- a/mi/miwideline.h +++ b/mi/miwideline.h @@ -153,24 +153,6 @@ typedef struct _LineFace { } \ } -extern void miFillPolyHelper( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - unsigned long /*pixel*/, - SpanDataPtr /*spanData*/, - int /*y*/, - int /*overall_height*/, - PolyEdgePtr /*left*/, - PolyEdgePtr /*right*/, - int /*left_count*/, - int /*right_count*/ -); -extern int miRoundJoinFace( - LineFacePtr /*face*/, - PolyEdgePtr /*edge*/, - Bool * /*leftEdge*/ -); - extern void miRoundJoinClip( LineFacePtr /*pLeft*/, LineFacePtr /*pRight*/, @@ -189,30 +171,6 @@ extern int miRoundCapClip( Bool * /*leftEdge*/ ); -extern void miLineProjectingCap( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - unsigned long /*pixel*/, - SpanDataPtr /*spanData*/, - LineFacePtr /*face*/, - Bool /*isLeft*/, - double /*xorg*/, - double /*yorg*/, - Bool /*isInt*/ -); - -extern SpanDataPtr miSetupSpanData( - GCPtr /*pGC*/, - SpanDataPtr /*spanData*/, - int /*npt*/ -); - -extern void miCleanupSpanData( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - SpanDataPtr /*spanData*/ -); - extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy, int xi, int yi, int left, PolyEdgePtr edge); extern int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes, diff --git a/mi/mizerarc.c b/mi/mizerarc.c index f1adc9e2b..9d4715a30 100644 --- a/mi/mizerarc.c +++ b/mi/mizerarc.c @@ -401,10 +401,8 @@ miZeroArcSetup(arc, info, ok360) #define DoPix(idx,xval,yval) if (mask & (1 << idx)) Pixelate(xval, yval); -DDXPointPtr -miZeroArcPts(arc, pts) - xArc *arc; - DDXPointPtr pts; +static DDXPointPtr +miZeroArcPts(xArc *arc, DDXPointPtr pts) { miZeroArcRec info; int x, y, a, b, d, mask; diff --git a/mi/mizerarc.h b/mi/mizerarc.h index 8119d885e..28ebbe030 100644 --- a/mi/mizerarc.h +++ b/mi/mizerarc.h @@ -124,9 +124,3 @@ extern Bool miZeroArcSetup( miZeroArcRec * /*info*/, Bool /*ok360*/ ); - -extern DDXPointPtr miZeroArcPts( - xArc * /*arc*/, - DDXPointPtr /*pts*/ -); - diff --git a/miext/cw/cw.c b/miext/cw/cw.c index f60f8cf28..69502711a 100644 --- a/miext/cw/cw.c +++ b/miext/cw/cw.c @@ -50,7 +50,6 @@ int cwWindowIndex; #ifdef RENDER int cwPictureIndex; #endif -static Bool cwDisabled[MAXSCREENS]; static unsigned long cwGeneration = 0; extern GCOps cwGCOps; @@ -619,9 +618,9 @@ void miInitializeCompositeWrapper(ScreenPtr pScreen) { cwScreenPtr pScreenPriv; - - if (cwDisabled[pScreen->myNum]) - return; +#ifdef RENDER + Bool has_render = GetPictureScreenIfSet(pScreen) != NULL; +#endif if (cwGeneration != serverGeneration) { @@ -631,7 +630,8 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) cwGCIndex = AllocateGCPrivateIndex(); cwWindowIndex = AllocateWindowPrivateIndex(); #ifdef RENDER - cwPictureIndex = AllocatePicturePrivateIndex(); + if (has_render) + cwPictureIndex = AllocatePicturePrivateIndex(); #endif cwGeneration = serverGeneration; } @@ -640,8 +640,10 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0)) return; #ifdef RENDER - if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0)) - return; + if (has_render) { + if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0)) + return; + } #endif pScreenPriv = (cwScreenPtr)xalloc(sizeof(cwScreenRec)); if (!pScreenPriv) @@ -661,17 +663,11 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap); #ifdef RENDER - if (GetPictureScreen (pScreen)) + if (has_render) cwInitializeRender(pScreen); #endif } -_X_EXPORT void -miDisableCompositeWrapper(ScreenPtr pScreen) -{ - cwDisabled[pScreen->myNum] = TRUE; -} - static Bool cwCloseScreen (int i, ScreenPtr pScreen) { diff --git a/miext/cw/cw.h b/miext/cw/cw.h index 09cfc7828..69abbbfed 100644 --- a/miext/cw/cw.h +++ b/miext/cw/cw.h @@ -169,7 +169,3 @@ cwFiniRender (ScreenPtr pScreen); void miInitializeCompositeWrapper(ScreenPtr pScreen); - -/* Must be called before miInitializeCompositeWrapper */ -void -miDisableCompositeWrapper(ScreenPtr pScreen); diff --git a/miext/damage/damage.c b/miext/damage/damage.c index cd66b5473..d93074758 100755 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -72,6 +72,12 @@ #define pixmapDamage(pPixmap) damagePixPriv(pPixmap) +static int damageScrPrivateIndex; +static int damagePixPrivateIndex; +static int damageGCPrivateIndex; +static int damageWinPrivateIndex; +static int damageGeneration; + static DamagePtr * getDrawableDamageRef (DrawablePtr pDrawable) { @@ -368,12 +374,12 @@ static void damageChangeClip(GCPtr, int, pointer, int); static void damageDestroyClip(GCPtr); static void damageCopyClip(GCPtr, GCPtr); -GCFuncs damageGCFuncs = { +static GCFuncs damageGCFuncs = { damageValidateGC, damageChangeGC, damageCopyGC, damageDestroyGC, damageChangeClip, damageDestroyClip, damageCopyClip }; -extern GCOps damageGCOps; +static GCOps damageGCOps; static Bool damageCreateGC(GCPtr pGC) @@ -1686,7 +1692,7 @@ damageCopyWindow(WindowPtr pWindow, wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow); } -GCOps damageGCOps = { +static GCOps damageGCOps = { damageFillSpans, damageSetSpans, damagePutImage, damageCopyArea, damageCopyPlane, damagePolyPoint, @@ -1787,12 +1793,6 @@ damageCloseScreen (int i, ScreenPtr pScreen) return (*pScreen->CloseScreen) (i, pScreen); } -int damageScrPrivateIndex; -int damagePixPrivateIndex; -int damageGCPrivateIndex; -int damageWinPrivateIndex; -int damageGeneration; - Bool DamageSetup (ScreenPtr pScreen) { @@ -1831,16 +1831,6 @@ DamageSetup (ScreenPtr pScreen) if (!pScrPriv) return FALSE; -#ifdef COMPOSITE - /* This is a kludge to ensure wrapping order with the composite wrapper. - * If it's done from compinit.c, then DamageSetup may be called before the - * extension init phase, so that cw will be higher in the wrapping chain and - * rewrite drawables before damage gets to it, causing confusion. - */ - if (!noCompositeExtension) - miInitializeCompositeWrapper (pScreen); -#endif - pScrPriv->internalLevel = 0; pScrPriv->pScreenDamage = 0; diff --git a/miext/damage/damagestr.h b/miext/damage/damagestr.h index 93e213fd1..83a202ba8 100755 --- a/miext/damage/damagestr.h +++ b/miext/damage/damagestr.h @@ -82,11 +82,7 @@ typedef struct _damageGCPriv { GCFuncs *funcs; } DamageGCPrivRec, *DamageGCPrivPtr; -extern int damageScrPrivateIndex; -extern int damagePixPrivateIndex; -extern int damageGCPrivateIndex; -extern int damageWinPrivateIndex; - +/* XXX should move these into damage.c, damageScrPrivateIndex is static */ #define damageGetScrPriv(pScr) \ ((DamageScrPrivPtr) (pScr)->devPrivates[damageScrPrivateIndex].ptr) diff --git a/os/WaitFor.c b/os/WaitFor.c index d39964f30..4a606ac7d 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -125,7 +125,7 @@ struct _OsTimerRec { }; static void DoTimer(OsTimerPtr timer, CARD32 now, OsTimerPtr *prev); -static void CheckAllTimers(CARD32 now); +static void CheckAllTimers(void); static OsTimerPtr timers = NULL; /***************** @@ -204,7 +204,7 @@ WaitForSomething(int *pClientsReady) timeout = timers->expires - now; if (timeout > 0 && timeout > timers->delta + 250) { /* time has rewound. reset the timers. */ - CheckAllTimers(now); + CheckAllTimers(); } if (timers) { @@ -436,11 +436,14 @@ ANYSET(FdMask *src) /* If time has rewound, re-run every affected timer. * Timers might drop out of the list, so we have to restart every time. */ static void -CheckAllTimers(CARD32 now) +CheckAllTimers(void) { OsTimerPtr timer; + CARD32 now; start: + now = GetTimeInMillis(); + for (timer = timers; timer; timer = timer->next) { if (timer->expires - now > timer->delta + 250) { TimerForce(timer); diff --git a/os/access.c b/os/access.c index db5ca3135..221b8cbcd 100644 --- a/os/access.c +++ b/os/access.c @@ -234,8 +234,8 @@ static Bool NewHost(int /*family*/, int /*len*/, int /* addingLocalHosts */); -int LocalClientCredAndGroups(ClientPtr client, int *pUid, int *pGid, - int **pSuppGids, int *nSuppGids); +static int LocalClientCredAndGroups(ClientPtr client, int *pUid, int *pGid, + int **pSuppGids, int *nSuppGids); /* XFree86 bug #156: To keep track of which hosts were explicitly requested in @@ -1431,7 +1431,7 @@ LocalClientCred(ClientPtr client, int *pUid, int *pGid) * * Used by localuser & localgroup ServerInterpreted access control forms below */ -int +static int LocalClientCredAndGroups(ClientPtr client, int *pUid, int *pGid, int **pSuppGids, int *nSuppGids) { @@ -255,26 +255,6 @@ ResetAuthorization (void) ShouldLoadAuth = TRUE; } -XID -AuthorizationToID ( - unsigned short name_length, - char *name, - unsigned short data_length, - char *data) -{ - int i; - - for (i = 0; i < NUM_AUTHORIZATION; i++) { - if (protocols[i].name_length == name_length && - memcmp (protocols[i].name, name, (int) name_length) == 0 && - protocols[i].ToID) - { - return (*protocols[i].ToID) (data_length, data); - } - } - return (XID) ~0L; -} - int AuthorizationFromID ( XID id, diff --git a/os/connection.c b/os/connection.c index d0ffb8156..cb3443c5b 100644 --- a/os/connection.c +++ b/os/connection.c @@ -175,7 +175,7 @@ typedef const char *string; # include <ucred.h> #endif -int lastfdesc; /* maximum file descriptor */ +static int lastfdesc; /* maximum file descriptor */ fd_set WellKnownConnections; /* Listener mask */ fd_set EnabledDevices; /* mask for input devices that are on */ @@ -189,7 +189,7 @@ int MaxClients = 0; Bool NewOutputPending; /* not yet attempted to write some new output */ Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ -Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ +static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ Bool PartialNetwork; /* continue even if unable to bind all addrs */ static Pid_t ParentProcess; #ifdef __UNIXOS2__ @@ -298,9 +298,9 @@ void ClearConnectionTranslation(void) } #endif -XtransConnInfo *ListenTransConns = NULL; -int *ListenTransFds = NULL; -int ListenTransCount; +static XtransConnInfo *ListenTransConns = NULL; +static int *ListenTransFds = NULL; +static int ListenTransCount; static void ErrorConnMax(XtransConnInfo /* trans_conn */); @@ -90,6 +90,11 @@ SOFTWARE. _X_EXPORT CallbackListPtr ReplyCallback; _X_EXPORT CallbackListPtr FlushCallback; +static ConnectionInputPtr AllocateInputBuffer(void); +static ConnectionOutputPtr AllocateOutputBuffer(void); +static xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore); +static void SkipRequests(xReqPtr req, ClientPtr client, int numskipped); + /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN */ @@ -111,11 +116,11 @@ _X_EXPORT CallbackListPtr FlushCallback; #define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK || err == ENOSPC) #endif -Bool CriticalOutputPending; -int timesThisConnection = 0; -ConnectionInputPtr FreeInputs = (ConnectionInputPtr)NULL; -ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr)NULL; -OsCommPtr AvailableInput = (OsCommPtr)NULL; +static Bool CriticalOutputPending; +static int timesThisConnection = 0; +static ConnectionInputPtr FreeInputs = (ConnectionInputPtr)NULL; +static ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr)NULL; +static OsCommPtr AvailableInput = (OsCommPtr)NULL; #define get_req_len(req,cli) ((cli)->swapped ? \ lswaps((req)->length) : (req)->length) @@ -635,7 +640,7 @@ ResetCurrentRequest(ClientPtr client) * **********************/ -xReqPtr +static xReqPtr PeekNextRequest( xReqPtr req, /* request we're starting from */ ClientPtr client, /* client whose requests we're skipping */ @@ -697,7 +702,7 @@ PeekNextRequest( _X_EXPORT CallbackListPtr SkippedRequestsCallback = NULL; -void +static void SkipRequests( xReqPtr req, /* last request being skipped */ ClientPtr client, /* client whose requests we're skipping */ @@ -1165,7 +1170,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount) return extraCount; /* return only the amount explicitly requested */ } -ConnectionInputPtr +static ConnectionInputPtr AllocateInputBuffer(void) { ConnectionInputPtr oci; @@ -1186,7 +1191,7 @@ AllocateInputBuffer(void) return oci; } -ConnectionOutputPtr +static ConnectionOutputPtr AllocateOutputBuffer(void) { ConnectionOutputPtr oco; diff --git a/os/osdep.h b/os/osdep.h index 5fa1e3918..0984d51e8 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -210,10 +210,6 @@ extern void FreeOsBuffers( #include "dix.h" -extern ConnectionInputPtr AllocateInputBuffer(void); - -extern ConnectionOutputPtr AllocateOutputBuffer(void); - extern fd_set AllSockets; extern fd_set AllClients; extern fd_set LastSelectMask; @@ -234,12 +230,6 @@ extern void ClearConnectionTranslation(); extern Bool NewOutputPending; extern Bool AnyClientsWriteBlocked; -extern Bool CriticalOutputPending; - -extern int timesThisConnection; -extern ConnectionInputPtr FreeInputs; -extern ConnectionOutputPtr FreeOutputs; -extern OsCommPtr AvailableInput; extern WorkQueuePtr workQueue; @@ -299,14 +289,12 @@ extern XID AuthSecurityCheck (AuthCheckArgs); /* in xdmcp.c */ extern void XdmcpUseMsg (void); extern int XdmcpOptions(int argc, char **argv, int i); -extern void XdmcpSetAuthentication (ARRAY8Ptr name); extern void XdmcpRegisterConnection ( int type, char *address, int addrlen); extern void XdmcpRegisterAuthorizations (void); extern void XdmcpRegisterAuthorization (char *name, int namelen); -extern void XdmcpRegisterDisplayClass (char *name, int length); extern void XdmcpInit (void); extern void XdmcpReset (void); extern void XdmcpOpenDisplay(int sock); @@ -319,8 +307,6 @@ extern void XdmcpRegisterAuthentication ( ValidatorFunc Validator, GeneratorFunc Generator, AddAuthorFunc AddAuth); -extern int XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type); -extern int XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data); struct sockaddr_in; extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr); diff --git a/os/utils.c b/os/utils.c index 612c2644a..e605a6c7a 100644 --- a/os/utils.c +++ b/os/utils.c @@ -117,7 +117,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #endif #ifdef XKB -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #endif #ifdef XCSECURITY #include "securitysrv.h" @@ -136,10 +136,7 @@ _X_EXPORT Bool noTestExtensions; _X_EXPORT Bool noBigReqExtension = FALSE; #endif #ifdef COMPOSITE - /* COMPOSITE is disabled by default for now until the - * interface is stable */ - #define COMPOSITE_DEFAULT FALSE -_X_EXPORT Bool noCompositeExtension = !COMPOSITE_DEFAULT; +_X_EXPORT Bool noCompositeExtension = FALSE; #endif #ifdef DAMAGE @@ -245,10 +242,6 @@ _X_EXPORT Bool noXvExtension = FALSE; Bool CoreDump; #ifdef PANORAMIX -Bool PanoramiXVisibilityNotifySent = FALSE; -Bool PanoramiXMapped = FALSE; -Bool PanoramiXWindowExposureSent = FALSE; -Bool PanoramiXOneExposeRequest = FALSE; Bool PanoramiXExtensionDisabledHack = FALSE; #endif @@ -271,7 +264,7 @@ long Memory_fail = 0; #include <stdlib.h> /* for random() */ #endif -char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ +static char *dev_tty_from_init = NULL; /* since we need to parse it anyway */ OsSigHandlerPtr OsSignal(sig, handler) diff --git a/os/xdmcp.c b/os/xdmcp.c index fd4be5e81..310f33bc0 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -197,8 +197,6 @@ static void receive_packet(int /*socketfd*/); static void send_packet(void); -extern void XdmcpDeadSession(char * /*reason*/); - static void timeout(void); static void restart(void); @@ -213,10 +211,23 @@ static void XdmcpWakeupHandler( int /*i*/, pointer /*LastSelectMask*/); -void XdmcpRegisterManufacturerDisplayID( - char * /*name*/, - int /*length*/); +/* + * Register the Manufacturer display ID + */ +static ARRAY8 ManufacturerDisplayID; + +static void +XdmcpRegisterManufacturerDisplayID (char *name, int length) +{ + int i; + + XdmcpDisposeARRAY8 (&ManufacturerDisplayID); + if (!XdmcpAllocARRAY8 (&ManufacturerDisplayID, length)) + return; + for (i = 0; i < length; i++) + ManufacturerDisplayID.data[i] = (CARD8) name[i]; +} static unsigned short xdm_udp_port = XDM_UDP_PORT; static Bool OneSession = FALSE; @@ -411,13 +422,13 @@ XdmcpRegisterAuthentication ( * set by the manager of the host to be connected to. */ -ARRAY8 noAuthenticationName = {(CARD16) 0, (CARD8Ptr) 0}; -ARRAY8 noAuthenticationData = {(CARD16) 0, (CARD8Ptr) 0}; -ARRAY8Ptr AuthenticationName = &noAuthenticationName; -ARRAY8Ptr AuthenticationData = &noAuthenticationData; -AuthenticationFuncsPtr AuthenticationFuncs; +static ARRAY8 noAuthenticationName = {(CARD16) 0, (CARD8Ptr) 0}; +static ARRAY8 noAuthenticationData = {(CARD16) 0, (CARD8Ptr) 0}; +static ARRAY8Ptr AuthenticationName = &noAuthenticationName; +static ARRAY8Ptr AuthenticationData = &noAuthenticationData; +static AuthenticationFuncsPtr AuthenticationFuncs; -void +static void XdmcpSetAuthentication (ARRAY8Ptr name) { int i; @@ -547,9 +558,9 @@ XdmcpRegisterAuthorization (char *name, int namelen) * Register the DisplayClass string */ -ARRAY8 DisplayClass; +static ARRAY8 DisplayClass; -void +static void XdmcpRegisterDisplayClass (char *name, int length) { int i; @@ -561,24 +572,6 @@ XdmcpRegisterDisplayClass (char *name, int length) DisplayClass.data[i] = (CARD8) name[i]; } -/* - * Register the Manufacturer display ID - */ - -ARRAY8 ManufacturerDisplayID; - -void -XdmcpRegisterManufacturerDisplayID (char *name, int length) -{ - int i; - - XdmcpDisposeARRAY8 (&ManufacturerDisplayID); - if (!XdmcpAllocARRAY8 (&ManufacturerDisplayID, length)) - return; - for (i = 0; i < length; i++) - ManufacturerDisplayID.data[i] = (CARD8) name[i]; -} - /* * initialize XDMCP; create the socket, compute the display * number, set up the state machine @@ -776,7 +769,7 @@ XdmcpAddHost( * do the appropriate thing */ -ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" }; +static ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" }; static void receive_packet(int socketfd) @@ -867,7 +860,7 @@ send_packet(void) * timeouts, or Keepalive failure. */ -void +static void XdmcpDeadSession (char *reason) { ErrorF ("XDM: %s, declaring session dead\n", reason); @@ -960,21 +953,16 @@ restart(void) send_packet(); } -int -XdmcpCheckAuthentication ( - ARRAY8Ptr Name, - ARRAY8Ptr Data, - int packet_type) +static int +XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type) { return (XdmcpARRAY8Equal (Name, AuthenticationName) && (AuthenticationName->length == 0 || (*AuthenticationFuncs->Validator) (AuthenticationData, Data, packet_type))); } -int -XdmcpAddAuthorization ( - ARRAY8Ptr name, - ARRAY8Ptr data) +static int +XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data) { AddAuthorFunc AddAuth; diff --git a/randr/mirandr.c b/randr/mirandr.c index 0b763e111..3c4991e5a 100644 --- a/randr/mirandr.c +++ b/randr/mirandr.c @@ -73,6 +73,20 @@ miRROutputSetProperty (ScreenPtr pScreen, return TRUE; } +Bool +miRROutputValidateMode (ScreenPtr pScreen, + RROutputPtr output, + RRModePtr mode) +{ + return FALSE; +} + +void +miRRModeDestroy (ScreenPtr pScreen, + RRModePtr mode) +{ +} + /* * This function assumes that only a single depth can be * displayed at a time, but that all visuals of that depth @@ -102,7 +116,8 @@ miRandRInit (ScreenPtr pScreen) pScrPriv->rrCrtcSet = miRRCrtcSet; pScrPriv->rrCrtcSetGamma = miRRCrtcSetGamma; pScrPriv->rrOutputSetProperty = miRROutputSetProperty; - + pScrPriv->rrOutputValidateMode = miRROutputValidateMode; + pScrPriv->rrModeDestroy = miRRModeDestroy; RRScreenSetSizeRange (pScreen, pScreen->width, pScreen->height, @@ -118,20 +133,13 @@ miRandRInit (ScreenPtr pScreen) if (!mode) return FALSE; - crtc = RRCrtcCreate (NULL); + crtc = RRCrtcCreate (pScreen, NULL); if (!crtc) return FALSE; - if (!RRCrtcAttachScreen (crtc, pScreen)) - { - RRCrtcDestroy (crtc); - return FALSE; - } - output = RROutputCreate ("screen", 6, NULL); + output = RROutputCreate (pScreen, "screen", 6, NULL); if (!output) return FALSE; - if (!RROutputAttachScreen (output, pScreen)) - return FALSE; if (!RROutputSetClones (output, NULL, 0)) return FALSE; if (!RROutputSetModes (output, &mode, 1, 0)) diff --git a/randr/randr.c b/randr/randr.c index 5fa9baf84..4dd0ee5b4 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -230,7 +230,7 @@ Bool RRScreenInit(ScreenPtr pScreen) RRScreenGeneration = serverGeneration; } - pScrPriv = (rrScrPrivPtr) xalloc (sizeof (rrScrPrivRec)); + pScrPriv = (rrScrPrivPtr) xcalloc (1, sizeof (rrScrPrivRec)); if (!pScrPriv) return FALSE; diff --git a/randr/randrstr.h b/randr/randrstr.h index 505821269..4cc3a469e 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -79,8 +79,7 @@ struct _rrMode { int refcnt; xRRModeInfo mode; char *name; - void *devPrivate; - Bool userDefined; + ScreenPtr userScreen; }; struct _rrPropertyValue { @@ -135,8 +134,11 @@ struct _rrOutput { int numModes; int numPreferred; RRModePtr *modes; + int numUserModes; + RRModePtr *userModes; Bool changed; RRPropertyPtr properties; + Bool pendingProperties; void *devPrivate; }; @@ -164,6 +166,13 @@ typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen, Atom property, RRPropertyValuePtr value); +typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen, + RROutputPtr output, + RRModePtr mode); + +typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, + RRModePtr mode); + #endif typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations); @@ -208,6 +217,8 @@ typedef struct _rrScrPriv { RRCrtcSetProcPtr rrCrtcSet; RRCrtcSetGammaProcPtr rrCrtcSetGamma; RROutputSetPropertyProcPtr rrOutputSetProperty; + RROutputValidateModeProcPtr rrOutputValidateMode; + RRModeDestroyProcPtr rrModeDestroy; #endif /* @@ -394,6 +405,15 @@ miRROutputSetProperty (ScreenPtr pScreen, Atom property, RRPropertyValuePtr value); +Bool +miRROutputValidateMode (ScreenPtr pScreen, + RROutputPtr output, + RRModePtr mode); + +void +miRRModeDestroy (ScreenPtr pScreen, + RRModePtr mode); + /* randr.c */ /* * Send all pending events @@ -477,16 +497,14 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged); * Create a CRTC */ RRCrtcPtr -RRCrtcCreate (void *devPrivate); +RRCrtcCreate (ScreenPtr pScreen, void *devPrivate); /* - * Attach a CRTC to a screen. Once done, this cannot be - * undone without destroying the CRTC; it is separate from Create - * only to allow an xf86-based driver to create objects in preinit + * Set the allowed rotations on a CRTC */ -Bool -RRCrtcAttachScreen (RRCrtcPtr crtc, ScreenPtr pScreen); - +void +RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations); + /* * Notify the extension that the Crtc has been reconfigured, * the driver calls this whenever it has updated the mode @@ -543,11 +561,9 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc, int size); /* - * Set the allowable rotations of the CRTC. + * Return the area of the frame buffer scanned out by the crtc, + * taking into account the current mode and rotation */ -Bool -RRCrtcSetRotations (RRCrtcPtr crtc, - Rotation rotations); void RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height); @@ -646,19 +662,12 @@ RROutputChanged (RROutputPtr output, Bool configChanged); */ RROutputPtr -RROutputCreate (const char *name, +RROutputCreate (ScreenPtr pScreen, + const char *name, int nameLength, void *devPrivate); /* - * Attach an output to a screen, again split from creation so - * xf86 DDXen can create randr resources before the ScreenRec - * exists - */ -Bool -RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen); - -/* * Notify extension that output parameters have been changed */ Bool @@ -672,6 +681,14 @@ RROutputSetModes (RROutputPtr output, int numModes, int numPreferred); +int +RROutputAddUserMode (RROutputPtr output, + RRModePtr mode); + +int +RROutputDeleteUserMode (RROutputPtr output, + RRModePtr mode); + Bool RROutputSetCrtcs (RROutputPtr output, RRCrtcPtr *crtcs, @@ -729,10 +746,13 @@ RRQueryOutputProperty (RROutputPtr output, Atom property); void RRDeleteOutputProperty (RROutputPtr output, Atom property); +Bool +RRPostPendingProperties (RROutputPtr output); + int RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, int format, int mode, unsigned long len, - pointer value, Bool sendevent); + pointer value, Bool sendevent, Bool pending); int RRConfigureOutputProperty (RROutputPtr output, Atom property, diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index db506f4b0..1dfc3bbb0 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -51,17 +51,32 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged) * Create a CRTC */ RRCrtcPtr -RRCrtcCreate (void *devPrivate) +RRCrtcCreate (ScreenPtr pScreen, void *devPrivate) { - RRCrtcPtr crtc; - + RRCrtcPtr crtc; + RRCrtcPtr *crtcs; + rrScrPrivPtr pScrPriv; + if (!RRInit()) return NULL; + + pScrPriv = rrGetScrPriv(pScreen); + + /* make space for the crtc pointer */ + if (pScrPriv->numCrtcs) + crtcs = xrealloc (pScrPriv->crtcs, + (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr)); + else + crtcs = xalloc (sizeof (RRCrtcPtr)); + if (!crtcs) + return FALSE; + pScrPriv->crtcs = crtcs; + crtc = xalloc (sizeof (RRCrtcRec)); if (!crtc) return NULL; crtc->id = FakeClientID (0); - crtc->pScreen = NULL; + crtc->pScreen = pScreen; crtc->mode = NULL; crtc->x = 0; crtc->y = 0; @@ -77,37 +92,20 @@ RRCrtcCreate (void *devPrivate) if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc)) return NULL; + /* attach the screen and crtc together */ + crtc->pScreen = pScreen; + pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc; + return crtc; } /* - * Attach a Crtc to a screen. This is done as a separate step - * so that an xf86-based driver can create CRTCs in PreInit - * before the Screen has been created + * Set the allowed rotations on a CRTC */ - -Bool -RRCrtcAttachScreen (RRCrtcPtr crtc, ScreenPtr pScreen) +void +RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations) { - rrScrPriv (pScreen); - RRCrtcPtr *crtcs; - - /* make space for the crtc pointer */ - if (pScrPriv->numCrtcs) - crtcs = xrealloc (pScrPriv->crtcs, - (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr)); - else - crtcs = xalloc (sizeof (RRCrtcPtr)); - if (!crtcs) - return FALSE; - - /* attach the screen and crtc together */ - crtc->pScreen = pScreen; - pScrPriv->crtcs = crtcs; - pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc; - - RRCrtcChanged (crtc, TRUE); - return TRUE; + crtc->rotations = rotations; } /* @@ -249,6 +247,22 @@ RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc) WriteEventsToClient (client, 1, (xEvent *) &ce); } +static Bool +RRCrtcPendingProperties (RRCrtcPtr crtc) +{ + ScreenPtr pScreen = crtc->pScreen; + rrScrPriv(pScreen); + int o; + + for (o = 0; o < pScrPriv->numOutputs; o++) + { + RROutputPtr output = pScrPriv->outputs[o]; + if (output->crtc == crtc && output->pendingProperties) + return TRUE; + } + return FALSE; +} + /* * Request that the Crtc be reconfigured */ @@ -262,6 +276,8 @@ RRCrtcSet (RRCrtcPtr crtc, RROutputPtr *outputs) { ScreenPtr pScreen = crtc->pScreen; + Bool ret = FALSE; + rrScrPriv(pScreen); /* See if nothing changed */ if (crtc->mode == mode && @@ -269,63 +285,73 @@ RRCrtcSet (RRCrtcPtr crtc, crtc->y == y && crtc->rotation == rotation && crtc->numOutputs == numOutputs && - !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr))) + !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) && + !RRCrtcPendingProperties (crtc)) { - return TRUE; + ret = TRUE; } - if (pScreen) + else { #if RANDR_12_INTERFACE - rrScrPriv(pScreen); if (pScrPriv->rrCrtcSet) { - return (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y, - rotation, numOutputs, outputs); + ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y, + rotation, numOutputs, outputs); } + else #endif -#if RANDR_10_INTERFACE - if (pScrPriv->rrSetConfig) { - RRScreenSize size; - RRScreenRate rate; - Bool ret; - - if (!mode) +#if RANDR_10_INTERFACE + if (pScrPriv->rrSetConfig) { - RRCrtcNotify (crtc, NULL, x, y, rotation, 0, NULL); - return TRUE; + RRScreenSize size; + RRScreenRate rate; + + if (!mode) + { + RRCrtcNotify (crtc, NULL, x, y, rotation, 0, NULL); + ret = TRUE; + } + else + { + size.width = mode->mode.width; + size.height = mode->mode.height; + if (outputs[0]->mmWidth && outputs[0]->mmHeight) + { + size.mmWidth = outputs[0]->mmWidth; + size.mmHeight = outputs[0]->mmHeight; + } + else + { + size.mmWidth = pScreen->mmWidth; + size.mmHeight = pScreen->mmHeight; + } + size.nRates = 1; + rate.rate = RRVerticalRefresh (&mode->mode); + size.pRates = &rate; + ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size); + /* + * Old 1.0 interface tied screen size to mode size + */ + if (ret) + { + RRCrtcNotify (crtc, mode, x, y, rotation, 1, outputs); + RRScreenSizeNotify (pScreen); + } + } } +#endif + } + if (ret) + { + int o; + RRTellChanged (pScreen); - size.width = mode->mode.width; - size.height = mode->mode.height; - if (outputs[0]->mmWidth && outputs[0]->mmHeight) - { - size.mmWidth = outputs[0]->mmWidth; - size.mmHeight = outputs[0]->mmHeight; - } - else - { - size.mmWidth = pScreen->mmWidth; - size.mmHeight = pScreen->mmHeight; - } - size.nRates = 1; - rate.rate = RRVerticalRefresh (&mode->mode); - size.pRates = &rate; - ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size); - /* - * Old 1.0 interface tied screen size to mode size - */ - if (ret) - { - RRCrtcNotify (crtc, mode, x, y, rotation, 1, outputs); - RRScreenSizeNotify (pScreen); - } - return ret; + for (o = 0; o < numOutputs; o++) + RRPostPendingProperties (outputs[o]); } -#endif - RRTellChanged (pScreen); } - return FALSE; + return ret; } /* @@ -361,6 +387,8 @@ RRCrtcDestroyResource (pointer value, XID pid) } if (crtc->gammaRed) xfree (crtc->gammaRed); + if (crtc->mode) + RRModeDestroy (crtc->mode); xfree (crtc); return 1; } @@ -462,17 +490,6 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc, } /* - * Set the allowable rotations of the CRTC. - */ -Bool -RRCrtcSetRotations (RRCrtcPtr crtc, - Rotation rotations) -{ - crtc->rotations = rotations; - return TRUE; -} - -/* * Initialize crtc type */ Bool @@ -666,10 +683,15 @@ ProcRRSetCrtcConfig (ClientPtr client) return BadMatch; } /* validate mode for this output */ - for (j = 0; j < outputs[i]->numModes; j++) - if (outputs[i]->modes[j] == mode) + for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++) + { + RRModePtr m = (j < outputs[i]->numModes ? + outputs[i]->modes[j] : + outputs[i]->userModes[j - outputs[i]->numModes]); + if (m == mode) break; - if (j == outputs[i]->numModes) + } + if (j == outputs[i]->numModes + outputs[i]->numUserModes) { if (outputs) xfree (outputs); @@ -711,6 +733,7 @@ ProcRRSetCrtcConfig (ClientPtr client) goto sendReply; } +#if 0 /* * if the client's config timestamp is not the same as the last config * timestamp, then the config information isn't up-to-date and @@ -721,6 +744,7 @@ ProcRRSetCrtcConfig (ClientPtr client) rep.status = RRSetConfigInvalidConfigTime; goto sendReply; } +#endif /* * Validate requested rotation diff --git a/randr/rrinfo.c b/randr/rrinfo.c index 797cdb1b4..5ef1a6b83 100644 --- a/randr/rrinfo.c +++ b/randr/rrinfo.c @@ -91,19 +91,12 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations) if (pScrPriv->numOutputs == 0 && pScrPriv->numCrtcs == 0) { - crtc = RRCrtcCreate (NULL); + crtc = RRCrtcCreate (pScreen, NULL); if (!crtc) return; - if (!RRCrtcAttachScreen (crtc, pScreen)) - { - RRCrtcDestroy (crtc); - return; - } - output = RROutputCreate ("default", 7, NULL); + output = RROutputCreate (pScreen, "default", 7, NULL); if (!output) return; - if (!RROutputAttachScreen (output, pScreen)) - return; RROutputSetCrtcs (output, &crtc, 1); RROutputSetCrtc (output, crtc); RROutputSetConnection (output, RR_Connected); @@ -157,9 +150,11 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations) pScrPriv->nSizes = 0; /* find size bounds */ - for (i = 0; i < output->numModes; i++) + for (i = 0; i < output->numModes + output->numUserModes; i++) { - RRModePtr mode = output->modes[i]; + RRModePtr mode = (i < output->numModes ? + output->modes[i] : + output->userModes[i-output->numModes]); CARD16 width = mode->mode.width; CARD16 height = mode->mode.height; diff --git a/randr/rrmode.c b/randr/rrmode.c index 261e1b75f..11175810c 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -48,25 +48,13 @@ RRModeEqual (xRRModeInfo *a, xRRModeInfo *b) static int num_modes; static RRModePtr *modes; -RRModePtr -RRModeGet (xRRModeInfo *modeInfo, - const char *name) +static RRModePtr +RRModeCreate (xRRModeInfo *modeInfo, + const char *name, + ScreenPtr userScreen) { - int i; - RRModePtr mode; - RRModePtr *newModes; - - for (i = 0; i < num_modes; i++) - { - mode = modes[i]; - if (RRModeEqual (&mode->mode, modeInfo) && - !memcmp (name, mode->name, modeInfo->nameLength)) - { - ++mode->refcnt; - return mode; - } - } - + RRModePtr mode, *newModes; + if (!RRInit ()) return NULL; @@ -78,7 +66,7 @@ RRModeGet (xRRModeInfo *modeInfo, mode->name = (char *) (mode + 1); memcpy (mode->name, name, modeInfo->nameLength); mode->name[modeInfo->nameLength] = '\0'; - mode->userDefined = FALSE; + mode->userScreen = userScreen; if (num_modes) newModes = xrealloc (modes, (num_modes + 1) * sizeof (RRModePtr)); @@ -104,11 +92,75 @@ RRModeGet (xRRModeInfo *modeInfo, return mode; } +static RRModePtr +RRModeFindByName (const char *name, + CARD16 nameLength) +{ + int i; + RRModePtr mode; + + for (i = 0; i < num_modes; i++) + { + mode = modes[i]; + if (mode->mode.nameLength == nameLength && + !memcmp (name, mode->name, nameLength)) + { + return mode; + } + } + return NULL; +} + +RRModePtr +RRModeGet (xRRModeInfo *modeInfo, + const char *name) +{ + int i; + + for (i = 0; i < num_modes; i++) + { + RRModePtr mode = modes[i]; + if (RRModeEqual (&mode->mode, modeInfo) && + !memcmp (name, mode->name, modeInfo->nameLength)) + { + ++mode->refcnt; + return mode; + } + } + + return RRModeCreate (modeInfo, name, NULL); +} + +static RRModePtr +RRModeCreateUser (ScreenPtr pScreen, + xRRModeInfo *modeInfo, + const char *name, + int *error) +{ + RRModePtr mode; + + mode = RRModeFindByName (name, modeInfo->nameLength); + if (mode) + { + *error = BadName; + return NULL; + } + + mode = RRModeCreate (modeInfo, name, pScreen); + if (!mode) + { + *error = BadAlloc; + return NULL; + } + *error = Success; + return mode; +} + RRModePtr * RRModesForScreen (ScreenPtr pScreen, int *num_ret) { rrScrPriv(pScreen); - int o, c; + int o, c, m; RRModePtr *screen_modes; int num_screen_modes = 0; @@ -122,9 +174,11 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret) RROutputPtr output = pScrPriv->outputs[o]; int m, n; - for (m = 0; m < output->numModes; m++) + for (m = 0; m < output->numModes + output->numUserModes; m++) { - RRModePtr mode = output->modes[m]; + RRModePtr mode = (m < output->numModes ? + output->modes[m] : + output->userModes[m-output->numModes]); for (n = 0; n < num_screen_modes; n++) if (screen_modes[n] == mode) break; @@ -150,6 +204,23 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret) if (n == num_screen_modes) screen_modes[num_screen_modes++] = mode; } + /* + * Add all user modes for this screen + */ + for (m = 0; m < num_modes; m++) + { + RRModePtr mode = modes[m]; + int n; + + if (mode->userScreen != pScreen) + continue; + for (n = 0; n < num_screen_modes; n++) + if (screen_modes[n] == mode) + break; + if (n == num_screen_modes) + screen_modes[num_screen_modes++] = mode; + } + *num_ret = num_screen_modes; return screen_modes; } @@ -205,38 +276,122 @@ int ProcRRCreateMode (ClientPtr client) { REQUEST(xRRCreateModeReq); + xRRCreateModeReply rep; + WindowPtr pWin; + ScreenPtr pScreen; + rrScrPrivPtr pScrPriv; + xRRModeInfo *modeInfo; + long units_after; + char *name; + int error, rc; + RRModePtr mode; + + REQUEST_AT_LEAST_SIZE (xRRCreateModeReq); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; + + pScreen = pWin->drawable.pScreen; + pScrPriv = rrGetScrPriv(pScreen); - REQUEST_SIZE_MATCH(xRRCreateModeReq); - (void) stuff; - return BadImplementation; + modeInfo = &stuff->modeInfo; + name = (char *) (stuff + 1); + units_after = (stuff->length - (sizeof (xRRCreateModeReq) >> 2)); + + /* check to make sure requested name fits within the data provided */ + if ((int) (modeInfo->nameLength + 3) >> 2 > units_after) + return BadLength; + + mode = RRModeCreateUser (pScreen, modeInfo, name, &error); + if (!mode) + return error; + + rep.type = X_Reply; + rep.pad0 = 0; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.mode = mode->mode.id; + if (client->swapped) + { + int n; + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.mode, n); + } + WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep); + + return client->noClientException; } int ProcRRDestroyMode (ClientPtr client) { REQUEST(xRRDestroyModeReq); + RRModePtr mode; REQUEST_SIZE_MATCH(xRRDestroyModeReq); - (void) stuff; - return BadImplementation; + mode = LookupIDByType (stuff->mode, RRModeType); + if (!mode) + { + client->errorValue = stuff->mode; + return RRErrorBase + BadRRMode; + } + if (!mode->userScreen) + return BadMatch; + if (mode->refcnt > 1) + return BadAccess; + FreeResource (stuff->mode, 0); + return Success; } int ProcRRAddOutputMode (ClientPtr client) { REQUEST(xRRAddOutputModeReq); + RRModePtr mode; + RROutputPtr output; REQUEST_SIZE_MATCH(xRRAddOutputModeReq); - (void) stuff; - return BadImplementation; + output = LookupOutput(client, stuff->output, DixReadAccess); + + if (!output) + { + client->errorValue = stuff->output; + return RRErrorBase + BadRROutput; + } + + mode = LookupIDByType (stuff->mode, RRModeType); + if (!mode) + { + client->errorValue = stuff->mode; + return RRErrorBase + BadRRMode; + } + + return RROutputAddUserMode (output, mode); } int ProcRRDeleteOutputMode (ClientPtr client) { REQUEST(xRRDeleteOutputModeReq); + RRModePtr mode; + RROutputPtr output; REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); - (void) stuff; - return BadImplementation; + output = LookupOutput(client, stuff->output, DixReadAccess); + + if (!output) + { + client->errorValue = stuff->output; + return RRErrorBase + BadRROutput; + } + + mode = LookupIDByType (stuff->mode, RRModeType); + if (!mode) + { + client->errorValue = stuff->mode; + return RRErrorBase + BadRRMode; + } + + return RROutputDeleteUserMode (output, mode); } diff --git a/randr/rroutput.c b/randr/rroutput.c index df1741f5c..e00116283 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -47,19 +47,35 @@ RROutputChanged (RROutputPtr output, Bool configChanged) */ RROutputPtr -RROutputCreate (const char *name, +RROutputCreate (ScreenPtr pScreen, + const char *name, int nameLength, void *devPrivate) { - RROutputPtr output; + RROutputPtr output; + RROutputPtr *outputs; + rrScrPrivPtr pScrPriv; if (!RRInit()) return NULL; + + pScrPriv = rrGetScrPriv(pScreen); + + if (pScrPriv->numOutputs) + outputs = xrealloc (pScrPriv->outputs, + (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr)); + else + outputs = xalloc (sizeof (RROutputPtr)); + if (!outputs) + return FALSE; + + pScrPriv->outputs = outputs; + output = xalloc (sizeof (RROutputRec) + nameLength + 1); if (!output) return NULL; output->id = FakeClientID (0); - output->pScreen = NULL; + output->pScreen = pScreen; output->name = (char *) (output + 1); output->nameLength = nameLength; memcpy (output->name, name, nameLength); @@ -76,6 +92,8 @@ RROutputCreate (const char *name, output->numModes = 0; output->numPreferred = 0; output->modes = NULL; + output->numUserModes = 0; + output->userModes = NULL; output->properties = NULL; output->changed = FALSE; output->devPrivate = devPrivate; @@ -83,36 +101,11 @@ RROutputCreate (const char *name, if (!AddResource (output->id, RROutputType, (pointer) output)) return NULL; + pScrPriv->outputs[pScrPriv->numOutputs++] = output; return output; } /* - * Attach an Output to a screen. This is done as a separate step - * so that an xf86-based driver can create Outputs in PreInit - * before the Screen has been created - */ - -Bool -RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen) -{ - rrScrPriv (pScreen); - RROutputPtr *outputs; - - if (pScrPriv->numOutputs) - outputs = xrealloc (pScrPriv->outputs, - (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr)); - else - outputs = xalloc (sizeof (RROutputPtr)); - if (!outputs) - return FALSE; - output->pScreen = pScreen; - pScrPriv->outputs = outputs; - pScrPriv->outputs[pScrPriv->numOutputs++] = output; - RROutputChanged (output, FALSE); - return TRUE; -} - -/* * Notify extension that output parameters have been changed */ Bool @@ -192,6 +185,74 @@ RROutputSetModes (RROutputPtr output, return TRUE; } +int +RROutputAddUserMode (RROutputPtr output, + RRModePtr mode) +{ + int m; + ScreenPtr pScreen = output->pScreen; + rrScrPriv(pScreen); + RRModePtr *newModes; + + /* Check to see if this mode is already listed for this output */ + for (m = 0; m < output->numModes + output->numUserModes; m++) + { + RRModePtr e = (m < output->numModes ? + output->modes[m] : + output->userModes[m - output->numModes]); + if (mode == e) + return Success; + } + + /* Check with the DDX to see if this mode is OK */ + if (pScrPriv->rrOutputValidateMode) + if (!pScrPriv->rrOutputValidateMode (pScreen, output, mode)) + return BadMatch; + + if (output->userModes) + newModes = xrealloc (output->userModes, + (output->numUserModes + 1) * sizeof (RRModePtr)); + else + newModes = xalloc (sizeof (RRModePtr)); + if (!newModes) + return BadAlloc; + + output->userModes = newModes; + output->userModes[output->numUserModes++] = mode; + ++mode->refcnt; + RROutputChanged (output, TRUE); + RRTellChanged (pScreen); + return Success; +} + +int +RROutputDeleteUserMode (RROutputPtr output, + RRModePtr mode) +{ + int m; + + /* Find this mode in the user mode list */ + for (m = 0; m < output->numUserModes; m++) + { + RRModePtr e = output->userModes[m]; + + if (mode == e) + break; + } + /* Not there, access error */ + if (m == output->numUserModes) + return BadAccess; + + /* make sure the mode isn't active for this output */ + if (output->crtc && output->crtc->mode == mode) + return BadMatch; + + memmove (output->userModes + m, output->userModes + m + 1, + (output->numUserModes - m - 1) * sizeof (RRModePtr)); + RRModeDestroy (mode); + return Success; +} + Bool RROutputSetCrtcs (RROutputPtr output, RRCrtcPtr *crtcs, @@ -308,9 +369,9 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output) * Destroy a Output at shutdown */ void -RROutputDestroy (RROutputPtr crtc) +RROutputDestroy (RROutputPtr output) { - FreeResource (crtc->id, 0); + FreeResource (output->id, 0); } static int @@ -318,6 +379,7 @@ RROutputDestroyResource (pointer value, XID pid) { RROutputPtr output = (RROutputPtr) value; ScreenPtr pScreen = output->pScreen; + int m; if (pScreen) { @@ -336,7 +398,17 @@ RROutputDestroyResource (pointer value, XID pid) } } if (output->modes) + { + for (m = 0; m < output->numModes; m++) + RRModeDestroy (output->modes[m]); xfree (output->modes); + } + + for (m = 0; m < output->numUserModes; m++) + RRModeDestroy (output->userModes[m]); + if (output->userModes) + xfree (output->userModes); + if (output->crtcs) xfree (output->crtcs); if (output->clones) @@ -383,7 +455,10 @@ ProcRRGetOutputInfo (ClientPtr client) output = LookupOutput(client, stuff->output, DixReadAccess); if (!output) + { + client->errorValue = stuff->output; return RRErrorBase + BadRROutput; + } pScreen = output->pScreen; pScrPriv = rrGetScrPriv(pScreen); @@ -398,13 +473,13 @@ ProcRRGetOutputInfo (ClientPtr client) rep.connection = output->connection; rep.subpixelOrder = output->subpixelOrder; rep.nCrtcs = output->numCrtcs; - rep.nModes = output->numModes; + rep.nModes = output->numModes + output->numUserModes; rep.nPreferred = output->numPreferred; rep.nClones = output->numClones; rep.nameLength = output->nameLength; extraLen = ((output->numCrtcs + - output->numModes + + output->numModes + output->numUserModes + output->numClones + ((rep.nameLength + 3) >> 2)) << 2); @@ -420,7 +495,7 @@ ProcRRGetOutputInfo (ClientPtr client) crtcs = (RRCrtc *) extra; modes = (RRMode *) (crtcs + output->numCrtcs); - clones = (RROutput *) (modes + output->numModes); + clones = (RROutput *) (modes + output->numModes + output->numUserModes); name = (char *) (clones + output->numClones); for (i = 0; i < output->numCrtcs; i++) @@ -429,9 +504,12 @@ ProcRRGetOutputInfo (ClientPtr client) if (client->swapped) swapl (&crtcs[i], n); } - for (i = 0; i < output->numModes; i++) + for (i = 0; i < output->numModes + output->numUserModes; i++) { - modes[i] = output->modes[i]->mode.id; + if (i < output->numModes) + modes[i] = output->modes[i]->mode.id; + else + modes[i] = output->userModes[i - output->numModes]->mode.id; if (client->swapped) swapl (&modes[i], n); } diff --git a/randr/rrproperty.c b/randr/rrproperty.c index edfed1f47..5ac073f81 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -27,7 +27,7 @@ static void RRDeliverEvent (ScreenPtr pScreen, xEvent *event, CARD32 mask) { - + } void @@ -50,7 +50,7 @@ RRDeleteAllOutputProperties (RROutputPtr output) xfree(prop->current.data); if (prop->pending.data) xfree(prop->pending.data); - xfree(prop); + xfree(prop); } } @@ -67,7 +67,7 @@ static RRPropertyPtr RRCreateOutputProperty (Atom property) { RRPropertyPtr prop; - + prop = (RRPropertyPtr)xalloc(sizeof(RRPropertyRec)); if (!prop) return NULL; @@ -121,105 +121,114 @@ RRDeleteOutputProperty (RROutputPtr output, Atom property) int RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, int format, int mode, unsigned long len, - pointer value, Bool sendevent) + pointer value, Bool sendevent, Bool pending) { RRPropertyPtr prop; xRROutputPropertyNotifyEvent event; rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen); - int sizeInBytes; - int totalSize; - pointer data; + int size_in_bytes; + int total_size; + unsigned long total_len; RRPropertyValuePtr prop_value; + RRPropertyValueRec new_value; Bool add = FALSE; - sizeInBytes = format >> 3; - totalSize = len * sizeInBytes; + size_in_bytes = format >> 3; /* first see if property already exists */ prop = RRQueryOutputProperty (output, property); if (!prop) /* just add to list */ { - prop = RRCreateOutputProperty (property); + prop = RRCreateOutputProperty (property); if (!prop) return(BadAlloc); add = TRUE; mode = PropModeReplace; } - if (prop->is_pending) + if (pending && prop->is_pending) prop_value = &prop->pending; else prop_value = &prop->current; - + /* To append or prepend to a property the request format and type - must match those of the already defined property. The - existing format and type are irrelevant when using the mode - "PropModeReplace" since they will be written over. */ + must match those of the already defined property. The + existing format and type are irrelevant when using the mode + "PropModeReplace" since they will be written over. */ if ((format != prop_value->format) && (mode != PropModeReplace)) return(BadMatch); if ((prop_value->type != type) && (mode != PropModeReplace)) return(BadMatch); + new_value = *prop_value; if (mode == PropModeReplace) + total_len = len; + else + total_len = prop_value->size + len; + + if (mode == PropModeReplace || len > 0) { - if (totalSize != prop_value->size * (prop_value->format >> 3)) + pointer new_data = NULL, old_data = NULL; + + total_size = total_len * size_in_bytes; + new_value.data = (pointer)xalloc (total_size); + if (!new_value.data && total_size) { - if (prop_value->data) - data = (pointer)xrealloc(prop_value->data, totalSize); - else - data = (pointer)xalloc (totalSize); - if (!data && len) - { - if (add) - RRDestroyOutputProperty (prop); - return(BadAlloc); - } - prop_value->data = data; + if (add) + RRDestroyOutputProperty (prop); + return BadAlloc; } - if (len) - memmove((char *)prop_value->data, (char *)value, totalSize); - prop_value->size = len; - prop_value->type = type; - prop_value->format = format; + new_value.size = len; + new_value.type = type; + new_value.format = format; + + switch (mode) { + case PropModeReplace: + new_data = new_value.data; + old_data = NULL; + break; + case PropModeAppend: + new_data = (pointer) (((char *) new_value.data) + + (prop_value->size * size_in_bytes)); + old_data = new_value.data; + break; + case PropModePrepend: + new_data = new_value.data; + old_data = (pointer) (((char *) new_value.data) + + (prop_value->size * size_in_bytes)); + break; + } + if (new_data) + memcpy ((char *) new_data, (char *) value, len * size_in_bytes); + if (old_data) + memcpy ((char *) old_data, (char *) prop_value->data, + prop_value->size * size_in_bytes); + + if (pending && pScrPriv->rrOutputSetProperty && + !pScrPriv->rrOutputSetProperty(output->pScreen, output, + prop->propertyName, &new_value)) + { + if (new_value.data) + xfree (new_value.data); + return (BadValue); + } + if (prop_value->data) + xfree (prop_value->data); + *prop_value = new_value; } + else if (len == 0) { /* do nothing */ } - else if (mode == PropModeAppend) - { - data = (pointer)xrealloc(prop_value->data, - sizeInBytes * (len + prop_value->size)); - if (!data) - return(BadAlloc); - prop_value->data = data; - memmove(&((char *)data)[prop_value->size * sizeInBytes], - (char *)value, - totalSize); - prop_value->size += len; - } - else if (mode == PropModePrepend) - { - data = (pointer)xalloc(sizeInBytes * (len + prop_value->size)); - if (!data) - return(BadAlloc); - memmove(&((char *)data)[totalSize], (char *)prop_value->data, - (int)(prop_value->size * sizeInBytes)); - memmove((char *)data, (char *)value, totalSize); - xfree(prop_value->data); - prop_value->data = data; - prop_value->size += len; - } + if (add) { prop->next = output->properties; output->properties = prop; } - if (!prop->is_pending) { - /* What should we do in case of failure? */ - pScrPriv->rrOutputSetProperty(output->pScreen, output, - prop->propertyName, prop_value); - } + if (pending && prop->is_pending) + output->pendingProperties = TRUE; if (sendevent) { @@ -234,6 +243,48 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type, return(Success); } +Bool +RRPostPendingProperties (RROutputPtr output) +{ + RRPropertyValuePtr pending_value; + RRPropertyValuePtr current_value; + RRPropertyPtr property; + Bool ret = TRUE; + + if (!output->pendingProperties) + return TRUE; + + output->pendingProperties = FALSE; + for (property = output->properties; property; property = property->next) + { + /* Skip non-pending properties */ + if (!property->is_pending) + continue; + + pending_value = &property->pending; + current_value = &property->current; + + /* + * If the pending and current values are equal, don't mark it + * as changed (which would deliver an event) + */ + if (pending_value->type == current_value->type && + pending_value->format == current_value->format && + pending_value->size == current_value->size && + !memcmp (pending_value->data, current_value->data, + pending_value->size)) + continue; + + if (RRChangeOutputProperty (output, property->propertyName, + pending_value->type, pending_value->format, + PropModeReplace, pending_value->size, + pending_value->data, TRUE, + FALSE) != Success) + ret = FALSE; + } + return ret; +} + RRPropertyPtr RRQueryOutputProperty (RROutputPtr output, Atom property) { @@ -474,7 +525,7 @@ ProcRRChangeOutputProperty (ClientPtr client) err = RRChangeOutputProperty(output, stuff->property, stuff->type, (int)format, - (int)mode, len, (pointer)&stuff[1], TRUE); + (int)mode, len, (pointer)&stuff[1], TRUE, TRUE); if (err != Success) return err; else @@ -508,8 +559,8 @@ int ProcRRGetOutputProperty (ClientPtr client) { REQUEST(xRRGetOutputPropertyReq); - RRPropertyPtr prop, *prev; - RRPropertyValuePtr prop_value; + RRPropertyPtr prop, *prev; + RRPropertyValuePtr prop_value; unsigned long n, len, ind; RROutputPtr output; xRRGetOutputPropertyReply reply; @@ -600,7 +651,10 @@ ProcRRGetOutputProperty (ClientPtr client) reply.bytesAfter = n - (ind + len); reply.format = prop_value->format; reply.length = (len + 3) >> 2; - reply.nItems = len / (prop_value->format / 8 ); + if (prop_value->format) + reply.nItems = len / (prop_value->format / 8); + else + reply.nItems = 0; reply.propertyType = prop_value->type; if (stuff->delete && (reply.bytesAfter == 0)) diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 168000351..ad74ac3af 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -473,7 +473,7 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output) { RR10DataPtr data; RRScreenSizePtr size; - int nmode = output->numModes; + int nmode = output->numModes + output->numUserModes; int o, os, l, r; RRScreenRatePtr refresh; CARD16 vRefresh; @@ -500,11 +500,14 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output) /* * find modes not yet listed */ - for (o = 0; o < output->numModes; o++) + for (o = 0; o < output->numModes + output->numUserModes; o++) { if (used[o]) continue; - mode = output->modes[o]; + if (o < output->numModes) + mode = output->modes[o]; + else + mode = output->userModes[o - output->numModes]; l = data->nsize; size[l].id = data->nsize; @@ -524,9 +527,12 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output) /* * Find all modes with matching size */ - for (os = o; os < output->numModes; os++) + for (os = o; os < output->numModes + output->numUserModes; os++) { - mode = output->modes[os]; + if (os < output->numModes) + mode = output->modes[os]; + else + mode = output->userModes[os - output->numModes]; if (mode->mode.width == size[l].width && mode->mode.height == size[l].height) { diff --git a/record/set.c b/record/set.c index 0ebb0884d..07a3a63a3 100644 --- a/record/set.c +++ b/record/set.c @@ -164,10 +164,10 @@ BitVectorIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter, return (RecordSetIteratePtr)(long)(pInterval->last + 1); } -RecordSetOperations BitVectorSetOperations = { +static RecordSetOperations BitVectorSetOperations = { BitVectorDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet }; -RecordSetOperations BitVectorNoFreeOperations = { +static RecordSetOperations BitVectorNoFreeOperations = { NoopDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet }; static int @@ -277,10 +277,10 @@ IntervalListIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter, return (RecordSetIteratePtr)NULL; } -RecordSetOperations IntervalListSetOperations = { +static RecordSetOperations IntervalListSetOperations = { IntervalListDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet }; -RecordSetOperations IntervalListNoFreeOperations = { +static RecordSetOperations IntervalListNoFreeOperations = { NoopDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet }; static int diff --git a/render/animcur.c b/render/animcur.c index 2b552a3a2..7bddc0dad 100644 --- a/render/animcur.c +++ b/render/animcur.c @@ -88,8 +88,8 @@ static CursorBits animCursorBits = { empty, empty, 2, 1, 1, 0, 0, 1 }; -int AnimCurScreenPrivateIndex = -1; -int AnimCurGeneration; +static int AnimCurScreenPrivateIndex = -1; +static int AnimCurGeneration; #define IsAnimCur(c) ((c)->bits == &animCursorBits) #define GetAnimCur(c) ((AnimCurPtr) ((c) + 1)) diff --git a/render/glyph.c b/render/glyph.c index 6d09a0e52..5987cbc70 100644 --- a/render/glyph.c +++ b/render/glyph.c @@ -77,11 +77,11 @@ static GlyphHashSetRec glyphHashSets[] = { #define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0])) -const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 }; +static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 }; -GlyphHashRec globalGlyphs[GlyphFormatNum]; +static GlyphHashRec globalGlyphs[GlyphFormatNum]; -int globalTotalGlyphPrivateSize = 0; +static int globalTotalGlyphPrivateSize = 0; static int glyphPrivateCount = 0; diff --git a/render/glyphstr.h b/render/glyphstr.h index 64cedfa16..22150deee 100644 --- a/render/glyphstr.h +++ b/render/glyphstr.h @@ -91,8 +91,6 @@ typedef struct _GlyphList { PictFormatPtr format; } GlyphListRec, *GlyphListPtr; -extern GlyphHashRec globalGlyphs[GlyphFormatNum]; - GlyphHashSetPtr FindGlyphHashSet (CARD32 filled); diff --git a/render/picture.c b/render/picture.c index e7901e873..c30649c6b 100644 --- a/render/picture.c +++ b/render/picture.c @@ -43,7 +43,7 @@ _X_EXPORT int PictureScreenPrivateIndex = -1; int PictureWindowPrivateIndex; -int PictureGeneration; +static int PictureGeneration; RESTYPE PictureType; RESTYPE PictFormatType; RESTYPE GlyphSetType; diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c index cee9e096d..32dee8a18 100755 --- a/xfixes/xfixes.c +++ b/xfixes/xfixes.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * Copyright © 2006 Sun Microsystems * * Permission to use, copy, modify, distribute, and sell this software and its @@ -55,10 +53,10 @@ #define SERVER_XFIXES_MAJOR 4 #define SERVER_XFIXES_MINOR 0 -unsigned char XFixesReqCode; +static unsigned char XFixesReqCode; int XFixesEventBase; int XFixesErrorBase; -int XFixesClientPrivateIndex; +static int XFixesClientPrivateIndex; static int ProcXFixesQueryVersion(ClientPtr client) @@ -169,7 +167,7 @@ SProcXFixesQueryVersion(ClientPtr client) return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } -int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { +static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = { /*************** Version 1 ******************/ SProcXFixesQueryVersion, SProcXFixesChangeSaveSet, diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h index 5f08807f9..7f3b119b7 100755 --- a/xfixes/xfixesint.h +++ b/xfixes/xfixesint.h @@ -61,9 +61,7 @@ #include "selection.h" #include "xfixes.h" -extern unsigned char XFixesReqCode; extern int XFixesEventBase; -extern int XFixesClientPrivateIndex; typedef struct _XFixesClient { CARD32 major_version; @@ -73,7 +71,6 @@ typedef struct _XFixesClient { #define GetXFixesClient(pClient) ((XFixesClientPtr) (pClient)->devPrivates[XFixesClientPrivateIndex].ptr) extern int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr); -extern int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr); /* Initialize extension at server startup time */ diff --git a/xkb/Makefile.am b/xkb/Makefile.am index 996d52761..78cdf7196 100644 --- a/xkb/Makefile.am +++ b/xkb/Makefile.am @@ -41,7 +41,8 @@ X11_SRCS = \ XKBGAlloc.c \ XKBMAlloc.c -XI_SRCS = xkbPrOtherEv.c +# ends up unused... +# XI_SRCS = xkbPrOtherEv.c libxkb_la_SOURCES = $(DDX_SRCS) $(DIX_SRCS) $(XI_SRCS) $(XKBFILE_SRCS) \ $(X11_SRCS) diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c index c474733d0..f0a1f890e 100644 --- a/xkb/XKBAlloc.c +++ b/xkb/XKBAlloc.c @@ -35,7 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/Xproto.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> /***===================================================================***/ @@ -259,7 +259,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which) } /*ARGSUSED*/ -void +static void XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap) { if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) { @@ -284,7 +284,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb) return Success; } -void +static void XkbFreeIndicatorMaps(XkbDescPtr xkb) { if ((xkb!=NULL)&&(xkb->indicators!=NULL)) { @@ -335,154 +335,3 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll) _XkbFree(xkb); return; } - -/***====================================================================***/ - -XkbDeviceLedInfoPtr -XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi,unsigned ledClass,unsigned ledId) -{ -XkbDeviceLedInfoPtr devli; -register int i; - - if ((!devi)||(!XkbSingleXIClass(ledClass))||(!XkbSingleXIId(ledId))) - return NULL; - for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) { - if ((devli->led_class==ledClass)&&(devli->led_id==ledId)) - return devli; - } - if (devi->num_leds>=devi->sz_leds) { - XkbDeviceLedInfoRec *prev_leds = devi->leds; - - if (devi->sz_leds>0) devi->sz_leds*= 2; - else devi->sz_leds= 1; - devi->leds= _XkbTypedRealloc(devi->leds,devi->sz_leds, - XkbDeviceLedInfoRec); - if (!devi->leds) { - _XkbFree(prev_leds); - devi->sz_leds= devi->num_leds= 0; - return NULL; - } - i= devi->num_leds; - for (devli=&devi->leds[i];i<devi->sz_leds;i++,devli++) { - bzero(devli,sizeof(XkbDeviceLedInfoRec)); - devli->led_class= XkbXINone; - devli->led_id= XkbXINone; - } - } - devli= &devi->leds[devi->num_leds++]; - bzero(devli,sizeof(XkbDeviceLedInfoRec)); - devli->led_class= ledClass; - devli->led_id= ledId; - return devli; -} - -Status -XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi,unsigned newTotal) -{ - XkbAction *prev_btn_acts; - - if ((!devi)||(newTotal>255)) - return BadValue; - if ((devi->btn_acts!=NULL)&&(newTotal==devi->num_btns)) - return Success; - if (newTotal==0) { - if (devi->btn_acts!=NULL) { - _XkbFree(devi->btn_acts); - devi->btn_acts= NULL; - } - devi->num_btns= 0; - return Success; - } - prev_btn_acts = devi->btn_acts; - devi->btn_acts= _XkbTypedRealloc(devi->btn_acts,newTotal,XkbAction); - if (devi->btn_acts==NULL) { - _XkbFree(prev_btn_acts); - devi->num_btns= 0; - return BadAlloc; - } - if (newTotal>devi->num_btns) { - XkbAction *act; - act= &devi->btn_acts[devi->num_btns]; - bzero((char *)act,(newTotal-devi->num_btns)*sizeof(XkbAction)); - } - devi->num_btns= newTotal; - return Success; -} - -/*ARGSUSED*/ -XkbDeviceInfoPtr -XkbAllocDeviceInfo(unsigned deviceSpec,unsigned nButtons,unsigned szLeds) -{ -XkbDeviceInfoPtr devi; - - devi= _XkbTypedCalloc(1,XkbDeviceInfoRec); - if (devi!=NULL) { - devi->device_spec= deviceSpec; - devi->has_own_state= False; - devi->num_btns= 0; - devi->btn_acts= NULL; - if (nButtons>0) { - devi->num_btns= nButtons; - devi->btn_acts= _XkbTypedCalloc(nButtons,XkbAction); - if (!devi->btn_acts) { - _XkbFree(devi); - return NULL; - } - } - devi->dflt_kbd_fb= XkbXINone; - devi->dflt_led_fb= XkbXINone; - devi->num_leds= 0; - devi->sz_leds= 0; - devi->leds= NULL; - if (szLeds>0) { - devi->sz_leds= szLeds; - devi->leds= _XkbTypedCalloc(szLeds,XkbDeviceLedInfoRec); - if (!devi->leds) { - if (devi->btn_acts) - _XkbFree(devi->btn_acts); - _XkbFree(devi); - return NULL; - } - } - } - return devi; -} - - -void -XkbFreeDeviceInfo(XkbDeviceInfoPtr devi,unsigned which,Bool freeDevI) -{ - if (devi) { - if (freeDevI) { - which= XkbXI_AllDeviceFeaturesMask; - if (devi->name) { - _XkbFree(devi->name); - devi->name= NULL; - } - } - if ((which&XkbXI_ButtonActionsMask)&&(devi->btn_acts)) { - _XkbFree(devi->btn_acts); - devi->num_btns= 0; - devi->btn_acts= NULL; - } - if ((which&XkbXI_IndicatorsMask)&&(devi->leds)) { - register int i; - if ((which&XkbXI_IndicatorsMask)==XkbXI_IndicatorsMask) { - _XkbFree(devi->leds); - devi->sz_leds= devi->num_leds= 0; - devi->leds= NULL; - } - else { - XkbDeviceLedInfoPtr devli; - for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) { - if (which&XkbXI_IndicatorMapsMask) - bzero((char *)&devli->maps[0],sizeof(devli->maps)); - else bzero((char *)&devli->names[0],sizeof(devli->names)); - } - } - } - if (freeDevI) - _XkbFree(devi); - } - return; -} diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index edaed10f3..815cc95f5 100644 --- a/xkb/XKBGAlloc.c +++ b/xkb/XKBGAlloc.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/Xproto.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #ifdef X_NOT_POSIX diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c index ef4097dad..9feaf8e93 100644 --- a/xkb/XKBMAlloc.c +++ b/xkb/XKBMAlloc.c @@ -39,7 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include <X11/keysym.h> #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> /***====================================================================***/ @@ -220,7 +220,7 @@ XkbServerMapPtr map; /***====================================================================***/ -Status +static Status XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) { if ((!from)||(!into)) @@ -275,82 +275,6 @@ register int i,rtrn; return Success; } -XkbKeyTypePtr -XkbAddKeyType( XkbDescPtr xkb, - Atom name, - int map_count, - Bool want_preserve, - int num_lvls) -{ -register int i; -unsigned tmp; -XkbKeyTypePtr type; -XkbClientMapPtr map; - - if ((!xkb)||(num_lvls<1)) - return NULL; - map= xkb->map; - if ((map)&&(map->types)) { - for (i=0;i<map->num_types;i++) { - if (map->types[i].name==name) { - Status status; - status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls); - return (status==Success?&map->types[i]:NULL); - } - } - } - if ((!map)||(!map->types)||(!map->num_types<XkbNumRequiredTypes)) { - tmp= XkbNumRequiredTypes+1; - if (XkbAllocClientMap(xkb,XkbKeyTypesMask,tmp)!=Success) - return NULL; - map = xkb->map; - tmp= 0; - if (map->num_types<=XkbKeypadIndex) - tmp|= XkbKeypadMask; - if (map->num_types<=XkbAlphabeticIndex) - tmp|= XkbAlphabeticMask; - if (map->num_types<=XkbTwoLevelIndex) - tmp|= XkbTwoLevelMask; - if (map->num_types<=XkbOneLevelIndex) - tmp|= XkbOneLevelMask; - if (XkbInitCanonicalKeyTypes(xkb,tmp,XkbNoModifier)==Success) { - for (i=0;i<map->num_types;i++) { - Status status; - if (map->types[i].name!=name) - continue; - status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls); - return (status==Success?&map->types[i]:NULL); - } - } - } - if ((map->num_types<=map->size_types)&& - (XkbAllocClientMap(xkb,XkbKeyTypesMask,map->num_types+1)!=Success)) { - return NULL; - } - type= &map->types[map->num_types]; - map->num_types++; - bzero((char *)type,sizeof(XkbKeyTypeRec)); - type->num_levels= num_lvls; - type->map_count= map_count; - type->name= name; - if (map_count>0) { - type->map= _XkbTypedCalloc(map_count,XkbKTMapEntryRec); - if (!type->map) { - map->num_types--; - return NULL; - } - if (want_preserve) { - type->preserve= _XkbTypedCalloc(map_count,XkbModsRec); - if (!type->preserve) { - _XkbFree(type->map); - map->num_types--; - return NULL; - } - } - } - return type; -} - Status XkbResizeKeyType( XkbDescPtr xkb, int type_ndx, @@ -475,7 +399,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys; } if (nResize>0) { int nextMatch; - xkb->map->size_syms= (nTotal*12)/10; + xkb->map->size_syms= (nTotal*15)/10; newSyms = _XkbTypedCalloc(xkb->map->size_syms,KeySym); if (newSyms==NULL) return BadAlloc; diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c index 7ed47697e..0404108a2 100644 --- a/xkb/XKBMisc.c +++ b/xkb/XKBMisc.c @@ -39,102 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include <X11/keysym.h> #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> - -/***====================================================================***/ - -#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec)) -static XkbKTMapEntryRec map2Level[]= { - { True, ShiftMask, {1, ShiftMask, 0} } -}; - -static XkbKTMapEntryRec mapAlpha[]= { - { True, ShiftMask, { 1, ShiftMask, 0 } }, - { True, LockMask, { 0, LockMask, 0 } } -}; - -static XkbModsRec preAlpha[]= { - { 0, 0, 0 }, - { LockMask, LockMask, 0 } -}; - -#define NL_VMOD_MASK 0 -static XkbKTMapEntryRec mapKeypad[]= { - { True, ShiftMask, { 1, ShiftMask, 0 } }, - { False, 0, { 1, 0, NL_VMOD_MASK } } -}; - -static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = { - { { 0, 0, 0 }, - 1, /* num_levels */ - 0, /* map_count */ - NULL, NULL, - None, NULL - }, - { { ShiftMask, ShiftMask, 0 }, - 2, /* num_levels */ - mapSize(map2Level), /* map_count */ - map2Level, NULL, - None, NULL - }, - { { ShiftMask|LockMask, ShiftMask|LockMask, 0 }, - 2, /* num_levels */ - mapSize(mapAlpha), /* map_count */ - mapAlpha, preAlpha, - None, NULL - }, - { { ShiftMask, ShiftMask, NL_VMOD_MASK }, - 2, /* num_levels */ - mapSize(mapKeypad), /* map_count */ - mapKeypad, NULL, - None, NULL - } -}; - -Status -XkbInitCanonicalKeyTypes(XkbDescPtr xkb,unsigned which,int keypadVMod) -{ -XkbClientMapPtr map; -XkbKeyTypePtr from,to; -Status rtrn; - - if (!xkb) - return BadMatch; - rtrn= XkbAllocClientMap(xkb,XkbKeyTypesMask,XkbNumRequiredTypes); - if (rtrn!=Success) - return rtrn; - map= xkb->map; - if ((which&XkbAllRequiredTypes)==0) - return Success; - rtrn= Success; - from= canonicalTypes; - to= map->types; - if (which&XkbOneLevelMask) - rtrn= XkbCopyKeyType(&from[XkbOneLevelIndex],&to[XkbOneLevelIndex]); - if ((which&XkbTwoLevelMask)&&(rtrn==Success)) - rtrn= XkbCopyKeyType(&from[XkbTwoLevelIndex],&to[XkbTwoLevelIndex]); - if ((which&XkbAlphabeticMask)&&(rtrn==Success)) - rtrn= XkbCopyKeyType(&from[XkbAlphabeticIndex],&to[XkbAlphabeticIndex]); - if ((which&XkbKeypadMask)&&(rtrn==Success)) { - XkbKeyTypePtr type; - rtrn= XkbCopyKeyType(&from[XkbKeypadIndex],&to[XkbKeypadIndex]); - type= &to[XkbKeypadIndex]; - if ((keypadVMod>=0)&&(keypadVMod<XkbNumVirtualMods)&&(rtrn==Success)) { - type->mods.vmods= (1<<keypadVMod); - type->map[0].active= True; - type->map[0].mods.mask= ShiftMask; - type->map[0].mods.real_mods= ShiftMask; - type->map[0].mods.vmods= 0; - type->map[0].level= 1; - type->map[1].active= False; - type->map[1].mods.mask= 0; - type->map[1].mods.real_mods= 0; - type->map[1].mods.vmods= (1<<keypadVMod); - type->map[1].level= 1; - } - } - return Success; -} +#include <xkbsrv.h> /***====================================================================***/ @@ -558,88 +463,6 @@ unsigned changed,tmp; return True; } -Bool -XkbUpdateMapFromCore( XkbDescPtr xkb, - KeyCode first_key, - int num_keys, - int map_width, - KeySym * core_keysyms, - XkbChangesPtr changes) -{ -register int key,last_key; -KeySym * syms; - - syms= &core_keysyms[(first_key-xkb->min_key_code)*map_width]; - if (changes) { - if (changes->map.changed&XkbKeySymsMask) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms,first_key); - if (num_keys>1) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms, - first_key+num_keys-1); - } - } - else { - changes->map.changed|= XkbKeySymsMask; - changes->map.first_key_sym= first_key; - changes->map.num_key_syms= num_keys; - } - } - last_key= first_key+num_keys-1; - for (key=first_key;key<=last_key;key++,syms+= map_width) { - XkbMapChangesPtr mc; - unsigned explicit; - KeySym tsyms[XkbMaxSymsPerKey]; - int types[XkbNumKbdGroups]; - int nG; - - explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask; - types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); - types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index); - types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index); - types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index); - nG= XkbKeyTypesForCoreSymbols(xkb,map_width,syms,explicit,types,tsyms); - if (changes) - mc= &changes->map; - else mc= NULL; - XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc); - memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms, - XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); - XkbApplyCompatMapToKey(xkb,key,changes); - } - - if ((xkb->server->vmods!=NULL)&&(xkb->map->modmap!=NULL)&&(changes)&& - (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask))) { - unsigned char newVMods[XkbNumVirtualMods]; - register unsigned bit,i; - unsigned present; - - bzero(newVMods,XkbNumVirtualMods); - present= 0; - for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { - if (xkb->server->vmodmap[key]==0) - continue; - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if (bit&xkb->server->vmodmap[key]) { - present|= bit; - newVMods[i]|= xkb->map->modmap[key]; - } - } - } - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if ((bit&present)&&(newVMods[i]!=xkb->server->vmods[i])) { - changes->map.changed|= XkbVirtualModsMask; - changes->map.vmods|= bit; - xkb->server->vmods[i]= newVMods[i]; - } - } - } - if (changes && (changes->map.changed&XkbVirtualModsMask)) - XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes); - return True; -} - Status XkbChangeTypesOfKey( XkbDescPtr xkb, int key, @@ -788,7 +611,7 @@ register unsigned mask; /***====================================================================***/ -Bool +static Bool XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed) { unsigned int tmp; @@ -814,7 +637,7 @@ unsigned int tmp; return False; } -void +static void XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb, XkbKeyTypePtr type, unsigned int changed, diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c index 53f3a6f9c..331357ded 100644 --- a/xkb/ddxBeep.c +++ b/xkb/ddxBeep.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> /*#define FALLING_TONE 1*/ diff --git a/xkb/ddxCtrls.c b/xkb/ddxCtrls.c index 5a9ad4018..0f7f9187f 100644 --- a/xkb/ddxCtrls.c +++ b/xkb/ddxCtrls.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> void diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c index dd7d4459c..89c17d28a 100644 --- a/xkb/ddxDevBtn.c +++ b/xkb/ddxDevBtn.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> diff --git a/xkb/ddxFakeBtn.c b/xkb/ddxFakeBtn.c index 3f23542fe..10ce90b1f 100644 --- a/xkb/ddxFakeBtn.c +++ b/xkb/ddxFakeBtn.c @@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> void diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c index d15c5c193..446764c86 100644 --- a/xkb/ddxFakeMtn.c +++ b/xkb/ddxFakeMtn.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #ifdef PANORAMIX diff --git a/xkb/ddxInit.c b/xkb/ddxInit.c index 88c488c22..3bcf9d604 100644 --- a/xkb/ddxInit.c +++ b/xkb/ddxInit.c @@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> int diff --git a/xkb/ddxKeyClick.c b/xkb/ddxKeyClick.c index 528b20207..685ae1b42 100644 --- a/xkb/ddxKeyClick.c +++ b/xkb/ddxKeyClick.c @@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> void diff --git a/xkb/ddxKillSrv.c b/xkb/ddxKillSrv.c index 95d75897b..a573ecbd8 100644 --- a/xkb/ddxKillSrv.c +++ b/xkb/ddxKillSrv.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> int XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act) diff --git a/xkb/ddxLEDs.c b/xkb/ddxLEDs.c index fd0195882..22899d766 100644 --- a/xkb/ddxLEDs.c +++ b/xkb/ddxLEDs.c @@ -37,10 +37,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> -void +static void XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new) { dev->kbdfeed->ctrl.leds= new; diff --git a/xkb/ddxList.c b/xkb/ddxList.c index 034f694ed..a91a9badf 100644 --- a/xkb/ddxList.c +++ b/xkb/ddxList.c @@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "scrnintstr.h" #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #ifndef PATH_MAX diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index 6e8f8921c..c24c56c1c 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -44,7 +44,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "scrnintstr.h" #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XI.h> #include "xkb.h" @@ -211,7 +211,7 @@ OutputDirectory( } } -Bool +static Bool XkbDDXCompileNamedKeymap( XkbDescPtr xkb, XkbComponentNamesPtr names, char * nameRtrn, @@ -298,7 +298,7 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile; return False; } -Bool +static Bool XkbDDXCompileKeymapByNames( XkbDescPtr xkb, XkbComponentNamesPtr names, unsigned want, @@ -432,7 +432,7 @@ char tmpname[PATH_MAX]; return False; } -FILE * +static FILE * XkbDDXOpenConfigFile(char *mapName,char *fileNameRtrn,int fileNameRtrnLen) { char buf[PATH_MAX],xkm_output_dir[PATH_MAX]; diff --git a/xkb/ddxPrivate.c b/xkb/ddxPrivate.c index 7450b47ba..f67e20c27 100644 --- a/xkb/ddxPrivate.c +++ b/xkb/ddxPrivate.c @@ -6,7 +6,7 @@ #define NEED_EVENTS #include <X11/X.h> #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> int XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act) diff --git a/xkb/ddxVT.c b/xkb/ddxVT.c index f56f0796d..55c82a865 100644 --- a/xkb/ddxVT.c +++ b/xkb/ddxVT.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> int XkbDDXSwitchScreen(DeviceIntPtr dev,KeyCode key,XkbAction *act) diff --git a/xkb/maprules.c b/xkb/maprules.c index b0a2225e2..0fa356ee5 100644 --- a/xkb/maprules.c +++ b/xkb/maprules.c @@ -48,7 +48,7 @@ #include "dix.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #ifdef DEBUG #define PR_DEBUG(s) fprintf(stderr,s) @@ -36,23 +36,20 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "misc.h" #include "inputstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "extnsionst.h" #include "xkb.h" #include <X11/extensions/XI.h> int XkbEventBase; - int XkbErrorBase; +static int XkbErrorBase; int XkbReqCode; - int XkbKeyboardErrorCode; -Atom xkbONE_LEVEL; -Atom xkbTWO_LEVEL; -Atom xkbKEYPAD; +static int XkbKeyboardErrorCode; CARD32 xkbDebugFlags = 0; -CARD32 xkbDebugCtrls = 0; +static CARD32 xkbDebugCtrls = 0; -RESTYPE RT_XKBCLIENT; +static RESTYPE RT_XKBCLIENT; /***====================================================================***/ @@ -895,52 +892,6 @@ ProcXkbSetControls(ClientPtr client) return client->noClientException; } -/* FIXME: Needs to set rate on all core-sending devices. */ -int -XkbSetRepeatRate(DeviceIntPtr dev,int timeout,int interval,int major,int minor) -{ -int changed= 0; -XkbControlsRec old,*xkb; - - if ((!dev)||(!dev->key)||(!dev->key->xkbInfo)) - return 0; - xkb= dev->key->xkbInfo->desc->ctrls; - old= *xkb; - if ((timeout!=0) && (xkb->repeat_delay!=timeout)) { - xkb->repeat_delay= timeout; - changed++; - } - if ((interval!=0) && (xkb->repeat_interval!=interval)) { - xkb->repeat_interval= interval; - changed++; - } - if (changed) { - xkbControlsNotify cn; - XkbDDXChangeControls(dev,&old,xkb); - if (XkbComputeControlsNotify(dev,&old,xkb,&cn,False)) { - cn.keycode= 0; - cn.eventType = 0; - cn.requestMajor = major; - cn.requestMinor = minor; - XkbSendControlsNotify(dev,&cn); - } - } - return 1; -} - -int -XkbGetRepeatRate(DeviceIntPtr dev,int *timeout,int *interval) -{ -XkbControlsPtr xkb; - - if ((!dev)||(!dev->key)||(!dev->key->xkbInfo)) - return 0; - xkb= dev->key->xkbInfo->desc->ctrls; - if (timeout) *timeout= xkb->repeat_delay; - if (interval) *interval= xkb->repeat_interval; - return 1; -} - /***====================================================================***/ static int @@ -2820,7 +2771,7 @@ ProcXkbGetIndicatorState(ClientPtr client) /***====================================================================***/ -Status +static Status XkbComputeGetIndicatorMapReplySize( XkbIndicatorPtr indicators, xkbGetIndicatorMapReply *rep) @@ -2837,7 +2788,7 @@ int nIndicators; return Success; } -int +static int XkbSendIndicatorMap( ClientPtr client, XkbIndicatorPtr indicators, xkbGetIndicatorMapReply * rep) @@ -1,5 +1,3 @@ -/* $XFree86$ */ - /* #include "XKBfile.h" */ extern int ProcXkbUseExtension(ClientPtr client); @@ -29,50 +27,10 @@ extern int ProcXkbGetDeviceInfo(ClientPtr client); extern int ProcXkbSetDeviceInfo(ClientPtr client); extern int ProcXkbSetDebuggingFlags(ClientPtr client); -extern int XkbSetRepeatRate(DeviceIntPtr dev, int timeout, int interval, int major, int minor); -extern int XkbGetRepeatRate(DeviceIntPtr dev, int *timeout, int *interval); - extern void XkbExtensionInit(void); -extern Status XkbComputeGetIndicatorMapReplySize( - XkbIndicatorPtr indicators, - xkbGetIndicatorMapReply *rep); -extern int XkbSendIndicatorMap( - ClientPtr client, - XkbIndicatorPtr indicators, - xkbGetIndicatorMapReply *rep); - -extern void XkbComputeCompatState(XkbSrvInfoPtr xkbi); -extern void XkbSetPhysicalLockingKey(DeviceIntPtr dev, unsigned key); - extern Bool XkbFilterEvents(ClientPtr pClient, int nEvents, xEvent *xE); -extern Bool XkbApplyLEDChangeToKeyboard( - XkbSrvInfoPtr xkbi, - XkbIndicatorMapPtr map, - Bool on, - XkbChangesPtr change); - -extern Bool XkbWriteRulesProp(ClientPtr client, pointer closure); - -extern XkbAction XkbGetButtonAction(DeviceIntPtr kbd, DeviceIntPtr dev, int button); - -/* extern Status XkbMergeFile(XkbDescPtr xkb, XkbFileInfo finfo); */ - -extern Bool XkbDDXCompileNamedKeymap( - XkbDescPtr xkb, - XkbComponentNamesPtr names, - char * nameRtrn, - int nameRtrnLen); - -extern Bool XkbDDXCompileKeymapByNames( - XkbDescPtr xkb, - XkbComponentNamesPtr names, - unsigned want, - unsigned need, - char * nameRtrn, - int nameRtrnLen); - extern Bool XkbCopyKeymap( XkbDescPtr src, XkbDescPtr dst, diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c index 0ab3dadf6..2954a0c0e 100644 --- a/xkb/xkbAccessX.c +++ b/xkb/xkbAccessX.c @@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/Xproto.h> #include <X11/keysym.h> #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #if !defined(WIN32) && !defined(Lynx) #include <sys/time.h> #endif @@ -52,9 +52,9 @@ pointer XkbLastRepeatEvent= NULL; unsigned short XkbDfltAccessXTimeout= 120; unsigned int XkbDfltAccessXTimeoutMask= DFLT_TIMEOUT_CTRLS; -unsigned int XkbDfltAccessXTimeoutValues= 0; -unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS; -unsigned int XkbDfltAccessXTimeoutOptionsValues= 0; +static unsigned int XkbDfltAccessXTimeoutValues= 0; +static unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS; +static unsigned int XkbDfltAccessXTimeoutOptionsValues= 0; unsigned int XkbDfltAccessXFeedback= XkbAccessXFeedbackMask; unsigned short XkbDfltAccessXOptions= XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask|XkbAX_SKReleaseFBMask|XkbAX_SKRejectFBMask); diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 7b074b53f..4c3efe28d 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -36,14 +36,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/keysym.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "xkb.h" #include <ctype.h> static unsigned int _xkbServerGeneration; -int xkbDevicePrivateIndex = -1; +static int xkbDevicePrivateIndex = -1; -void +static void xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data) { @@ -216,7 +216,7 @@ static XkbAction fake; return fake; } -XkbAction +static XkbAction XkbGetButtonAction(DeviceIntPtr kbd,DeviceIntPtr dev,int button) { XkbAction fake; diff --git a/xkb/xkbDflts.h b/xkb/xkbDflts.h index e31568abb..5d8690650 100644 --- a/xkb/xkbDflts.h +++ b/xkb/xkbDflts.h @@ -456,43 +456,6 @@ static XkbCompatMapRec compatMap= { num_dfltSI, num_dfltSI }; -static XkbIndicatorRec indicators= { - 0x0, - { - { 0x80, 0, 0x00, XkbIM_UseEffective, { LockMask, LockMask, 0 }, 0 }, - { 0x80, 0, 0x00, XkbIM_UseEffective, { 0, 0, vmod_NumLockMask }, 0 }, - { 0x80, 0, 0x00, XkbIM_UseLocked, { ShiftMask, ShiftMask, 0 }, 0 }, - { 0x80, 0, 0x00, 0, { 0, 0, 0 }, XkbMouseKeysMask }, - { 0x80, 0, 0x00, XkbIM_UseLocked, { 0, 0, vmod_ScrollLockMask }, 0 }, - { 0x80, XkbIM_UseEffective, 0xfe, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }, - { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 } - } -}; static void initIndicatorNames(DPYTYPE dpy,XkbDescPtr xkb) { diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index eeb9dec7c..1e5a43b1b 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XI.h> #include "inputstr.h" #include "windowstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "xkb.h" /***====================================================================***/ @@ -331,7 +331,7 @@ Time time = 0; return; } -void +static void XkbSendIndicatorNotify(DeviceIntPtr kbd,int xkbType,xkbIndicatorNotify *pEv) { int initialized; @@ -975,48 +975,6 @@ XkbInterestPtr interest; } int -XkbRemoveClient(DevicePtr inDev,ClientPtr client) -{ -XkbSrvInfoPtr xkbi; -DeviceIntPtr dev = (DeviceIntPtr)inDev; -XkbInterestPtr interest; -unsigned long autoCtrls,autoValues; -Bool found; - - found= False; - autoCtrls= autoValues= 0; - if ( dev->xkb_interest ) { - interest = dev->xkb_interest; - if (interest && (interest->client==client)){ - dev->xkb_interest = interest->next; - autoCtrls= interest->autoCtrls; - autoValues= interest->autoCtrlValues; - _XkbFree(interest); - found= True; - } - while ((!found)&&(interest->next)) { - if (interest->next->client==client) { - XkbInterestPtr victim = interest->next; - interest->next = victim->next; - autoCtrls= victim->autoCtrls; - autoValues= victim->autoCtrlValues; - _XkbFree(victim); - found= True; - } - interest = interest->next; - } - } - if (found && autoCtrls && dev->key && dev->key->xkbInfo ) { - XkbEventCauseRec cause; - - xkbi= dev->key->xkbInfo; - XkbSetCauseXkbReq(&cause,X_kbPerClientFlags,client); - XkbEnableDisableControls(xkbi,autoCtrls,autoValues,NULL,&cause); - } - return found; -} - -int XkbRemoveResourceClient(DevicePtr inDev,XID id) { XkbSrvInfoPtr xkbi; diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 5aa121da2..716bc26a5 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -47,7 +47,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "opaque.h" #include "property.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #include <X11/extensions/XKMformat.h> #include <X11/extensions/XKBfile.h> @@ -124,7 +124,7 @@ typedef struct _SrvXkmInfo { char * XkbBaseDirectory= XKB_BASE_DIRECTORY; char * XkbBinDirectory= XKB_BIN_DIRECTORY; -int XkbWantAccessX= 0; +static int XkbWantAccessX= 0; static XkbFileInfo * _XkbInitFileInfo= NULL; static Bool rulesDefined= False; @@ -134,20 +134,17 @@ static char * XkbLayoutDflt= NULL; static char * XkbVariantDflt= NULL; static char * XkbOptionsDflt= NULL; -char * XkbModelUsed= NULL; -char * XkbLayoutUsed= NULL; -char * XkbVariantUsed= NULL; -char * XkbOptionsUsed= NULL; - -int _XkbClientMajor= XkbMajorVersion; -int _XkbClientMinor= XkbMinorVersion; +static char * XkbModelUsed= NULL; +static char * XkbLayoutUsed= NULL; +static char * XkbVariantUsed= NULL; +static char * XkbOptionsUsed= NULL; _X_EXPORT Bool noXkbExtension= XKB_DFLT_DISABLED; -Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; +static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; /***====================================================================***/ -char * +static char * XkbGetRulesDflts(XkbRF_VarDefsPtr defs) { if (XkbModelDflt) defs->model= XkbModelDflt; @@ -161,7 +158,7 @@ XkbGetRulesDflts(XkbRF_VarDefsPtr defs) return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES_FILE); } -Bool +static Bool XkbWriteRulesProp(ClientPtr client, pointer closure) { int len,out; @@ -230,7 +227,7 @@ char * pval; return True; } -void +static void XkbSetRulesUsed(XkbRF_VarDefsPtr defs) { if (XkbModelUsed) @@ -289,9 +286,6 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, #include "xkbDflts.h" -/* A dummy to keep the compiler quiet */ -pointer xkbBogus = &indicators; - static Bool XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file) { diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index e94e0bff4..d607d9066 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #include <X11/extensions/XI.h> -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include "xkb.h" /***====================================================================***/ @@ -82,7 +82,7 @@ XkbSrvLedInfoPtr sli; /* * Bool - * XkbApplyLEDChangeToKeyboard(xkbi,map,on,change) + *XkbApplyLEDChangeToKeyboard(xkbi,map,on,change) * * Some indicators "drive" the keyboard when their state is explicitly * changed, as described in section 9.2.1 of the XKB protocol spec. @@ -91,7 +91,7 @@ XkbSrvLedInfoPtr sli; * when the indicator described by 'map' is turned on or off. The * extent of the changes is reported in change, which must be defined. */ -Bool +static Bool XkbApplyLEDChangeToKeyboard( XkbSrvInfoPtr xkbi, XkbIndicatorMapPtr map, Bool on, @@ -166,6 +166,164 @@ XkbStatePtr state; } return (stateChange || ctrlChange); } + + /* + * Bool + * ComputeAutoState(map,state,ctrls) + * + * This function reports the effect of applying the specified + * indicator map given the specified state and controls, as + * described in section 9.2 of the XKB protocol specification. + */ + +static Bool +ComputeAutoState( XkbIndicatorMapPtr map, + XkbStatePtr state, + XkbControlsPtr ctrls) +{ +Bool on; +CARD8 mods,group; + + on= False; + mods= group= 0; + if (map->which_mods&XkbIM_UseAnyMods) { + if (map->which_mods&XkbIM_UseBase) + mods|= state->base_mods; + if (map->which_mods&XkbIM_UseLatched) + mods|= state->latched_mods; + if (map->which_mods&XkbIM_UseLocked) + mods|= state->locked_mods; + if (map->which_mods&XkbIM_UseEffective) + mods|= state->mods; + if (map->which_mods&XkbIM_UseCompat) + mods|= state->compat_state; + on = ((map->mods.mask&mods)!=0); + on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0)); + } + if (map->which_groups&XkbIM_UseAnyGroup) { + if (map->which_groups&XkbIM_UseBase) + group|= (1L << state->base_group); + if (map->which_groups&XkbIM_UseLatched) + group|= (1L << state->latched_group); + if (map->which_groups&XkbIM_UseLocked) + group|= (1L << state->locked_group); + if (map->which_groups&XkbIM_UseEffective) + group|= (1L << state->group); + on = on||(((map->groups&group)!=0)||(map->groups==0)); + } + if (map->ctrls) + on = on||(ctrls->enabled_ctrls&map->ctrls); + return on; +} + + +static void +XkbUpdateLedAutoState( DeviceIntPtr dev, + XkbSrvLedInfoPtr sli, + unsigned maps_to_check, + xkbExtensionDeviceNotify * ed, + XkbChangesPtr changes, + XkbEventCausePtr cause) +{ +DeviceIntPtr kbd; +XkbStatePtr state; +XkbControlsPtr ctrls; +XkbChangesRec my_changes; +xkbExtensionDeviceNotify my_ed; +register unsigned i,bit,affected; +register XkbIndicatorMapPtr map; +unsigned oldState; + + if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0)) + return; + + if (dev->key && dev->key->xkbInfo) + kbd= dev; + else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + + state= &kbd->key->xkbInfo->state; + ctrls= kbd->key->xkbInfo->desc->ctrls; + affected= maps_to_check; + oldState= sli->effectiveState; + sli->autoState&= ~affected; + for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) { + if ((affected&bit)==0) + continue; + affected&= ~bit; + map= &sli->maps[i]; + if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls)) + sli->autoState|= bit; + } + sli->effectiveState= (sli->autoState|sli->explicitState); + affected= sli->effectiveState^oldState; + if (affected==0) + return; + + if (ed==NULL) { + ed= &my_ed; + bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); + } + else if ((ed->reason&XkbXI_IndicatorsMask)&& + ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { + XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); + } + + if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { + if (changes==NULL) { + changes= &my_changes; + bzero((char *)changes,sizeof(XkbChangesRec)); + } + changes->indicators.state_changes|= affected; + } + + ed->reason|= XkbXI_IndicatorStateMask; + ed->ledClass= sli->class; + ed->ledID= sli->id; + ed->ledsDefined= sli->namesPresent|sli->mapsPresent; + ed->ledState= sli->effectiveState; + ed->unsupported|= XkbXI_IndicatorStateMask; + ed->supported= XkbXI_AllFeaturesMask; + + if (changes!=&my_changes) changes= NULL; + if (ed!=&my_ed) ed= NULL; + if (changes || ed) + XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); + return; +} + +static void +XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause) +{ +DeviceIntPtr edev; +XkbSrvLedInfoPtr sli; + + for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { + if (edev->kbdfeed) { + KbdFeedbackPtr kf; + for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) { + if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) + continue; + sli= kf->xkb_sli; + XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, + changes,cause); + + } + } + if (edev->leds) { + LedFeedbackPtr lf; + for (lf=edev->leds;lf!=NULL;lf=lf->next) { + if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) + continue; + sli= lf->xkb_sli; + XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, + changes,cause); + + } + } + } + return; +} + /***====================================================================***/ @@ -228,55 +386,6 @@ unsigned side_affected; /***====================================================================***/ - /* - * Bool - * ComputeAutoState(map,state,ctrls) - * - * This function reports the effect of applying the specified - * indicator map given the specified state and controls, as - * described in section 9.2 of the XKB protocol specification. - */ - -static Bool -ComputeAutoState( XkbIndicatorMapPtr map, - XkbStatePtr state, - XkbControlsPtr ctrls) -{ -Bool on; -CARD8 mods,group; - - on= False; - mods= group= 0; - if (map->which_mods&XkbIM_UseAnyMods) { - if (map->which_mods&XkbIM_UseBase) - mods|= state->base_mods; - if (map->which_mods&XkbIM_UseLatched) - mods|= state->latched_mods; - if (map->which_mods&XkbIM_UseLocked) - mods|= state->locked_mods; - if (map->which_mods&XkbIM_UseEffective) - mods|= state->mods; - if (map->which_mods&XkbIM_UseCompat) - mods|= state->compat_state; - on = ((map->mods.mask&mods)!=0); - on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0)); - } - if (map->which_groups&XkbIM_UseAnyGroup) { - if (map->which_groups&XkbIM_UseBase) - group|= (1L << state->base_group); - if (map->which_groups&XkbIM_UseLatched) - group|= (1L << state->latched_group); - if (map->which_groups&XkbIM_UseLocked) - group|= (1L << state->locked_group); - if (map->which_groups&XkbIM_UseEffective) - group|= (1L << state->group); - on = on||(((map->groups&group)!=0)||(map->groups==0)); - } - if (map->ctrls) - on = on||(ctrls->enabled_ctrls&map->ctrls); - return on; -} - /***====================================================================***/ /* @@ -314,39 +423,6 @@ XkbSrvLedInfoPtr sli; /***====================================================================***/ -void -XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause) -{ -DeviceIntPtr edev; -XkbSrvLedInfoPtr sli; - - for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { - if (edev->kbdfeed) { - KbdFeedbackPtr kf; - for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) { - if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) - continue; - sli= kf->xkb_sli; - XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, - changes,cause); - - } - } - if (edev->leds) { - LedFeedbackPtr lf; - for (lf=edev->leds;lf!=NULL;lf=lf->next) { - if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) - continue; - sli= lf->xkb_sli; - XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, - changes,cause); - - } - } - } - return; -} - /***====================================================================***/ /* @@ -856,210 +932,3 @@ Bool kb_changed; XkbUpdateAllDeviceIndicators(NULL,cause); return; } - -/***====================================================================***/ - -void -XkbUpdateLedAutoState( DeviceIntPtr dev, - XkbSrvLedInfoPtr sli, - unsigned maps_to_check, - xkbExtensionDeviceNotify * ed, - XkbChangesPtr changes, - XkbEventCausePtr cause) -{ -DeviceIntPtr kbd; -XkbStatePtr state; -XkbControlsPtr ctrls; -XkbChangesRec my_changes; -xkbExtensionDeviceNotify my_ed; -register unsigned i,bit,affected; -register XkbIndicatorMapPtr map; -unsigned oldState; - - if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0)) - return; - - if (dev->key && dev->key->xkbInfo) - kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); - - state= &kbd->key->xkbInfo->state; - ctrls= kbd->key->xkbInfo->desc->ctrls; - affected= maps_to_check; - oldState= sli->effectiveState; - sli->autoState&= ~affected; - for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) { - if ((affected&bit)==0) - continue; - affected&= ~bit; - map= &sli->maps[i]; - if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls)) - sli->autoState|= bit; - } - sli->effectiveState= (sli->autoState|sli->explicitState); - affected= sli->effectiveState^oldState; - if (affected==0) - return; - - if (ed==NULL) { - ed= &my_ed; - bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); - } - else if ((ed->reason&XkbXI_IndicatorsMask)&& - ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { - XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); - } - - if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { - if (changes==NULL) { - changes= &my_changes; - bzero((char *)changes,sizeof(XkbChangesRec)); - } - changes->indicators.state_changes|= affected; - } - - ed->reason|= XkbXI_IndicatorStateMask; - ed->ledClass= sli->class; - ed->ledID= sli->id; - ed->ledsDefined= sli->namesPresent|sli->mapsPresent; - ed->ledState= sli->effectiveState; - ed->unsupported|= XkbXI_IndicatorStateMask; - ed->supported= XkbXI_AllFeaturesMask; - - if (changes!=&my_changes) changes= NULL; - if (ed!=&my_ed) ed= NULL; - if (changes || ed) - XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); - return; -} - -/***====================================================================***/ - -static void -_UpdateButtonVMods( XkbDescPtr xkb, - unsigned num_btns, - XkbAction * acts, - unsigned changed, - xkbExtensionDeviceNotify * ed_inout) -{ -register int i; - - for (i=0;i<num_btns;i++,acts++) { - if ((acts->any.type!=XkbSA_NoAction)&& - XkbUpdateActionVirtualMods(xkb,acts,changed)) { - if ((ed_inout->reason&XkbXI_ButtonActionsMask)==0) { - ed_inout->reason|= XkbXI_ButtonActionsMask; - ed_inout->firstBtn= i; - ed_inout->nBtns= 1; - } - else { - ed_inout->nBtns= (i-ed_inout->firstBtn)+1; - } - } - } - return; -} - -static void -_UpdateMapVMods( XkbDescPtr xkb, - register XkbIndicatorMapPtr map, - unsigned changed_vmods, - unsigned * changed_maps_rtrn) -{ -register int i; - - *changed_maps_rtrn= 0; - for (i=0;i<XkbNumIndicators;i++,map++) { - if (map->mods.vmods&changed_vmods) { - map->mods.mask= map->mods.real_mods; - map->mods.mask|= XkbMaskForVMask(xkb,map->mods.vmods); - *changed_maps_rtrn|= (1L<<i); - } - } - return; -} - -static void -_UpdateDeviceVMods( DeviceIntPtr dev, - XkbDescPtr xkb, - unsigned changed, - XkbEventCausePtr cause) -{ -xkbExtensionDeviceNotify ed; -XkbSrvLedInfoPtr sli; -unsigned changed_maps; - - bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify)); - ed.deviceID= dev->id; - if ((dev->button)&&(dev->button->xkb_acts)) { - _UpdateButtonVMods(xkb,dev->button->numButtons, - dev->button->xkb_acts,changed,&ed); - } - if (dev->kbdfeed) { - KbdFeedbackPtr kf; - for (kf=dev->kbdfeed;kf!=NULL;kf=kf->next) { - if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) - continue; - sli= kf->xkb_sli; - _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps); - if (changed_maps) { - if (ed.reason&XkbXI_IndicatorsMask) { - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - ed.reason= 0; - ed.firstBtn= ed.nBtns; - } - ed.ledClass= sli->class; - ed.ledID= sli->id; - ed.ledsDefined= sli->namesPresent|sli->mapsPresent; - ed.reason|= XkbXI_IndicatorMapsMask; - XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause); - } - } - } - if (dev->leds) { - LedFeedbackPtr lf; - for (lf=dev->leds;lf!=NULL;lf=lf->next) { - if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) - continue; - sli= lf->xkb_sli; - _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps); - if (changed_maps) { - if (ed.reason&XkbXI_IndicatorsMask) { - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - ed.reason= 0; - ed.firstBtn= ed.nBtns; - } - ed.ledClass= sli->class; - ed.ledID= sli->id; - ed.ledsDefined= sli->namesPresent|sli->mapsPresent; - ed.reason|= XkbXI_IndicatorMapsMask; - XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause); - } - } - } - if (ed.reason!=0) - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - return; -} - -void -XkbApplyVModChangesToAllDevices( DeviceIntPtr dev, - XkbDescPtr xkb, - unsigned changed, - XkbEventCausePtr cause) -{ -DeviceIntPtr edev; - if (dev!=(DeviceIntPtr)LookupKeyboardDevice()) - return; - for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { - if (edev->key) - continue; - _UpdateDeviceVMods(edev,xkb,changed,cause); - } - for (edev=inputInfo.off_devices;edev!=NULL;edev=edev->next) { - if (edev->key) - continue; - _UpdateDeviceVMods(edev,xkb,changed,cause); - } - return; -} diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c index 9944c8886..81124bcfb 100644 --- a/xkb/xkbPrKeyEv.c +++ b/xkb/xkbPrKeyEv.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/keysym.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <ctype.h> diff --git a/xkb/xkbSwap.c b/xkb/xkbSwap.c index 9a04b77d5..da4c9053b 100644 --- a/xkb/xkbSwap.c +++ b/xkb/xkbSwap.c @@ -35,7 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/Xproto.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBstr.h> #include "extnsionst.h" #include "xkb.h" diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 062159ec6..bb6d8a0ae 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -41,7 +41,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "inputstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #include "xkb.h" @@ -172,44 +172,6 @@ register unsigned mask; return mask; } - -Bool -XkbApplyVModChanges( XkbSrvInfoPtr xkbi, - unsigned changed, - XkbChangesPtr changes, - unsigned * needChecksRtrn, - XkbEventCausePtr cause) -{ -XkbDescPtr xkb; -Bool check; - - xkb= xkbi->desc; -#ifdef DEBUG -{ -register unsigned i,bit; - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if ((changed&bit)==0) - continue; - if (xkbDebugFlags) - ErrorF("Should be applying: change vmod %d to 0x%x\n",i, - xkb->server->vmods[i]); - } -} -#endif - check= XkbApplyVirtualModChanges(xkb,changed,changes); - XkbApplyVModChangesToAllDevices(xkbi->device,xkb,changed,cause); - - if (needChecksRtrn!=NULL) { - if (check) - *needChecksRtrn= XkbStateNotifyMask|XkbIndicatorStateNotifyMask; - else *needChecksRtrn= 0; - } - else if (check) { - /* 7/12/95 (ef) -- XXX check compatibility and/or indicator state */ - } - return 1; -} - /***====================================================================***/ void @@ -658,7 +620,7 @@ int changed; return changed; } -void +static void XkbComputeCompatState(XkbSrvInfoPtr xkbi) { CARD16 grp_mask; @@ -772,21 +734,6 @@ XkbCheckSecondaryEffects( XkbSrvInfoPtr xkbi, /***====================================================================***/ -void -XkbSetPhysicalLockingKey(DeviceIntPtr dev,unsigned key) -{ -XkbDescPtr xkb; - - xkb= dev->key->xkbInfo->desc; - if ((key>=xkb->min_key_code) && (key<=xkb->max_key_code)) { - xkb->server->behaviors[key].type= XkbKB_Lock|XkbKB_Permanent; - } - else ErrorF("Internal Error! Bad XKB info in SetPhysicalLockingKey\n"); - return; -} - -/***====================================================================***/ - Bool XkbEnableDisableControls( XkbSrvInfoPtr xkbi, unsigned long change, @@ -1193,6 +1140,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) dtype->preserve = NULL; } } + + dst->map->size_types = src->map->num_types; + dst->map->num_types = src->map->num_types; } else { if (dst->map->types) { @@ -1208,9 +1158,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) xfree(dst->map->types); dst->map->types = NULL; } + dst->map->num_types = 0; + dst->map->size_types = 0; } - dst->map->size_types = src->map->num_types; - dst->map->num_types = src->map->num_types; if (src->map->modmap) { if (src->max_key_code != dst->max_key_code) { diff --git a/xkb/xkberrs.c b/xkb/xkberrs.c index 095d573ea..3534356c6 100644 --- a/xkb/xkberrs.c +++ b/xkb/xkberrs.c @@ -32,37 +32,6 @@ #include <ctype.h> #include <stdlib.h> -char * _XkbErrMessages[] = { - "success", /* _XkbSuccess */ - "key names not defined", /* _XkbErrMissingNames */ - "key types not defined", /* _XkbErrMissingTypes */ - "required key types not present", /* _XkbErrMissingReqTypes */ - "symbols not defined", /* _XkbErrMissingSymbols */ - "virtual modifier bindings not defined",/* _XkbErrMissingVMods */ - "indicators not defined", /* _XkbErrMissingIndicators */ - "compatibility map not defined", /* _XkbErrMissingCompatMap */ - "symbol interpretations not defined", /* _XkbErrMissingSymInterps */ - "geometry not defined", /* _XkbErrMissingGeometry */ - "illegal doodad type", /* _XkbErrIllegalDoodad */ - "illegal TOC type", /* _XkbErrIllegalTOCType */ - "illegal contents", /* _XkbErrIllegalContents */ - "empty file", /* _XkbErrEmptyFile */ - "file not found", /* _XkbErrFileNotFound */ - "cannot open", /* _XkbErrFileCannotOpen */ - "bad value", /* _XkbErrBadValue */ - "bad match", /* _XkbErrBadMatch */ - "illegal name for type", /* _XkbErrBadTypeName */ - "illegal width for type", /* _XkbErrBadTypeWidth */ - "bad file type", /* _XkbErrBadFileType */ - "bad file version", /* _XkbErrBadFileVersion */ - "error in Xkm file", /* _XkbErrBadFileFormat */ - "allocation failed", /* _XkbErrBadAlloc */ - "bad length", /* _XkbErrBadLength */ - "X request failed", /* _XkbErrXReqFailure */ - "not implemented" /* _XkbErrBadImplementation */ -}; - unsigned _XkbErrCode; char * _XkbErrLocation= NULL; unsigned _XkbErrData; - diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c index 4130bd998..05344b475 100644 --- a/xkb/xkbfmisc.c +++ b/xkb/xkbfmisc.c @@ -44,7 +44,7 @@ #include "dix.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS 1 -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #include "xkb.h" @@ -133,76 +133,6 @@ unsigned set,rtrn; /***===================================================================***/ -Bool -XkbLookupGroupAndLevel( XkbDescPtr xkb, - int key, - int * mods_inout, - int * grp_inout, - int * lvl_rtrn) -{ -int nG,eG; - - if ((!xkb)||(!XkbKeycodeInRange(xkb,key))||(!grp_inout)) - return False; - - nG= XkbKeyNumGroups(xkb,key); - eG= *grp_inout; - - if ( nG==0 ) { - *grp_inout= 0; - if (lvl_rtrn!=NULL) - *lvl_rtrn= 0; - return False; - } - else if ( nG==1 ) { - eG= 0; - } - else if ( eG>=nG ) { - unsigned gI= XkbKeyGroupInfo(xkb,key); - switch (XkbOutOfRangeGroupAction(gI)) { - default: - eG %= nG; - break; - case XkbClampIntoRange: - eG = nG-1; - break; - case XkbRedirectIntoRange: - eG = XkbOutOfRangeGroupNumber(gI); - if (eG>=nG) - eG= 0; - break; - } - } - *grp_inout= eG; - if (mods_inout!=NULL) { - XkbKeyTypePtr type; - int preserve; - - type = XkbKeyKeyType(xkb,key,eG); - if (lvl_rtrn!=NULL) - *lvl_rtrn= 0; - preserve= 0; - if (type->map) { /* find the shift level */ - register int i; - register XkbKTMapEntryPtr entry; - for (i=0,entry=type->map;i<type->map_count;i++,entry++) { - if ((entry->active)&& - (((*mods_inout)&type->mods.mask)==entry->mods.mask)){ - if (lvl_rtrn!=NULL) - *lvl_rtrn= entry->level; - if (type->preserve) - preserve= type->preserve[i].mask; - break; - } - } - } - (*mods_inout)&= ~(type->mods.mask&(~preserve)); - } - return True; -} - -/***===================================================================***/ - static Bool XkbWriteSectionFromName(FILE *file,char *sectionName,char *name) { @@ -416,15 +346,6 @@ XkbFileInfo finfo; /***====================================================================***/ -/*ARGSUSED*/ -Status -XkbMergeFile(XkbDescPtr xkb,XkbFileInfo finfo) -{ - return BadImplementation; -} - -/***====================================================================***/ - int XkbFindKeycodeByName(XkbDescPtr xkb,char *name,Bool use_aliases) { @@ -484,34 +405,6 @@ unsigned rtrn; return rtrn; } -unsigned -XkbConvertXkbComponents(Bool toXkm,unsigned orig) -{ -unsigned rtrn; - - rtrn= 0; - if (toXkm) { - if (orig&XkbClientMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask; - if (orig&XkbServerMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask; - if (orig&XkbCompatMapMask) rtrn|= XkmCompatMapMask; - if (orig&XkbIndicatorMapMask) rtrn|= XkmIndicatorsMask; - if (orig&XkbNamesMask) rtrn|= XkmKeyNamesMask; - if (orig&XkbGeometryMask) rtrn|= XkmGeometryMask; - } - else { - if (orig!=0) rtrn|= XkbNamesMask; - if (orig&XkmTypesMask) rtrn|= XkbClientMapMask; - if (orig&XkmCompatMapMask) - rtrn|= XkbCompatMapMask|XkbIndicatorMapMask; - if (orig&XkmSymbolsMask) rtrn|=XkbClientMapMask|XkbServerMapMask; - if (orig&XkmIndicatorsMask) rtrn|= XkbIndicatorMapMask; - if (orig&XkmKeyNamesMask) - rtrn|= XkbNamesMask|XkbIndicatorMapMask; - if (orig&XkmGeometryMask) rtrn|= XkbGeometryMask; - } - return rtrn; -} - Bool XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing) { diff --git a/xkb/xkbout.c b/xkb/xkbout.c index 31cd4fae4..bdec8e7d3 100644 --- a/xkb/xkbout.c +++ b/xkb/xkbout.c @@ -44,7 +44,7 @@ #include "dix.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS 1 -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> #include <X11/extensions/XKBfile.h> @@ -925,127 +925,3 @@ XkbGeometryPtr geom; fprintf(file,"};\n\n"); return True; } - -/*ARGSUSED*/ -Bool -XkbWriteXKBSemantics( FILE * file, - XkbFileInfo * result, - Bool topLevel, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok; - - fprintf(file,"xkb_semantics {\n"); - ok= XkbWriteXKBKeyTypes(file,result,False,False,addOn,priv); - ok= ok&&XkbWriteXKBCompatMap(file,result,False,False,addOn,priv); - fprintf(file,"};\n"); - return ok; -} - -/*ARGSUSED*/ -Bool -XkbWriteXKBLayout( FILE * file, - XkbFileInfo * result, - Bool topLevel, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok; -XkbDescPtr xkb; - - xkb= result->xkb; - fprintf(file,"xkb_layout {\n"); - ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv); - if (xkb->geom) - ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv); - fprintf(file,"};\n"); - return ok; -} - -/*ARGSUSED*/ -Bool -XkbWriteXKBKeymap( FILE * file, - XkbFileInfo * result, - Bool topLevel, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok; -XkbDescPtr xkb; - - xkb= result->xkb; - fprintf(file,"xkb_keymap {\n"); - ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBCompatMap(file,result,False,showImplicit,addOn,priv); - ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv); - if (xkb->geom) - ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv); - fprintf(file,"};\n"); - return ok; -} - -Bool -XkbWriteXKBFile( FILE * out, - XkbFileInfo * result, - Bool showImplicit, - XkbFileAddOnFunc addOn, - void * priv) -{ -Bool ok = False; -Bool (*func)( - FILE * /* file */, - XkbFileInfo * /* result */, - Bool /* topLevel */, - Bool /* showImplicit */, - XkbFileAddOnFunc /* addOn */, - void * /* priv */ -) = NULL; - - switch (result->type) { - case XkmSemanticsFile: - func= XkbWriteXKBSemantics; - break; - case XkmLayoutFile: - func= XkbWriteXKBLayout; - break; - case XkmKeymapFile: - func= XkbWriteXKBKeymap; - break; - case XkmTypesIndex: - func= XkbWriteXKBKeyTypes; - break; - case XkmCompatMapIndex: - func= XkbWriteXKBCompatMap; - break; - case XkmSymbolsIndex: - func= XkbWriteXKBSymbols; - break; - case XkmKeyNamesIndex: - func= XkbWriteXKBKeycodes; - break; - case XkmGeometryFile: - case XkmGeometryIndex: - func= XkbWriteXKBGeometry; - break; - case XkmVirtualModsIndex: - case XkmIndicatorsIndex: - _XkbLibError(_XkbErrBadImplementation, - XkbConfigText(result->type,XkbMessage),0); - return False; - } - if (out==NULL) { - _XkbLibError(_XkbErrFileCannotOpen,"XkbWriteXkbFile",0); - ok= False; - } - else if (func) { - ok= (*func)(out,result,True,showImplicit,addOn,priv); - } - return ok; -} diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c index defd45a64..3a5037150 100644 --- a/xkb/xkbtext.c +++ b/xkb/xkbtext.c @@ -44,7 +44,7 @@ #include "dix.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS 1 -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> /***====================================================================***/ @@ -448,100 +448,6 @@ char * buf; return buf; } -char * -XkbAccessXDetailText(unsigned state,unsigned format) -{ -char *buf,*prefix; - - buf= tbGetBuffer(32); - if (format==XkbMessage) prefix= ""; - else prefix= "XkbAXN_"; - switch (state){ - case XkbAXN_SKPress: sprintf(buf,"%sSKPress",prefix); break; - case XkbAXN_SKAccept: sprintf(buf,"%sSKAccept",prefix); break; - case XkbAXN_SKRelease: sprintf(buf,"%sSKRelease",prefix); break; - case XkbAXN_SKReject: sprintf(buf,"%sSKReject",prefix); break; - case XkbAXN_BKAccept: sprintf(buf,"%sBKAccept",prefix); break; - case XkbAXN_BKReject: sprintf(buf,"%sBKReject",prefix); break; - case XkbAXN_AXKWarning: sprintf(buf,"%sAXKWarning",prefix); break; - default: sprintf(buf,"ILLEGAL"); break; - } - return buf; -} - -static char *nknNames[] = { - "keycodes", "geometry", "deviceID" -}; -#define NUM_NKN (sizeof(nknNames)/sizeof(char *)) - -char * -XkbNKNDetailMaskText(unsigned detail,unsigned format) -{ -char *buf,*prefix,*suffix; -register int i; -register unsigned bit; -int len,plen,slen; - - - if ((detail&XkbAllNewKeyboardEventsMask)==0) { - char *tmp = ""; - if (format==XkbCFile) tmp= "0"; - else if (format==XkbMessage) tmp= "none"; - buf= tbGetBuffer(strlen(tmp)+1); - strcpy(buf,tmp); - return buf; - } - else if ((detail&XkbAllNewKeyboardEventsMask)==XkbAllNewKeyboardEventsMask){ - char * tmp; - if (format==XkbCFile) tmp= "XkbAllNewKeyboardEventsMask"; - else tmp= "all"; - buf= tbGetBuffer(strlen(tmp)+1); - strcpy(buf,tmp); - return buf; - } - if (format==XkbMessage) { - prefix= ""; - suffix= ""; - slen= plen= 0; - } - else { - prefix= "XkbNKN_"; - plen= 7; - if (format==XkbCFile) - suffix= "Mask"; - else suffix= ""; - slen= strlen(suffix); - } - for (len=0,i=0,bit=1;i<NUM_NKN;i++,bit<<=1) { - if (detail&bit) { - if (len!=0) len+= 1; /* room for '+' or '|' */ - len+= plen+slen+strlen(nknNames[i]); - } - } - buf= tbGetBuffer(len+1); - buf[0]= '\0'; - for (len=0,i=0,bit=1;i<NUM_NKN;i++,bit<<=1) { - if (detail&bit) { - if (len!=0) { - if (format==XkbCFile) buf[len++]= '|'; - else buf[len++]= '+'; - } - if (plen) { - strcpy(&buf[len],prefix); - len+= plen; - } - strcpy(&buf[len],nknNames[i]); - len+= strlen(nknNames[i]); - if (slen) { - strcpy(&buf[len],suffix); - len+= slen; - } - } - } - buf[len++]= '\0'; - return buf; -} - static char *ctrlNames[] = { "repeatKeys", "slowKeys", diff --git a/xkb/xkmread.c b/xkb/xkmread.c index fec86874f..c6c18422d 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -41,7 +41,7 @@ #include "inputstr.h" #include <X11/extensions/XKBstr.h> #define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> +#include <xkbsrv.h> #include <X11/extensions/XKBgeom.h> Atom @@ -1098,18 +1098,6 @@ unsigned i,size_toc; return 1; } -xkmSectionInfo * -XkmFindTOCEntry(xkmFileInfo *finfo,xkmSectionInfo *toc,unsigned type) -{ -register int i; - - for (i=0;i<finfo->num_toc;i++) { - if (toc[i].type==type) - return &toc[i]; - } - return NULL; -} - Bool XkmReadFileSection( FILE * file, xkmSectionInfo * toc, |