mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-11 01:28:41 +12:00
Wayland fixes
This commit is contained in:
parent
7c2918f3f7
commit
5ce6d6d466
3 changed files with 12 additions and 2 deletions
|
@ -24,7 +24,7 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
|
|||
resize(800, 240 * 4);
|
||||
|
||||
// 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); }, nullptr);
|
||||
setCentralWidget(screen);
|
||||
|
||||
screen->show();
|
||||
|
|
|
@ -29,6 +29,7 @@ ScreenWidget::ScreenWidget(ResizeCallback resizeCallback, QWidget* parent) : QWi
|
|||
setAttribute(Qt::WA_KeyCompression, false);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setMouseTracking(true);
|
||||
show();
|
||||
|
||||
if (!createGLContext()) {
|
||||
Helpers::panic("Failed to create GL context for display");
|
||||
|
@ -72,6 +73,10 @@ bool ScreenWidget::createGLContext() {
|
|||
this->windowInfo = *windowInfo;
|
||||
|
||||
glContext = GL::Context::Create(*getWindowInfo(), versionsToTry);
|
||||
if (!glContext) {
|
||||
return false;
|
||||
}
|
||||
|
||||
glContext->DoneCurrent();
|
||||
}
|
||||
|
||||
|
@ -79,7 +84,7 @@ bool ScreenWidget::createGLContext() {
|
|||
}
|
||||
|
||||
qreal ScreenWidget::devicePixelRatioFromScreen() const {
|
||||
const QScreen* screenForRatio = window()->windowHandle()->screen();
|
||||
const QScreen* screenForRatio = windowHandle()->screen();
|
||||
if (!screenForRatio) {
|
||||
screenForRatio = QGuiApplication::primaryScreen();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue