aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin')
-rw-r--r--xorg-server/hw/xwin/InitOutput.c23
-rw-r--r--xorg-server/hw/xwin/Makefile.am1
-rw-r--r--xorg-server/hw/xwin/glx/gen_gl_wrappers.py10
-rw-r--r--xorg-server/hw/xwin/glx/glwrap.c2
-rw-r--r--xorg-server/hw/xwin/glx/indirect.c12
-rw-r--r--xorg-server/hw/xwin/makefile1
-rw-r--r--xorg-server/hw/xwin/win.h18
-rw-r--r--xorg-server/hw/xwin/winallpriv.c2
-rw-r--r--xorg-server/hw/xwin/winclipboard.h2
-rw-r--r--xorg-server/hw/xwin/winclipboardtextconv.c10
-rw-r--r--xorg-server/hw/xwin/winclipboardthread.c1
-rw-r--r--xorg-server/hw/xwin/winclipboardwrappers.c7
-rw-r--r--xorg-server/hw/xwin/winconfig.c11
-rw-r--r--xorg-server/hw/xwin/wincursor.c3
-rw-r--r--xorg-server/hw/xwin/winerror.c4
-rw-r--r--xorg-server/hw/xwin/wingc.c5
-rw-r--r--xorg-server/hw/xwin/winlayouts.h10
-rw-r--r--xorg-server/hw/xwin/winmonitors.c5
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwm.c8
-rw-r--r--xorg-server/hw/xwin/winprefs.c21
-rw-r--r--xorg-server/hw/xwin/winprefslex.l7
-rw-r--r--xorg-server/hw/xwin/winprefsyacc.y921
-rw-r--r--xorg-server/hw/xwin/winprocarg.c4
-rw-r--r--xorg-server/hw/xwin/winregistry.c65
-rw-r--r--xorg-server/hw/xwin/winscrinit.c6
-rw-r--r--xorg-server/hw/xwin/winvalargs.c2
-rw-r--r--xorg-server/hw/xwin/winwindow.c6
-rw-r--r--xorg-server/hw/xwin/winwindowswm.c5
28 files changed, 524 insertions, 648 deletions
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index 53388a093..eb6165e38 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -76,11 +76,6 @@ static void
winClipboardShutdown(void);
#endif
-#if defined(DDXOSVERRORF)
-void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
-#endif
-
static Bool
winCheckDisplayNumber(void);
@@ -295,11 +290,11 @@ winCheckMount(void)
}
while ((ent = getmntent(mnt)) != NULL) {
- BOOL system = (winCheckMntOpt(ent, "user") != NULL);
+ BOOL sys = (winCheckMntOpt(ent, "user") != NULL);
BOOL root = (strcmp(ent->mnt_dir, "/") == 0);
BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0);
- if (system) {
+ if (sys) {
if (root)
curlevel = sys_root;
else if (tmp)
@@ -924,7 +919,7 @@ ddxUseMsg(void)
*/
void
-InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
+InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
{
int i;
@@ -959,15 +954,15 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[])
LoadPreferences();
/* Setup global screen info parameters */
- screenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
- screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
- screenInfo->numPixmapFormats = NUMFORMATS;
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+ pScreenInfo->numPixmapFormats = NUMFORMATS;
/* Describe how we want common pixmap formats padded */
for (i = 0; i < NUMFORMATS; i++) {
- screenInfo->formats[i] = g_PixmapFormats[i];
+ pScreenInfo->formats[i] = g_PixmapFormats[i];
}
/* Load pointers to DirectDraw functions */
diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am
index 003a9a272..eaf475fff 100644
--- a/xorg-server/hw/xwin/Makefile.am
+++ b/xorg-server/hw/xwin/Makefile.am
@@ -95,7 +95,6 @@ SRCS = InitInput.c \
winprefsyacc.y \
winprefslex.l \
winprocarg.c \
- winregistry.c \
winscrinit.c \
winshaddd.c \
winshadddnl.c \
diff --git a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
index d45e7aea9..6e92e9edb 100644
--- a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
+++ b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py
@@ -146,9 +146,8 @@ for line in glspec :
arglist_use = m1.group(2)
wrappers[function] = {}
- # near and far might be reserved words or macros so can't be used as formal parameter names
- arglist_use = arglist_use.replace('near','zNear')
- arglist_use = arglist_use.replace('far','zFar')
+ # ensure formal parameter names don't collide with reserved names or shadow global declarations
+ arglist_use = ',' .join([i.rstrip() + '_' for i in arglist_use.split(",")])
wrappers[function]['arglist_use'] = arglist_use
param_count = 0
@@ -217,9 +216,8 @@ for w in sorted(wrappers.keys()) :
if k.startswith('param') :
l = wrappers[w][k].split()
- # near and far might be reserved words or macros so can't be used as formal parameter names
- l[0] = l[0].replace('near','zNear')
- l[0] = l[0].replace('far','zFar')
+ # ensure formal parameter names don't collide with reserved names or shadow global declarations
+ l[0] = l[0] + '_'
if l[2] == 'in' :
if l[3] == 'array' :
diff --git a/xorg-server/hw/xwin/glx/glwrap.c b/xorg-server/hw/xwin/glx/glwrap.c
index 21a42aa9c..18d3521e0 100644
--- a/xorg-server/hw/xwin/glx/glwrap.c
+++ b/xorg-server/hw/xwin/glx/glwrap.c
@@ -70,7 +70,7 @@ glWinCallDelta(void)
#endif
static PROC
-glWinResolveHelper(PROC * cache, char *symbol)
+glWinResolveHelper(PROC * cache, const char *symbol)
{
PROC proc = NULL;
diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c
index 830d00e19..c1eb254f2 100644
--- a/xorg-server/hw/xwin/glx/indirect.c
+++ b/xorg-server/hw/xwin/glx/indirect.c
@@ -1809,15 +1809,15 @@ glxWinCreateContext(__GLXscreen * screen,
*/
static int
-GetShift(int Mask)
+GetShift(int mask)
{
- int Shift = 0;
+ int shift = 0;
- while ((Mask &1) == 0) {
- Shift++;
- Mask >>=1;
+ while ((mask &1) == 0) {
+ shift++;
+ mask >>=1;
}
- return Shift;
+ return shift;
}
static int
diff --git a/xorg-server/hw/xwin/makefile b/xorg-server/hw/xwin/makefile
index 8523d0f26..82585a025 100644
--- a/xorg-server/hw/xwin/makefile
+++ b/xorg-server/hw/xwin/makefile
@@ -104,7 +104,6 @@ SRCS = InitInput.c \
winprefsyacc.y \
winprefslex.l \
winprocarg.c \
- winregistry.c \
winscrinit.c \
winshaddd.c \
winshadddnl.c \
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index 37e8e3d43..9c474cba3 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -825,11 +825,13 @@ void
#ifdef DDXOSVERRORF
void
- OSVenderVErrorF(const char *pszFormat, va_list va_args);
+OsVendorVErrorF(const char *pszFormat, va_list va_args)
+_X_ATTRIBUTE_PRINTF(1, 0);
#endif
void
- winMessageBoxF(const char *pszError, UINT uType, ...);
+winMessageBoxF(const char *pszError, UINT uType, ...)
+_X_ATTRIBUTE_PRINTF(1, 3);
#ifdef XWIN_NATIVEGDI
/*
@@ -1020,18 +1022,6 @@ void
winPolyLineNativeGDI(DrawablePtr pDrawable,
GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
#endif
-
-#ifdef XWIN_NATIVEGDI
-/*
- * winpushpxl.c
- */
-
-void
-
-winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
- int dx, int dy, int xOrg, int yOrg);
-#endif
-
/*
* winscrinit.c
*/
diff --git a/xorg-server/hw/xwin/winallpriv.c b/xorg-server/hw/xwin/winallpriv.c
index a263d3a7f..248d03658 100644
--- a/xorg-server/hw/xwin/winallpriv.c
+++ b/xorg-server/hw/xwin/winallpriv.c
@@ -108,7 +108,7 @@ winAllocatePrivates(ScreenPtr pScreen)
*/
Bool
-winInitCmapPrivates(ColormapPtr pcmap, int index)
+winInitCmapPrivates(ColormapPtr pcmap, int i)
{
winDebug("winInitCmapPrivates\n");
diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h
index a267dec7c..7d5db98fe 100644
--- a/xorg-server/hw/xwin/winclipboard.h
+++ b/xorg-server/hw/xwin/winclipboard.h
@@ -98,7 +98,7 @@ void
winClipboardDOStoUNIX(char *pszData, int iLength);
void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+ winClipboardUNIXtoDOS(char **ppszData, int iLength);
/*
* winclipboardthread.c
diff --git a/xorg-server/hw/xwin/winclipboardtextconv.c b/xorg-server/hw/xwin/winclipboardtextconv.c
index 74a351b17..fd405a02e 100644
--- a/xorg-server/hw/xwin/winclipboardtextconv.c
+++ b/xorg-server/hw/xwin/winclipboardtextconv.c
@@ -38,7 +38,7 @@
void
winClipboardDOStoUNIX(char *pszSrc, int iLength);
void
- winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength);
+ winClipboardUNIXtoDOS(char **ppszData, int iLength);
/*
* Convert \r\n to \n
@@ -75,12 +75,12 @@ winClipboardDOStoUNIX(char *pszSrc, int iLength)
*/
void
-winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength)
+winClipboardUNIXtoDOS(char **ppszData, int iLength)
{
int iNewlineCount = 0;
- unsigned char *pszSrc = *ppszData;
- unsigned char *pszEnd = pszSrc + iLength;
- unsigned char *pszDest = NULL, *pszDestBegin = NULL;
+ char *pszSrc = *ppszData;
+ char *pszEnd = pszSrc + iLength;
+ char *pszDest = NULL, *pszDestBegin = NULL;
winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData);
diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c
index eb32db88c..c0069e329 100644
--- a/xorg-server/hw/xwin/winclipboardthread.c
+++ b/xorg-server/hw/xwin/winclipboardthread.c
@@ -51,7 +51,6 @@
*/
extern Bool g_fUnicodeClipboard;
-extern unsigned long serverGeneration;
extern Bool g_fClipboardStarted;
extern Bool g_fClipboardLaunched;
extern HWND g_hwndClipboard;
diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c
index 247c8ea43..09fbfd3aa 100644
--- a/xorg-server/hw/xwin/winclipboardwrappers.c
+++ b/xorg-server/hw/xwin/winclipboardwrappers.c
@@ -49,9 +49,6 @@
* Local function prototypes
*/
-int winProcEstablishConnection(ClientPtr /* client */ );
-int winProcSetSelectionOwner(ClientPtr /* client */ );
-
DISPATCH_PROC(winProcEstablishConnection);
DISPATCH_PROC(winProcSetSelectionOwner);
@@ -59,10 +56,8 @@ DISPATCH_PROC(winProcSetSelectionOwner);
* References to external symbols
*/
-extern int g_iNumScreens;
extern unsigned int g_uiAuthDataLen;
extern char *g_pAuthData;
-extern Bool g_fXdmcpEnabled;
extern Bool g_fClipboardLaunched;
extern Bool g_fClipboardStarted;
extern Bool g_fClipboard;
@@ -71,8 +66,6 @@ extern Atom g_atomLastOwnedSelection;
extern HWND g_hwndClipboard;
extern Bool g_fClipboardPrimary;
-extern winDispatchProcPtr winProcEstablishConnectionOrig;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
/*
* Wrapper for internal EstablishConnection function.
diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c
index 57825af72..5d36aa89f 100644
--- a/xorg-server/hw/xwin/winconfig.c
+++ b/xorg-server/hw/xwin/winconfig.c
@@ -81,7 +81,8 @@ WinCmdlineRec g_cmdline = {
0 /* emulate3Timeout */
};
-winInfoRec g_winInfo = {
+winInfoRec
+g_winInfo = {
{ /* keyboard */
0, /* leds */
500, /* delay */
@@ -335,10 +336,10 @@ winConfigKeyboard(DeviceIntPtr pDevice)
pLayout->xkbvariant ? pLayout->xkbvariant : "none",
pLayout->xkboptions ? pLayout->xkboptions : "none");
- g_winInfo.xkb.model = pLayout->xkbmodel;
- g_winInfo.xkb.layout = pLayout->xkblayout;
- g_winInfo.xkb.variant = pLayout->xkbvariant;
- g_winInfo.xkb.options = pLayout->xkboptions;
+ g_winInfo.xkb.model = (char *)pLayout->xkbmodel;
+ g_winInfo.xkb.layout = (char *)pLayout->xkblayout;
+ g_winInfo.xkb.variant = (char *)pLayout->xkbvariant;
+ g_winInfo.xkb.options = (char *)pLayout->xkboptions;
break;
}
diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c
index 8f4130207..77cf1c13f 100644
--- a/xorg-server/hw/xwin/wincursor.c
+++ b/xorg-server/hw/xwin/wincursor.c
@@ -157,7 +157,6 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
HBITMAP hAnd, hXor;
ICONINFO ii;
unsigned char *pCur;
- int x, y;
unsigned char bit;
HDC hDC;
BITMAPV4HEADER bi;
@@ -261,6 +260,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
sizeof(unsigned long));
if (lpBits) {
+ int y;
for (y = 0; y < nCY; y++) {
unsigned long *src, *dst;
@@ -304,6 +304,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen)
pCur = (unsigned char *) lpBits;
if (lpBits) {
+ int x, y;
for (y = 0; y < pScreenPriv->cursor.sm_cy; y++) {
for (x = 0; x < pScreenPriv->cursor.sm_cx; x++) {
if (x >= nCX || y >= nCY) /* Outside of X11 icon bounds */
diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c
index 9638bdcb1..ed9ee296e 100644
--- a/xorg-server/hw/xwin/winerror.c
+++ b/xorg-server/hw/xwin/winerror.c
@@ -37,10 +37,6 @@
extern Bool g_fSilentDupError;
#ifdef DDXOSVERRORF
-/* Prototype */
-void
- OsVendorVErrorF(const char *pszFormat, va_list va_args);
-
void
OsVendorVErrorF(const char *pszFormat, va_list va_args)
{
diff --git a/xorg-server/hw/xwin/wingc.c b/xorg-server/hw/xwin/wingc.c
index 0ad64676d..259d2e29d 100644
--- a/xorg-server/hw/xwin/wingc.c
+++ b/xorg-server/hw/xwin/wingc.c
@@ -33,11 +33,6 @@
#endif
#include "win.h"
-void
-
-winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx,
- int dy, int xOrg, int yOrg);
-
/*
* Local prototypes
*/
diff --git a/xorg-server/hw/xwin/winlayouts.h b/xorg-server/hw/xwin/winlayouts.h
index 82da2da63..0aae18b00 100644
--- a/xorg-server/hw/xwin/winlayouts.h
+++ b/xorg-server/hw/xwin/winlayouts.h
@@ -30,11 +30,11 @@
typedef struct {
unsigned int winlayout;
int winkbtype;
- char *xkbmodel;
- char *xkblayout;
- char *xkbvariant;
- char *xkboptions;
- char *layoutname;
+ const char *xkbmodel;
+ const char *xkblayout;
+ const char *xkbvariant;
+ const char *xkboptions;
+ const char *layoutname;
} WinKBLayoutRec, *WinKBLayoutPtr;
/*
diff --git a/xorg-server/hw/xwin/winmonitors.c b/xorg-server/hw/xwin/winmonitors.c
index ab8842a32..916b8b0bb 100644
--- a/xorg-server/hw/xwin/winmonitors.c
+++ b/xorg-server/hw/xwin/winmonitors.c
@@ -30,6 +30,7 @@ from The Open Group.
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
+
#include "win.h"
#define COMPILE_MULTIMON_STUBS
#include <multimon.h>
@@ -60,13 +61,13 @@ getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
}
Bool
-QueryMonitor(int index, struct GetMonitorInfoData *data)
+QueryMonitor(int i, struct GetMonitorInfoData *data)
{
/* prepare data */
if (data == NULL)
return FALSE;
memset(data, 0, sizeof(*data));
- data->requestedMonitor = index;
+ data->requestedMonitor = i;
/* query information */
return !EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
index 662664b8a..5d547dbdd 100644
--- a/xorg-server/hw/xwin/winmultiwindowwm.c
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -140,13 +140,6 @@ typedef struct _XMsgProcArgRec {
} XMsgProcArgRec, *XMsgProcArgPtr;
/*
- * References to external symbols
- */
-
-extern char *display;
-extern void ErrorF(const char * /*f */ , ...);
-
-/*
* Prototypes for local functions
*/
@@ -496,7 +489,6 @@ getHwnd(WMInfoPtr pWMInfo, Window iWindow)
static void
UpdateName(WMInfoPtr pWMInfo, Window iWindow)
{
- wchar_t *pszName;
HWND hWnd;
XWindowAttributes attr;
diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c
index c66e11396..5becf23a0 100644
--- a/xorg-server/hw/xwin/winprefs.c
+++ b/xorg-server/hw/xwin/winprefs.c
@@ -59,9 +59,6 @@ extern int parse_file(FILE * fp);
/* Currently in use command ID, incremented each new menu item created */
static int g_cmdid = STARTMENUID;
-/* Defined in DIX */
-extern char *display;
-
/* Local function to handle comma-ified icon names */
static HICON LoadImageComma(char *fname, int sx, int sy, int flags);
@@ -332,12 +329,12 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
case CMD_EXEC:
if (fork() == 0) {
struct rlimit rl;
- unsigned long i;
+ int fd;
/* Close any open descriptors except for STD* */
getrlimit(RLIMIT_NOFILE, &rl);
- for (i = STDERR_FILENO + 1; i < rl.rlim_cur; i++)
- close(i);
+ for (fd = STDERR_FILENO + 1; fd < rl.rlim_cur; fd++)
+ close(fd);
/* Disassociate any TTYs */
setsid();
@@ -540,21 +537,21 @@ static HICON
LoadImageComma(char *fname, int sx, int sy, int flags)
{
HICON hicon;
- int index;
+ int i;
char file[PATH_MAX + NAME_MAX + 2];
/* Some input error checking */
if (!fname || !fname[0])
return NULL;
- index = 0;
+ i = 0;
hicon = NULL;
if (fname[0] == ',') {
/* It's the XWIN.EXE resource they want */
- index = atoi(fname + 1);
+ i = atoi(fname + 1);
hicon = LoadImage(g_hInstance,
- MAKEINTRESOURCE(index), IMAGE_ICON, sx, sy, flags);
+ MAKEINTRESOURCE(i), IMAGE_ICON, sx, sy, flags);
}
else {
file[0] = 0;
@@ -571,8 +568,8 @@ LoadImageComma(char *fname, int sx, int sy, int flags)
/* Specified as <fname>,<index> */
*(strrchr(file, ',')) = 0; /* End string at comma */
- index = atoi(strrchr(fname, ',') + 1);
- hicon = ExtractIcon(g_hInstance, file, index);
+ i = atoi(strrchr(fname, ',') + 1);
+ hicon = ExtractIcon(g_hInstance, file, i);
}
else {
/* Just an .ico file... */
diff --git a/xorg-server/hw/xwin/winprefslex.l b/xorg-server/hw/xwin/winprefslex.l
index 83204b61c..66d12ede7 100644
--- a/xorg-server/hw/xwin/winprefslex.l
+++ b/xorg-server/hw/xwin/winprefslex.l
@@ -37,12 +37,8 @@
#include <string.h>
#include "winprefsyacc.h"
-extern YYSTYPE yylval;
-extern char *yytext;
extern int yyparse(void);
-int yylineno;
-
/* Copy the parsed string, must be free()d in yacc parser */
static char *makestr(char *str)
{
@@ -60,6 +56,9 @@ static char *makestr(char *str)
%}
%option yylineno
+%option nounput
+%option noinput
+%option never-interactive
%%
\#.*[\r\n] { /* comment */ return NEWLINE; }
diff --git a/xorg-server/hw/xwin/winprefsyacc.y b/xorg-server/hw/xwin/winprefsyacc.y
index b9e961622..ff051f233 100644
--- a/xorg-server/hw/xwin/winprefsyacc.y
+++ b/xorg-server/hw/xwin/winprefsyacc.y
@@ -1,460 +1,461 @@
-%{
-/*
- * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- * Copyright (C) Colin Harrison 2005-2008
- *
- * 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 XFREE86 PROJECT 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 XFree86 Project
- * 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 XFree86 Project.
- *
- * Authors: Earle F. Philhower, III
- * Colin Harrison
- */
-/* $XFree86: $ */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "winprefs.h"
-#include "winmsg.h"
-
-/* The following give better error messages in bison at the cost of a few KB */
-#define YYERROR_VERBOSE 1
-
-/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */
-#define YYLTYPE_IS_TRIVIAL 1
-#define YYENABLE_NLS 0
-
-/* The global pref settings */
-WINPREFS pref;
-
-/* The working menu */
-static MENUPARSED menu;
-
-/* Functions for parsing the tokens into out structure */
-/* Defined at the end section of this file */
-
-static void SetIconDirectory (char *path);
-static void SetDefaultIcon (char *fname);
-static void SetRootMenu (char *menu);
-static void SetDefaultSysMenu (char *menu, int pos);
-static void SetTrayIcon (char *fname);
-
-static void OpenMenu(char *menuname);
-static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
-static void CloseMenu(void);
-
-static void OpenIcons(void);
-static void AddIconLine(char *matchstr, char *iconfile);
-static void CloseIcons(void);
-
-static void OpenStyles(void);
-static void AddStyleLine(char *matchstr, unsigned long style);
-static void CloseStyles(void);
-
-static void OpenSysMenu(void);
-static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
-static void CloseSysMenu(void);
-
-static int yyerror (char *s);
-
-extern char *yytext;
-extern int yylex(void);
-
-#define YYMALLOC malloc
-#define YYFREE free
-
-%}
-
-%union {
- char *sVal;
- unsigned long uVal;
- int iVal;
-}
-
-%token NEWLINE
-%token MENU
-%token LB
-%token RB
-%token ICONDIRECTORY
-%token DEFAULTICON
-%token ICONS
-%token STYLES
-%token TOPMOST
-%token MAXIMIZE
-%token MINIMIZE
-%token BOTTOM
-%token NOTITLE
-%token OUTLINE
-%token NOFRAME
-%token DEFAULTSYSMENU
-%token SYSMENU
-%token ROOTMENU
-%token SEPARATOR
-%token ATSTART
-%token ATEND
-%token EXEC
-%token ALWAYSONTOP
-%token DEBUGOUTPUT "DEBUG"
-%token RELOAD
-%token TRAYICON
-%token FORCEEXIT
-%token SILENTEXIT
-
-%token <sVal> STRING
-%type <uVal> group1
-%type <uVal> group2
-%type <uVal> stylecombo
-%type <iVal> atspot
-
-%%
-
-input: /* empty */
- | input line
- ;
-
-line: NEWLINE
- | command
- ;
-
-
-newline_or_nada:
- | NEWLINE newline_or_nada
- ;
-
-command: defaulticon
- | icondirectory
- | menu
- | icons
- | styles
- | sysmenu
- | rootmenu
- | defaultsysmenu
- | debug
- | trayicon
- | forceexit
- | silentexit
- ;
-
-trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
- ;
-
-rootmenu: ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); }
- ;
-
-defaultsysmenu: DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); }
- ;
-
-defaulticon: DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); }
- ;
-
-icondirectory: ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); }
- ;
-
-menuline: SEPARATOR NEWLINE newline_or_nada { AddMenuLine("-", CMD_SEPARATOR, ""); }
- | STRING ALWAYSONTOP NEWLINE newline_or_nada { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); }
- | STRING EXEC STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); }
- | STRING MENU STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); }
- | STRING RELOAD NEWLINE newline_or_nada { AddMenuLine($1, CMD_RELOAD, ""); free($1); }
- ;
-
-menulist: menuline
- | menuline menulist
- ;
-
-menu: MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();}
- ;
-
-iconline: STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); }
- ;
-
-iconlist: iconline
- | iconline iconlist
- ;
-
-icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();}
- ;
-
-group1: TOPMOST { $$=STYLE_TOPMOST; }
- | MAXIMIZE { $$=STYLE_MAXIMIZE; }
- | MINIMIZE { $$=STYLE_MINIMIZE; }
- | BOTTOM { $$=STYLE_BOTTOM; }
- ;
-
-group2: NOTITLE { $$=STYLE_NOTITLE; }
- | OUTLINE { $$=STYLE_OUTLINE; }
- | NOFRAME { $$=STYLE_NOFRAME; }
- ;
-
-stylecombo: group1 { $$=$1; }
- | group2 { $$=$1; }
- | group1 group2 { $$=$1|$2; }
- | group2 group1 { $$=$1|$2; }
- ;
-
-styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); }
- ;
-
-stylelist: styleline
- | styleline stylelist
- ;
-
-styles: STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();}
- ;
-
-atspot: { $$=AT_END; }
- | ATSTART { $$=AT_START; }
- | ATEND { $$=AT_END; }
- ;
-
-sysmenuline: STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); }
- ;
-
-sysmenulist: sysmenuline
- | sysmenuline sysmenulist
- ;
-
-sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
- ;
-
-forceexit: FORCEEXIT NEWLINE { pref.fForceExit = TRUE; }
- ;
-
-silentexit: SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
- ;
-
-debug: DEBUGOUTPUT STRING NEWLINE { winDebug("LoadPreferences: %s\n", $2); free($2); }
- ;
-
-
-%%
-/*
- * Errors in parsing abort and print log messages
- */
-static int
-yyerror (char *s)
-{
- extern int yylineno; /* Handled by flex internally */
-
- ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
- return 1;
-}
-
-/* Miscellaneous functions to store TOKENs into the structure */
-static void
-SetIconDirectory (char *path)
-{
- strncpy (pref.iconDirectory, path, PATH_MAX);
- pref.iconDirectory[PATH_MAX] = 0;
-}
-
-static void
-SetDefaultIcon (char *fname)
-{
- strncpy (pref.defaultIconName, fname, NAME_MAX);
- pref.defaultIconName[NAME_MAX] = 0;
-}
-
-static void
-SetTrayIcon (char *fname)
-{
- strncpy (pref.trayIconName, fname, NAME_MAX);
- pref.trayIconName[NAME_MAX] = 0;
-}
-
-static void
-SetRootMenu (char *menu)
-{
- strncpy (pref.rootMenuName, menu, MENU_MAX);
- pref.rootMenuName[MENU_MAX] = 0;
-}
-
-static void
-SetDefaultSysMenu (char *menu, int pos)
-{
- strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
- pref.defaultSysMenuName[MENU_MAX] = 0;
- pref.defaultSysMenuPos = pos;
-}
-
-static void
-OpenMenu (char *menuname)
-{
- if (menu.menuItem) free(menu.menuItem);
- menu.menuItem = NULL;
- strncpy(menu.menuName, menuname, MENU_MAX);
- menu.menuName[MENU_MAX] = 0;
- menu.menuItems = 0;
-}
-
-static void
-AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
-{
- if (menu.menuItem==NULL)
- menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
- else
- menu.menuItem = (MENUITEM*)
- realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
-
- strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
- menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
-
- menu.menuItem[menu.menuItems].cmd = cmd;
-
- strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
- menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
-
- menu.menuItem[menu.menuItems].commandID = 0;
-
- menu.menuItems++;
-}
-
-static void
-CloseMenu (void)
-{
- if (menu.menuItem==NULL || menu.menuItems==0)
- {
- ErrorF("LoadPreferences: Empty menu detected\n");
- return;
- }
-
- if (pref.menuItems)
- pref.menu = (MENUPARSED*)
- realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
- else
- pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
-
- memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
- pref.menuItems++;
-
- memset (&menu, 0, sizeof(MENUPARSED));
-}
-
-static void
-OpenIcons (void)
-{
- if (pref.icon != NULL) {
- winDebug("LoadPreferences: Redefining icon mappings\n");
- free(pref.icon);
- pref.icon = NULL;
- }
- pref.iconItems = 0;
-}
-
-static void
-AddIconLine (char *matchstr, char *iconfile)
-{
- if (pref.icon==NULL)
- pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
- else
- pref.icon = (ICONITEM*)
- realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
-
- strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
- pref.icon[pref.iconItems].match[MENU_MAX] = 0;
-
- strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
- pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
-
- pref.icon[pref.iconItems].hicon = 0;
-
- pref.iconItems++;
-}
-
-static void
-CloseIcons (void)
-{
-}
-
-static void
-OpenStyles (void)
-{
- if (pref.style != NULL) {
- winDebug("LoadPreferences: Redefining window style\n");
- free(pref.style);
- pref.style = NULL;
- }
- pref.styleItems = 0;
-}
-
-static void
-AddStyleLine (char *matchstr, unsigned long style)
-{
- if (pref.style==NULL)
- pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM));
- else
- pref.style = (STYLEITEM*)
- realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1));
-
- strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX);
- pref.style[pref.styleItems].match[MENU_MAX] = 0;
-
- pref.style[pref.styleItems].type = style;
-
- pref.styleItems++;
-}
-
-static void
-CloseStyles (void)
-{
-}
-
-static void
-OpenSysMenu (void)
-{
- if (pref.sysMenu != NULL) {
- winDebug("LoadPreferences: Redefining system menu\n");
- free(pref.sysMenu);
- pref.sysMenu = NULL;
- }
- pref.sysMenuItems = 0;
-}
-
-static void
-AddSysMenuLine (char *matchstr, char *menuname, int pos)
-{
- if (pref.sysMenu==NULL)
- pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
- else
- pref.sysMenu = (SYSMENUITEM*)
- realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
-
- strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
- pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
-
- strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
- pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
-
- pref.sysMenu[pref.sysMenuItems].menuPos = pos;
-
- pref.sysMenuItems++;
-}
-
-static void
-CloseSysMenu (void)
-{
-}
-
+%{
+/*
+ * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ * Copyright (C) Colin Harrison 2005-2008
+ *
+ * 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 XFREE86 PROJECT 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 XFree86 Project
+ * 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 XFree86 Project.
+ *
+ * Authors: Earle F. Philhower, III
+ * Colin Harrison
+ */
+/* $XFree86: $ */
+
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */
+#include <string.h>
+#include "winprefs.h"
+#include "winmsg.h"
+
+/* The following give better error messages in bison at the cost of a few KB */
+#define YYERROR_VERBOSE 1
+
+/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */
+#define YYLTYPE_IS_TRIVIAL 1
+#define YYENABLE_NLS 0
+
+/* The global pref settings */
+WINPREFS pref;
+
+/* The working menu */
+static MENUPARSED menu;
+
+/* Functions for parsing the tokens into out structure */
+/* Defined at the end section of this file */
+
+static void SetIconDirectory (char *path);
+static void SetDefaultIcon (char *fname);
+static void SetRootMenu (char *menu);
+static void SetDefaultSysMenu (char *menu, int pos);
+static void SetTrayIcon (char *fname);
+
+static void OpenMenu(char *menuname);
+static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
+static void CloseMenu(void);
+
+static void OpenIcons(void);
+static void AddIconLine(char *matchstr, char *iconfile);
+static void CloseIcons(void);
+
+static void OpenStyles(void);
+static void AddStyleLine(char *matchstr, unsigned long style);
+static void CloseStyles(void);
+
+static void OpenSysMenu(void);
+static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
+static void CloseSysMenu(void);
+
+static int yyerror (char *s);
+
+extern char *yytext;
+extern int yylex(void);
+
+#define YYMALLOC malloc
+#define YYFREE free
+
+%}
+
+%union {
+ char *sVal;
+ unsigned long uVal;
+ int iVal;
+}
+
+%token NEWLINE
+%token MENU
+%token LB
+%token RB
+%token ICONDIRECTORY
+%token DEFAULTICON
+%token ICONS
+%token STYLES
+%token TOPMOST
+%token MAXIMIZE
+%token MINIMIZE
+%token BOTTOM
+%token NOTITLE
+%token OUTLINE
+%token NOFRAME
+%token DEFAULTSYSMENU
+%token SYSMENU
+%token ROOTMENU
+%token SEPARATOR
+%token ATSTART
+%token ATEND
+%token EXEC
+%token ALWAYSONTOP
+%token DEBUGOUTPUT "DEBUG"
+%token RELOAD
+%token TRAYICON
+%token FORCEEXIT
+%token SILENTEXIT
+
+%token <sVal> STRING
+%type <uVal> group1
+%type <uVal> group2
+%type <uVal> stylecombo
+%type <iVal> atspot
+
+%%
+
+input: /* empty */
+ | input line
+ ;
+
+line: NEWLINE
+ | command
+ ;
+
+
+newline_or_nada:
+ | NEWLINE newline_or_nada
+ ;
+
+command: defaulticon
+ | icondirectory
+ | menu
+ | icons
+ | styles
+ | sysmenu
+ | rootmenu
+ | defaultsysmenu
+ | debug
+ | trayicon
+ | forceexit
+ | silentexit
+ ;
+
+trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
+ ;
+
+rootmenu: ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); }
+ ;
+
+defaultsysmenu: DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); }
+ ;
+
+defaulticon: DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); }
+ ;
+
+icondirectory: ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); }
+ ;
+
+menuline: SEPARATOR NEWLINE newline_or_nada { AddMenuLine("-", CMD_SEPARATOR, ""); }
+ | STRING ALWAYSONTOP NEWLINE newline_or_nada { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); }
+ | STRING EXEC STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); }
+ | STRING MENU STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); }
+ | STRING RELOAD NEWLINE newline_or_nada { AddMenuLine($1, CMD_RELOAD, ""); free($1); }
+ ;
+
+menulist: menuline
+ | menuline menulist
+ ;
+
+menu: MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();}
+ ;
+
+iconline: STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); }
+ ;
+
+iconlist: iconline
+ | iconline iconlist
+ ;
+
+icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();}
+ ;
+
+group1: TOPMOST { $$=STYLE_TOPMOST; }
+ | MAXIMIZE { $$=STYLE_MAXIMIZE; }
+ | MINIMIZE { $$=STYLE_MINIMIZE; }
+ | BOTTOM { $$=STYLE_BOTTOM; }
+ ;
+
+group2: NOTITLE { $$=STYLE_NOTITLE; }
+ | OUTLINE { $$=STYLE_OUTLINE; }
+ | NOFRAME { $$=STYLE_NOFRAME; }
+ ;
+
+stylecombo: group1 { $$=$1; }
+ | group2 { $$=$1; }
+ | group1 group2 { $$=$1|$2; }
+ | group2 group1 { $$=$1|$2; }
+ ;
+
+styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); }
+ ;
+
+stylelist: styleline
+ | styleline stylelist
+ ;
+
+styles: STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();}
+ ;
+
+atspot: { $$=AT_END; }
+ | ATSTART { $$=AT_START; }
+ | ATEND { $$=AT_END; }
+ ;
+
+sysmenuline: STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); }
+ ;
+
+sysmenulist: sysmenuline
+ | sysmenuline sysmenulist
+ ;
+
+sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
+ ;
+
+forceexit: FORCEEXIT NEWLINE { pref.fForceExit = TRUE; }
+ ;
+
+silentexit: SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
+ ;
+
+debug: DEBUGOUTPUT STRING NEWLINE { winDebug("LoadPreferences: %s\n", $2); free($2); }
+ ;
+
+
+%%
+/*
+ * Errors in parsing abort and print log messages
+ */
+static int
+yyerror (char *s)
+{
+ extern int yylineno; /* Handled by flex internally */
+
+ ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
+ return 1;
+}
+
+/* Miscellaneous functions to store TOKENs into the structure */
+static void
+SetIconDirectory (char *path)
+{
+ strncpy (pref.iconDirectory, path, PATH_MAX);
+ pref.iconDirectory[PATH_MAX] = 0;
+}
+
+static void
+SetDefaultIcon (char *fname)
+{
+ strncpy (pref.defaultIconName, fname, NAME_MAX);
+ pref.defaultIconName[NAME_MAX] = 0;
+}
+
+static void
+SetTrayIcon (char *fname)
+{
+ strncpy (pref.trayIconName, fname, NAME_MAX);
+ pref.trayIconName[NAME_MAX] = 0;
+}
+
+static void
+SetRootMenu (char *menuname)
+{
+ strncpy (pref.rootMenuName, menuname, MENU_MAX);
+ pref.rootMenuName[MENU_MAX] = 0;
+}
+
+static void
+SetDefaultSysMenu (char *menuname, int pos)
+{
+ strncpy (pref.defaultSysMenuName, menuname, MENU_MAX);
+ pref.defaultSysMenuName[MENU_MAX] = 0;
+ pref.defaultSysMenuPos = pos;
+}
+
+static void
+OpenMenu (char *menuname)
+{
+ if (menu.menuItem) free(menu.menuItem);
+ menu.menuItem = NULL;
+ strncpy(menu.menuName, menuname, MENU_MAX);
+ menu.menuName[MENU_MAX] = 0;
+ menu.menuItems = 0;
+}
+
+static void
+AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
+{
+ if (menu.menuItem==NULL)
+ menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
+ else
+ menu.menuItem = (MENUITEM*)
+ realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
+
+ strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
+ menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
+
+ menu.menuItem[menu.menuItems].cmd = cmd;
+
+ strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
+ menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
+
+ menu.menuItem[menu.menuItems].commandID = 0;
+
+ menu.menuItems++;
+}
+
+static void
+CloseMenu (void)
+{
+ if (menu.menuItem==NULL || menu.menuItems==0)
+ {
+ ErrorF("LoadPreferences: Empty menu detected\n");
+ return;
+ }
+
+ if (pref.menuItems)
+ pref.menu = (MENUPARSED*)
+ realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
+ else
+ pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
+
+ memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
+ pref.menuItems++;
+
+ memset (&menu, 0, sizeof(MENUPARSED));
+}
+
+static void
+OpenIcons (void)
+{
+ if (pref.icon != NULL) {
+ winDebug("LoadPreferences: Redefining icon mappings\n");
+ free(pref.icon);
+ pref.icon = NULL;
+ }
+ pref.iconItems = 0;
+}
+
+static void
+AddIconLine (char *matchstr, char *iconfile)
+{
+ if (pref.icon==NULL)
+ pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
+ else
+ pref.icon = (ICONITEM*)
+ realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
+
+ strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
+ pref.icon[pref.iconItems].match[MENU_MAX] = 0;
+
+ strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
+ pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
+
+ pref.icon[pref.iconItems].hicon = 0;
+
+ pref.iconItems++;
+}
+
+static void
+CloseIcons (void)
+{
+}
+
+static void
+OpenStyles (void)
+{
+ if (pref.style != NULL) {
+ winDebug("LoadPreferences: Redefining window style\n");
+ free(pref.style);
+ pref.style = NULL;
+ }
+ pref.styleItems = 0;
+}
+
+static void
+AddStyleLine (char *matchstr, unsigned long style)
+{
+ if (pref.style==NULL)
+ pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM));
+ else
+ pref.style = (STYLEITEM*)
+ realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1));
+
+ strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX);
+ pref.style[pref.styleItems].match[MENU_MAX] = 0;
+
+ pref.style[pref.styleItems].type = style;
+
+ pref.styleItems++;
+}
+
+static void
+CloseStyles (void)
+{
+}
+
+static void
+OpenSysMenu (void)
+{
+ if (pref.sysMenu != NULL) {
+ winDebug("LoadPreferences: Redefining system menu\n");
+ free(pref.sysMenu);
+ pref.sysMenu = NULL;
+ }
+ pref.sysMenuItems = 0;
+}
+
+static void
+AddSysMenuLine (char *matchstr, char *menuname, int pos)
+{
+ if (pref.sysMenu==NULL)
+ pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
+ else
+ pref.sysMenu = (SYSMENUITEM*)
+ realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
+
+ strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
+ pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
+
+ strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
+ pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
+
+ pref.sysMenu[pref.sysMenuItems].menuPos = pos;
+
+ pref.sysMenuItems++;
+}
+
+static void
+CloseSysMenu (void)
+{
+}
+
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c
index f8c981a97..7ada2de73 100644
--- a/xorg-server/hw/xwin/winprocarg.c
+++ b/xorg-server/hw/xwin/winprocarg.c
@@ -57,10 +57,6 @@ void
void
winLogVersionInfo(void);
-#ifdef DDXOSVERRORF
-void OsVendorVErrorF(const char *pszFormat, va_list va_args);
-#endif
-
/*
* Process arguments on the command line
*/
diff --git a/xorg-server/hw/xwin/winregistry.c b/xorg-server/hw/xwin/winregistry.c
deleted file mode 100644
index 0535c879d..000000000
--- a/xorg-server/hw/xwin/winregistry.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *Copyright (C) 2002-2004 Harold L Hunt II 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, 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 HAROLD L HUNT II 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 Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
- *
- * Authors: Harold L Hunt II
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-
-/* Prototypes */
-DWORD winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey);
-
-DWORD
-winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey)
-{
- HKEY hkResult;
- DWORD dwDisposition;
-
- RegCreateKeyEx(hkey,
- pszRegistryKey,
- 0,
- '\0',
- REG_OPTION_NON_VOLATILE,
- KEY_READ, NULL, &hkResult, &dwDisposition);
-
- if (dwDisposition == REG_CREATED_NEW_KEY) {
- winDebug ("winGetRegistryDWORD - Created new key: %s\n", pszRegistryKey);
- }
- else if (dwDisposition == REG_OPENED_EXISTING_KEY) {
- winDebug ("winGetRegistryDWORD - Opened existing key: %s\n",
- pszRegistryKey);
- }
-
- /* Free the registry key handle */
- RegCloseKey(hkResult);
- hkResult = NULL;
-
- return 0;
-}
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
index bfc094fcf..c0426ac0b 100644
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -251,7 +251,7 @@ winCreateScreenResources(ScreenPtr pScreen)
/* See Porting Layer Definition - p. 20 */
Bool
-winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
+winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
@@ -565,11 +565,11 @@ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv)
/* See Porting Layer Definition - p. 20 */
Bool
-winFinishScreenInitNativeGDI(int index,
+winFinishScreenInitNativeGDI(int i,
ScreenPtr pScreen, int argc, char **argv)
{
winScreenPriv(pScreen);
- winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index];
+ winScreenInfoPtr pScreenInfo = &g_ScreenInfo[i];
VisualPtr pVisuals = NULL;
DepthPtr pDepths = NULL;
VisualID rootVisual = 0;
diff --git a/xorg-server/hw/xwin/winvalargs.c b/xorg-server/hw/xwin/winvalargs.c
index eb6e973b8..edfd71f72 100644
--- a/xorg-server/hw/xwin/winvalargs.c
+++ b/xorg-server/hw/xwin/winvalargs.c
@@ -57,9 +57,7 @@ Bool
winValidateArgs(void)
{
int i;
- int iMaxConsecutiveScreen = 0;
BOOL fHasNormalScreen0 = FALSE;
- BOOL fImplicitScreenFound = FALSE;
/*
* Check for a malformed set of -screen parameters.
diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c
index a847561f8..1a5bbae4e 100644
--- a/xorg-server/hw/xwin/winwindow.c
+++ b/xorg-server/hw/xwin/winwindow.c
@@ -59,7 +59,6 @@ winCreateWindowNativeGDI(WindowPtr pWin)
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
winDebug ("winCreateWindowNativeGDI (%p)\n", pWin);
@@ -80,7 +79,6 @@ winDestroyWindowNativeGDI(WindowPtr pWin)
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
winDebug ("winDestroyWindowNativeGDI (%p)\n", pWin);
@@ -101,7 +99,6 @@ winPositionWindowNativeGDI(WindowPtr pWin, int x, int y)
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
winDebug ("winPositionWindowNativeGDI (%p)\n", pWin);
@@ -190,7 +187,6 @@ winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask)
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
winDebug ("winChangeWindowAttributesNativeGDI (%p)\n", pWin);
@@ -216,7 +212,6 @@ winUnmapWindowNativeGDI(WindowPtr pWin)
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
winDebug ("winUnmapWindowNativeGDI (%p)\n", pWin);
@@ -238,7 +233,6 @@ winMapWindowNativeGDI(WindowPtr pWin)
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
winDebug ("winMapWindowNativeGDI (%p)\n", pWin);
diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c
index 19d5e95a9..92fa5e3ff 100644
--- a/xorg-server/hw/xwin/winwindowswm.c
+++ b/xorg-server/hw/xwin/winwindowswm.c
@@ -82,7 +82,6 @@ static int
ProcWindowsWMQueryVersion(ClientPtr client)
{
xWindowsWMQueryVersionReply rep;
- int n;
REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq);
rep.type = X_Reply;
@@ -467,7 +466,7 @@ ProcWindowsWMFrameSetTitle(ClientPtr client)
winDebug ("ProcWindowsWMFrameSetTitle - length is valid\n");
title_bytes = malloc(title_length + 1);
- strncpy(title_bytes, (unsigned char *) &stuff[1], title_length);
+ strncpy(title_bytes, (char *) &stuff[1], title_length);
title_bytes[title_length] = '\0';
pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);
@@ -536,8 +535,6 @@ SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to)
static int
SProcWindowsWMQueryVersion(ClientPtr client)
{
- int n;
-
REQUEST(xWindowsWMQueryVersionReq);
swaps(&stuff->length);
return ProcWindowsWMQueryVersion(client);