summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2014-05-23 13:37:41 -0400
committerAdam Jackson <ajax@redhat.com>2015-07-08 16:40:57 -0400
commitb51f7f8582ab6c3cc9fa56c8d9721d0f240915e7 (patch)
treeffa87b9b61d1ad4959eb78961dc68fbf67075958 /dix
parentc4a0d6c9139d2c0107b80420cc2342614bbe95ef (diff)
dix: Unexport various implementation details
Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'dix')
-rw-r--r--dix/colormap.c337
-rw-r--r--dix/dispatch.c1
-rw-r--r--dix/dixfonts.c12
-rw-r--r--dix/enterleave.c2
-rw-r--r--dix/enterleave.h2
-rw-r--r--dix/main.c2
6 files changed, 180 insertions, 176 deletions
diff --git a/dix/colormap.c b/dix/colormap.c
index a3e5a2c09..89a17c43b 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -64,6 +64,9 @@ SOFTWARE.
#include "privates.h"
#include "xace.h"
+typedef int (*ColorCompareProcPtr) (EntryPtr /*pent */ ,
+ xrgb * /*prgb */ );
+
static Pixel FindBestPixel(EntryPtr /*pentFirst */ ,
int /*size */ ,
xrgb * /*prgb */ ,
@@ -748,6 +751,173 @@ UpdateColors(ColormapPtr pmap)
free(defs);
}
+/* Tries to find a color in pmap that exactly matches the one requested in prgb
+ * if it can't it allocates one.
+ * Starts looking at pentFirst + *pPixel, so if you want a specific pixel,
+ * load *pPixel with that value, otherwise set it to 0
+ */
+static int
+FindColor(ColormapPtr pmap, EntryPtr pentFirst, int size, xrgb * prgb,
+ Pixel * pPixel, int channel, int client, ColorCompareProcPtr comp)
+{
+ EntryPtr pent;
+ Bool foundFree;
+ Pixel pixel, Free = 0;
+ int npix, count, *nump = NULL;
+ Pixel **pixp = NULL, *ppix;
+ xColorItem def;
+
+ foundFree = FALSE;
+
+ if ((pixel = *pPixel) >= size)
+ pixel = 0;
+ /* see if there is a match, and also look for a free entry */
+ for (pent = pentFirst + pixel, count = size; --count >= 0;) {
+ if (pent->refcnt > 0) {
+ if ((*comp) (pent, prgb)) {
+ if (client >= 0)
+ pent->refcnt++;
+ *pPixel = pixel;
+ switch (channel) {
+ case REDMAP:
+ *pPixel <<= pmap->pVisual->offsetRed;
+ case PSEUDOMAP:
+ break;
+ case GREENMAP:
+ *pPixel <<= pmap->pVisual->offsetGreen;
+ break;
+ case BLUEMAP:
+ *pPixel <<= pmap->pVisual->offsetBlue;
+ break;
+ }
+ goto gotit;
+ }
+ }
+ else if (!foundFree && pent->refcnt == 0) {
+ Free = pixel;
+ foundFree = TRUE;
+ /* If we're initializing the colormap, then we are looking for
+ * the first free cell we can find, not to minimize the number
+ * of entries we use. So don't look any further. */
+ if (pmap->flags & BeingCreated)
+ break;
+ }
+ pixel++;
+ if (pixel >= size) {
+ pent = pentFirst;
+ pixel = 0;
+ }
+ else
+ pent++;
+ }
+
+ /* If we got here, we didn't find a match. If we also didn't find
+ * a free entry, we're out of luck. Otherwise, we'll usurp a free
+ * entry and fill it in */
+ if (!foundFree)
+ return BadAlloc;
+ pent = pentFirst + Free;
+ pent->fShared = FALSE;
+ pent->refcnt = (client >= 0) ? 1 : AllocTemporary;
+
+ switch (channel) {
+ case PSEUDOMAP:
+ pent->co.local.red = prgb->red;
+ pent->co.local.green = prgb->green;
+ pent->co.local.blue = prgb->blue;
+ def.red = prgb->red;
+ def.green = prgb->green;
+ def.blue = prgb->blue;
+ def.flags = (DoRed | DoGreen | DoBlue);
+ if (client >= 0)
+ pmap->freeRed--;
+ def.pixel = Free;
+ break;
+
+ case REDMAP:
+ pent->co.local.red = prgb->red;
+ def.red = prgb->red;
+ def.green = pmap->green[0].co.local.green;
+ def.blue = pmap->blue[0].co.local.blue;
+ def.flags = DoRed;
+ if (client >= 0)
+ pmap->freeRed--;
+ def.pixel = Free << pmap->pVisual->offsetRed;
+ break;
+
+ case GREENMAP:
+ pent->co.local.green = prgb->green;
+ def.red = pmap->red[0].co.local.red;
+ def.green = prgb->green;
+ def.blue = pmap->blue[0].co.local.blue;
+ def.flags = DoGreen;
+ if (client >= 0)
+ pmap->freeGreen--;
+ def.pixel = Free << pmap->pVisual->offsetGreen;
+ break;
+
+ case BLUEMAP:
+ pent->co.local.blue = prgb->blue;
+ def.red = pmap->red[0].co.local.red;
+ def.green = pmap->green[0].co.local.green;
+ def.blue = prgb->blue;
+ def.flags = DoBlue;
+ if (client >= 0)
+ pmap->freeBlue--;
+ def.pixel = Free << pmap->pVisual->offsetBlue;
+ break;
+ }
+ (*pmap->pScreen->StoreColors) (pmap, 1, &def);
+ pixel = Free;
+ *pPixel = def.pixel;
+
+ gotit:
+ if (pmap->flags & BeingCreated || client == -1)
+ return Success;
+ /* Now remember the pixel, for freeing later */
+ switch (channel) {
+ case PSEUDOMAP:
+ case REDMAP:
+ nump = pmap->numPixelsRed;
+ pixp = pmap->clientPixelsRed;
+ break;
+
+ case GREENMAP:
+ nump = pmap->numPixelsGreen;
+ pixp = pmap->clientPixelsGreen;
+ break;
+
+ case BLUEMAP:
+ nump = pmap->numPixelsBlue;
+ pixp = pmap->clientPixelsBlue;
+ break;
+ }
+ npix = nump[client];
+ ppix = reallocarray(pixp[client], npix + 1, sizeof(Pixel));
+ if (!ppix) {
+ pent->refcnt--;
+ if (!pent->fShared)
+ switch (channel) {
+ case PSEUDOMAP:
+ case REDMAP:
+ pmap->freeRed++;
+ break;
+ case GREENMAP:
+ pmap->freeGreen++;
+ break;
+ case BLUEMAP:
+ pmap->freeBlue++;
+ break;
+ }
+ return BadAlloc;
+ }
+ ppix[npix] = pixel;
+ pixp[client] = ppix;
+ nump[client]++;
+
+ return Success;
+}
+
/* Get a read-only color from a ColorMap (probably slow for large maps)
* Returns by changing the value in pred, pgreen, pblue and pPix
*/
@@ -1137,173 +1307,6 @@ FindColorInRootCmap(ColormapPtr pmap, EntryPtr pentFirst, int size,
}
}
-/* Tries to find a color in pmap that exactly matches the one requested in prgb
- * if it can't it allocates one.
- * Starts looking at pentFirst + *pPixel, so if you want a specific pixel,
- * load *pPixel with that value, otherwise set it to 0
- */
-int
-FindColor(ColormapPtr pmap, EntryPtr pentFirst, int size, xrgb * prgb,
- Pixel * pPixel, int channel, int client, ColorCompareProcPtr comp)
-{
- EntryPtr pent;
- Bool foundFree;
- Pixel pixel, Free = 0;
- int npix, count, *nump = NULL;
- Pixel **pixp = NULL, *ppix;
- xColorItem def;
-
- foundFree = FALSE;
-
- if ((pixel = *pPixel) >= size)
- pixel = 0;
- /* see if there is a match, and also look for a free entry */
- for (pent = pentFirst + pixel, count = size; --count >= 0;) {
- if (pent->refcnt > 0) {
- if ((*comp) (pent, prgb)) {
- if (client >= 0)
- pent->refcnt++;
- *pPixel = pixel;
- switch (channel) {
- case REDMAP:
- *pPixel <<= pmap->pVisual->offsetRed;
- case PSEUDOMAP:
- break;
- case GREENMAP:
- *pPixel <<= pmap->pVisual->offsetGreen;
- break;
- case BLUEMAP:
- *pPixel <<= pmap->pVisual->offsetBlue;
- break;
- }
- goto gotit;
- }
- }
- else if (!foundFree && pent->refcnt == 0) {
- Free = pixel;
- foundFree = TRUE;
- /* If we're initializing the colormap, then we are looking for
- * the first free cell we can find, not to minimize the number
- * of entries we use. So don't look any further. */
- if (pmap->flags & BeingCreated)
- break;
- }
- pixel++;
- if (pixel >= size) {
- pent = pentFirst;
- pixel = 0;
- }
- else
- pent++;
- }
-
- /* If we got here, we didn't find a match. If we also didn't find
- * a free entry, we're out of luck. Otherwise, we'll usurp a free
- * entry and fill it in */
- if (!foundFree)
- return BadAlloc;
- pent = pentFirst + Free;
- pent->fShared = FALSE;
- pent->refcnt = (client >= 0) ? 1 : AllocTemporary;
-
- switch (channel) {
- case PSEUDOMAP:
- pent->co.local.red = prgb->red;
- pent->co.local.green = prgb->green;
- pent->co.local.blue = prgb->blue;
- def.red = prgb->red;
- def.green = prgb->green;
- def.blue = prgb->blue;
- def.flags = (DoRed | DoGreen | DoBlue);
- if (client >= 0)
- pmap->freeRed--;
- def.pixel = Free;
- break;
-
- case REDMAP:
- pent->co.local.red = prgb->red;
- def.red = prgb->red;
- def.green = pmap->green[0].co.local.green;
- def.blue = pmap->blue[0].co.local.blue;
- def.flags = DoRed;
- if (client >= 0)
- pmap->freeRed--;
- def.pixel = Free << pmap->pVisual->offsetRed;
- break;
-
- case GREENMAP:
- pent->co.local.green = prgb->green;
- def.red = pmap->red[0].co.local.red;
- def.green = prgb->green;
- def.blue = pmap->blue[0].co.local.blue;
- def.flags = DoGreen;
- if (client >= 0)
- pmap->freeGreen--;
- def.pixel = Free << pmap->pVisual->offsetGreen;
- break;
-
- case BLUEMAP:
- pent->co.local.blue = prgb->blue;
- def.red = pmap->red[0].co.local.red;
- def.green = pmap->green[0].co.local.green;
- def.blue = prgb->blue;
- def.flags = DoBlue;
- if (client >= 0)
- pmap->freeBlue--;
- def.pixel = Free << pmap->pVisual->offsetBlue;
- break;
- }
- (*pmap->pScreen->StoreColors) (pmap, 1, &def);
- pixel = Free;
- *pPixel = def.pixel;
-
- gotit:
- if (pmap->flags & BeingCreated || client == -1)
- return Success;
- /* Now remember the pixel, for freeing later */
- switch (channel) {
- case PSEUDOMAP:
- case REDMAP:
- nump = pmap->numPixelsRed;
- pixp = pmap->clientPixelsRed;
- break;
-
- case GREENMAP:
- nump = pmap->numPixelsGreen;
- pixp = pmap->clientPixelsGreen;
- break;
-
- case BLUEMAP:
- nump = pmap->numPixelsBlue;
- pixp = pmap->clientPixelsBlue;
- break;
- }
- npix = nump[client];
- ppix = reallocarray(pixp[client], npix + 1, sizeof(Pixel));
- if (!ppix) {
- pent->refcnt--;
- if (!pent->fShared)
- switch (channel) {
- case PSEUDOMAP:
- case REDMAP:
- pmap->freeRed++;
- break;
- case GREENMAP:
- pmap->freeGreen++;
- break;
- case BLUEMAP:
- pmap->freeBlue++;
- break;
- }
- return BadAlloc;
- }
- ppix[npix] = pixel;
- pixp[client] = ppix;
- nump[client]++;
-
- return Success;
-}
-
/* Comparison functions -- passed to FindColor to determine if an
* entry is already the color we're looking for or not */
static int
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 9208582a6..dbbac8bd6 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -108,6 +108,7 @@ int ProcInitialConnection();
#include "windowstr.h"
#include <X11/fonts/fontstruct.h>
+#include <X11/fonts/fontutil.h>
#include "dixfontstr.h"
#include "gcstruct.h"
#include "selection.h"
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index be389e82f..968cee461 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -156,7 +156,7 @@ SetDefaultFont(const char *defaultfontname)
* init_fpe() and free_fpe(), there shouldn't be any problem in using
* freed data.
*/
-void
+static void
QueueFontWakeup(FontPathElementPtr fpe)
{
int i;
@@ -179,7 +179,7 @@ QueueFontWakeup(FontPathElementPtr fpe)
num_slept_fpes++;
}
-void
+static void
RemoveFontWakeup(FontPathElementPtr fpe)
{
int i, j;
@@ -195,7 +195,7 @@ RemoveFontWakeup(FontPathElementPtr fpe)
}
}
-void
+static void
FontWakeup(void *data, int count, void *LastSelectMask)
{
int i;
@@ -849,7 +849,7 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
return Success;
}
-int
+static int
doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
{
FontPathElementPtr fpe;
@@ -1105,7 +1105,7 @@ static ChangeGCVal clearGC[] = { {.ptr = NullPixmap} };
#define clearGCmask (GCClipMask)
-int
+static int
doPolyText(ClientPtr client, PTclosurePtr c)
{
FontPtr pFont = c->pGC->font, oldpFont;
@@ -1389,7 +1389,7 @@ PolyText(ClientPtr client, DrawablePtr pDraw, GC * pGC, unsigned char *pElt,
#undef TextEltHeader
#undef FontShiftSize
-int
+static int
doImageText(ClientPtr client, ITclosurePtr c)
{
int err = Success, lgerr; /* err is in X error, not font error, space */
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 7f1f94165..f0b1572fb 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -212,7 +212,7 @@ SetFocusOut(DeviceIntPtr dev)
* @return The window that is the first ancestor of both 'a' and 'b', or the
* NullWindow if they do not have a common ancestor.
*/
-WindowPtr
+static WindowPtr
CommonAncestor(WindowPtr a, WindowPtr b)
{
for (b = b->parent; b; b = b->parent)
diff --git a/dix/enterleave.h b/dix/enterleave.h
index a59d05799..4b833d8a3 100644
--- a/dix/enterleave.h
+++ b/dix/enterleave.h
@@ -41,8 +41,6 @@ extern void EnterLeaveEvent(DeviceIntPtr mouse,
int type,
int mode, int detail, WindowPtr pWin, Window child);
-extern WindowPtr CommonAncestor(WindowPtr a, WindowPtr b);
-
extern void CoreEnterLeaveEvent(DeviceIntPtr mouse,
int type,
int mode,
diff --git a/dix/main.c b/dix/main.c
index 09f9504b8..db3b9c0a9 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -95,6 +95,8 @@ Equipment Corporation.
#include "cursorstr.h"
#include "selection.h"
#include <X11/fonts/font.h>
+#include <X11/fonts/fontstruct.h>
+#include <X11/fonts/fontutil.h>
#include "opaque.h"
#include "servermd.h"
#include "hotplug.h"