From 226cb2b752c57912f6b32e77b467e7e77d619079 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Sun, 28 Dec 2014 05:24:34 +0000 Subject: Refinement of redraw during window resizing in Cocoa; refinement of button display --- macosx/tkMacOSXButton.c | 5 +++-- macosx/tkMacOSXWindowEvent.c | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 627565a..80324cc 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -67,14 +67,15 @@ static NSRect TkMacOSXGetButtonFrame(TkButton *butPtr); return; } - /* Do not draw if the widget is completely outside of its parent, or within 50 pixels of the right border; this prevents buttons from being drawn on peer widgets as scrolling occurs. */ + /* Do not draw if the widget is completely outside of its parent, or within 20 pixels of the right border; this prevents buttons from being drawn on peer widgets as scrolling occurs. */ int parent_width = Tk_Width(Tk_Parent(tkwin)); int widget_width = Tk_Width(tkwin); int x = Tk_X(tkwin); - if (x > parent_width - 50 || x < 0) { + if (x > parent_width - 20 || x < 0) { return; } } + [super drawRect:dirtyRect]; } } diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 7207859..bce64f2 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -817,7 +817,6 @@ ExposeRestrictProc( while (rectsBeingDrawnCount--) { CGRect r = NSRectToCGRect(*rectsBeingDrawn++); - r.origin.y = height - (r.origin.y + r.size.height); HIShapeUnionWithRect(drawShape, &r); } @@ -838,6 +837,13 @@ ExposeRestrictProc( /*Provide more fine-grained control over resizing of content to reduce flicker after removal of private API's.*/ +-(void) viewWillDraw +{ + + [super viewWillDraw]; +} + + - (BOOL) preservesContentDuringLiveResize { return YES; @@ -845,21 +851,24 @@ ExposeRestrictProc( - (void)viewWillStartLiveResize { + NSDisableScreenUpdates(); [super viewWillStartLiveResize]; [self setNeedsDisplay:NO]; + [self setHidden:YES]; } - (void)viewDidEndLiveResize { + NSEnableScreenUpdates(); + [self setHidden:NO]; [self setNeedsDisplay:YES]; [super setNeedsDisplay:YES]; [super viewDidEndLiveResize]; } - /*Core function of this class, generates expose events for redrawing.*/ - (void) generateExposeEvents: (HIMutableShapeRef) shape { @@ -872,6 +881,7 @@ ExposeRestrictProc( return; } + HIShapeGetBounds(shape, &updateBounds); serial = LastKnownRequestProcessed(Tk_Display(winPtr)); if (GenerateUpdates(shape, &updateBounds, winPtr) && @@ -896,6 +906,7 @@ ExposeRestrictProc( while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {} Tk_RestrictEvents(oldProc, oldArg, &oldArg); + while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} } -- cgit v0.12