openpilot v0.9.6 release
date: 2024-01-12T10:13:37 master commit: ba792d576a49a0899b88a753fa1c52956bedf9e6
This commit is contained in:
34
selfdrive/ui/qt/qt_window.cc
Normal file
34
selfdrive/ui/qt/qt_window.cc
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "selfdrive/ui/qt/qt_window.h"
|
||||
|
||||
void setMainWindow(QWidget *w) {
|
||||
const float scale = util::getenv("SCALE", 1.0f);
|
||||
const QSize sz = QGuiApplication::primaryScreen()->size();
|
||||
|
||||
if (Hardware::PC() && scale == 1.0 && !(sz - DEVICE_SCREEN_SIZE).isValid()) {
|
||||
w->setMinimumSize(QSize(640, 480)); // allow resize smaller than fullscreen
|
||||
w->setMaximumSize(DEVICE_SCREEN_SIZE);
|
||||
w->resize(sz);
|
||||
} else {
|
||||
w->setFixedSize(DEVICE_SCREEN_SIZE * scale);
|
||||
}
|
||||
w->show();
|
||||
|
||||
#ifdef QCOM2
|
||||
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
|
||||
wl_surface *s = reinterpret_cast<wl_surface*>(native->nativeResourceForWindow("surface", w->windowHandle()));
|
||||
wl_surface_set_buffer_transform(s, WL_OUTPUT_TRANSFORM_270);
|
||||
wl_surface_commit(s);
|
||||
w->showFullScreen();
|
||||
|
||||
// ensure we have a valid eglDisplay, otherwise the ui will silently fail
|
||||
void *egl = native->nativeResourceForWindow("egldisplay", w->windowHandle());
|
||||
assert(egl != nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
void set_main_window(void *w) {
|
||||
setMainWindow((QWidget*)w);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user