Gtk3: added IsWayland helper function.

This commit is contained in:
zeljan1 2025-02-27 12:00:02 +01:00
parent 2219f01ce4
commit 03fa715e23
2 changed files with 12 additions and 0 deletions

View File

@ -47,6 +47,7 @@ type
TGtk3WidgetSet = class(TWidgetSet)
private
FIsWayland: boolean;
FActivityCounter: integer;
FMainPoll: PGPollFD;
FGtk3Application: PGtkApplication;
@ -95,6 +96,7 @@ type
FDragImageLock: Boolean;
public
function IsWayland: boolean;
function CreateDCForWidget(AWidget: PGtkWidget; AWindow: PGdkWindow; cr: Pcairo_t): HDC;
procedure AddWindow(AWindow: PGtkWindow);
{$IFDEF UNIX}

View File

@ -73,6 +73,11 @@ begin
FGtk3Application^.register(nil, nil);
end;
GTK3WidgetSet := Self;
{$IFDEF UNIX}
FIsWayland := CompareText(G_OBJECT_TYPE_NAME(gdk_display_get_default),'gdkwaylanddisplay') = 0;
{$ELSE}
FIsWayland := False;
{$ENDIF}
end;
procedure TGtk3WidgetSet.Gtk3Destroy;
@ -130,6 +135,11 @@ begin
DeleteAndNilObject(FSysColorBrushes[i]);
end;
function TGtk3WidgetSet.IsWayland: boolean;
begin
Result := FIsWayland;
end;
{$IFNDEF UNIX}
procedure TGtk3WidgetSet.DoWakeMainThread(Sender: TObject);
begin