Gtk2: better recognition of wayland session, do not create dummy frame.

(cherry picked from commit 54ba042fb2)

Co-authored-by: Željan Rikalo <zeljko@lazarus-ide.org>
This commit is contained in:
Željan Rikalo 2024-11-11 06:46:10 +00:00 committed by Željan Rikalo
parent 6739c59336
commit 1b2d86714b
3 changed files with 16 additions and 2 deletions

View File

@ -76,6 +76,9 @@ type
{$IFNDEF USE_GTK_MAIN_OLD_ITERATION}
FMainPoll: PGPollFD;
{$ENDIF}
{$IFDEF HASX}
FIsWayland: boolean;
{$ENDIF}
FIsLibraryInstance: Boolean;
FGtkTerminated: Boolean;
FMultiThreadingEnabled: boolean;
@ -315,6 +318,7 @@ type
function GetDesktopWidget: PGtkWidget;
//function X11Raise(AHandle: HWND): boolean; currently not used
function GetWindowManager: String;
function IsWayland: boolean;
function IsCurrentDesktop(AWindow: PGdkWindow): Boolean;
function X11GetActiveWindow: HWND;
function GetAlwaysOnTopX11(AWindow: PGdkWindow): boolean;

View File

@ -1531,6 +1531,11 @@ begin
FIsLibraryInstance := False;
FGtkTerminated := False;
{$IFDEF HASX}
FIsWayland := UTF8LowerCase(GetEnvironmentVariableUTF8('XDG_SESSION_TYPE')) = 'wayland';
{$ELSE}
FIsWayland := False;
{$ENDIF}
{$IFDEF EnabledGtkThreading}
{$IFNDEF Win32}
@ -1931,7 +1936,7 @@ var
begin
Result := False;
WM := GetWindowManager;
if (WM = '') or (WM = 'wayland') then
if (WM = '') or (WM = 'wayland') or IsWayland then
exit;
ADummy := TDummyWidget.Create;
ADummy.ShowDummyWidget(ALeft, ATop, AWidth, AHeight);
@ -4630,6 +4635,11 @@ begin
end;
end;
function TGtk2WidgetSet.IsWayland: boolean;
begin
Result := FIsWayland;
end;
function TGtk2WidgetSet.X11GetActiveWindow: HWND;
var
Display: PDisplay;

View File

@ -425,7 +425,7 @@ begin
end;
{$IFDEF HASX}
if (AWinControl = Application.MainForm) and
if (AWinControl = Application.MainForm) and not Gtk2WidgetSet.IsWayland and
not Application.HasOption('disableaccurateframe') then
Gtk2WidgetSet.CreateDummyWidgetFrame(-1, -1, -1, -1);
{$ENDIF}