richmemo: adding a workaround for richEdit not properly drawn after being minimized

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7284 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2020-01-13 22:06:39 +00:00
parent d1956180b1
commit 9100c787d7

View File

@ -300,6 +300,11 @@ begin
if Assigned(AWinControl) and (AWinControl is TCustomRichMemo) then
TIntCustomRichMemo(AWinControl).Change;
Result:=true;
if IsIconic( GetAncestor(AWinControl.Handle, GA_ROOTOWNER)) then
// hack: the RichMemo has problems repainting itself
// if changes were done while the root window was minimized
// see #34391
GetWin32WindowInfo(AWinControl.Handle)^.TrackValid:=true;
end;
end;
end;
@ -347,13 +352,28 @@ function RichEditProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
var
WindowInfo : PWin32WindowInfo;
NcHandled : Boolean; // NCPaint has painted by itself
r: TRect;
PrevWndProc: Windows.WNDPROC;
begin
case Msg of
WM_PAINT : begin
//todo: LCL WM_PAINT handling prevents richedit from drawing correctly
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam)
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
//Result := WindowProc(Window, Msg, WParam, LParam)
// hack: the RichMemo has problems repainting itself
// if changes were done while the root window was minimized
// see #34391
if GetWin32WindowInfo(Window)^.TrackValid then begin
Windows.GetWindowRect(Window, r);
OffsetRect(r, -r.left, -r.top);
r.Left:=-r.Right;
r.Top:=-r.Bottom;
InvalidateRect(Window, @r, false);
PrevWndProc := GetWin32WindowInfo(Window)^.DefWndProc;
Windows.CallWindowProcW(PrevWndProc, Window, Msg, WParam, LParam);
GetWin32WindowInfo(Window)^.TrackValid:=false;
end;
end;
//When theming is enabled, and the component should have a border around it,
WM_NCPAINT: begin
if Assigned(NCPaint) then begin