- Timestamp:
- Aug 7, 2017 12:50:54 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 47 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r65653 r68315 3670 3670 const OverlayList & overlays = mDisplay.overlays(); 3671 3671 QRect overInter = overlaysRectIntersection(); 3672 #if QT_VERSION >= 0x0500003673 3672 overInter = overInter.intersected(aRect); 3674 #else /* QT_VERSION < 0x050000 */3675 overInter = overInter.intersect(aRect);3676 #endif /* QT_VERSION < 0x050000 */3677 3673 3678 3674 bool bDisplayPrimary = true; -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp
r64762 r68315 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* Qt includes: */23 # ifdef VBOX_WS_WIN24 # include <QtGlobal> /* for QT_VERSION */25 # if QT_VERSION < 0x05000026 # include <QLibrary>27 # endif28 # endif29 30 22 /* GUI includes: */ 31 23 # include "QILineEdit.h" 32 33 /* Other VBox includes: */34 # ifdef VBOX_WS_WIN35 # if QT_VERSION < 0x05000036 # include "iprt/ldr.h"37 # endif38 # endif39 40 /* External includes: */41 # ifdef VBOX_WS_WIN42 # if QT_VERSION < 0x05000043 # include <iprt/win/windows.h>44 # endif45 # endif46 24 47 25 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 49 27 /* Qt includes: */ 50 28 #include <QStyleOptionFrame> 51 #ifdef VBOX_WS_WIN52 # if QT_VERSION < 0x05000053 # include <QWindowsVistaStyle>54 # endif55 #endif56 29 57 30 … … 81 54 QSize sa = style()->sizeFromContents (QStyle::CT_LineEdit, &sof, sc, this); 82 55 83 #ifdef VBOX_WS_WIN84 # if QT_VERSION < 0x05000085 /* Vista l&f style has a bug where the last parameter of sizeFromContents86 * function ('widget' what corresponds to 'this' in our class) is ignored.87 * Due to it QLineEdit processed as QComboBox and size calculation includes88 * non-existing combo-box button of 23 pix in width. So fixing it here: */89 if (qobject_cast <QWindowsVistaStyle*> (style()))90 {91 /* Check if l&f style theme is really active else painting performed by92 * Windows Classic theme and there is no such shifting error. */93 typedef BOOL (WINAPI *PFNISAPPTHEMED)(VOID);94 static PFNISAPPTHEMED s_pfnIsAppThemed = (PFNISAPPTHEMED)~(uintptr_t)0;95 if (s_pfnIsAppThemed == (PFNISAPPTHEMED)~(uintptr_t)0 )96 s_pfnIsAppThemed = (PFNISAPPTHEMED)RTLdrGetSystemSymbol("uxtheme.dll", "IsAppThemed");97 98 if (s_pfnIsAppThemed && s_pfnIsAppThemed())99 sa -= QSize(23, 0);100 }101 # endif /* QT_VERSION < 0x050000 */102 #endif /* VBOX_WS_WIN */103 104 56 return sa; 105 57 } -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsView.cpp
r62493 r68315 52 52 AssertPtrReturn(pTouchEvent, QGraphicsView::event(pEvent)); 53 53 /* For touch-screen event we have something special: */ 54 #if QT_VERSION >= 0x05000055 54 if (pTouchEvent->device()->type() == QTouchDevice::TouchScreen) 56 #else /* QT_VERSION < 0x050000 */57 if (pTouchEvent->deviceType() == QTouchEvent::TouchScreen)58 #endif /* QT_VERSION < 0x050000 */59 55 { 60 56 /* Remember where the scrolling was started: */ … … 73 69 AssertPtrReturn(pTouchEvent, QGraphicsView::event(pEvent)); 74 70 /* For touch-screen event we have something special: */ 75 #if QT_VERSION >= 0x05000076 71 if (pTouchEvent->device()->type() == QTouchDevice::TouchScreen) 77 #else /* QT_VERSION < 0x050000 */78 if (pTouchEvent->deviceType() == QTouchEvent::TouchScreen)79 #endif /* QT_VERSION < 0x050000 */80 72 { 81 73 /* Determine vertical shift (inverted): */ … … 100 92 AssertPtrReturn(pTouchEvent, QGraphicsView::event(pEvent)); 101 93 /* For touch-screen event we have something special: */ 102 #if QT_VERSION >= 0x050000103 94 if (pTouchEvent->device()->type() == QTouchDevice::TouchScreen) 104 #else /* QT_VERSION < 0x050000 */105 if (pTouchEvent->deviceType() == QTouchEvent::TouchScreen)106 #endif /* QT_VERSION < 0x050000 */107 95 { 108 96 /* Reset the scrolling start position: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r68304 r68315 1538 1538 { 1539 1539 /* Configure chooser-filter: */ 1540 #if QT_VERSION >= 0x0407001541 1540 m_pFilterOfChooser->setPlaceholderText("Search.."); 1542 #endif /* QT_VERSION >= 0x040700 */1543 1541 connect(m_pFilterOfChooser, SIGNAL(textChanged(const QString&)), 1544 1542 this, SLOT(sltChooserApplyFilter(const QString&))); … … 1605 1603 { 1606 1604 /* Configure data-filter: */ 1607 #if QT_VERSION >= 0x0407001608 1605 m_pFilterOfData->setPlaceholderText("Search.."); 1609 #endif /* QT_VERSION >= 0x040700 */1610 1606 connect(m_pFilterOfData, SIGNAL(textChanged(const QString&)), 1611 1607 this, SLOT(sltDataApplyFilter(const QString&))); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp
r68190 r68315 23 23 # include <QApplication> 24 24 # include <QDesktopWidget> 25 # include <QScreen> 25 26 # ifdef VBOX_WS_X11 26 27 # include <QTimer> 27 28 # endif 28 # if QT_VERSION >= 0x05000029 # include <QScreen>30 # endif /* QT_VERSION >= 0x050000 */31 29 32 30 /* GUI includes: */ … … 343 341 } 344 342 345 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000343 #ifdef VBOX_WS_X11 346 344 bool UIDesktopWidgetWatchdog::isFakeScreenDetected() const 347 345 { … … 355 353 || (qApp->screens().size() == 1 && qApp->screens().first()->name() == ":0.0"); 356 354 } 357 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 358 359 #if QT_VERSION < 0x050000 360 361 void UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged(int cHostScreenCount) 362 { 363 // printf("UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged(%d)\n", cHostScreenCount); 364 365 # ifdef VBOX_WS_X11 366 /* Update host-screen configuration: */ 367 updateHostScreenConfiguration(cHostScreenCount); 368 # endif /* VBOX_WS_X11 */ 369 370 /* Notify listeners: */ 371 emit sigHostScreenCountChanged(cHostScreenCount); 372 } 373 374 void UIDesktopWidgetWatchdog::sltHandleHostScreenResized(int iHostScreenIndex) 375 { 376 // printf("UIDesktopWidgetWatchdog::sltHandleHostScreenResized(%d)\n", iHostScreenIndex); 377 378 # ifdef VBOX_WS_X11 379 /* Update host-screen available-geometry: */ 380 updateHostScreenAvailableGeometry(iHostScreenIndex); 381 # endif /* VBOX_WS_X11 */ 382 383 /* Notify listeners: */ 384 emit sigHostScreenResized(iHostScreenIndex); 385 } 386 387 void UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(int iHostScreenIndex) 388 { 389 // printf("UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized(%d)\n", iHostScreenIndex); 390 391 # ifdef VBOX_WS_X11 392 /* Update host-screen available-geometry: */ 393 updateHostScreenAvailableGeometry(iHostScreenIndex); 394 # endif /* VBOX_WS_X11 */ 395 396 /* Notify listeners: */ 397 emit sigHostScreenWorkAreaResized(iHostScreenIndex); 398 } 399 400 #else /* QT_VERSION >= 0x050000 */ 355 #endif /* VBOX_WS_X11 */ 401 356 402 357 void UIDesktopWidgetWatchdog::sltHostScreenAdded(QScreen *pHostScreen) … … 483 438 emit sigHostScreenWorkAreaResized(iHostScreenIndex); 484 439 } 485 486 #endif /* QT_VERSION >= 0x050000 */487 440 488 441 #ifdef VBOX_WS_X11 … … 512 465 { 513 466 /* Prepare connections: */ 514 #if QT_VERSION < 0x050000515 connect(QApplication::desktop(), &QDesktopWidget::screenCountChanged,516 this, &UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged);517 connect(QApplication::desktop(), &QDesktopWidget::resized,518 this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);519 connect(QApplication::desktop(), &QDesktopWidget::workAreaResized,520 this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);521 #else /* QT_VERSION >= 0x050000 */522 467 connect(qApp, &QGuiApplication::screenAdded, 523 468 this, &UIDesktopWidgetWatchdog::sltHostScreenAdded); … … 531 476 this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized); 532 477 } 533 #endif /* QT_VERSION >= 0x050000 */534 478 535 479 #ifdef VBOX_WS_X11 … … 542 486 { 543 487 /* Cleanup connections: */ 544 #if QT_VERSION < 0x050000545 disconnect(QApplication::desktop(), &QDesktopWidget::screenCountChanged,546 this, &UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged);547 disconnect(QApplication::desktop(), &QDesktopWidget::resized,548 this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);549 disconnect(QApplication::desktop(), &QDesktopWidget::workAreaResized,550 this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);551 #else /* QT_VERSION >= 0x050000 */552 488 disconnect(qApp, &QGuiApplication::screenAdded, 553 489 this, &UIDesktopWidgetWatchdog::sltHostScreenAdded); … … 561 497 this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized); 562 498 } 563 #endif /* QT_VERSION >= 0x050000 */564 499 565 500 #ifdef VBOX_WS_X11 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h
r64767 r68315 101 101 const QRegion overallAvailableRegion() const; 102 102 103 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000103 #ifdef VBOX_WS_X11 104 104 /** Qt5: X11: Returns whether no or fake screen detected. */ 105 105 bool isFakeScreenDetected() const; 106 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */106 #endif 107 107 108 108 private slots: … … 111 111 /** Stupid moc does not warn if it cannot find headers! */ 112 112 void QT_VERSION_NOT_DEFINED 113 #elif QT_VERSION < 0x050000 114 /** Handles host-screen count change to @a cHostScreenCount. */ 115 void sltHandleHostScreenCountChanged(int cHostScreenCount); 116 /** Handles resize for the host-screen with @a iHostScreenIndex. */ 117 void sltHandleHostScreenResized(int iHostScreenIndex); 118 /** Handles work-area resize for the host-screen with @a iHostScreenIndex. */ 119 void sltHandleHostScreenWorkAreaResized(int iHostScreenIndex); 120 #else /* QT_VERSION >= 0x050000 */ 113 #else 121 114 /** Handles @a pHostScreen adding. */ 122 115 void sltHostScreenAdded(QScreen *pHostScreen); … … 127 120 /** Handles host-screen work-area resize to passed @a availableGeometry. */ 128 121 void sltHandleHostScreenWorkAreaResized(const QRect &availableGeometry); 129 #endif /* QT_VERSION >= 0x050000 */122 #endif 130 123 131 124 #ifdef VBOX_WS_X11 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r68190 r68315 24 24 # include <QToolTip> 25 25 # include <QTranslator> 26 # if QT_VERSION >= 0x05000027 26 # include <QStandardPaths> 28 # endif /* QT_VERSION >= 0x050000 */29 27 # include <QDesktopServices> 30 28 # include <QMutex> … … 48 46 # include <QTextStream> 49 47 # endif /* VBOX_GUI_WITH_PIDFILE */ 50 # if defined(VBOX_WS_X11) && QT_VERSION >= 0x05000048 # ifdef VBOX_WS_X11 51 49 # include <QScreen> 52 # include <xcb/xcb.h> 53 # endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 50 # endif 54 51 55 52 /* GUI includes: */ … … 132 129 # ifdef VBOX_WS_WIN 133 130 # include <iprt/win/shlobj.h> 134 # endif /* VBOX_WS_WIN */ 131 # endif 132 # ifdef VBOX_WS_X11 133 # include <xcb/xcb.h> 134 # endif 135 135 136 136 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 1804 1804 1805 1805 /* Try to load the corresponding Qt translation */ 1806 #if QT_VERSION < 0x0500001807 if (sLoadedLangId != gVBoxBuiltInLangName)1808 #else /* QT_VERSION >= 0x050000 */1809 1806 if (sLoadedLangId != gVBoxBuiltInLangName && sLoadedLangId != "en") 1810 #endif /* QT_VERSION >= 0x050000 */1811 1807 { 1812 1808 #ifdef Q_OS_UNIX … … 3122 3118 QString VBoxGlobal::documentsPath() 3123 3119 { 3124 #if QT_VERSION >= 0x0500003125 3120 QString path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); 3126 #else /* QT_VERSION < 0x050000 */3127 QString path = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);3128 #endif /* QT_VERSION < 0x050000 */3129 3121 QDir dir(path); 3130 3122 if (dir.exists()) … … 3243 3235 } 3244 3236 3245 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x0500003237 #ifdef VBOX_WS_X11 3246 3238 typedef struct { 3247 3239 /** User specified flags */ … … 3266 3258 uint32_t win_gravity; 3267 3259 } xcb_size_hints_t; 3268 #endif /* defined(VBOX_WS_X11) && QT_VERSION >= 0x050000*/3260 #endif /* VBOX_WS_X11 */ 3269 3261 3270 3262 /* static */ … … 3272 3264 { 3273 3265 AssertPtrReturnVoid(pWidget); 3274 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x0500003266 #ifdef VBOX_WS_X11 3275 3267 # define QWINDOWSIZE_MAX ((1<<24)-1) 3276 3268 if (pWidget->isWindow() && pWidget->isVisible()) … … 3320 3312 * Configure event will arrive to tell Qt what geometry we want. */ 3321 3313 pWidget->setGeometry(x, y, w, h); 3322 # else /* ! defined(VBOX_WS_X11) && QT_VERSION >= 0x050000*/3314 # else /* !VBOX_WS_X11 */ 3323 3315 pWidget->setGeometry(x, y, w, h); 3324 # endif /* ! defined(VBOX_WS_X11) && QT_VERSION >= 0x050000*/3316 # endif /* !VBOX_WS_X11 */ 3325 3317 } 3326 3318 … … 3654 3646 QString vmNameOrUuid; 3655 3647 3656 #if QT_VERSION >= 0x0500003657 3648 const QStringList arguments = qApp->arguments(); 3658 3649 const int argc = arguments.size(); 3659 #else /* QT_VERSION < 0x050000 */3660 int argc = qApp->argc();3661 #endif /* QT_VERSION < 0x050000 */3662 3650 int i = 1; 3663 3651 while (i < argc) 3664 3652 { 3665 #if QT_VERSION >= 0x0500003666 3653 QByteArray argBytes = arguments.at(i).toUtf8(); 3667 3654 const char *arg = argBytes.constData(); 3668 #else /* QT_VERSION < 0x050000 */3669 const char *arg = qApp->argv() [i];3670 #endif /* QT_VERSION < 0x050000 */3671 3655 /* NOTE: the check here must match the corresponding check for the 3672 3656 * options to start a VM in main.cpp and hardenedmain.cpp exactly, … … 3677 3661 if (++i < argc) 3678 3662 { 3679 #if QT_VERSION >= 0x0500003680 3663 vmNameOrUuid = arguments.at(i); 3681 #else /* QT_VERSION < 0x050000 */3682 vmNameOrUuid = QString (qApp->argv() [i]);3683 #endif /* QT_VERSION < 0x050000 */3684 3664 startVM = true; 3685 3665 } … … 3693 3673 { 3694 3674 if (++i < argc) 3695 # if QT_VERSION >= 0x0500003696 3675 m_strPidfile = arguments.at(i); 3697 # else /* QT_VERSION < 0x050000 */3698 m_strPidfile = QString(qApp->argv()[i]);3699 # endif /* QT_VERSION < 0x050000 */3700 3676 } 3701 3677 #endif /* VBOX_GUI_WITH_PIDFILE */ … … 3714 3690 if (++i < argc) 3715 3691 { 3716 #if QT_VERSION >= 0x0500003717 3692 RTStrCopy(mSettingsPw, sizeof(mSettingsPw), arguments.at(i).toLocal8Bit().constData()); 3718 #else /* QT_VERSION < 0x050000 */3719 RTStrCopy(mSettingsPw, sizeof(mSettingsPw), qApp->argv() [i]);3720 #endif /* QT_VERSION < 0x050000 */3721 3693 mSettingsPwSet = true; 3722 3694 } … … 3727 3699 { 3728 3700 size_t cbFile; 3729 #if QT_VERSION >= 0x0500003730 3701 const char *pszFile = arguments.at(i).toLocal8Bit().constData(); 3731 #else /* QT_VERSION < 0x050000 */3732 char *pszFile = qApp->argv() [i];3733 #endif /* QT_VERSION < 0x050000 */3734 3702 bool fStdIn = !::strcmp(pszFile, "stdin"); 3735 3703 int vrc = VINF_SUCCESS; … … 3775 3743 { 3776 3744 if (++i < argc) 3777 # if QT_VERSION >= 0x0500003778 3745 m_strFloppyImage = arguments.at(i); 3779 # else /* QT_VERSION < 0x050000 */3780 m_strFloppyImage = qApp->argv()[i];3781 # endif /* QT_VERSION < 0x050000 */3782 3746 } 3783 3747 else if (!::strcmp(arg, "--dvd") || !::strcmp(arg, "--cdrom")) 3784 3748 { 3785 3749 if (++i < argc) 3786 # if QT_VERSION >= 0x0500003787 3750 m_strDvdImage = arguments.at(i); 3788 # else /* QT_VERSION < 0x050000 */3789 m_strDvdImage = qApp->argv()[i];3790 # endif /* QT_VERSION < 0x050000 */3791 3751 } 3792 3752 /* VMM Options: */ … … 3806 3766 { 3807 3767 if (++i < argc) 3808 #if QT_VERSION >= 0x0500003809 3768 mWarpPct = RTStrToUInt32(arguments.at(i).toLocal8Bit().constData()); 3810 #else /* QT_VERSION < 0x050000 */3811 mWarpPct = RTStrToUInt32(qApp->argv() [i]);3812 #endif /* QT_VERSION < 0x050000 */3813 3769 } 3814 3770 #ifdef VBOX_WITH_DEBUGGER_GUI -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r64528 r68315 53 53 /* Qt includes: */ 54 54 #ifdef VBOX_WS_X11 55 # ifdef Q_OS_SOLARIS56 # if QT_VERSION < 0x05000057 # include <QPlastiqueStyle>58 # endif /* QT_VERSION < 0x050000 */59 # endif /* Q_OS_SOLARIS */60 55 # ifndef Q_OS_SOLARIS 61 56 # include <QFontDatabase> … … 228 223 #endif /* VBOX_WS_X11 */ 229 224 230 #if QT_VERSION >= 0x050000231 225 /** Qt5 message handler, function that prints out 232 226 * debug, warning, critical, fatal and system error messages. … … 272 266 } 273 267 } 274 #else /* QT_VERSION < 0x050000 */275 /** Qt4 message handler, function that prints out276 * debug, warning, critical, fatal and system error messages.277 * @param type Holds the type of the message.278 * @param pMsg Holds the message body. */279 static void QtMessageOutput(QtMsgType type, const char *pMsg)280 {281 # ifndef VBOX_WS_X11282 NOREF(pMsg);283 # endif /* !VBOX_WS_X11 */284 switch (type)285 {286 case QtDebugMsg:287 Log(("Qt DEBUG: %s\n", pMsg));288 break;289 case QtWarningMsg:290 Log(("Qt WARNING: %s\n", pMsg));291 # ifdef VBOX_WS_X11292 /* Needed for instance for the message ``cannot connect to X server'': */293 RTStrmPrintf(g_pStdErr, "Qt WARNING: %s\n", pMsg);294 # endif /* VBOX_WS_X11 */295 break;296 case QtCriticalMsg:297 Log(("Qt CRITICAL: %s\n", pMsg));298 # ifdef VBOX_WS_X11299 /* Needed for instance for the message ``cannot connect to X server'': */300 RTStrmPrintf(g_pStdErr, "Qt CRITICAL: %s\n", pMsg);301 # endif /* VBOX_WS_X11 */302 break;303 case QtFatalMsg:304 Log(("Qt FATAL: %s\n", pMsg));305 # ifdef VBOX_WS_X11306 /* Needed for instance for the message ``cannot connect to X server'': */307 RTStrmPrintf(g_pStdErr, "Qt FATAL: %s\n", pMsg);308 # endif /* VBOX_WS_X11 */309 }310 }311 #endif /* QT_VERSION < 0x050000 */312 268 313 269 /** Shows all available command line parameters. */ … … 439 395 #endif /* VBOX_WS_X11 */ 440 396 441 #if QT_VERSION >= 0x050000442 397 /* Install Qt console message handler: */ 443 398 qInstallMessageHandler(QtMessageOutput); 444 #else /* QT_VERSION < 0x050000 */445 /* Install Qt console message handler: */446 qInstallMsgHandler(QtMessageOutput);447 #endif /* QT_VERSION < 0x050000 */448 399 449 400 /* Create application: */ … … 480 431 481 432 # ifdef Q_OS_SOLARIS 482 # if QT_VERSION < 0x050000483 /* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */484 QApplication::setStyle(new QPlastiqueStyle);485 # else /* QT_VERSION >= 0x050000 */486 433 a.setStyle("fusion"); 487 # endif /* QT_VERSION >= 0x050000 */488 434 # endif /* Q_OS_SOLARIS */ 489 435 … … 496 442 bool isSubScaleable = fontDataBase.isScalable(subFamily); 497 443 if (isCurrentScaleable && !isSubScaleable) 498 # if QT_VERSION >= 0x050000499 444 QFont::removeSubstitutions(currentFamily); 500 # else /* QT_VERSION < 0x050000 */501 QFont::removeSubstitution(currentFamily);502 # endif /* QT_VERSION < 0x050000 */503 445 # endif /* !Q_OS_SOLARIS */ 504 446 … … 569 511 int main(int argc, char **argv, char **envp) 570 512 { 571 # ifdef VBOX_WS_X11513 # ifdef VBOX_WS_X11 572 514 /* Make sure multi-threaded environment is safe: */ 573 515 if (!MakeSureMultiThreadingIsSafe()) 574 516 return 1; 575 # endif /* VBOX_WS_X11 */517 # endif /* VBOX_WS_X11 */ 576 518 577 519 /* Initialize VBox Runtime. … … 609 551 Q_UNUSED(a); 610 552 611 #ifdef Q_OS_SOLARIS 612 # if QT_VERSION < 0x050000 613 /* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */ 614 QApplication::setStyle(new QPlastiqueStyle); 615 #else /* QT_VERSION >= 0x050000 */ 553 # ifdef Q_OS_SOLARIS 616 554 a.setStyle("fusion"); 617 # endif /* QT_VERSION >= 0x050000 */ 618 #endif /* Q_OS_SOLARIS */ 555 # endif /* Q_OS_SOLARIS */ 619 556 620 557 /* Prepare the error-message: */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r68264 r68315 1528 1528 pTreeWidget->sortItems(0, Qt::AscendingOrder); 1529 1529 if (iColumns > 0) 1530 #if QT_VERSION >= 0x0500001531 1530 pTreeWidget->header()->setSectionResizeMode(0, QHeaderView::Fixed); 1532 #else /* QT_VERSION < 0x050000 */1533 pTreeWidget->header()->setResizeMode(0, QHeaderView::Fixed);1534 #endif /* QT_VERSION < 0x050000 */1535 1531 if (iColumns > 1) 1536 #if QT_VERSION >= 0x0500001537 1532 pTreeWidget->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); 1538 #else /* QT_VERSION < 0x050000 */1539 pTreeWidget->header()->setResizeMode(1, QHeaderView::ResizeToContents);1540 #endif /* QT_VERSION < 0x050000 */1541 1533 if (iColumns > 2) 1542 #if QT_VERSION >= 0x0500001543 1534 pTreeWidget->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); 1544 #else /* QT_VERSION < 0x050000 */1545 pTreeWidget->header()->setResizeMode(2, QHeaderView::ResizeToContents);1546 #endif /* QT_VERSION < 0x050000 */1547 1535 pTreeWidget->header()->setStretchLastSection(false); 1548 1536 pTreeWidget->setSortingEnabled(true); -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
r68041 r68315 24 24 # include <QDir> 25 25 # include <QPointer> 26 # if QT_VERSION >= 0x050000 27 # include <QUrl> 28 # include <QUrlQuery> 29 # endif /* QT_VERSION >= 0x050000 */ 26 # include <QUrl> 27 # include <QUrlQuery> 30 28 31 29 /* GUI includes: */ … … 181 179 { 182 180 /* Compose query: */ 183 #if QT_VERSION >= 0x050000184 181 QUrlQuery url; 185 #else /* QT_VERSION < 0x050000 */186 QUrl url(m_url);187 #endif /* QT_VERSION < 0x050000 */188 182 url.addQueryItem("platform", vboxGlobal().virtualBox().GetPackageType()); 189 183 /* Check if branding is active: */ … … 209 203 UserDictionary headers; 210 204 headers["User-Agent"] = strUserAgent; 211 #if QT_VERSION >= 0x050000212 205 QUrl fullUrl(m_url); 213 206 fullUrl.setQuery(url); 214 207 createNetworkRequest(UINetworkRequestType_GET, QList<QUrl>() << fullUrl, headers); 215 #else /* QT_VERSION < 0x050000 */216 createNetworkRequest(UINetworkRequestType_GET, QList<QUrl>() << url, headers);217 #endif /* QT_VERSION < 0x050000 */218 208 } 219 209 -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm
r65223 r68315 29 29 #import <AppKit/NSImage.h> 30 30 #import <AppKit/NSSegmentedControl.h> 31 #if QT_VERSION >= 0x050000 32 # import <AppKit/NSEvent.h> 33 # import <AppKit/NSColor.h> 34 # import <AppKit/NSSearchFieldCell.h> 35 # import <AppKit/NSSearchField.h> 36 # import <AppKit/NSSegmentedCell.h> 37 #endif /* QT_VERSION >= 0x050000 */ 31 #import <AppKit/NSEvent.h> 32 #import <AppKit/NSColor.h> 33 #import <AppKit/NSSearchFieldCell.h> 34 #import <AppKit/NSSearchField.h> 35 #import <AppKit/NSSegmentedCell.h> 38 36 39 37 /* Qt includes */ … … 46 44 /* Other VBox includes: */ 47 45 #include <iprt/assert.h> 48 49 #if 0 /* This is a built-in according to clang. Not sure how it relates to QT_VERSION... */50 /* Interface Builder Constant,51 * hmm, where is it declared with Qt4? */52 #if QT_VERSION >= 0x05000053 # define IBAction void54 #endif /* QT_VERSION >= 0x050000 */55 #endif56 46 57 47 /* Forward declarations: */ -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp
r62493 r68315 287 287 const QEvent::Type type = pEvent->type(); 288 288 289 #if defined(VBOX_OSE) || (QT_VERSION < 0x040700)289 #ifdef VBOX_OSE // TODO: Do we still need it? 290 290 /* Stupid Qt: Qt doesn't check if a window is minimized when a command is 291 291 * executed. This leads to strange behaviour. The minimized window is … … 305 305 } 306 306 } 307 #endif /* VBOX_OSE || QT_VERSION < 0x040700*/307 #endif /* VBOX_OSE */ 308 308 309 309 /* We need to track several events which leads to different window -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
r63492 r68315 26 26 #import <AppKit/NSColor.h> 27 27 #import <AppKit/NSFont.h> 28 #if QT_VERSION >= 0x050000 29 # import <AppKit/NSScreen.h> 30 # import <AppKit/NSWindow.h> 31 # import <AppKit/NSImageView.h> 32 #endif /* QT_VERSION >= 0x050000 */ 28 #import <AppKit/NSScreen.h> 29 #import <AppKit/NSWindow.h> 30 #import <AppKit/NSImageView.h> 33 31 34 32 #import <objc/objc-class.h> … … 293 291 return 1.0; 294 292 } 295 296 #if QT_VERSION < 0x050000297 void darwinSetDockIconMenu(QMenu* pMenu)298 {299 extern void qt_mac_set_dock_menu(QMenu *);300 qt_mac_set_dock_menu(pMenu);301 }302 #endif /* QT_VERSION < 0x050000 */303 293 304 294 /** -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
r62493 r68315 30 30 #include <QPixmap> 31 31 #include <QContextMenuEvent> 32 #if QT_VERSION >= 0x050000 33 # include <QtMac> 34 #endif /* QT_VERSION >= 0x050000 */ 32 #include <QtMac> 35 33 36 34 #include <Carbon/Carbon.h> … … 329 327 kCGImageAlphaPremultipliedFirst); 330 328 /* Get the CGImageRef from Qt */ 331 #if QT_VERSION < 0x050000332 CGImageRef qtPixmap = pPixmap->toMacCGImageRef();333 #else /* QT_VERSION >= 0x050000 */334 329 CGImageRef qtPixmap = QtMac::toCGImageRef(*pPixmap); 335 #endif /* QT_VERSION >= 0x050000 */336 330 /* Draw the image from Qt & convert the context back to a new CGImageRef. */ 337 331 CGContextDrawImage(ctx, CGRectMake(0, 0, pPixmap->width(), pPixmap->height()), qtPixmap); -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
r62493 r68315 254 254 void darwinSetShowsWindowTransparent(QWidget *pWidget, bool fEnabled); 255 255 void darwinSetWindowHasShadow(QWidget *pWidget, bool fEnabled); 256 #if QT_VERSION < 0x050000257 void darwinSetDockIconMenu(QMenu *pMenu);258 #endif /* QT_VERSION < 0x050000 */259 256 void darwinDisableIconsInMenus(void); 260 257 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp
r64162 r68315 425 425 verticalHeader()->setDefaultSectionSize((int)(verticalHeader()->minimumSectionSize() * 1.33)); 426 426 horizontalHeader()->setStretchLastSection(false); 427 #if QT_VERSION >= 0x050000428 427 horizontalHeader()->setSectionResizeMode(UIEncryptionDataTableSection_Id, QHeaderView::Interactive); 429 428 horizontalHeader()->setSectionResizeMode(UIEncryptionDataTableSection_Password, QHeaderView::Stretch); 430 #else /* QT_VERSION < 0x050000 */431 horizontalHeader()->setResizeMode(UIEncryptionDataTableSection_Id, QHeaderView::Interactive);432 horizontalHeader()->setResizeMode(UIEncryptionDataTableSection_Password, QHeaderView::Stretch);433 #endif /* QT_VERSION < 0x050000 */434 429 } 435 430 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp
r63327 r68315 287 287 QTextStream *g_pStrmLogQt = NULL; /* Output stream for Qt debug logging. */ 288 288 289 # if QT_VERSION >= 0x050000290 289 /* static */ 291 290 void UIDnDHandler::debugOutputQt(QtMsgType type, const QMessageLogContext &context, const QString &strMessage) … … 312 311 (*g_pStrmLogQt) << strMsg << " " << strMessage << endl; 313 312 } 314 # else /* QT_VERSION < 0x050000 */315 /* static */316 void UIDnDHandler::debugOutputQt(QtMsgType type, const char *pszMsg)317 {318 AssertPtr(pszMsg);319 320 QString strMsg;321 switch (type)322 {323 case QtWarningMsg:324 strMsg += "[W]";325 break;326 case QtCriticalMsg:327 strMsg += "[C]";328 break;329 case QtFatalMsg:330 strMsg += "[F]";331 break;332 case QtDebugMsg:333 default:334 strMsg += "[D]";335 break;336 }337 338 if (g_pStrmLogQt)339 (*g_pStrmLogQt) << strMsg << " " << pszMsg << endl;340 }341 # endif /* QT_VERSION < 0x050000 */342 313 #endif /* DEBUG_DND_QT */ 343 314 … … 367 338 g_pStrmLogQt = new QTextStream(pFileDebugQt); 368 339 369 #if QT_VERSION >= 0x050000370 340 qInstallMessageHandler(UIDnDHandler::debugOutputQt); 371 #else /* QT_VERSION < 0x050000 */372 qInstallMsgHandler(UIDnDHandler::debugOutputQt);373 #endif /* QT_VERSION < 0x050000 */374 341 qDebug("========================================================================"); 375 342 } … … 438 405 # ifdef RT_OS_DARWIN 439 406 # ifdef VBOX_WITH_DRAG_AND_DROP_PROMISES 440 # if QT_VERSION < 0x050000441 dropAction = pDrag->exec(actions, defAction, true /* fUsePromises */);442 # else /* QT_VERSION >= 0x050000 */443 407 dropAction = pDrag->exec(actions, defAction); 444 # endif /* QT_VERSION >= 0x050000 */445 408 # else 446 409 /* Without having VBOX_WITH_DRAG_AND_DROP_PROMISES enabled drag and drop -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r65444 r68315 64 64 # include <QX11Info> 65 65 # include <X11/Xlib.h> 66 # if QT_VERSION >= 0x050000 67 # undef Bool // Qt5 vs Xlib gift.. 68 # endif /* QT_VERSION >= 0x050000 */ 66 # undef Bool // Qt5 vs Xlib gift.. 69 67 #endif /* VBOX_WS_X11 */ 70 68 … … 1384 1382 1385 1383 #ifdef VBOX_WS_MAC 1386 # if QT_VERSION >= 0x0500001387 1384 /* On OSX for Qt5 we need to erase backing store first: */ 1388 1385 QRect eraseRect = paintRect; … … 1397 1394 painter.fillRect(eraseRect, QColor(Qt::black)); 1398 1395 painter.setCompositionMode(QPainter::CompositionMode_SourceAtop); 1399 # endif /* QT_VERSION >= 0x050000 */1400 1396 #endif /* VBOX_WS_MAC */ 1401 1397 … … 1470 1466 1471 1467 #if defined(VBOX_WITH_TRANSLUCENT_SEAMLESS) 1472 # if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11) || QT_VERSION >= 0x0500001473 1468 /* On OSX for Qt5 we need to erase backing store first: */ 1474 1469 QRect eraseRect = paintRect; … … 1483 1478 painter.fillRect(eraseRect, QColor(Qt::black)); 1484 1479 painter.setCompositionMode(QPainter::CompositionMode_SourceAtop); 1485 # endif /* VBOX_WS_WIN || VBOX_WS_X11 || QT_VERSION >= 0x050000 */1486 1480 #endif /* VBOX_WITH_TRANSLUCENT_SEAMLESS */ 1487 1481 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r66589 r68315 37 37 /* Qt includes: */ 38 38 # include <QKeyEvent> 39 # include <QTimer> 39 40 # ifdef VBOX_WS_X11 40 41 # include <QX11Info> 41 # endif42 # if QT_VERSION >= 0x05000043 # include <QTimer>44 42 # endif 45 43 … … 70 68 /* Other VBox includes: */ 71 69 # ifdef VBOX_WS_MAC 72 # if QT_VERSION >= 0x050000 73 # include "iprt/cpp/utils.h" 74 # endif /* QT_VERSION >= 0x050000 */ 70 # include "iprt/cpp/utils.h" 75 71 # endif /* VBOX_WS_MAC */ 76 72 … … 105 101 # undef FocusIn 106 102 # endif /* KeyPress */ 107 # if QT_VERSION >= 0x050000 108 # include <xcb/xcb.h> 109 # endif /* QT_VERSION >= 0x050000 */ 103 # include <xcb/xcb.h> 110 104 #endif /* VBOX_WS_X11 */ 111 105 … … 212 206 } 213 207 214 #ifdef VBOX_WS_X11215 # if QT_VERSION < 0x050000216 struct CHECKFORX11FOCUSEVENTSDATA217 {218 Window hWindow;219 bool fEventFound;220 };221 222 static Bool checkForX11FocusEventsWorker(Display *pDisplay, XEvent *pEvent,223 XPointer pArg)224 {225 NOREF(pDisplay);226 struct CHECKFORX11FOCUSEVENTSDATA *pStruct;227 228 pStruct = (struct CHECKFORX11FOCUSEVENTSDATA *)pArg;229 if ( pEvent->xany.type == XFocusIn230 || pEvent->xany.type == XFocusOut)231 if (pEvent->xany.window == pStruct->hWindow)232 pStruct->fEventFound = true;233 return false;234 }235 236 bool UIKeyboardHandler::checkForX11FocusEvents(Window hWindow)237 {238 XEvent dummy;239 struct CHECKFORX11FOCUSEVENTSDATA data;240 241 data.hWindow = hWindow;242 data.fEventFound = false;243 XCheckIfEvent(QX11Info::display(), &dummy, checkForX11FocusEventsWorker,244 (XPointer)&data);245 return data.fEventFound;246 }247 # endif /* QT_VERSION < 0x050000 */248 #endif /* VBOX_WS_X11 */249 250 208 void UIKeyboardHandler::captureKeyboard(ulong uScreenId) 251 209 { … … 264 222 m_iKeyboardCaptureViewIndex = uScreenId; 265 223 266 #if QT_VERSION < 0x050000267 /* Finalise keyboard capture: */268 finaliseCaptureKeyboard();269 #else270 224 /* On X11, we do not grab the keyboard as soon as it is captured, but delay it 271 225 * for 300 milliseconds after the formal capture. We do this for several reasons: … … 281 235 * common behavior everywhere while X11 is forced to behave that way. */ 282 236 QTimer::singleShot(300, this, SLOT(sltFinaliseCaptureKeyboard())); 283 #endif284 237 } 285 238 } … … 318 271 319 272 #elif defined(VBOX_WS_X11) 320 # if QT_VERSION < 0x050000321 322 /* On X11, we are using passive XGrabKey for normal (windowed) mode323 * instead of XGrabKeyboard (called by QWidget::grabKeyboard()) because324 * XGrabKeyboard causes a problem under metacity - a window cannot be moved325 * using the mouse if it is currently actively grabbing the keyboard;326 * For static modes we are using usual (active) keyboard grabbing. */327 328 switch (machineLogic()->visualStateType())329 {330 /* If window is moveable we are making passive keyboard grab: */331 case UIVisualStateType_Normal:332 case UIVisualStateType_Scale:333 {334 XGrabKey(QX11Info::display(), AnyKey, AnyModifier, m_windows[m_iKeyboardCaptureViewIndex]->winId(), False, GrabModeAsync, GrabModeAsync);335 break;336 }337 /* If window is NOT moveable we are making active keyboard grab: */338 case UIVisualStateType_Fullscreen:339 case UIVisualStateType_Seamless:340 {341 /* Keyboard grabbing can fail because of some keyboard shortcut is still grabbed by window manager.342 * We can't be sure this shortcut will be released at all, so we will retry to grab keyboard for 50 times,343 * and after we will just ignore that issue: */344 int cTriesLeft = 50;345 Window hWindow;346 347 /* Only do our keyboard grab if there are no other focus events348 * for this window on the queue. This can prevent problems349 * including two windows fighting to grab the keyboard. */350 hWindow = m_windows[m_iKeyboardCaptureViewIndex]->winId();351 if (!checkForX11FocusEvents(hWindow))352 while (cTriesLeft && XGrabKeyboard(QX11Info::display(),353 hWindow, False, GrabModeAsync, GrabModeAsync,354 CurrentTime))355 --cTriesLeft;356 break;357 }358 /* Should we try to grab keyboard in default case? I think - NO. */359 default:360 break;361 }362 363 # else /* QT_VERSION >= 0x050000 */364 273 365 274 /* On X11, we are using XCB stuff to grab the keyboard. … … 398 307 free(pGrabReply); 399 308 400 # endif /* QT_VERSION >= 0x050000 */401 309 #else 402 310 … … 451 359 452 360 #elif defined(VBOX_WS_X11) 453 # if QT_VERSION < 0x050000454 455 /* On X11, we are using passive XGrabKey for normal (windowed) mode456 * instead of XGrabKeyboard (called by QWidget::grabKeyboard()) because457 * XGrabKeyboard causes a problem under metacity - a window cannot be moved458 * using the mouse if it is currently actively grabbing the keyboard;459 * For static modes we are using usual (active) keyboard grabbing. */460 461 switch (machineLogic()->visualStateType())462 {463 /* If window is moveable we are making passive keyboard ungrab: */464 case UIVisualStateType_Normal:465 case UIVisualStateType_Scale:466 {467 XUngrabKey(QX11Info::display(), AnyKey, AnyModifier, m_windows[m_iKeyboardCaptureViewIndex]->winId());468 break;469 }470 /* If window is NOT moveable we are making active keyboard ungrab: */471 case UIVisualStateType_Fullscreen:472 case UIVisualStateType_Seamless:473 {474 XUngrabKeyboard(QX11Info::display(), CurrentTime);475 break;476 }477 /* Should we try to release keyboard in default case? I think - NO. */478 default:479 break;480 }481 482 # else /* QT_VERSION >= 0x050000 */483 361 484 362 /* On X11, we are using XCB stuff to grab the keyboard. … … 496 374 m_hButtonGrabWindow = 0; 497 375 498 # endif /* QT_VERSION >= 0x050000 */499 376 #else 500 377 … … 613 490 #endif /* VBOX_WS_WIN */ 614 491 615 #if QT_VERSION < 0x050000 616 # if defined(VBOX_WS_MAC) 617 618 bool UIKeyboardHandler::macEventFilter(const void *pvCocoaEvent, EventRef event, ulong uScreenId) 619 { 492 bool UIKeyboardHandler::nativeEventFilter(void *pMessage, ulong uScreenId) 493 { 494 /* Make sure view with passed index exists: */ 495 if (!m_views.contains(uScreenId)) 496 return false; 497 620 498 /* Check if some system event should be filtered out. 621 499 * Returning @c true means filtering-out, 622 500 * Returning @c false means passing event to Qt. */ 623 501 bool fResult = false; /* Pass to Qt by default. */ 502 503 # if defined(VBOX_WS_MAC) 504 505 /* Acquire carbon event reference from the cocoa one: */ 506 EventRef event = static_cast<EventRef>(darwinCocoaToCarbonEvent(pMessage)); 624 507 625 508 /* Depending on event kind: */ … … 691 574 692 575 /* Adjust new modifier mask to distinguish left/right modifiers: */ 693 uNewMask = ::DarwinAdjustModifierMask(uNewMask, p vCocoaEvent);576 uNewMask = ::DarwinAdjustModifierMask(uNewMask, pMessage); 694 577 695 578 /* Determine what is really changed: */ … … 753 636 } 754 637 755 /* Return result: */756 return fResult;757 }758 759 638 # elif defined(VBOX_WS_WIN) 760 639 761 bool UIKeyboardHandler::winEventFilter(MSG *pMsg, ulong uScreenId)762 {763 640 /* Ignore this event if m_fSkipKeyboardEvents is set by winSkipKeyboardEvents(). */ 764 641 if (m_fSkipKeyboardEvents) 765 642 return false; 766 643 767 /* Check if some system event should be filtered out. 768 * Returning @c true means filtering-out, 769 * Returning @c false means passing event to Qt. */ 770 bool fResult = false; /* Pass to Qt by default. */ 644 /* Cast to MSG event: */ 645 MSG *pMsg = static_cast<MSG*>(pMessage); 771 646 772 647 /* Depending on message type: */ … … 779 654 case WM_SYSKEYUP: 780 655 { 656 // WORKAROUND: 657 // Can't do COM inter-process calls from a SendMessage handler, 658 // see http://support.microsoft.com/kb/131056. 659 if (vboxGlobal().isSeparateProcess() && InSendMessage()) 660 { 661 PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam); 662 fResult = true; 663 break; 664 } 665 781 666 /* Check for our own special flag to ignore this event. 782 667 * That flag could only be set later in this function … … 918 803 } 919 804 920 /* Return result: */921 return fResult;922 }923 924 # elif defined(VBOX_WS_X11)925 926 static Bool UIKeyboardHandlerCompEvent(Display*, XEvent *pEvent, XPointer pvArg)927 {928 XEvent *pKeyEvent = (XEvent*)pvArg;929 if ((pEvent->type == XKeyPress) && (pEvent->xkey.keycode == pKeyEvent->xkey.keycode))930 return True;931 else932 return False;933 }934 935 bool UIKeyboardHandler::x11EventFilter(XEvent *pEvent, ulong uScreenId)936 {937 /* Check if some system event should be filtered out.938 * Returning @c true means filtering-out,939 * Returning @c false means passing event to Qt. */940 bool fResult = false; /* Pass to Qt by default. */941 942 /* Depending on event type: */943 switch (pEvent->type)944 {945 /* We have to handle XFocusOut right here as this event is not passed to UIMachineView::event().946 * Handling this event is important for releasing the keyboard before the screen saver gets active.947 * See public ticket #3894: Apparently this makes problems with newer versions of Qt948 * and this hack is probably not necessary anymore. So disable it for Qt >= 4.5.0. */949 case XFocusOut:950 case XFocusIn:951 {952 if (isSessionRunning())953 {954 if (VBoxGlobal::qtRTVersion() < ((4 << 16) | (5 << 8) | 0))955 {956 if (pEvent->type == XFocusIn)957 {958 /* Capture keyboard by chosen view number: */959 captureKeyboard(uScreenId);960 /* Reset the single-time disable capture flag: */961 if (isAutoCaptureDisabled())962 setAutoCaptureDisabled(false);963 }964 else965 {966 /* Release keyboard: */967 releaseKeyboard();968 /* And all pressed keys including host-one: */969 releaseAllPressedKeys(true);970 }971 }972 }973 fResult = false;974 break;975 }976 /* Watch for key-events: */977 case XKeyPress:978 case XKeyRelease:979 {980 /* Translate the keycode to a PC scan code: */981 unsigned uScan = handleXKeyEvent(pEvent->xkey.display, pEvent->xkey.keycode);982 983 /* Scan codes 0x00 (no valid translation) and 0x80 (extended flag) are ignored: */984 if (!(uScan & 0x7F))985 {986 fResult = true;987 break;988 }989 990 /* Fix for http://www.virtualbox.org/ticket/1296:991 * when X11 sends events for repeated keys, it always inserts an XKeyRelease before the XKeyPress. */992 XEvent returnEvent;993 if ((pEvent->type == XKeyRelease) && (XCheckIfEvent(pEvent->xkey.display, &returnEvent,994 UIKeyboardHandlerCompEvent, (XPointer)pEvent) == True))995 {996 XPutBackEvent(pEvent->xkey.display, &returnEvent);997 fResult = true;998 break;999 }1000 1001 /* Calculate flags: */1002 int iFlags = 0;1003 if (uScan >> 8)1004 iFlags |= KeyExtended;1005 if (pEvent->type == XKeyPress)1006 iFlags |= KeyPressed;1007 1008 /* Remove the extended flag: */1009 uScan &= 0x7F;1010 1011 /* Special Korean keys must send scan code 0xF1/0xF21012 * when pressed and nothing when released. */1013 if (uScan == 0x71 || uScan == 0x72)1014 {1015 if (pEvent->type == XKeyRelease)1016 {1017 fResult = true;1018 break;1019 }1020 /* Re-create the bizarre scan code: */1021 uScan |= 0x80;1022 }1023 1024 /* Translate the keycode to a keysym: */1025 KeySym ks = ::wrapXkbKeycodeToKeysym(pEvent->xkey.display, pEvent->xkey.keycode, 0, 0);1026 1027 /* Update special flags: */1028 switch (ks)1029 {1030 case XK_Print:1031 iFlags |= KeyPrint;1032 break;1033 case XK_Pause:1034 if (pEvent->xkey.state & ControlMask) /* Break */1035 {1036 ks = XK_Break;1037 iFlags |= KeyExtended;1038 uScan = 0x46;1039 }1040 else1041 iFlags |= KeyPause;1042 break;1043 }1044 1045 /* Finally, handle parsed key-event: */1046 fResult = keyEvent(ks, uScan, iFlags, uScreenId);1047 1048 break;1049 }1050 default:1051 break;1052 }1053 1054 /* Return result: */1055 return fResult;1056 }1057 1058 # endif /* VBOX_WS_X11 */1059 #else /* QT_VERSION >= 0x050000 */1060 1061 bool UIKeyboardHandler::nativeEventFilter(void *pMessage, ulong uScreenId)1062 {1063 /* Make sure view with passed index exists: */1064 if (!m_views.contains(uScreenId))1065 return false;1066 1067 /* Check if some system event should be filtered out.1068 * Returning @c true means filtering-out,1069 * Returning @c false means passing event to Qt. */1070 bool fResult = false; /* Pass to Qt by default. */1071 1072 # if defined(VBOX_WS_MAC)1073 1074 /* Acquire carbon event reference from the cocoa one: */1075 EventRef event = static_cast<EventRef>(darwinCocoaToCarbonEvent(pMessage));1076 1077 /* Depending on event kind: */1078 const UInt32 uEventKind = ::GetEventKind(event);1079 switch (uEventKind)1080 {1081 /* Watch for simple key-events: */1082 case kEventRawKeyDown:1083 case kEventRawKeyRepeat:1084 case kEventRawKeyUp:1085 {1086 /* Acquire keycode: */1087 UInt32 uKeyCode = ~0U;1088 ::GetEventParameter(event, kEventParamKeyCode, typeUInt32,1089 NULL, sizeof(uKeyCode), NULL, &uKeyCode);1090 1091 /* The usb keyboard driver translates these codes to different virtual1092 * keycodes depending of the keyboard type. There are ANSI, ISO, JIS1093 * and unknown. For European keyboards (ISO) the key 0xa and 0x32 have1094 * to be switched. Here we are doing this at runtime, cause the user1095 * can have more than one keyboard (of different type), where he may1096 * switch at will all the time. Default is the ANSI standard as defined1097 * in g_aDarwinToSet1. Please note that the "~" on some English ISO1098 * keyboards will be wrongly swapped. This can maybe fixed by1099 * using a Apple keyboard layout in the guest. */1100 if ( (uKeyCode == 0xa || uKeyCode == 0x32)1101 && KBGetLayoutType(LMGetKbdType()) == kKeyboardISO)1102 uKeyCode = 0x3c - uKeyCode;1103 1104 /* Translate keycode to set 1 scan code: */1105 unsigned uScanCode = ::DarwinKeycodeToSet1Scancode(uKeyCode);1106 1107 /* If scan code is valid: */1108 if (uScanCode)1109 {1110 /* Calculate flags: */1111 int iFlags = 0;1112 if (uEventKind != kEventRawKeyUp)1113 iFlags |= KeyPressed;1114 if (uScanCode & VBOXKEY_EXTENDED)1115 iFlags |= KeyExtended;1116 /** @todo KeyPause, KeyPrint. */1117 uScanCode &= VBOXKEY_SCANCODE_MASK;1118 1119 /* Get the unicode string (if present): */1120 AssertCompileSize(wchar_t, 2);1121 AssertCompileSize(UniChar, 2);1122 ByteCount cbWritten = 0;1123 wchar_t ucs[8];1124 if (::GetEventParameter(event, kEventParamKeyUnicodes, typeUnicodeText,1125 NULL, sizeof(ucs), &cbWritten, &ucs[0]) != 0)1126 cbWritten = 0;1127 ucs[cbWritten / sizeof(wchar_t)] = 0; /* The api doesn't terminate it. */1128 1129 /* Finally, handle parsed key-event: */1130 fResult = keyEvent(uKeyCode, uScanCode, iFlags, uScreenId, ucs[0] ? ucs : NULL);1131 }1132 1133 break;1134 }1135 /* Watch for modifier key-events: */1136 case kEventRawKeyModifiersChanged:1137 {1138 /* Acquire new modifier mask, it may contain1139 * multiple modifier changes, kind of annoying: */1140 UInt32 uNewMask = 0;1141 ::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32,1142 NULL, sizeof(uNewMask), NULL, &uNewMask);1143 1144 /* Adjust new modifier mask to distinguish left/right modifiers: */1145 uNewMask = ::DarwinAdjustModifierMask(uNewMask, pMessage);1146 1147 /* Determine what is really changed: */1148 const UInt32 changed = uNewMask ^ m_uDarwinKeyModifiers;1149 if (changed)1150 {1151 for (UInt32 bit = 0; bit < 32; ++bit)1152 {1153 /* Skip unchanged bits: */1154 if (!(changed & (1 << bit)))1155 continue;1156 /* Acquire set 1 scan code from new mask: */1157 unsigned uScanCode = ::DarwinModifierMaskToSet1Scancode(1 << bit);1158 /* Skip invalid scan codes: */1159 if (!uScanCode)1160 continue;1161 /* Acquire darwin keycode from new mask: */1162 unsigned uKeyCode = ::DarwinModifierMaskToDarwinKeycode(1 << bit);1163 /* Assert invalid keycodes: */1164 Assert(uKeyCode);1165 1166 /* For non-lockable modifier: */1167 if (!(uScanCode & VBOXKEY_LOCK))1168 {1169 /* Calculate flags: */1170 unsigned uFlags = (uNewMask & (1 << bit)) ? KeyPressed : 0;1171 if (uScanCode & VBOXKEY_EXTENDED)1172 uFlags |= KeyExtended;1173 uScanCode &= VBOXKEY_SCANCODE_MASK;1174 1175 /* Finally, handle parsed key-event: */1176 keyEvent(uKeyCode, uScanCode & 0xff, uFlags, uScreenId);1177 }1178 /* For lockable modifier: */1179 else1180 {1181 /* Calculate flags: */1182 unsigned uFlags = 0;1183 if (uScanCode & VBOXKEY_EXTENDED)1184 uFlags |= KeyExtended;1185 uScanCode &= VBOXKEY_SCANCODE_MASK;1186 1187 /* Finally, handle parsed press/release pair: */1188 keyEvent(uKeyCode, uScanCode, uFlags | KeyPressed, uScreenId);1189 keyEvent(uKeyCode, uScanCode, uFlags, uScreenId);1190 }1191 }1192 }1193 1194 /* Remember new modifier mask: */1195 m_uDarwinKeyModifiers = uNewMask;1196 1197 /* Always return true here because we'll otherwise getting a Qt event1198 * we don't want and that will only cause the Pause warning to pop up: */1199 fResult = true;1200 1201 break;1202 }1203 default:1204 break;1205 }1206 1207 # elif defined(VBOX_WS_WIN)1208 1209 /* Ignore this event if m_fSkipKeyboardEvents is set by winSkipKeyboardEvents(). */1210 if (m_fSkipKeyboardEvents)1211 return false;1212 1213 /* Cast to MSG event: */1214 MSG *pMsg = static_cast<MSG*>(pMessage);1215 1216 /* Depending on message type: */1217 switch (pMsg->message)1218 {1219 /* Watch for key-events: */1220 case WM_KEYDOWN:1221 case WM_KEYUP:1222 case WM_SYSKEYDOWN:1223 case WM_SYSKEYUP:1224 {1225 // WORKAROUND:1226 // Can't do COM inter-process calls from a SendMessage handler,1227 // see http://support.microsoft.com/kb/131056.1228 if (vboxGlobal().isSeparateProcess() && InSendMessage())1229 {1230 PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);1231 fResult = true;1232 break;1233 }1234 1235 /* Check for our own special flag to ignore this event.1236 * That flag could only be set later in this function1237 * so having it here means this event came here1238 * for the second time already. */1239 if (pMsg->lParam & (0x1 << 25))1240 {1241 /* Remove that flag as well: */1242 pMsg->lParam &= ~(0x1 << 25);1243 fResult = false;1244 break;1245 }1246 1247 /* Scan codes 0x80 and 0x00 should be filtered out: */1248 unsigned uScan = (pMsg->lParam >> 16) & 0x7F;1249 if (!uScan)1250 {1251 fResult = true;1252 break;1253 }1254 1255 /* Get the virtual key: */1256 int iVKey = pMsg->wParam;1257 1258 /* Calculate flags: */1259 int iFlags = 0;1260 if (pMsg->lParam & 0x1000000)1261 iFlags |= KeyExtended;1262 if (!(pMsg->lParam & 0x80000000))1263 iFlags |= KeyPressed;1264 1265 /* Make sure AltGr monitor exists: */1266 AssertPtrReturn(m_pAltGrMonitor, false);1267 {1268 /* Filter event out if we are sure that this is a fake left control event: */1269 if (m_pAltGrMonitor->isCurrentEventDefinitelyFake(uScan, iFlags & KeyPressed, iFlags & KeyExtended))1270 {1271 fResult = true;1272 break;1273 }1274 /* Update AltGR monitor state from key-event: */1275 m_pAltGrMonitor->updateStateFromKeyEvent(uScan, iFlags & KeyPressed, iFlags & KeyExtended);1276 /* And release left Ctrl key early (if required): */1277 if (m_pAltGrMonitor->isLeftControlReleaseNeeded())1278 keyboard().PutScancode(0x1D | 0x80);1279 }1280 1281 /* Check for special Korean keys. Based on the keyboard layout selected1282 * on the host, the scan code in lParam might be 0x71/0x72 or 0xF1/0xF2.1283 * In either case, we must deliver 0xF1/0xF2 scan code to the guest when1284 * the key is pressed and nothing when it's released. */1285 if (uScan == 0x71 || uScan == 0x72)1286 {1287 uScan |= 0x80;1288 iFlags = KeyPressed; /* Because a release would be ignored. */1289 iVKey = VK_PROCESSKEY; /* In case it was 0xFF. */1290 }1291 1292 /* When one of the SHIFT keys is held and one of the cursor movement1293 * keys is pressed, Windows duplicates SHIFT press/release messages,1294 * but with the virtual keycode set to 0xFF. These virtual keys are also1295 * sent in some other situations (Pause, PrtScn, etc.). Filter out such messages. */1296 if (iVKey == 0xFF)1297 {1298 fResult = true;1299 break;1300 }1301 1302 /* Handle special virtual keys: */1303 switch (iVKey)1304 {1305 case VK_SHIFT:1306 case VK_CONTROL:1307 case VK_MENU:1308 {1309 /* Overcome Win32 modifier key generalization: */1310 int iKeyscan = uScan;1311 if (iFlags & KeyExtended)1312 iKeyscan |= 0xE000;1313 switch (iKeyscan)1314 {1315 case 0x002A: iVKey = VK_LSHIFT; break;1316 case 0x0036: iVKey = VK_RSHIFT; break;1317 case 0x001D: iVKey = VK_LCONTROL; break;1318 case 0xE01D: iVKey = VK_RCONTROL; break;1319 case 0x0038: iVKey = VK_LMENU; break;1320 case 0xE038: iVKey = VK_RMENU; break;1321 }1322 break;1323 }1324 case VK_NUMLOCK:1325 /* Win32 sets the extended bit for the NumLock key. Reset it: */1326 iFlags &= ~KeyExtended;1327 break;1328 case VK_SNAPSHOT:1329 iFlags |= KeyPrint;1330 break;1331 case VK_PAUSE:1332 iFlags |= KeyPause;1333 break;1334 }1335 1336 /* Finally, handle parsed key-event: */1337 fResult = keyEvent(iVKey, uScan, iFlags, uScreenId);1338 1339 /* Always let Windows see key releases to prevent stuck keys.1340 * Hopefully this won't cause any other issues. */1341 if (pMsg->message == WM_KEYUP || pMsg->message == WM_SYSKEYUP)1342 {1343 fResult = false;1344 break;1345 }1346 1347 /* Above keyEvent() returned that it didn't processed the event, but since the1348 * keyboard is captured, we don't want to pass it to Windows. We just want1349 * to let Qt process the message (to handle non-alphanumeric <HOST>+key1350 * shortcuts for example). So send it directly to the window with the1351 * special flag in the reserved area of lParam (to avoid recursion). */1352 if (!fResult && m_fIsKeyboardCaptured)1353 {1354 ::SendMessage(pMsg->hwnd, pMsg->message,1355 pMsg->wParam, pMsg->lParam | (0x1 << 25));1356 fResult = true;1357 break;1358 }1359 1360 /* These special keys have to be handled by Windows as well to update the1361 * internal modifier state and to enable/disable the keyboard LED: */1362 if (iVKey == VK_NUMLOCK || iVKey == VK_CAPITAL || iVKey == VK_LSHIFT || iVKey == VK_RSHIFT)1363 {1364 fResult = false;1365 break;1366 }1367 1368 break;1369 }1370 default:1371 break;1372 }1373 1374 805 # elif defined(VBOX_WS_X11) 1375 806 … … 1470 901 return fResult; 1471 902 } 1472 1473 #endif /* QT_VERSION >= 0x050000 */1474 903 1475 904 /* Machine state-change handler: */ … … 1527 956 } 1528 957 1529 #if QT_VERSION >= 0x0500001530 958 void UIKeyboardHandler::sltFinaliseCaptureKeyboard() 1531 959 { … … 1537 965 } 1538 966 } 1539 #endif1540 967 1541 968 /* Keyboard-handler constructor: */ … … 1559 986 , m_pAltGrMonitor(0) 1560 987 #elif defined(VBOX_WS_X11) 1561 # if QT_VERSION >= 0x0500001562 988 , m_hButtonGrabWindow(0) 1563 # endif1564 989 #endif /* VBOX_WS_X11 */ 1565 990 , m_cMonitors(1) … … 1866 1291 1867 1292 /* Pass event to machine-view's event handler: */ 1868 #if QT_VERSION < 0x0500001869 return m_views[m_iKeyboardHookViewIndex]->macEvent(pvCocoaEvent, event);1870 #else /* QT_VERSION >= 0x050000 */1871 1293 Q_UNUSED(event); 1872 1294 return nativeEventFilter(unconst(pvCocoaEvent), m_iKeyboardHookViewIndex); 1873 #endif /* QT_VERSION >= 0x050000 */1874 1295 } 1875 1296 … … 1931 1352 1932 1353 /* Pass event to view's event handler: */ 1933 #if QT_VERSION < 0x0500001934 long dummyResult;1935 return m_views[m_iKeyboardHookViewIndex]->winEvent(&message, &dummyResult);1936 #else /* QT_VERSION >= 0x050000 */1937 1354 return nativeEventFilter(&message, m_iKeyboardHookViewIndex); 1938 #endif /* QT_VERSION >= 0x050000 */1939 1355 } 1940 1356 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
r66571 r68315 45 45 #ifdef VBOX_WS_WIN 46 46 class WinAltGrMonitor; 47 #endif /* VBOX_WS_WIN */47 #endif 48 48 #ifdef VBOX_WS_X11 49 # if QT_VERSION < 0x05000050 typedef union _XEvent XEvent;51 #else52 49 # include <xcb/xcb.h> 53 # endif /* QT_VERSION >= 0x050000 */ 54 #endif /* VBOX_WS_X11 */ 50 #endif 55 51 56 52 … … 74 70 void prepareListener(ulong uScreenId, UIMachineWindow *pMachineWindow); 75 71 void cleanupListener(ulong uScreenId); 76 77 /* Commands to capture/release keyboard: */78 #ifdef VBOX_WS_X1179 # if QT_VERSION < 0x05000080 bool checkForX11FocusEvents(unsigned long hWindow);81 # endif /* QT_VERSION < 0x050000 */82 #endif /* VBOX_WS_X11 */83 72 84 73 /** Captures the keyboard for @a uScreenId. */ … … 113 102 #endif /* VBOX_WS_WIN */ 114 103 115 #if QT_VERSION < 0x050000116 # if defined(VBOX_WS_MAC)117 /** Qt4: Mac: Performs pre-processing of all the native events. */118 bool macEventFilter(const void *pvCocoaEvent, EventRef event, ulong uScreenId);119 # elif defined(VBOX_WS_WIN)120 /** Qt4: Win: Performs pre-processing of all the native events. */121 bool winEventFilter(MSG *pMsg, ulong uScreenId);122 # elif defined(VBOX_WS_X11)123 /** Qt4: X11: Performs pre-processing of all the native events. */124 bool x11EventFilter(XEvent *pEvent, ulong uScreenId);125 # endif /* VBOX_WS_X11 */126 #else127 104 /** Qt5: Performs pre-processing of all the native events. */ 128 105 bool nativeEventFilter(void *pMessage, ulong uScreenId); 129 #endif130 106 131 107 protected slots: … … 134 110 virtual void sltMachineStateChanged(); 135 111 136 #if QT_VERSION >= 0x050000 112 #if QT_VERSION == 0 113 /** Stupid moc does not warn if it cannot find headers! */ 114 void QT_VERSION_NOT_DEFINED 115 #else 137 116 /** Finalises keyboard capture. */ 138 117 void sltFinaliseCaptureKeyboard(); 139 #elif QT_VERSION == 0140 /** Stupid moc does not warn if it cannot find headers! */141 void QT_VERSION_NOT_DEFINED142 118 #endif 143 119 … … 244 220 static UIKeyboardHandler *m_spKeyboardHandler; 245 221 #elif defined(VBOX_WS_X11) 246 # if QT_VERSION >= 0x050000247 222 /** The root window at the time we grab the mouse buttons. */ 248 223 xcb_window_t m_hButtonGrabWindow; 249 # endif250 224 #endif /* VBOX_WS_X11 */ 251 225 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r67535 r68315 1268 1268 pDockMenu->addMenu(pDockSettingsMenu); 1269 1269 1270 # if QT_VERSION < 0x0500001271 /* Add it to the dock. */1272 ::darwinSetDockIconMenu(pDockMenu);1273 # else /* QT_VERSION >= 0x050000 */1274 1270 /* Add it to the dock: */ 1275 1271 pDockMenu->setAsDockMenu(); 1276 # endif /* QT_VERSION >= 0x050000 */1277 1272 1278 1273 /* Now the dock icon preview: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r67664 r68315 72 72 73 73 /* Qt includes: */ 74 #if QT_VERSION >= 0x05000075 74 # include <QAbstractNativeEventFilter> 76 #endif77 75 78 76 /* GUI includes: */ … … 100 98 #ifdef VBOX_WS_MAC 101 99 # include <Carbon/Carbon.h> 102 #endif /* VBOX_WS_MAC */100 #endif 103 101 #ifdef VBOX_WS_X11 104 # if QT_VERSION < 0x050000105 # include <X11/XKBlib.h>106 # ifdef KeyPress107 const int XFocusIn = FocusIn;108 const int XFocusOut = FocusOut;109 const int XKeyPress = KeyPress;110 const int XKeyRelease = KeyRelease;111 # undef KeyRelease112 # undef KeyPress113 # undef FocusOut114 # undef FocusIn115 # endif /* KeyPress */116 # else /* QT_VERSION >= 0x050000 */117 102 # include <xcb/xcb.h> 118 # endif /* QT_VERSION >= 0x050000 */ 119 #endif /* VBOX_WS_X11 */ 103 #endif 120 104 121 105 #ifdef DEBUG_andy … … 128 112 129 113 130 #if QT_VERSION >= 0x050000131 114 /** QAbstractNativeEventFilter extension 132 115 * allowing to pre-process native platform events. */ … … 151 134 UIMachineView *m_pParent; 152 135 }; 153 #endif154 136 155 137 … … 660 642 , m_fIsDraggingFromGuest(false) 661 643 #endif 662 #if QT_VERSION >= 0x050000663 644 , m_pNativeEventFilter(0) 664 #endif665 645 { 666 646 } … … 888 868 void UIMachineView::cleanupNativeFilters() 889 869 { 890 #if QT_VERSION >= 0x050000891 870 /* If native event filter exists: */ 892 871 if (m_pNativeEventFilter) … … 897 876 m_pNativeEventFilter = 0; 898 877 } 899 #endif900 878 } 901 879 … … 1525 1503 { 1526 1504 /* We have a snapshot for the paused state: */ 1527 #if QT_VERSION >= 0x0500001528 1505 QRect rect = pPaintEvent->rect().intersected(viewport()->rect()); 1529 #else /* QT_VERSION < 0x050000 */1530 QRect rect = pPaintEvent->rect().intersect(viewport()->rect());1531 #endif /* QT_VERSION < 0x050000 */1532 1506 QPainter painter(viewport()); 1533 1507 /* Take the scale-factor into account: */ … … 1553 1527 } 1554 1528 1555 #if QT_VERSION >= 0x0500001556 1529 void UIMachineView::focusInEvent(QFocusEvent *pEvent) 1557 1530 { … … 1582 1555 QAbstractScrollArea::focusOutEvent(pEvent); 1583 1556 } 1584 #endif1585 1557 1586 1558 #ifdef VBOX_WITH_DRAG_AND_DROP … … 1763 1735 } 1764 1736 #endif /* VBOX_WITH_DRAG_AND_DROP */ 1765 1766 #if QT_VERSION < 0x0500001767 # if defined(VBOX_WS_MAC)1768 1769 bool UIMachineView::macEvent(const void *pvCocoaEvent, EventRef event)1770 {1771 /* Make sure arguments valid: */1772 AssertPtrReturn(pvCocoaEvent, false);1773 AssertReturn(event != NULL, false);1774 1775 /* Check if some system event should be filtered out.1776 * Returning @c true means filtering-out,1777 * Returning @c false means passing event to Qt. */1778 bool fResult = false; /* Pass to Qt by default. */1779 switch (::GetEventClass(event))1780 {1781 /* Watch for keyboard-events: */1782 case kEventClassKeyboard:1783 {1784 switch (::GetEventKind(event))1785 {1786 /* Watch for key-events: */1787 case kEventRawKeyDown:1788 case kEventRawKeyRepeat:1789 case kEventRawKeyUp:1790 case kEventRawKeyModifiersChanged:1791 {1792 /* Filter using keyboard-filter? */1793 bool fKeyboardFilteringResult =1794 machineLogic()->keyboardHandler()->macEventFilter(pvCocoaEvent, event, screenId());1795 /* Keyboard filter rules the result? */1796 fResult = fKeyboardFilteringResult;1797 break;1798 }1799 default:1800 break;1801 }1802 break;1803 }1804 default:1805 break;1806 }1807 1808 /* Return result: */1809 return fResult;1810 }1811 1812 # elif defined(VBOX_WS_WIN)1813 1814 bool UIMachineView::winEvent(MSG *pMsg, long* /* piResult */)1815 {1816 /* Make sure arguments valid: */1817 AssertPtrReturn(pMsg, false);1818 1819 /* Check if some system event should be filtered out.1820 * Returning @c true means filtering-out,1821 * Returning @c false means passing event to Qt. */1822 bool fResult = false; /* Pass to Qt by default. */1823 switch (pMsg->message)1824 {1825 /* Watch for key-events: */1826 case WM_KEYDOWN:1827 case WM_KEYUP:1828 case WM_SYSKEYDOWN:1829 case WM_SYSKEYUP:1830 {1831 /* Can't do COM inter-process calls from a SendMessage handler,1832 * see http://support.microsoft.com/kb/131056. */1833 if (vboxGlobal().isSeparateProcess() && InSendMessage())1834 {1835 PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);1836 fResult = true;1837 break;1838 }1839 /* Filter using keyboard filter? */1840 bool fKeyboardFilteringResult =1841 machineLogic()->keyboardHandler()->winEventFilter(pMsg, screenId());1842 /* Keyboard filter rules the result? */1843 fResult = fKeyboardFilteringResult;1844 break;1845 }1846 default:1847 break;1848 }1849 1850 /* Return result: */1851 return fResult;1852 }1853 1854 # elif defined(VBOX_WS_X11)1855 1856 bool UIMachineView::x11Event(XEvent *pEvent)1857 {1858 /* Make sure arguments valid: */1859 AssertPtrReturn(pEvent, false);1860 1861 /* Check if some system event should be filtered out.1862 * Returning @c true means filtering-out,1863 * Returning @c false means passing event to Qt. */1864 bool fResult = false; /* Pass to Qt by default. */1865 switch (pEvent->type)1866 {1867 /* Watch for focus-events: */1868 case XFocusIn:1869 case XFocusOut:1870 /* Watch for key-events: */1871 case XKeyPress:1872 case XKeyRelease:1873 {1874 /* Filter using keyboard-filter? */1875 bool fKeyboardFilteringResult =1876 machineLogic()->keyboardHandler()->x11EventFilter(pEvent, screenId());1877 /* Filter using mouse-filter? */1878 bool fMouseFilteringResult =1879 machineLogic()->mouseHandler()->x11EventFilter(pEvent, screenId());1880 /* If at least one of filters wants to filter event out then the result is true. */1881 fResult = fKeyboardFilteringResult || fMouseFilteringResult;1882 break;1883 }1884 default:1885 break;1886 }1887 1888 /* Return result: */1889 return fResult;1890 }1891 1892 # endif /* VBOX_WS_X11 */1893 #else /* QT_VERSION >= 0x050000 */1894 1737 1895 1738 bool UIMachineView::nativeEventPreprocessor(const QByteArray &eventType, void *pMessage) … … 2024 1867 } 2025 1868 2026 #endif /* QT_VERSION >= 0x050000 */2027 2028 1869 QSize UIMachineView::scaledForward(QSize size) const 2029 1870 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r66588 r68315 36 36 #include "VBox/com/ptr.h" 37 37 #ifdef VBOX_WS_MAC 38 # if QT_VERSION >= 0x05000039 38 # include <ApplicationServices/ApplicationServices.h> 40 # endif /* QT_VERSION >= 0x050000 */41 39 #endif /* VBOX_WS_MAC */ 42 40 … … 52 50 class UIMachineWindow; 53 51 class UIFrameBuffer; 52 class UINativeEventFilter; 54 53 class CConsole; 55 54 class CDisplay; … … 57 56 class CMachine; 58 57 class CSession; 59 #ifdef VBOX_WS_X1160 # if QT_VERSION < 0x05000061 typedef union _XEvent XEvent;62 # endif /* QT_VERSION < 0x050000 */63 #endif /* VBOX_WS_X11 */64 58 #ifdef VBOX_WITH_DRAG_AND_DROP 65 class CDnDTarget; 66 #endif /* VBOX_WITH_DRAG_AND_DROP */ 67 #if QT_VERSION >= 0x050000 68 class UINativeEventFilter; 59 class CDnDTarget; 69 60 #endif 70 61 … … 271 262 void paintEvent(QPaintEvent *pEvent); 272 263 273 #if QT_VERSION >= 0x050000274 264 /** Handles focus-in @a pEvent. */ 275 265 void focusInEvent(QFocusEvent *pEvent); 276 266 /** Handles focus-out @a pEvent. */ 277 267 void focusOutEvent(QFocusEvent *pEvent); 278 #endif279 268 280 269 #ifdef VBOX_WITH_DRAG_AND_DROP … … 344 333 #endif /* VBOX_WITH_DRAG_AND_DROP */ 345 334 346 #if QT_VERSION < 0x050000347 # if defined(VBOX_WS_MAC)348 /** Qt4: Mac: Performs pre-processing of all the native events.349 * @note Take into account this function is _not_ called by350 * the Qt itself because it has another signature,351 * only by the keyboard-hook of the keyboard-handler. */352 virtual bool macEvent(const void *pvCocoaEvent, EventRef event);353 # elif defined(VBOX_WS_WIN)354 /** Qt4: Win: Performs pre-processing of all the native events.355 * @note Take into account this function is called by356 * the Qt as well opposing to other host (Mac)357 * because it has required signature. */358 virtual bool winEvent(MSG *pMsg, long *piResult);359 # elif defined(VBOX_WS_X11)360 /** Qt4: X11: Performs pre-processing of all the native events.361 * @note Take into account this function is called by362 * the Qt as well opposing to other host (Mac)363 * because it has required signature. */364 virtual bool x11Event(XEvent *pEvent);365 # endif /* VBOX_WS_X11 */366 #else /* QT_VERSION >= 0x050000 */367 335 /** Qt5: Performs pre-processing of all the native events. */ 368 336 virtual bool nativeEventPreprocessor(const QByteArray &eventType, void *pMessage); 369 #endif /* QT_VERSION >= 0x050000 */370 337 371 338 /** Scales passed size forward. */ … … 424 391 #endif 425 392 426 #if QT_VERSION >= 0x050000427 393 /** Holds the native event filter instance. */ 428 394 UINativeEventFilter *m_pNativeEventFilter; … … 430 396 * events directly to nativeEventPreprocessor(). */ 431 397 friend class UINativeEventFilter; 432 #endif433 398 434 399 /* Friend classes: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r66660 r68315 55 55 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 56 56 57 /* External includes: */58 #ifdef VBOX_WS_X1159 # if QT_VERSION < 0x05000060 # include <X11/Xlib.h>61 # endif /* QT_VERSION < 0x050000 */62 #endif /* VBOX_WS_X11 */63 64 57 65 58 /* static */ … … 252 245 updateAppearanceOf(UIVisualElement_WindowTitle); 253 246 } 254 255 #ifdef VBOX_WS_X11256 # if QT_VERSION < 0x050000257 bool UIMachineWindow::x11Event(XEvent *pEvent)258 {259 /// @todo Is that really needed?260 /* Qt bug: when the machine-view grabs the keyboard,261 * FocusIn, FocusOut, WindowActivate and WindowDeactivate Qt events are262 * not properly sent on top level window deactivation.263 * The fix is to substiute the mode in FocusOut X11 event structure264 * to NotifyNormal to cause Qt to process it as desired. */265 if (pEvent->type == FocusOut)266 {267 if (pEvent->xfocus.mode == NotifyWhileGrabbed &&268 (pEvent->xfocus.detail == NotifyAncestor ||269 pEvent->xfocus.detail == NotifyInferior ||270 pEvent->xfocus.detail == NotifyNonlinear))271 {272 pEvent->xfocus.mode = NotifyNormal;273 }274 }275 return false;276 }277 # endif /* QT_VERSION < 0x050000 */278 #endif /* VBOX_WS_X11 */279 247 280 248 void UIMachineWindow::showEvent(QShowEvent *pShowEvent) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
r63229 r68315 42 42 class UIMachineView; 43 43 class CSession; 44 #ifdef VBOX_WS_X1145 # if QT_VERSION < 0x05000046 typedef union _XEvent XEvent;47 # endif /* QT_VERSION < 0x050000 */48 #endif /* VBOX_WS_X11 */49 44 50 45 … … 129 124 /* Translate stuff: */ 130 125 void retranslateUi(); 131 132 /* Event handlers: */133 #ifdef VBOX_WS_X11134 # if QT_VERSION < 0x050000135 /** X11: Qt4: Handles all native events. */136 bool x11Event(XEvent *pEvent);137 # endif /* QT_VERSION < 0x050000 */138 #endif /* VBOX_WS_X11 */139 126 140 127 /** Show event handler. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r66278 r68315 23 23 # include <QMouseEvent> 24 24 # include <QTimer> 25 # if defined(VBOX_WS_X11) && QT_VERSION >= 0x05000025 # ifdef VBOX_WS_X11 26 26 # include <QX11Info> 27 27 # endif … … 59 59 60 60 /* GUI includes: */ 61 #if defined(VBOX_WS_MAC) && QT_VERSION >= 0x05000061 #ifdef VBOX_WS_MAC 62 62 # include "CocoaEventHelper.h" 63 63 #endif … … 68 68 /* External includes: */ 69 69 #ifdef VBOX_WS_X11 70 # if QT_VERSION < 0x050000 71 # include <X11/Xlib.h> 72 # ifdef FocusOut 73 const int XFocusOut = FocusOut; 74 # undef FocusOut 75 # endif /* FocusOut */ 76 # else 77 # include <xcb/xcb.h> 78 # endif 70 # include <xcb/xcb.h> 79 71 #endif 80 72 … … 273 265 (uisession()->isMouseIntegrated() ? 0 : UIMouseStateType_MouseAbsoluteDisabled); 274 266 } 275 276 #if QT_VERSION < 0x050000277 # ifdef VBOX_WS_X11278 279 bool UIMouseHandler::x11EventFilter(XEvent *pEvent, ulong /* uScreenId */)280 {281 /* Check if some system event should be filtered-out.282 * Returning 'true' means filtering-out,283 * Returning 'false' means passing event to Qt. */284 bool fResult = false; /* Pass to Qt by default: */285 switch (pEvent->type)286 {287 /* We have to handle XFocusOut right here as this event is not passed to UIMachineView::event().288 * Handling this event is important for releasing the keyboard before the screen saver gets active.289 * See public ticket #3894: Apparently this makes problems with newer versions of Qt290 * and this hack is probably not necessary anymore. So disable it for Qt >= 4.5.0. */291 case XFocusOut:292 {293 if (uisession()->isRunning())294 {295 if (VBoxGlobal::qtRTVersion() < ((4 << 16) | (5 << 8) | 0))296 releaseMouse();297 }298 fResult = false;299 }300 default:301 break;302 }303 /* Return result: */304 return fResult;305 }306 307 # endif /* VBOX_WS_X11 */308 #else /* QT_VERSION >= 0x050000 */309 267 310 268 bool UIMouseHandler::nativeEventFilter(void *pMessage, ulong uScreenId) … … 413 371 return fResult; 414 372 } 415 416 #endif /* QT_VERSION >= 0x050000 */417 373 418 374 /* Machine state-change handler: */ … … 774 730 { 775 731 QMouseEvent *pMouseEvent = static_cast<QMouseEvent*>(pEvent); 776 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000732 #ifdef VBOX_WS_X11 777 733 /* When the keyboard is captured, we also capture mouse button 778 734 * events, and release the keyboard and re-capture it delayed … … 783 739 if (pEvent->type() == QEvent::MouseButtonPress) 784 740 machineLogic()->keyboardHandler()->finaliseCaptureKeyboard(); 785 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/741 #endif /* VBOX_WS_X11 */ 786 742 m_iLastMouseWheelDelta = 0; 787 743 if (mouseEvent(pMouseEvent->type(), uScreenId, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h
r63579 r68315 38 38 class CDisplay; 39 39 class CMouse; 40 #ifdef VBOX_WS_X1141 # if QT_VERSION < 0x05000042 typedef union _XEvent XEvent;43 # endif /* QT_VERSION < 0x050000 */44 #endif /* VBOX_WS_X11 */45 40 46 41 … … 75 70 int state() const; 76 71 77 #if QT_VERSION < 0x05000078 # ifdef VBOX_WS_X1179 /** Qt4: X11: Performs pre-processing of all the native events. */80 bool x11EventFilter(XEvent *pEvent, ulong uScreenId);81 # endif82 #else83 72 /** Qt5: Performs pre-processing of all the native events. */ 84 73 bool nativeEventFilter(void *pMessage, ulong uScreenId); 85 #endif86 74 87 75 protected slots: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r67611 r68315 75 75 /* Qt includes: */ 76 76 #ifdef VBOX_WS_WIN 77 # if QT_VERSION >= 0x050000 78 # include <QtWin> 79 # endif /* QT_VERSION >= 0x050000 */ 77 # include <QtWin> 80 78 #endif /* VBOX_WS_WIN */ 81 79 … … 1541 1539 } 1542 1540 1543 #if defined(VBOX_WS_WIN) && QT_VERSION >= 0x0500001541 #ifdef VBOX_WS_WIN 1544 1542 static bool isPointer1bpp(const uint8_t *pu8XorMask, 1545 1543 uint uWidth, … … 1565 1563 return true; 1566 1564 } 1567 #endif 1565 #endif /* VBOX_WS_WIN */ 1568 1566 1569 1567 void UISession::setPointerShape(const uchar *pShapeData, bool fHasAlpha, … … 1580 1578 #if defined (VBOX_WS_WIN) 1581 1579 1582 # if QT_VERSION < 0x0500001583 BITMAPV5HEADER bi;1584 HBITMAP hBitmap;1585 void *lpBits;1586 1587 ::ZeroMemory(&bi, sizeof (BITMAPV5HEADER));1588 bi.bV5Size = sizeof(BITMAPV5HEADER);1589 bi.bV5Width = uWidth;1590 bi.bV5Height = - (LONG)uHeight;1591 bi.bV5Planes = 1;1592 bi.bV5BitCount = 32;1593 bi.bV5Compression = BI_BITFIELDS;1594 bi.bV5RedMask = 0x00FF0000;1595 bi.bV5GreenMask = 0x0000FF00;1596 bi.bV5BlueMask = 0x000000FF;1597 if (fHasAlpha)1598 bi.bV5AlphaMask = 0xFF000000;1599 else1600 bi.bV5AlphaMask = 0;1601 1602 HDC hdc = GetDC(NULL);1603 1604 /* Create the DIB section with an alpha channel: */1605 hBitmap = CreateDIBSection(hdc, (BITMAPINFO *)&bi, DIB_RGB_COLORS, (void **)&lpBits, NULL, (DWORD) 0);1606 1607 ReleaseDC(NULL, hdc);1608 1609 HBITMAP hMonoBitmap = NULL;1610 if (fHasAlpha)1611 {1612 /* Create an empty mask bitmap: */1613 hMonoBitmap = CreateBitmap(uWidth, uHeight, 1, 1, NULL);1614 }1615 else1616 {1617 /* Word aligned AND mask. Will be allocated and created if necessary. */1618 uint8_t *pu8AndMaskWordAligned = NULL;1619 1620 /* Width in bytes of the original AND mask scan line. */1621 uint32_t cbAndMaskScan = (uWidth + 7) / 8;1622 1623 if (cbAndMaskScan & 1)1624 {1625 /* Original AND mask is not word aligned. */1626 1627 /* Allocate memory for aligned AND mask. */1628 pu8AndMaskWordAligned = (uint8_t *)RTMemTmpAllocZ((cbAndMaskScan + 1) * uHeight);1629 1630 Assert(pu8AndMaskWordAligned);1631 1632 if (pu8AndMaskWordAligned)1633 {1634 /* According to MSDN the padding bits must be 0.1635 * Compute the bit mask to set padding bits to 0 in the last byte of original AND mask. */1636 uint32_t u32PaddingBits = cbAndMaskScan * 8 - uWidth;1637 Assert(u32PaddingBits < 8);1638 uint8_t u8LastBytesPaddingMask = (uint8_t)(0xFF << u32PaddingBits);1639 1640 Log(("u8LastBytesPaddingMask = %02X, aligned w = %d, width = %d, cbAndMaskScan = %d\n",1641 u8LastBytesPaddingMask, (cbAndMaskScan + 1) * 8, uWidth, cbAndMaskScan));1642 1643 uint8_t *src = (uint8_t *)srcAndMaskPtr;1644 uint8_t *dst = pu8AndMaskWordAligned;1645 1646 unsigned i;1647 for (i = 0; i < uHeight; i++)1648 {1649 memcpy(dst, src, cbAndMaskScan);1650 1651 dst[cbAndMaskScan - 1] &= u8LastBytesPaddingMask;1652 1653 src += cbAndMaskScan;1654 dst += cbAndMaskScan + 1;1655 }1656 }1657 }1658 1659 /* Create the AND mask bitmap: */1660 hMonoBitmap = ::CreateBitmap(uWidth, uHeight, 1, 1,1661 pu8AndMaskWordAligned? pu8AndMaskWordAligned: srcAndMaskPtr);1662 1663 if (pu8AndMaskWordAligned)1664 {1665 RTMemTmpFree(pu8AndMaskWordAligned);1666 }1667 }1668 1669 Assert(hBitmap);1670 Assert(hMonoBitmap);1671 if (hBitmap && hMonoBitmap)1672 {1673 DWORD *dstShapePtr = (DWORD *) lpBits;1674 1675 for (uint y = 0; y < uHeight; y ++)1676 {1677 memcpy(dstShapePtr, srcShapePtr, srcShapePtrScan);1678 srcShapePtr += srcShapePtrScan;1679 dstShapePtr += uWidth;1680 }1681 1682 ICONINFO ii;1683 ii.fIcon = FALSE;1684 ii.xHotspot = uXHot;1685 ii.yHotspot = uYHot;1686 ii.hbmMask = hMonoBitmap;1687 ii.hbmColor = hBitmap;1688 1689 HCURSOR hAlphaCursor = CreateIconIndirect(&ii);1690 Assert(hAlphaCursor);1691 if (hAlphaCursor)1692 {1693 /* Set the new cursor: */1694 m_cursor = QCursor(hAlphaCursor);1695 if (m_alphaCursor)1696 DestroyIcon(m_alphaCursor);1697 m_alphaCursor = hAlphaCursor;1698 m_fIsValidPointerShapePresent = true;1699 }1700 }1701 1702 if (hMonoBitmap)1703 DeleteObject(hMonoBitmap);1704 if (hBitmap)1705 DeleteObject(hBitmap);1706 # else /* QT_VERSION >= 0x050000 */1707 1580 /* Create a ARGB image out of the shape data: */ 1708 1581 … … 1849 1722 m_fIsValidPointerShapePresent = true; 1850 1723 NOREF(srcShapePtrScan); 1851 # endif /* QT_VERSION >= 0x050000 */1852 1724 1853 1725 #elif defined(VBOX_WS_X11) || defined(VBOX_WS_MAC) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationModel.cpp
r65337 r68315 87 87 roleNames[Qt::UserRole + 1] = ""; 88 88 roleNames[Qt::UserRole + 2] = ""; 89 # if QT_VERSION < 0x05000090 setRoleNames(roleNames);91 # endif /* QT_VERSION < 0x050000 */92 89 93 90 /* Register meta-type: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
r63567 r68315 254 254 void UIMachineLogicNormal::sltHostScreenAvailableAreaChange() 255 255 { 256 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000256 #ifdef VBOX_WS_X11 257 257 /* Prevent handling if fake screen detected: */ 258 258 if (gpDesktop->isFakeScreenDetected()) … … 262 262 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 263 263 pMachineWindow->restoreCachedGeometry(); 264 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/264 #endif /* VBOX_WS_X11 */ 265 265 266 266 /* Call to base-class: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r67942 r68315 468 468 case QEvent::Resize: 469 469 { 470 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000470 #ifdef VBOX_WS_X11 471 471 /* Prevent handling if fake screen detected: */ 472 472 if (gpDesktop->isFakeScreenDetected()) 473 473 break; 474 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/474 #endif /* VBOX_WS_X11 */ 475 475 476 476 QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent); … … 488 488 case QEvent::Move: 489 489 { 490 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000490 #ifdef VBOX_WS_X11 491 491 /* Prevent handling if fake screen detected: */ 492 492 if (gpDesktop->isFakeScreenDetected()) 493 493 break; 494 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/494 #endif /* VBOX_WS_X11 */ 495 495 496 496 if (!isMaximizedChecked()) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp
r63567 r68315 78 78 void UIMachineLogicScale::sltHostScreenAvailableAreaChange() 79 79 { 80 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x05000080 #ifdef VBOX_WS_X11 81 81 /* Prevent handling if fake screen detected: */ 82 82 if (gpDesktop->isFakeScreenDetected()) … … 86 86 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 87 87 pMachineWindow->restoreCachedGeometry(); 88 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/88 #endif /* VBOX_WS_X11 */ 89 89 90 90 /* Call to base-class: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
r64334 r68315 217 217 case QEvent::Resize: 218 218 { 219 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000219 #ifdef VBOX_WS_X11 220 220 /* Prevent handling if fake screen detected: */ 221 221 if (gpDesktop->isFakeScreenDetected()) 222 222 break; 223 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/223 #endif /* VBOX_WS_X11 */ 224 224 225 225 QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent); … … 236 236 case QEvent::Move: 237 237 { 238 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000238 #ifdef VBOX_WS_X11 239 239 /* Prevent handling if fake screen detected: */ 240 240 if (gpDesktop->isFakeScreenDetected()) 241 241 break; 242 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/242 #endif /* VBOX_WS_X11 */ 243 243 244 244 if (!isMaximizedChecked()) … … 258 258 } 259 259 260 #ifdef VBOX_WS_WIN261 # if QT_VERSION < 0x050000262 bool UIMachineWindowScale::winEvent(MSG *pMessage, long *pResult)263 {264 /* Try to keep aspect ratio during window resize if:265 * 1. machine view exists and 2. event-type is WM_SIZING and 3. shift key is NOT pressed: */266 if (machineView() && pMessage->message == WM_SIZING && !(QApplication::keyboardModifiers() & Qt::ShiftModifier))267 {268 double dAspectRatio = machineView()->aspectRatio();269 if (dAspectRatio)270 {271 RECT *pRect = reinterpret_cast<RECT*>(pMessage->lParam);272 switch (pMessage->wParam)273 {274 case WMSZ_LEFT:275 case WMSZ_RIGHT:276 {277 pRect->bottom = pRect->top + (double)(pRect->right - pRect->left) / dAspectRatio;278 break;279 }280 case WMSZ_TOP:281 case WMSZ_BOTTOM:282 {283 pRect->right = pRect->left + (double)(pRect->bottom - pRect->top) * dAspectRatio;284 break;285 }286 case WMSZ_BOTTOMLEFT:287 case WMSZ_BOTTOMRIGHT:288 {289 pRect->bottom = pRect->top + (double)(pRect->right - pRect->left) / dAspectRatio;290 break;291 }292 case WMSZ_TOPLEFT:293 case WMSZ_TOPRIGHT:294 {295 pRect->top = pRect->bottom - (double)(pRect->right - pRect->left) / dAspectRatio;296 break;297 }298 default:299 break;300 }301 }302 }303 /* Call to base-class: */304 return UIMachineWindow::winEvent(pMessage, pResult);305 }306 # endif /* QT_VERSION < 0x050000 */307 #endif /* VBOX_WS_WIN */308 309 260 bool UIMachineWindowScale::isMaximizedChecked() 310 261 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h
r63230 r68315 63 63 /** Common @a pEvent handler. */ 64 64 bool event(QEvent *pEvent); 65 #ifdef VBOX_WS_WIN66 # if QT_VERSION < 0x05000067 /** Qt4: Win: Handles all native messages. */68 bool winEvent(MSG *pMessage, long *pResult);69 # endif /* QT_VERSION < 0x050000 */70 #endif /* VBOX_WS_WIN */71 65 72 66 /** Returns whether this window is maximized. */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r68304 r68315 167 167 } 168 168 169 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000169 #ifdef VBOX_WS_X11 170 170 void UISelectorWindow::sltHandleHostScreenAvailableAreaChange() 171 171 { … … 178 178 move(m_geometry.topLeft()); 179 179 } 180 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/180 #endif /* VBOX_WS_X11 */ 181 181 182 182 void UISelectorWindow::sltShowSelectorWindowContextMenu(const QPoint &position) … … 1053 1053 const CMachine &machine = pItem->machine(); 1054 1054 UIDesktopServices::createMachineShortcut(machine.GetSettingsFilePath(), 1055 #if QT_VERSION >= 0x0500001056 1055 QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), 1057 #else /* QT_VERSION < 0x050000 */1058 QDesktopServices::storageLocation(QDesktopServices::DesktopLocation),1059 #endif /* QT_VERSION < 0x050000 */1060 1056 machine.GetName(), machine.GetId()); 1061 1057 } … … 1180 1176 sltHandleChooserPaneIndexChange(false /* update details? */, false /* update snapshots? */); 1181 1177 1182 #if defined(VBOX_WS_MAC) && QT_VERSION < 0x050000 1183 /* Avoid bug in Qt Cocoa which results in showing a "more arrow" on size-hint changes: */ 1178 #ifdef VBOX_WS_MAC 1179 // WORKAROUND: 1180 // There is a bug in Qt Cocoa which result in showing a "more arrow" when 1181 // the necessary size of the toolbar is increased. Also for some languages 1182 // the with doesn't match if the text increase. So manually adjust the size 1183 // after changing the text. 1184 1184 m_pToolBar->updateLayout(); 1185 1185 #endif … … 1194 1194 case QEvent::Resize: 1195 1195 { 1196 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x0500001196 #ifdef VBOX_WS_X11 1197 1197 /* Prevent handling if fake screen detected: */ 1198 1198 if (gpDesktop->isFakeScreenDetected()) 1199 1199 break; 1200 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/1200 #endif /* VBOX_WS_X11 */ 1201 1201 1202 1202 if (isVisible() && (windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0) … … 1209 1209 case QEvent::Move: 1210 1210 { 1211 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x0500001211 #ifdef VBOX_WS_X11 1212 1212 /* Prevent handling if fake screen detected: */ 1213 1213 if (gpDesktop->isFakeScreenDetected()) 1214 1214 break; 1215 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/1215 #endif /* VBOX_WS_X11 */ 1216 1216 1217 1217 if (isVisible() && (windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0) … … 1969 1969 void UISelectorWindow::prepareConnections() 1970 1970 { 1971 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x0500001971 #ifdef VBOX_WS_X11 1972 1972 /* Desktop event handlers: */ 1973 1973 connect(gpDesktop, SIGNAL(sigHostScreenWorkAreaResized(int)), this, SLOT(sltHandleHostScreenAvailableAreaChange())); 1974 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000*/1974 #endif /* VBOX_WS_X11 */ 1975 1975 1976 1976 /* Medium enumeration connections: */ … … 2377 2377 actionPool()->action(UIActionIndexST_M_Machine_T_Pause)->blockSignals(false); 2378 2378 2379 #if defined(VBOX_WS_MAC) && QT_VERSION < 0x050000 2380 /* Avoid bug in Qt Cocoa which results in showing a "more arrow" on size-hint changes: */ 2379 #ifdef VBOX_WS_MAC 2380 // WORKAROUND: 2381 // There is a bug in Qt Cocoa which result in showing a "more arrow" when 2382 // the necessary size of the toolbar is increased. Also for some languages 2383 // the with doesn't match if the text increase. So manually adjust the size 2384 // after changing the text. 2381 2385 m_pToolBar->updateLayout(); 2382 2386 #endif -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r68304 r68315 79 79 void sltHandlePolishEvent(); 80 80 81 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 81 #if QT_VERSION == 0 82 /** Stupid moc does not warn if it cannot find headers! */ 83 void QT_VERSION_NOT_DEFINED 84 #elif defined(VBOX_WS_X11) 82 85 /** Handles host-screen available-area change. */ 83 86 void sltHandleHostScreenAvailableAreaChange(); 84 #elif QT_VERSION == 0 85 /** Stupid moc does not warn if it cannot find headers! */ 86 void QT_VERSION_NOT_DEFINED 87 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 87 #endif /* VBOX_WS_X11 */ 88 88 89 89 /** Handles selector-window context-menu call for passed @a position. */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp
r68264 r68315 51 51 52 52 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 53 54 /* Qt includes: */55 #if QT_VERSION < 0x05000056 # include <QWindowsStyle>57 #endif /* QT_VERSION < 0x050000 */58 53 59 54 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp
r63763 r68315 401 401 m_fHovered = true; 402 402 emit sigHoverEnter(); 403 #if QT_VERSION >= 0x050000404 403 update(); 405 #endif /* QT_VERSION >= 0x050000 */406 404 } 407 405 } … … 413 411 m_fHovered = false; 414 412 emit sigHoverLeave(); 415 #if QT_VERSION >= 0x050000416 413 update(); 417 #endif /* QT_VERSION >= 0x050000 */418 414 } 419 415 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp
r65632 r68315 395 395 396 396 #ifdef VBOX_WS_MAC 397 # if QT_VERSION >= 0x050000398 397 /* Set composition-mode to opaque: */ 399 398 pPainter->setCompositionMode(QPainter::CompositionMode_Source); … … 402 401 /* Return default composition-mode back: */ 403 402 pPainter->setCompositionMode(QPainter::CompositionMode_SourceAtop); 404 # endif /* QT_VERSION >= 0x050000 */405 403 #endif /* VBOX_WS_MAC */ 406 404 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r65600 r68315 190 190 int index = m_pages[cId]; 191 191 #ifdef VBOX_WS_MAC 192 # if QT_VERSION < 0x050000193 QSize cs = size();194 if (index < m_sizeList.count())195 {196 QSize ss = m_sizeList.at(index);197 /* Switch to the new page first if we are shrinking: */198 if (cs.height() > ss.height())199 m_pStack->setCurrentIndex(index);200 /* Do the animation: */201 ::darwinWindowAnimateResize(this, QRect (x(), y(), ss.width(), ss.height()));202 /* Switch to the new page last if we are zooming: */203 if (cs.height() <= ss.height())204 m_pStack->setCurrentIndex(index);205 }206 ::darwinSetShowsResizeIndicator(this, false);207 # else /* QT_VERSION >= 0x050000 */208 192 /* If index is within the stored size list bounds: */ 209 193 if (index < m_sizeList.count()) … … 234 218 } 235 219 } 236 # endif /* QT_VERSION >= 0x050000 */237 220 #else 238 221 m_pStack->setCurrentIndex(index); … … 632 615 ::darwinSetHidesAllTitleButtons(this); 633 616 634 # if QT_VERSION < 0x050000635 /* Set all size policies to ignored: */636 for (int i = 0; i < m_pStack->count(); ++i)637 m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);638 /* Activate every single page to get the optimal size: */639 for (int i = m_pStack->count() - 1; i >= 0; --i)640 {641 m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);642 /* Prevent this widgets to go in the Small/Mini size state which is643 * available on Mac OS X. Not sure why this happens but this seems to help644 * against. */645 QList <QWidget*> list = m_pStack->widget(i)->findChildren<QWidget*>();646 for (int a = 0; a < list.size(); ++a)647 {648 QWidget *w = list.at(a);649 if (w->parent() == m_pStack->widget(i))650 w->setFixedHeight(w->sizeHint().height());651 }652 m_pStack->setCurrentIndex(i);653 /* Now make sure the layout is freshly calculated. */654 layout()->activate();655 QSize s = minimumSize();656 if (iMinWidth > s.width())657 s.setWidth(iMinWidth);658 m_sizeList.insert(0, s);659 m_pStack->widget(i)->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);660 }661 # else /* QT_VERSION >= 0x050000 */662 617 /* Unlock all page policies initially: */ 663 618 for (int i = 0; i < m_pStack->count(); ++i) … … 695 650 m_pStack->widget(i)->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored); 696 651 } 697 # endif /* QT_VERSION >= 0x050000 */698 652 699 653 sltCategoryChanged(m_pSelector->currentId()); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r66626 r68315 822 822 verticalHeader()->setDefaultSectionSize((int)(verticalHeader()->minimumSectionSize() * 1.33)); 823 823 horizontalHeader()->setStretchLastSection(false); 824 #if QT_VERSION >= 0x050000825 824 horizontalHeader()->setSectionResizeMode(UIHotKeyColumnIndex_Description, QHeaderView::Interactive); 826 825 horizontalHeader()->setSectionResizeMode(UIHotKeyColumnIndex_Sequence, QHeaderView::Stretch); 827 #else /* QT_VERSION < 0x050000 */828 horizontalHeader()->setResizeMode(UIHotKeyColumnIndex_Description, QHeaderView::Interactive);829 horizontalHeader()->setResizeMode(UIHotKeyColumnIndex_Sequence, QHeaderView::Stretch);830 #endif /* QT_VERSION < 0x050000 */831 826 832 827 /* Connect model: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
r66658 r68315 1345 1345 m_pTreeViewSettings->header()->setStretchLastSection(true); 1346 1346 m_pTreeViewSettings->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding); 1347 #if QT_VERSION < 0x0500001348 m_pTreeViewSettings->header()->setResizeMode(QHeaderView::ResizeToContents);1349 #else1350 1347 m_pTreeViewSettings->header()->setSectionResizeMode(QHeaderView::ResizeToContents); 1351 #endif1352 1348 1353 1349 /* Add tree-view into information layout: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp
r63322 r68315 71 71 int h = 2 * frameWidth(); 72 72 int w = h; 73 #if QT_VERSION < 0x04070074 w += 4; // WTF?75 #endif /* QT_VERSION < 0x040700 */76 73 setFixedSize(sizeHintForColumn(0) + w, 77 74 sizeHintForRow(0) * count() + h); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp
r66589 r68315 45 45 /* Qt includes: */ 46 46 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 47 # if QT_VERSION >= 0x050000 48 # include <QAbstractNativeEventFilter> 49 # endif /* QT_VERSION >= 0x050000 */ 47 # include <QAbstractNativeEventFilter> 50 48 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */ 51 49 … … 71 69 # include <X11/Xutil.h> 72 70 # include <X11/keysym.h> 73 # if QT_VERSION >= 0x050000 74 # include <xcb/xcb.h> 75 # else /* QT_VERSION < 0x050000 */ 76 # ifdef KeyPress 77 const int XKeyPress = KeyPress; 78 const int XKeyRelease = KeyRelease; 79 # undef KeyPress 80 # undef KeyRelease 81 # endif /* KeyPress */ 82 # endif /* QT_VERSION < 0x050000 */ 71 # include <xcb/xcb.h> 83 72 #endif /* VBOX_WS_X11 */ 84 73 … … 88 77 89 78 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 90 # if QT_VERSION >= 0x05000091 79 /** QAbstractNativeEventFilter extension 92 80 * allowing to handle native platform events. … … 119 107 UIHostComboEditorPrivate *m_pParent; 120 108 }; 121 # endif /* QT_VERSION >= 0x050000 */122 109 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */ 123 110 … … 546 533 , m_fStartNewSequence(true) 547 534 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 548 # if QT_VERSION >= 0x050000549 535 , m_pPrivateEventFilter(0) 550 # endif /* QT_VERSION >= 0x050000 */551 536 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */ 552 537 #ifdef VBOX_WS_WIN … … 566 551 567 552 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 568 # if QT_VERSION >= 0x050000569 553 /* Prepare private event filter: */ 570 554 m_pPrivateEventFilter = new ComboEditorEventFilter(this); 571 555 qApp->installNativeEventFilter(m_pPrivateEventFilter); 572 # endif /* QT_VERSION >= 0x050000 */573 556 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */ 574 557 575 558 #if defined(VBOX_WS_MAC) 576 559 m_uDarwinKeyModifiers = 0; 577 # if QT_VERSION < 0x050000578 UICocoaApplication::instance()->registerForNativeEvents(RT_BIT_32(10) | RT_BIT_32(11) | RT_BIT_32(12) /* NSKeyDown | NSKeyUp | | NSFlagsChanged */, UIHostComboEditorPrivate::darwinEventHandlerProc, this);579 ::DarwinGrabKeyboard(false /* just modifiers */);580 # endif /* QT_VERSION < 0x050000 */581 560 #elif defined(VBOX_WS_WIN) 582 561 /* Prepare AltGR monitor: */ … … 590 569 UIHostComboEditorPrivate::~UIHostComboEditorPrivate() 591 570 { 592 #if defined(VBOX_WS_MAC) 593 # if QT_VERSION < 0x050000 594 ::DarwinReleaseKeyboard(); 595 UICocoaApplication::instance()->unregisterForNativeEvents(RT_BIT_32(10) | RT_BIT_32(11) | RT_BIT_32(12) /* NSKeyDown | NSKeyUp | | NSFlagsChanged */, UIHostComboEditorPrivate::darwinEventHandlerProc, this); 596 # endif /* QT_VERSION < 0x050000 */ 597 #elif defined(VBOX_WS_WIN) 571 #if defined(VBOX_WS_WIN) 598 572 /* Cleanup AltGR monitor: */ 599 573 delete m_pAltGrMonitor; … … 602 576 603 577 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 604 # if QT_VERSION >= 0x050000605 578 /* Cleanup private event filter: */ 606 579 qApp->removeNativeEventFilter(m_pPrivateEventFilter); 607 580 delete m_pPrivateEventFilter; 608 581 m_pPrivateEventFilter = 0; 609 # endif /* QT_VERSION >= 0x050000 */610 582 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */ 611 583 } … … 651 623 emit sigDataChanged(); 652 624 } 653 654 #if QT_VERSION >= 0x050000655 625 656 626 bool UIHostComboEditorPrivate::nativeEvent(const QByteArray &eventType, void *pMessage, long *pResult) … … 800 770 } 801 771 802 #else /* QT_VERSION < 0x050000 */803 804 # if defined(VBOX_WS_MAC)805 806 /* static */807 bool UIHostComboEditorPrivate::darwinEventHandlerProc(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser)808 {809 UIHostComboEditorPrivate *pEditor = static_cast<UIHostComboEditorPrivate*>(pvUser);810 EventRef inEvent = (EventRef)pvCarbonEvent;811 UInt32 EventClass = ::GetEventClass(inEvent);812 if (EventClass == kEventClassKeyboard)813 return pEditor->darwinKeyboardEvent(pvCocoaEvent, inEvent);814 return false;815 }816 817 bool UIHostComboEditorPrivate::darwinKeyboardEvent(const void *pvCocoaEvent, EventRef inEvent)818 {819 /* Ignore key changes unless we're the focus widget: */820 if (!hasFocus())821 return false;822 823 UInt32 eventKind = ::GetEventKind(inEvent);824 switch (eventKind)825 {826 //case kEventRawKeyDown:827 //case kEventRawKeyUp:828 //case kEventRawKeyRepeat:829 case kEventRawKeyModifiersChanged:830 {831 /* Get modifier mask: */832 UInt32 modifierMask = 0;833 ::GetEventParameter(inEvent, kEventParamKeyModifiers, typeUInt32, NULL,834 sizeof(modifierMask), NULL, &modifierMask);835 modifierMask = ::DarwinAdjustModifierMask(modifierMask, pvCocoaEvent);836 UInt32 changed = m_uDarwinKeyModifiers ^ modifierMask;837 838 if (!changed)839 break;840 841 /* Convert to keycode: */842 unsigned uKeyCode = ::DarwinModifierMaskToDarwinKeycode(changed);843 844 if (!uKeyCode || uKeyCode == ~0U)845 return false;846 847 /* Process the key event: */848 if (processKeyEvent(uKeyCode, changed & modifierMask))849 {850 /* Save the new modifier mask state. */851 m_uDarwinKeyModifiers = modifierMask;852 return true;853 }854 break;855 }856 default:857 break;858 }859 return false;860 }861 862 # elif defined(VBOX_WS_WIN)863 864 bool UIHostComboEditorPrivate::winEvent(MSG *pMsg, long* /* pResult */)865 {866 switch (pMsg->message)867 {868 case WM_KEYDOWN:869 case WM_SYSKEYDOWN:870 case WM_KEYUP:871 case WM_SYSKEYUP:872 {873 /* Get key-code: */874 int iKeyCode = UINativeHotKey::distinguishModifierVKey((int)pMsg->wParam, (int)pMsg->lParam);875 unsigned iDownScanCode = (pMsg->lParam >> 16) & 0x7F;876 bool fPressed = !(pMsg->lParam & 0x80000000);877 bool fExtended = pMsg->lParam & 0x1000000;878 879 /* If present - why not just assert this? */880 if (m_pAltGrMonitor)881 {882 /* Update AltGR monitor state from key-event: */883 m_pAltGrMonitor->updateStateFromKeyEvent(iDownScanCode, fPressed, fExtended);884 /* And release left Ctrl key early (if required): */885 if (m_pAltGrMonitor->isLeftControlReleaseNeeded())886 {887 m_pressedKeys.remove(VK_LCONTROL);888 m_shownKeys.remove(VK_LCONTROL);889 }890 /* Fake LCtrl release events can also end up in the released891 * key set. Detect them on the immediately following RAlt up. */892 if (!m_pressedKeys.contains(VK_LCONTROL))893 m_releasedKeys.remove(VK_LCONTROL);894 }895 896 /* Process the key event: */897 return processKeyEvent(iKeyCode, pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN);898 }899 default:900 break;901 }902 903 return false;904 }905 906 # elif defined(VBOX_WS_X11)907 908 bool UIHostComboEditorPrivate::x11Event(XEvent *pEvent)909 {910 switch (pEvent->type)911 {912 case XKeyPress:913 case XKeyRelease:914 {915 /* Get key-code: */916 XKeyEvent *pKeyEvent = (XKeyEvent*)pEvent;917 RT_GCC_NO_WARN_DEPRECATED_BEGIN918 KeySym ks = ::XKeycodeToKeysym(pKeyEvent->display, pKeyEvent->keycode, 0);919 RT_GCC_NO_WARN_DEPRECATED_END920 921 int iKeySym = (int)ks;922 923 /* Process the key event: */924 return processKeyEvent(iKeySym, pEvent->type == XKeyPress);925 }926 default:927 break;928 }929 930 return false;931 }932 933 # endif /* VBOX_WS_X11 */934 935 #endif /* QT_VERSION < 0x050000 */936 937 772 void UIHostComboEditorPrivate::keyPressEvent(QKeyEvent *pEvent) 938 773 { -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.h
r62493 r68315 32 32 class UIHostComboEditorPrivate; 33 33 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 34 # if QT_VERSION >= 0x05000035 34 class ComboEditorEventFilter; 36 # endif /* QT_VERSION >= 0x050000 */37 35 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */ 38 36 #ifdef VBOX_WS_WIN … … 155 153 protected: 156 154 157 #if QT_VERSION >= 0x050000158 155 /** Qt5: Handles all native events. */ 159 156 bool nativeEvent(const QByteArray &eventType, void *pMessage, long *pResult); 160 #else /* QT_VERSION < 0x050000 */161 # if defined(VBOX_WS_MAC)162 /** Mac: Qt4: Handles all native events (static callback). */163 static bool darwinEventHandlerProc(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser);164 /** Mac: Qt4: Handles all native events. */165 bool darwinKeyboardEvent(const void *pvCocoaEvent, EventRef inEvent);166 # elif defined(VBOX_WS_WIN)167 /** Win: Qt4: Handles all native events. */168 bool winEvent(MSG *pMsg, long *pResult);169 # elif defined(VBOX_WS_X11)170 /** X11: Qt4: Handles all native events. */171 bool x11Event(XEvent *pEvent);172 # endif /* VBOX_WS_X11 */173 #endif /* QT_VERSION < 0x050000 */174 157 175 158 void keyPressEvent(QKeyEvent *pEvent); … … 195 178 196 179 #if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN) 197 # if QT_VERSION >= 0x050000198 180 /** Mac, Win: Holds the native event filter instance. */ 199 181 ComboEditorEventFilter *m_pPrivateEventFilter; … … 201 183 * redirect events directly to nativeEvent handler. */ 202 184 friend class ComboEditorEventFilter; 203 # endif /* QT_VERSION >= 0x050000 */204 185 #endif /* VBOX_WS_MAC || VBOX_WS_WIN */ 205 186 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp
r62493 r68315 31 31 32 32 #endif /* VBOX_WS_MAC */ 33 34 /* Qt includes: */35 #if QT_VERSION < 0x05000036 # include <QWindowsStyle>37 # include <QCleanlooksStyle>38 #endif /* QT_VERSION < 0x050000 */39 33 40 34 … … 93 87 setMovable(false); 94 88 95 #if QT_VERSION < 0x050000 96 /* Remove that ugly frame panel around the toolbar. 97 * Doing that currently for Cleanlooks & Windows styles. */ 98 if (qobject_cast <QWindowsStyle*>(QToolBar::style()) || 99 qobject_cast <QCleanlooksStyle*>(QToolBar::style())) 89 #ifdef VBOX_WS_MAC 100 90 setStyleSheet("QToolBar { border: 0px none black; }"); 101 #else /* QT_VERSION >= 0x050000 */ 102 # ifdef VBOX_WS_MAC 103 setStyleSheet("QToolBar { border: 0px none black; }"); 104 # endif /* VBOX_WS_MAC */ 105 #endif /* QT_VERSION >= 0x050000 */ 91 #endif /* VBOX_WS_MAC */ 106 92 107 93 /* Configure tool-bar' layout: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp
r62493 r68315 80 80 { 81 81 setFinalPage(pButton != m_pFullCloneRadio); 82 #if QT_VERSION < 0x04070083 /* On older Qt versions the content of the current page isn't updated when84 * using setFinalPage. So switch back and for to simulate it. */85 wizard()->back();86 wizard()->next();87 #endif /* QT_VERSION < 0x040700 */88 82 } 89 83
Note:
See TracChangeset
for help on using the changeset viewer.