From feee504abc2ff11af14be90b9afe8bc072e7d16f Mon Sep 17 00:00:00 2001
From: wolfsuit <wolfsuit>
Date: Wed, 10 Nov 2004 17:29:44 +0000
Subject: Fix for 1055023 from mikek@muonics.com.

---
 ChangeLog               |  8 ++++++++
 macosx/tkMacOSXButton.c | 26 +++++++++++++++-----------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 718988a..d72e571 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-11-10  Jim Ingham  <jingham@apple.com>
+
+	From Michael Kirkham (mikek@muonics.com):
+	
+	* macosx/tkMacOSXButton.c (TkpDisplayButton): Don't set
+	the text if compound is NONE and we have and image.
+	[Bug 1055023]
+	
 2004-10-29  Mo DeJong  <mdejong@users.sourceforge.net>
 
 	* tests/wm.test: Add Win32 test cases for attributes
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 9cd2994..b3935a1 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.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: tkMacOSXButton.c,v 1.2.2.5 2004/02/16 00:42:34 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXButton.c,v 1.2.2.6 2004/11/10 17:29:45 wolfsuit Exp $
  */
 
 #include "tkButton.h"
@@ -309,7 +309,7 @@ TkpDisplayButton(
             fullWidth = 0;
             fullHeight = 0;
             
-            switch ((enum compound) butPtr->compound) {
+            switch ((enum compound) butPtr->compound)
                 case COMPOUND_TOP: 
                 case COMPOUND_BOTTOM: {
                     /* Image is above or below text */
@@ -324,9 +324,8 @@ TkpDisplayButton(
                     textXOffset = (fullWidth - butPtr->textWidth)/2;
                     imageXOffset = (fullWidth - width)/2;
                     break;
-                }
                 case COMPOUND_LEFT:
-                case COMPOUND_RIGHT: {
+                case COMPOUND_RIGHT:
                     /* 
                      * Image is left or right of text 
                      */
@@ -342,8 +341,7 @@ TkpDisplayButton(
                     textYOffset = (fullHeight - butPtr->textHeight)/2;
                     imageYOffset = (fullHeight - height)/2;
                     break;
-                }
-                case COMPOUND_CENTER: {
+                case COMPOUND_CENTER:
                     /* 
                      * Image and text are superimposed 
                      */
@@ -357,8 +355,8 @@ TkpDisplayButton(
                     textYOffset = (fullHeight - butPtr->textHeight)/2;
                     imageYOffset = (fullHeight - height)/2;
                     break;
-                }
-                case COMPOUND_NONE: {break;}
+                case COMPOUND_NONE:
+		  break;
             }
             
             TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
@@ -967,9 +965,15 @@ TkMacOSXDrawControl(
         Tk_Font    font;
         int        len;
         
-        len = TkFontGetFirstTextLayout(butPtr->textLayout, 
-                &font, controlTitle);
-        controlTitle[len] = 0;
+        if (((mbPtr->info.image == NULL) && (mbPtr->info.bitmap == None))
+               || (mbPtr->info.compound != COMPOUND_NONE)) {
+            len = TkFontGetFirstTextLayout(butPtr->textLayout, 
+                    &font, controlTitle);
+            controlTitle[len] = 0;
+        } else {
+            len = 0;
+            controlTitle[0] = 0;
+        }
         if (bcmp(mbPtr->controlTitle, controlTitle, len+1)) {
             CFStringRef cf;    	    
             cf = CFStringCreateWithCString(NULL,
-- 
cgit v0.12