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

View File

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