VirtualBox

Changeset 10519 in vbox for trunk/src


Ignore:
Timestamp:
Jul 11, 2008 12:40:01 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4-OSX: Try to fix the big/white window if the user clicks on a unified
toolbar with the right mouse key.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxToolBar.h

    r10230 r10519  
    7272    }
    7373
     74    void setMacToolbar ()
     75    {
     76#ifdef Q_WS_MAC
     77        if (mMainWindow)
     78        {
     79            mMainWindow->setUnifiedTitleAndToolBarOnMac (true);
     80            WindowRef window = ::darwinToWindowRef (this);
     81            EventHandlerUPP eventHandler = ::NewEventHandlerUPP (VBoxToolBar::macEventFilter);
     82            EventTypeSpec eventTypes[2];
     83            eventTypes[0].eventClass = kEventClassMouse;
     84            eventTypes[0].eventKind  = kEventMouseDown;
     85            eventTypes[1].eventClass = kEventClassMouse;
     86            eventTypes[1].eventKind  = kEventMouseUp;
     87            InstallWindowEventHandler (window, eventHandler,
     88                                       RT_ELEMENTS (eventTypes), eventTypes,
     89                                       NULL, NULL);
     90        }
     91#endif /* Q_WS_MAC */
     92    }
     93
     94#ifdef Q_WS_MAC
     95    static pascal OSStatus macEventFilter (EventHandlerCallRef aNextHandler,
     96                                           EventRef aEvent, void * /* aUserData */)
     97    {
     98        UInt32 eclass = GetEventClass (aEvent);
     99        if (eclass == kEventClassMouse)
     100        {
     101            WindowPartCode partCode;
     102            GetEventParameter (aEvent, kEventParamWindowPartCode, typeWindowPartCode, NULL, sizeof (WindowPartCode), NULL, &partCode);
     103            UInt32 ekind = GetEventKind (aEvent);
     104            if (partCode == 15 ||
     105                partCode == 4)
     106                if(ekind == kEventMouseDown || ekind == kEventMouseUp)
     107                {
     108                    EventMouseButton button = 0;
     109                    GetEventParameter (aEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof (button), NULL, &button);
     110                    if (button != kEventMouseButtonPrimary)
     111                        return noErr;
     112                }
     113        }
     114        return CallNextEventHandler (aNextHandler, aEvent);
     115    }
     116#endif /* Q_WS_MAC */
     117
    74118    void setShowToolBarButton (bool aShow)
    75119    {
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDiskImageManagerDlg.cpp

    r10416 r10519  
    363363#if MAC_LEOPARD_STYLE
    364364    /* Enable unified toolbars on Mac OS X. Available on Qt >= 4.3 */
    365     setUnifiedTitleAndToolBarOnMac (true);
    366365    addToolBar (mActionsToolBar);
     366    mActionsToolBar->setMacToolbar();
    367367    /* No spacing/margin on the mac */
    368368    VBoxGlobal::setLayoutMargin (centralLayout, 0);
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp

    r10515 r10519  
    476476#if MAC_LEOPARD_STYLE
    477477    /* Enable unified toolbars on Mac OS X. Available on Qt >= 4.3 */
    478     setUnifiedTitleAndToolBarOnMac (true);
    479478    addToolBar (vmTools);
     479    vmTools->setMacToolbar();
    480480    /* No spacing/margin on the mac */
    481481    VBoxGlobal::setLayoutMargin (centralLayout, 0);
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSettingsDialog.cpp

    r10475 r10519  
    7070#ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
    7171    mSelector = new VBoxSettingsToolBarSelector (this);
    72     setUnifiedTitleAndToolBarOnMac (true);
     72    static_cast<VBoxToolBar*> (mSelector->widget())->setMacToolbar();
    7373    addToolBar (qobject_cast<QToolBar*> (mSelector->widget()));
    7474    /* No title in this mode, we change the title of the window. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette