mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 18:43:51 +00:00
Guard OpenGL mode on native Wayland
This commit is contained in:
@@ -35,6 +35,7 @@ uses
|
|||||||
CATEngine, CATSerial, CATTcp,
|
CATEngine, CATSerial, CATTcp,
|
||||||
SpectrumView, SpectrumViewOpengl,
|
SpectrumView, SpectrumViewOpengl,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
|
PlatformUtils,
|
||||||
WinFirewall;
|
WinFirewall;
|
||||||
|
|
||||||
const
|
const
|
||||||
@@ -1469,6 +1470,22 @@ begin
|
|||||||
FSplitterDrag := False;
|
FSplitterDrag := False;
|
||||||
|
|
||||||
FUseOpenGLSpectrum := HasOpenGLSpectrumSwitch;
|
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
|
if FUseOpenGLSpectrum then
|
||||||
FWaterfallFrameInterval := 1;
|
FWaterfallFrameInterval := 1;
|
||||||
if FUseOpenGLSpectrum then
|
if FUseOpenGLSpectrum then
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
unit PlatformUtils;
|
||||||
|
|
||||||
|
{
|
||||||
|
PlatformUtils.pas - small helpers for desktop/runtime platform checks.
|
||||||
|
}
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$MODE Delphi}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
function QtPlatformAllowsOpenGLControls: Boolean;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
SysUtils;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
end.
|
||||||
@@ -210,6 +210,10 @@
|
|||||||
<Filename Value="SpectrumView.pas"/>
|
<Filename Value="SpectrumView.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit>
|
</Unit>
|
||||||
|
<Unit>
|
||||||
|
<Filename Value="PlatformUtils.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit>
|
||||||
<Unit>
|
<Unit>
|
||||||
<Filename Value="SpectrumViewOpengl.pas"/>
|
<Filename Value="SpectrumViewOpengl.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user