diff options
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | library/demos/widget | 14 | ||||
-rw-r--r-- | macosx/tkMacOSXColor.c | 7 | ||||
-rw-r--r-- | macosx/tkMacOSXInt.h | 5 | ||||
-rw-r--r-- | macosx/tkMacOSXKeyEvent.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 8 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 95 |
7 files changed, 102 insertions, 48 deletions
@@ -1,3 +1,20 @@ +2006-09-11 Daniel Steffen <das@users.sourceforge.net> + + * macosx/tkMacOSXWm.c (TkMacOSXMakeRealWindowExist): revert part of + 2006-05-16 change that had set overrideredirect windows to not become + activated by the window manager, as this prevented interaction with + native widgets in such windows [Bug 1472624]; apply changes to carbon + window attributes even if native window has already been created. + + * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): fix app + * macosx/tkMacOSXMenu.c (DrawMenuBarWhenIdle): menu item key shortcuts + * macosx/tkMacOSXInt.h: when custom ".apple" menu is installed. + + * library/demos/widget: on TkAqua, don't install file menu with single + quit menu item, as the application menu already has a quit item. + + * macosx/tkMacOSXColor.c: fix building on Mac OS X 10.2. + 2006-09-10 Daniel Steffen <das@users.sourceforge.net> * macosx/tkMacOSXColor.c (TkSetMacColor, TkpGetColor): use AppearanceMgr diff --git a/library/demos/widget b/library/demos/widget index 7795851..1e96c59 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -11,7 +11,7 @@ exec wish "$0" "$@" # ".tcl" files is this directory, which are sourced by this script # as needed. # -# RCS: @(#) $Id: widget,v 1.9.2.1 2003/09/25 05:37:48 das Exp $ +# RCS: @(#) $Id: widget,v 1.9.2.2 2006/09/11 14:41:16 das Exp $ eval destroy [winfo child .] wm title . "Widget Demonstration" @@ -43,24 +43,24 @@ set font $widgetFont(main) #---------------------------------------------------------------- menu .menuBar -tearoff 0 -.menuBar add cascade -menu .menuBar.file -label "File" -underline 0 -menu .menuBar.file -tearoff 0 -# On the Mac use the specia .apple menu for the about item +# On the Mac use the special .apple menu for the about item if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} { .menuBar add cascade -menu .menuBar.apple menu .menuBar.apple -tearoff 0 .menuBar.apple add command -label "About..." -command "aboutBox" } else { + .menuBar add cascade -menu .menuBar.file -label "File" -underline 0 + menu .menuBar.file -tearoff 0 .menuBar.file add command -label "About..." -command "aboutBox" \ -underline 0 -accelerator "<F1>" .menuBar.file add sep + .menuBar.file add command -label "Quit" -command "exit" -underline 0 \ + -accelerator "Meta-Q" + bind . <F1> aboutBox } -.menuBar.file add command -label "Quit" -command "exit" -underline 0 \ - -accelerator "Meta-Q" . configure -menu .menuBar -bind . <F1> aboutBox frame .statusBar label .statusBar.lab -text " " -relief sunken -bd 1 \ diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 2e059c2..33e39a7 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -12,12 +12,17 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.3 2006/09/10 17:07:36 das Exp $ + * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.4 2006/09/11 14:41:16 das Exp $ */ #include "tkMacOSXInt.h" #include "tkColor.h" +/* Define constants only available on Mac OS X 10.3 or later */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 + #define kThemeBrushAlternatePrimaryHighlightColor -5 +#endif + /* * Default Auxillary Control Record for all controls. This is cached once * and is updated by the system. We use this to get the default system diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h index a892404..337efbe 100644 --- a/macosx/tkMacOSXInt.h +++ b/macosx/tkMacOSXInt.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3.2.13 2006/07/24 04:45:26 das Exp $ + * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3.2.14 2006/09/11 14:41:16 das Exp $ */ #ifndef _TKMACINT @@ -125,7 +125,8 @@ MODULE_SCOPE TkMacOSXEmbedHandler *gMacEmbedHandler; * Globals shared among Macintosh Tk */ -MODULE_SCOPE MenuHandle tkAppleMenu; /* Handle to the Apple Menu */ +MODULE_SCOPE MenuHandle tkCurrentAppleMenu; /* Handle to current Apple Menu */ +MODULE_SCOPE MenuHandle tkAppleMenu; /* Handle to default Apple Menu */ MODULE_SCOPE MenuHandle tkFileMenu; /* Handles to menus */ MODULE_SCOPE MenuHandle tkEditMenu; /* Handles to menus */ MODULE_SCOPE RgnHandle tkMenuCascadeRgn;/* A region to clip with. */ diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index 692c194..b8d3828 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -54,7 +54,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.6.2.11 2006/07/25 12:09:05 das Exp $ + * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.6.2.12 2006/09/11 14:41:17 das Exp $ */ #include "tkMacOSXInt.h" @@ -184,7 +184,7 @@ TkMacOSXProcessKeyboardEvent( if ((eventPtr->eKind == kEventRawKeyDown || eventPtr->eKind == kEventRawKeyRepeat) - && IsMenuKeyEvent(tkAppleMenu, eventPtr->eventRef, + && IsMenuKeyEvent(tkCurrentAppleMenu, eventPtr->eventRef, kMenuEventQueryOnly, &menuRef, &menuItemIndex)) { MenuCommand menuCmd; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index a27b376..47f1927 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.6.2.22 2006/09/10 17:07:36 das Exp $ + * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.6.2.23 2006/09/11 14:41:17 das Exp $ */ #include "tkMacOSXInt.h" @@ -221,7 +221,9 @@ static TopLevelMenubarList *windowListPtr; static MenuItemDrawingUPP tkThemeMenuItemDrawingUPP; /* Points to the UPP for theme Item drawing. */ static Tcl_Obj *useMDEFVar; - + +MenuRef tkCurrentAppleMenu = NULL; + /* * Forward declarations for procedures defined later in this file: */ @@ -1733,6 +1735,7 @@ DrawMenuBarWhenIdle( if (appleIndex == -1) { InsertMenu(tkAppleMenu, 0); currentAppleMenuID = 0; + tkCurrentAppleMenu = tkAppleMenu; } else { short appleID; appleMenuPtr = menuBarPtr->entries[appleIndex] @@ -1757,6 +1760,7 @@ DrawMenuBarWhenIdle( InsertMenu(macMenuHdl, 0); RecursivelyInsertMenu(appleMenuPtr); currentAppleMenuID = appleID; + tkCurrentAppleMenu = macMenuHdl; } if (helpIndex == -1) { currentHelpMenuID = 0; diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 694bf53..fcb2040 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.32 2006/09/10 17:02:18 das Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.33 2006/09/11 14:41:17 das Exp $ */ #include "tkMacOSXInt.h" @@ -80,7 +80,7 @@ static int ParseGeometry _ANSI_ARGS_((Tcl_Interp *interp, char *string, TkWindow *winPtr)); static void TopLevelEventProc _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr)); -static void TkWmStackorderToplevelWrapperMap _ANSI_ARGS_(( +static void WmStackorderToplevelWrapperMap _ANSI_ARGS_(( TkWindow *winPtr, Display *display, Tcl_HashTable *table)); @@ -185,9 +185,12 @@ static int WmWithdrawCmd _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj *CONST objv[])); static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr, TkWindow *winPtr)); -static int TkMacOSXWinStyle _ANSI_ARGS_((Tcl_Interp *interp, +static int WmWinStyle _ANSI_ARGS_((Tcl_Interp *interp, TkWindow *winPtr, int objc, Tcl_Obj * CONST objv[])); +static void ApplyWindowAttributeChanges _ANSI_ARGS_(( + TkWindow *winPtr, int newAttributes, + int oldAttributes, int create)); /* *-------------------------------------------------------------- @@ -2172,6 +2175,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */ register WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean; XSetWindowAttributes atts; + int oldAttributes = wmPtr->attributes; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -2210,6 +2214,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */ } } } + ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, oldAttributes, 0); return TCL_OK; } @@ -2395,7 +2400,8 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv) Tcl_Obj *CONST objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - int width, height, oldAttributes; + int width, height; + int oldAttributes = wmPtr->attributes; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -2414,7 +2420,6 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv) || (Tcl_GetBooleanFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } - oldAttributes = wmPtr->attributes; if (width) { wmPtr->flags &= ~WM_WIDTH_NOT_RESIZABLE; wmPtr->attributes |= kWindowHorizontalZoomAttribute; @@ -2440,18 +2445,7 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv) wmPtr->scrollWinPtr->instanceData); } WmUpdateGeom(wmPtr, winPtr); - if (wmPtr->attributes != oldAttributes) { - if (winPtr->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr); - } - if (!TkMacOSXHostToplevelExists(winPtr)) { - TkMacOSXMakeRealWindowExist(winPtr); - } - ChangeWindowAttributes( - GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window)), - wmPtr->attributes & (wmPtr->attributes ^ oldAttributes), - oldAttributes & (wmPtr->attributes ^ oldAttributes)); - } + ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, oldAttributes, 1); return TCL_OK; } @@ -2825,6 +2819,7 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv) WmInfo *wmPtr2; char *argv3; int length; + int oldAttributes = wmPtr->attributes; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?master?"); @@ -2896,6 +2891,7 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv) wmPtr->attributes = kWindowStandardFloatingAttributes; } } + ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, oldAttributes, 0); return TCL_OK; } @@ -4841,7 +4837,7 @@ TkUnsupported1ObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "window ?class attributes?"); return TCL_ERROR; } - return TkMacOSXWinStyle(interp, winPtr, objc, objv); + return WmWinStyle(interp, winPtr, objc, objv); } /* won't be reached */ return TCL_ERROR; @@ -4850,7 +4846,7 @@ TkUnsupported1ObjCmd( /* *---------------------------------------------------------------------- * - * TkMacOSXWinStyle -- + * WmWinStyle -- * * This procedure is invoked to process the * "::tk::unsupported::MacWindowStyle style" subcommand. @@ -4865,8 +4861,8 @@ TkUnsupported1ObjCmd( * *---------------------------------------------------------------------- */ -int -TkMacOSXWinStyle( +static int +WmWinStyle( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ int objc, /* Number of arguments. */ @@ -5035,6 +5031,8 @@ TkMacOSXWinStyle( return TCL_ERROR; } } + ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, + oldAttributes, 0); wmPtr->style = -1; } @@ -5189,15 +5187,6 @@ TkMacOSXMakeRealWindowExist( MoveWindowStructure(newWindow, geometry.left, geometry.top); SetPort(GetWindowPort(newWindow)); - /* - * overrideredirect windows are not activated by the window server and - * don't receive activate events. - */ - if (winPtr->atts.override_redirect) { - SetWindowActivationScope(newWindow, kWindowActivationScopeNone); - ChangeWindowAttributes(newWindow, kWindowNoActivatesAttribute, 0); - } - if ((wmPtr->master != None) && winPtr->atts.override_redirect) { /* * If we are transient and overrideredirect, use the utility class @@ -5669,7 +5658,7 @@ TkpChangeFocus(winPtr, force) /* *---------------------------------------------------------------------- * - * TkWmStackorderToplevelWrapperMap -- + * WmStackorderToplevelWrapperMap -- * * This procedure will create a table that maps the reparent wrapper * X id for a toplevel to the TkWindow structure that is wraps. @@ -5688,7 +5677,7 @@ TkpChangeFocus(winPtr, force) *---------------------------------------------------------------------- */ static void -TkWmStackorderToplevelWrapperMap(winPtr, display, table) +WmStackorderToplevelWrapperMap(winPtr, display, table) TkWindow *winPtr; /* TkWindow to recurse on */ Display *display; /* X display of parent window */ Tcl_HashTable *table; /* Maps mac window to TkWindow */ @@ -5708,7 +5697,7 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table) for (childPtr = winPtr->childList; childPtr != NULL; childPtr = childPtr->nextPtr) { - TkWmStackorderToplevelWrapperMap(childPtr, display, table); + WmStackorderToplevelWrapperMap(childPtr, display, table); } } @@ -5744,7 +5733,7 @@ TkWmStackorderToplevel(parentPtr) */ Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); - TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); + WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); windows = (TkWindow **) ckalloc((table.numEntries+1) * sizeof(TkWindow *)); @@ -5789,3 +5778,41 @@ TkWmStackorderToplevel(parentPtr) Tcl_DeleteHashTable(&table); return windows; } + +/* + *---------------------------------------------------------------------- + * + * ApplyWindowAttributeChanges -- + * + * This procedure applies carbon window attribute changes. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +ApplyWindowAttributeChanges(TkWindow *winPtr, int newAttributes, + int oldAttributes, int create) +{ + if (newAttributes != oldAttributes) { + if (winPtr->window == None && create) { + Tk_MakeWindowExist((Tk_Window) winPtr); + } else { + return; + } + if (!TkMacOSXHostToplevelExists(winPtr) && create) { + TkMacOSXMakeRealWindowExist(winPtr); + } else { + return; + } + ChangeWindowAttributes( + GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window)), + newAttributes & (newAttributes ^ oldAttributes), + oldAttributes & (newAttributes ^ oldAttributes)); + } +} |