mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-29 18:42:50 +02:00
LCL-GTK2: Prevent flickering in TOpenGLControl. Turn DoubleBuffered off. Issue #33864, patch from accorp.
git-svn-id: trunk@59111 -
This commit is contained in:
parent
fd64c39c73
commit
2ee72166e4
@ -275,6 +275,7 @@ type
|
|||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): HWND; override;
|
const AParams: TCreateParams): HWND; override;
|
||||||
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
||||||
|
class function GetDoubleBuffered(const AWinControl: TWinControl): Boolean; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -723,6 +724,11 @@ begin
|
|||||||
TWSWinControlClass(ClassParent).DestroyHandle(AWinControl);
|
TWSWinControlClass(ClassParent).DestroyHandle(AWinControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TWSOpenGLControl.GetDoubleBuffered(const AWinControl: TWinControl): Boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterWSComponent(TCustomOpenGLControl,TWSOpenGLControl);
|
RegisterWSComponent(TCustomOpenGLControl,TWSOpenGLControl);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ uses
|
|||||||
LMessages, LCLProc, LCLIntf, LCLType, GraphType, GraphMath,
|
LMessages, LCLProc, LCLIntf, LCLType, GraphType, GraphMath,
|
||||||
Graphics, Menus, Themes, Buttons, StdCtrls, CheckLst, ComCtrls, Spin, ExtCtrls,
|
Graphics, Menus, Themes, Buttons, StdCtrls, CheckLst, ComCtrls, Spin, ExtCtrls,
|
||||||
LCLPlatformDef, InterfaceBase,
|
LCLPlatformDef, InterfaceBase,
|
||||||
WSLCLClasses,
|
WSLCLClasses, WSControls,
|
||||||
Gtk2WinApiWindow, Gtk2Globals, Gtk2Proc, Gtk2Def, Gtk2FontCache, Gtk2Extra,
|
Gtk2WinApiWindow, Gtk2Globals, Gtk2Proc, Gtk2Def, Gtk2FontCache, Gtk2Extra,
|
||||||
Gtk2MsgQueue;
|
Gtk2MsgQueue;
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ begin
|
|||||||
else Control := nil;
|
else Control := nil;
|
||||||
|
|
||||||
if (Control <> nil)
|
if (Control <> nil)
|
||||||
and Control.DoubleBuffered
|
and TWSWinControlClass(Control.WidgetSetClass).GetDoubleBuffered(Control)
|
||||||
and not GTK_WIDGET_DOUBLE_BUFFERED({%H-}PGTKWidget(Handle))
|
and not GTK_WIDGET_DOUBLE_BUFFERED({%H-}PGTKWidget(Handle))
|
||||||
then begin
|
then begin
|
||||||
//DebugLn(['TGtk2WidgetSet.BeginPaint ',DbgSName(Control)]);
|
//DebugLn(['TGtk2WidgetSet.BeginPaint ',DbgSName(Control)]);
|
||||||
@ -2837,8 +2837,10 @@ begin
|
|||||||
then Control := TWinControl(GetLCLObject({%H-}Pointer(Handle)))
|
then Control := TWinControl(GetLCLObject({%H-}Pointer(Handle)))
|
||||||
else Control := nil;
|
else Control := nil;
|
||||||
|
|
||||||
If (Control <> nil) and (not GTK_WIDGET_DOUBLE_BUFFERED(({%H-}PGTKWidget(Handle)))) and (Control.DoubleBuffered) then
|
if (Control <> nil)
|
||||||
begin
|
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_thaw_updates(TGtkDeviceContext(PS.HDC).Drawable);
|
||||||
gdk_window_end_paint (TGtkDeviceContext(PS.HDC).Drawable);
|
gdk_window_end_paint (TGtkDeviceContext(PS.HDC).Drawable);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user