Qt6: use x11Display() from Qt's QNativeInterface, so our X11OpenDisplay() won't open another descriptor

This commit is contained in:
Željan Rikalo 2022-12-16 15:39:22 +01:00
parent 944332963e
commit 7c5b20806e
2 changed files with 5 additions and 1 deletions

View File

@ -5554,6 +5554,10 @@ function QGuiApplication_isSavingSession(handle: QGuiApplicationH): Boolean; cde
function QGuiApplication_applicationState(): QtApplicationState; cdecl; external Qt6PasLib name 'QGuiApplication_applicationState';
function QGuiApplication_highDpiScaleFactorRoundingPolicy(): QtHighDpiScaleFactorRoundingPolicy; cdecl; external Qt6PasLib name 'QGuiApplication_highDpiScaleFactorRoundingPolicy';
procedure QGuiApplication_setHighDpiScaleFactorRoundingPolicy(const policy: QtHighDpiScaleFactorRoundingPolicy); cdecl; external Qt6PasLib name 'QGuiApplication_setHighDpiScaleFactorRoundingPolicy';
{$IFDEF BINUX}
function QGuiApplication_x11Display(handle: QGuiApplicationH): Pointer; cdecl; external Qt6PasLib name 'QGuiApplication_x11Display';
function QGuiApplication_xcbConnection(handle: QGuiApplicationH): Pointer; cdecl; external Qt6PasLib name 'QGuiApplication_xcbConnection';
{$ENDIF}
type

View File

@ -546,7 +546,7 @@ end;
function TQtWidgetSet.x11Display: PDisplay;
begin
if FX11Display = nil then
FX11Display := XOpenDisplay(nil);
FX11Display := PDisplay(QGuiApplication_x11Display(QGuiApplicationH(QCoreApplication_instance())));
Result := FX11Display;
end;
{$ENDIF}