From d9b04b436af1f10f26bfffac3006e7cfd3006e57 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Fri, 13 Feb 2015 01:43:12 +0000 Subject: Final adjustment of checkbutton flags in Cocoa --- macosx/tkMacOSXButton.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 4dddcf9..9a43b46 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -420,8 +420,8 @@ TkpComputeButtonGeometry( width += 0; } } else { - /*If just text, just add width of string.*/ - width += txtWidth; + /*If just text, hard-code width of 30. Text renders unevenly otherwise.*/ + width += 30; } break; } -- cgit v0.12 From 27538409d500aa8a26dd5f72bf26514ea234a95a Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Sat, 14 Feb 2015 01:22:31 +0000 Subject: Remove calls during window resize notification that cause crash on Cocoa --- macosx/tkMacOSXWindowEvent.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 0f1e2be..1b43296 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -80,10 +80,6 @@ extern NSString *opaqueTag; NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); - /*Disable drawing until window is resized removes flicker and drawing artifacts;necessary after removal of private API.*/ - NSDisableScreenUpdates(); - [ [w contentView] setHidden:YES]; - if (winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; NSRect bounds = [w frame]; @@ -111,8 +107,6 @@ extern NSString *opaqueTag; } TkGenWMConfigureEvent((Tk_Window) winPtr, x, y, width, height, flags); } - [[w contentView] setHidden:NO]; - NSEnableScreenUpdates(); } - (void) windowExpanded: (NSNotification *) notification -- cgit v0.12 From 5d1c639c749bd73d90e37f7f67de9646ca84bd6d Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Sun, 15 Feb 2015 18:29:14 +0000 Subject: Better alingment of notebook tabs in Cocoa; thanks to Marc Culler for patch --- macosx/ttkMacOSXTheme.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 64b96cb..747254c 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -294,20 +294,13 @@ static Ttk_StateTable TabPositionTable[] = { * TP30000359-TPXREF116> */ -int TAB_HEIGHT = 0; -int TAB_OVERLAP = 0; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TAB_HEIGHT = 10; - TAB_OVERLAP = 10; - /*Different metrics on 10.10/Yosemite.*/ - if (MAC_OS_X_VERSION_MIN_REQUIRED > 100000) { - TAB_OVERLAP = 5; - } - *heightPtr = TAB_HEIGHT + TAB_OVERLAP - 1; + *heightPtr = kThemeMetricLargeTabHeight; + *paddingPtr = Ttk_MakePadding(0, 0, 0, 2); } @@ -326,7 +319,6 @@ static void TabElementDraw( .position = Ttk_StateTableLookup(TabPositionTable, state), }; - bounds.size.height += TAB_OVERLAP; BEGIN_DRAWING(d) ChkErr(HIThemeDrawTab, &bounds, &info, dc.context, HIOrientation, NULL); END_DRAWING @@ -364,8 +356,8 @@ static void PaneElementDraw( .adornment = kHIThemeTabPaneAdornmentNormal, }; - bounds.origin.y -= TAB_OVERLAP; - bounds.size.height += TAB_OVERLAP; + bounds.origin.y -= kThemeMetricTabFrameOverlap; + bounds.size.height += kThemeMetricTabFrameOverlap; BEGIN_DRAWING(d) ChkErr(HIThemeDrawTabPane, &bounds, &info, dc.context, HIOrientation); END_DRAWING -- cgit v0.12 From 2d63ea99a19f290fc631561cb060fd7dd7a719d8 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Sun, 15 Feb 2015 18:54:12 +0000 Subject: Remove Mac-specific display timer from tkTextDisp.c; no longer needed --- generic/tkTextDisp.c | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 3edd5dc..bcbb03a 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -3931,30 +3931,6 @@ TkTextUpdateOneLine( * *---------------------------------------------------------------------- */ -#ifdef MAC_OSX_TK -static void -RedisplayText( - ClientData clientData ) -{ - register TkText *textPtr = (TkText *) clientData; - TextDInfo *dInfoPtr = textPtr->dInfoPtr; - TkRegion damageRegion; - XRectangle rectangle; - - if (dInfoPtr == NULL) { - return; - } - damageRegion = TkCreateRegion(); - rectangle.x = 0; - rectangle.y = 0; - rectangle.width = dInfoPtr->maxX; - rectangle.height = dInfoPtr->maxY; - TkUnionRectWithRegion(&rectangle, damageRegion, damageRegion); - - TextInvalidateRegion(textPtr, damageRegion); - DisplayText(clientData); -} -#endif static void DisplayText( @@ -3969,9 +3945,6 @@ DisplayText( int bottomY = 0; /* Initialization needed only to stop compiler * warnings. */ Tcl_Interp *interp; -#ifdef MAC_OSX_TK - Tcl_TimerToken macRefreshTimer = NULL; -#endif if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { /* @@ -4165,21 +4138,6 @@ DisplayText( damageRgn)) { TextInvalidateRegion(textPtr, damageRgn); -#ifdef MAC_OSX_TK - - /* - * On OS X large scrolls sometimes leave garbage on the screen. - * This attempts to clean it up by redisplaying the Text window - * after 200 milliseconds. - */ - if ( abs(y-oldY) > 14 ) { - Tcl_DeleteTimerHandler(macRefreshTimer); - macRefreshTimer = Tcl_CreateTimerHandler(200, - RedisplayText, - clientData); - } -#endif - } numCopies++; TkDestroyRegion(damageRgn); -- cgit v0.12 From fae1b687220c1f7bf9ac63856a5cb354153ebc13 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 15 Feb 2015 19:16:21 +0000 Subject: Fixed failing textImage-3.2 test - See bug [1591493fff] --- tests/textImage.test | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/textImage.test b/tests/textImage.test index bb5909c..47ea298 100644 --- a/tests/textImage.test +++ b/tests/textImage.test @@ -242,7 +242,7 @@ test textImage-3.1 {image change propagation} { set result } {{base:0 0 5 5} {10:0 0 10 10} {20:0 0 20 20} {40:0 0 40 40}} -test textImage-3.2 {delayed image management} { +test textImage-3.2 {delayed image management, see also bug 1591493} { catch { image create photo small -width 5 -height 5 small put red -to 0 0 4 4 @@ -253,11 +253,13 @@ test textImage-3.2 {delayed image management} { .t image create end -name test update set result "" - lappend result [.t bbox test] + foreach {x1 y1 w1 h1} [.t bbox test] {} + lappend result [list $x1 $w1 $h1] .t image configure test -image small -align top update - lappend result [.t bbox test] -} {{} {0 0 5 5}} + foreach {x2 y2 w2 h2} [.t bbox test] {} + lappend result [list [expr {$x1==$x2}] [expr {$w2>0}] [expr {$h2>0}]] +} {{0 0 0} {1 1 1}} # some temporary random tests -- cgit v0.12 From 4f6838d1207225dc01e59d05e337bdf5d86eb771 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Mon, 16 Feb 2015 20:19:32 +0000 Subject: Major fix for HITheme button metrics; thanks to Marc Culler for patch. --- macosx/tkMacOSXButton.c | 474 ++++++++++++++++++++--------------------------- macosx/tkMacOSXDefault.h | 36 ++-- macosx/ttkMacOSXTheme.c | 2 +- 3 files changed, 220 insertions(+), 292 deletions(-) diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 9a43b46..cfd338b 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -7,8 +7,9 @@ * Copyright (c) 1996-1997 by Sun Microsystems, Inc. * Copyright 2001, Apple Computer, Inc. * Copyright (c) 2006-2007 Daniel A. Steffen - * Copyright 2007 Revar Desmera. - * Copyright 2015 Kevin Walzer/WordTech Communications LLC. + * Copyright 2007 Revar Desmera. + * Copyright 2015 Kevin Walzer/WordTech Communications LLC. + * Copyright 2015 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -89,10 +90,10 @@ static void ButtonContentDrawCB (const HIRect *bounds, ThemeButtonKind kind, const HIThemeButtonDrawInfo *info, MacButton *ptr, SInt16 depth, Boolean isColorDev); static void ButtonEventProc(ClientData clientData, XEvent *eventPtr); -static void TkMacOSXComputeButtonParams (TkButton * butPtr, ThemeButtonKind* btnkind, HIThemeButtonDrawInfo* drawinfo); +static void TkMacOSXComputeButtonParams (TkButton * butPtr, ThemeButtonKind* btnkind, + HIThemeButtonDrawInfo* drawinfo); static int TkMacOSXComputeButtonDrawParams (TkButton * butPtr, DrawParams * dpPtr); -static void TkMacOSXDrawButton (MacButton *butPtr, - GC gc, Pixmap pixmap); +static void TkMacOSXDrawButton (MacButton *butPtr, GC gc, Pixmap pixmap); static void DrawButtonImageAndText(TkButton* butPtr); static void PulseDefaultButtonProc(ClientData clientData); @@ -101,7 +102,7 @@ static void PulseDefaultButtonProc(ClientData clientData); * The class procedure table for the button widgets. */ -Tk_ClassProcs tkpButtonProcs = { +const Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ }; @@ -230,7 +231,7 @@ TkpDisplayButton( } else { /* Draw the native portion of the buttons. */ TkMacOSXDrawButton(macButtonPtr, dpPtr->gc, pixmap); - + /* Draw highlight border, if needed. */ if (butPtr->highlightWidth < 3) { needhighlight = 1; @@ -264,13 +265,13 @@ TkpDisplayButton( * *---------------------------------------------------------------------- */ - + void TkpComputeButtonGeometry( TkButton *butPtr) /* Button whose geometry may have changed. */ { - int width, height, avgWidth, haveImage = 0, haveText = 0; - int txtWidth, txtHeight; + int width = 0, height = 0, charWidth = 1, haveImage = 0, haveText = 0; + int txtWidth = 0, txtHeight = 0; MacButton *mbPtr = (MacButton*)butPtr; Tk_FontMetrics fm; DrawParams drawParams; @@ -279,15 +280,30 @@ TkpComputeButtonGeometry( * First figure out the size of the contents of the button. */ - width = 0; - height = 0; - txtWidth = 0; - txtHeight = 0; - avgWidth = 0; - TkMacOSXComputeButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo); - butPtr->indicatorSpace = 0; + /* + * If the indicator is on, get its size. + */ + + if ( butPtr->indicatorOn ) { + switch (butPtr->type) { + case TYPE_RADIO_BUTTON: + GetThemeMetric(kThemeMetricRadioButtonWidth, &butPtr->indicatorDiameter); + break; + case TYPE_CHECK_BUTTON: + GetThemeMetric(kThemeMetricCheckBoxWidth, &butPtr->indicatorDiameter); + break; + default: + break; + } + /* Allow 2px extra space next to the indicator. */ + butPtr->indicatorSpace = butPtr->indicatorDiameter + 2; + } else { + butPtr->indicatorSpace = 0; + butPtr->indicatorDiameter = 0; + } + if (butPtr->image != NULL) { Tk_SizeOfImage(butPtr->image, &width, &height); haveImage = 1; @@ -304,19 +320,12 @@ TkpComputeButtonGeometry( txtWidth = butPtr->textWidth; txtHeight = butPtr->textHeight; - avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); + charWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); Tk_GetFontMetrics(butPtr->tkfont, &fm); haveText = (txtWidth != 0 && txtHeight != 0); } - /* - * If the button is compound (ie, it shows both an image and text), - * the new geometry is a combination of the image and text geometry. - * We only honor the compound bit if the button has both text and an - * image, because otherwise it is not really a compound button. - */ - - if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) { + if (haveImage && haveText) { /* Image and Text */ switch ((enum compound) butPtr->compound) { case COMPOUND_TOP: case COMPOUND_BOTTOM: @@ -344,88 +353,30 @@ TkpComputeButtonGeometry( width = (width > txtWidth ? width : txtWidth); height = (height > txtHeight ? height : txtHeight); break; - case COMPOUND_NONE: + default: break; } - if (butPtr->width > 0) { - width = butPtr->width; - } - if (butPtr->height > 0) { - height = butPtr->height; - } - - } else if (haveImage) { + width += butPtr->indicatorSpace; - if (butPtr->width > 0) { - width = butPtr->width; - } - if (butPtr->height > 0) { - height = butPtr->height; - } + } else if (haveImage) { /* Image only */ + width = butPtr->width > 0 ? butPtr->width : width + butPtr->indicatorSpace; + height = butPtr->height > 0 ? butPtr->height : height; - } else { - width = txtWidth; + } else { /* Text only */ + width = txtWidth + butPtr->indicatorSpace; height = txtHeight; - if (butPtr->width > 0) { - width = butPtr->width * avgWidth; + width = butPtr->width * charWidth; } if (butPtr->height > 0) { height = butPtr->height * fm.linespace; } } + /* Add padding */ width += 2 * butPtr->padX; height += 2 * butPtr->padY; - /* Need special handling for radiobuttons and checkbuttons: - the text and images is drawn right on top of the button unless - we expand the width. This is not perfect; some radiobuttons may render - on top anyway. - */ - switch (butPtr->type) { - case TYPE_RADIO_BUTTON: - /*Pad radiobutton by 50 if indicatorOn to ensure image does not draw - right over radiobutton on left.*/ - if (butPtr->image != None) { - if (butPtr->indicatorOn) { - width += 50; - } else { - width += 0; - } - } else if (butPtr->bitmap != None) { - if (butPtr->indicatorOn) { - width += 50; - } else { - width += 0; - } - } else { - /*If just text, just add width of string.*/ - width += txtWidth; - } - break; - case TYPE_CHECK_BUTTON: - /*Pad checkbutton by 50 if indicatorOn to ensure image does not draw - right over radiobutton on left.*/ - if (butPtr->image != None) { - if (butPtr->indicatorOn) { - width += 50; - } else { - width += 0; - } - } else if (butPtr->bitmap != None) { - if (butPtr->indicatorOn) { - width += 50; - } else { - width += 0; - } - } else { - /*If just text, hard-code width of 30. Text renders unevenly otherwise.*/ - width += 30; - } - break; - } - /* * Now figure out the size of the border decorations for the button. */ @@ -436,45 +387,40 @@ TkpComputeButtonGeometry( butPtr->inset = 0; butPtr->inset += butPtr->highlightWidth; - + if (TkMacOSXComputeButtonDrawParams(butPtr,&drawParams)) { - - HIRect tmpRect; - HIRect contBounds; + HIRect contBounds; int paddingx = 0; int paddingy = 0; - tmpRect = CGRectMake(0, 0, width, height); - - - HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds); - + tmpRect = CGRectMake(0, 0, width, height); + HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds); /* If the content region has a minimum height, match it. */ if (height < contBounds.size.height) { - height = contBounds.size.height; + height = contBounds.size.height; } /* If the content region has a minimum width, match it. */ if (width < contBounds.size.width) { - width = contBounds.size.width; + width = contBounds.size.width; } /* Pad to fill difference between content bounds and button bounds. */ - paddingx = tmpRect.origin.x - contBounds.origin.x; - paddingy = tmpRect.origin.y - contBounds.origin.y; + paddingx = contBounds.origin.x; + paddingy = contBounds.origin.y; if (paddingx > 0) { - width += paddingx; + //width += paddingx; } if (paddingy > 0) { - height += paddingy; + //height += paddingy; } if (height < paddingx - 4) { /* can't have buttons much shorter than button side diameter. */ height = paddingx - 4; - } + } } else { height += butPtr->borderWidth*2; @@ -486,10 +432,10 @@ TkpComputeButtonGeometry( Tk_GeometryRequest(butPtr->tkwin, width, height); Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset); - } /* +/* *---------------------------------------------------------------------- * * DrawButtonImageAndText -- @@ -508,7 +454,7 @@ static void DrawButtonImageAndText( TkButton* butPtr) { - + MacButton *mbPtr = (MacButton*)butPtr; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; @@ -533,7 +479,7 @@ DrawButtonImageAndText( DrawParams* dpPtr = &mbPtr->drawParams; pixmap = (Pixmap)Tk_WindowId(tkwin); - + if (butPtr->image != None) { Tk_SizeOfImage(butPtr->image, &width, &height); haveImage = 1; @@ -549,9 +495,9 @@ DrawButtonImageAndText( /* Offset bitmaps by a bit when the button is pressed. */ pressed = 1; } - - haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0); - if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) { + + haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0); + if (haveImage && haveText) { /* Image and Text */ int x; int y; textXOffset = 0; @@ -560,60 +506,64 @@ DrawButtonImageAndText( fullHeight = 0; switch ((enum compound) butPtr->compound) { - case COMPOUND_TOP: - case COMPOUND_BOTTOM: { - /* Image is above or below text */ - if (butPtr->compound == COMPOUND_TOP) { - textYOffset = height + butPtr->padY; - } else { - imageYOffset = butPtr->textHeight + butPtr->padY; - } - fullHeight = height + butPtr->textHeight + butPtr->padY; - fullWidth = (width > butPtr->textWidth ? width : - butPtr->textWidth); - textXOffset = (fullWidth - butPtr->textWidth)/2; - imageXOffset = (fullWidth - width)/2; - break; - } - case COMPOUND_LEFT: - case COMPOUND_RIGHT: { - /* - * Image is left or right of text - */ - - if (butPtr->compound == COMPOUND_LEFT) { - textXOffset = width + butPtr->padX; - } else { - imageXOffset = butPtr->textWidth + butPtr->padX; - } - fullWidth = butPtr->textWidth + butPtr->padX + width; - fullHeight = (height > butPtr->textHeight ? height : + case COMPOUND_TOP: + case COMPOUND_BOTTOM: { + /* Image is above or below text */ + if (butPtr->compound == COMPOUND_TOP) { + textYOffset = height + butPtr->padY; + } else { + imageYOffset = butPtr->textHeight + butPtr->padY; + } + fullHeight = height + butPtr->textHeight + butPtr->padY; + fullWidth = (width > butPtr->textWidth ? width : + butPtr->textWidth); + textXOffset = (fullWidth - butPtr->textWidth)/2; + imageXOffset = (fullWidth - width)/2; + break; + } + case COMPOUND_LEFT: + case COMPOUND_RIGHT: { + /* + * Image is left or right of text + */ + + if (butPtr->compound == COMPOUND_LEFT) { + textXOffset = width + butPtr->padX; + } else { + imageXOffset = butPtr->textWidth + butPtr->padX; + } + fullWidth = butPtr->textWidth + butPtr->padX + width; + fullHeight = (height > butPtr->textHeight ? height : butPtr->textHeight); - textYOffset = (fullHeight - butPtr->textHeight)/2; - imageYOffset = (fullHeight - height)/2; - break; - } - case COMPOUND_CENTER: { - /* - * Image and text are superimposed - */ - - fullWidth = (width > butPtr->textWidth ? width : - butPtr->textWidth); - fullHeight = (height > butPtr->textHeight ? height : + textYOffset = (fullHeight - butPtr->textHeight)/2; + imageYOffset = (fullHeight - height)/2; + break; + } + case COMPOUND_CENTER: { + /* + * Image and text are superimposed + */ + + fullWidth = (width > butPtr->textWidth ? width : + butPtr->textWidth); + fullHeight = (height > butPtr->textHeight ? height : butPtr->textHeight); - textXOffset = (fullWidth - butPtr->textWidth)/2; - imageXOffset = (fullWidth - width)/2; - textYOffset = (fullHeight - butPtr->textHeight)/2; - imageYOffset = (fullHeight - height)/2; - break; - } - case COMPOUND_NONE: {break;} - } + textXOffset = (fullWidth - butPtr->textWidth)/2; + imageXOffset = (fullWidth - width)/2; + textYOffset = (fullHeight - butPtr->textHeight)/2; + imageYOffset = (fullHeight - height)/2; + break; + } + default: + break; + } + TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX + butPtr->borderWidth, butPtr->padY + butPtr->borderWidth, - fullWidth, fullHeight, &x, &y); + fullWidth + butPtr->indicatorSpace, fullHeight, &x, &y); + x += butPtr->indicatorSpace; + if (dpPtr->relief == TK_RELIEF_SUNKEN) { x += dpPtr->offset; y += dpPtr->offset; @@ -630,110 +580,89 @@ DrawButtonImageAndText( textYOffset -= 1; if (butPtr->image != NULL) { - if ((butPtr->selectImage != NULL) && - (butPtr->flags & SELECTED)) { - Tk_RedrawImage(butPtr->selectImage, 0, 0, - width, height, pixmap, imageXOffset, imageYOffset); - } else if ((butPtr->tristateImage != NULL) && - (butPtr->flags & TRISTATED)) { - Tk_RedrawImage(butPtr->tristateImage, 0, 0, - width, height, pixmap, imageXOffset, imageYOffset); - } else { - Tk_RedrawImage(butPtr->image, 0, 0, width, - height, pixmap, imageXOffset, imageYOffset); - } + if ((butPtr->selectImage != NULL) && + (butPtr->flags & SELECTED)) { + Tk_RedrawImage(butPtr->selectImage, 0, 0, + width, height, pixmap, imageXOffset, imageYOffset); + } else if ((butPtr->tristateImage != NULL) && + (butPtr->flags & TRISTATED)) { + Tk_RedrawImage(butPtr->tristateImage, 0, 0, + width, height, pixmap, imageXOffset, imageYOffset); + } else { + Tk_RedrawImage(butPtr->image, 0, 0, width, + height, pixmap, imageXOffset, imageYOffset); + } } else { - XSetClipOrigin(butPtr->display, dpPtr->gc, - imageXOffset, imageYOffset); - XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, - 0, 0, (unsigned int) width, (unsigned int) height, - imageXOffset, imageYOffset, 1); - XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); + XSetClipOrigin(butPtr->display, dpPtr->gc, + imageXOffset, imageYOffset); + XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, + 0, 0, (unsigned int) width, (unsigned int) height, + imageXOffset, imageYOffset, 1); + XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); } - - Tk_DrawTextLayout(butPtr->display, pixmap, + + Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1); Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc, - butPtr->textLayout, + butPtr->textLayout, x + textXOffset, y + textYOffset, butPtr->underline); - } else { - if (haveImage) { - int x = 0; - int y; - TkComputeAnchor(butPtr->anchor, tkwin, - butPtr->padX + butPtr->borderWidth, - butPtr->padY + butPtr->borderWidth, - width, height, &x, &y); - if (dpPtr->relief == TK_RELIEF_SUNKEN) { - x += dpPtr->offset; - y += dpPtr->offset; - } else if (dpPtr->relief == TK_RELIEF_RAISED) { - x -= dpPtr->offset; - y -= dpPtr->offset; - } - if (pressed) { - x += dpPtr->offset; - y += dpPtr->offset; - } - imageXOffset += x; - imageYOffset += y; - - if (butPtr->image != NULL) { - - if ((butPtr->selectImage != NULL) && - (butPtr->flags & SELECTED)) { - Tk_RedrawImage(butPtr->selectImage, 0, 0, width, - height, pixmap, imageXOffset, imageYOffset); - } else if ((butPtr->tristateImage != NULL) && - (butPtr->flags & TRISTATED)) { - Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, - height, pixmap, imageXOffset, imageYOffset); - } else { - Tk_RedrawImage(butPtr->image, 0, 0, width, height, - pixmap, imageXOffset, imageYOffset); - } - } else { - XSetClipOrigin(butPtr->display, dpPtr->gc, x, y); - XCopyPlane(butPtr->display, butPtr->bitmap, - pixmap, dpPtr->gc, - 0, 0, (unsigned int) width, - (unsigned int) height, - imageXOffset, imageYOffset, 1); - XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); - } - } else { - /*Adequate padding / offset for text in various buttons.*/ - int x = 0; - int y; - switch (butPtr->type) { - case TYPE_RADIO_BUTTON: - case TYPE_CHECK_BUTTON: - if (butPtr->indicatorOn) { - TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY, - butPtr->textWidth, butPtr->textHeight, &x, &y); - Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, - butPtr->textLayout, x + 20, y, 0, -1); - } else { - TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY, - butPtr->textWidth, butPtr->textHeight, &x, &y); - Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, - butPtr->textLayout, x, y, 0, -1); - } - break; - case TYPE_BUTTON: - case TYPE_LABEL: - TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY, - butPtr->textWidth, butPtr->textHeight, &x, &y); - Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, - butPtr->textLayout, x, y, 0, -1); - y += butPtr->textHeight/2; - break; + } else if (haveImage) { /* Image only */ + int x = 0; + int y; + TkComputeAnchor(butPtr->anchor, tkwin, + butPtr->padX + butPtr->borderWidth, + butPtr->padY + butPtr->borderWidth, + width + butPtr->indicatorSpace, + height, &x, &y); + x += butPtr->indicatorSpace; + if (dpPtr->relief == TK_RELIEF_SUNKEN) { + x += dpPtr->offset; + y += dpPtr->offset; + } else if (dpPtr->relief == TK_RELIEF_RAISED) { + x -= dpPtr->offset; + y -= dpPtr->offset; + } + if (pressed) { + x += dpPtr->offset; + y += dpPtr->offset; + } + imageXOffset += x; + imageYOffset += y; + + if (butPtr->image != NULL) { + + if ((butPtr->selectImage != NULL) && + (butPtr->flags & SELECTED)) { + Tk_RedrawImage(butPtr->selectImage, 0, 0, width, + height, pixmap, imageXOffset, imageYOffset); + } else if ((butPtr->tristateImage != NULL) && + (butPtr->flags & TRISTATED)) { + Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, + height, pixmap, imageXOffset, imageYOffset); + } else { + Tk_RedrawImage(butPtr->image, 0, 0, width, height, + pixmap, imageXOffset, imageYOffset); } + } else { + XSetClipOrigin(butPtr->display, dpPtr->gc, x, y); + XCopyPlane(butPtr->display, butPtr->bitmap, + pixmap, dpPtr->gc, + 0, 0, (unsigned int) width, + (unsigned int) height, + imageXOffset, imageYOffset, 1); + XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); } - } - + } else { /* Text only */ + int x, y; + TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY, + butPtr->textWidth + butPtr->indicatorSpace, + butPtr->textHeight, &x, &y); + x += butPtr->indicatorSpace; + Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, + x, y, 0, -1); + } /* * If the button is disabled with a stipple rather than a special @@ -775,7 +704,7 @@ DrawButtonImageAndText( * Draw the border and traversal highlight last. This way, if the * button's contents overflow they'll be covered up by the border. */ - + if (dpPtr->relief != TK_RELIEF_FLAT) { int inset = butPtr->highlightWidth; Tk_Draw3DRectangle(tkwin, pixmap, dpPtr->border, inset, inset, @@ -783,7 +712,7 @@ DrawButtonImageAndText( butPtr->borderWidth, dpPtr->relief); } } - + } @@ -821,7 +750,7 @@ TkpDestroyButton( * TkMacOSXDrawButton -- * * This function draws the tk button using Mac controls - * In addition, this code may apply custom colors passed + * In addition, this code may apply custom colors passed * in the TkButton. * * Results: @@ -847,13 +776,16 @@ TkMacOSXDrawButton( TkMacOSXDrawingContext dc; DrawParams* dpPtr = &mbPtr->drawParams; int useNewerHITools = 1; - + winPtr = (TkWindow *)butPtr->tkwin; TkMacOSXComputeButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo); - cntrRect = CGRectMake(winPtr->privatePtr->xOff, winPtr->privatePtr->yOff, Tk_Width(butPtr->tkwin),Tk_Height(butPtr->tkwin)); - + cntrRect = CGRectMake(winPtr->privatePtr->xOff, + winPtr->privatePtr->yOff, + Tk_Width(butPtr->tkwin), + Tk_Height(butPtr->tkwin)); + cntrRect = CGRectInset(cntrRect, butPtr->inset, butPtr->inset); if (useNewerHITools == 1) { @@ -865,7 +797,7 @@ TkMacOSXDrawButton( if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { return; } - + if (mbPtr->btnkind == kThemePushButton) { /* @@ -889,17 +821,15 @@ TkMacOSXDrawButton( hiinfo.animation.time.start = hiinfo.animation.time.current; } - HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, kHIThemeOrientationNormal, &contHIRec); - + HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, kHIThemeOrientationNormal, &contHIRec); TkMacOSXRestoreDrawingContext(&dc); - ButtonContentDrawCB(&contHIRec, mbPtr->btnkind, &mbPtr->drawinfo, (MacButton *)mbPtr, 32, true); } else { if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { return; } - + TkMacOSXRestoreDrawingContext(&dc); } mbPtr->lastdrawinfo = mbPtr->drawinfo; @@ -1127,7 +1057,7 @@ TkMacOSXComputeButtonParams( } else { drawinfo->value = kThemeButtonOff; } - + if ((mbPtr->flags & FIRST_DRAW) != 0) { mbPtr->flags &= ~FIRST_DRAW; if (Tk_MacOSXIsAppInFront()) { @@ -1229,8 +1159,6 @@ TkMacOSXComputeButtonDrawParams( /* * Override the relief specified for the button if this is a * checkbutton or radiobutton and there's no indicator. - * However, don't do this in the presence of Appearance, since - * then the bevel button will take care of the relief. */ dpPtr->relief = butPtr->relief; diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index 868144d..0380de9 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -16,9 +16,9 @@ #ifndef _TKMACDEFAULT #define _TKMACDEFAULT -#ifndef TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS -#define TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS 1 -#endif +//#ifndef TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS +//#define TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS 1 +//#endif /* * The definitions below provide symbolic names for the default colors. @@ -72,12 +72,12 @@ #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT "systemButtonFrame" #define DEF_LABEL_HIGHLIGHT_WIDTH "0" -#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS -#define DEF_BUTTON_HIGHLIGHT_WIDTH "4" -#define DEF_BUTTON_HIGHLIGHT_WIDTH_NOCM "1" -#else +//#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS +//#define DEF_BUTTON_HIGHLIGHT_WIDTH "4" +//#define DEF_BUTTON_HIGHLIGHT_WIDTH_NOCM "1" +//#else #define DEF_BUTTON_HIGHLIGHT_WIDTH "1" -#endif +//#endif #define DEF_BUTTON_IMAGE ((char *) NULL) #define DEF_BUTTON_INDICATOR "1" #define DEF_BUTTON_JUSTIFY "center" @@ -85,19 +85,19 @@ #define DEF_BUTTON_ON_VALUE "1" #define DEF_BUTTON_TRISTATE_VALUE "" #define DEF_BUTTON_OVER_RELIEF "" -#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS -#define DEF_BUTTON_PADX "12" -#define DEF_BUTTON_PADX_NOCM "1" -#else +//#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS +//#define DEF_BUTTON_PADX "12" +//#define DEF_BUTTON_PADX_NOCM "1" +//#else #define DEF_BUTTON_PADX "1" -#endif +//#endif #define DEF_LABCHKRAD_PADX "1" -#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS -#define DEF_BUTTON_PADY "3" -#define DEF_BUTTON_PADY_NOCM "1" -#else +//#if TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS +//#define DEF_BUTTON_PADY "3" +//#define DEF_BUTTON_PADY_NOCM "1" +//#else #define DEF_BUTTON_PADY "1" -#endif +//#endif #define DEF_LABCHKRAD_PADY "1" #define DEF_BUTTON_RELIEF "flat" #define DEF_LABCHKRAD_RELIEF "flat" diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 747254c..87ec4c2 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -299,7 +299,7 @@ static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - *heightPtr = kThemeMetricLargeTabHeight; + *heightPtr = GetThemeMetric(kThemeMetricLargeTabHeight, heightPtr); *paddingPtr = Ttk_MakePadding(0, 0, 0, 2); } -- cgit v0.12 From a9636f8f6d51caac57f740287c37a4563d33c8da Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Mon, 16 Feb 2015 22:06:17 +0000 Subject: Cleanup of bounds in button code. --- macosx/tkMacOSXButton.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index cfd338b..1a54514 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -410,12 +410,6 @@ TkpComputeButtonGeometry( /* Pad to fill difference between content bounds and button bounds. */ paddingx = contBounds.origin.x; paddingy = contBounds.origin.y; - if (paddingx > 0) { - //width += paddingx; - } - if (paddingy > 0) { - //height += paddingy; - } if (height < paddingx - 4) { /* can't have buttons much shorter than button side diameter. */ -- cgit v0.12 From 8ba8aeb4d8cc82ddb494f9c8c8a9cf2620b5df4d Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Wed, 18 Feb 2015 03:32:48 +0000 Subject: Fine-tune display during resize events; now shows resize in progress but does not redraw contentview until done --- macosx/tkMacOSXWindowEvent.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 1b43296..fea6049 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -848,12 +848,11 @@ ExposeRestrictProc( - (BOOL) preservesContentDuringLiveResize { - return YES; + return NO; } - (void)viewWillStartLiveResize { - NSDisableScreenUpdates(); [super viewWillStartLiveResize]; [self setNeedsDisplay:NO]; [self setHidden:YES]; @@ -863,7 +862,6 @@ ExposeRestrictProc( - (void)viewDidEndLiveResize { - NSEnableScreenUpdates(); [self setHidden:NO]; [self setNeedsDisplay:YES]; [super setNeedsDisplay:YES]; -- cgit v0.12 From 85a2a651bd79c8d724f04ecec7439b7b4332ee3e Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Thu, 19 Feb 2015 02:27:14 +0000 Subject: Restore live resize to Cocoa with reduced flickering; addresses most serious issue of Cocoa drawing while preserving user expectations for display during window resize; thanks to Marc Culler for extensive patch --- macosx/tkMacOSXDraw.c | 15 +++----- macosx/tkMacOSXWindowEvent.c | 82 +++++++++++++++++++------------------------- 2 files changed, 41 insertions(+), 56 deletions(-) diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 0b39cb4..f94c8af 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -1508,11 +1508,6 @@ TkScrollWindow( /* Scroll the rectangle. */ [view scrollRect:scrollSrc by:NSMakeSize(dx, -dy)]; - - /* Redisplay the scrolled area; hide to reduce flicker after removal of private API calls. */ - [view setHidden:YES]; - [view displayRect:scrollDst]; - [view setHidden:NO]; } } @@ -1857,9 +1852,9 @@ TkpClipDrawableToRect( macDraw->drawRgn = NULL; } if (width >= 0 && height >= 0) { - CGRect drawRect = CGRectMake(x + macDraw->xOff, y + macDraw->yOff, + CGRect clipRect = CGRectMake(x + macDraw->xOff, y + macDraw->yOff, width, height); - HIShapeRef drawRgn = HIShapeCreateWithRect(&drawRect); + HIShapeRef drawRgn = HIShapeCreateWithRect(&clipRect); if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(macDraw->winPtr); @@ -1872,9 +1867,9 @@ TkpClipDrawableToRect( macDraw->drawRgn = drawRgn; } if (view && view != [NSView focusView] && [view lockFocusIfCanDraw]) { - drawRect.origin.y = [view bounds].size.height - - (drawRect.origin.y + drawRect.size.height); - NSRectClip(NSRectFromCGRect(drawRect)); + clipRect.origin.y = [view bounds].size.height - + (clipRect.origin.y + clipRect.size.height); + NSRectClip(NSRectFromCGRect(clipRect)); macDraw->flags |= TK_FOCUSED_VIEW; } } else { diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index fea6049..4e51dbf 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -6,6 +6,8 @@ * * Copyright 2001-2009, Apple Inc. * Copyright (c) 2005-2009 Daniel A. Steffen + * Copyright (c) 2015 Kevin Walzer/WordTech Communications LLC. + * Copyright (c) 2015 Marc Culler. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -762,19 +764,29 @@ Tk_MacOSXIsAppInFront(void) #import /* - * Custom content view for Tk NSWindows, containing standard NSView subviews. - * The goal is to emulate X11-style drawing in response to Expose events: - * during the normal AppKit drawing cycle, we supress drawing of all subviews - * and instead send Expose events about the subviews that would be redrawn. + * Custom content view for use in Tk NSWindows. + * + * Since Tk handles all drawing of widgets, we only use the AppKit event loop + * as a source of input events. To do this, we overload the NSView drawRect + * method with a method which generates Expose events for Tk but does no + * drawing. The redrawing operations are then done when Tk processes these + * events. + * + * Earlier versions of Mac Tk used subclasses of NSView, e.g. NSButton, as the + * basis for Tk widgets. These would then appear as subviews of the + * TKContentView. To prevent the AppKit from redrawing and corrupting the Tk + * Widgets it was necessary to use Apple private API calls. In order to avoid + * using private API calls, the NSView-based widgets have been replaced with + * normal Tk widgets which draw themselves as native widgets by using the + * HITheme API. + * */ @interface TKContentView(TKWindowEvent) - (void) drawRect: (NSRect) rect; - (void) generateExposeEvents: (HIMutableShapeRef) shape; -- (BOOL) preservesContentDuringLiveResize; -- (void) viewWillStartLiveResize; - (void) viewDidEndLiveResize; -- (void) viewWillDraw; +- (void) tkToolbarButton: (id) sender; - (BOOL) isOpaque; - (BOOL) wantsDefaultClipping; - (BOOL) acceptsFirstResponder; @@ -795,12 +807,10 @@ ExposeRestrictProc( ? TK_PROCESS_EVENT : TK_DEFER_EVENT); } - @implementation TKContentView(TKWindowEvent) - (void) drawRect: (NSRect) rect { - const NSRect *rectsBeingDrawn; NSInteger rectsBeingDrawnCount; @@ -836,39 +846,20 @@ ExposeRestrictProc( } - -/*Provide more fine-grained control over resizing of content to reduce flicker after removal of private API's.*/ - --(void) viewWillDraw -{ - - [super viewWillDraw]; -} - - -- (BOOL) preservesContentDuringLiveResize -{ - return NO; -} - -- (void)viewWillStartLiveResize -{ - [super viewWillStartLiveResize]; - [self setNeedsDisplay:NO]; - [self setHidden:YES]; -} - +/* + * As insurance against bugs that might cause layout glitches during a live + * resize, we redraw the window at the end of the resize operation. + */ - (void)viewDidEndLiveResize { + NSRect bounds = NSRectFromCGRect([self bounds]); + HIShapeRef shape = HIShapeCreateWithRect(&bounds); + [self generateExposeEvents: shape]; - [self setHidden:NO]; - [self setNeedsDisplay:YES]; - [super setNeedsDisplay:YES]; - [super viewDidEndLiveResize]; - } + /*Core function of this class, generates expose events for redrawing.*/ - (void) generateExposeEvents: (HIMutableShapeRef) shape { @@ -888,15 +879,16 @@ ExposeRestrictProc( ![[NSRunLoop currentRunLoop] currentMode] && Tcl_GetServiceMode() != TCL_SERVICE_NONE) { /* - * Ensure there are no pending idle-time redraws that could prevent the - * just posted Expose events from generating new redraws. + * Ensure there are no pending idle-time redraws that could + * prevent the just posted Expose events from generating + * new redraws. */ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} /* - * For smoother drawing, process Expose events and resulting redraws - * immediately instead of at idle time. + * For smoother drawing, process Expose events and resulting + * redraws immediately instead of at idle time. */ ClientData oldArg; @@ -913,7 +905,10 @@ ExposeRestrictProc( } -/*This is no-op on 10.7 and up because Apple has removed this widget, but leaving here for backwards compatibility.*/ +/* + * This is no-op on 10.7 and up because Apple has removed this widget, + * but we are leaving it here for backwards compatibility. + */ - (void) tkToolbarButton: (id) sender { #ifdef TK_MAC_DEBUG_EVENTS @@ -941,11 +936,6 @@ ExposeRestrictProc( Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); } -- (void) setFrameSize: (NSSize) newSize -{ - [super setFrameSize:newSize]; -} - - (BOOL) isOpaque { NSWindow *w = [self window]; -- cgit v0.12 From 2889c21f06d4a1042a9e42ddbc582e85cc0d3c3f Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Thu, 19 Feb 2015 15:57:33 +0000 Subject: Fix for Cocoa scrollbar appearance on 10.6 --- macosx/tkMacOSXScrlbr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index efa0f38..bc93b79 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -186,7 +186,15 @@ TkpDisplayScrollbar( /*Update values and draw in native rect.*/ UpdateControlValues(scrollPtr); +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + if (scrollPtr->vertical) { + HIThemeDrawTrack (&info, 0, dc.context, kHIThemeOrientationNormal); + } else { + HIThemeDrawTrack (&info, 0, dc.context, kHIThemeOrientationInverted); + } +#else HIThemeDrawTrack (&info, 0, dc.context, kHIThemeOrientationNormal); +#endif TkMacOSXRestoreDrawingContext(&dc); scrollPtr->flags &= ~REDRAW_PENDING; -- cgit v0.12 From 595ba695b4ad80cea066dab38d88f05188a84c79 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Thu, 19 Feb 2015 16:02:34 +0000 Subject: Add padding to HITheme menubuttons --- macosx/tkMacOSXMenubutton.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c index 05b553e..4a3c7f8 100644 --- a/macosx/tkMacOSXMenubutton.c +++ b/macosx/tkMacOSXMenubutton.c @@ -539,10 +539,10 @@ DrawMenuButtonImageAndText( XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); } } else { - /*Move x back by six pixels to give the menubutton arrows room.*/ + /*Move x back by eight pixels to give the menubutton arrows room.*/ int x = 0; int y; - textXOffset = 6; + textXOffset = 8; TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY, butPtr->textWidth, butPtr->textHeight, &x, &y); Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, -- cgit v0.12 From 998a2fcb291e7ccc945b650a7499b356b79bcaf9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 19 Feb 2015 21:27:05 +0000 Subject: Fix build problem on OSX --- macosx/tkMacOSXButton.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 1a54514..c44a40b 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -102,7 +102,7 @@ static void PulseDefaultButtonProc(ClientData clientData); * The class procedure table for the button widgets. */ -const Tk_ClassProcs tkpButtonProcs = { +Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ }; -- cgit v0.12 From 3a13bc5fac2d59e87c18e58d621b9f0631141f04 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 20 Feb 2015 21:29:23 +0000 Subject: Malformed comment. --- macosx/tkMacOSXButton.c | 1 - 1 file changed, 1 deletion(-) diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index c44a40b..c2a4a40 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -429,7 +429,6 @@ TkpComputeButtonGeometry( } /* -/* *---------------------------------------------------------------------- * * DrawButtonImageAndText -- -- cgit v0.12 From b4c8b7030528c756f79673b9511327918950afb7 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Sun, 22 Feb 2015 18:03:41 +0000 Subject: Fix for CGRect/NSRect confusion --- macosx/tkMacOSXWindowEvent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 4e51dbf..3233b37 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -853,7 +853,7 @@ ExposeRestrictProc( - (void)viewDidEndLiveResize { - NSRect bounds = NSRectFromCGRect([self bounds]); + HIRect bounds = NSRectToCGRect([self bounds]); HIShapeRef shape = HIShapeCreateWithRect(&bounds); [self generateExposeEvents: shape]; -- cgit v0.12