VirtualBox

Changeset 17126 in vbox for trunk


Ignore:
Timestamp:
Feb 25, 2009 1:03:29 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt-OSX: Make the handling of Darwin tasks more generic for Carbon & Cocoa. Disable settings window animation on Cocoa.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 added
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r17070 r17126  
    152152VirtualBox_DEFS.debug     = VBOX_CHECK_STATE # QT_FATAL_ASSERT
    153153VirtualBox_DEFS.darwin    = VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
     154ifndef VBOX_WITH_COCOA_QT
    154155VirtualBox_DEFS.darwin.x86= VBOX_GUI_USE_QUARTZ2D USE_HID_FOR_MODIFIERS
     156endif
    155157VirtualBox_DEFS.freebsd   = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
    156158VirtualBox_DEFS.linux     = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
     
    403405ifdef VBOX_WITH_COCOA_QT
    404406 VirtualBox_SOURCES.darwin += \
    405         src/darwin/VBoxCocoaApplication.m
     407        src/darwin/VBoxCocoaApplication.m \
     408        src/darwin/VBoxUtils-darwin-cocoa.m
     409else
     410 VirtualBox_SOURCES.darwin += \
     411        src/darwin/VBoxUtils-darwin-carbon.cpp
    406412endif
    407413
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxToolBar.h

    r16469 r17126  
    8181            /** @todo Carbon -> Cocoa */
    8282# else  /* !QT_MAC_USE_COCOA */
    83             WindowRef window = ::darwinToWindowRef (this);
     83            WindowRef window = ::darwinToNativeWindow (this);
    8484            EventHandlerUPP eventHandler = ::NewEventHandlerUPP (VBoxToolBar::macEventFilter);
    8585            EventTypeSpec eventTypes[2];
     
    123123    {
    124124#ifdef Q_WS_MAC
    125         ::darwinSetShowToolBarButton (this, aShow);
     125        ::darwinSetShowsToolbarButton (this, aShow);
    126126#else  /* Q_WS_MAC */
    127127        NOREF (aShow);
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h

    r16691 r17126  
    128128
    129129#ifdef Q_WS_MAC
    130 class QImage;
    131 class QPixmap;
    132 class QToolBar;
    133 class VBoxFrameBuffer;
    134 
    135 # ifdef QT_MAC_USE_COCOA
    136 /** @todo Carbon -> Cocoa */
    137 # else /* !QT_MAC_USE_COCOA */
    138 #  undef PAGE_SIZE
    139 #  undef PAGE_SHIFT
    140 #  include <Carbon/Carbon.h>
    141 
    142 /* Asserts if a != noErr and prints the error code */
    143 #  define AssertCarbonOSStatus(a) AssertMsg ((a) == noErr, ("Carbon OSStatus: %d\n", static_cast<int> (a)))
    144 
    145 /* Converting stuff */
    146 CGImageRef darwinToCGImageRef (const QImage *aImage);
    147 CGImageRef darwinToCGImageRef (const QPixmap *aPixmap);
    148 CGImageRef darwinToCGImageRef (const char *aSource);
    149 
    150 /**
    151  * Returns a reference to the HIView of the QWidget.
    152  *
    153  * @returns HIViewRef of the QWidget.
    154  * @param   aWidget   Pointer to the QWidget
    155  */
    156 DECLINLINE(HIViewRef) darwinToHIViewRef (QWidget *aWidget)
    157 {
    158     return HIViewRef(aWidget->winId());
    159 }
    160 
    161 /**
    162  * Returns a reference to the Window of the HIView.
    163  *
    164  * @returns WindowRef of the HIView.
    165  * @param   aViewRef  Reference to the HIView
    166  */
    167 DECLINLINE(WindowRef) darwinToWindowRef (HIViewRef aViewRef)
    168 {
    169     return reinterpret_cast<WindowRef> (HIViewGetWindow(aViewRef));
    170 }
    171 
    172 /**
    173  * Returns a reference to the Window of the QWidget.
    174  *
    175  * @returns WindowRef of the QWidget.
    176  * @param   aWidget   Pointer to the QWidget
    177  */
    178 DECLINLINE(WindowRef) darwinToWindowRef (QWidget *aWidget)
    179 {
    180     return ::darwinToWindowRef (::darwinToHIViewRef (aWidget));
    181 }
    182 
    183 /**
    184  * Returns a reference to the CGContext of the QWidget.
    185  *
    186  * @returns CGContextRef of the QWidget.
    187  * @param   aWidget      Pointer to the QWidget
    188  */
    189 DECLINLINE(CGContextRef) darwinToCGContextRef (QWidget *aWidget)
    190 {
    191     return static_cast<CGContext *> (aWidget->macCGHandle());
    192 }
    193 
    194 /**
    195  * Converts a QRect to a HIRect.
    196  *
    197  * @returns HIRect for the converted QRect.
    198  * @param   aRect  the QRect to convert
    199  */
    200 DECLINLINE(HIRect) darwinToHIRect (const QRect &aRect)
    201 {
    202     return CGRectMake (aRect.x(), aRect.y(), aRect.width(), aRect.height());
    203 }
    204 #endif /* !QT_MAC_USE_COCOA */
    205 
    206 QString darwinSystemLanguage (void);
    207 
    208 bool darwinIsMenuOpen (void);
    209 
    210 void darwinSetShowToolBarButton (QToolBar *aToolBar, bool aShow);
    211 
    212 void darwinWindowAnimateResize (QWidget *aWidget, const QRect &aTarget);
    213 
    214 /* Proxy icon creation */
    215 QPixmap darwinCreateDragPixmap (const QPixmap& aPixmap, const QString &aText);
    216 
    217 /* Icons in the menu of an mac application are unusual. */
    218 void darwinDisableIconsInMenus (void);
    219 
    220 # ifdef DEBUG
    221 void darwinDebugPrintEvent (const char *aPrefix, EventRef aEvent);
    222 # endif
    223 
    224 # ifdef QT_MAC_USE_COCOA
    225 /** @todo Carbon -> Cocoa  */
    226 # else  /* !QT_MAC_USE_COCOA */
    227 /* Experimental region handler for the seamless mode */
    228 OSStatus darwinRegionHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData);
    229 
    230 /* Handler for the OpenGL overlay window stuff & the possible messages. */
    231 enum
    232 {
    233     /* Event classes */
    234     kEventClassVBox        = 'vbox',
    235     /* Event kinds */
    236     kEventVBoxShowWindow   = 'swin',
    237     kEventVBoxMoveWindow   = 'mwin',
    238     kEventVBoxResizeWindow = 'rwin',
    239     kEventVBoxUpdateDock   = 'udck'
    240 };
    241 OSStatus darwinOverlayWindowHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData);
    242 # endif /* !QT_MAC_USE_COCOA*/
     130# include "VBoxUtils-darwin.h"
    243131#endif /* Q_WS_MAC */
    244132
  • trunk/src/VBox/Frontends/VirtualBox/src/QIDialog.cpp

    r16469 r17126  
    5050        /** @todo Carbon -> Cocoa */
    5151# else
    52         ChangeWindowAttributes (::darwinToWindowRef (this), kWindowNoAttributes, kWindowResizableAttribute);
     52        ChangeWindowAttributes (::darwinToNativeWindow (this), kWindowNoAttributes, kWindowResizableAttribute);
    5353# endif
    5454#endif /* Q_WS_MAC */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r16953 r17126  
    40914091       event handler). */
    40924092    if (aOn || mKeyboardGrabbed)
    4093 # ifdef QT_MAC_USE_COCOA
    4094         ::VBoxCocoaApplication_setMouseCoalescingEnabled (aOn);
    4095 # else
    4096         ::SetMouseCoalescingEnabled (aOn, NULL);
    4097 # endif
     4093        ::darwinSetMouseCoalescingEnabled (aOn);
    40984094}
    40994095
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r17071 r17126  
    12701270# else
    12711271                HIRect viewRect;
    1272                 HIViewGetBounds (::darwinToHIViewRef (this), &viewRect);
     1272                HIViewGetBounds (::darwinToNativeView (this), &viewRect);
    12731273                CGContextClearRect (::darwinToCGContextRef (this), viewRect);
    12741274# endif
     
    23852385# else  /* !QT_MAC_USE_COCOA */
    23862386            OSStatus status;
    2387             WindowRef windowRef = ::darwinToWindowRef (this);
     2387            WindowRef windowRef = ::darwinToNativeWindow (this);
    23882388            Assert (VALID_PTR (windowRef));
    23892389            /* See above.
     
    24322432# else  /* !QT_MAC_USE_COCOA */
    24332433        OSStatus status;
    2434         HIViewRef viewRef = ::darwinToHIViewRef (console->viewport());
     2434        HIViewRef viewRef = ::darwinToNativeView (console->viewport());
    24352435        Assert (VALID_PTR (viewRef));
    2436         WindowRef windowRef = ::darwinToWindowRef (viewRef);
     2436        WindowRef windowRef = ::darwinToNativeWindow (viewRef);
    24372437        Assert (VALID_PTR (windowRef));
    24382438        /* @todo=poetzsch: Currently this isn't necessary. I should
     
    25182518    /* setWindowState removes the window group connection somehow. So save it
    25192519     * temporary. */
    2520     WindowGroupRef g = GetWindowGroup (::darwinToWindowRef (this));
     2520    WindowGroupRef g = GetWindowGroup (::darwinToNativeWindow (this));
    25212521    if (aSeamless)
    25222522        if (aOn)
     
    25402540        setWindowState (windowState() ^ Qt::WindowFullScreen);
    25412541    /* Reassign the correct window group. */
    2542     SetWindowGroup (::darwinToWindowRef (this), g);
     2542    SetWindowGroup (::darwinToNativeWindow (this), g);
    25432543# endif /* !QT_MAC_USE_COCOA */
    25442544#else
     
    30313031         * an repaint only. All the magic clipping stuff is done
    30323032         * in the paint engine. */
    3033         HIViewReshapeStructure (::darwinToHIViewRef (console->viewport()));
     3033        HIViewReshapeStructure (::darwinToNativeView (console->viewport()));
    30343034//        HIWindowInvalidateShadow (::darwinToWindowRef (console->viewport()));
    30353035//        ReshapeCustomWindow (::darwinToWindowRef (this));
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQuartz2D.cpp

    r12628 r17126  
    164164    Assert (VALID_PTR (viewport));
    165165
    166     HIViewRef viewRef = ::darwinToHIViewRef (viewport);
     166    HIViewRef viewRef = ::darwinToNativeView (viewport);
    167167    Assert (VALID_PTR (viewRef));
    168168    /* Get the dimensions of this HIView */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialog.cpp

    r15103 r17126  
    2020 * additional information or have any questions.
    2121 */
    22 
    2322#include "VBoxSettingsDialog.h"
    2423#include "VBoxSettingsUtils.h"
     
    3938#include <QStackedWidget>
    4039
    41 
    4240#if MAC_LEOPARD_STYLE
    4341# define VBOX_GUI_WITH_TOOLBAR_SETTINGS
     
    5654    Ui::VBoxSettingsDialog::setupUi (this);
    5755
     56//    setToolbar (new VBoxToolBar (this));
    5857#ifdef Q_WS_MAC
    5958//    VBoxGlobal::setLayoutMargin (centralWidget()->layout(), 0);
     
    277276    mStack->setCurrentIndex (mStack->indexOf (rootPage));
    278277#else /* Q_WS_MAC */
     278# ifndef QT_MAC_USE_COCOA
    279279    QSize cs = size();
    280280    /* First make all fully resizeable */
     
    300300        setFixedSize (ss);
    301301    }
     302# else /* QT_MAC_USE_COCOA */
     303    for (int i = 0; i < mStack->count(); ++i)
     304        mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
     305    mStack->setCurrentIndex (mStack->indexOf (rootPage));
     306# endif /* QT_MAC_USE_COCOA */
    302307#endif /* !Q_WS_MAC */
    303308# ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
     
    415420    int minWidth = mSelector->minWidth();
    416421#ifdef Q_WS_MAC
     422# ifndef QT_MAC_USE_COCOA
    417423    /* Set all size policies to ignored */
    418424    for (int i = 0; i < mStack->count(); ++i)
     
    432438
    433439    categoryChanged (mSelector->currentId());
     440# else /* QT_MAC_USE_COCOA */
     441    categoryChanged (mSelector->currentId());
     442# endif /* QT_MAC_USE_COCOA */
    434443#else /* Q_WS_MAC */
    435444    /* Resize to the minimum possible size */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsSelector.cpp

    r12130 r17126  
    368368    mTbSelector->setUsesTextLabel (true);
    369369    mTbSelector->setIconSize (QSize (32, 32));
     370    mTbSelector->setShowToolBarButton (false);
    370371    /* Init the action group for house keeping */
    371372    mActionGroup = new QActionGroup (this);
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxCocoaApplication.m

    r16699 r17126  
    2727#include "DarwinKeyboard.h"
    2828#include <iprt/assert.h>
     29#import <AppKit/NSWindow.h>
    2930#import <AppKit/NSEvent.h>
    3031
     
    289290
    290291    return fCarbon;
    291 }
    292 
    293 
    294 /**
    295  * Calls the + (void)setMouseCoalescingEnabled:(BOOL)flag class method.
    296  *
    297  * @param   fEnabled    Whether to enable or disable coalescing.
    298  */
    299 void VBoxCocoaApplication_setMouseCoalescingEnabled(bool fEnabled)
    300 {
    301     [NSEvent setMouseCoalescingEnabled:fEnabled];
    302292}
    303293
     
    337327        EVT_CASE(NSOtherMouseUp);
    338328        EVT_CASE(NSOtherMouseDragged);
    339 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
     329#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
    340330        EVT_CASE(NSEventTypeGesture);
    341331        EVT_CASE(NSEventTypeMagnify);
     
    467457        case NSOtherMouseUp:
    468458        case NSOtherMouseDragged:
    469 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
     459#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
    470460        case NSEventTypeGesture:
    471461        case NSEventTypeMagnify:
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxDockIconPreview.cpp

    r16469 r17126  
    252252
    253253    /* Process the content of any external OpenGL window. */
    254     WindowRef w = darwinToWindowRef (mMainWnd);
     254    WindowRef w = darwinToNativeWindow (mMainWnd);
    255255    WindowGroupRef g = GetWindowGroup (w);
    256256    WindowGroupContentOptions wgco = kWindowGroupContentsReturnWindows | kWindowGroupContentsRecurse | kWindowGroupContentsVisible;
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin-carbon.cpp

    r17108 r17126  
    1 /* $Id$ */
    21/** @file
    3  * Qt GUI - Utility Classes and Functions specific to Darwin.
     2 *
     3 * VBox frontends: Qt GUI ("VirtualBox"):
     4 * Declarations of utility classes and functions for handling Darwin Carbon
     5 * specific tasks
    46 */
    57
    68/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     9 * Copyright (C) 2009 Sun Microsystems, Inc.
    810 *
    911 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2022 */
    2123
    22 
    23 
    24 #include "VBoxUtils.h"
    25 #include "VBoxFrameBuffer.h"
     24#include "VBoxUtils-darwin.h"
     25
     26#include <iprt/assert.h>
     27
     28#include <Carbon/Carbon.h>
     29
     30NativeWindowRef darwinToNativeWindowImpl (NativeViewRef aView)
     31{
     32    return reinterpret_cast<WindowRef> (::HIViewGetWindow (aView));
     33}
     34
     35void darwinSetShowsToolbarButtonImpl (NativeWindowRef aWindow, bool aEnabled)
     36{
     37    int err = ::ChangeWindowAttributes (aWindow, aEnabled ? kWindowToolbarButtonAttribute:kWindowNoAttributes,
     38                                                 aEnabled ? kWindowNoAttributes:kWindowToolbarButtonAttribute);
     39    AssertCarbonOSStatus (err);
     40}
     41
     42void darwinSetMouseCoalescingEnabled (bool aEnabled)
     43{
     44    ::SetMouseCoalescingEnabled (aEnabled, NULL);
     45}
     46
     47
     48
     49
     50
     51/********************************************************************************
     52 *
     53 * Old carbon stuff. Have to converted soon!
     54 *
     55 ********************************************************************************/
    2656#include "VBoxConsoleView.h"
    27 
    28 #include <iprt/assert.h>
    29 #include <iprt/mem.h>
    30 
    31 #include <CoreFoundation/CFBundle.h>
    32 #include <Carbon/Carbon.h>
    33 
    34 /* Qt includes */
    35 #include <QImage>
    36 #include <QPixmap>
    37 #include <QPainter>
    38 #include <QApplication>
    39 #include <QToolBar>
    40 #include <QMainWindow>
    41 #include <QStatusBar>
    42 
    43 #if QT_VERSION < 0x040400
    44 extern void qt_mac_set_menubar_icons(bool b);
    45 #endif /* QT_VERSION < 0x040400 */
    46 
    47 #ifndef QT_MAC_USE_COCOA
    4857
    4958/**
     
    111120}
    112121
    113 #endif /* !QT_MAC_USE_COCOA */
    114 
    115 void darwinSetShowToolBarButton (QToolBar *aToolBar, bool aShow)
    116 {
    117     QWidget *parent = aToolBar->parentWidget();
    118     if (parent)
    119     {
    120 #ifdef QT_MAC_USE_COCOA
    121         /** @todo Carbon -> Cocoa */
    122 #else
    123         int err = ChangeWindowAttributes (::darwinToWindowRef (parent), aShow ? kWindowToolbarButtonAttribute:kWindowNoAttributes,
    124                                                                         aShow ? kWindowNoAttributes:kWindowToolbarButtonAttribute);
    125         AssertCarbonOSStatus (err);
    126 #endif
    127     }
    128 }
    129 
    130122void darwinWindowAnimateResize (QWidget *aWidget, const QRect &aTarget)
    131123{
    132 #ifdef QT_MAC_USE_COCOA
    133     /** @todo Carbon -> Cocoa */
    134 #else
    135124    HIRect r = ::darwinToHIRect (aTarget);
    136     TransitionWindowWithOptions (::darwinToWindowRef (aWidget), kWindowSlideTransitionEffect, kWindowResizeTransitionAction, &r, false, NULL);
    137 #endif
    138 }
    139 
    140 /* Proxy icon creation */
    141 QPixmap darwinCreateDragPixmap (const QPixmap& aPixmap, const QString &aText)
    142 {
    143     QFontMetrics fm (qApp->font());
    144     QRect tbRect = fm.boundingRect (aText);
    145     const int h = qMax (aPixmap.height(), fm.ascent() + 1);
    146     const int m = 2;
    147     QPixmap dragPixmap (aPixmap.width() + tbRect.width() + m, h);
    148     dragPixmap.fill (Qt::transparent);
    149     QPainter painter (&dragPixmap);
    150     painter.drawPixmap (0, qAbs (h - aPixmap.height()) / 2.0, aPixmap);
    151     painter.setPen (Qt::white);
    152     painter.drawText (QRect (aPixmap.width() + m, 1, tbRect.width(), h - 1), Qt::AlignLeft | Qt::AlignVCenter, aText);
    153     painter.setPen (Qt::black);
    154     painter.drawText (QRect (aPixmap.width() + m, 0, tbRect.width(), h - 1), Qt::AlignLeft | Qt::AlignVCenter, aText);
    155     painter.end();
    156     return dragPixmap;
    157 }
    158 
    159 QString darwinSystemLanguage (void)
    160 {
    161     /* Get the locales supported by our bundle */
    162     CFArrayRef supportedLocales = CFBundleCopyBundleLocalizations (CFBundleGetMainBundle());
    163     /* Check them against the languages currently selected by the user */
    164     CFArrayRef preferredLocales = CFBundleCopyPreferredLocalizationsFromArray (supportedLocales);
    165     /* Get the one which is on top */
    166     CFStringRef localeId = (CFStringRef)CFArrayGetValueAtIndex (preferredLocales, 0);
    167     /* Convert them to a C-string */
    168     char localeName[20];
    169     CFStringGetCString (localeId, localeName, sizeof (localeName), kCFStringEncodingUTF8);
    170     /* Some cleanup */
    171     CFRelease (supportedLocales);
    172     CFRelease (preferredLocales);
    173     QString id(localeName);
    174     /* Check for some misbehavior */
    175     if (id.isEmpty() ||
    176         id.toLower() == "english")
    177         id = "en";
    178     return id;
     125    TransitionWindowWithOptions (::darwinToNativeWindow (aWidget), kWindowSlideTransitionEffect, kWindowResizeTransitionAction, &r, false, NULL);
    179126}
    180127
    181128bool darwinIsMenuOpen (void)
    182129{
    183 #ifdef QT_MAC_USE_COCOA
    184     /** @todo Carbon -> Cocoa */
    185     return false;
    186 #else
    187130    MenuTrackingData outData;
    188131    return (GetMenuTrackingData (NULL, &outData) != menuNotFoundErr);
    189 #endif
    190 }
    191 
    192 void darwinDisableIconsInMenus (void)
    193 {
    194     /* No icons in the menu of a mac application. */
    195 #if QT_VERSION < 0x040400
    196     qt_mac_set_menubar_icons (false);
    197 #else /* QT_VERSION < 0x040400 */
    198     /* Available since Qt 4.4 only */
    199     QApplication::instance()->setAttribute (Qt::AA_DontShowIconsInMenus, true);
    200 #endif /* QT_VERSION >= 0x040400 */
    201 }
    202 
    203 #ifndef QT_MAC_USE_COCOA
     132}
    204133
    205134/* Currently not used! */
     
    236165                if (!pRegion->isEmpty() && pRegion)
    237166                {
    238                     CopyRgn (pRegion->handle(), rgn);
     167                    //CopyRgn (pRegion->handle(), rgn);
    239168                    status = noErr;
    240169                }
     
    326255}
    327256
    328 #endif /* !QT_MAC_USE_COCOA */
    329 
    330 
    331 /* Event debugging stuff. Borrowed from Knuts Qt patch. */
    332 #if defined (DEBUG)
    333 
    334 # define MY_CASE(a) case a: return #a
    335 const char * DarwinDebugEventName (UInt32 ekind)
    336 {
    337     switch (ekind)
    338     {
    339 # if !__LP64__
    340         MY_CASE(kEventWindowUpdate                );
    341         MY_CASE(kEventWindowDrawContent           );
    342 # endif
    343         MY_CASE(kEventWindowActivated             );
    344         MY_CASE(kEventWindowDeactivated           );
    345         MY_CASE(kEventWindowHandleActivate        );
    346         MY_CASE(kEventWindowHandleDeactivate      );
    347         MY_CASE(kEventWindowGetClickActivation    );
    348         MY_CASE(kEventWindowGetClickModality      );
    349         MY_CASE(kEventWindowShowing               );
    350         MY_CASE(kEventWindowHiding                );
    351         MY_CASE(kEventWindowShown                 );
    352         MY_CASE(kEventWindowHidden                );
    353         MY_CASE(kEventWindowCollapsing            );
    354         MY_CASE(kEventWindowCollapsed             );
    355         MY_CASE(kEventWindowExpanding             );
    356         MY_CASE(kEventWindowExpanded              );
    357         MY_CASE(kEventWindowZoomed                );
    358         MY_CASE(kEventWindowBoundsChanging        );
    359         MY_CASE(kEventWindowBoundsChanged         );
    360         MY_CASE(kEventWindowResizeStarted         );
    361         MY_CASE(kEventWindowResizeCompleted       );
    362         MY_CASE(kEventWindowDragStarted           );
    363         MY_CASE(kEventWindowDragCompleted         );
    364         MY_CASE(kEventWindowClosed                );
    365         MY_CASE(kEventWindowTransitionStarted     );
    366         MY_CASE(kEventWindowTransitionCompleted   );
    367 # if !__LP64__
    368         MY_CASE(kEventWindowClickDragRgn          );
    369         MY_CASE(kEventWindowClickResizeRgn        );
    370         MY_CASE(kEventWindowClickCollapseRgn      );
    371         MY_CASE(kEventWindowClickCloseRgn         );
    372         MY_CASE(kEventWindowClickZoomRgn          );
    373         MY_CASE(kEventWindowClickContentRgn       );
    374         MY_CASE(kEventWindowClickProxyIconRgn     );
    375         MY_CASE(kEventWindowClickToolbarButtonRgn );
    376         MY_CASE(kEventWindowClickStructureRgn     );
    377 # endif
    378         MY_CASE(kEventWindowCursorChange          );
    379         MY_CASE(kEventWindowCollapse              );
    380         MY_CASE(kEventWindowCollapseAll           );
    381         MY_CASE(kEventWindowExpand                );
    382         MY_CASE(kEventWindowExpandAll             );
    383         MY_CASE(kEventWindowClose                 );
    384         MY_CASE(kEventWindowCloseAll              );
    385         MY_CASE(kEventWindowZoom                  );
    386         MY_CASE(kEventWindowZoomAll               );
    387         MY_CASE(kEventWindowContextualMenuSelect  );
    388         MY_CASE(kEventWindowPathSelect            );
    389         MY_CASE(kEventWindowGetIdealSize          );
    390         MY_CASE(kEventWindowGetMinimumSize        );
    391         MY_CASE(kEventWindowGetMaximumSize        );
    392         MY_CASE(kEventWindowConstrain             );
    393 # if !__LP64__
    394         MY_CASE(kEventWindowHandleContentClick    );
    395 # endif
    396         MY_CASE(kEventWindowGetDockTileMenu       );
    397         MY_CASE(kEventWindowProxyBeginDrag        );
    398         MY_CASE(kEventWindowProxyEndDrag          );
    399         MY_CASE(kEventWindowToolbarSwitchMode     );
    400         MY_CASE(kEventWindowFocusAcquired         );
    401         MY_CASE(kEventWindowFocusRelinquish       );
    402         MY_CASE(kEventWindowFocusContent          );
    403         MY_CASE(kEventWindowFocusToolbar          );
    404         MY_CASE(kEventWindowFocusDrawer           );
    405         MY_CASE(kEventWindowSheetOpening          );
    406         MY_CASE(kEventWindowSheetOpened           );
    407         MY_CASE(kEventWindowSheetClosing          );
    408         MY_CASE(kEventWindowSheetClosed           );
    409         MY_CASE(kEventWindowDrawerOpening         );
    410         MY_CASE(kEventWindowDrawerOpened          );
    411         MY_CASE(kEventWindowDrawerClosing         );
    412         MY_CASE(kEventWindowDrawerClosed          );
    413         MY_CASE(kEventWindowDrawFrame             );
    414         MY_CASE(kEventWindowDrawPart              );
    415         MY_CASE(kEventWindowGetRegion             );
    416         MY_CASE(kEventWindowHitTest               );
    417         MY_CASE(kEventWindowInit                  );
    418         MY_CASE(kEventWindowDispose               );
    419         MY_CASE(kEventWindowDragHilite            );
    420         MY_CASE(kEventWindowModified              );
    421         MY_CASE(kEventWindowSetupProxyDragImage   );
    422         MY_CASE(kEventWindowStateChanged          );
    423         MY_CASE(kEventWindowMeasureTitle          );
    424         MY_CASE(kEventWindowDrawGrowBox           );
    425         MY_CASE(kEventWindowGetGrowImageRegion    );
    426         MY_CASE(kEventWindowPaint                 );
    427     }
    428     static char s_sz[64];
    429     sprintf(s_sz, "kind=%u", (uint)ekind);
    430     return s_sz;
    431 }
    432 # undef MY_CASE
    433 
    434 /* Convert a class into the 4 char code defined in
    435  * 'Developer/Headers/CFMCarbon/CarbonEvents.h' to
    436  * identify the event. */
    437 const char * darwinDebugClassName (UInt32 eclass)
    438 {
    439     char *pclass = (char*)&eclass;
    440     static char s_sz[11];
    441     sprintf(s_sz, "class=%c%c%c%c", pclass[3],
    442                                     pclass[2],
    443                                     pclass[1],
    444                                     pclass[0]);
    445     return s_sz;
    446 }
    447 
    448 void darwinDebugPrintEvent (const char *psz, EventRef evtRef)
    449 {
    450   if (!evtRef)
    451       return;
    452   UInt32 ekind = GetEventKind (evtRef), eclass = GetEventClass (evtRef);
    453   if (eclass == kEventClassWindow)
    454   {
    455       switch (ekind)
    456       {
    457 # if !__LP64__
    458           case kEventWindowDrawContent:
    459           case kEventWindowUpdate:
    460 # endif
    461           case kEventWindowBoundsChanged:
    462               break;
    463           default:
    464           {
    465               WindowRef wid = NULL;
    466               GetEventParameter(evtRef, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &wid);
    467               QWidget *widget = QWidget::find((WId)wid);
    468               printf("%d %s: (%s) %#x win=%p wid=%p (%s)\n", (int)time(NULL), psz, darwinDebugClassName (eclass), (uint)ekind, wid, widget, DarwinDebugEventName (ekind));
    469               break;
    470           }
    471       }
    472   }
    473   else if (eclass == kEventClassCommand)
    474   {
    475       WindowRef wid = NULL;
    476       GetEventParameter(evtRef, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &wid);
    477       QWidget *widget = QWidget::find((WId)wid);
    478       const char *name = "Unknown";
    479       switch (ekind)
    480       {
    481           case kEventCommandProcess:
    482               name = "kEventCommandProcess";
    483               break;
    484           case kEventCommandUpdateStatus:
    485               name = "kEventCommandUpdateStatus";
    486               break;
    487       }
    488       printf("%d %s: (%s) %#x win=%p wid=%p (%s)\n", (int)time(NULL), psz, darwinDebugClassName (eclass), (uint)ekind, wid, widget, name);
    489   }
    490   else if (eclass == kEventClassKeyboard)
    491   {
    492       printf("%d %s: %#x(%s) %#x (kEventClassKeyboard)", (int)time(NULL), psz, (uint)eclass, darwinDebugClassName (eclass), (uint)ekind);
    493 
    494       UInt32 keyCode = 0;
    495       ::GetEventParameter (evtRef, kEventParamKeyCode, typeUInt32, NULL,
    496                            sizeof (keyCode), NULL, &keyCode);
    497       printf(" keyCode=%d (%#x) ", keyCode, keyCode);
    498 
    499       char macCharCodes[8] = {0,0,0,0, 0,0,0,0};
    500       ::GetEventParameter (evtRef, kEventParamKeyCode, typeChar, NULL,
    501                            sizeof (macCharCodes), NULL, &macCharCodes[0]);
    502       printf(" macCharCodes={");
    503       for (unsigned i =0; i < 8 && macCharCodes[i]; i++)
    504           printf( i == 0 ? "%02x" : ",%02x", macCharCodes[i]);
    505       printf("}");
    506 
    507       UInt32 modifierMask = 0;
    508       ::GetEventParameter (evtRef, kEventParamKeyModifiers, typeUInt32, NULL,
    509                            sizeof (modifierMask), NULL, &modifierMask);
    510       printf(" modifierMask=%08x", modifierMask);
    511 
    512       UniChar keyUnicodes[8] = {0,0,0,0, 0,0,0,0};
    513       ::GetEventParameter (evtRef, kEventParamKeyUnicodes, typeUnicodeText, NULL,
    514                            sizeof (keyUnicodes), NULL, &keyUnicodes[0]);
    515       printf(" keyUnicodes={");
    516       for (unsigned i =0; i < 8 && keyUnicodes[i]; i++)
    517           printf( i == 0 ? "%02x" : ",%02x", keyUnicodes[i]);
    518       printf("}");
    519 
    520       UInt32 keyboardType = 0;
    521       ::GetEventParameter (evtRef, kEventParamKeyboardType, typeUInt32, NULL,
    522                            sizeof (keyboardType), NULL, &keyboardType);
    523       printf(" keyboardType=%08x", keyboardType);
    524 
    525       EventHotKeyID evtHotKeyId = {0,0};
    526       ::GetEventParameter (evtRef, typeEventHotKeyID, typeEventHotKeyID, NULL,
    527                            sizeof (evtHotKeyId), NULL, &evtHotKeyId);
    528       printf(" evtHotKeyId={signature=%08x, .id=%08x}", evtHotKeyId.signature, evtHotKeyId.id);
    529       printf("\n");
    530   }
    531   else
    532       printf("%d %s: %#x(%s) %#x\n", (int)time(NULL), psz, (uint)eclass, darwinDebugClassName (eclass), (uint)ekind);
    533 }
    534 
    535 #endif /* DEBUG */
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp

    r16691 r17126  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020 */
    2121
    22 
    23 
    24 #include "VBoxUtils.h"
    25 #include "VBoxFrameBuffer.h"
    26 #include "VBoxConsoleView.h"
    27 
    28 #include <iprt/assert.h>
    29 #include <iprt/mem.h>
    30 
    31 #include <CoreFoundation/CFBundle.h>
     22#include "VBoxUtils-darwin.h"
     23
     24#include <QApplication>
     25#include <QWidget>
     26#include <QToolBar>
     27#include <QPainter>
     28#include <QPixmap>
     29
    3230#include <Carbon/Carbon.h>
    33 
    34 /* Qt includes */
    35 #include <QImage>
    36 #include <QPixmap>
    37 #include <QPainter>
    38 #include <QApplication>
    39 #include <QToolBar>
    40 #include <QMainWindow>
    41 #include <QStatusBar>
    4231
    4332#if QT_VERSION < 0x040400
     
    4534#endif /* QT_VERSION < 0x040400 */
    4635
    47 #ifndef QT_MAC_USE_COCOA
    48 
    49 /**
    50  * Callback for deleting the QImage object when CGImageCreate is done
    51  * with it (which is probably not until the returned CFGImageRef is released).
    52  *
    53  * @param   info        Pointer to the QImage.
    54  */
    55 static void darwinDataProviderReleaseQImage (void *info, const void *, size_t)
    56 {
    57     QImage *qimg = (QImage *)info;
    58     delete qimg;
    59 }
    60 
    61 /**
    62  * Converts a QPixmap to a CGImage.
    63  *
    64  * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
    65  * @param   aPixmap     Pointer to the QPixmap instance to convert.
    66  */
    67 CGImageRef darwinToCGImageRef (const QImage *aImage)
    68 {
    69     QImage *imageCopy = new QImage (*aImage);
    70     /** @todo this code assumes 32-bit image input, the lazy bird convert image to 32-bit method is anything but optimal... */
    71     if (imageCopy->format() != QImage::Format_ARGB32)
    72         *imageCopy = imageCopy->convertToFormat (QImage::Format_ARGB32);
    73     Assert (!imageCopy->isNull());
    74 
    75     CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
    76     CGDataProviderRef dp = CGDataProviderCreateWithData (imageCopy, aImage->bits(), aImage->numBytes(), darwinDataProviderReleaseQImage);
    77 
    78     CGBitmapInfo bmpInfo = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
    79     CGImageRef ir = CGImageCreate (imageCopy->width(), imageCopy->height(), 8, 32, imageCopy->bytesPerLine(), cs,
    80                                    bmpInfo, dp, 0 /*decode */, 0 /* shouldInterpolate */,
    81                                    kCGRenderingIntentDefault);
    82     CGColorSpaceRelease (cs);
    83     CGDataProviderRelease (dp);
    84 
    85     Assert (ir);
    86     return ir;
    87 }
    88 
    89 /**
    90  * Converts a QPixmap to a CGImage.
    91  *
    92  * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
    93  * @param   aPixmap     Pointer to the QPixmap instance to convert.
    94  */
    95 CGImageRef darwinToCGImageRef (const QPixmap *aPixmap)
    96 {
    97     return aPixmap->toMacCGImageRef();
    98 }
    99 
    100 /**
    101  * Loads an image using Qt and converts it to a CGImage.
    102  *
    103  * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
    104  * @param   aSource     The source name.
    105  */
    106 CGImageRef darwinToCGImageRef (const char *aSource)
    107 {
    108     QPixmap qpm (QString(":/") + aSource);
    109     Assert (!qpm.isNull());
    110     return ::darwinToCGImageRef (&qpm);
    111 }
    112 
    113 #endif /* !QT_MAC_USE_COCOA */
    114 
    115 void darwinSetShowToolBarButton (QToolBar *aToolBar, bool aShow)
     36NativeViewRef darwinToNativeView (QWidget *aWidget)
     37{
     38    return reinterpret_cast<NativeViewRef>(aWidget->winId());
     39}
     40
     41NativeWindowRef darwinToNativeWindow (QWidget *aWidget)
     42{
     43    return darwinToNativeWindowImpl (::darwinToNativeView (aWidget));
     44}
     45
     46NativeWindowRef darwinToNativeWindow (NativeViewRef aView)
     47{
     48    return darwinToNativeWindowImpl (aView);
     49}
     50
     51void darwinSetShowsToolbarButton (QToolBar *aToolBar, bool aEnabled)
    11652{
    11753    QWidget *parent = aToolBar->parentWidget();
    11854    if (parent)
    119     {
    120 #ifdef QT_MAC_USE_COCOA
    121         /** @todo Carbon -> Cocoa */
    122 #else
    123         int err = ChangeWindowAttributes (::darwinToWindowRef (parent), aShow ? kWindowToolbarButtonAttribute:kWindowNoAttributes,
    124                                                                         aShow ? kWindowNoAttributes:kWindowToolbarButtonAttribute);
    125         AssertCarbonOSStatus (err);
    126 #endif
    127     }
    128 }
    129 
    130 void darwinWindowAnimateResize (QWidget *aWidget, const QRect &aTarget)
    131 {
    132 #ifdef QT_MAC_USE_COCOA
    133     /** @todo Carbon -> Cocoa */
    134 #else
    135     HIRect r = ::darwinToHIRect (aTarget);
    136     TransitionWindowWithOptions (::darwinToWindowRef (aWidget), kWindowSlideTransitionEffect, kWindowResizeTransitionAction, &r, false, NULL);
    137 #endif
     55        darwinSetShowsToolbarButtonImpl (::darwinToNativeWindow (parent), aEnabled);
     56}
     57
     58QString darwinSystemLanguage (void)
     59{
     60    /* Get the locales supported by our bundle */
     61    CFArrayRef supportedLocales = ::CFBundleCopyBundleLocalizations (::CFBundleGetMainBundle());
     62    /* Check them against the languages currently selected by the user */
     63    CFArrayRef preferredLocales = ::CFBundleCopyPreferredLocalizationsFromArray (supportedLocales);
     64    /* Get the one which is on top */
     65    CFStringRef localeId = (CFStringRef)::CFArrayGetValueAtIndex (preferredLocales, 0);
     66    /* Convert them to a C-string */
     67    char localeName[20];
     68    ::CFStringGetCString (localeId, localeName, sizeof (localeName), kCFStringEncodingUTF8);
     69    /* Some cleanup */
     70    ::CFRelease (supportedLocales);
     71    ::CFRelease (preferredLocales);
     72    QString id(localeName);
     73    /* Check for some misbehavior */
     74    if (id.isEmpty() ||
     75        id.toLower() == "english")
     76        id = "en";
     77    return id;
     78}
     79
     80void darwinDisableIconsInMenus (void)
     81{
     82    /* No icons in the menu of a mac application. */
     83#if QT_VERSION < 0x040400
     84    qt_mac_set_menubar_icons (false);
     85#else /* QT_VERSION < 0x040400 */
     86    /* Available since Qt 4.4 only */
     87    QApplication::instance()->setAttribute (Qt::AA_DontShowIconsInMenus, true);
     88#endif /* QT_VERSION >= 0x040400 */
    13889}
    13990
     
    157108}
    158109
    159 QString darwinSystemLanguage (void)
    160 {
    161     /* Get the locales supported by our bundle */
    162     CFArrayRef supportedLocales = CFBundleCopyBundleLocalizations (CFBundleGetMainBundle());
    163     /* Check them against the languages currently selected by the user */
    164     CFArrayRef preferredLocales = CFBundleCopyPreferredLocalizationsFromArray (supportedLocales);
    165     /* Get the one which is on top */
    166     CFStringRef localeId = (CFStringRef)CFArrayGetValueAtIndex (preferredLocales, 0);
    167     /* Convert them to a C-string */
    168     char localeName[20];
    169     CFStringGetCString (localeId, localeName, sizeof (localeName), kCFStringEncodingUTF8);
    170     /* Some cleanup */
    171     CFRelease (supportedLocales);
    172     CFRelease (preferredLocales);
    173     QString id(localeName);
    174     /* Check for some misbehavior */
    175     if (id.isEmpty() ||
    176         id.toLower() == "english")
    177         id = "en";
    178     return id;
    179 }
    180 
    181 bool darwinIsMenuOpen (void)
    182 {
    183 #ifdef QT_MAC_USE_COCOA
    184     /** @todo Carbon -> Cocoa */
    185     return false;
    186 #else
    187     MenuTrackingData outData;
    188     return (GetMenuTrackingData (NULL, &outData) != menuNotFoundErr);
    189 #endif
    190 }
    191 
    192 void darwinDisableIconsInMenus (void)
    193 {
    194     /* No icons in the menu of a mac application. */
    195 #if QT_VERSION < 0x040400
    196     qt_mac_set_menubar_icons (false);
    197 #else /* QT_VERSION < 0x040400 */
    198     /* Available since Qt 4.4 only */
    199     QApplication::instance()->setAttribute (Qt::AA_DontShowIconsInMenus, true);
    200 #endif /* QT_VERSION >= 0x040400 */
    201 }
    202 
    203 #ifndef QT_MAC_USE_COCOA
    204 
    205 /* Currently not used! */
    206 OSStatus darwinRegionHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData)
    207 {
    208     NOREF (aInHandlerCallRef);
    209 
    210     OSStatus status = eventNotHandledErr;
    211 
    212     switch (GetEventKind (aInEvent))
    213     {
    214         case kEventWindowGetRegion:
    215         {
    216             WindowRegionCode code;
    217             RgnHandle rgn;
    218 
    219             /* which region code is being queried? */
    220             GetEventParameter (aInEvent, kEventParamWindowRegionCode, typeWindowRegionCode, NULL, sizeof (code), NULL, &code);
    221 
    222             /* if it is the opaque region code then set the region to Empty and return noErr to stop the propagation */
    223             if (code == kWindowOpaqueRgn)
    224             {
    225                 printf("test1\n");
    226                 GetEventParameter (aInEvent, kEventParamRgnHandle, typeQDRgnHandle, NULL, sizeof (rgn), NULL, &rgn);
    227                 SetEmptyRgn (rgn);
    228                 status = noErr;
    229             }
    230             /* if the content of the whole window is queried return a copy of our saved region. */
    231             else if (code == (kWindowStructureRgn))// || kWindowGlobalPortRgn || kWindowUpdateRgn))
    232             {
    233                 printf("test2\n");
    234                 GetEventParameter (aInEvent, kEventParamRgnHandle, typeQDRgnHandle, NULL, sizeof (rgn), NULL, &rgn);
    235                 QRegion *pRegion = static_cast <QRegion*> (aInUserData);
    236                 if (!pRegion->isEmpty() && pRegion)
    237                 {
    238                     CopyRgn (pRegion->handle(), rgn);
    239                     status = noErr;
    240                 }
    241             }
    242             break;
    243         }
    244         case kEventControlDraw:
    245         {
    246             printf("test3\n");
    247             CGContextRef ctx;
    248             HIRect bounds;
    249 
    250             GetEventParameter (aInEvent, kEventParamCGContextRef, typeCGContextRef, NULL, sizeof (ctx), NULL, &ctx);
    251             HIViewGetBounds ((HIViewRef)aInUserData, &bounds);
    252 
    253             CGContextClearRect (ctx, bounds);
    254             status = noErr;
    255             break;
    256         }
    257     }
    258 
    259     return status;
    260 }
    261 
    262 OSStatus darwinOverlayWindowHandler (EventHandlerCallRef aInHandlerCallRef, EventRef aInEvent, void *aInUserData)
    263 {
    264     if (!aInUserData)
    265         return ::CallNextEventHandler (aInHandlerCallRef, aInEvent);
    266 
    267     UInt32 eventClass = ::GetEventClass (aInEvent);
    268     UInt32 eventKind = ::GetEventKind (aInEvent);
    269     /* For debugging events */
    270     /*
    271     if (!(eventClass == 'cute'))
    272         ::darwinDebugPrintEvent ("view: ", aInEvent);
    273     */
    274     VBoxConsoleView *view = static_cast<VBoxConsoleView *> (aInUserData);
    275 
    276     if (eventClass == kEventClassVBox)
    277     {
    278         if (eventKind == kEventVBoxShowWindow)
    279         {
    280 //            printf ("ShowWindow requested\n");
    281             WindowRef w;
    282             if (GetEventParameter (aInEvent, kEventParamWindowRef, typeWindowRef, NULL, sizeof (w), NULL, &w) != noErr)
    283                 return noErr;
    284             ShowWindow (w);
    285             SelectWindow (w);
    286             return noErr;
    287         }
    288         if (eventKind == kEventVBoxMoveWindow)
    289         {
    290 //            printf ("MoveWindow requested\n");
    291             WindowPtr w;
    292             if (GetEventParameter (aInEvent, kEventParamWindowRef, typeWindowRef, NULL, sizeof (w), NULL, &w) != noErr)
    293                 return noErr;
    294             HIPoint p;
    295             if (GetEventParameter (aInEvent, kEventParamOrigin, typeHIPoint, NULL, sizeof (p), NULL, &p) != noErr)
    296                 return noErr;
    297             ChangeWindowGroupAttributes (GetWindowGroup (w), 0, kWindowGroupAttrMoveTogether);
    298             QPoint p1 = view->mapToGlobal (QPoint (p.x, p.y));
    299             MoveWindow (w, p1.x(), p1.y(), true);
    300             ChangeWindowGroupAttributes (GetWindowGroup (w), kWindowGroupAttrMoveTogether, 0);
    301             return noErr;
    302         }
    303         if (eventKind == kEventVBoxResizeWindow)
    304         {
    305 //            printf ("ResizeWindow requested\n");
    306             WindowPtr w;
    307             if (GetEventParameter (aInEvent, kEventParamWindowRef, typeWindowRef, NULL, sizeof (w), NULL, &w) != noErr)
    308                 return noErr;
    309             HISize s;
    310             if (GetEventParameter (aInEvent, kEventParamDimensions, typeHISize, NULL, sizeof (s), NULL, &s) != noErr)
    311                 return noErr;
    312             ChangeWindowGroupAttributes (GetWindowGroup (w), 0, kWindowGroupAttrMoveTogether);
    313             SizeWindow (w, s.width, s.height, true);
    314             ChangeWindowGroupAttributes (GetWindowGroup (w), kWindowGroupAttrMoveTogether, 0);
    315             return noErr;
    316         }
    317         if (eventKind == kEventVBoxUpdateDock)
    318         {
    319 //            printf ("UpdateDock requested\n");
    320             view->updateDockIcon();
    321             return noErr;
    322         }
    323     }
    324 
    325     return ::CallNextEventHandler (aInHandlerCallRef, aInEvent);
    326 }
    327 
    328 #endif /* !QT_MAC_USE_COCOA */
    329 
     110
     111/********************************************************************************
     112 *
     113 * Old carbon stuff. Have to converted soon!
     114 *
     115 ********************************************************************************/
    330116
    331117/* Event debugging stuff. Borrowed from Knuts Qt patch. */
     
    534320
    535321#endif /* DEBUG */
     322
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