summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXMenu.c3
-rw-r--r--macosx/tkMacOSXMenubutton.c11
2 files changed, 7 insertions, 7 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 1d3bd34..f36da42 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -791,7 +791,6 @@ TkpPostMenu(
NSView *view = [win contentView];
NSMenu *menu = (NSMenu *) menuPtr->platformData;
NSMenuItem *item = nil;
- NSInteger index = index;
NSPoint location = NSMakePoint(x, tkMacOSXZeroScreenHeight - y);
int result, oldMode;
@@ -805,7 +804,7 @@ TkpPostMenu(
index = [menu numberOfItems] - 1;
}
if (index >= 0) {
- item = [menu itemAtIndex:index];
+ item = [menu itemAtIndex:(NSInteger)index];
}
oldMode = Tcl_SetServiceMode(TCL_SERVICE_NONE);
[menu popUpMenuPositioningItem:item
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index 8e22fd8..b2b4b76 100644
--- a/macosx/tkMacOSXMenubutton.c
+++ b/macosx/tkMacOSXMenubutton.c
@@ -243,7 +243,7 @@ void
TkpComputeMenuButtonGeometry(butPtr)
register TkMenuButton *butPtr; /* Widget record for menu button. */
{
- int width, height, avgWidth, haveImage = 0;
+ int width, height, avgWidth, haveImage = 0, haveText = 0;
int txtWidth, txtHeight;
Tk_FontMetrics fm;
int highlightWidth = butPtr->highlightWidth > 0 ? butPtr->highlightWidth : 0;
@@ -266,7 +266,8 @@ TkpComputeMenuButtonGeometry(butPtr)
haveImage = 1;
}
- if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) {
+ if (butPtr->text && strlen(butPtr->text) > 0) {
+ haveText = 1;
Tk_FreeTextLayout(butPtr->textLayout);
butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
butPtr->text, -1, butPtr->wrapLength,
@@ -284,7 +285,7 @@ TkpComputeMenuButtonGeometry(butPtr)
* image, because otherwise it is not really a compound button.
*/
- if (butPtr->compound != COMPOUND_NONE && haveImage) {
+ if (haveImage && haveText) {
switch ((enum compound) butPtr->compound) {
case COMPOUND_TOP:
case COMPOUND_BOTTOM: {
@@ -326,14 +327,14 @@ TkpComputeMenuButtonGeometry(butPtr)
}
} else {
- if (haveImage) {
+ if (haveImage) { /* Image only */
if (butPtr->width > 0) {
width = butPtr->width;
}
if (butPtr->height > 0) {
height = butPtr->height;
}
- } else {
+ } else { /* Text only */
width = txtWidth;
height = txtHeight;
if (butPtr->width > 0) {