From b2961e1a86c13f6505e843476369d46550b31eab Mon Sep 17 00:00:00 2001 From: das Date: Thu, 31 May 2007 13:42:11 +0000 Subject: * macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): complete all pending idle-time redraws before newly posted Expose events are processed; add bounds of redrawn windows to update region to ensure all child windows overdrawn by parents are redrawn. * macosx/tkMacOSXWindowEvent.c: centralize clip and window invalidation * macosx/tkMacOSXSubwindows.c: after location/size changes in the * macosx/tkMacOSXWm.c: BoundsChanged carbon event handler; correct/add window invalidation after window attribute changes. * macosx/tkMacOSXSubwindows.c (XResizeWindow, XMoveResizeWindow, XMoveWindow): factor out common code dealing with embedded and non-toplevel windows; remove unnecessary clip and window invalidation. * macosx/tkMacOSXButton.c (TkpDisplayButton): move clip setup closer to native button drawing calls. * macosx/tkMacOSXWm.c (TkMacOSXIsWindowZoomed, TkMacOSXZoomToplevel): correct handle gridded windows in max size calculations. * macosx/tkMacOSXEvent.c (TkMacOSXFlushWindows): use HIWindowFlush API when available. * macosx/tkMacOSXColor.c: cleanup whitespace and formatting. * macosx/tkMacOSXDraw.c: * macosx/tkMacOSXSubwindows.c: * macosx/tkMacOSXWm.c: --- ChangeLog | 32 ++++ macosx/tkMacOSXButton.c | 20 +-- macosx/tkMacOSXColor.c | 11 +- macosx/tkMacOSXDraw.c | 5 +- macosx/tkMacOSXEvent.c | 20 ++- macosx/tkMacOSXSubwindows.c | 382 ++++++++++++++----------------------------- macosx/tkMacOSXWindowEvent.c | 16 +- macosx/tkMacOSXWm.c | 43 +++-- 8 files changed, 236 insertions(+), 293 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74bdde8..7ab988c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2007-05-31 Daniel Steffen + + * macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): complete all + pending idle-time redraws before newly posted Expose events are + processed; add bounds of redrawn windows to update region to ensure all + child windows overdrawn by parents are redrawn. + + * macosx/tkMacOSXWindowEvent.c: centralize clip and window invalidation + * macosx/tkMacOSXSubwindows.c: after location/size changes in the + * macosx/tkMacOSXWm.c: BoundsChanged carbon event handler; + correct/add window invalidation after window attribute changes. + + * macosx/tkMacOSXSubwindows.c (XResizeWindow, XMoveResizeWindow, + XMoveWindow): factor out common code dealing with embedded and + non-toplevel windows; remove unnecessary clip and window invalidation. + + * macosx/tkMacOSXButton.c (TkpDisplayButton): move clip setup closer to + native button drawing calls. + + * macosx/tkMacOSXWm.c (TkMacOSXIsWindowZoomed, TkMacOSXZoomToplevel): + correct handle gridded windows in max size calculations. + + * macosx/tkMacOSXEvent.c (TkMacOSXFlushWindows): use HIWindowFlush API + when available. + + * macosx/tkMacOSXColor.c: cleanup whitespace and formatting. + * macosx/tkMacOSXDraw.c: + * macosx/tkMacOSXSubwindows.c: + * macosx/tkMacOSXWm.c: + + * generic/tkFont.c: #ifdef out debug msg printing to stderr. + 2007-05-30 Don Porter * generic/tk.h: Correct placement of #include [Bug 1723812]. diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 5180734..76906e7 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -11,7 +11,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.16 2007/05/09 12:57:45 das Exp $ + * RCS: @(#) $Id: tkMacOSXButton.c,v 1.2.2.17 2007/05/31 13:42:11 das Exp $ */ #include "tkMacOSXInt.h" @@ -225,15 +225,6 @@ TkpDisplayButton( } /* - * Set up clipping region. Make sure the we are using the port - * for this button, or we will set the wrong window's clip. - */ - - destPort = TkMacOSXGetDrawablePort(pixmap); - portChanged = QDSwapPort(destPort, &savePort); - TkMacOSXSetUpClippingRgn(pixmap); - - /* * See the comment in UpdateControlColors as to why we use the * highlightbackground for the border of Macintosh buttons. */ @@ -249,6 +240,15 @@ TkpDisplayButton( } /* + * Set up clipping region. Make sure the we are using the port + * for this button, or we will set the wrong window's clip. + */ + + destPort = TkMacOSXGetDrawablePort(pixmap); + portChanged = QDSwapPort(destPort, &savePort); + TkMacOSXSetUpClippingRgn(pixmap); + + /* * Draw the native portion of the buttons. Start by creating the control * if it doesn't already exist. Then configure the Macintosh control from * the Tk info. Finally, we call Draw1Control to draw to the screen. diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index c3a5bc7..5a35086 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.5 2007/04/29 02:26:48 das Exp $ + * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.6 2007/05/31 13:42:12 das Exp $ */ #include "tkMacOSXInt.h" @@ -462,12 +462,13 @@ TkMacOSXSetColorInContext(unsigned long pixel, CGContextRef context) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 (1 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1040 - && &kHIToolboxVersionNumber != NULL - && kHIToolboxVersionNumber >= kHIToolboxVersionNumber10_4 + && &kHIToolboxVersionNumber != NULL + && kHIToolboxVersionNumber >= + kHIToolboxVersionNumber10_4 #endif - ) ? kCGBitmapByteOrder32Host : + ) ? kCGBitmapByteOrder32Host : #endif - 0; + 0; } portChanged = QDSwapPort(patGWorld, &savePort); TkMacOSXSetColorInPort(pixel, 1, pixpat); diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 6d1d064..f6781d5 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.22 2007/05/30 06:39:38 das Exp $ + * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.23 2007/05/31 13:42:12 das Exp $ */ #include "tkMacOSXInt.h" @@ -408,9 +408,9 @@ TkPutImage( display->request++; destPort = TkMacOSXGetDrawablePort(d); portChanged = QDSwapPort(destPort, &savePort); - destBits = GetPortBitMapForCopyBits(destPort); TkMacOSXSetUpClippingRgn(d); + destBits = GetPortBitMapForCopyBits(destPort); srcPtr = &srcRect; SetRect(srcPtr, src_x, src_y, src_x + width, src_y + height); if (tkPictureIsOpen) { @@ -1602,7 +1602,6 @@ TkMacOSXSetupDrawingContext( if (port) { GetPortBounds(port, &portBounds); } - dc->saveState = NULL; if (port && !context) { dc->portChanged = QDSwapPort(port, &(dc->savePort)); diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c index be7ba56..ab275ae 100644 --- a/macosx/tkMacOSXEvent.c +++ b/macosx/tkMacOSXEvent.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: tkMacOSXEvent.c,v 1.3.2.11 2007/05/30 06:39:38 das Exp $ + * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.3.2.12 2007/05/31 13:42:12 das Exp $ */ #include "tkMacOSXInt.h" @@ -41,9 +41,21 @@ TkMacOSXFlushWindows(void) WindowRef wRef = GetWindowList(); while (wRef) { - CGrafPtr portPtr = GetWindowPort(wRef); - if (QDIsPortBuffered(portPtr)) { - QDFlushPortBuffer(portPtr, NULL); +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 + if (1 +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1030 + && HIWindowFlush != NULL +#endif + ) { + ChkErr(HIWindowFlush, wRef); + } else +#endif + { + CGrafPtr portPtr = GetWindowPort(wRef); + + if (QDIsPortBuffered(portPtr)) { + QDFlushPortBuffer(portPtr, NULL); + } } wRef = GetNextWindow(wRef); } diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 21ecce7..ed4ebcc 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.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: tkMacOSXSubwindows.c,v 1.2.2.16 2007/05/30 06:39:38 das Exp $ + * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.2.2.17 2007/05/31 13:42:12 das Exp $ */ #include "tkMacOSXInt.h" @@ -27,8 +27,9 @@ * Prototypes for functions used only in this file. */ -static void GenerateConfigureNotify (TkWindow *winPtr, int includeWin); -static void UpdateOffsets (TkWindow *winPtr, int deltaX, int deltaY); +static void MoveResizeWindow(MacDrawable *macWin); +static void GenerateConfigureNotify(TkWindow *winPtr, int includeWin); +static void UpdateOffsets(TkWindow *winPtr, int deltaX, int deltaY); /* @@ -225,6 +226,7 @@ XMapWindow( /* * Generate damage for that area of the window */ + TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } @@ -293,6 +295,7 @@ XUnmapWindow( /* * Generate damage for that area of the window. */ + TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr); } @@ -323,125 +326,22 @@ XResizeWindow( unsigned int height) { MacDrawable *macWin = (MacDrawable *) window; - CGrafPtr destPort; - destPort = TkMacOSXGetDrawablePort(window); display->request++; - if (Tk_IsTopLevel(macWin->winPtr)) { - if (!Tk_IsEmbedded(macWin->winPtr)) { - /* - * NOTE: we are not adding the new space to the update - * region. It is currently assumed that Tk will need - * to completely redraw anway. - */ - if (destPort) { - WindowRef w = GetWindowFromPort(destPort); - Rect bounds; - - ChkErr(GetWindowBounds, w, kWindowContentRgn, &bounds); - bounds.right = bounds.left + width; - bounds.bottom = bounds.top + height; - ChkErr(SetWindowBounds, w, kWindowContentRgn, &bounds); - TkMacOSXInvalidateWindow(macWin, TK_WINDOW_ONLY); - } - } else { - int deltaX, deltaY; - - /* - * Find the Parent window - - * For an embedded window this will be its container. - */ - TkWindow *contWinPtr; - - contWinPtr = TkpGetOtherWindow(macWin->winPtr); - - if (contWinPtr != NULL) { - MacDrawable *macParent = contWinPtr->privatePtr; - - if (destPort) { - TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); - TkMacOSXInvalClipRgns((Tk_Window) macParent->winPtr); - } - deltaX = macParent->xOff + - macWin->winPtr->changes.x - macWin->xOff; - deltaY = macParent->yOff + - macWin->winPtr->changes.y - macWin->yOff; - - UpdateOffsets(macWin->winPtr, deltaX, deltaY); - } else { - /* - * This is the case where we are embedded in - * another app. At this point, we are assuming that - * the changes.x,y is not maintained, if you need - * the info get it from Tk_GetRootCoords, - * and that the toplevel sits at 0,0 when it is drawn. - */ - - TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); - UpdateOffsets(macWin->winPtr, 0, 0); - } - - } - } else { - /* TODO: update all xOff & yOffs */ - int deltaX, deltaY, parentBorderwidth; - MacDrawable *macParent = macWin->winPtr->parentPtr->privatePtr; - - if (macParent == NULL) { - return; /* TODO: Probably should be a panic */ - } + if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { + CGrafPtr destPort = TkMacOSXGetDrawablePort(window); if (destPort) { - TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); - TkMacOSXInvalClipRgns((Tk_Window) macParent->winPtr); - } - deltaX = - macWin->xOff; - deltaY = - macWin->yOff; - - parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width; - - deltaX += macParent->xOff + parentBorderwidth + - macWin->winPtr->changes.x; - deltaY += macParent->yOff + parentBorderwidth + - macWin->winPtr->changes.y; - - UpdateOffsets(macWin->winPtr, deltaX, deltaY); - } -} - -/* - *---------------------------------------------------------------------- - * - * GenerateConfigureNotify -- - * - * Generates ConfigureNotify events for all the child widgets - * of the widget passed in the winPtr parameter. If includeWin - * is true, also generates ConfigureNotify event for the - * widget itself. - * - * Results: - * None. - * - * Side effects: - * ConfigureNotify events will be posted. - * - *---------------------------------------------------------------------- - */ - -static void -GenerateConfigureNotify (TkWindow *winPtr, int includeWin) -{ - TkWindow *childPtr; + WindowRef w = GetWindowFromPort(destPort); + Rect bounds; - for (childPtr = winPtr->childList; childPtr != NULL; - childPtr = childPtr->nextPtr) { - if (!Tk_IsMapped(childPtr) || Tk_IsTopLevel(childPtr)) { - continue; + ChkErr(GetWindowBounds, w, kWindowContentRgn, &bounds); + bounds.right = bounds.left + width; + bounds.bottom = bounds.top + height; + ChkErr(SetWindowBounds, w, kWindowContentRgn, &bounds); } - GenerateConfigureNotify(childPtr, 1); - } - if (includeWin) { - TkDoConfigureNotify(winPtr); + } else { + MoveResizeWindow(macWin); } } @@ -471,86 +371,23 @@ XMoveResizeWindow( unsigned int height) { MacDrawable * macWin = (MacDrawable *) window; - CGrafPtr destPort; - destPort = TkMacOSXGetDrawablePort(window); + display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { - /* - * NOTE: we are not adding the new space to the update - * region. It is currently assumed that Tk will need - * to completely redraw anway. - */ + CGrafPtr destPort = TkMacOSXGetDrawablePort(window); + if (destPort) { + WindowRef w = GetWindowFromPort(destPort); Rect bounds; bounds.left = x + macWin->winPtr->wmInfoPtr->xInParent; bounds.right = bounds.left + width; bounds.top = y + macWin->winPtr->wmInfoPtr->yInParent; bounds.bottom = bounds.top + height; - ChkErr(SetWindowBounds, GetWindowFromPort(destPort), - kWindowContentRgn, &bounds); - TkMacOSXInvalidateWindow(macWin, TK_WINDOW_ONLY); + ChkErr(SetWindowBounds, w, kWindowContentRgn, &bounds); } } else { - int deltaX, deltaY, parentBorderwidth; - Rect bounds; - MacDrawable *macParent; - - /* - * Find the Parent window - - * For an embedded window this will be its container. - */ - - if (Tk_IsEmbedded(macWin->winPtr)) { - TkWindow *contWinPtr; - - contWinPtr = TkpGetOtherWindow(macWin->winPtr); - if (contWinPtr == NULL) { - Tcl_Panic("XMoveResizeWindow could not find container"); - } - macParent = contWinPtr->privatePtr; - - /* - * NOTE: Here we should handle out of process embedding. - */ - - - } else { - macParent = macWin->winPtr->parentPtr->privatePtr; - if (macParent == NULL) { - return; /* TODO: Probably should be a panic */ - } - } - - if (destPort) { - TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); - TkMacOSXInvalClipRgns((Tk_Window) macParent->winPtr); - } - - deltaX = - macWin->xOff; - deltaY = - macWin->yOff; - - /* - * If macWin->winPtr is an embedded window, don't offset by its - * parent's borderwidth... - */ - - if (!Tk_IsEmbedded(macWin->winPtr)) { - parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width; - } else { - parentBorderwidth = 0; - } - deltaX += macParent->xOff + parentBorderwidth + - macWin->winPtr->changes.x; - deltaY += macParent->yOff + parentBorderwidth + - macWin->winPtr->changes.y; - - UpdateOffsets(macWin->winPtr, deltaX, deltaY); - if (destPort) { - TkMacOSXWinBounds(macWin->winPtr, &bounds); - InvalWindowRect(GetWindowFromPort(destPort),&bounds); - } - GenerateConfigureNotify(macWin->winPtr, 0); + MoveResizeWindow(macWin); } } @@ -560,7 +397,7 @@ XMoveResizeWindow( * XMoveWindow -- * * Move a given X window. See X windows documentation for further - * details. + * details. * * Results: * None. @@ -579,81 +416,118 @@ XMoveWindow( int y) { MacDrawable *macWin = (MacDrawable *) window; - CGrafPtr destPort; - - destPort = TkMacOSXGetDrawablePort(window); + display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { - /* - * NOTE: we are not adding the new space to the update - * region. It is currently assumed that Tk will need - * to completely redraw anway. - */ + CGrafPtr destPort = TkMacOSXGetDrawablePort(window); + if (destPort) { WindowRef w = GetWindowFromPort(destPort); - MoveWindowStructure(w, x, y); - TkMacOSXInvalidateWindow(macWin, TK_WINDOW_ONLY); + ChkErr(MoveWindowStructure, w, x, y); } } else { - int deltaX, deltaY, parentBorderwidth; - Rect bounds; - MacDrawable *macParent; + MoveResizeWindow(macWin); + } +} + +/* + *---------------------------------------------------------------------- + * + * MoveResizeWindow -- + * + * Helper proc for XResizeWindow, XMoveResizeWindow and XMoveWindow. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ - /* - * Find the Parent window - - * For an embedded window this will be its container. - */ +static void +MoveResizeWindow( + MacDrawable *macWin) +{ + int deltaX = 0, deltaY = 0, parentBorderwidth = 0; + MacDrawable *macParent = NULL; + CGrafPtr destPort = TkMacOSXGetDrawablePort((Drawable) macWin); - if (Tk_IsEmbedded(macWin->winPtr)) { - TkWindow *contWinPtr; + /* + * Find the Parent window, for an embedded window it will be its container. + */ + if (Tk_IsEmbedded(macWin->winPtr)) { + TkWindow *contWinPtr = TkpGetOtherWindow(macWin->winPtr); - contWinPtr = TkpGetOtherWindow(macWin->winPtr); - if (contWinPtr == NULL) { - Tcl_Panic("XMoveWindow could not find container"); - } + if (contWinPtr) { macParent = contWinPtr->privatePtr; - + } else { /* - * NOTE: Here we should handle out of process embedding. + * Here we should handle out of process embedding. + * At this point, we are assuming that the changes.x,y is not + * maintained, if you need the info get it from Tk_GetRootCoords, + * and that the toplevel sits at 0,0 when it is drawn. */ - - } else { - macParent = macWin->winPtr->parentPtr->privatePtr; - if (macParent == NULL) { - return; /* TODO: Probably should be a panic */ - } } - - if (destPort) { - TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); + } else { + /* TODO: update all xOff & yOffs */ + macParent = macWin->winPtr->parentPtr->privatePtr; + parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width; + } + if (macParent) { + deltaX = macParent->xOff + parentBorderwidth + + macWin->winPtr->changes.x - macWin->xOff; + deltaY = macParent->yOff + parentBorderwidth + + macWin->winPtr->changes.y - macWin->yOff; + } + if (destPort) { + TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); + if (macParent) { TkMacOSXInvalClipRgns((Tk_Window) macParent->winPtr); } + } + UpdateOffsets(macWin->winPtr, deltaX, deltaY); + if (destPort) { + TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); + } + GenerateConfigureNotify(macWin->winPtr, 0); +} + +/* + *---------------------------------------------------------------------- + * + * GenerateConfigureNotify -- + * + * Generates ConfigureNotify events for all the child widgets + * of the widget passed in the winPtr parameter. If includeWin + * is true, also generates ConfigureNotify event for the + * widget itself. + * + * Results: + * None. + * + * Side effects: + * ConfigureNotify events will be posted. + * + *---------------------------------------------------------------------- + */ - deltaX = - macWin->xOff; - deltaY = - macWin->yOff; - - /* - * If macWin->winPtr is an embedded window, don't offset by its - * parent's borderwidth... - */ - - if (!Tk_IsEmbedded(macWin->winPtr)) { - parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width; - } else { - parentBorderwidth = 0; - } - deltaX += macParent->xOff + parentBorderwidth + - macWin->winPtr->changes.x; - deltaY += macParent->yOff + parentBorderwidth + - macWin->winPtr->changes.y; +static void +GenerateConfigureNotify (TkWindow *winPtr, int includeWin) +{ + TkWindow *childPtr; - UpdateOffsets(macWin->winPtr, deltaX, deltaY); - if (destPort) { - TkMacOSXWinBounds(macWin->winPtr, &bounds); - InvalWindowRect(GetWindowFromPort(destPort),&bounds); + for (childPtr = winPtr->childList; childPtr != NULL; + childPtr = childPtr->nextPtr) { + if (!Tk_IsMapped(childPtr) || Tk_IsTopLevel(childPtr)) { + continue; } - GenerateConfigureNotify(macWin->winPtr, 0); + GenerateConfigureNotify(childPtr, 1); + } + if (includeWin) { + TkDoConfigureNotify(winPtr); } } @@ -918,7 +792,6 @@ TkMacOSXUpdateClipRgn( /* * NOTE: Here we should handle out of process embedding. */ - } SetEmptyRgn(tkMacOSXtmpRgn1); } else { @@ -974,7 +847,6 @@ TkMacOSXVisableClipRgn( if (winPtr->privatePtr->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(winPtr); } - return winPtr->privatePtr->clipRgn; } @@ -1003,25 +875,20 @@ TkMacOSXInvalidateWindow( { WindowRef windowRef; CGrafPtr grafPtr; + RgnHandle rgn; grafPtr = TkMacOSXGetDrawablePort((Drawable)macWin); windowRef = GetWindowFromPort(grafPtr); - if (macWin->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(macWin->winPtr); } - if (flag == TK_WINDOW_ONLY) { - InvalWindowRgn(windowRef, macWin->clipRgn); - } else { - if (!EmptyRgn(macWin->aboveClipRgn)) { - InvalWindowRgn(windowRef, macWin->aboveClipRgn); - } - + rgn = (flag == TK_WINDOW_ONLY) ? macWin->clipRgn : macWin->aboveClipRgn; + if (!EmptyRgn(rgn)) { + InvalWindowRgn(windowRef, rgn); + } #ifdef TK_MAC_DEBUG_CLIP_REGIONS - TkMacOSXDebugFlashRegion(grafPtr, macWin->aboveClipRgn); + TkMacOSXDebugFlashRegion(grafPtr, rgn); #endif /* TK_MAC_DEBUG_CLIP_REGIONS */ - - } } /* @@ -1103,7 +970,6 @@ TkMacOSXGetDrawablePort( /* * NOTE: Here we should handle out of process embedding. */ - } return resultPort; } @@ -1219,7 +1085,6 @@ TkMacOSXInvalClipRgns( /* * NOTE: Here we should handle out of process embedding. */ - } } @@ -1283,7 +1148,7 @@ UpdateOffsets( if (winPtr->privatePtr == NULL) { /* - * We havn't called Tk_MakeWindowExist for this window yet. The + * We haven't called Tk_MakeWindowExist for this window yet. The * offset information will be postponed and calulated at that * time. (This will usually only happen when a mapped parent is * being moved but has child windows that have yet to be mapped.) @@ -1311,7 +1176,6 @@ UpdateOffsets( /* * NOTE: Here we should handle out of process embedding. */ - } } diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 69c8ebb..41966da 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -54,7 +54,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.20 2007/05/30 06:39:38 das Exp $ + * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.21 2007/05/31 13:42:12 das Exp $ */ #include "tkMacOSXInt.h" @@ -314,6 +314,9 @@ TkMacOSXProcessWindowEvent( height = bounds.bottom - bounds.top; flags |= TK_SIZE_CHANGED; } + TkMacOSXInvalClipRgns((Tk_Window) winPtr); + TkMacOSXInvalidateWindow((MacDrawable *) window, + TK_PARENT_WINDOW); TkGenWMConfigureEvent((Tk_Window)winPtr, x, y, width, height, flags); if (attr & kWindowBoundsChangeUserResize || @@ -467,6 +470,14 @@ GenerateUpdateEvent(Window window) result = GenerateUpdates(tkMacOSXtmpRgn1, &updateBounds, winPtr); EndUpdate(macWindow); SetEmptyRgn(tkMacOSXtmpRgn1); + if (result) { + /* + * Ensure there are no pending idle-time redraws that could prevent + * the just posted Expose events from generating new redraws. + */ + + Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT); + } return result; } @@ -522,6 +533,9 @@ GenerateUpdates( SectRgn(damageRgn, updateRgn, damageRgn); OffsetRgn(damageRgn, -bounds.left, -bounds.top); GetRegionBounds(damageRgn, &damageBounds); + RectRgn(damageRgn, &bounds); + UnionRgn(damageRgn, updateRgn, updateRgn); + GetRegionBounds(updateRgn, updateBounds); SetEmptyRgn(damageRgn); event.xany.serial = Tk_Display(winPtr)->request; diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 478dc7c..41b79ca 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.37 2007/05/30 06:39:38 das Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.38 2007/05/31 13:42:13 das Exp $ */ #include "tkMacOSXInt.h" @@ -898,7 +898,7 @@ static int WmSetAttribute( wmPtr->macClass, oldAttributes, 1); ChkErr(ReshapeCustomWindow, macWindow); TkMacOSXInvalidateWindow((MacDrawable *)(winPtr->window), - TK_WINDOW_ONLY); + TK_PARENT_WINDOW); } break; case _WMATT_LAST_ATTRIBUTE: @@ -4517,6 +4517,7 @@ TkMacOSXGrowToplevel( if (wmPtr->gridWin != NULL) { int base = winPtr->reqWidth - (wmPtr->reqGridWidth * wmPtr->widthInc); + if (base < 0) { base = 0; } @@ -4702,6 +4703,19 @@ TkMacOSXIsWindowZoomed( return false; } GetMaxSize(winPtr, &maxWidth, &maxHeight); + if (wmPtr->gridWin != NULL) { + int base = winPtr->reqWidth - (wmPtr->reqGridWidth * wmPtr->widthInc); + + if (base < 0) { + base = 0; + } + maxWidth = base + (maxWidth * wmPtr->widthInc); + base = winPtr->reqHeight - (wmPtr->reqGridHeight * wmPtr->heightInc); + if (base < 0) { + base = 0; + } + maxHeight = base + (maxHeight * wmPtr->heightInc); + } if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) { idealSize.h = winPtr->changes.width; } else { @@ -4749,9 +4763,7 @@ TkMacOSXZoomToplevel( WmInfo *wmPtr; Point idealSize; int maxWidth, maxHeight; - Rect portRect; OSStatus err; - CGrafPtr destPort = GetWindowPort(whichWindow); window = TkMacOSXGetXWindow(whichWindow); dispPtr = TkGetDisplayList(); @@ -4763,6 +4775,19 @@ TkMacOSXZoomToplevel( return false; } GetMaxSize(winPtr, &maxWidth, &maxHeight); + if (wmPtr->gridWin != NULL) { + int base = winPtr->reqWidth - (wmPtr->reqGridWidth * wmPtr->widthInc); + + if (base < 0) { + base = 0; + } + maxWidth = base + (maxWidth * wmPtr->widthInc); + base = winPtr->reqHeight - (wmPtr->reqGridHeight * wmPtr->heightInc); + if (base < 0) { + base = 0; + } + maxHeight = base + (maxHeight * wmPtr->heightInc); + } if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) { idealSize.h = winPtr->changes.width; } else { @@ -4780,12 +4805,10 @@ TkMacOSXZoomToplevel( return false; } - GetPortBounds(destPort, &portRect); err = ChkErr(ZoomWindowIdeal, whichWindow, zoomPart, &idealSize); if (err == noErr) { wmPtr->hints.initial_state = (zoomPart == inZoomIn ? NormalState : ZoomState); - InvalWindowRect(whichWindow, &portRect); return true; } else { return false; @@ -5847,7 +5870,7 @@ ApplyWindowClassAttributeChanges( #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 if (wmPtr->macClass != oldClass #if MAC_OS_X_VERSION_MIN_REQUIRED < 1030 - && HIWindowChangeClass != NULL + && HIWindowChangeClass != NULL #endif ) { ChkErr(HIWindowChangeClass, macWindow, wmPtr->macClass); @@ -5871,6 +5894,8 @@ ApplyWindowClassAttributeChanges( ChkErr(HIGrowBoxViewSetTransparent, growBoxView, true); } } + TkMacOSXInvalidateWindow((MacDrawable *)(winPtr->window), + TK_PARENT_WINDOW); } /* @@ -6018,8 +6043,6 @@ TkMacOSXMakeFullscreen( ChkErr(SetWindowBounds, window, kWindowContentRgn, &screenBounds); wmPtr->flags &= ~WM_SYNC_PENDING; - TkMacOSXInvalidateWindow((MacDrawable*)winPtr->window, - TK_WINDOW_ONLY); } wmPtr->flags |= WM_FULLSCREEN; } @@ -6039,8 +6062,6 @@ TkMacOSXMakeFullscreen( wmPtr->flags |= WM_SYNC_PENDING; ChkErr(SetWindowBounds, window, kWindowStructureRgn, &bounds); wmPtr->flags &= ~WM_SYNC_PENDING; - TkMacOSXInvalidateWindow((MacDrawable*)winPtr->window, - TK_WINDOW_ONLY); } TkMacOSXEnterExitFullscreen(winPtr, IsWindowActive(window)); return result; -- cgit v0.12