LCL-GTK2: Prevent flickering in TOpenGLControl. Turn DoubleBuffered off. Issue #33864, patch from accorp.

git-svn-id: trunk@59111 -
This commit is contained in:
juha 2018-09-21 09:13:12 +00:00
parent fd64c39c73
commit 2ee72166e4
3 changed files with 12 additions and 4 deletions

View File

@ -275,6 +275,7 @@ type
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): HWND; override;
class procedure DestroyHandle(const AWinControl: TWinControl); override;
class function GetDoubleBuffered(const AWinControl: TWinControl): Boolean; override;
end;
@ -723,6 +724,11 @@ begin
TWSWinControlClass(ClassParent).DestroyHandle(AWinControl);
end;
class function TWSOpenGLControl.GetDoubleBuffered(const AWinControl: TWinControl): Boolean;
begin
Result := False;
end;
initialization
RegisterWSComponent(TCustomOpenGLControl,TWSOpenGLControl);

View File

@ -45,7 +45,7 @@ uses
LMessages, LCLProc, LCLIntf, LCLType, GraphType, GraphMath,
Graphics, Menus, Themes, Buttons, StdCtrls, CheckLst, ComCtrls, Spin, ExtCtrls,
LCLPlatformDef, InterfaceBase,
WSLCLClasses,
WSLCLClasses, WSControls,
Gtk2WinApiWindow, Gtk2Globals, Gtk2Proc, Gtk2Def, Gtk2FontCache, Gtk2Extra,
Gtk2MsgQueue;

View File

@ -138,7 +138,7 @@ begin
else Control := nil;
if (Control <> nil)
and Control.DoubleBuffered
and TWSWinControlClass(Control.WidgetSetClass).GetDoubleBuffered(Control)
and not GTK_WIDGET_DOUBLE_BUFFERED({%H-}PGTKWidget(Handle))
then begin
//DebugLn(['TGtk2WidgetSet.BeginPaint ',DbgSName(Control)]);
@ -2837,8 +2837,10 @@ begin
then Control := TWinControl(GetLCLObject({%H-}Pointer(Handle)))
else Control := nil;
If (Control <> nil) and (not GTK_WIDGET_DOUBLE_BUFFERED(({%H-}PGTKWidget(Handle)))) and (Control.DoubleBuffered) then
begin
if (Control <> nil)
and TWSWinControlClass(Control.WidgetSetClass).GetDoubleBuffered(Control)
and not GTK_WIDGET_DOUBLE_BUFFERED({%H-}PGTKWidget(Handle))
then begin
gdk_window_thaw_updates(TGtkDeviceContext(PS.HDC).Drawable);
gdk_window_end_paint (TGtkDeviceContext(PS.HDC).Drawable);
end;