Changeset 52784 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 18, 2014 1:30:26 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 96168
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r52733 r52784 359 359 qInstallMsgHandler(QtMessageOutput); 360 360 361 #ifdef Q_WS_X11 362 /* Qt has a complex algorithm for selecting the right visual which 363 * doesn't always seem to work. So we naively choose a visual - the 364 * default one - ourselves and pass that to Qt. This means that we 365 * also have to open the display ourselves. 366 * We check the Qt parameter list and handle Qt's -display argument 367 * ourselves, since we open the display connection. We also check the 368 * to see if the user has passed Qt's -visual parameter, and if so we 369 * assume that the user wants Qt to handle visual selection after all, 370 * and don't supply a visual. */ 371 char *pszDisplay = NULL; 372 bool useDefaultVisual = true; 373 for (int i = 0; i < argc; ++i) 374 { 375 if (!::strcmp(argv[i], "-display") && (i + 1 < argc)) 376 /* What if it isn't? Rely on QApplication to complain? */ 377 { 378 pszDisplay = argv[i + 1]; 379 ++i; 380 } 381 else if (!::strcmp(argv[i], "-visual")) 382 useDefaultVisual = false; 383 } 384 Display *pDisplay = XOpenDisplay(pszDisplay); 385 if (!pDisplay) 386 { 387 RTPrintf(pszDisplay ? "Failed to open the X11 display \"%s\"!\n" 388 : "Failed to open the X11 display!\n", 389 pszDisplay); 390 break; 391 } 392 Visual *pVisual = useDefaultVisual 393 ? DefaultVisual(pDisplay, DefaultScreen(pDisplay)) 394 : NULL; 395 /* Now create the application object: */ 396 QApplication a(pDisplay, argc, argv, (Qt::HANDLE)pVisual); 397 #else /* Q_WS_X11 */ 361 /* Create application: */ 398 362 QApplication a(argc, argv); 399 #endif /* Q_WS_X11 */400 363 401 364 #ifdef Q_WS_MAC
Note:
See TracChangeset
for help on using the changeset viewer.