redraw fix backported
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20613 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -43,6 +43,8 @@
|
|||||||
#include "wx/tooltip.h"
|
#include "wx/tooltip.h"
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
|
|
||||||
|
#include "ToolUtils.h"
|
||||||
|
|
||||||
#define wxMAC_DEBUG_REDRAW 0
|
#define wxMAC_DEBUG_REDRAW 0
|
||||||
#ifndef wxMAC_DEBUG_REDRAW
|
#ifndef wxMAC_DEBUG_REDRAW
|
||||||
#define wxMAC_DEBUG_REDRAW 0
|
#define wxMAC_DEBUG_REDRAW 0
|
||||||
@@ -60,6 +62,7 @@ static Point gs_lastWhere;
|
|||||||
static long gs_lastWhen = 0;
|
static long gs_lastWhen = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
|
static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
|
||||||
#endif
|
#endif
|
||||||
@@ -442,13 +445,28 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
|
|||||||
|
|
||||||
wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
|
wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
|
||||||
|
|
||||||
|
|
||||||
|
RgnHandle visRgn = NewRgn() ;
|
||||||
|
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), visRgn );
|
||||||
BeginUpdate( (WindowRef)m_macWindow ) ;
|
BeginUpdate( (WindowRef)m_macWindow ) ;
|
||||||
|
|
||||||
RgnHandle updateRgn = NewRgn();
|
RgnHandle updateRgn = NewRgn();
|
||||||
RgnHandle diffRgn = NewRgn() ;
|
RgnHandle diffRgn = NewRgn() ;
|
||||||
if ( updateRgn && diffRgn )
|
if ( updateRgn && diffRgn )
|
||||||
{
|
{
|
||||||
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn );
|
// macos internal control redraws clean up areas we'd like to redraw ourselves
|
||||||
|
// therefore we pick the boundary rect and make sure we can redraw it
|
||||||
|
// this has to be intersected by the visRgn in order to avoid drawing over its own
|
||||||
|
// boundaries
|
||||||
|
RgnHandle trueUpdateRgn = NewRgn() ;
|
||||||
|
Rect trueUpdateRgnBoundary ;
|
||||||
|
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), trueUpdateRgn );
|
||||||
|
GetRegionBounds( trueUpdateRgn , &trueUpdateRgnBoundary ) ;
|
||||||
|
RectRgn( updateRgn , &trueUpdateRgnBoundary ) ;
|
||||||
|
SectRgn( updateRgn , visRgn , updateRgn ) ;
|
||||||
|
if ( trueUpdateRgn )
|
||||||
|
DisposeRgn( trueUpdateRgn ) ;
|
||||||
|
SetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ;
|
||||||
DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
|
DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
|
||||||
if ( !EmptyRgn( updateRgn ) )
|
if ( !EmptyRgn( updateRgn ) )
|
||||||
{
|
{
|
||||||
@@ -459,6 +477,9 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
|
|||||||
DisposeRgn( updateRgn );
|
DisposeRgn( updateRgn );
|
||||||
if ( diffRgn )
|
if ( diffRgn )
|
||||||
DisposeRgn( diffRgn );
|
DisposeRgn( diffRgn );
|
||||||
|
if ( visRgn )
|
||||||
|
DisposeRgn( visRgn ) ;
|
||||||
|
|
||||||
EndUpdate( (WindowRef)m_macWindow ) ;
|
EndUpdate( (WindowRef)m_macWindow ) ;
|
||||||
SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
|
SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
|
||||||
m_macNeedsErasing = false ;
|
m_macNeedsErasing = false ;
|
||||||
@@ -866,6 +887,7 @@ bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
|
|||||||
// http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm
|
// http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
|
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
|
||||||
{
|
{
|
||||||
|
@@ -43,6 +43,8 @@
|
|||||||
#include "wx/tooltip.h"
|
#include "wx/tooltip.h"
|
||||||
#include "wx/dnd.h"
|
#include "wx/dnd.h"
|
||||||
|
|
||||||
|
#include "ToolUtils.h"
|
||||||
|
|
||||||
#define wxMAC_DEBUG_REDRAW 0
|
#define wxMAC_DEBUG_REDRAW 0
|
||||||
#ifndef wxMAC_DEBUG_REDRAW
|
#ifndef wxMAC_DEBUG_REDRAW
|
||||||
#define wxMAC_DEBUG_REDRAW 0
|
#define wxMAC_DEBUG_REDRAW 0
|
||||||
@@ -60,6 +62,7 @@ static Point gs_lastWhere;
|
|||||||
static long gs_lastWhen = 0;
|
static long gs_lastWhen = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
|
static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
|
||||||
#endif
|
#endif
|
||||||
@@ -442,13 +445,28 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
|
|||||||
|
|
||||||
wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
|
wxMacPortStateHelper help( (GrafPtr) GetWindowPort( (WindowRef) m_macWindow) ) ;
|
||||||
|
|
||||||
|
|
||||||
|
RgnHandle visRgn = NewRgn() ;
|
||||||
|
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), visRgn );
|
||||||
BeginUpdate( (WindowRef)m_macWindow ) ;
|
BeginUpdate( (WindowRef)m_macWindow ) ;
|
||||||
|
|
||||||
RgnHandle updateRgn = NewRgn();
|
RgnHandle updateRgn = NewRgn();
|
||||||
RgnHandle diffRgn = NewRgn() ;
|
RgnHandle diffRgn = NewRgn() ;
|
||||||
if ( updateRgn && diffRgn )
|
if ( updateRgn && diffRgn )
|
||||||
{
|
{
|
||||||
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn );
|
// macos internal control redraws clean up areas we'd like to redraw ourselves
|
||||||
|
// therefore we pick the boundary rect and make sure we can redraw it
|
||||||
|
// this has to be intersected by the visRgn in order to avoid drawing over its own
|
||||||
|
// boundaries
|
||||||
|
RgnHandle trueUpdateRgn = NewRgn() ;
|
||||||
|
Rect trueUpdateRgnBoundary ;
|
||||||
|
GetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), trueUpdateRgn );
|
||||||
|
GetRegionBounds( trueUpdateRgn , &trueUpdateRgnBoundary ) ;
|
||||||
|
RectRgn( updateRgn , &trueUpdateRgnBoundary ) ;
|
||||||
|
SectRgn( updateRgn , visRgn , updateRgn ) ;
|
||||||
|
if ( trueUpdateRgn )
|
||||||
|
DisposeRgn( trueUpdateRgn ) ;
|
||||||
|
SetPortVisibleRegion( GetWindowPort( (WindowRef)m_macWindow ), updateRgn ) ;
|
||||||
DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
|
DiffRgn( updateRgn , (RgnHandle) m_macNoEraseUpdateRgn , diffRgn ) ;
|
||||||
if ( !EmptyRgn( updateRgn ) )
|
if ( !EmptyRgn( updateRgn ) )
|
||||||
{
|
{
|
||||||
@@ -459,6 +477,9 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
|
|||||||
DisposeRgn( updateRgn );
|
DisposeRgn( updateRgn );
|
||||||
if ( diffRgn )
|
if ( diffRgn )
|
||||||
DisposeRgn( diffRgn );
|
DisposeRgn( diffRgn );
|
||||||
|
if ( visRgn )
|
||||||
|
DisposeRgn( visRgn ) ;
|
||||||
|
|
||||||
EndUpdate( (WindowRef)m_macWindow ) ;
|
EndUpdate( (WindowRef)m_macWindow ) ;
|
||||||
SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
|
SetEmptyRgn( (RgnHandle) m_macNoEraseUpdateRgn ) ;
|
||||||
m_macNeedsErasing = false ;
|
m_macNeedsErasing = false ;
|
||||||
@@ -866,6 +887,7 @@ bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
|
|||||||
// http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm
|
// http://developer.apple.com/samplecode/Sample_Code/Human_Interface_Toolbox/Mac_OS_High_Level_Toolbox/CustomWindow.htm
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
|
static void wxShapedMacWindowGetPos(WindowRef window, Rect* inRect)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user