mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 17:27:32 +00:00
Guard OpenGL mode on native Wayland
This commit is contained in:
@@ -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.
|
||||
Reference in New Issue
Block a user