1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-22 22:17:48 +02:00

Added GlobalCEFApp.GTKVersion in Linux

Set GlobalCEFApp.GTKVersion to gtkVersion3 in TinyBrowser and TinyBrowser2 for Lazarus and GTK3 in order to avoid an initial error because the app and Chromium are trying to load diferent versions of GTK.
This commit is contained in:
Salvador Díaz Fau
2025-04-25 16:51:53 +02:00
parent 232e06c8c7
commit 3904180367
5 changed files with 38 additions and 1 deletions

View File

@ -239,6 +239,7 @@ begin
GlobalCEFApp.SetCurrentDir := True;
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
GlobalCEFApp.OnGetDefaultClient := GlobalCEFApp_OnGetDefaultClient;
GlobalCEFApp.GTKVersion := gtkVersion3;
end;
procedure DestroyTinyBrowser;

View File

@ -93,6 +93,7 @@ begin
GlobalCEFApp.SetCurrentDir := True;
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
GlobalCEFApp.OnGetDefaultClient := GlobalCEFApp_OnGetDefaultClient;
GlobalCEFApp.GTKVersion := gtkVersion3;
// Add a debug log in the BIN directory
//GlobalCEFApp.LogFile := 'cef.log';

View File

@ -163,6 +163,7 @@ type
FPostQuantumKyber : TCefState;
{$IFDEF LINUX}
FPasswordStorage : TCefPasswordStorage;
FGTKVersion : TCefGTKVersion;
{$ENDIF}
@ -1325,6 +1326,13 @@ type
/// <para><see href="https://source.chromium.org/chromium/chromium/src/+/main:docs/linux/password_storage.md">Chromium document: docs/linux/password_storage.md</see></para>
/// </remarks>
property PasswordStorage : TCefPasswordStorage read FPasswordStorage write FPasswordStorage;
/// <summary>
/// Preferred GTK version loaded by Chromium.
/// </summary>
/// <remarks>
/// <para><see href="https://github.com/chromium/chromium/blob/main/ui/gtk/gtk_compat.cc">See the LoadGtkImpl function in ui/gtk/gtk_compat.cc</see></para>
/// </remarks>
property GTKVersion : TCefGTKVersion read FGTKVersion write FGTKVersion;
{$ENDIF}
/// <summary>
/// Ignores certificate-related errors.
@ -2003,6 +2011,7 @@ begin
FPostQuantumKyber := STATE_DEFAULT;
{$IFDEF LINUX}
FPasswordStorage := psDefault;
FGTKVersion := gtkVersionDefault;
{$ENDIF}
// Fields used during the CEF initialization
@ -3687,6 +3696,11 @@ begin
psKWallet6 : ReplaceSwitch(aKeys, aValues, '--password-store', 'kwallet6');
psBasic : ReplaceSwitch(aKeys, aValues, '--password-store', 'basic');
end;
case FGTKVersion of
gtkVersion3 : ReplaceSwitch(aKeys, aValues, '--gtk-version', '3');
gtkVersion4 : ReplaceSwitch(aKeys, aValues, '--gtk-version', '4');
end;
{$ENDIF}
// The list of features you can enable is here :

View File

@ -456,6 +456,27 @@ type
/// Plain text.
/// </summary>
psBasic);
/// <summary>
/// Preferred GTK version loaded by Chromium.
/// </summary>
/// <remarks>
/// <para><see href="https://github.com/chromium/chromium/blob/main/ui/gtk/gtk_compat.cc">See the LoadGtkImpl function in ui/gtk/gtk_compat.cc</see></para>
/// </remarks>
TCefGTKVersion = (
/// <summary>
/// Chromium tries to load the default GTK version.
/// </summary>
gtkVersionDefault,
/// <summary>
/// Chromium tries to load GTK 3 first.
/// </summary>
gtkVersion3,
/// <summary>
/// Chromium tries to load GTK 4 first.
/// </summary>
gtkVersion4
);
{$ENDIF}
/// <summary>

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 726,
"InternalVersion" : 727,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "135.0.22"
}