<commit_before>#include "selfdrive/ui/qt/qt_window.h"

void setMainWindow(QWidget *w) {
  const bool wide = (QGuiApplication::primaryScreen()->size().width() >= WIDE_WIDTH) ^
                    (getenv("INVERT_WIDTH") != NULL);
  const float scale = util::getenv("SCALE", 1.0f);

  w->setFixedSize(QSize(wide ? WIDE_WIDTH : 1920, 1080) * 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();
#endif
}


extern "C" {
  void set_main_window(void *w) {
    setMainWindow((QWidget*)w);
  }
}<commit_msg>ui: auto scaling on resolution below 1920 x 1080 (#22842)<commit_after>#include "selfdrive/ui/qt/qt_window.h"

void setMainWindow(QWidget *w) {
  const QSize sz = QGuiApplication::primaryScreen()->size();
  if (Hardware::PC() && sz.width() <= 1920 && sz.height() <= 1080 && getenv("SCALE") == nullptr) {
    w->setMinimumSize(QSize(640, 480)); // allow resize smaller than fullscreen
    w->setMaximumSize(QSize(2160, 1080));
    w->resize(sz);
  } else {
    const float scale = util::getenv("SCALE", 1.0f);
    const bool wide = (sz.width() >= WIDE_WIDTH) ^ (getenv("INVERT_WIDTH") != NULL);
    w->setFixedSize(QSize(wide ? WIDE_WIDTH : 1920, 1080) * 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();
#endif
}


extern "C" {
  void set_main_window(void *w) {
    setMainWindow((QWidget*)w);
  }
}
{'fraction_non_alphanumeric': 0.16266666666666665, 'fraction_numerical': 0.0336, 'mean_word_length': 5.274247491638796, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3074985', 'n_tokens_mistral': 707, 'n_tokens_neox': 636, 'n_words': 118}