Skip to content

Commit b6b2048

Browse files
committed
Small improvements reading the display server value in Linux
Added TCefLinuxDisplayServer.ldsTTY
1 parent ff091dc commit b6b2048

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

source/uCEFApplicationCore.pas

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,19 +2533,36 @@ procedure TCefApplicationCore.AfterConstruction;
25332533
procedure TCefApplicationCore.ReadDisplayServer;
25342534
{$IFDEF FPC}
25352535
var
2536-
TempSession : AnsiString;
2536+
TempSession, TempDisplay : AnsiString;
25372537
{$ENDIF}
25382538
begin
25392539
{$IFDEF FPC}
2540-
TempSession := GetEnvironmentVariable('XDG_SESSION_TYPE');
2540+
TempSession := lowercase(GetEnvironmentVariable('XDG_SESSION_TYPE'));
25412541

25422542
if (TempSession = 'wayland') then
25432543
FDisplayServer := ldsWayland
25442544
else
25452545
if (TempSession = 'x11') then
25462546
FDisplayServer := ldsX11
25472547
else
2548-
FDisplayServer := ldsUnknown;
2548+
if (TempSession = 'tty') then
2549+
FDisplayServer := ldsTTY
2550+
else
2551+
begin
2552+
TempDisplay := lowercase(GetEnvironmentVariable('WAYLAND_DISPLAY'));
2553+
2554+
if (length(TempDisplay) > 0) then
2555+
FDisplayServer := ldsWayland
2556+
else
2557+
begin
2558+
TempDisplay := lowercase(GetEnvironmentVariable('DISPLAY'));
2559+
2560+
if (length(TempDisplay) > 0) then
2561+
FDisplayServer := ldsX11
2562+
else
2563+
FDisplayServer := ldsUnknown;
2564+
end;
2565+
end;
25492566
{$ENDIF}
25502567
// TO-DO : Find a way to get read the value of an environment variable or the display server type in FMXLinux.
25512568
end;

source/uCEFTypes.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ TChromiumVersionInfo = record
14881488
/// <summary>
14891489
/// Linux session type. Used to check whether the display server is Xorg or Wayland.
14901490
/// </summary>
1491-
TCefLinuxDisplayServer = (ldsX11, ldsWayland, ldsUnknown);
1491+
TCefLinuxDisplayServer = (ldsX11, ldsWayland, ldsTTY, ldsUnknown);
14921492

14931493
/// <summary>
14941494
/// Used by TCEFFileDialogInfo.

update_CEF4Delphi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"UpdateLazPackages" : [
33
{
44
"ForceNotify" : true,
5-
"InternalVersion" : 814,
5+
"InternalVersion" : 815,
66
"Name" : "cef4delphi_lazarus.lpk",
77
"Version" : "141.0.11"
88
}

0 commit comments

Comments
 (0)