From d9515fcde572938b09db64f102295b704bd83aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salvador=20D=C3=ADaz=20Fau?= Date: Sat, 11 Oct 2025 18:16:42 +0200 Subject: [PATCH] Fixed some Wayland compatibility issues in the Lazarus demos for Linux --- demos/Lazarus_Linux_GTK3/GTKBrowser/umainwindow.pas | 10 +++++++--- demos/Lazarus_Linux_QT5/SimpleOSRBrowser/umainform.pas | 7 +++++-- demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.lfm | 1 + demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.pas | 3 +++ demos/Lazarus_Linux_QT6/SimpleOSRBrowser/umainform.pas | 4 +++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/demos/Lazarus_Linux_GTK3/GTKBrowser/umainwindow.pas b/demos/Lazarus_Linux_GTK3/GTKBrowser/umainwindow.pas index ba9ef984..eb1132ec 100644 --- a/demos/Lazarus_Linux_GTK3/GTKBrowser/umainwindow.pas +++ b/demos/Lazarus_Linux_GTK3/GTKBrowser/umainwindow.pas @@ -101,12 +101,15 @@ begin GlobalCEFApp.LogFile := 'debug.log'; GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; GlobalCEFApp.RootCache := 'RootCache'; + GlobalCEFApp.Cache := GlobalCEFApp.RootCache + '/cache'; GlobalCEFApp.DisableZygote := True; GlobalCEFApp.SetCurrentDir := True; GlobalCEFApp.MultiThreadedMessageLoop := False; GlobalCEFApp.ExternalMessagePump := False; - GlobalCEFApp.GTKVersion := gtkVersion3; - GlobalCEFApp.OzonePlatform := ozpX11; + GlobalCEFApp.GTKVersion := gtkVersion3; + GlobalCEFApp.EnableGPU := True; + //GlobalCEFApp.OzonePlatform := ozpWayland; + //GlobalCEFApp.OzonePlatform := ozpX11; GlobalCEFApp.OnContextInitialized := @GlobalCEFApp_OnContextInitialized; end; @@ -214,7 +217,8 @@ end; procedure TMainWindow.Show; begin // Show the GTK window. - UseDefaultX11VisualForGtk(FWindow); + if (GlobalCEFApp.DisplayServer = ldsX11) then + UseDefaultX11VisualForGtk(FWindow); gtk_widget_show_all(FWindow); diff --git a/demos/Lazarus_Linux_QT5/SimpleOSRBrowser/umainform.pas b/demos/Lazarus_Linux_QT5/SimpleOSRBrowser/umainform.pas index 20cf2fb2..6f6a019b 100644 --- a/demos/Lazarus_Linux_QT5/SimpleOSRBrowser/umainform.pas +++ b/demos/Lazarus_Linux_QT5/SimpleOSRBrowser/umainform.pas @@ -220,9 +220,12 @@ begin GlobalCEFApp.LogFile := 'debug.log'; GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; GlobalCEFApp.RootCache := 'RootCache'; + GlobalCEFApp.Cache := GlobalCEFApp.RootCache + '/cache'; GlobalCEFApp.SetCurrentDir := True; - GlobalCEFApp.DisableZygote := True; - GlobalCEFApp.WindowlessRenderingEnabled := True; + GlobalCEFApp.DisableZygote := True; + GlobalCEFApp.EnableGPU := True; + GlobalCEFApp.WindowlessRenderingEnabled := True; + GlobalCEFApp.GTKVersion := gtkVersion3; GlobalCEFApp.OnContextInitialized := @GlobalCEFApp_OnContextInitialized; // If you need transparency leave the GlobalCEFApp.BackgroundColor property diff --git a/demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.lfm b/demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.lfm index 6dd632e7..cff4aec5 100644 --- a/demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.lfm +++ b/demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.lfm @@ -7,6 +7,7 @@ object MainForm: TMainForm ClientHeight = 768 ClientWidth = 1024 Position = poScreenCenter + LCLVersion = '4.2.0.0' OnActivate = FormActivate OnCloseQuery = FormCloseQuery OnCreate = FormCreate diff --git a/demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.pas b/demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.pas index 0383f85f..c453dfb1 100644 --- a/demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.pas +++ b/demos/Lazarus_Linux_QT6/SimpleBrowser/umainform.pas @@ -115,8 +115,11 @@ begin GlobalCEFApp.LogFile := 'debug.log'; GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; GlobalCEFApp.RootCache := 'RootCache'; + GlobalCEFApp.Cache := GlobalCEFApp.RootCache + '/cache'; GlobalCEFApp.SetCurrentDir := True; GlobalCEFApp.DisableZygote := True; + GlobalCEFApp.EnableGPU := True; + GlobalCEFApp.GTKVersion := gtkVersion3; GlobalCEFApp.OnContextInitialized := @GlobalCEFApp_OnContextInitialized; end; diff --git a/demos/Lazarus_Linux_QT6/SimpleOSRBrowser/umainform.pas b/demos/Lazarus_Linux_QT6/SimpleOSRBrowser/umainform.pas index 6a0b34c0..5793177c 100644 --- a/demos/Lazarus_Linux_QT6/SimpleOSRBrowser/umainform.pas +++ b/demos/Lazarus_Linux_QT6/SimpleOSRBrowser/umainform.pas @@ -220,9 +220,11 @@ begin GlobalCEFApp.LogFile := 'debug.log'; GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; GlobalCEFApp.WindowlessRenderingEnabled := True; - GlobalCEFApp.RootCache := 'RootCache'; + GlobalCEFApp.RootCache := 'RootCache'; + GlobalCEFApp.Cache := GlobalCEFApp.RootCache + '/Cache'; GlobalCEFApp.SetCurrentDir := True; GlobalCEFApp.DisableZygote := True; + GlobalCEFApp.GTKVersion := gtkVersion3; GlobalCEFApp.OnContextInitialized := @GlobalCEFApp_OnContextInitialized; // If you need transparency leave the GlobalCEFApp.BackgroundColor property