diff --git a/lcl/interfaces/win32/win32pagecontrol.inc b/lcl/interfaces/win32/win32pagecontrol.inc index d54e09aaec..93e8fdd217 100644 --- a/lcl/interfaces/win32/win32pagecontrol.inc +++ b/lcl/interfaces/win32/win32pagecontrol.inc @@ -655,12 +655,6 @@ begin Result := (AIndex <> -1) and (AIndex <> ACurIndex); end; -class function TWin32WSCustomTabControl.GetDoubleBuffered( - const AWinControl: TWinControl): Boolean; -begin - Result := GetWin32ThemedDoubleBuffered(AWinControl); -end; - class procedure TWin32WSCustomTabControl.SetTabSize( const ATabControl: TCustomTabControl; const ATabWidth, ATabHeight: integer); diff --git a/lcl/interfaces/win32/win32proc.pp b/lcl/interfaces/win32/win32proc.pp index c62781c70e..499f297500 100644 --- a/lcl/interfaces/win32/win32proc.pp +++ b/lcl/interfaces/win32/win32proc.pp @@ -87,7 +87,7 @@ function GetLCLClientBoundsOffset(Handle: HWnd; out Rect: TRect): boolean; procedure LCLBoundsToWin32Bounds(Sender: TObject; var Left, Top, Width, Height: Integer); procedure Win32PosToLCLPos(Sender: TObject; var Left, Top: SmallInt); procedure GetWin32ControlPos(Window, Parent: HWND; var Left, Top: integer); -function GetWin32ThemedDoubleBuffered(Sender: TWinControl): boolean; +function GetWin32NativeDoubleBuffered(Sender: TWinControl): boolean; procedure UpdateWindowStyle(Handle: HWnd; Style: integer; StyleMask: integer); @@ -784,12 +784,12 @@ begin Top := winRect.Top - parRect.Top; end; -function GetWin32ThemedDoubleBuffered(Sender: TWinControl): boolean; +function GetWin32NativeDoubleBuffered(Sender: TWinControl): boolean; begin - // force double buffering when themes are enabled and there is no remote session + // disable auto-DoubleBuffered to allow animations, see #33832 Result := - Sender.DoubleBuffered - or (ThemeServices.ThemesEnabled and (GetSystemMetrics(SM_REMOTESESSION)=0)); + Sender.DoubleBuffered + and not(ThemeServices.ThemesEnabled and (Application.DoubleBuffered=adbDefault) and Sender.ParentDoubleBuffered); end; { diff --git a/lcl/interfaces/win32/win32treeview.inc b/lcl/interfaces/win32/win32treeview.inc index 298dc752dc..4171bc68a0 100644 --- a/lcl/interfaces/win32/win32treeview.inc +++ b/lcl/interfaces/win32/win32treeview.inc @@ -9,9 +9,3 @@ } { TWin32WSCustomTreeView } - -class function TWin32WSCustomTreeView.GetDoubleBuffered( - const AWinControl: TWinControl): Boolean; -begin - Result := GetWin32ThemedDoubleBuffered(AWinControl); -end; diff --git a/lcl/interfaces/win32/win32wscomctrls.pp b/lcl/interfaces/win32/win32wscomctrls.pp index 7866b3c911..70011930e4 100644 --- a/lcl/interfaces/win32/win32wscomctrls.pp +++ b/lcl/interfaces/win32/win32wscomctrls.pp @@ -65,7 +65,6 @@ type class procedure RemovePage(const ATabControl: TCustomTabControl; const AIndex: integer); override; - class function GetDoubleBuffered(const AWinControl: TWinControl): Boolean; override; class function GetNotebookMinTabHeight(const AWinControl: TWinControl): integer; override; class function GetNotebookMinTabWidth(const AWinControl: TWinControl): integer; override; class function GetTabIndexAtPos(const ATabControl: TCustomTabControl; const AClientPos: TPoint): integer; override; @@ -97,7 +96,6 @@ type class procedure SetPanelText(const AStatusBar: TStatusBar; PanelIndex: integer); override; class procedure SetSizeGrip(const AStatusBar: TStatusBar; SizeGrip: Boolean); override; class procedure SetText(const AWinControl: TWinControl; const AText: string); override; - class function GetDoubleBuffered(const AWinControl: TWinControl): Boolean; override; class procedure GetPreferredSize(const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override; @@ -263,7 +261,6 @@ type TWin32WSCustomTreeView = class(TWSCustomTreeView) published - class function GetDoubleBuffered(const AWinControl: TWinControl): Boolean; override; end; { TWin32WSTreeView } @@ -489,12 +486,6 @@ begin end; end; -class function TWin32WSStatusBar.GetDoubleBuffered( - const AWinControl: TWinControl): Boolean; -begin - Result := GetWin32ThemedDoubleBuffered(AWinControl); -end; - class function TWin32WSStatusBar.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; var diff --git a/lcl/interfaces/win32/win32wsfactory.pas b/lcl/interfaces/win32/win32wsfactory.pas index 93ad8c04c7..e332d33426 100644 --- a/lcl/interfaces/win32/win32wsfactory.pas +++ b/lcl/interfaces/win32/win32wsfactory.pas @@ -209,8 +209,8 @@ end; function RegisterCustomTreeView: Boolean; alias : 'WSRegisterCustomTreeView'; begin - RegisterWSComponent(TCustomTreeView, TWin32WSCustomTreeView); - Result := True; + //RegisterWSComponent(TCustomTreeView, TWin32WSCustomTreeView); + Result := False; end; // calendar diff --git a/lcl/interfaces/win32/win32wsgrids.pp b/lcl/interfaces/win32/win32wsgrids.pp index dfc1131fc0..3840446bdf 100644 --- a/lcl/interfaces/win32/win32wsgrids.pp +++ b/lcl/interfaces/win32/win32wsgrids.pp @@ -41,19 +41,12 @@ type class procedure SendCharToEditor(AEditor:TWinControl; Ch: TUTF8Char); override; class function GetEditorBoundsFromCellRect(ACanvas: TCanvas; const ACellRect: TRect; const AColumnLayout: TTextLayout): TRect; override; - class function GetDoubleBuffered(const AWinControl: TWinControl): Boolean; override; end; implementation { TWin32WSCustomGrid } -class function TWin32WSCustomGrid.GetDoubleBuffered( - const AWinControl: TWinControl): Boolean; -begin - Result := GetWin32ThemedDoubleBuffered(AWinControl); -end; - class function TWin32WSCustomGrid.GetEditorBoundsFromCellRect(ACanvas: TCanvas; const ACellRect: TRect; const AColumnLayout: TTextLayout): TRect; var diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index f59ae70f8a..f7fb8a0a38 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -257,6 +257,7 @@ type published class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; override; + class function GetDoubleBuffered(const AWinControl: TWinControl): Boolean; override; class procedure SetDefault(const AButton: TCustomButton; ADefault: Boolean); override; class procedure SetShortCut(const AButton: TCustomButton; const ShortCutK1, ShortCutK2: TShortCut); override; end; @@ -441,7 +442,7 @@ begin WM_ERASEBKGND: begin Control := GetWin32WindowInfo(Window)^.WinControl; - if not Control.DoubleBuffered then + if not TWSWinControlClass(Control.WidgetSetClass).GetDoubleBuffered(Control) then begin LMessage.msg := Msg; LMessage.wParam := WParam; @@ -1782,7 +1783,7 @@ begin WM_ERASEBKGND: begin Control := GetWin32WindowInfo(Window)^.WinControl; - if not Control.DoubleBuffered then + if not TWSWinControlClass(Control.WidgetSetClass).GetDoubleBuffered(Control) then begin LMessage.msg := Msg; LMessage.wParam := WParam; @@ -1819,6 +1820,12 @@ begin Result := Params.Window; end; +class function TWin32WSButton.GetDoubleBuffered( + const AWinControl: TWinControl): Boolean; +begin + Result := GetWin32NativeDoubleBuffered(AWinControl); +end; + class procedure TWin32WSButton.SetDefault(const AButton: TCustomButton; ADefault: Boolean); var WindowStyle: dword; @@ -1853,6 +1860,7 @@ begin with Params do begin pClassName := @ButtonClsName[0]; + SubClassWndProc := @ButtonWndProc; WindowTitle := StrCaption; end; // create window @@ -1863,7 +1871,7 @@ end; class function TWin32WSCustomCheckBox.GetDoubleBuffered( const AWinControl: TWinControl): Boolean; begin - Result := GetWin32ThemedDoubleBuffered(AWinControl); + Result := GetWin32NativeDoubleBuffered(AWinControl); end; class procedure TWin32WSCustomCheckBox.GetPreferredSize(const AWinControl: TWinControl; @@ -1971,6 +1979,7 @@ begin with Params do begin pClassName := @ButtonClsName[0]; + SubClassWndProc := @ButtonWndProc; WindowTitle := StrCaption; end; // create window