diff options
-rw-r--r-- | generic/tkPanedWindow.c | 24 | ||||
-rw-r--r-- | macosx/tkMacOSXDialog.c | 44 | ||||
-rw-r--r-- | macosx/tkMacOSXXStubs.c | 6 |
3 files changed, 44 insertions, 30 deletions
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index f350d0a..17e2b4a 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -1789,10 +1789,18 @@ ArrangePanes( */ if (horizontal) { - paneSize = slavePtr->paneWidth; + if (slavePtr->width > 0) { + paneSize = slavePtr->width; + } else { + paneSize = slavePtr->paneWidth; + } stretchReserve -= paneSize + (2 * slavePtr->padx); } else { - paneSize = slavePtr->paneHeight; + if (slavePtr->height > 0) { + paneSize = slavePtr->height; + } else { + paneSize = slavePtr->paneHeight; + } stretchReserve -= paneSize + (2 * slavePtr->pady); } if (IsStretchable(slavePtr->stretch,i,first,last) @@ -1842,10 +1850,18 @@ ArrangePanes( */ if (horizontal) { - paneSize = slavePtr->paneWidth; + if (slavePtr->width > 0) { + paneSize = slavePtr->width; + } else { + paneSize = slavePtr->paneWidth; + } pwSize = pwWidth; } else { - paneSize = slavePtr->paneHeight; + if (slavePtr->height > 0) { + paneSize = slavePtr->height; + } else { + paneSize = slavePtr->paneHeight; + } pwSize = pwHeight; } if (IsStretchable(slavePtr->stretch, i, first, last)) { diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 027a8e4..3397f71 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -159,22 +159,6 @@ static const short alertNativeButtonIndexAndTypeToButtonIndex[][3] = { [TYPE_YESNOCANCEL] = {5, 6, 4}, }; -/* - * Construct a file URL from directory and filename. Either may - * be nil. If both are nil, returns nil. - */ -#if MAC_OS_X_VERSION_MIN_REQUIRED > 1050 -static NSURL *getFileURL(NSString *directory, NSString *filename) { - NSURL *url = nil; - if (directory) { - url = [NSURL fileURLWithPath:directory]; - } - if (filename) { - url = [NSURL URLWithString:filename relativeToURL:url]; - } - return url; -} -#endif #pragma mark TKApplication(TKDialog) @@ -675,7 +659,10 @@ Tk_GetOpenFileObjCmd( @selector(tkFilePanelDidEnd:returnCode:contextInfo:) contextInfo:callbackInfo]; #else - [openpanel setDirectoryURL:getFileURL(directory, filename)]; + if (directory) { + [openpanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; + } + [openpanel setNameFieldStringValue:filename]; [openpanel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:openpanel @@ -688,7 +675,10 @@ Tk_GetOpenFileObjCmd( modalReturnCode = [openpanel runModalForDirectory:directory file:filename]; #else - [openpanel setDirectoryURL:getFileURL(directory, filename)]; + if (directory) { + [openpanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; + } + [openpanel setNameFieldStringValue:filename]; modalReturnCode = [openpanel runModal]; #endif [NSApp tkFilePanelDidEnd:openpanel returnCode:modalReturnCode @@ -905,7 +895,10 @@ Tk_GetSaveFileObjCmd( @selector(tkFilePanelDidEnd:returnCode:contextInfo:) contextInfo:callbackInfo]; #else - [savepanel setDirectoryURL:getFileURL(directory, filename)]; + if (directory) { + [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; + } + [savepanel setNameFieldStringValue:filename]; [savepanel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:savepanel @@ -917,7 +910,10 @@ Tk_GetSaveFileObjCmd( #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 modalReturnCode = [savepanel runModalForDirectory:directory file:filename]; #else - [savepanel setDirectoryURL:getFileURL(directory, filename)]; + if (directory) { + [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; + } + [savepanel setNameFieldStringValue:filename]; modalReturnCode = [savepanel runModal]; #if 0 NSLog(@"modal: %li", modalReturnCode); @@ -980,7 +976,7 @@ Tk_ChooseDirectoryObjCmd( Tcl_Obj *cmdObj = NULL; FilePanelCallbackInfo callbackInfoStruct; FilePanelCallbackInfo *callbackInfo = &callbackInfoStruct; - NSString *directory = nil, *filename = nil; + NSString *directory = nil; NSString *message, *title; NSWindow *parent; NSOpenPanel *panel = [NSOpenPanel openPanel]; @@ -1056,13 +1052,13 @@ Tk_ChooseDirectoryObjCmd( parentIsKey = [parent isKeyWindow]; #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 [panel beginSheetForDirectory:directory - file:filename + file:nil modalForWindow:parent modalDelegate:NSApp didEndSelector: @selector(tkFilePanelDidEnd:returnCode:contextInfo:) contextInfo:callbackInfo]; #else - [panel setDirectoryURL:getFileURL(directory, filename)]; + [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; [panel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:panel @@ -1074,7 +1070,7 @@ Tk_ChooseDirectoryObjCmd( #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 modalReturnCode = [panel runModalForDirectory:directory file:nil]; #else - [panel setDirectoryURL:getFileURL(directory, filename)]; + [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; modalReturnCode = [panel runModal]; #endif [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 8d9820b..1c2d908 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -890,16 +890,18 @@ XGetImage( int bitmap_pad = 0; int bytes_per_row = 4*width; int size; - MacDrawable *macDraw = (MacDrawable *) d; + MacDrawable *macDraw = (MacDrawable *) d; // Where is this variable used? May it be removed? + int scalefactor = 1; +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 NSWindow *win = TkMacOSXDrawableWindow(d); /* This code assumes that backing scale factors are integers. Currently * Retina displays use a scale factor of 2.0 and normal displays use 1.0. * We do not support any other values here. */ - int scalefactor = 1; if (win && [win respondsToSelector:@selector(backingScaleFactor)]) { scalefactor = ([win backingScaleFactor] == 2.0) ? 2 : 1; } +#endif int scaled_height = height * scalefactor; int scaled_width = width * scalefactor; |