summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rw-r--r--generic/tkInt.decls6
-rw-r--r--generic/tkIntXlibDecls.h17
-rw-r--r--generic/tkStubInit.c4
-rw-r--r--macosx/tkMacOSXDraw.c36
-rw-r--r--macosx/tkMacOSXInit.c79
-rw-r--r--macosx/tkMacOSXKeyboard.c40
-rw-r--r--macosx/tkMacOSXPrivate.h5
-rw-r--r--macosx/tkMacOSXRegion.c13
9 files changed, 116 insertions, 88 deletions
diff --git a/.travis.yml b/.travis.yml
index 29a66d8..7b1cac1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,3 @@
-sudo: required
language: c
addons:
apt:
@@ -17,8 +16,7 @@ addons:
- tcl-tk
casks:
- xquartz
- update: true
-matrix:
+jobs:
include:
# Testing on Linux with various compilers
- name: "Linux/GCC/Shared"
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 14ab250..c39cd16 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -1844,6 +1844,9 @@ declare 112 aqua {
declare 114 aqua {
VisualID XVisualIDFromVisual(Visual *visual)
}
+declare 120 macosx {
+ int XOffsetRegion(void *rgn, int dx, int dy)
+}
declare 129 aqua {
int XLowerWindow(Display *d, Window w)
}
@@ -1864,6 +1867,9 @@ declare 146 aqua {
unsigned int ui1, unsigned int ui2, XColor _Xconst *x1,
XColor _Xconst *x2)
}
+declare 157 macosx {
+ KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i)
+}
declare 158 aqua {
void TkUnusedStubEntry(void)
}
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 7c5d815..5d8f00e 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -734,7 +734,8 @@ EXTERN VisualID XVisualIDFromVisual(Visual *visual);
/* Slot 117 is reserved */
/* Slot 118 is reserved */
/* Slot 119 is reserved */
-/* Slot 120 is reserved */
+/* 120 */
+EXTERN int XOffsetRegion(void *rgn, int dx, int dy);
/* Slot 121 is reserved */
/* Slot 122 is reserved */
/* Slot 123 is reserved */
@@ -782,7 +783,9 @@ EXTERN Cursor XCreateGlyphCursor(Display *d, Font f1, Font f2,
/* Slot 154 is reserved */
/* Slot 155 is reserved */
/* Slot 156 is reserved */
-/* Slot 157 is reserved */
+/* 157 */
+EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g,
+ int i);
/* 158 */
EXTERN void TkUnusedStubEntry(void);
#endif /* AQUA */
@@ -1073,7 +1076,7 @@ typedef struct TkIntXlibStubs {
void (*reserved117)(void);
void (*reserved118)(void);
void (*reserved119)(void);
- void (*reserved120)(void);
+ int (*xOffsetRegion) (void *rgn, int dx, int dy); /* 120 */
void (*reserved121)(void);
void (*reserved122)(void);
void (*reserved123)(void);
@@ -1110,7 +1113,7 @@ typedef struct TkIntXlibStubs {
void (*reserved154)(void);
void (*reserved155)(void);
void (*reserved156)(void);
- void (*reserved157)(void);
+ KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */
void (*tkUnusedStubEntry) (void); /* 158 */
#endif /* AQUA */
} TkIntXlibStubs;
@@ -1635,7 +1638,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
/* Slot 117 is reserved */
/* Slot 118 is reserved */
/* Slot 119 is reserved */
-/* Slot 120 is reserved */
+#define XOffsetRegion \
+ (tkIntXlibStubsPtr->xOffsetRegion) /* 120 */
/* Slot 121 is reserved */
/* Slot 122 is reserved */
/* Slot 123 is reserved */
@@ -1677,7 +1681,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
/* Slot 154 is reserved */
/* Slot 155 is reserved */
/* Slot 156 is reserved */
-/* Slot 157 is reserved */
+#define XkbKeycodeToKeysym \
+ (tkIntXlibStubsPtr->xkbKeycodeToKeysym) /* 157 */
#define TkUnusedStubEntry \
(tkIntXlibStubsPtr->tkUnusedStubEntry) /* 158 */
#endif /* AQUA */
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index ab8b675..9a6a0e8 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -953,7 +953,7 @@ static const TkIntXlibStubs tkIntXlibStubs = {
0, /* 117 */
0, /* 118 */
0, /* 119 */
- 0, /* 120 */
+ XOffsetRegion, /* 120 */
0, /* 121 */
0, /* 122 */
0, /* 123 */
@@ -990,7 +990,7 @@ static const TkIntXlibStubs tkIntXlibStubs = {
0, /* 154 */
0, /* 155 */
0, /* 156 */
- 0, /* 157 */
+ XkbKeycodeToKeysym, /* 157 */
TkUnusedStubEntry, /* 158 */
#endif /* AQUA */
};
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 645b72b..a31819a 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -70,7 +70,7 @@ static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr);
MODULE_SCOPE int
TkMacOSXInitCGDrawing(
Tcl_Interp *interp,
- int enable,
+ TCL_UNUSED(int),
int limit)
{
static Boolean initialized = FALSE;
@@ -604,7 +604,7 @@ TkMacOSXGetCGContextForDrawable(
bytesPerRow = ((size_t)
macDraw->size.width * bitsPerPixel + 127) >> 3 & ~15;
len = macDraw->size.height * bytesPerRow;
- data = ckalloc(len);
+ data = (char *)ckalloc(len);
bzero(data, len);
macDraw->context = CGBitmapContextCreate(data, macDraw->size.width,
macDraw->size.height, bitsPerComponent, bytesPerRow,
@@ -865,7 +865,7 @@ XFillPolygon(
GC gc, /* Use this GC. */
XPoint *points, /* Array of points. */
int npoints, /* Number of points. */
- int shape, /* Shape to draw. */
+ TCL_UNUSED(int), /* Shape to draw. */
int mode) /* Drawing mode. */
{
MacDrawable *macWin = (MacDrawable *) d;
@@ -976,7 +976,7 @@ XDrawRectangle(
*----------------------------------------------------------------------
*/
-void
+int
XDrawRectangles(
Display *display,
Drawable drawable,
@@ -990,8 +990,8 @@ XDrawRectangles(
int i, lw = gc->line_width;
display->request++;
- if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
- return;
+ if (!TkMacOSXSetupDrawingContext(drawable, gc, 1, &dc)) {
+ return BadDrawable;
}
if (dc.context) {
CGRect rect;
@@ -1009,6 +1009,7 @@ XDrawRectangles(
}
}
TkMacOSXRestoreDrawingContext(&dc);
+ return Success;
}
#endif
@@ -1360,7 +1361,7 @@ XFillArc(
*----------------------------------------------------------------------
*/
-void
+int
XFillArcs(
Display *display,
Drawable d,
@@ -1375,7 +1376,7 @@ XFillArcs(
display->request++;
if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
- return;
+ return BadDrawable;
}
if (dc.context) {
CGRect rect;
@@ -1423,6 +1424,7 @@ XFillArcs(
}
}
TkMacOSXRestoreDrawingContext(&dc);
+ return Success;
}
#endif
@@ -1464,7 +1466,7 @@ XMaxRequestSize(
int
TkScrollWindow(
Tk_Window tkwin, /* The window to be scrolled. */
- GC gc, /* GC for window to be scrolled. */
+ TCL_UNUSED(GC), /* GC for window to be scrolled. */
int x, int y, /* Position rectangle to be scrolled. */
int width, int height,
int dx, int dy, /* Distance rectangle should be moved. */
@@ -1560,8 +1562,8 @@ TkScrollWindow(
void
TkMacOSXSetUpGraphicsPort(
- GC gc, /* GC to apply to current port. */
- void *destPort)
+ TCL_UNUSED(GC), /* GC to apply to current port. */
+ TCL_UNUSED(void *))
{
Tcl_Panic("TkMacOSXSetUpGraphicsPort: Obsolete, no more QD!");
}
@@ -1589,7 +1591,7 @@ Bool
TkMacOSXSetupDrawingContext(
Drawable d,
GC gc,
- int useCG, /* advisory only ! */
+ TCL_UNUSED(int),
TkMacOSXDrawingContext *dcPtr)
{
MacDrawable *macDraw = (MacDrawable *) d;
@@ -1928,7 +1930,7 @@ TkMacOSXSetUpClippingRgn(
void
TkpClipDrawableToRect(
- Display *display,
+ TCL_UNUSED(Display *),
Drawable d,
int x, int y,
int width, int height)
@@ -1986,7 +1988,7 @@ ClipToGC(
int yOffset = ((MacDrawable *) d)->yOff + gc->clip_y_origin;
HIShapeRef clipRgn = *clipRgnPtr, gcClipRgn;
- TkMacOSXOffsetRegion(gcClip, xOffset, yOffset);
+ XOffsetRegion(gcClip, xOffset, yOffset);
gcClipRgn = TkMacOSXGetNativeRegion(gcClip);
if (clipRgn) {
*clipRgnPtr = HIShapeCreateIntersection(gcClipRgn, clipRgn);
@@ -1995,7 +1997,7 @@ ClipToGC(
*clipRgnPtr = HIShapeCreateCopy(gcClipRgn);
}
CFRelease(gcClipRgn);
- TkMacOSXOffsetRegion(gcClip, -xOffset, -yOffset);
+ XOffsetRegion(gcClip, -xOffset, -yOffset);
}
}
@@ -2019,8 +2021,8 @@ ClipToGC(
void *
TkMacOSXMakeStippleMap(
- Drawable drawable, /* Window to apply stipple. */
- Drawable stipple) /* The stipple pattern. */
+ TCL_UNUSED(Drawable), /* Window to apply stipple. */
+ TCL_UNUSED(Drawable)) /* The stipple pattern. */
{
return NULL;
}
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index d3c4a0c..ab2400c 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -28,6 +28,13 @@ static char tkLibPath[PATH_MAX + 1] = "";
static char scriptPath[PATH_MAX + 1] = "";
+/*
+ * Forward declarations...
+ */
+
+static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
+ int objc, Tcl_Obj *const objv[]);
+
#pragma mark TKApplication(TKInit)
@implementation TKApplication
@@ -86,6 +93,7 @@ static char scriptPath[PATH_MAX + 1] = "";
-(void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
+ (void)aNotification;
/*
* Initialize notifications.
@@ -117,6 +125,8 @@ static char scriptPath[PATH_MAX + 1] = "";
-(void)applicationDidFinishLaunching:(NSNotification *)notification
{
+ (void)notification;
+
/*
* It is not safe to force activation of the NSApp until this method is
* called. Activating too early can cause the menu bar to be unresponsive.
@@ -421,7 +431,8 @@ TkpInit(
TkMacOSXStandardAboutPanelObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap",
TkMacOSXIconBitmapObjCmd, NULL, NULL);
- Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath",
+ TkMacOSXGetAppPathCmd, NULL, NULL);
return TCL_OK;
}
@@ -461,11 +472,11 @@ TkpGetAppName(
}
Tcl_DStringAppend(namePtr, name, -1);
}
-
+
/*
*----------------------------------------------------------------------
*
- * TkMacOSXGetAppPath --
+ * TkMacOSXGetAppPathCmd --
*
* Returns the path of the Wish application bundle.
*
@@ -477,42 +488,39 @@ TkpGetAppName(
*
*----------------------------------------------------------------------
*/
-int TkMacOSXGetAppPath(
- ClientData cd,
- Tcl_Interp *ip,
- int objc,
- Tcl_Obj *const objv[])
-{
-
- CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle());
-
-
- /*
- * Convert the URL reference into a string reference.
- */
-
- CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
- /*
- * Get the system encoding method.
- */
-
- CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
+static int
+TkMacOSXGetAppPathCmd(
+ TCL_UNUSED(ClientData),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ if (objc != 1) {
+ Tcl_WrongNumArgs(interp, 1, objv, NULL);
+ return TCL_ERROR;
+ }
- /*
- * Convert the string reference into a C string.
- */
+ /*
+ * Get the application path URL and convert it to a string path reference.
+ */
- char *path = (char *) CFStringGetCStringPtr(appPath, encodingMethod);
+ CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle());
+ CFStringRef appPath =
+ CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
- Tcl_SetResult(ip, path, NULL);
+ /*
+ * Convert (and copy) the string reference into a Tcl result.
+ */
- CFRelease(mainBundleURL);
- CFRelease(appPath);
- return TCL_OK;
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ CFStringGetCStringPtr(appPath, CFStringGetSystemEncoding()), -1));
+ CFRelease(mainBundleURL);
+ CFRelease(appPath);
+ return TCL_OK;
}
-
+
/*
*----------------------------------------------------------------------
*
@@ -579,7 +587,7 @@ TkMacOSXDefaultStartupScript(void)
CFURLRef scriptFldrURL;
char startupScript[PATH_MAX + 1];
- if (CFURLGetFileSystemRepresentation (appMainURL, true,
+ if (CFURLGetFileSystemRepresentation(appMainURL, true,
(unsigned char *) startupScript, PATH_MAX)) {
Tcl_SetStartupScript(Tcl_NewStringObj(startupScript,-1), NULL);
scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL,
@@ -616,10 +624,11 @@ TkMacOSXDefaultStartupScript(void)
MODULE_SCOPE void*
TkMacOSXGetNamedSymbol(
- const char* module,
- const char* symbol)
+ TCL_UNUSED(const char *),
+ const char *symbol)
{
void *addr = dlsym(RTLD_NEXT, symbol);
+
if (!addr) {
(void) dlerror(); /* Clear dlfcn error state */
}
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index 8381aa7..378c30e 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.c
@@ -153,6 +153,8 @@ static int KeyDataToUnicode(UniChar *uniChars, int maxChars,
{
#ifdef TK_MAC_DEBUG_NOTIFICATIONS
TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification);
+#else
+ (void)notification;
#endif
keyboardChanged = YES;
UpdateKeymaps();
@@ -401,14 +403,14 @@ KeyDataToUnicode(
*/
KeySym
-XKeycodeToKeysym(
- Display* display,
- KeyCode keycode,
+XkbKeycodeToKeysym(
+ TCL_UNUSED(Display *),
+ unsigned int keycode,
+ TCL_UNUSED(int),
int index)
{
Tcl_HashEntry *hPtr;
MacKeycode macKC;
- (void) display; /*unused*/
int modifiers, result;
UniChar keychar = 0;
@@ -459,6 +461,15 @@ XKeycodeToKeysym(
}
return NoSymbol;
}
+
+KeySym
+XKeycodeToKeysym(
+ TCL_UNUSED(Display *),
+ KeyCode keycode,
+ int index)
+{
+ return XkbKeycodeToKeysym(NULL, keycode, 0, index);
+}
/*
*----------------------------------------------------------------------
@@ -479,13 +490,12 @@ XKeycodeToKeysym(
const char *
TkpGetString(
- TkWindow *winPtr, /* Window where event occurred: Needed to get
+ TCL_UNUSED(TkWindow *), /* Window where event occurred: Needed to get
* input context. */
XEvent *eventPtr, /* X keyboard event. */
Tcl_DString *dsPtr) /* Uninitialized or empty string to hold
* result. */
{
- (void) winPtr; /*unused*/
MacKeycode macKC;
char utfChars[8];
int length = 0;
@@ -519,11 +529,11 @@ TkpGetString(
XModifierKeymap *
XGetModifierMapping(
- Display *display)
+ TCL_UNUSED(Display *))
{
XModifierKeymap *modmap;
- modmap = ckalloc(sizeof(XModifierKeymap));
+ modmap = (XModifierKeymap *)ckalloc(sizeof(XModifierKeymap));
modmap->max_keypermod = 0;
modmap->modifiermap = NULL;
return modmap;
@@ -578,14 +588,14 @@ XFreeModifiermap(
char *
XKeysymToString(
- KeySym keysym)
+ TCL_UNUSED(KeySym))
{
return NULL;
}
KeySym
XStringToKeysym(
- const char* string)
+ TCL_UNUSED(const char *))
{
return NoSymbol;
}
@@ -613,7 +623,7 @@ XStringToKeysym(
KeyCode
XKeysymToKeycode(
- Display *display,
+ TCL_UNUSED(Display *),
KeySym keysym)
{
Tcl_HashEntry *hPtr;
@@ -681,7 +691,7 @@ XKeysymToKeycode(
*/
void
TkpSetKeycodeAndState(
- Tk_Window tkwin,
+ TCL_UNUSED(Tk_Window),
KeySym keysym,
XEvent *eventPtr)
{
@@ -813,7 +823,7 @@ TkpGetKeySym(
* First do the straightforward lookup.
*/
- sym = XKeycodeToKeysym(dispPtr->display, macKC.uint, index);
+ sym = XkbKeycodeToKeysym(dispPtr->display, macKC.uint, 0, index);
/*
* Special handling: If the key was shifted because of Lock, which is only
@@ -823,7 +833,7 @@ TkpGetKeySym(
if ((index & INDEX_SHIFT) && !(eventPtr->xkey.state & ShiftMask)) {
if ((sym == NoSymbol) || !Tcl_UniCharIsUpper(sym)) {
- sym = XKeycodeToKeysym(dispPtr->display, macKC.uint,
+ sym = XkbKeycodeToKeysym(dispPtr->display, macKC.uint, 0,
index & ~INDEX_SHIFT);
}
}
@@ -834,7 +844,7 @@ TkpGetKeySym(
*/
if ((index & INDEX_SHIFT) && (sym == NoSymbol)) {
- sym = XKeycodeToKeysym(dispPtr->display, macKC.uint,
+ sym = XkbKeycodeToKeysym(dispPtr->display, macKC.uint, 0,
index & ~INDEX_SHIFT);
}
return sym;
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 6109024..a6b988e 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -218,7 +218,6 @@ MODULE_SCOPE long tkMacOSXMacOSXVersion;
MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(TkRegion r);
MODULE_SCOPE void TkMacOSXSetWithNativeRegion(TkRegion r,
HIShapeRef rgn);
-MODULE_SCOPE void TkMacOSXOffsetRegion(TkRegion r, short dx, short dy);
MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void);
MODULE_SCOPE HIMutableShapeRef TkMacOSXHIShapeCreateMutableWithRect(
const CGRect *inRect);
@@ -557,9 +556,7 @@ VISIBILITY_HIDDEN
@end
#endif /* _TKMACPRIV */
-
-int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *const objv[]);
-
+
/*
* Local Variables:
* mode: objc
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index db19c94..4baa3e8 100644
--- a/macosx/tkMacOSXRegion.c
+++ b/macosx/tkMacOSXRegion.c
@@ -436,7 +436,7 @@ TkMacOSXSetWithNativeRegion(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXOffsetRegion --
+ * XOffsetRegion --
*
* Offsets region by given distances.
*
@@ -449,13 +449,14 @@ TkMacOSXSetWithNativeRegion(
*----------------------------------------------------------------------
*/
-void
-TkMacOSXOffsetRegion(
- TkRegion r,
- short dx,
- short dy)
+int
+XOffsetRegion(
+ void *r,
+ int dx,
+ int dy)
{
ChkErr(HIShapeOffset, (HIMutableShapeRef) r, dx, dy);
+ return Success;
}
/*