Skip to content

Commit 6f0b07e

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 0b43c3c + 420a1fa commit 6f0b07e

5 files changed

Lines changed: 37 additions & 16 deletions

File tree

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@
8080
packages = with pkgs; [
8181
qt6.qttools
8282
];
83+
84+
# https://discourse.nixos.org/t/how-to-create-a-qt-devshell/58529/5
85+
shellHook = ''
86+
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$APPEND_LIBRARY_PATH"
87+
eval $(echo "''${qtWrapperArgs[@]}"|perl -n -e '$_ =~ s/--prefix (\w+) : ([\w-.\/]+)/export ''${1}="''${2}:\''${''${1}}";/g;print')
88+
'';
8389
};
8490

8591
# Shell for building static melonDS release builds with vcpkg

src/frontend/qt_sdl/Screen.cpp

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@
2323

2424
#include <QPaintEvent>
2525
#include <QPainter>
26-
#ifndef _WIN32
27-
#ifndef APPLE
28-
#include <qpa/qplatformnativeinterface.h>
29-
#endif
30-
#endif
26+
3127
#include <QDateTime>
3228

3329
#include "OpenGLSupport.h"
@@ -50,6 +46,14 @@
5046

5147
using namespace melonDS;
5248

49+
#if !defined(_WIN32) && !defined(APPLE)
50+
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
51+
using namespace QNativeInterface;
52+
#else
53+
#include <qpa/qplatformnativeinterface.h>
54+
#endif
55+
#endif
56+
5357

5458
const u32 kOSDMargin = 6;
5559
const int kLogoWidth = 192;
@@ -1285,8 +1289,25 @@ std::optional<WindowInfo> ScreenPanelGL::getWindowInfo()
12851289
wi.type = WindowInfo::Type::MacOS;
12861290
wi.window_handle = reinterpret_cast<void*>(winId());
12871291
#else
1288-
QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface();
12891292
const QString platform_name = QGuiApplication::platformName();
1293+
1294+
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
1295+
if (platform_name == QStringLiteral("xcb"))
1296+
{
1297+
wi.type = WindowInfo::Type::X11;
1298+
const QX11Application* x11 = qApp->nativeInterface<QX11Application>();
1299+
wi.display_connection = x11->display();
1300+
wi.window_handle = reinterpret_cast<void*>(winId());
1301+
}
1302+
else if (platform_name == QStringLiteral("wayland"))
1303+
{
1304+
wi.type = WindowInfo::Type::Wayland;
1305+
const QWaylandApplication* wl = qApp->nativeInterface<QWaylandApplication>();
1306+
wi.display_connection = wl->display();
1307+
wi.window_handle = reinterpret_cast<void*>(winId());
1308+
}
1309+
#else
1310+
QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface();
12901311
if (platform_name == QStringLiteral("xcb"))
12911312
{
12921313
wi.type = WindowInfo::Type::X11;
@@ -1303,9 +1324,9 @@ std::optional<WindowInfo> ScreenPanelGL::getWindowInfo()
13031324
wi.display_connection = pni->nativeResourceForWindow("display", handle);
13041325
wi.window_handle = pni->nativeResourceForWindow("surface", handle);
13051326
}
1327+
#endif
13061328
else
13071329
{
1308-
//qCritical() << "Unknown PNI platform " << platform_name;
13091330
Platform::Log(Platform::LogLevel::Error, "Unknown PNI platform %s\n", platform_name.toStdString().c_str());
13101331
return std::nullopt;
13111332
}

src/frontend/qt_sdl/Window.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
#include <unistd.h>
4848
#include <sys/socket.h>
4949
#include <signal.h>
50-
#ifndef APPLE
51-
#include <qpa/qplatformnativeinterface.h>
52-
#endif
5350
#endif
5451

5552
#include "main.h"

src/frontend/qt_sdl/main.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
#include <unistd.h>
4343
#include <sys/socket.h>
4444
#include <signal.h>
45-
#ifndef APPLE
46-
#include <qpa/qplatformnativeinterface.h>
47-
#endif
4845
#endif
4946

5047
#include <SDL2/SDL.h>

0 commit comments

Comments
 (0)