mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Wayland detection (fixes #2773)
This commit is contained in:
parent
4947949834
commit
448e3d2d75
2 changed files with 18 additions and 4 deletions
|
|
@ -28,7 +28,7 @@ var
|
|||
implementation
|
||||
|
||||
uses
|
||||
CTypes, SysUtils, Forms, Graphics, GraphUtil, qtobjects, qt6;
|
||||
CTypes, SysUtils, Forms, Graphics, GraphUtil, qtobjects, qt6, DCStrUtils;
|
||||
|
||||
function setenv(const name, value: pchar; overwrite: cint): cint; cdecl; external clib;
|
||||
|
||||
|
|
@ -406,12 +406,26 @@ end;
|
|||
|
||||
function IsWayland: Boolean;
|
||||
var
|
||||
Index: Integer;
|
||||
ASession: String;
|
||||
APlatform: String;
|
||||
begin
|
||||
ASession:= LowerCase(GetEnvironmentVariable('XDG_SESSION_TYPE'));
|
||||
APlatform:= LowerCase(GetEnvironmentVariable('QT_QPA_PLATFORM'));
|
||||
Result:= (ASession = 'wayland') and ((APlatform = '') or (APlatform = 'wayland'));
|
||||
Result:= (ASession = 'wayland');
|
||||
if Result then
|
||||
begin
|
||||
for Index:= 1 to ParamCount do
|
||||
begin
|
||||
if ParamStr(Index) = '-platform' then
|
||||
begin
|
||||
APlatform:= ParamStr(Index + 1);
|
||||
Result:= StrBegins(APlatform, 'wayland');
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
APlatform:= LowerCase(GetEnvironmentVariable('QT_QPA_PLATFORM'));
|
||||
Result:= (APlatform = '') or StrBegins(APlatform, 'wayland');
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ uses
|
|||
|
||||
procedure Initialize;
|
||||
begin
|
||||
if IsWayland then
|
||||
if IsWayland and Assigned(QtWidgetSetEx) then
|
||||
begin
|
||||
WSControls.RegisterControl;
|
||||
RegisterWSComponent(TControl, TQtWSControlEx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue