diff options
Diffstat (limited to 'macosx/tkMacOSXScrlbr.c')
-rw-r--r-- | macosx/tkMacOSXScrlbr.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index 3658f7e..405558b 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -20,7 +20,7 @@ #define TK_MAC_DEBUG_SCROLLBAR #endif */ - + NSRect TkMacOSXGetScrollFrame(TkScrollbar *scrlPtr); /* @@ -49,9 +49,9 @@ NSRect TkMacOSXGetScrollFrame(TkScrollbar *scrlPtr); Tk_Window tkwin = scrollPtr->tkwin; NSRect Tkframe = TkMacOSXGetScrollFrame(scrollPtr); /* Do not draw if the widget is misplaced or unmapped. */ - if ( NSIsEmptyRect(Tkframe) || + if ( NSIsEmptyRect(Tkframe) || ! macWin->winPtr->flags & TK_MAPPED || - ! NSEqualRects(Tkframe, [self frame]) + ! NSEqualRects(Tkframe, [self frame]) ) { return; } @@ -116,7 +116,7 @@ static void ScrollbarEventProc(ClientData clientData, * The class procedure table for the scrollbar widget. */ -Tk_ClassProcs tkpScrollbarProcs = { +const Tk_ClassProcs tkpScrollbarProcs = { sizeof(Tk_ClassProcs), /* size */ NULL, /* worldChangedProc */ NULL, /* createProc */ @@ -177,7 +177,7 @@ Tk_ClassProcs tkpScrollbarProcs = { Tcl_DStringLength(&cmdString), TCL_EVAL_GLOBAL); if (result != TCL_OK && result != TCL_CONTINUE && result != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (scrollbar command)"); - Tcl_BackgroundError(interp); + Tcl_BackgroundException(interp, result); } Tcl_Release(scrollPtr); Tcl_Release(interp); @@ -287,11 +287,11 @@ TkScrollbar * TkpCreateScrollbar( Tk_Window tkwin) { - MacScrollbar *scrollPtr = (MacScrollbar *) ckalloc(sizeof(MacScrollbar)); + MacScrollbar *scrollPtr = ckalloc(sizeof(MacScrollbar)); scrollPtr->scroller = nil; Tk_CreateEventHandler(tkwin, StructureNotifyMask|FocusChangeMask| - ActivateMask|ExposureMask, ScrollbarEventProc, (ClientData) scrollPtr); + ActivateMask|ExposureMask, ScrollbarEventProc, scrollPtr); return (TkScrollbar *) scrollPtr; } @@ -344,8 +344,8 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - TkScrollbar *scrollPtr = (TkScrollbar *) clientData; - MacScrollbar *macScrollPtr = (MacScrollbar *) clientData; + TkScrollbar *scrollPtr = clientData; + MacScrollbar *macScrollPtr = clientData; TkNSScroller *scroller = macScrollPtr->scroller; Tk_Window tkwin = scrollPtr->tkwin; TkWindow *winPtr = (TkWindow *) tkwin; @@ -393,6 +393,26 @@ TkpDisplayScrollbar( frame = NSInsetRect(frame, scrollPtr->inset, scrollPtr->inset); frame.origin.y = viewHeight - (frame.origin.y + frame.size.height); + NSWindow *w = [view window]; + + //This uses a private API call that is no longer needed on systems >= 10.7. + #if 0 + if ([w showsResizeIndicator]) { + NSRect growBox = [view convertRect:[w _growBoxRect] fromView:nil]; + + if (NSIntersectsRect(growBox, frame)) { + if (scrollPtr->vertical) { + CGFloat y = frame.origin.y; + + frame.origin.y = growBox.origin.y + growBox.size.height; + frame.size.height -= frame.origin.y - y; + } else { + frame.size.width = growBox.origin.x - frame.origin.x; + } + TkMacOSXSetScrollbarGrow(winPtr, true); + } + } + #endif if (!NSEqualRects(frame, [scroller frame])) { [scroller setFrame:frame]; } @@ -643,7 +663,7 @@ ScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScrollbar *scrollPtr = (TkScrollbar *) clientData; + TkScrollbar *scrollPtr = clientData; switch (eventPtr->type) { case UnmapNotify: @@ -651,7 +671,7 @@ ScrollbarEventProc( break; case ActivateNotify: case DeactivateNotify: - TkScrollbarEventuallyRedraw((ClientData) scrollPtr); + TkScrollbarEventuallyRedraw(scrollPtr); break; default: TkScrollbarEventProc(clientData, eventPtr); |