diff options
-rw-r--r-- | macosx/tkMacOSXDialog.c | 64 | ||||
-rw-r--r-- | macosx/tkMacOSXEmbed.c | 23 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 3 | ||||
-rw-r--r-- | macosx/tkMacOSXScrlbr.c | 10 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 8 |
5 files changed, 20 insertions, 88 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index ea456a6..2f77203 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -1,4 +1,4 @@ -/* +/* * tkMacOSXDialog.c -- * * Contains the Mac implementation of the common dialog boxes. @@ -24,12 +24,12 @@ enum colorOptions { static const char *const openOptionStrings[] = { "-defaultextension", "-filetypes", "-initialdir", "-initialfile", "-message", "-multiple", "-parent", "-title", "-typevariable", - "-command", "-allbutton", "-allbuttontip", NULL + "-command", NULL }; enum openOptions { OPEN_DEFAULT, OPEN_FILETYPES, OPEN_INITDIR, OPEN_INITFILE, OPEN_MESSAGE, OPEN_MULTIPLE, OPEN_PARENT, OPEN_TITLE, - OPEN_TYPEVARIABLE, OPEN_COMMAND, OPEN_ALLBUTTON, OPEN_ALLBUTTONTIP + OPEN_TYPEVARIABLE, OPEN_COMMAND, }; static const char *const saveOptionStrings[] = { "-defaultextension", "-filetypes", "-initialdir", "-initialfile", @@ -221,35 +221,6 @@ static const short alertNativeButtonIndexAndTypeToButtonIndex[][3] = { } @end - @interface TKOpenDialog : NSControl - @property(assign) NSOpenPanel *openPanel; - @property(assign) NSMutableArray *openFileTypes; - - (void)openUnrecognizedFiles:(id)sender; - @end - - @implementation TKOpenDialog - - (id)init { - self = [super init]; - if (self) { - _openPanel = nil; - _openFileTypes = nil; - } - return self; - } - - - (void)openUnrecognizedFiles:(id)sender - { - if ([sender state]) { - self.openPanel.allowedFileTypes = [NSArray arrayWithObjects:@"public.data", nil]; - } else { - self.openPanel.allowedFileTypes = self.openFileTypes; - } - [self.openPanel setDirectoryURL:self.openPanel.directoryURL]; - [self.openPanel validateVisibleColumns]; - } - - @end - #pragma mark - /* @@ -395,14 +366,11 @@ Tk_GetOpenFileObjCmd( FilePanelCallbackInfo *callbackInfo = &callbackInfoStruct; NSString *directory = nil, *filename = nil; NSString *message, *title, *type; - NSString *allbutton, *allbuttontip; NSWindow *parent; NSMutableArray *fileTypes = nil; NSOpenPanel *panel = [NSOpenPanel openPanel]; NSInteger returnCode = NSAlertErrorReturn; - allbutton = nil; - allbuttontip = nil; TkInitFileFilters(&fl); for (i = 1; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], openOptionStrings, @@ -469,14 +437,6 @@ Tk_GetOpenFileObjCmd( case OPEN_COMMAND: cmdObj = objv[i+1]; break; - case OPEN_ALLBUTTON: - allbutton = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; - break; - case OPEN_ALLBUTTONTIP: - allbuttontip = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; - break; } } if (fl.filters) { @@ -512,24 +472,6 @@ Tk_GetOpenFileObjCmd( } } [panel setAllowsMultipleSelection:multiple]; - - if (allbutton) { - TKOpenDialog *tkDialog = [TKOpenDialog alloc]; - tkDialog.openPanel = panel; - tkDialog.openFileTypes = fileTypes; - - NSButton *openPanelAccessoryView = [[[NSButton alloc] initWithFrame:NSMakeRect(0.0, 0.0, 224.0, 22.0)] autorelease]; - if (allbuttontip) { - [openPanelAccessoryView setToolTip:allbuttontip]; - } - [openPanelAccessoryView setButtonType:NSSwitchButton]; - [openPanelAccessoryView setBezelStyle:0]; - [openPanelAccessoryView setTitle:allbutton]; - [openPanelAccessoryView setAction:@selector(openUnrecognizedFiles:)]; - [openPanelAccessoryView setTarget:tkDialog]; - [panel setAccessoryView:openPanelAccessoryView]; - } - if (cmdObj) { callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); if (Tcl_IsShared(cmdObj)) { diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index f9700f6..41a1e1b 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ - + #include "tkMacOSXPrivate.h" #include "tkBusy.h" @@ -207,7 +207,6 @@ TkpUseWindow( MacDrawable *parent, *macWin; Container *containerPtr; - if (winPtr->window != None) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't modify container after widget is created", -1)); @@ -248,14 +247,14 @@ TkpUseWindow( * Container structure, since we only allow the case where both container * and embedded app. are in the same process. */ - + for (containerPtr = firstContainerPtr; containerPtr != NULL; - containerPtr = containerPtr->nextPtr) { - if (containerPtr->parent == (Window) parent) { - winPtr->flags |= TK_BOTH_HALVES; - containerPtr->parentPtr->flags |= TK_BOTH_HALVES; - break; - } + containerPtr = containerPtr->nextPtr) { + if (containerPtr->parent == (Window) parent) { + winPtr->flags |= TK_BOTH_HALVES; + containerPtr->parentPtr->flags |= TK_BOTH_HALVES; + break; + } } /* @@ -314,10 +313,9 @@ TkpUseWindow( if (tkMacOSXEmbedHandler == NULL || tkMacOSXEmbedHandler->registerWinProc((long) parent, (Tk_Window) winPtr) != TCL_OK) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "The window ID %s does not correspond to a valid Tk Window", - string)); + "The window ID %s does not correspond to a valid Tk Window", + string)); Tcl_SetErrorCode(interp, "TK", "EMBED", "HANDLE", NULL); return TCL_ERROR; } @@ -393,6 +391,7 @@ TkpMakeContainer( * sure the argument to -use is valid. */ + Tk_MakeWindowExist(tkwin); containerPtr = ckalloc(sizeof(Container)); containerPtr->parent = Tk_WindowId(tkwin); containerPtr->parentPtr = winPtr; diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 599317d..1aee7f4 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -1,5 +1,5 @@ /* - * tkMacOSXPrivate.h -- + * tkMacOSXPrivate.h -- * * Macros and declarations that are purely internal & private to TkAqua. * @@ -326,7 +326,6 @@ VISIBILITY_HIDDEN BOOL _subviewsSetAside; #endif NSString *privateWorkingText; - BOOL _in_event; } @end diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index 00f6088..f9a2f5f 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -1,5 +1,5 @@ /* - * tkMacOSXScrollbar.c -- + * tkMacOSXScrollbar.c -- * * This file implements the Macintosh specific portion of the scrollbar * widget. @@ -50,15 +50,11 @@ NSRect TkMacOSXGetScrollFrame(TkScrollbar *scrlPtr); NSRect Tkframe = TkMacOSXGetScrollFrame(scrollPtr); /* Do not draw if the widget is misplaced or unmapped. */ if ( NSIsEmptyRect(Tkframe) || - ! (macWin->winPtr->flags & TK_MAPPED) + ! macWin->winPtr->flags & TK_MAPPED || + ! NSEqualRects(Tkframe, [self frame]) ) { return; } - for (Tk_Window parent_win = tkwin; parent_win != NULL;parent_win = Tk_Parent(parent_win)) { - if (!Tk_IsMapped(parent_win)) { - return; - } - } /* * Do not draw if the widget is completely outside of its parent. diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 361b2e2..b257caa 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ - + #include "tkMacOSXPrivate.h" #include "tkMacOSXWm.h" #include "tkMacOSXEvent.h" @@ -831,11 +831,7 @@ ExposeRestrictProc( HIShapeUnionWithRect(drawShape, &r); } if (CFRunLoopGetMain() == CFRunLoopGetCurrent()) { - if (!_in_event) { - _in_event = true; - [self generateExposeEvents:drawShape]; - _in_event = false; - } + [self generateExposeEvents:drawShape]; } else { [self performSelectorOnMainThread:@selector(generateExposeEvents:) withObject:(id)drawShape waitUntilDone:NO |