| 181 | } |
| 182 | |
| 183 | int main(int argc, char *argv[]) |
| 184 | { |
| 185 | // call this as the very first thing - no-op on other platforms, but on linux it means |
| 186 | // XInitThreads will be called allowing driver access to xlib on multiple threads. |
| 187 | QCoreApplication::setAttribute(Qt::AA_X11InitThreads); |
| 188 | |
| 189 | qInstallMessageHandler(sharedLogOutput); |
| 190 | |
| 191 | // there seems to be a persistent crash in QWidgetPrivate::subtractOpaqueSiblings where a widget |
| 192 | // has no parent but is not a window. Try to work around it by setting this env var, as it's only |
| 193 | // an optimisation |
| 194 | qputenv("QT_NO_SUBTRACTOPAQUESIBLINGS", lit("1").toUtf8()); |
| 195 | |
| 196 | qInfo() << "QRenderDoc initialising."; |
| 197 | |
| 198 | if(IsRunningAsAdmin()) |
| 199 | qInfo() << "Running as administrator"; |
| 200 | |
| 201 | #if defined(RENDERDOC_PLATFORM_LINUX) && !defined(RENDERDOC_WINDOWING_WAYLAND) |
| 202 | bool envChanged = false; |
| 203 | { |
| 204 | const char *qpa_plat = getenv("QT_QPA_PLATFORM"); |
| 205 | // if not set or empty, force non-wayland to help go through backwards compatibility path on wayland. |
| 206 | if(!qpa_plat || qpa_plat[0] == 0) |
| 207 | { |
| 208 | setenv("QT_QPA_PLATFORM", "xcb", 1); |
| 209 | envChanged = true; |
| 210 | } |
| 211 | } |
| 212 | #endif |
| 213 | |
| 214 | QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); |
| 215 | QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); |
| 216 | |
| 217 | #if(QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) |
| 218 | QGuiApplication::setHighDpiScaleFactorRoundingPolicy( |
| 219 | Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor); |
| 220 | #endif |
| 221 | |
| 222 | QApplication::setApplicationVersion(lit(FULL_VERSION_STRING)); |
| 223 | |
| 224 | // shortcut here so we can run this with a non-GUI application |
| 225 | #if ENABLE_UNIT_TESTS |
| 226 | if(QString::fromUtf8(argv[1]) == lit("--unittest")) |
| 227 | { |
| 228 | char **mod_argv = new char *[argc + 1]; |
| 229 | char **alloc_argv = mod_argv; |
| 230 | for(int i = 0; i < argc; i++) |
| 231 | mod_argv[i] = argv[i]; |
| 232 | mod_argv[argc] = 0; |
| 233 | |
| 234 | // pop --unittest |
| 235 | argc--; |
| 236 | mod_argv++; |
| 237 | |
| 238 | FILE *test_logOut = NULL; |
| 239 | |
| 240 | if(argc >= 2 && QString::fromUtf8(mod_argv[1]).left(4) == lit("log=")) |
nothing calls this directly
no test coverage detected