summaryrefslogtreecommitdiffstats
path: root/carbon/tkMacOSXMenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'carbon/tkMacOSXMenu.c')
-rw-r--r--carbon/tkMacOSXMenu.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/carbon/tkMacOSXMenu.c b/carbon/tkMacOSXMenu.c
index 31bb20e..b02c289 100644
--- a/carbon/tkMacOSXMenu.c
+++ b/carbon/tkMacOSXMenu.c
@@ -531,8 +531,10 @@ TkMacOSXGetNewMenuID(
}
if (!found) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "No more menus can be allocated.", NULL);
+ Tcl_SetObjResult(menuPtr->interp, Tcl_NewStringObj(
+ "No more menus can be allocated.", -1));
+ Tcl_SetErrorCode(menuPtr->interp, "TK", "MENU", "SYSTEM_RESOURCES",
+ NULL);
return TCL_ERROR;
}
Tcl_SetHashValue(commandEntryPtr, menuPtr);
@@ -682,21 +684,25 @@ TkpNewMenu(
err = ChkErr(CreateNewMenu, menuID, kMenuAttrDoNotUseUserCommandKeys,
&macMenuHdl);
if (err != noErr) {
- Tcl_AppendResult(menuPtr->interp, "CreateNewMenu failed.", NULL);
+ Tcl_SetObjResult(menuPtr->interp, Tcl_NewStringObj(
+ "CreateNewMenu failed.", -1));
+ Tcl_SetErrorCode(menuPtr->interp, "TK", "MENU", "CREATE", NULL);
return TCL_ERROR;
}
cfStr = CFStringCreateWithCString(NULL, Tk_PathName(menuPtr->tkwin),
kCFStringEncodingUTF8);
if (!cfStr) {
- Tcl_AppendResult(menuPtr->interp, "CFStringCreateWithCString failed.",
- NULL);
+ Tcl_SetObjResult(menuPtr->interp, Tcl_NewStringObj(
+ "CFStringCreateWithCString failed.", -1));
+ Tcl_SetErrorCode(menuPtr->interp, "TK", "MENU", "CREATE_STRING",NULL);
return TCL_ERROR;
}
err = ChkErr(SetMenuTitleWithCFString, macMenuHdl, cfStr);
CFRelease(cfStr);
if (err != noErr) {
- Tcl_AppendResult(menuPtr->interp, "SetMenuTitleWithCFString failed.",
- NULL);
+ Tcl_SetObjResult(menuPtr->interp, Tcl_NewStringObj(
+ "SetMenuTitleWithCFString failed.", -1));
+ Tcl_SetErrorCode(menuPtr->interp, "TK", "MENU", "SET_TITLE", NULL);
return TCL_ERROR;
}
@@ -1546,8 +1552,9 @@ TkpPostMenu(
int result;
if (inPostMenu > 0) {
- Tcl_AppendResult(interp,
- "Cannot call post menu while already posting menu", NULL);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "Cannot call post menu while already posting menu", -1));
+ Tcl_SetErrorCode(interp, "TK", "MENU", "POSTING", NULL);
result = TCL_ERROR;
} else {
short menuID;
@@ -2248,7 +2255,7 @@ TkMacOSXDispatchMenuEvent(
Tcl_HashEntry *commandEntryPtr =
Tcl_FindHashEntry(&commandTable, (char*)(intptr_t)menuID);
if (commandEntryPtr != NULL) {
- TkMenu *menuPtr = (TkMenu *) Tcl_GetHashValue(commandEntryPtr);
+ TkMenu *menuPtr = Tcl_GetHashValue(commandEntryPtr);
if ((currentAppleMenuID == menuID)
&& (index > menuPtr->numEntries + 1)) {
@@ -2365,7 +2372,7 @@ GetMenuAccelGeometry (
CFRelease(cfStr);
}
}
- if ((mePtr->entryFlags & ENTRY_ACCEL_MASK) == 0) {
+ if (!(mePtr->entryFlags & ENTRY_ACCEL_MASK)) {
if (!geometryPtr->accelGlyph) {
width = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
}
@@ -2629,7 +2636,7 @@ DrawMenuEntryAccelerator(
drawState = kThemeStateActive;
break;
}
- if ((mePtr->entryFlags & ENTRY_ACCEL_MASK) == 0) {
+ if (!(mePtr->entryFlags & ENTRY_ACCEL_MASK)) {
leftEdge -= geometryPtr->modifierWidth;
}
if (geometryPtr->accelGlyph) {