summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXCarbonEvents.c4
-rw-r--r--macosx/tkMacOSXEvent.c52
2 files changed, 40 insertions, 16 deletions
diff --git a/macosx/tkMacOSXCarbonEvents.c b/macosx/tkMacOSXCarbonEvents.c
index 28bd3ef..fc81844 100644
--- a/macosx/tkMacOSXCarbonEvents.c
+++ b/macosx/tkMacOSXCarbonEvents.c
@@ -60,7 +60,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.10 2006/03/24 14:58:01 das Exp $
+ * RCS: @(#) $Id: tkMacOSXCarbonEvents.c,v 1.11 2006/04/11 10:22:34 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -192,6 +192,7 @@ TkMacOSXInitCarbonEvents (
{kEventClassMenu, kEventMenuBeginTracking},
{kEventClassMenu, kEventMenuEndTracking},
{kEventClassCommand, kEventCommandProcess},
+ {kEventClassCommand, kEventCommandUpdateStatus},
{kEventClassMouse, kEventMouseWheelMoved},
{kEventClassWindow, kEventWindowExpanded},
{kEventClassApplication, kEventAppHidden},
@@ -246,6 +247,7 @@ TkMacOSXInitCarbonEvents (
TraceEventByName("kEventMenuBeginTracking");
TraceEventByName("kEventMenuEndTracking");
TraceEventByName("kEventCommandProcess");
+ TraceEventByName("kEventCommandUpdateStatus");
TraceEventByName("kEventWindowExpanded");
TraceEventByName("kEventAppHidden");
TraceEventByName("kEventAppShown");
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index ba749a6..5f479b0 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -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: tkMacOSXEvent.c,v 1.9 2006/03/24 14:58:01 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.10 2006/04/11 10:22:34 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -180,12 +180,13 @@ TkMacOSXProcessMenuEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
MODULE_SCOPE int
TkMacOSXProcessCommandEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
{
- HICommand command;
- int menuContext;
+ HICommand command;
+ int menuContext;
OSStatus status;
switch (eventPtr->eKind) {
case kEventCommandProcess:
+ case kEventCommandUpdateStatus:
break;
default:
return 0;
@@ -197,18 +198,39 @@ TkMacOSXProcessCommandEvent(TkMacOSXEvent *eventPtr, MacEventStatus * statusPtr)
sizeof(command), NULL,
&command);
if (status == noErr && (command.attributes & kHICommandFromMenu)) {
- status = GetEventParameter(eventPtr->eventRef,
- kEventParamMenuContext,
- typeUInt32, NULL,
- sizeof(menuContext), NULL,
- &menuContext);
- if (status == noErr && (menuContext & kMenuContextMenuBar) &&
- (menuContext & kMenuContextMenuBarTracking)) {
- TkMacOSXHandleMenuSelect(GetMenuID(command.menu.menuRef),
- command.menu.menuItemIndex,
- GetCurrentEventKeyModifiers() & optionKey);
- return 1;
- }
+ if (eventPtr->eKind == kEventCommandProcess) {
+ status = GetEventParameter(eventPtr->eventRef,
+ kEventParamMenuContext,
+ typeUInt32, NULL,
+ sizeof(menuContext), NULL,
+ &menuContext);
+ if (status == noErr && (menuContext & kMenuContextMenuBar) &&
+ (menuContext & kMenuContextMenuBarTracking)) {
+ TkMacOSXHandleMenuSelect(GetMenuID(command.menu.menuRef),
+ command.menu.menuItemIndex,
+ GetCurrentEventKeyModifiers() & optionKey);
+ return 1;
+ }
+ } else {
+ Tcl_CmdInfo dummy;
+ if (command.commandID == kHICommandPreferences && eventPtr->interp) {
+ if (Tcl_GetCommandInfo(eventPtr->interp,
+ "::tk::mac::ShowPreferences", &dummy)) {
+ if (!IsMenuItemEnabled(command.menu.menuRef,
+ command.menu.menuItemIndex)) {
+ EnableMenuItem(command.menu.menuRef,
+ command.menu.menuItemIndex);
+ }
+ } else {
+ if (IsMenuItemEnabled(command.menu.menuRef,
+ command.menu.menuItemIndex)) {
+ DisableMenuItem(command.menu.menuRef,
+ command.menu.menuItemIndex);
+ }
+ }
+ return 1;
+ }
+ }
}
return 0;
}