summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-08 10:45:07 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-11-08 10:45:07 (GMT)
commitf2d49e3c2bd2d6ee9466d8cd814a5eef2a93408f (patch)
treec005142ab80bfc39314ee11c9cfe3c69e14bfb0f
parent6864f7029a8095dec62bdc53e31f4e3c30c31b0b (diff)
downloadtk-f2d49e3c2bd2d6ee9466d8cd814a5eef2a93408f.zip
tk-f2d49e3c2bd2d6ee9466d8cd814a5eef2a93408f.tar.gz
tk-f2d49e3c2bd2d6ee9466d8cd814a5eef2a93408f.tar.bz2
Add XDrawSegments/XDrawPoint/XDrawPoints to internal stub table, and fix their signature matching X11.
-rw-r--r--generic/tkFrame.c6
-rw-r--r--generic/tkInt.decls32
-rw-r--r--generic/tkIntXlibDecls.h99
-rw-r--r--generic/tkStubInit.c21
-rw-r--r--macosx/tkMacOSXDraw.c16
-rw-r--r--macosx/tkMacOSXWindowEvent.c22
-rw-r--r--macosx/tkMacOSXXStubs.c4
-rw-r--r--xlib/X11/Xutil.h4
-rw-r--r--xlib/xgc.c20
9 files changed, 172 insertions, 52 deletions
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index e38fe87..0c3c016 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -781,7 +781,7 @@ FrameWidgetObjCmd(
|| ((c == 'v')
&& (strncmp(arg, "-visual", (unsigned)length) == 0))) {
- #ifdef SUPPORT_CONFIG_EMBEDDED
+#ifdef SUPPORT_CONFIG_EMBEDDED
if (c == 'u') {
CONST char *string = Tcl_GetString(objv[i+1]);
if (TkpUseWindow(interp, framePtr->tkwin,
@@ -800,7 +800,7 @@ FrameWidgetObjCmd(
" option after widget is created", NULL);
result = TCL_ERROR;
goto done;
- #endif
+#endif
}
}
result = ConfigureFrame(interp, framePtr, objc-2, objv+2);
@@ -1939,7 +1939,7 @@ TkMapTopFrame (tkwin)
return;
}
/*
- * The option table has already been created so
+ * The option table has already been created so
* the cached pointer will be returned.
*/
optionTable = Tk_CreateOptionTable(framePtr->interp, optionSpecs[framePtr->type]);
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index f24d48c..c2d018c 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -1361,28 +1361,38 @@ declare 106 win {
# new for 8.4.20+/8.5.12+ Cygwin only
declare 107 win {
- int XFlush(Display *display)
+ int XFlush(Display *display)
}
declare 108 win {
- int XGrabServer(Display *display)
+ int XGrabServer(Display *display)
}
declare 109 win {
- int XUngrabServer(Display *display)
+ int XUngrabServer(Display *display)
}
declare 110 win {
- int XFree(void *data)
+ int XFree(void *data)
}
declare 111 win {
- int XNoOp(Display *display)
+ int XNoOp(Display *display)
}
declare 112 win {
- XAfterFunction XSynchronize(Display *display, Bool onoff)
+ XAfterFunction XSynchronize(Display *display, Bool onoff)
}
declare 113 win {
- int XSync(Display *display, Bool discard)
+ int XSync(Display *display, Bool discard)
}
declare 114 win {
- VisualID XVisualIDFromVisual(Visual *visual)
+ VisualID XVisualIDFromVisual(Visual *visual)
+}
+
+declare 133 win {
+ int XDrawSegments(Display *d, Drawable dr, GC gc, XSegment *s, int n)
+}
+declare 134 win {
+ int XDrawPoint(Display *d, Drawable dr, GC gc, int x, int y)
+}
+declare 135 win {
+ int XDrawPoints(Display *d, Drawable dr, GC gc, XPoint *p, int n, int m)
}
################################
@@ -1664,7 +1674,7 @@ declare 79 aqua {
XTextProperty *text_prop_return)
}
declare 80 aqua {
- void XDrawSegments(Display *display, Drawable d, GC gc,
+ int XDrawSegments(Display *display, Drawable d, GC gc,
XSegment *segments, int nsegments)
}
declare 81 aqua {
@@ -1682,10 +1692,10 @@ declare 84 aqua {
void XClearWindow(Display *d, Window w)
}
declare 85 aqua {
- void XDrawPoint(Display *display, Drawable d, GC gc, int x, int y)
+ int XDrawPoint(Display *display, Drawable d, GC gc, int x, int y)
}
declare 86 aqua {
- void XDrawPoints(Display *display, Drawable d, GC gc, XPoint *points,
+ int XDrawPoints(Display *display, Drawable d, GC gc, XPoint *points,
int npoints, int mode)
}
declare 87 aqua {
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index b978561..a897241 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -698,6 +698,42 @@ EXTERN int XSync(Display *display, Bool discard);
/* 114 */
EXTERN VisualID XVisualIDFromVisual(Visual *visual);
#endif
+/* Slot 115 is reserved */
+/* Slot 116 is reserved */
+/* Slot 117 is reserved */
+/* Slot 118 is reserved */
+/* Slot 119 is reserved */
+/* Slot 120 is reserved */
+/* Slot 121 is reserved */
+/* Slot 122 is reserved */
+/* Slot 123 is reserved */
+/* Slot 124 is reserved */
+/* Slot 125 is reserved */
+/* Slot 126 is reserved */
+/* Slot 127 is reserved */
+/* Slot 128 is reserved */
+/* Slot 129 is reserved */
+/* Slot 130 is reserved */
+/* Slot 131 is reserved */
+/* Slot 132 is reserved */
+#ifndef XDrawSegments_TCL_DECLARED
+#define XDrawSegments_TCL_DECLARED
+/* 133 */
+EXTERN int XDrawSegments(Display *d, Drawable dr, GC gc,
+ XSegment *s, int n);
+#endif
+#ifndef XDrawPoint_TCL_DECLARED
+#define XDrawPoint_TCL_DECLARED
+/* 134 */
+EXTERN int XDrawPoint(Display *d, Drawable dr, GC gc, int x,
+ int y);
+#endif
+#ifndef XDrawPoints_TCL_DECLARED
+#define XDrawPoints_TCL_DECLARED
+/* 135 */
+EXTERN int XDrawPoints(Display *d, Drawable dr, GC gc,
+ XPoint *p, int n, int m);
+#endif
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
#ifndef XSetDashes_TCL_DECLARED
@@ -1168,7 +1204,7 @@ EXTERN Status XStringListToTextProperty(char **list, int count,
#ifndef XDrawSegments_TCL_DECLARED
#define XDrawSegments_TCL_DECLARED
/* 80 */
-EXTERN void XDrawSegments(Display *display, Drawable d, GC gc,
+EXTERN int XDrawSegments(Display *display, Drawable d, GC gc,
XSegment *segments, int nsegments);
#endif
#ifndef XForceScreenSaver_TCL_DECLARED
@@ -1197,13 +1233,13 @@ EXTERN void XClearWindow(Display *d, Window w);
#ifndef XDrawPoint_TCL_DECLARED
#define XDrawPoint_TCL_DECLARED
/* 85 */
-EXTERN void XDrawPoint(Display *display, Drawable d, GC gc,
+EXTERN int XDrawPoint(Display *display, Drawable d, GC gc,
int x, int y);
#endif
#ifndef XDrawPoints_TCL_DECLARED
#define XDrawPoints_TCL_DECLARED
/* 86 */
-EXTERN void XDrawPoints(Display *display, Drawable d, GC gc,
+EXTERN int XDrawPoints(Display *display, Drawable d, GC gc,
XPoint *points, int npoints, int mode);
#endif
#ifndef XWarpPointer_TCL_DECLARED
@@ -1360,6 +1396,27 @@ typedef struct TkIntXlibStubs {
XAfterFunction (*xSynchronize) (Display *display, Bool onoff); /* 112 */
int (*xSync) (Display *display, Bool discard); /* 113 */
VisualID (*xVisualIDFromVisual) (Visual *visual); /* 114 */
+ VOID *reserved115;
+ VOID *reserved116;
+ VOID *reserved117;
+ VOID *reserved118;
+ VOID *reserved119;
+ VOID *reserved120;
+ VOID *reserved121;
+ VOID *reserved122;
+ VOID *reserved123;
+ VOID *reserved124;
+ VOID *reserved125;
+ VOID *reserved126;
+ VOID *reserved127;
+ VOID *reserved128;
+ VOID *reserved129;
+ VOID *reserved130;
+ VOID *reserved131;
+ VOID *reserved132;
+ int (*xDrawSegments) (Display *d, Drawable dr, GC gc, XSegment *s, int n); /* 133 */
+ int (*xDrawPoint) (Display *d, Drawable dr, GC gc, int x, int y); /* 134 */
+ int (*xDrawPoints) (Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 135 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */
@@ -1442,13 +1499,13 @@ typedef struct TkIntXlibStubs {
XVisualInfo * (*xGetVisualInfo) (Display *display, long vinfo_mask, XVisualInfo *vinfo_template, int *nitems_return); /* 77 */
void (*xSetWMClientMachine) (Display *display, Window w, XTextProperty *text_prop); /* 78 */
Status (*xStringListToTextProperty) (char **list, int count, XTextProperty *text_prop_return); /* 79 */
- void (*xDrawSegments) (Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 80 */
+ int (*xDrawSegments) (Display *display, Drawable d, GC gc, XSegment *segments, int nsegments); /* 80 */
void (*xForceScreenSaver) (Display *display, int mode); /* 81 */
int (*xDrawLine) (Display *d, Drawable dr, GC g, int x1, int y1, int x2, int y2); /* 82 */
int (*xFillRectangle) (Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height); /* 83 */
void (*xClearWindow) (Display *d, Window w); /* 84 */
- void (*xDrawPoint) (Display *display, Drawable d, GC gc, int x, int y); /* 85 */
- void (*xDrawPoints) (Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode); /* 86 */
+ int (*xDrawPoint) (Display *display, Drawable d, GC gc, int x, int y); /* 85 */
+ int (*xDrawPoints) (Display *display, Drawable d, GC gc, XPoint *points, int npoints, int mode); /* 86 */
int (*xWarpPointer) (Display *display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y); /* 87 */
void (*xQueryColor) (Display *display, Colormap colormap, XColor *def_in_out); /* 88 */
void (*xQueryColors) (Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 89 */
@@ -1927,6 +1984,36 @@ extern TkIntXlibStubs *tkIntXlibStubsPtr;
#define XVisualIDFromVisual \
(tkIntXlibStubsPtr->xVisualIDFromVisual) /* 114 */
#endif
+/* Slot 115 is reserved */
+/* Slot 116 is reserved */
+/* Slot 117 is reserved */
+/* Slot 118 is reserved */
+/* Slot 119 is reserved */
+/* Slot 120 is reserved */
+/* Slot 121 is reserved */
+/* Slot 122 is reserved */
+/* Slot 123 is reserved */
+/* Slot 124 is reserved */
+/* Slot 125 is reserved */
+/* Slot 126 is reserved */
+/* Slot 127 is reserved */
+/* Slot 128 is reserved */
+/* Slot 129 is reserved */
+/* Slot 130 is reserved */
+/* Slot 131 is reserved */
+/* Slot 132 is reserved */
+#ifndef XDrawSegments
+#define XDrawSegments \
+ (tkIntXlibStubsPtr->xDrawSegments) /* 133 */
+#endif
+#ifndef XDrawPoint
+#define XDrawPoint \
+ (tkIntXlibStubsPtr->xDrawPoint) /* 134 */
+#endif
+#ifndef XDrawPoints
+#define XDrawPoints \
+ (tkIntXlibStubsPtr->xDrawPoints) /* 135 */
+#endif
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
#ifndef XSetDashes
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 90a124f..3573db0 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -730,6 +730,27 @@ TkIntXlibStubs tkIntXlibStubs = {
XSynchronize, /* 112 */
XSync, /* 113 */
XVisualIDFromVisual, /* 114 */
+ NULL, /* 115 */
+ NULL, /* 116 */
+ NULL, /* 117 */
+ NULL, /* 118 */
+ NULL, /* 119 */
+ NULL, /* 120 */
+ NULL, /* 121 */
+ NULL, /* 122 */
+ NULL, /* 123 */
+ NULL, /* 124 */
+ NULL, /* 125 */
+ NULL, /* 126 */
+ NULL, /* 127 */
+ NULL, /* 128 */
+ NULL, /* 129 */
+ NULL, /* 130 */
+ NULL, /* 131 */
+ NULL, /* 132 */
+ XDrawSegments, /* 133 */
+ XDrawPoint, /* 134 */
+ XDrawPoints, /* 135 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
XSetDashes, /* 0 */
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index f376591..bb1938a 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -148,7 +148,7 @@ BitmapRepFromDrawableRect(
cg_image = CGBitmapContextCreateImage( (CGContextRef) cg_context);
sub_cg_image = CGImageCreateWithImageInRect(cg_image, image_rect);
if ( sub_cg_image ) {
- /*This can be dealloc'ed prematurely if set for autorelease, causing crashes.*/
+ /*This can be dealloc'ed prematurely if set for autorelease, causing crashes.*/
bitmap_rep = [NSBitmapImageRep alloc];
[bitmap_rep initWithCGImage:sub_cg_image];
}
@@ -163,7 +163,7 @@ BitmapRepFromDrawableRect(
width,height);
if ( [view lockFocusIfCanDraw] ) {
- /*This can be dealloc'ed prematurely if set for autorelease, causing crashes.*/
+ /*This can be dealloc'ed prematurely if set for autorelease, causing crashes.*/
bitmap_rep = [NSBitmapImageRep alloc];
bitmap_rep = [bitmap_rep initWithFocusedViewRect:view_rect];
[view unlockFocus];
@@ -786,9 +786,6 @@ DrawCGImage(
CGContextDrawImage(context, dstBounds, image);
CGContextRestoreGState(context);
#endif /* TK_MAC_DEBUG_IMAGE_DRAWING */
- /*if (CGImageIsMask(image)) {
- CGContextRestoreGState(context);
- }*/
if (subImage) {
CFRelease(subImage);
}
@@ -875,7 +872,7 @@ XDrawLines(
*----------------------------------------------------------------------
*/
-void
+int
XDrawSegments(
Display *display,
Drawable d,
@@ -889,7 +886,7 @@ XDrawSegments(
display->request++;
if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
- return;
+ return BadDrawable;
}
if (dc.context) {
double o = (lw % 2) ? .5 : 0;
@@ -906,6 +903,7 @@ XDrawSegments(
}
}
TkMacOSXRestoreDrawingContext(&dc);
+ return Success;
}
/*
@@ -1828,7 +1826,7 @@ TkMacOSXGetClipRgn(
{
MacDrawable *macDraw = (MacDrawable *) drawable;
HIShapeRef clipRgn = NULL;
-
+
if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) {
TkMacOSXUpdateClipRgn(macDraw->winPtr);
#ifdef TK_MAC_DEBUG_DRAWING
@@ -1905,7 +1903,7 @@ TkpClipDrawableToRect(
{
MacDrawable *macDraw = (MacDrawable *) d;
NSView *view = TkMacOSXDrawableView(macDraw);
-
+
if (macDraw->drawRgn) {
CFRelease(macDraw->drawRgn);
macDraw->drawRgn = NULL;
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index fce3801..75949ba 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -17,7 +17,7 @@
#include "tkMacOSXWm.h"
#include "tkMacOSXEvent.h"
#include "tkMacOSXDebug.h"
-
+
/*
#ifdef TK_MAC_DEBUG
#define TK_MAC_DEBUG_EVENTS
@@ -365,10 +365,10 @@ GenerateUpdates(
event.xexpose.count = 0;
Tk_HandleEvent(&event);
- #ifdef TK_MAC_DEBUG_DRAWING
+#ifdef TK_MAC_DEBUG_DRAWING
NSLog(@"Expose %p {{%d, %d}, {%d, %d}}", event.xany.window, event.xexpose.x,
event.xexpose.y, event.xexpose.width, event.xexpose.height);
- #endif
+#endif
/*
* Generate updates for the children of this window
@@ -395,7 +395,7 @@ GenerateUpdates(
/*
* TODO: Here we should handle out of process embedding.
*/
- }
+ }
return 1;
}
@@ -770,7 +770,7 @@ Tk_MacOSXIsAppInFront(void)
/*
* Custom content view for use in Tk NSWindows.
- *
+ *
* Since Tk handles all drawing of widgets, we only use the AppKit event loop
* as a source of input events. To do this, we overload the NSView drawRect
* method with a method which generates Expose events for Tk but does no
@@ -812,7 +812,7 @@ ConfigureRestrictProc(
{
const NSRect *rectsBeingDrawn;
NSInteger rectsBeingDrawnCount;
-
+
[self getRectsBeingDrawn:&rectsBeingDrawn count:&rectsBeingDrawnCount];
#ifdef TK_MAC_DEBUG_DRAWING
@@ -822,7 +822,7 @@ ConfigureRestrictProc(
NSCompositeSourceOver);
#endif
-
+
CGFloat height = [self bounds].size.height;
HIMutableShapeRef drawShape = HIShapeCreateMutable();
@@ -841,9 +841,9 @@ ConfigureRestrictProc(
NSEventTrackingRunLoopMode, NSModalPanelRunLoopMode,
nil]];
}
-
+
CFRelease(drawShape);
-
+
}
-(void) setFrameSize: (NSSize)newsize
@@ -863,13 +863,13 @@ ConfigureRestrictProc(
* don't clobber the AutoreleasePool set up by the caller.
*/
[NSApp setPoolProtected:YES];
-
+
/*
* Try to prevent flickers and flashes.
*/
[w disableFlushWindow];
NSDisableScreenUpdates();
-
+
/* Disable Tk drawing until the window has been completely configured.*/
TkMacOSXSetDrawingEnabled(winPtr, 0);
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index a16daa8..e928298 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -555,7 +555,7 @@ XClearWindow(
}
/*
-void
+int
XDrawPoint(
Display* display,
Drawable d,
@@ -565,7 +565,7 @@ XDrawPoint(
{
}
-void
+int
XDrawPoints(
Display* display,
Drawable d,
diff --git a/xlib/X11/Xutil.h b/xlib/X11/Xutil.h
index 58124b0..bf372fb 100644
--- a/xlib/X11/Xutil.h
+++ b/xlib/X11/Xutil.h
@@ -535,7 +535,7 @@ extern Status XMatchVisualInfo(
#endif
);
-extern void XOffsetRegion(
+extern int XOffsetRegion(
#if NeedFunctionPrototypes
Region /* r */,
int /* dx */,
@@ -814,7 +814,7 @@ extern void XUnionRectWithRegion(
#endif
);
-extern void XUnionRegion(
+extern int XUnionRegion(
#if NeedFunctionPrototypes
Region /* sra */,
Region /* srb */,
diff --git a/xlib/xgc.c b/xlib/xgc.c
index 8975373..b18cb9e 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -521,7 +521,7 @@ XDrawImageString(
}
#endif
-void
+int
XDrawPoint(
Display *display,
Drawable d,
@@ -529,10 +529,10 @@ XDrawPoint(
int x,
int y)
{
- XDrawLine(display, d, gc, x, y, x, y);
+ return XDrawLine(display, d, gc, x, y, x, y);
}
-void
+int
XDrawPoints(
Display *display,
Drawable d,
@@ -541,16 +541,19 @@ XDrawPoints(
int npoints,
int mode)
{
- int i;
+ int res = Success;
- for (i=0; i<npoints; i++) {
- XDrawLine(display, d, gc,
- points[i].x, points[i].y, points[i].x, points[i].y);
+ while (npoints-- > 0) {
+ res = XDrawLine(display, d, gc,
+ points[0].x, points[0].y, points[0].x, points[0].y);
+ if (res != Success) break;
+ ++points;
}
+ return res;
}
#if !defined(MAC_OSX_TK)
-void
+int
XDrawSegments(
Display *display,
Drawable d,
@@ -558,6 +561,7 @@ XDrawSegments(
XSegment *segments,
int nsegments)
{
+ return Success;
}
#endif