summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2019-05-17 03:13:34 (GMT)
committerKevin Walzer <kw@codebykevin.com>2019-05-17 03:13:34 (GMT)
commiteb47f72e2905e940a3f2b3c81f9d0a8944df5143 (patch)
tree26c0526fa040d03d676ecd21d216b0b95d9db0ef
parent3726f38ebed5f4a444b0b3de64095649563eecf8 (diff)
downloadtk-eb47f72e2905e940a3f2b3c81f9d0a8944df5143.zip
tk-eb47f72e2905e940a3f2b3c81f9d0a8944df5143.tar.gz
tk-eb47f72e2905e940a3f2b3c81f9d0a8944df5143.tar.bz2
Code and data type cleanup, thanks to Marc Culler for patch
-rw-r--r--macosx/Wish-Info.plist.in1
-rw-r--r--macosx/tkMacOSXInit.c7
-rw-r--r--macosx/tkMacOSXPrivate.h6
-rw-r--r--macosx/tkMacOSXServices.c49
4 files changed, 41 insertions, 22 deletions
diff --git a/macosx/Wish-Info.plist.in b/macosx/Wish-Info.plist.in
index 40d7139..d6f48e9 100644
--- a/macosx/Wish-Info.plist.in
+++ b/macosx/Wish-Info.plist.in
@@ -106,6 +106,7 @@
<key>NSSendTypes</key>
<array>
+ <string>NSStringPboardType</string>
<string>NSPasteboardTypeString</string>
</array>
</dict>
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 3951f07..f33c0a0 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -116,6 +116,7 @@ static char scriptPath[PATH_MAX + 1] = "";
-(void)applicationDidFinishLaunching:(NSNotification *)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.
@@ -131,8 +132,8 @@ static char scriptPath[PATH_MAX + 1] = "";
[NSApp _lockAutoreleasePool];
while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT)) {}
[NSApp _unlockAutoreleasePool];
-
- Tk_MacOSXServices_Init(_eventInterp);
+
+ TkMacOSXServices_Init(_eventInterp);
}
- (void) _setup: (Tcl_Interp *) interp
@@ -449,7 +450,7 @@ int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *CONST o
CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
/* Convert the string reference into a C string. */
- char *path = CFStringGetCStringPtr(appPath, encodingMethod);
+ char *path = (char *) CFStringGetCStringPtr(appPath, encodingMethod);
Tcl_SetResult(ip, path, NULL);
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 8398a5e..1ee32e2 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -233,6 +233,9 @@ MODULE_SCOPE int TkMacOSXStandardAboutPanelObjCmd(ClientData clientData,
MODULE_SCOPE int TkMacOSXIconBitmapObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
+MODULE_SCOPE void TkMacOSXDrawSolidBorder(Tk_Window tkwin, GC gc,
+ int inset, int thickness);
+MODULE_SCOPE int TkMacOSXServices_Init(Tcl_Interp *interp);
MODULE_SCOPE int TkMacOSXRegisterServiceWidgetObjCmd(ClientData clientData,
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
@@ -337,8 +340,9 @@ VISIBILITY_HIDDEN
VISIBILITY_HIDDEN
@interface TKContentView : NSView <NSTextInput>
{
+@private
NSString *privateWorkingText;
- #ifdef __i386__
+#ifdef __i386__
/* The Objective C runtime used on i386 requires this. */
Bool _needsRedisplay;
#endif
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index 3340ba7..30e851d 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -50,9 +50,9 @@ int ServicesEventProc(
@implementation TkService
+ (void) initialize {
- NSArray *sendTypes = [NSArray arrayWithObjects:NSPasteboardTypeString, nil];
-
- [NSApp registerServicesMenuSendTypes:sendTypes returnTypes:nil];
+ NSArray *sendTypes = [NSArray arrayWithObjects:@"NSStringPboardType",
+ @"NSPasteboardTypeString", nil];
+ [NSApp registerServicesMenuSendTypes:sendTypes returnTypes:sendTypes];
NSUpdateDynamicServices();
return;
}
@@ -61,7 +61,8 @@ int ServicesEventProc(
- (id)validRequestorForSendType:(NSString *)sendType
returnType:(NSString *)returnType
{
- if ([sendType isEqual:NSStringPboardType]) {
+ if ([sendType isEqualToString:@"NSStringPboardType"] ||
+ [sendType isEqualToString:@"NSPasteboardTypeString"]) {
return self;
}
return [super validRequestorForSendType:sendType returnType:returnType];
@@ -87,19 +88,26 @@ int ServicesEventProc(
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard
types:(NSArray *)types
{
- NSArray *typesDeclared;
- if ([types containsObject:NSStringPboardType] == NO) {
+ NSArray *typesDeclared = nil;
+ NSString *pboardType = nil;
+ for (NSString *typeString in types) {
+ if ([typeString isEqualToString:@"NSStringPboardType"] ||
+ [typeString isEqualToString:@"NSPasteboardTypeString"]) {
+ typesDeclared = [NSArray arrayWithObject:typeString];
+ pboardType = typeString;
+ break;
+ }
+ }
+ if (!typesDeclared) {
return NO;
}
-
Tcl_Eval(ServicesInterp,"selection get");
char *copystring;
copystring = Tcl_GetString(Tcl_GetObjResult(ServicesInterp));
NSString *writestring = [NSString stringWithUTF8String:copystring];
- typesDeclared = [NSArray arrayWithObject:NSStringPboardType];
[pboard declareTypes:typesDeclared owner:nil];
- return [pboard setString:writestring forType:NSPasteboardTypeString];
+ return [pboard setString:writestring forType:pboardType];
}
@@ -112,7 +120,7 @@ int ServicesEventProc(
userData:(NSString *)data
error:(NSString **)error
{
- NSString *pboardString;
+ NSString *pboardString, *pboardType;
NSArray *types = [pboard types];
Tcl_Event *event;
@@ -121,19 +129,24 @@ int ServicesEventProc(
* available to Tcl service.
*/
- if ([types containsObject:NSStringPboardType] &&
- (pboardString = [pboard stringForType:NSStringPboardType])) {
-
+ for (NSString *typeString in types) {
+ if ([typeString isEqualToString:@"NSStringPboardType"] ||
+ [typeString isEqualToString:@"NSPasteboardTypeString"]) {
+ pboardString = [pboard stringForType:typeString];
+ pboardType = typeString;
+ break;
+ }
+ }
+ if (pboardString) {
NSPasteboard *generalpasteboard = [NSPasteboard generalPasteboard];
- [generalpasteboard declareTypes:[NSArray
- arrayWithObjects:NSStringPboardType, nil] owner:nil];
- [generalpasteboard setString:pboardString forType: NSPasteboardTypeString];
+ [generalpasteboard declareTypes:[NSArray arrayWithObjects:pboardType, nil]
+ owner:nil];
+ [generalpasteboard setString:pboardString forType:pboardType];
event = ckalloc(sizeof(Tcl_Event));
event->proc = ServicesEventProc;
Tcl_QueueEvent((Tcl_Event *)event, TCL_QUEUE_TAIL);
}
}
-
@end
@@ -205,7 +218,7 @@ int TkMacOSXRegisterServiceWidgetObjCmd (
* Initalize the package in the tcl interpreter, create tcl commands.
*/
-int Tk_MacOSXServices_Init(
+int TkMacOSXServices_Init(
Tcl_Interp *interp)
{
/*