From 416295a661f5c8f30dfe0751b5618c6a51173034 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 18 Aug 2019 21:54:50 +0000 Subject: Fix signatures of many X11 functions on MacOSX: They have an "int" return value, not "void", which allows to check for errors. --- generic/tkInt.decls | 16 ++++++++-------- generic/tkIntXlibDecls.h | 32 ++++++++++++++++---------------- macosx/tkMacOSXDraw.c | 13 +++++++------ macosx/tkMacOSXSubwindows.c | 9 ++++++--- macosx/tkMacOSXXStubs.c | 8 +++++--- 5 files changed, 42 insertions(+), 36 deletions(-) diff --git a/generic/tkInt.decls b/generic/tkInt.decls index a3e1f98..743157f 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -1544,15 +1544,15 @@ declare 13 aqua { int XBell(Display *d, int i) } declare 14 aqua { - void XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, + int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3) } declare 15 aqua { - void XChangeWindowAttributes(Display *d, Window w, unsigned long ul, + int XChangeWindowAttributes(Display *d, Window w, unsigned long ul, XSetWindowAttributes *x) } declare 16 aqua { - void XConfigureWindow(Display *d, Window w, unsigned int i, + int XConfigureWindow(Display *d, Window w, unsigned int i, XWindowChanges *x) } declare 17 aqua { @@ -1582,11 +1582,11 @@ declare 23 aqua { int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2) } declare 24 aqua { - void XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, + int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2) } declare 25 aqua { - void XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, + int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4) } declare 26 aqua { @@ -1630,11 +1630,11 @@ declare 36 aqua { void XMapWindow(Display *d, Window w) } declare 37 aqua { - void XMoveResizeWindow(Display *d, Window w, int i1, int i2, + int XMoveResizeWindow(Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2) } declare 38 aqua { - void XMoveWindow(Display *d, Window w, int i1, int i2) + int XMoveWindow(Display *d, Window w, int i1, int i2) } declare 39 aqua { Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3, @@ -1758,7 +1758,7 @@ declare 75 aqua { int _XInitImageFuncPtrs(XImage *image) } declare 76 aqua { - XIC XCreateIC(void) + XIC XCreateIC(XIM xim, ...) } declare 77 aqua { XVisualInfo *XGetVisualInfo(Display *display, long vinfo_mask, diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index de44068..6a6bedb 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -450,14 +450,14 @@ EXTERN Status XAllocColor(Display *d, Colormap c, XColor *xp); /* 13 */ EXTERN int XBell(Display *d, int i); /* 14 */ -EXTERN void XChangeProperty(Display *d, Window w, Atom a1, +EXTERN int XChangeProperty(Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 15 */ -EXTERN void XChangeWindowAttributes(Display *d, Window w, +EXTERN int XChangeWindowAttributes(Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 16 */ -EXTERN void XConfigureWindow(Display *d, Window w, +EXTERN int XConfigureWindow(Display *d, Window w, unsigned int i, XWindowChanges *x); /* 17 */ EXTERN void XCopyArea(Display *d, Drawable dr1, Drawable dr2, @@ -484,10 +484,10 @@ EXTERN void XDrawArc(Display *d, Drawable dr, GC g, int i1, EXTERN int XDrawLines(Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 24 */ -EXTERN void XDrawRectangle(Display *d, Drawable dr, GC g, int i1, +EXTERN int XDrawRectangle(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 25 */ -EXTERN void XFillArc(Display *d, Drawable dr, GC g, int i1, +EXTERN int XFillArc(Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 26 */ @@ -525,10 +525,10 @@ EXTERN KeyCode XKeysymToKeycode(Display *d, KeySym k); /* 36 */ EXTERN void XMapWindow(Display *d, Window w); /* 37 */ -EXTERN void XMoveResizeWindow(Display *d, Window w, int i1, +EXTERN int XMoveResizeWindow(Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 38 */ -EXTERN void XMoveWindow(Display *d, Window w, int i1, int i2); +EXTERN int XMoveWindow(Display *d, Window w, int i1, int i2); /* 39 */ EXTERN Bool XQueryPointer(Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, @@ -629,7 +629,7 @@ EXTERN int XSetLineAttributes(Display *display, GC gc, /* 75 */ EXTERN int _XInitImageFuncPtrs(XImage *image); /* 76 */ -EXTERN XIC XCreateIC(void); +EXTERN XIC XCreateIC(XIM xim, ...); /* 77 */ EXTERN XVisualInfo * XGetVisualInfo(Display *display, long vinfo_mask, XVisualInfo *vinfo_template, @@ -838,9 +838,9 @@ typedef struct TkIntXlibStubs { XErrorHandler (*xSetErrorHandler) (XErrorHandler x); /* 11 */ Status (*xAllocColor) (Display *d, Colormap c, XColor *xp); /* 12 */ int (*xBell) (Display *d, int i); /* 13 */ - void (*xChangeProperty) (Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 14 */ - void (*xChangeWindowAttributes) (Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 15 */ - void (*xConfigureWindow) (Display *d, Window w, unsigned int i, XWindowChanges *x); /* 16 */ + int (*xChangeProperty) (Display *d, Window w, Atom a1, Atom a2, int i1, int i2, _Xconst unsigned char *c, int i3); /* 14 */ + int (*xChangeWindowAttributes) (Display *d, Window w, unsigned long ul, XSetWindowAttributes *x); /* 15 */ + int (*xConfigureWindow) (Display *d, Window w, unsigned int i, XWindowChanges *x); /* 16 */ void (*xCopyArea) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 17 */ void (*xCopyPlane) (Display *d, Drawable dr1, Drawable dr2, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4, unsigned long ul); /* 18 */ Pixmap (*xCreateBitmapFromData) (Display *display, Drawable d, _Xconst char *data, unsigned int width, unsigned int height); /* 19 */ @@ -848,8 +848,8 @@ typedef struct TkIntXlibStubs { void (*xDestroyWindow) (Display *d, Window w); /* 21 */ void (*xDrawArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 22 */ int (*xDrawLines) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2); /* 23 */ - void (*xDrawRectangle) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 24 */ - void (*xFillArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 25 */ + int (*xDrawRectangle) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 24 */ + int (*xFillArc) (Display *d, Drawable dr, GC g, int i1, int i2, unsigned int ui1, unsigned int ui2, int i3, int i4); /* 25 */ void (*xFillPolygon) (Display *d, Drawable dr, GC g, XPoint *x, int i1, int i2, int i3); /* 26 */ int (*xFillRectangles) (Display *d, Drawable dr, GC g, XRectangle *x, int i); /* 27 */ int (*xFreeColormap) (Display *d, Colormap c); /* 28 */ @@ -861,8 +861,8 @@ typedef struct TkIntXlibStubs { int (*xGrabPointer) (Display *d, Window w1, Bool b, unsigned int ui, int i1, int i2, Window w2, Cursor c, Time t); /* 34 */ KeyCode (*xKeysymToKeycode) (Display *d, KeySym k); /* 35 */ void (*xMapWindow) (Display *d, Window w); /* 36 */ - void (*xMoveResizeWindow) (Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 37 */ - void (*xMoveWindow) (Display *d, Window w, int i1, int i2); /* 38 */ + int (*xMoveResizeWindow) (Display *d, Window w, int i1, int i2, unsigned int ui1, unsigned int ui2); /* 37 */ + int (*xMoveWindow) (Display *d, Window w, int i1, int i2); /* 38 */ Bool (*xQueryPointer) (Display *d, Window w1, Window *w2, Window *w3, int *i1, int *i2, int *i3, int *i4, unsigned int *ui); /* 39 */ void (*xRaiseWindow) (Display *d, Window w); /* 40 */ void (*xRefreshKeyboardMapping) (XMappingEvent *x); /* 41 */ @@ -900,7 +900,7 @@ typedef struct TkIntXlibStubs { int (*xSetFunction) (Display *display, GC gc, int function); /* 73 */ int (*xSetLineAttributes) (Display *display, GC gc, unsigned int line_width, int line_style, int cap_style, int join_style); /* 74 */ int (*_XInitImageFuncPtrs) (XImage *image); /* 75 */ - XIC (*xCreateIC) (void); /* 76 */ + XIC (*xCreateIC) (XIM xim, ...); /* 76 */ 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 */ diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 1793b64..a8399ef 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -906,7 +906,7 @@ XFillPolygon( *---------------------------------------------------------------------- */ -void +int XDrawRectangle( Display *display, /* Display. */ Drawable d, /* Draw on this. */ @@ -920,12 +920,12 @@ XDrawRectangle( int lw = gc->line_width; if (width == 0 || height == 0) { - return; + return BadDrawable; } display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + return BadDrawable; } if (dc.context) { CGRect rect; @@ -937,6 +937,7 @@ XDrawRectangle( CGContextStrokeRect(dc.context, rect); } TkMacOSXRestoreDrawingContext(&dc); + return Success; } #ifdef TK_MACOSXDRAW_UNUSED @@ -1266,7 +1267,7 @@ XDrawArcs( *---------------------------------------------------------------------- */ -void +int XFillArc( Display *display, /* Display. */ Drawable d, /* Draw on this. */ @@ -1282,12 +1283,12 @@ XFillArc( int lw = gc->line_width; if (width == 0 || height == 0 || angle2 == 0) { - return; + return BadDrawable; } display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { - return; + return BadDrawable; } if (dc.context) { CGRect rect; diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index b660917..1c63870 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -394,7 +394,7 @@ XResizeWindow( *---------------------------------------------------------------------- */ -void +int XMoveResizeWindow( Display *display, /* Display. */ Window window, /* Window. */ @@ -430,6 +430,7 @@ XMoveResizeWindow( } else { MoveResizeWindow(macWin); } + return Success; } /* @@ -448,7 +449,7 @@ XMoveResizeWindow( *---------------------------------------------------------------------- */ -void +int XMoveWindow( Display *display, /* Display. */ Window window, /* Window. */ @@ -467,6 +468,7 @@ XMoveWindow( } else { MoveResizeWindow(macWin); } + return Success; } /* @@ -661,7 +663,7 @@ XLowerWindow( *---------------------------------------------------------------------- */ -void +int XConfigureWindow( Display *display, /* Display. */ Window w, /* Window. */ @@ -708,6 +710,7 @@ XConfigureWindow( TkGenWMMoveRequestEvent(macWin->winPtr, macWin->winPtr->changes.x, macWin->winPtr->changes.y); #endif + return Success; } /* diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 13cba84..9d4f7db 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -435,7 +435,7 @@ XGetGeometry( return 1; } -void +int XChangeProperty( Display* display, Window w, @@ -447,6 +447,7 @@ XChangeProperty( int nelements) { Debugger(); + return Success; } void @@ -776,13 +777,14 @@ TkGetServerInfo( *---------------------------------------------------------------------- */ -void +int XChangeWindowAttributes( Display *display, Window w, unsigned long value_mask, XSetWindowAttributes *attributes) { + return Success; } void @@ -854,7 +856,7 @@ XSetWMClientMachine( } XIC -XCreateIC(void) +XCreateIC(XIM xim, ...) { Debugger(); return (XIC) 0; -- cgit v0.12