diff options
author | Kevin Walzer <kw@codebykevin.com> | 2018-11-10 14:15:50 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2018-11-10 14:15:50 (GMT) |
commit | 8b8d040cfe3afe4615c0275dec4132c556ec088d (patch) | |
tree | d114d20a5f7558d70dbf26a6949674e2a7d8ee16 | |
parent | 2dee9a6869191253cd430d51db377dc484499c0f (diff) | |
download | tk-8b8d040cfe3afe4615c0275dec4132c556ec088d.zip tk-8b8d040cfe3afe4615c0275dec4132c556ec088d.tar.gz tk-8b8d040cfe3afe4615c0275dec4132c556ec088d.tar.bz2 |
Remove new Mojave virtual events to register system appearance changes because Tk crashes unpredictably; window decotrations, menus and dialogs change when system appearance changes and virtual events are not required
-rw-r--r-- | macosx/README | 13 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 46 |
3 files changed, 9 insertions, 54 deletions
diff --git a/macosx/README b/macosx/README index c63b8ae..8b2f52f 100644 --- a/macosx/README +++ b/macosx/README @@ -561,12 +561,13 @@ source and destination rectangles for the scrolling. The embedded windows are redrawn within the DisplayText function by some conditional code which is only used for macOS. -5.0 Virtual events on 10.14 +5.0 Dark Mode on 10.14 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10.14 supports system appearance changes, and has added a "Dark Mode" -that casts all window frames and menus as black. Tk 8.6.9 has added two -virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update -your Tk app's appearance when the system appearance changes. Just bind -your appearance-updating code to these virtual events and you will see -it triggered when the system appearance toggles between dark and light. +that casts all window frames and menus as black. Tk 8.6.9 supports Dark +Mode by having the window decorations, menus, and dialogs automatically +take on the appropriate appearance when the system appearance is changed. +Because the window content itself is drawn by Tk, it will not change when +the system mode changes. + diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index cd29791..d804ca0 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -333,9 +333,7 @@ VISIBILITY_HIDDEN @interface TKContentView(TKWindowEvent) - (void) drawRect: (NSRect) rect; -- (void) generateExposeEvents: (HIShapeRef) shape; -- (void) viewDidChangeEffectiveAppearance; -- (void) updateAppearanceEvent; +- (void) generateExposeEvents: (HIShapeRef) shape; - (void) tkToolbarButton: (id) sender; - (BOOL) isOpaque; - (BOOL) wantsDefaultClipping; diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index c463875..9ec77cf 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -991,51 +991,7 @@ ConfigureRestrictProc( */ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } -} - - -/* - * These two methods allow Tk to register a virtual event which fires when the - * appearance changes on 10.14. - */ - -- (void) viewDidChangeEffectiveAppearance -{ - [self updateAppearanceEvent]; -} - -- (void) updateAppearanceEvent -{ - NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]; - NSWindow *w = [self window]; - TkWindow *winPtr = TkMacOSXGetTkWindow(w); - XVirtualEvent event; - int x, y; - Tk_Window tkwin = (Tk_Window) winPtr; - bzero(&event, sizeof(XVirtualEvent)); - event.type = VirtualEvent; - event.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); - event.send_event = false; - event.display = Tk_Display(tkwin); - event.event = Tk_WindowId(tkwin); - event.root = XRootWindow(Tk_Display(tkwin), 0); - event.subwindow = None; - event.time = TkpGetMS(); - XQueryPointer(NULL, winPtr->window, NULL, NULL, - &event.x_root, &event.y_root, &x, &y, &event.state); - Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y); - event.same_screen = true; - if (osxMode == nil) { - event.name = Tk_GetUid("LightAqua"); - Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); - return; - } - if ([osxMode isEqual:@"Dark"]) { - event.name = Tk_GetUid("DarkAqua"); - Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); - return; - } -} +} /* * This is no-op on 10.7 and up because Apple has removed this widget, |