mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 18:43:51 +00:00
Пакет 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 <noreply@anthropic.com>
67 lines
1.5 KiB
ObjectPascal
67 lines
1.5 KiB
ObjectPascal
unit PlatformUtils;
|
|
|
|
{
|
|
PlatformUtils.pas - small helpers for desktop/runtime platform checks.
|
|
}
|
|
|
|
{$IFDEF FPC}
|
|
{$MODE Delphi}
|
|
{$ENDIF}
|
|
|
|
interface
|
|
|
|
function HasOpenGLSpectrumSwitch: Boolean;
|
|
function CurrentScreenDPI: Integer;
|
|
// Возвращает каталог для хранения конфигурации (с завершающим разделителем).
|
|
// macOS: ~/Library/Application Support/ewsdr/
|
|
// Linux: ~/.config/ewsdr/
|
|
// Windows: %APPDATA%\ewsdr\
|
|
function GetAppCfgDir: string;
|
|
|
|
implementation
|
|
|
|
uses
|
|
SysUtils {$IFNDEF HEADLESS}, Forms{$ENDIF};
|
|
|
|
function HasOpenGLSpectrumSwitch: Boolean;
|
|
var
|
|
I: Integer;
|
|
S: string;
|
|
begin
|
|
Result := False;
|
|
for I := 1 to ParamCount do
|
|
begin
|
|
S := LowerCase(ParamStr(I));
|
|
if (S = '--opengl') or (S = '-opengl') or (S = '/opengl') then
|
|
Exit(True);
|
|
end;
|
|
end;
|
|
|
|
function CurrentScreenDPI: Integer;
|
|
begin
|
|
{$IFNDEF HEADLESS}
|
|
Result := Screen.PixelsPerInch;
|
|
if Result <= 0 then Result := 96;
|
|
{$ELSE}
|
|
Result := 96; // headless-демон без LCL: экрана нет, дефолт DPI
|
|
{$ENDIF}
|
|
end;
|
|
|
|
function GetAppCfgDir: string;
|
|
begin
|
|
{$IFDEF WINDOWS}
|
|
Result := GetEnvironmentVariable('APPDATA');
|
|
if Result = '' then
|
|
Result := GetEnvironmentVariable('LOCALAPPDATA');
|
|
if Result = '' then
|
|
Result := ExtractFilePath(ParamStr(0));
|
|
Result := IncludeTrailingPathDelimiter(Result) + 'ewsdr' + PathDelim;
|
|
{$ELSE}
|
|
Result := IncludeTrailingPathDelimiter(GetAppConfigDir(False));
|
|
{$ENDIF}
|
|
if not DirectoryExists(Result) then
|
|
ForceDirectories(Result);
|
|
end;
|
|
|
|
end.
|