Commit a5c7b248 authored by Mike Gabriel's avatar Mike Gabriel

hw/nxagent/NXdixfonts.c: Shrink file, drop duplicate code that can identically…

hw/nxagent/NXdixfonts.c: Shrink file, drop duplicate code that can identically be found in dix/dixfonts.c. Also remove NX'ish code from dix/dixfonts.c.
parent 2ba50086
...@@ -16,6 +16,7 @@ FFS_OBJ = ffs.o ...@@ -16,6 +16,7 @@ FFS_OBJ = ffs.o
#if (!(defined(NXAgentServer) && NXAgentServer)) #if (!(defined(NXAgentServer) && NXAgentServer))
NXAGENT_SKIP_SRCS = \ NXAGENT_SKIP_SRCS = \
dispatch.c \ dispatch.c \
dixfonts.c \
events.c \ events.c \
extension.c \ extension.c \
glyphcurs.c \ glyphcurs.c \
...@@ -25,6 +26,7 @@ NXAGENT_SKIP_SRCS = \ ...@@ -25,6 +26,7 @@ NXAGENT_SKIP_SRCS = \
$(NULL) $(NULL)
NXAGENT_SKIP_OBJS = \ NXAGENT_SKIP_OBJS = \
dispatch.o \ dispatch.o \
dixfonts.o \
events.o \ events.o \
extension.o \ extension.o \
glyphcurs.o \ glyphcurs.o \
...@@ -50,7 +52,6 @@ SRCS = \ ...@@ -50,7 +52,6 @@ SRCS = \
swapreq.c \ swapreq.c \
tables.c \ tables.c \
initatoms.c \ initatoms.c \
dixfonts.c \
privates.c \ privates.c \
pixmap.c \ pixmap.c \
$(NXAGENT_SKIP_SRCS) \ $(NXAGENT_SKIP_SRCS) \
...@@ -72,7 +73,6 @@ OBJS = \ ...@@ -72,7 +73,6 @@ OBJS = \
swapreq.o \ swapreq.o \
tables.o \ tables.o \
initatoms.o \ initatoms.o \
dixfonts.o \
privates.o \ privates.o \
pixmap.o \ pixmap.o \
$(NXAGENT_SKIP_OBJS) \ $(NXAGENT_SKIP_OBJS) \
......
...@@ -72,63 +72,6 @@ Equipment Corporation. ...@@ -72,63 +72,6 @@ Equipment Corporation.
#include <stdio.h> #include <stdio.h>
#endif #endif
#ifdef NX_TRANS_SOCKET
char _NXFontPath[1024];
/*
* Override the default font path and make
* it configurable at run time, based on
* the NX_FONT environment.
*/
static const char *_NXGetFontPath(const char *path)
{
const char *fontEnv;
/*
* Check the environment only once.
*/
if (*_NXFontPath != '\0')
{
return _NXFontPath;
}
fontEnv = getenv("NX_FONT");
if (fontEnv != NULL && *fontEnv != '\0')
{
if (strlen(fontEnv) + 1 > 1024)
{
#ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n");
#endif
goto _NXGetFontPathError;
}
strcpy(_NXFontPath, fontEnv);
#ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath);
#endif
return _NXFontPath;
}
_NXGetFontPathError:
strcpy(_NXFontPath, path);
#ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath);
#endif
return _NXFontPath;
}
#endif
#ifdef PANORAMIX #ifdef PANORAMIX
#include "panoramiX.h" #include "panoramiX.h"
#endif #endif
...@@ -288,6 +231,7 @@ FreeFPE (FontPathElementPtr fpe) ...@@ -288,6 +231,7 @@ FreeFPE (FontPathElementPtr fpe)
} }
} }
#ifndef NXAGENT_SERVER
static Bool static Bool
doOpenFont(ClientPtr client, OFclosurePtr c) doOpenFont(ClientPtr client, OFclosurePtr c)
{ {
...@@ -438,6 +382,7 @@ bail: ...@@ -438,6 +382,7 @@ bail:
xfree(c); xfree(c);
return TRUE; return TRUE;
} }
#endif /* NXAGENT_SERVER */
int int
OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontname) OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontname)
...@@ -634,6 +579,7 @@ QueryFont(FontPtr pFont, xQueryFontReply *pReply, int nProtoCCIStructs) ...@@ -634,6 +579,7 @@ QueryFont(FontPtr pFont, xQueryFontReply *pReply, int nProtoCCIStructs)
return; return;
} }
#ifndef NXAGENT_SERVER
static Bool static Bool
doListFontsAndAliases(ClientPtr client, LFclosurePtr c) doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
{ {
...@@ -1163,6 +1109,7 @@ bail: ...@@ -1163,6 +1109,7 @@ bail:
xfree(c); xfree(c);
return TRUE; return TRUE;
} }
#endif /* NXAGENT_SERVER */
int int
StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern, StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
...@@ -1401,6 +1348,13 @@ doPolyText(ClientPtr client, register PTclosurePtr c) ...@@ -1401,6 +1348,13 @@ doPolyText(ClientPtr client, register PTclosurePtr c)
err = BadAlloc; err = BadAlloc;
goto bail; goto bail;
} }
#ifdef NXAGENT_SERVER
pGC->tileIsPixel = TRUE;
pGC->tile.pixel = 0;
pGC->stipple = NullPixmap;
#endif
if ((err = CopyGC(c->pGC, pGC, GCFunction | if ((err = CopyGC(c->pGC, pGC, GCFunction |
GCPlaneMask | GCForeground | GCPlaneMask | GCForeground |
GCBackground | GCFillStyle | GCBackground | GCFillStyle |
...@@ -1593,6 +1547,13 @@ doImageText(ClientPtr client, register ITclosurePtr c) ...@@ -1593,6 +1547,13 @@ doImageText(ClientPtr client, register ITclosurePtr c)
err = BadAlloc; err = BadAlloc;
goto bail; goto bail;
} }
#ifdef NXAGENT_SERVER
pGC->tileIsPixel = TRUE;
pGC->tile.pixel = 0;
pGC->stipple = NullPixmap;
#endif
if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask | if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask |
GCForeground | GCBackground | GCFillStyle | GCForeground | GCBackground | GCFillStyle |
GCTile | GCStipple | GCTileStipXOrigin | GCTile | GCStipple | GCTileStipXOrigin |
...@@ -1733,7 +1694,6 @@ find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int le ...@@ -1733,7 +1694,6 @@ find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int le
return (FontPathElementPtr) 0; return (FontPathElementPtr) 0;
} }
static int static int
SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
{ {
...@@ -1810,11 +1770,13 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) ...@@ -1810,11 +1770,13 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
err = (*fpe_functions[fpe->type].init_fpe) (fpe); err = (*fpe_functions[fpe->type].init_fpe) (fpe);
if (err != Successful) if (err != Successful)
{ {
#ifndef NXAGENT_SERVER
if (persist) if (persist)
{ {
ErrorF("Could not init font path element %s, removing from list!\n", ErrorF("Could not init font path element %s, removing from list!\n",
fpe->name); fpe->name);
} }
#endif /* NXAGENT_SERVER */
xfree (fpe->name); xfree (fpe->name);
xfree (fpe); xfree (fpe);
} }
...@@ -1862,6 +1824,7 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error) ...@@ -1862,6 +1824,7 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
return err; return err;
} }
#ifndef NXAGENT_SERVER
int int
SetDefaultFontPath(char *path) SetDefaultFontPath(char *path)
{ {
...@@ -1876,19 +1839,11 @@ SetDefaultFontPath(char *path) ...@@ -1876,19 +1839,11 @@ SetDefaultFontPath(char *path)
bad; bad;
/* get enough for string, plus values -- use up commas */ /* get enough for string, plus values -- use up commas */
#ifdef NX_TRANS_SOCKET
len = strlen(_NXGetFontPath(path)) + 1;
#else
len = strlen(path) + 1; len = strlen(path) + 1;
#endif
nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len); nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len);
if (!newpath) if (!newpath)
return BadAlloc; return BadAlloc;
#ifdef NX_TRANS_SOCKET
pp = (unsigned char *) _NXGetFontPath(path);
#else
pp = (unsigned char *) path; pp = (unsigned char *) path;
#endif
cp++; cp++;
while (*pp) { while (*pp) {
if (*pp == ',') { if (*pp == ',') {
...@@ -1910,6 +1865,7 @@ SetDefaultFontPath(char *path) ...@@ -1910,6 +1865,7 @@ SetDefaultFontPath(char *path)
return err; return err;
} }
#endif /* NXAGENT_SERVER */
unsigned char * unsigned char *
GetFontPath(int *count, int *length) GetFontPath(int *count, int *length)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment