diff options
author | culler <culler> | 2020-05-29 18:21:55 (GMT) |
---|---|---|
committer | culler <culler> | 2020-05-29 18:21:55 (GMT) |
commit | 9ba4c746ec344f1455e03c2f97ca0ae7c95d139f (patch) | |
tree | c2f3dab350bf3a9bd83fa139c24f9432b31eac06 /macosx/tkMacOSXWm.c | |
parent | bd0d1fd4d2137bebd775874b705c061a7e13aa7f (diff) | |
download | tk-9ba4c746ec344f1455e03c2f97ca0ae7c95d139f.zip tk-9ba4c746ec344f1455e03c2f97ca0ae7c95d139f.tar.gz tk-9ba4c746ec344f1455e03c2f97ca0ae7c95d139f.tar.bz2 |
Remove some unnecessary macOS conditional code by using internal stubs.
Diffstat (limited to 'macosx/tkMacOSXWm.c')
-rw-r--r-- | macosx/tkMacOSXWm.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 9117159..cab2b9a 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6174,28 +6174,40 @@ TkMacOSXMakeRealWindowExist( /* *---------------------------------------------------------------------- * - * TkpDisplayWindow -- + * TkpRedrawWidget -- * - * Mark the contentView of this window as needing display so the window - * will be drawn by the window manager. If this is called within the - * drawRect method, do nothing. + * Mark the bounding rectangle of this widget as needing display so the + * widget will be drawn by [NSView drawRect:]. If this is called within + * the drawRect method, do nothing. * * Results: * None. * * Side effects: - * The window's contentView is marked as needing display. + * The widget's bounding rectangle is marked as dirty. * *---------------------------------------------------------------------- */ -MODULE_SCOPE void -TkpDisplayWindow(Tk_Window tkwin) { - if (![NSApp isDrawing]) { - TkWindow *winPtr = (TkWindow *) tkwin; - NSWindow *w = TkMacOSXDrawableWindow(winPtr->window); +void +TkpRedrawWidget(Tk_Window tkwin) { + TkWindow *winPtr = (TkWindow *) tkwin; + NSWindow *w; + Rect tkBounds; + NSRect bounds; - [[w contentView] setNeedsDisplay: YES]; + if ([NSApp isDrawing]) { + return; + } + w = TkMacOSXDrawableWindow(winPtr->window); + if (w) { + NSView *view = [w contentView]; + TkMacOSXWinBounds(winPtr, &tkBounds); + bounds = NSMakeRect(tkBounds.left, + [view bounds].size.height - tkBounds.bottom, + tkBounds.right - tkBounds.left, + tkBounds.bottom - tkBounds.top); + [view setNeedsDisplayInRect:bounds]; } } |