summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordas <das>2006-09-11 14:41:03 (GMT)
committerdas <das>2006-09-11 14:41:03 (GMT)
commit165a8b48f80b1a778723600317777204d52a5186 (patch)
tree700c7d9af3cce6f0a022e29d853e43c8b0b799ab /macosx
parent41dfe0d4791ea37a1f6a7c3b069b3f41c79466b0 (diff)
downloadtk-165a8b48f80b1a778723600317777204d52a5186.zip
tk-165a8b48f80b1a778723600317777204d52a5186.tar.gz
tk-165a8b48f80b1a778723600317777204d52a5186.tar.bz2
* 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.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXColor.c7
-rw-r--r--macosx/tkMacOSXInt.h5
-rw-r--r--macosx/tkMacOSXKeyEvent.c4
-rw-r--r--macosx/tkMacOSXMenu.c8
-rw-r--r--macosx/tkMacOSXWm.c95
5 files changed, 78 insertions, 41 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index b69354a..45c63c8 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.5 2006/09/10 17:06:32 das Exp $
+ * RCS: @(#) $Id: tkMacOSXColor.c,v 1.6 2006/09/11 14:41:04 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 ffc01c3..262b842 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.18 2006/07/24 04:45:23 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInt.h,v 1.19 2006/09/11 14:41:04 das Exp $
*/
#ifndef _TKMACINT
@@ -132,7 +132,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 470fdee..3a6551b 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.17 2006/07/25 12:08:59 das Exp $
+ * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.18 2006/09/11 14:41:04 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 d16d23c..9f24e9b 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.32 2006/09/10 17:06:32 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.33 2006/09/11 14:41:04 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 dc0e9bc..65e7833 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.41 2006/09/10 17:02:19 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.42 2006/09/11 14:41:04 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -86,7 +86,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));
@@ -193,9 +193,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));
/*
*--------------------------------------------------------------
@@ -2254,6 +2257,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?");
@@ -2292,6 +2296,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
}
}
}
+ ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, oldAttributes, 0);
return TCL_OK;
}
@@ -2477,7 +2482,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?");
@@ -2496,7 +2502,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;
@@ -2522,18 +2527,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;
}
@@ -2907,6 +2901,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?");
@@ -2978,6 +2973,7 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv)
wmPtr->attributes = kWindowStandardFloatingAttributes;
}
}
+ ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, oldAttributes, 0);
return TCL_OK;
}
@@ -4933,7 +4929,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;
@@ -4942,7 +4938,7 @@ TkUnsupported1ObjCmd(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXWinStyle --
+ * WmWinStyle --
*
* This procedure is invoked to process the
* "::tk::unsupported::MacWindowStyle style" subcommand.
@@ -4957,8 +4953,8 @@ TkUnsupported1ObjCmd(
*
*----------------------------------------------------------------------
*/
-int
-TkMacOSXWinStyle(
+static int
+WmWinStyle(
Tcl_Interp *interp, /* Current interpreter. */
TkWindow *winPtr, /* Window to be manipulated. */
int objc, /* Number of arguments. */
@@ -5127,6 +5123,8 @@ TkMacOSXWinStyle(
return TCL_ERROR;
}
}
+ ApplyWindowAttributeChanges(winPtr, wmPtr->attributes,
+ oldAttributes, 0);
wmPtr->style = -1;
}
@@ -5281,15 +5279,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
@@ -5761,7 +5750,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.
@@ -5780,7 +5769,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 */
@@ -5800,7 +5789,7 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table)
for (childPtr = winPtr->childList; childPtr != NULL;
childPtr = childPtr->nextPtr) {
- TkWmStackorderToplevelWrapperMap(childPtr, display, table);
+ WmStackorderToplevelWrapperMap(childPtr, display, table);
}
}
@@ -5836,7 +5825,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 *));
@@ -5881,3 +5870,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));
+ }
+}