Import Tk 8.6.11
This commit is contained in:
459
xlib/xgc.c
459
xlib/xgc.c
@@ -13,24 +13,20 @@
|
||||
*/
|
||||
|
||||
#include "tkInt.h"
|
||||
|
||||
#if !defined(MAC_OSX_TK)
|
||||
# include <X11/Xlib.h>
|
||||
# define gcCacheSize 0
|
||||
# define TkpInitGCCache(gc)
|
||||
# define TkpFreeGCCache(gc)
|
||||
# define TkpGetGCCache(gc)
|
||||
#else
|
||||
# include <tkMacOSXInt.h>
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#if defined(MAC_OSX_TK)
|
||||
# define Cursor XCursor
|
||||
# define Region XRegion
|
||||
# define gcCacheSize sizeof(TkpGCCache)
|
||||
#endif
|
||||
|
||||
#undef TkSetRegion
|
||||
|
||||
#define MAX_DASH_LIST_SIZE 10
|
||||
typedef struct {
|
||||
XGCValues gc;
|
||||
char dash[MAX_DASH_LIST_SIZE];
|
||||
} XGCValuesWithDash;
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -51,12 +47,8 @@ static TkpClipMask *AllocClipMask(GC gc) {
|
||||
TkpClipMask *clip_mask = (TkpClipMask*) gc->clip_mask;
|
||||
|
||||
if (clip_mask == NULL) {
|
||||
clip_mask = ckalloc(sizeof(TkpClipMask));
|
||||
clip_mask = (TkpClipMask *)ckalloc(sizeof(TkpClipMask));
|
||||
gc->clip_mask = (Pixmap) clip_mask;
|
||||
#ifdef MAC_OSX_TK
|
||||
} else if (clip_mask->type == TKP_CLIP_REGION) {
|
||||
TkpReleaseRegion(clip_mask->value.region);
|
||||
#endif
|
||||
}
|
||||
return clip_mask;
|
||||
}
|
||||
@@ -79,12 +71,7 @@ static TkpClipMask *AllocClipMask(GC gc) {
|
||||
|
||||
static void FreeClipMask(GC gc) {
|
||||
if (gc->clip_mask != None) {
|
||||
#ifdef MAC_OSX_TK
|
||||
if (((TkpClipMask*) gc->clip_mask)->type == TKP_CLIP_REGION) {
|
||||
TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region);
|
||||
}
|
||||
#endif
|
||||
ckfree(gc->clip_mask);
|
||||
ckfree((char *)gc->clip_mask);
|
||||
gc->clip_mask = None;
|
||||
}
|
||||
}
|
||||
@@ -113,6 +100,7 @@ XCreateGC(
|
||||
XGCValues *values)
|
||||
{
|
||||
GC gp;
|
||||
(void)d;
|
||||
|
||||
/*
|
||||
* In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars
|
||||
@@ -121,9 +109,7 @@ XCreateGC(
|
||||
* initialization.
|
||||
*/
|
||||
|
||||
#define MAX_DASH_LIST_SIZE 10
|
||||
|
||||
gp = ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize);
|
||||
gp = (GC)ckalloc(sizeof(XGCValuesWithDash));
|
||||
if (!gp) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -144,11 +130,11 @@ XCreateGC(
|
||||
InitField(fill_style, GCFillStyle, FillSolid);
|
||||
InitField(fill_rule, GCFillRule, WindingRule);
|
||||
InitField(arc_mode, GCArcMode, ArcPieSlice);
|
||||
InitField(tile, GCTile, None);
|
||||
InitField(stipple, GCStipple, None);
|
||||
InitField(tile, GCTile, 0);
|
||||
InitField(stipple, GCStipple, 0);
|
||||
InitField(ts_x_origin, GCTileStipXOrigin, 0);
|
||||
InitField(ts_y_origin, GCTileStipYOrigin, 0);
|
||||
InitField(font, GCFont, None);
|
||||
InitField(font, GCFont, 0);
|
||||
InitField(subwindow_mode, GCSubwindowMode, ClipByChildren);
|
||||
InitField(graphics_exposures, GCGraphicsExposures, True);
|
||||
InitField(clip_x_origin, GCClipXOrigin, 0);
|
||||
@@ -164,33 +150,9 @@ 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
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
@@ -268,9 +230,10 @@ int XFreeGC(
|
||||
Display *d,
|
||||
GC gc)
|
||||
{
|
||||
(void)d;
|
||||
|
||||
if (gc != NULL) {
|
||||
FreeClipMask(gc);
|
||||
TkpFreeGCCache(gc);
|
||||
ckfree(gc);
|
||||
}
|
||||
return Success;
|
||||
@@ -299,6 +262,8 @@ XSetForeground(
|
||||
GC gc,
|
||||
unsigned long foreground)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->foreground = foreground;
|
||||
return Success;
|
||||
}
|
||||
@@ -309,6 +274,8 @@ XSetBackground(
|
||||
GC gc,
|
||||
unsigned long background)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->background = background;
|
||||
return Success;
|
||||
}
|
||||
@@ -322,6 +289,7 @@ XSetDashes(
|
||||
int n)
|
||||
{
|
||||
char *p = &(gc->dashes);
|
||||
(void)display;
|
||||
|
||||
#ifdef TkWinDeleteBrush
|
||||
TkWinDeleteBrush(gc->fgBrush);
|
||||
@@ -344,6 +312,8 @@ XSetFunction(
|
||||
GC gc,
|
||||
int function)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->function = function;
|
||||
return Success;
|
||||
}
|
||||
@@ -354,6 +324,8 @@ XSetFillRule(
|
||||
GC gc,
|
||||
int fill_rule)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->fill_rule = fill_rule;
|
||||
return Success;
|
||||
}
|
||||
@@ -364,6 +336,8 @@ XSetFillStyle(
|
||||
GC gc,
|
||||
int fill_style)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->fill_style = fill_style;
|
||||
return Success;
|
||||
}
|
||||
@@ -374,6 +348,8 @@ XSetTSOrigin(
|
||||
GC gc,
|
||||
int x, int y)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->ts_x_origin = x;
|
||||
gc->ts_y_origin = y;
|
||||
return Success;
|
||||
@@ -385,6 +361,8 @@ XSetFont(
|
||||
GC gc,
|
||||
Font font)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->font = font;
|
||||
return Success;
|
||||
}
|
||||
@@ -395,6 +373,8 @@ XSetArcMode(
|
||||
GC gc,
|
||||
int arc_mode)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->arc_mode = arc_mode;
|
||||
return Success;
|
||||
}
|
||||
@@ -405,6 +385,8 @@ XSetStipple(
|
||||
GC gc,
|
||||
Pixmap stipple)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->stipple = stipple;
|
||||
return Success;
|
||||
}
|
||||
@@ -418,6 +400,8 @@ XSetLineAttributes(
|
||||
int cap_style,
|
||||
int join_style)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->line_width = line_width;
|
||||
gc->line_style = line_style;
|
||||
gc->cap_style = cap_style;
|
||||
@@ -432,6 +416,8 @@ XSetClipOrigin(
|
||||
int clip_x_origin,
|
||||
int clip_y_origin)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
gc->clip_x_origin = clip_x_origin;
|
||||
gc->clip_y_origin = clip_y_origin;
|
||||
return Success;
|
||||
@@ -464,6 +450,8 @@ TkSetRegion(
|
||||
GC gc,
|
||||
TkRegion r)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
if (r == NULL) {
|
||||
Tcl_Panic("must not pass NULL to TkSetRegion for compatibility with X11; use XSetClipMask instead");
|
||||
} else {
|
||||
@@ -471,9 +459,6 @@ TkSetRegion(
|
||||
|
||||
clip_mask->type = TKP_CLIP_REGION;
|
||||
clip_mask->value.region = r;
|
||||
#ifdef MAC_OSX_TK
|
||||
TkpRetainRegion(r);
|
||||
#endif
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
@@ -484,6 +469,8 @@ XSetClipMask(
|
||||
GC gc,
|
||||
Pixmap pixmap)
|
||||
{
|
||||
(void)display;
|
||||
|
||||
if (pixmap == None) {
|
||||
FreeClipMask(gc);
|
||||
} else {
|
||||
@@ -542,6 +529,7 @@ XDrawPoints(
|
||||
int mode)
|
||||
{
|
||||
int res = Success;
|
||||
(void)mode;
|
||||
|
||||
while (npoints-- > 0) {
|
||||
res = XDrawLine(display, d, gc,
|
||||
@@ -561,6 +549,12 @@ XDrawSegments(
|
||||
XSegment *segments,
|
||||
int nsegments)
|
||||
{
|
||||
(void)display;
|
||||
(void)d;
|
||||
(void)gc;
|
||||
(void)segments;
|
||||
(void)nsegments;
|
||||
|
||||
return BadDrawable;
|
||||
}
|
||||
#endif
|
||||
@@ -572,6 +566,10 @@ XFetchBuffer(
|
||||
int *nbytes_return,
|
||||
int buffer)
|
||||
{
|
||||
(void)display;
|
||||
(void)nbytes_return;
|
||||
(void)buffer;
|
||||
|
||||
return (char *) 0;
|
||||
}
|
||||
|
||||
@@ -581,7 +579,11 @@ XFetchName(
|
||||
Window w,
|
||||
char **window_name_return)
|
||||
{
|
||||
return (Status) 0;
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)window_name_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
Atom *
|
||||
@@ -590,32 +592,25 @@ XListProperties(
|
||||
Window w,
|
||||
int *num_prop_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)num_prop_return;
|
||||
|
||||
return (Atom *) 0;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
XMapRaised(
|
||||
Display *display,
|
||||
Window w)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
XPutImage(
|
||||
Display *display,
|
||||
Drawable d,
|
||||
GC gc,
|
||||
XImage *image,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
unsigned int width,
|
||||
unsigned int height)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
XQueryTextExtents(
|
||||
Display *display,
|
||||
XID font_ID,
|
||||
@@ -626,9 +621,19 @@ XQueryTextExtents(
|
||||
int *font_descent_return,
|
||||
XCharStruct *overall_return)
|
||||
{
|
||||
(void)display;
|
||||
(void)font_ID;
|
||||
(void)string;
|
||||
(void)nchars;
|
||||
(void)direction_return;
|
||||
(void)font_ascent_return;
|
||||
(void)font_descent_return;
|
||||
(void)overall_return;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
XReparentWindow(
|
||||
Display *display,
|
||||
Window w,
|
||||
@@ -636,29 +641,297 @@ XReparentWindow(
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
(void)parent;
|
||||
(void)x;
|
||||
(void)y;
|
||||
|
||||
return BadWindow;
|
||||
}
|
||||
|
||||
void
|
||||
XRotateBuffers(
|
||||
Display *display,
|
||||
int rotate)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
XStoreBuffer(
|
||||
Display *display,
|
||||
_Xconst char *bytes,
|
||||
int nbytes,
|
||||
int buffer)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
XUndefineCursor(
|
||||
Display *display,
|
||||
Window w)
|
||||
{
|
||||
(void)display;
|
||||
(void)w;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
XVaNestedList
|
||||
XVaCreateNestedList(
|
||||
int unused, ...)
|
||||
{
|
||||
(void)unused;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
XSetICValues(
|
||||
XIC xic, ...)
|
||||
{
|
||||
(void)xic;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
XGetICValues(
|
||||
XIC xic, ...)
|
||||
{
|
||||
(void)xic;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
XSetICFocus(
|
||||
XIC xic)
|
||||
{
|
||||
(void)xic;
|
||||
}
|
||||
|
||||
Window
|
||||
XCreateWindow(
|
||||
Display *display,
|
||||
Window parent,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int border_width,
|
||||
int depth,
|
||||
unsigned int clazz,
|
||||
Visual *visual,
|
||||
unsigned long value_mask,
|
||||
XSetWindowAttributes *attributes)
|
||||
{
|
||||
(void)display;
|
||||
(void)parent;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)width;
|
||||
(void)height;
|
||||
(void)border_width;
|
||||
(void)depth;
|
||||
(void)clazz;
|
||||
(void)visual;
|
||||
(void)value_mask;
|
||||
(void)attributes;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
XPointInRegion(
|
||||
Region rgn,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
(void)rgn;
|
||||
(void)x;
|
||||
(void)y;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
XUnionRegion(
|
||||
Region srca,
|
||||
Region srcb,
|
||||
Region dr_return)
|
||||
{
|
||||
(void)srca;
|
||||
(void)srcb;
|
||||
(void)dr_return;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Region
|
||||
XPolygonRegion(
|
||||
XPoint *pts,
|
||||
int n,
|
||||
int rule)
|
||||
{
|
||||
(void)pts;
|
||||
(void)n;
|
||||
(void)rule;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
XDestroyIC(
|
||||
XIC ic)
|
||||
{
|
||||
(void)ic;
|
||||
}
|
||||
|
||||
Cursor
|
||||
XCreatePixmapCursor(
|
||||
Display *display,
|
||||
Pixmap source,
|
||||
Pixmap mask,
|
||||
XColor *foreground_color,
|
||||
XColor *background_color,
|
||||
unsigned int x,
|
||||
unsigned int y)
|
||||
{
|
||||
(void)display;
|
||||
(void)source;
|
||||
(void)mask;
|
||||
(void)foreground_color;
|
||||
(void)background_color;
|
||||
(void)x;
|
||||
(void)y;
|
||||
|
||||
return (Cursor) NULL;
|
||||
}
|
||||
|
||||
Cursor
|
||||
XCreateGlyphCursor(
|
||||
Display *display,
|
||||
Font source_font,
|
||||
Font mask_font,
|
||||
unsigned int source_char,
|
||||
unsigned int mask_char,
|
||||
XColor _Xconst *foreground_color,
|
||||
XColor _Xconst *background_color)
|
||||
{
|
||||
(void)display;
|
||||
(void)source_font;
|
||||
(void)mask_font;
|
||||
(void)source_char;
|
||||
(void)mask_char;
|
||||
(void)foreground_color;
|
||||
(void)background_color;
|
||||
|
||||
return (Cursor) NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
XFontSet
|
||||
XCreateFontSet(
|
||||
Display *display /* display */,
|
||||
_Xconst char *base_font_name_list /* base_font_name_list */,
|
||||
char ***missing_charset_list /* missing_charset_list */,
|
||||
int *missing_charset_count /* missing_charset_count */,
|
||||
char **def_string /* def_string */
|
||||
) {
|
||||
(void)display;
|
||||
(void)base_font_name_list;
|
||||
(void)missing_charset_list;
|
||||
(void)missing_charset_count;
|
||||
(void)def_string;
|
||||
|
||||
return (XFontSet)0;
|
||||
}
|
||||
|
||||
void
|
||||
XFreeFontSet(
|
||||
Display *display, /* display */
|
||||
XFontSet fontset /* font_set */
|
||||
) {
|
||||
(void)display;
|
||||
(void)fontset;
|
||||
}
|
||||
|
||||
void
|
||||
XFreeStringList(
|
||||
char **list /* list */
|
||||
) {
|
||||
(void)list;
|
||||
}
|
||||
|
||||
Status
|
||||
XCloseIM(
|
||||
XIM im /* im */
|
||||
) {
|
||||
(void)im;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
Bool
|
||||
XRegisterIMInstantiateCallback(
|
||||
Display *dpy /* dpy */,
|
||||
struct _XrmHashBucketRec *rdb /* rdb */,
|
||||
char *res_name /* res_name */,
|
||||
char *res_class /* res_class */,
|
||||
XIDProc callback /* callback */,
|
||||
XPointer client_data /* client_data */
|
||||
) {
|
||||
(void)dpy;
|
||||
(void)rdb;
|
||||
(void)res_name;
|
||||
(void)res_class;
|
||||
(void)callback;
|
||||
(void)client_data;
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
Bool
|
||||
XUnregisterIMInstantiateCallback(
|
||||
Display *dpy /* dpy */,
|
||||
struct _XrmHashBucketRec *rdb /* rdb */,
|
||||
char *res_name /* res_name */,
|
||||
char *res_class /* res_class */,
|
||||
XIDProc callback /* callback */,
|
||||
XPointer client_data /* client_data */
|
||||
) {
|
||||
(void)dpy;
|
||||
(void)rdb;
|
||||
(void)res_name;
|
||||
(void)res_class;
|
||||
(void)callback;
|
||||
(void)client_data;
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
char *
|
||||
XSetLocaleModifiers(
|
||||
const char *modifier_list /* modifier_list */
|
||||
) {
|
||||
(void)modifier_list;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XIM XOpenIM(
|
||||
Display *dpy /* dpy */,
|
||||
struct _XrmHashBucketRec *rdb /* rdb */,
|
||||
char *res_name /* res_name */,
|
||||
char *res_class /* res_class */
|
||||
) {
|
||||
(void)dpy;
|
||||
(void)rdb;
|
||||
(void)res_name;
|
||||
(void)res_class;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
XGetIMValues(
|
||||
XIM im /* im */, ...
|
||||
) {
|
||||
(void)im;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
XSetIMValues(
|
||||
XIM im /* im */, ...
|
||||
) {
|
||||
(void)im;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user