From c2eaef98e73b309df7c2e262fc0c982a634d0f9d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 24 Sep 2019 21:01:04 +0000 Subject: Add 7 X11 functions to the aqua stub table, which makes them accessable to stubbed extensions. They were defined in tkMacOSXPort.h as macro's, which is not 'right' --- generic/tkButton.c | 2 +- generic/tkCmds.c | 2 +- generic/tkImgPhInstance.c | 2 +- generic/tkInt.decls | 25 ++++++++++++-- generic/tkIntXlibDecls.h | 87 +++++++++++++++++++++++++++++++++++++++++++++-- generic/tkStubInit.c | 30 ++++++++++++++++ generic/tkWindow.c | 2 +- macosx/tkMacOSXPort.h | 19 +++++++---- macosx/tkMacOSXXStubs.c | 63 +++++++++++++++++++++++++++++++++- macosx/ttkMacOSXTheme.c | 2 +- win/stubs.c | 10 +++--- 11 files changed, 223 insertions(+), 21 deletions(-) diff --git a/generic/tkButton.c b/generic/tkButton.c index 37cfcd2..3c15bf6 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -878,7 +878,7 @@ ButtonWidgetObjCmd( */ Tcl_CancelIdleCall(TkpDisplayButton, butPtr); - XFlush(butPtr->display); + (void)XFlush(butPtr->display); #ifndef MAC_OSX_TK /* * On the mac you can not sleep in a display proc, and the diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 8ba05f0..7f4c49b 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -134,7 +134,7 @@ Tk_BellObjCmd( if (!nice) { XForceScreenSaver(Tk_Display(tkwin), ScreenSaverReset); } - XFlush(Tk_Display(tkwin)); + (void)XFlush(Tk_Display(tkwin)); Tk_DeleteErrorHandler(handler); return TCL_OK; } diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index b73ceeb..c500050 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -700,7 +700,7 @@ TkImgPhotoDisplay( XSetClipMask(display, instancePtr->gc, None); XSetClipOrigin(display, instancePtr->gc, 0, 0); } - XFlush(display); + (void)XFlush(display); #endif } diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 62441e5..8cea73c 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -1817,9 +1817,30 @@ declare 90 aqua { Window **w4, unsigned int *ui) } declare 91 aqua { - int XSync(Display *display, Bool flag) + int XSync(Display *display, Bool discard) } - +declare 107 aqua { + int XFlush(Display *display) +} +declare 108 aqua { + int XGrabServer(Display *display) +} +declare 109 aqua { + int XUngrabServer(Display *display) +} +declare 110 aqua { + int XFree(void *data) +} +declare 111 aqua { + int XNoOp(Display *display) +} +declare 112 aqua { + XAfterFunction XSynchronize(Display *display, Bool onoff) +} +declare 114 aqua { + VisualID XVisualIDFromVisual(Visual *visual) +} + # Local Variables: # mode: tcl # End: diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index fbf3faf..c4186b0 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -676,7 +676,37 @@ EXTERN int XQueryColors(Display *display, Colormap colormap, EXTERN Status XQueryTree(Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 91 */ -EXTERN int XSync(Display *display, Bool flag); +EXTERN int XSync(Display *display, Bool discard); +/* Slot 92 is reserved */ +/* Slot 93 is reserved */ +/* Slot 94 is reserved */ +/* Slot 95 is reserved */ +/* Slot 96 is reserved */ +/* Slot 97 is reserved */ +/* Slot 98 is reserved */ +/* Slot 99 is reserved */ +/* Slot 100 is reserved */ +/* Slot 101 is reserved */ +/* Slot 102 is reserved */ +/* Slot 103 is reserved */ +/* Slot 104 is reserved */ +/* Slot 105 is reserved */ +/* Slot 106 is reserved */ +/* 107 */ +EXTERN int XFlush(Display *display); +/* 108 */ +EXTERN int XGrabServer(Display *display); +/* 109 */ +EXTERN int XUngrabServer(Display *display); +/* 110 */ +EXTERN int XFree(void *data); +/* 111 */ +EXTERN int XNoOp(Display *display); +/* 112 */ +EXTERN XAfterFunction XSynchronize(Display *display, Bool onoff); +/* Slot 113 is reserved */ +/* 114 */ +EXTERN VisualID XVisualIDFromVisual(Visual *visual); #endif /* AQUA */ typedef struct TkIntXlibStubs { @@ -915,7 +945,30 @@ typedef struct TkIntXlibStubs { int (*xQueryColor) (Display *display, Colormap colormap, XColor *def_in_out); /* 88 */ int (*xQueryColors) (Display *display, Colormap colormap, XColor *defs_in_out, int ncolors); /* 89 */ Status (*xQueryTree) (Display *d, Window w1, Window *w2, Window *w3, Window **w4, unsigned int *ui); /* 90 */ - int (*xSync) (Display *display, Bool flag); /* 91 */ + int (*xSync) (Display *display, Bool discard); /* 91 */ + void (*reserved92)(void); + void (*reserved93)(void); + void (*reserved94)(void); + void (*reserved95)(void); + void (*reserved96)(void); + void (*reserved97)(void); + void (*reserved98)(void); + void (*reserved99)(void); + void (*reserved100)(void); + void (*reserved101)(void); + void (*reserved102)(void); + void (*reserved103)(void); + void (*reserved104)(void); + void (*reserved105)(void); + void (*reserved106)(void); + int (*xFlush) (Display *display); /* 107 */ + int (*xGrabServer) (Display *display); /* 108 */ + int (*xUngrabServer) (Display *display); /* 109 */ + int (*xFree) (void *data); /* 110 */ + int (*xNoOp) (Display *display); /* 111 */ + XAfterFunction (*xSynchronize) (Display *display, Bool onoff); /* 112 */ + void (*reserved113)(void); + VisualID (*xVisualIDFromVisual) (Visual *visual); /* 114 */ #endif /* AQUA */ } TkIntXlibStubs; @@ -1382,6 +1435,36 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; (tkIntXlibStubsPtr->xQueryTree) /* 90 */ #define XSync \ (tkIntXlibStubsPtr->xSync) /* 91 */ +/* Slot 92 is reserved */ +/* Slot 93 is reserved */ +/* Slot 94 is reserved */ +/* Slot 95 is reserved */ +/* Slot 96 is reserved */ +/* Slot 97 is reserved */ +/* Slot 98 is reserved */ +/* Slot 99 is reserved */ +/* Slot 100 is reserved */ +/* Slot 101 is reserved */ +/* Slot 102 is reserved */ +/* Slot 103 is reserved */ +/* Slot 104 is reserved */ +/* Slot 105 is reserved */ +/* Slot 106 is reserved */ +#define XFlush \ + (tkIntXlibStubsPtr->xFlush) /* 107 */ +#define XGrabServer \ + (tkIntXlibStubsPtr->xGrabServer) /* 108 */ +#define XUngrabServer \ + (tkIntXlibStubsPtr->xUngrabServer) /* 109 */ +#define XFree \ + (tkIntXlibStubsPtr->xFree) /* 110 */ +#define XNoOp \ + (tkIntXlibStubsPtr->xNoOp) /* 111 */ +#define XSynchronize \ + (tkIntXlibStubsPtr->xSynchronize) /* 112 */ +/* Slot 113 is reserved */ +#define XVisualIDFromVisual \ + (tkIntXlibStubsPtr->xVisualIDFromVisual) /* 114 */ #endif /* AQUA */ #endif /* defined(USE_TK_STUBS) */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index b531933..5dffe7a 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -38,6 +38,13 @@ MODULE_SCOPE const TkStubs tkStubs; */ #undef Tk_MainEx +#undef XVisualIDFromVisual +#undef XSynchronize +#undef XUngrabServer +#undef XNoOp +#undef XGrabServer +#undef XFree +#undef XFlush #ifdef _WIN32 @@ -821,6 +828,29 @@ static const TkIntXlibStubs tkIntXlibStubs = { XQueryColors, /* 89 */ XQueryTree, /* 90 */ XSync, /* 91 */ + 0, /* 92 */ + 0, /* 93 */ + 0, /* 94 */ + 0, /* 95 */ + 0, /* 96 */ + 0, /* 97 */ + 0, /* 98 */ + 0, /* 99 */ + 0, /* 100 */ + 0, /* 101 */ + 0, /* 102 */ + 0, /* 103 */ + 0, /* 104 */ + 0, /* 105 */ + 0, /* 106 */ + XFlush, /* 107 */ + XGrabServer, /* 108 */ + XUngrabServer, /* 109 */ + XFree, /* 110 */ + XNoOp, /* 111 */ + XSynchronize, /* 112 */ + 0, /* 113 */ + XVisualIDFromVisual, /* 114 */ #endif /* AQUA */ }; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 5e0ffeb..00fb344 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -3261,7 +3261,7 @@ Initialize( } Tcl_ResetResult(interp); if (sync) { - XSynchronize(Tk_Display(Tk_MainWindow(interp)), True); + (void)XSynchronize(Tk_Display(Tk_MainWindow(interp)), True); } /* diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index 8961c25..ba6e329 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -111,12 +111,19 @@ * no-op functions on the Macintosh. */ -#define XFlush(display) -#define XFree(data) {if ((data) != NULL) ckfree(data);} -#define XGrabServer(display) -#define XNoOp(display) {display->request++;} -#define XUngrabServer(display) -#define XSynchronize(display, bool) {display->request++;} +#undef XFlush +#define XFlush(display) (0) +#undef XFree +#define XFree(data) (((data) != NULL) ? (ckfree(data),0) : 0) +#undef XGrabServer +#define XGrabServer(display) (0) +#undef XNoOp +#define XNoOp(display) (display->request++,0) +#undef XUngrabServer +#define XUngrabServer(display) (0) +#undef XSynchronize +#define XSynchronize(display, onoff) (display->request++,NULL) +#undef XVisualIDFromVisual #define XVisualIDFromVisual(visual) (visual->visualid) /* diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 63f5dba..d60c012 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -696,7 +696,7 @@ Tk_FreeXId( int XSync( Display *display, - Bool flag) + Bool discard) { TkMacOSXFlushWindows(); display->request++; @@ -877,6 +877,67 @@ XCreateIC(XIM xim, ...) return (XIC) 0; } +#undef XVisualIDFromVisual +VisualID +XVisualIDFromVisual( + Visual *visual) +{ + return visual->visualid; +} + +#undef XSynchronize +XAfterFunction +XSynchronize( + Display *display, + Bool onoff) +{ + display->request++; + return NULL; +} + +#undef XUngrabServer +int +XUngrabServer( + Display *display) +{ + return 0; +} + +#undef XNoOp +int +XNoOp( + Display *display) +{ + display->request++; + return 0; +} + +#undef XGrabServer +int +XGrabServer( + Display *display) +{ + return 0; +} + +#undef XFree +int +XFree( + void *data) +{ + if ((data) != NULL) { + ckfree(data); + } + return 0; +} +#undef XFlush +int +XFlush( + Display *display) +{ + return 0; +} + /* *---------------------------------------------------------------------- * diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 2cbaeaa..4f9c044 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -1064,7 +1064,7 @@ static void DrawDarkFocusRing( { CGRect insetBounds = CGRectInset(bounds, -3, -3); CHECK_RADIUS(4, insetBounds) - + NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *strokeColor; NSColor *fillColor = [NSColor colorWithColorSpace:deviceRGB diff --git a/win/stubs.c b/win/stubs.c index 1cf23ef..884186c 100644 --- a/win/stubs.c +++ b/win/stubs.c @@ -444,25 +444,25 @@ int XNoOp( Display *display) { - display->request++; + display->request++; return 0; } XAfterFunction XSynchronize( Display *display, - Bool bool) + Bool onoff) { - display->request++; + display->request++; return NULL; } int XSync( Display *display, - Bool bool) + Bool discard) { - display->request++; + display->request++; return 0; } -- cgit v0.12