summaryrefslogtreecommitdiffstats
path: root/xlib
diff options
context:
space:
mode:
Diffstat (limited to 'xlib')
-rw-r--r--xlib/xcolors.c10
-rw-r--r--xlib/xgc.c42
-rw-r--r--xlib/xutil.c3
3 files changed, 43 insertions, 12 deletions
diff --git a/xlib/xcolors.c b/xlib/xcolors.c
index 0120579..90a9a9a 100644
--- a/xlib/xcolors.c
+++ b/xlib/xcolors.c
@@ -9,10 +9,10 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: xcolors.c,v 1.7 2007/01/02 23:39:40 dkf Exp $
+ * RCS: @(#) $Id: xcolors.c,v 1.9 2010/04/20 15:14:30 nijtmans Exp $
*/
-#include <tkInt.h>
+#include "tkInt.h"
/*
* This value will be set to the number of colors in the color table
@@ -34,11 +34,11 @@ static int FindColor(const char *name, XColor *colorPtr);
*/
typedef struct {
- char *name;
+ const char *name;
unsigned char red, green, blue;
} XColorEntry;
-static XColorEntry xColors[] = {
+static const XColorEntry xColors[] = {
{ "alice blue", 240, 248, 255 },
{ "AliceBlue", 240, 248, 255 },
{ "antique white", 250, 235, 215 },
@@ -825,7 +825,7 @@ FindColor(
*/
if (numXColors == 0) {
- XColorEntry *ePtr;
+ const XColorEntry *ePtr;
for (ePtr = xColors; ePtr->name != NULL; ePtr++) {
numXColors++;
}
diff --git a/xlib/xgc.c b/xlib/xgc.c
index 1fbcc48..a2a7087 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -5,25 +5,30 @@
* contexts.
*
* Copyright (c) 1995-1996 Sun Microsystems, Inc.
- * Copyright (c) 2002-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2002-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright 2008-2009, Apple Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: xgc.c,v 1.16 2007/12/13 15:29:45 dgp Exp $
+ * RCS: @(#) $Id: xgc.c,v 1.18 2010/04/20 15:14:30 nijtmans Exp $
*/
-#include <tkInt.h>
+#include "tkInt.h"
#if !defined(MAC_OSX_TK)
# include <X11/Xlib.h>
-#endif
-#ifdef MAC_OSX_TK
+# define gcCacheSize 0
+# define TkpInitGCCache(gc)
+# define TkpFreeGCCache(gc)
+# define TkpGetGCCache(gc)
+#else
# include <tkMacOSXInt.h>
# include <X11/Xlib.h>
# include <X11/X.h>
# define Cursor XCursor
# define Region XRegion
+# define gcCacheSize sizeof(TkpGCCache)
#endif
@@ -119,7 +124,8 @@ XCreateGC(
#define MAX_DASH_LIST_SIZE 10
- gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE);
+ gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE +
+ gcCacheSize);
if (!gp) {
return None;
}
@@ -160,10 +166,33 @@ XCreateGC(
clip_mask->type = TKP_CLIP_PIXMAP;
clip_mask->value.pixmap = values->clip_mask;
}
+ TkpInitGCCache(gp);
return gp;
}
+#ifdef MAC_OSX_TK
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetGCCache --
+ *
+ * Results:
+ * Pointer to the TkpGCCache at the end of the GC.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkpGCCache*
+TkpGetGCCache(GC gc) {
+ return (gc ? (TkpGCCache*)(((char*) gc) + sizeof(XGCValues) +
+ MAX_DASH_LIST_SIZE) : NULL);
+}
+#endif
+
/*
*----------------------------------------------------------------------
*
@@ -242,6 +271,7 @@ void XFreeGC(
{
if (gc != None) {
FreeClipMask(gc);
+ TkpFreeGCCache(gc);
ckfree((char *) gc);
}
}
diff --git a/xlib/xutil.c b/xlib/xutil.c
index 103d995..d5e26eb 100644
--- a/xlib/xutil.c
+++ b/xlib/xutil.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: xutil.c,v 1.4 2007/01/02 23:39:40 dkf Exp $
+ * RCS: @(#) $Id: xutil.c,v 1.5 2010/02/19 13:41:49 dkf Exp $
*/
#include <stdlib.h>
@@ -71,6 +71,7 @@ XGetVisualInfo(
int *nitems_return)
{
XVisualInfo *info = (XVisualInfo *) ckalloc(sizeof(XVisualInfo));
+
info->visual = DefaultVisual(display, 0);
info->visualid = info->visual->visualid;
info->screen = 0;