From 4733ddab58e22bfe78c4609ad01ba813b385cf88 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Fri, 3 Jul 2026 14:56:46 +0300 Subject: [PATCH] =?UTF-8?q?feat(opengl):=20=D0=BF=D0=B5=D1=80=D0=B5=D1=85?= =?UTF-8?q?=D0=BE=D0=B4=20=D0=BD=D0=B0=20LazOpenGLContextEx=20=E2=80=94=20?= =?UTF-8?q?GL-=D1=80=D0=B5=D0=BD=D0=B4=D0=B5=D1=80=20=D0=B2=20=D0=BD=D0=B0?= =?UTF-8?q?=D1=82=D0=B8=D0=B2=D0=BD=D0=BE=D0=BC=20Wayland?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Пакет LazOpenGLContext заменён на LazOpenGLContextEx (форк в ../lazOpengl): Qt6-бэкенд работает поверх настоящего QOpenGLWidget (своя C++-либа libqlclglwidget) вместо GLX-контекста на winId(), поэтому --opengl теперь работает в нативной Wayland-сессии, а под ws=qt6 открывается путь на Windows/macOS. - uses OpenGLContext -> OpenGLContextEx (класс TOpenGLControl тот же) - удалена заглушка QtPlatformAllowsOpenGLControls с советом про XWayland: больше не нужна - рантайм-зависимость: libqlclglwidget.so рядом с бинарником (сборка: make -C ../lazOpengl/csrc install-app APPDIR=bin/x86_64-linux) Проверено на живом эфире (QO-100): спектр/водопад через GL под Wayland и xcb, прозрачность FBO-альфы починена в обёртке (forceOpaque). Co-Authored-By: Claude Fable 5 --- MainForm.pas | 20 +++----------------- PlatformUtils.pas | 23 ----------------------- SpectrumViewOpengl.pas | 2 +- WaterfallViewOpengl.pas | 2 +- WidebandView.pas | 2 +- ewsdr.lpi | 2 +- ewsdr.lpr | 2 +- 7 files changed, 8 insertions(+), 45 deletions(-) diff --git a/MainForm.pas b/MainForm.pas index 5dfc88a..8945a3f 100644 --- a/MainForm.pas +++ b/MainForm.pas @@ -25,7 +25,7 @@ uses Classes, SysUtils, StrUtils, FreqDisplay, DeviceForm, VfoOverlay, SampleRateOverlay, BandPlanOverlay, FlatButton, FlatSlider, FlatDropDown, AppTheme, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Buttons, Menus, Math, Types, - OpenGLContext, + OpenGLContextEx, LCLIntf, LCLType, GraphType, HPSDRProtocol, HPSDRNetwork, WDSP, WDSPEngine, AudioOutput, AudioInput, @@ -1005,23 +1005,9 @@ begin FSplitterRatio := 0.40; FSplitterDrag := False; + // OpenGLContextEx (QOpenGLWidget-бэкенд) работает и в нативном Wayland, + // старая X11-заглушка больше не нужна FUseOpenGLSpectrum := HasOpenGLSpectrumSwitch; - if FUseOpenGLSpectrum and (not QtPlatformAllowsOpenGLControls) then - begin - MessageDlg('OpenGL rendering disabled', - 'OpenGL rendering is not available in the current Qt Wayland mode.' + LineEnding + - LineEnding + - 'The Lazarus/LCL Qt6 OpenGL control used by EWSDR requires an X11 display handle, ' + - 'but the native Wayland backend does not provide one. Using it here can cause an access violation during startup.' + - LineEnding + - LineEnding + - 'To run EWSDR with OpenGL rendering, start it through XWayland:' + LineEnding + - 'QT_QPA_PLATFORM=xcb ./ewsdr --opengl' + LineEnding + - LineEnding + - 'OpenGL rendering will be disabled for this session.', - mtWarning, [mbOK], 0); - FUseOpenGLSpectrum := False; - end; if FUseOpenGLSpectrum then FWaterfallFrameInterval := 1; if FUseOpenGLSpectrum then diff --git a/PlatformUtils.pas b/PlatformUtils.pas index 4e0a73e..2259529 100644 --- a/PlatformUtils.pas +++ b/PlatformUtils.pas @@ -10,7 +10,6 @@ unit PlatformUtils; interface -function QtPlatformAllowsOpenGLControls: Boolean; function HasOpenGLSpectrumSwitch: Boolean; function CurrentScreenDPI: Integer; // Возвращает каталог для хранения конфигурации (с завершающим разделителем). @@ -24,28 +23,6 @@ implementation uses SysUtils {$IFNDEF HEADLESS}, Forms{$ENDIF}; -function QtPlatformAllowsOpenGLControls: Boolean; -var - Qpa, FirstQpa, SessionType: string; - Sep: Integer; -begin - Result := True; - Qpa := LowerCase(Trim(GetEnvironmentVariable('QT_QPA_PLATFORM'))); - SessionType := LowerCase(Trim(GetEnvironmentVariable('XDG_SESSION_TYPE'))); - - if Qpa <> '' then - begin - FirstQpa := Qpa; - Sep := Pos(';', FirstQpa); - if Sep > 0 then - FirstQpa := Copy(FirstQpa, 1, Sep - 1); - Result := FirstQpa <> 'wayland'; - Exit; - end; - - Result := SessionType <> 'wayland'; -end; - function HasOpenGLSpectrumSwitch: Boolean; var I: Integer; diff --git a/SpectrumViewOpengl.pas b/SpectrumViewOpengl.pas index a432df5..034b495 100644 --- a/SpectrumViewOpengl.pas +++ b/SpectrumViewOpengl.pas @@ -16,7 +16,7 @@ interface uses Classes, SysUtils, Graphics, Controls, Math, Types, - OpenGLContext, GL, + OpenGLContextEx, GL, AppTheme, SpectrumView, VfoOverlay, BandPlanOverlay, WaterfallViewOpengl; type diff --git a/WaterfallViewOpengl.pas b/WaterfallViewOpengl.pas index 00a2a4d..61db121 100644 --- a/WaterfallViewOpengl.pas +++ b/WaterfallViewOpengl.pas @@ -15,7 +15,7 @@ interface uses Classes, SysUtils, Graphics, Controls, Math, - OpenGLContext, GL, + OpenGLContextEx, GL, AppTheme, WaterfallView; type diff --git a/WidebandView.pas b/WidebandView.pas index 3ddf318..00ab4a0 100644 --- a/WidebandView.pas +++ b/WidebandView.pas @@ -18,7 +18,7 @@ interface uses Classes, SysUtils, Math, Graphics, Controls, ExtCtrls, - OpenGLContext, GL, AppTheme, WDSP; + OpenGLContextEx, GL, AppTheme, WDSP; type TWidebandView = class diff --git a/ewsdr.lpi b/ewsdr.lpi index 1e17ac1..4a338f8 100644 --- a/ewsdr.lpi +++ b/ewsdr.lpi @@ -130,7 +130,7 @@ - + diff --git a/ewsdr.lpr b/ewsdr.lpr index fe2c468..317be48 100644 --- a/ewsdr.lpr +++ b/ewsdr.lpr @@ -15,7 +15,7 @@ uses {$ENDIF} Interfaces, // LCL platform WindowsDPI, - Forms, LazOpenGLContext, + Forms, LazOpenGLContextEx, MainForm, AudioOutput, DeviceForm, FlatButton, FreqDisplay, VfoOverlay, WDSP, WDSPEngine, WebPageHtml, WebServer, WebUtils, WinFirewall, WsClient, Settings, RadioController;