reduced paint messages on destroy

git-svn-id: trunk@2660 -
This commit is contained in:
mattias 2002-08-17 23:41:34 +00:00
parent d2ef70e4c2
commit f3340fb77b
3 changed files with 164 additions and 135 deletions

View File

@ -1618,11 +1618,14 @@ var
end;
begin
if (Parent=nil) or (not Parent.HandleAllocated)
or ([csLoading,csDestroying]*Parent.ComponentState<>[])
or ([csLoading,csDestroying]*ComponentState<>[])
then exit;
if (IsVisible or (csDesigning in ComponentState)
and not (csNoDesignVisible in ControlStyle))
and (Parent <> nil) and Parent.HandleAllocated
and (not (csLoading in Parent.ComponentState)) then
begin
then begin
Rect := BoundsRect;
InvalidateRect(Parent.Handle, @Rect, not (IsOpaque or
(csOpaque in Parent.ControlStyle) or BackgroundClipped));
@ -1655,10 +1658,11 @@ procedure TControl.Repaint;
var
DC: HDC;
begin
if (Parent=nil) or (not Parent.HandleAllocated)
or (csDestroying in ComponentState) then exit;
if (Visible or (csDesigning in ComponentState)
and not (csNoDesignVisible in ControlStyle))
and (Parent <> nil)
and Parent.HandleAllocated
then
if csOpaque in ControlStyle then
begin
@ -2414,6 +2418,9 @@ end;
{ =============================================================================
$Log$
Revision 1.135 2003/06/20 12:56:53 mattias
reduced paint messages on destroy
Revision 1.134 2003/06/13 14:38:01 mattias
fixed using streamed clientwith/height for child anchors

View File

@ -1155,6 +1155,8 @@ var
ControlsNeedsClipping: boolean;
begin
//writeln('[TWinControl.PaintHandler] ',Name,':',ClassName,' DC=',HexStr(Message.DC,8));
if (csDestroying in ComponentState) or (not HandleAllocated) then exit;
Assert(False, Format('Trace:> [TWinControl.PaintHandler] %s --> Msg.DC: 0x%x', [ClassName, TheMessage.DC]));
DC := TheMessage.DC;
if DC = 0 then DC := BeginPaint(Handle, PS);
@ -1200,6 +1202,10 @@ var
TempControl : TCOntrol;
begin
//writeln('[TWinControl.PaintControls] ',Name,':',ClassName,' DC=',HexStr(DC,8));
if (csDestroying in ComponentState)
or ((DC=0) and (not HandleAllocated)) then
exit;
// Controls that are not TWinControl, have no handle of their own, and so
// they are repainted as part of the parent:
if FControls <> nil then
@ -1258,6 +1264,10 @@ var
Message: TLMessage;
begin
//writeln('[TWinControl.PaintWindow] ',Name,':',Classname,' DC=',HexStr(DC,8));
if (csDestroying in ComponentState)
or ((DC=0) and (not HandleAllocated)) then
exit;
Message.Msg := LM_PAINT;
Message.WParam := DC;
Message.LParam := 0;
@ -1727,7 +1737,7 @@ end;
{------------------------------------------------------------------------------}
Procedure TWinControl.Invalidate;
Begin
if HandleAllocated
if HandleAllocated and (not (csDestroying in ComponentState))
then CNSendMessage(LM_Invalidate,Self,Nil);
end;
@ -1736,13 +1746,12 @@ end;
{------------------------------------------------------------------------------}
Procedure TWinControl.Repaint;
Begin
if HandleAllocated
if HandleAllocated and (not (csDestroying in ComponentState))
then begin
CNSendMessage(LM_PAINT, Self, nil);
end;
end;
{------------------------------------------------------------------------------}
{ TWinControl DoMouseWheel "Event Handler" }
{------------------------------------------------------------------------------}
@ -2161,6 +2170,8 @@ var
PS : TPaintStruct;
begin
//writeln('[TWinControl.WMPaint] ',Name,':',ClassName,' ',HexStr(Msg.DC,8));
if (csDestroying in ComponentState) then exit;
Assert(False, Format('Trace:> [TWinControl.WMPaint] %s Msg.DC: 0x%x', [ClassName, Msg.DC]));
if (Msg.DC <> 0) then
begin
@ -2816,6 +2827,9 @@ end;
{ =============================================================================
$Log$
Revision 1.141 2003/06/20 12:56:53 mattias
reduced paint messages on destroy
Revision 1.140 2003/06/19 22:38:21 mattias
fixed update on changing package usage options

View File

@ -2332,6 +2332,7 @@ var
aStyle := gtk_style_attach(gtk_style_ref(aStyle),aDC.Drawable);
end;
if aStyle<>nil then begin
If (DFCS_FLAT and uState)<>0 then
gtk_paint_flat_box(aStyle,aDC.Drawable,
State,
@ -2350,6 +2351,7 @@ var
'button',
Rect.Left+DCOrigin.X,Rect.Top+DCOrigin.Y,
Rect.Right-Rect.Left,Rect.Bottom-Rect.Top);
end;
Result := True;
end;
@ -2398,6 +2400,7 @@ var
Widget := GetStyleWidget('default');
If (Widget <> nil) and (Style <> nil) then begin
Widget^.Window := aDC.Drawable;
if Style<>nil then
gtk_paint_check(Style,aDC.Drawable, State,
Shadow, nil, Widget, 'checkbutton',
Rect.Left+DCOrigin.X,Rect.Top+DCOrigin.Y,
@ -2406,6 +2409,7 @@ var
end
else begin
{$IfNDef Win32}
if Style<>nil then
gtk_draw_check(Style,aDC.Drawable, State,
Shadow, Rect.Left+DCOrigin.X,Rect.Top+DCOrigin.Y,
Rect.Right-Rect.Left, Rect.Bottom-Rect.Top);
@ -3260,20 +3264,22 @@ var
//RightBottomGC: PGdkGC;
begin
Result := IsValidDC(DC);
if Result then
if not Result then exit;
if FrameWidth=0 then exit;
with TDeviceContext(DC) do
begin
if GC = nil then begin
Result:= False;
end
else begin
exit;
end;
Widget:=PGtkWidget(TDeviceContext(DC).Wnd);
ClientWidget:=GetFixedWidget(Widget);
if ClientWidget=nil then
ClientWidget:=Widget;
AWindow:=GetControlWindow(ClientWidget);
if AWindow<>nil then begin
if AWindow=nil then begin
exit;
end;
DCOrigin:=GetDCOffset(TDeviceContext(DC));
TheStyle:=GetStyle('button');
Area.X:=ARect.Left+DCOrigin.X;
@ -3321,6 +3327,7 @@ begin
gdk_draw_line(Drawable, RightBottomGC,
ARect.Left+DCOrigin.X, ARect.Bottom+DCOrigin.Y,
ARect.Right+DCOrigin.X, ARect.Bottom+DCOrigin.Y);}
if TheStyle<>nil then
gtk_paint_shadow(TheStyle,
AWindow, GTK_STATE_NORMAL,
ShadowType,
@ -3332,8 +3339,6 @@ begin
InflateRect(ARect, -1, -1);
end;
end;
end;
end;
end;
{------------------------------------------------------------------------------
@ -8291,6 +8296,9 @@ end;
{ =============================================================================
$Log$
Revision 1.246 2003/06/20 12:56:53 mattias
reduced paint messages on destroy
Revision 1.245 2003/06/19 09:26:58 mattias
fixed changing unitname during update