mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 22:25:41 +12:00
Merge pull request #699 from DaniElectra/wayland
Qt: Fix Wayland support
This commit is contained in:
commit
4ea15c9170
3 changed files with 4 additions and 5 deletions
|
@ -7,6 +7,5 @@ int main(int argc, char *argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
MainWindow window(&app);
|
MainWindow window(&app);
|
||||||
|
|
||||||
window.show();
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,13 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
|
||||||
// Enable drop events for loading ROMs
|
// Enable drop events for loading ROMs
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
resize(800, 240 * 4);
|
resize(800, 240 * 4);
|
||||||
|
show();
|
||||||
|
|
||||||
// We pass a callback to the screen widget that will be triggered every time we resize the screen
|
// We pass a callback to the screen widget that will be triggered every time we resize the screen
|
||||||
screen = new ScreenWidget([this](u32 width, u32 height) { handleScreenResize(width, height); }, this);
|
screen = new ScreenWidget([this](u32 width, u32 height) { handleScreenResize(width, height); }, this);
|
||||||
setCentralWidget(screen);
|
setCentralWidget(screen);
|
||||||
|
|
||||||
screen->show();
|
|
||||||
appRunning = true;
|
appRunning = true;
|
||||||
|
|
||||||
// Set our menu bar up
|
// Set our menu bar up
|
||||||
menuBar = new QMenuBar(nullptr);
|
menuBar = new QMenuBar(nullptr);
|
||||||
|
|
||||||
|
@ -699,4 +698,4 @@ void MainWindow::setupControllerSensors(SDL_GameController* controller) {
|
||||||
if (haveAccelerometer) {
|
if (haveAccelerometer) {
|
||||||
SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE);
|
SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ ScreenWidget::ScreenWidget(ResizeCallback resizeCallback, QWidget* parent) : QWi
|
||||||
setAttribute(Qt::WA_KeyCompression, false);
|
setAttribute(Qt::WA_KeyCompression, false);
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
show();
|
||||||
|
|
||||||
if (!createGLContext()) {
|
if (!createGLContext()) {
|
||||||
Helpers::panic("Failed to create GL context for display");
|
Helpers::panic("Failed to create GL context for display");
|
||||||
|
@ -84,7 +85,7 @@ bool ScreenWidget::createGLContext() {
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal ScreenWidget::devicePixelRatioFromScreen() const {
|
qreal ScreenWidget::devicePixelRatioFromScreen() const {
|
||||||
const QScreen* screenForRatio = window()->windowHandle()->screen();
|
const QScreen* screenForRatio = windowHandle()->screen();
|
||||||
if (!screenForRatio) {
|
if (!screenForRatio) {
|
||||||
screenForRatio = QGuiApplication::primaryScreen();
|
screenForRatio = QGuiApplication::primaryScreen();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue