VirtualBox

Ignore:
Timestamp:
Jul 11, 2008 12:40:01 PM (16 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.

File:
1 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    {
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