diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-16 15:55:24 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-16 15:55:24 (GMT) |
commit | a5ac44c7641b934c241a4918c784f1d4fe9d38b5 (patch) | |
tree | 2f8f23fe36c9df698f98f011fb891c5e3e58915b /xlib | |
parent | ca2badcc9092009cb15c20bba0fa98eff4dc14a5 (diff) | |
parent | 06aebb4c0d538d9d084f93e01cec12daedf27418 (diff) | |
download | tk-a5ac44c7641b934c241a4918c784f1d4fe9d38b5.zip tk-a5ac44c7641b934c241a4918c784f1d4fe9d38b5.tar.gz tk-a5ac44c7641b934c241a4918c784f1d4fe9d38b5.tar.bz2 |
Merge trunk
Diffstat (limited to 'xlib')
-rw-r--r-- | xlib/xgc.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -16,7 +16,6 @@ #if !defined(MAC_OSX_TK) # include <X11/Xlib.h> -# define gcCacheSize 0 # define TkpInitGCCache(gc) # define TkpFreeGCCache(gc) # define TkpGetGCCache(gc) @@ -24,10 +23,18 @@ # include <tkMacOSXInt.h> # include <X11/Xlib.h> # include <X11/X.h> -# define gcCacheSize sizeof(TkpGCCache) #endif +#define MAX_DASH_LIST_SIZE 10 +typedef struct { + XGCValues gc; + char dash[MAX_DASH_LIST_SIZE]; +#ifdef MAC_OSX_TK + TkpGCCache cache; +#endif +} XGCValuesWithCache; + /* *---------------------------------------------------------------------- * @@ -110,9 +117,7 @@ XCreateGC( * initialization. */ -#define MAX_DASH_LIST_SIZE 10 - - gp = (GC)ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize); + gp = (GC)ckalloc(sizeof(XGCValuesWithCache)); if (!gp) { return NULL; } @@ -175,8 +180,7 @@ XCreateGC( TkpGCCache* TkpGetGCCache(GC gc) { - return (gc ? (TkpGCCache*)(((char*) gc) + sizeof(XGCValues) + - MAX_DASH_LIST_SIZE) : NULL); + return (gc ? &((XGCValuesWithCache *)gc)->cache : NULL); } #endif |