Qt6: add x11Display function, returns xlib.PDisplay.

This commit is contained in:
Željan Rikalo 2022-11-15 13:07:53 +01:00
parent ea07cc1407
commit 1751d3c2ed
3 changed files with 12 additions and 10 deletions

View File

@ -44,6 +44,7 @@ uses
GraphType, LazStringUtils, LazUtilities, LazLoggerBase, LazUTF8, Maps,
// WS
{$IFDEF HASX11}
XAtom, X, XLib, XKB, xkblib,
qtx11dummywidget,
{$ENDIF}
qtproc;
@ -123,6 +124,7 @@ type
FStockSystemFont: HFONT;
FStockDefaultDC: HDC;
{$IFDEF HASX11}
FX11Display: PDisplay;
FWSFrameRect: TRect;
{$ENDIF}
@ -154,6 +156,7 @@ type
{$IFDEF HASX11}
function CreateDummyWidgetFrame(const ALeft, ATop, AWidth, AHeight: integer): boolean;
function GetDummyWidgetFrame: TRect;
function x11Display: PDisplay;
{$ENDIF}
public
constructor Create; override;
@ -352,9 +355,6 @@ uses
// To get as little as possible circles,
// uncomment only those units with implementation
////////////////////////////////////////////////////
{$IFDEF HASX11}
XAtom, X, XLib, XKB, xkblib,
{$ENDIF}
QtCaret,
QtThemes,

View File

@ -30,6 +30,7 @@ begin
App := QApplicationH(QCoreApplication_instance())
else
begin
FX11Display := nil;
{$IFDEF MSWINDOWS}
//add directory plugins to the Qt paths if Qt is distributed with application under mswindows.
WStr := 'plugins';
@ -533,6 +534,13 @@ function TQtWidgetSet.GetDummyWidgetFrame: TRect;
begin
Result := FWSFrameRect;
end;
function TQtWidgetSet.x11Display: PDisplay;
begin
if FX11Display = nil then
FX11Display := XOpenDisplay(nil);
Result := FX11Display;
end;
{$ENDIF}
procedure TQtWidgetSet.SetOverrideCursor(const AValue: TObject);

View File

@ -9,15 +9,9 @@ begin
Result := APlatform = 'xcb';
end;
var
GlobDisplay: PDisplay = nil;
function X11Display: PDisplay;
begin
{$warning move X11Display to TQtWidgetSet to avoid global GlobDisplay variable}
if GlobDisplay = nil then
GlobDisplay := XOpenDisplay(nil);
Result := GlobDisplay;
Result := QtWidgetSet.x11Display
end;
function IsCompositingManagerRunning: boolean;