summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2019-04-24 15:52:16 (GMT)
committerculler <culler>2019-04-24 15:52:16 (GMT)
commit40eb1fce5bbde4a49fd24fa146e34c292b729131 (patch)
treeab9c819798e065f3db34a192c7a9a367250e2856 /macosx
parente2d80191d706d8c9efed09c06b55ba96f48fdc7f (diff)
downloadtk-40eb1fce5bbde4a49fd24fa146e34c292b729131.zip
tk-40eb1fce5bbde4a49fd24fa146e34c292b729131.tar.gz
tk-40eb1fce5bbde4a49fd24fa146e34c292b729131.tar.bz2
Fix bug [4d2e8d4d5c]: Aqua notebooks sometimes do not draw a new pane immediately
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXKeyEvent.c10
-rw-r--r--macosx/tkMacOSXPrivate.h6
-rw-r--r--macosx/tkMacOSXSubwindows.c39
-rw-r--r--macosx/tkMacOSXWindowEvent.c39
4 files changed, 73 insertions, 21 deletions
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 6cf3783..8691ce2 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -257,6 +257,14 @@ unsigned short releaseCode;
@implementation TKContentView
+
+-(id)init {
+ if (self = [super init]) {
+ _needsRedisplay = NO;
+ }
+ return self;
+}
+
/* <NSTextInput> implementation (called through interpretKeyEvents:]). */
/* <NSTextInput>: called when done composing;
@@ -449,6 +457,8 @@ unsigned short releaseCode;
return str;
}
/* End <NSTextInput> impl. */
+
+@synthesize needsRedisplay = _needsRedisplay;
@end
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 105317d..fe913ec 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -332,8 +332,14 @@ VISIBILITY_HIDDEN
VISIBILITY_HIDDEN
@interface TKContentView : NSView <NSTextInput>
{
+@private
NSString *privateWorkingText;
+#ifdef __i386__
+ /* The Objective C runtime used on i386 requires this. */
+ Bool _needsRedisplay;
+#endif
}
+@property Bool needsRedisplay;
@end
@interface TKContentView(TKKeyEvent)
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 06aaa9d..853abc2 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -130,6 +130,8 @@ XMapWindow(
Window window) /* Window. */
{
MacDrawable *macWin = (MacDrawable *) window;
+ TkWindow *winPtr = macWin->winPtr;
+ NSWindow *win = TkMacOSXDrawableWindow(window);
XEvent event;
/*
@@ -145,10 +147,9 @@ XMapWindow(
}
display->request++;
- macWin->winPtr->flags |= TK_MAPPED;
- if (Tk_IsTopLevel(macWin->winPtr)) {
- if (!Tk_IsEmbedded(macWin->winPtr)) {
- NSWindow *win = TkMacOSXDrawableWindow(window);
+ winPtr->flags |= TK_MAPPED;
+ if (Tk_IsTopLevel(winPtr)) {
+ if (!Tk_IsEmbedded(winPtr)) {
/*
* We want to activate Tk when a toplevel is mapped but we must not
@@ -158,7 +159,7 @@ XMapWindow(
* bar unresponsive.
*/
- TkMacOSXApplyWindowAttributes(macWin->winPtr, win);
+ TkMacOSXApplyWindowAttributes(winPtr, win);
[win setExcludedFromWindowsMenu:NO];
[NSApp activateIgnoringOtherApps:NO];
[[win contentView] setNeedsDisplay:YES];
@@ -177,18 +178,18 @@ XMapWindow(
while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT)) {}
[NSApp _unlockAutoreleasePool];
} else {
+ TkWindow *contWinPtr = TkpGetOtherWindow(winPtr);
/*
* Rebuild the container's clipping region and display
* the window.
*/
- TkWindow *contWinPtr = TkpGetOtherWindow(macWin->winPtr);
-
TkMacOSXInvalClipRgns((Tk_Window) contWinPtr);
TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
}
- TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr);
+
+ TkMacOSXInvalClipRgns((Tk_Window) winPtr);
/*
* We only need to send the MapNotify event for toplevel windows.
@@ -201,15 +202,21 @@ XMapWindow(
event.xmap.window = window;
event.xmap.type = MapNotify;
event.xmap.event = window;
- event.xmap.override_redirect = macWin->winPtr->atts.override_redirect;
+ event.xmap.override_redirect = winPtr->atts.override_redirect;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
} else {
+
/*
- * Rebuild the parent's clipping region and display the window.
+ * For non-toplevel windows, rebuild the parent's clipping region
+ * and redisplay the window.
*/
- TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr);
- TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr);
+ if ([NSApp isDrawing]) {
+ [[win contentView] setNeedsRedisplay:YES];
+ } else {
+ [[win contentView] setNeedsDisplay:YES];
+ }
}
/*
@@ -220,13 +227,7 @@ XMapWindow(
event.xany.display = display;
event.xvisibility.type = VisibilityNotify;
event.xvisibility.state = VisibilityUnobscured;
- NotifyVisibility(macWin->winPtr, &event);
-
- /*
- * This seems to be needed to ensure that all subwindows get displayed.
- */
-
- GenerateConfigureNotify(macWin->winPtr, 1);
+ NotifyVisibility(winPtr, &event);
}
/*
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 6b80761..327132c 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -856,7 +856,10 @@ Tk_MacOSXIsAppInFront(void)
*
*/
-/*Restrict event processing to Expose events.*/
+/*
+ * Restrict event processing to Expose events.
+ */
+
static Tk_RestrictAction
ExposeRestrictProc(
ClientData arg,
@@ -866,7 +869,10 @@ ExposeRestrictProc(
? TK_PROCESS_EVENT : TK_DEFER_EVENT);
}
-/*Restrict event processing to ConfigureNotify events.*/
+/*
+ * Restrict event processing to ConfigureNotify events.
+ */
+
static Tk_RestrictAction
ConfigureRestrictProc(
ClientData arg,
@@ -875,6 +881,30 @@ ConfigureRestrictProc(
return (eventPtr->type==ConfigureNotify ? TK_PROCESS_EVENT : TK_DEFER_EVENT);
}
+/*
+ * If a window gets mapped inside the drawRect method, this will be run as an
+ * idle task, after drawRect returns, to clean up the mess.
+ */
+
+static void
+RedisplayView(
+ ClientData clientdata)
+{
+ NSView *view = (NSView *) clientdata;
+
+ /*
+ * Make sure that we are not trying to displaying a view that no longer
+ * exists.
+ */
+
+ for (NSWindow *w in [NSApp orderedWindows]) {
+ if ([w contentView] == view) {
+ [view setNeedsDisplay:YES];
+ break;
+ }
+ }
+}
+
@implementation TKContentView(TKWindowEvent)
- (void) drawRect: (NSRect) rect
@@ -921,6 +951,11 @@ ConfigureRestrictProc(
CFRelease(drawShape);
[NSApp setIsDrawing: NO];
+ if ([self needsRedisplay]) {
+ [self setNeedsRedisplay:NO];
+ Tcl_DoWhenIdle(RedisplayView, self);
+ }
+
#ifdef TK_MAC_DEBUG_DRAWING
fprintf(stderr, "drawRect: done.\n");
#endif