Changeset 27215 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 9, 2010 1:34:53 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 58588
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 14 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r27096 r27215 522 522 src/runtime/seamless/UIMachineWindowSeamless.cpp \ 523 523 src/runtime/seamless/UIMachineViewSeamless.cpp 524 VirtualBox_SOURCES.darwin += \ 525 src/darwin/UIAbstractDockIconPreview.cpp \ 526 src/darwin/UICocoaDockIconPreview.mm 524 527 endif 525 528 … … 548 551 src/win/VirtualBox.rc 549 552 550 VirtualBox_SOURCES.darwin = \553 VirtualBox_SOURCES.darwin += \ 551 554 src/darwin/DarwinKeyboard.cpp \ 552 555 src/darwin/VBoxUtils-darwin.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQuartz2D.cpp
r26719 r27215 230 230 231 231 /* We handle the seamless mode as a special case. */ 232 if (main->isTrueSeamless()) 232 if ( main 233 && main->isTrueSeamless()) 233 234 { 234 235 /* Here we paint the windows without any wallpaper. -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/DockIconPreview.h
r25171 r27215 35 35 }; 36 36 37 #include "UICocoaDockIconPreview.h" 38 class UIDockIconPreview: public UICocoaDockIconPreview 39 { 40 public: 41 UIDockIconPreview(UISession *pSession, const QPixmap& overlayImage) 42 : UICocoaDockIconPreview(pSession, overlayImage) {} 43 }; 44 37 45 #else /* QT_MAC_USE_COCOA */ 38 46 -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/UIAbstractDockIconPreview.cpp
r27154 r27215 21 21 22 22 /* VBox includes */ 23 #include " AbstractDockIconPreview.h"24 #include " VBoxConsoleWnd.h"25 #include " VBoxFrameBuffer.h"23 #include "UIAbstractDockIconPreview.h" 24 #include "UISession.h" 25 #include "UIFrameBuffer.h" 26 26 27 AbstractDockIconPreview::AbstractDockIconPreview (VBoxConsoleWnd * /* aMainWnd */, const QPixmap& /* aOverlayImage */)27 UIAbstractDockIconPreview::UIAbstractDockIconPreview(UISession * /* pSession */, const QPixmap& /* overlayImage */) 28 28 { 29 29 } 30 30 31 void AbstractDockIconPreview::updateDockPreview (VBoxFrameBuffer *aFrameBuffer)31 void UIAbstractDockIconPreview::updateDockPreview(UIFrameBuffer *pFrameBuffer) 32 32 { 33 33 CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); 34 Assert 34 Assert(cs); 35 35 /* Create the image copy of the framebuffer */ 36 CGDataProviderRef dp = CGDataProviderCreateWithData (aFrameBuffer, aFrameBuffer->address(), aFrameBuffer->bitsPerPixel() / 8 * aFrameBuffer->width() * aFrameBuffer->height(), NULL);37 Assert 38 CGImageRef ir = CGImageCreate (aFrameBuffer->width(), aFrameBuffer->height(), 8, 32, aFrameBuffer->bytesPerLine(), cs,39 40 41 Assert 36 CGDataProviderRef dp = CGDataProviderCreateWithData(pFrameBuffer, pFrameBuffer->address(), pFrameBuffer->bitsPerPixel() / 8 * pFrameBuffer->width() * pFrameBuffer->height(), NULL); 37 Assert(dp); 38 CGImageRef ir = CGImageCreate(pFrameBuffer->width(), pFrameBuffer->height(), 8, 32, pFrameBuffer->bytesPerLine(), cs, 39 kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host, dp, 0, false, 40 kCGRenderingIntentDefault); 41 Assert(ir); 42 42 43 43 /* Update the dock preview icon */ 44 updateDockPreview 44 updateDockPreview(ir); 45 45 46 46 /* Release the temp data and image */ 47 CGImageRelease 48 CGDataProviderRelease 49 CGColorSpaceRelease 47 CGImageRelease(ir); 48 CGDataProviderRelease(dp); 49 CGColorSpaceRelease(cs); 50 50 } 51 51 52 AbstractDockIconPreviewHelper::AbstractDockIconPreviewHelper (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage)53 : mMainWnd (aMainWnd)54 , mDockIconRect (CGRectMake(0, 0, 128, 128))55 , mDockMonitor(NULL)56 , mDockMonitorGlossy(NULL)57 , mUpdateRect (CGRectMake(0, 0, 0, 0))58 , mMonitorRect (CGRectMake(0, 0, 0, 0))52 UIAbstractDockIconPreviewHelper::UIAbstractDockIconPreviewHelper(UISession *pSession, const QPixmap& overlayImage) 53 : m_pSession(pSession) 54 , m_dockIconRect(CGRectMake(0, 0, 128, 128)) 55 , m_dockMonitor(NULL) 56 , m_dockMonitorGlossy(NULL) 57 , m_updateRect(CGRectMake(0, 0, 0, 0)) 58 , m_monitorRect(CGRectMake(0, 0, 0, 0)) 59 59 { 60 m OverlayImage = ::darwinToCGImageRef (&aOverlayImage);61 Assert (mOverlayImage);60 m_overlayImage = ::darwinToCGImageRef(&overlayImage); 61 Assert(m_overlayImage); 62 62 63 m StatePaused = ::darwinToCGImageRef("state_paused_16px.png");64 Assert (mStatePaused);65 m StateSaving = ::darwinToCGImageRef("state_saving_16px.png");66 Assert (mStateSaving);67 m StateRestoring = ::darwinToCGImageRef("state_restoring_16px.png");68 Assert (mStateRestoring);63 m_statePaused = ::darwinToCGImageRef("state_paused_16px.png"); 64 Assert(m_statePaused); 65 m_stateSaving = ::darwinToCGImageRef("state_saving_16px.png"); 66 Assert(m_stateSaving); 67 m_stateRestoring = ::darwinToCGImageRef("state_restoring_16px.png"); 68 Assert(m_stateRestoring); 69 69 } 70 70 71 AbstractDockIconPreviewHelper::~AbstractDockIconPreviewHelper()71 UIAbstractDockIconPreviewHelper::~UIAbstractDockIconPreviewHelper() 72 72 { 73 CGImageRelease (mOverlayImage);74 if (m DockMonitor)75 CGImageRelease (mDockMonitor);76 if (m DockMonitorGlossy)77 CGImageRelease (mDockMonitorGlossy);73 CGImageRelease(m_overlayImage); 74 if (m_dockMonitor) 75 CGImageRelease(m_dockMonitor); 76 if (m_dockMonitorGlossy) 77 CGImageRelease(m_dockMonitorGlossy); 78 78 79 CGImageRelease (mStatePaused);80 CGImageRelease (mStateSaving);81 CGImageRelease (mStateRestoring);79 CGImageRelease(m_statePaused); 80 CGImageRelease(m_stateSaving); 81 CGImageRelease(m_stateRestoring); 82 82 } 83 83 84 void AbstractDockIconPreviewHelper::initPreviewImages()84 void UIAbstractDockIconPreviewHelper::initPreviewImages() 85 85 { 86 if (!m DockMonitor)86 if (!m_dockMonitor) 87 87 { 88 m DockMonitor = ::darwinToCGImageRef("monitor.png");89 Assert (mDockMonitor);88 m_dockMonitor = ::darwinToCGImageRef("monitor.png"); 89 Assert(m_dockMonitor); 90 90 /* Center it on the dock icon context */ 91 m MonitorRect = centerRect (CGRectMake(0, 0,92 CGImageGetWidth (mDockMonitor),93 CGImageGetWidth (mDockMonitor)));91 m_monitorRect = centerRect(CGRectMake(0, 0, 92 CGImageGetWidth(m_dockMonitor), 93 CGImageGetWidth(m_dockMonitor))); 94 94 } 95 95 96 if (!m DockMonitorGlossy)96 if (!m_dockMonitorGlossy) 97 97 { 98 m DockMonitorGlossy = ::darwinToCGImageRef("monitor_glossy.png");99 Assert (mDockMonitorGlossy);98 m_dockMonitorGlossy = ::darwinToCGImageRef("monitor_glossy.png"); 99 Assert(m_dockMonitorGlossy); 100 100 /* This depends on the content of monitor.png */ 101 m UpdateRect = CGRectMake (mMonitorRect.origin.x + 7 + 1,102 m MonitorRect.origin.y + 8 + 1,101 m_updateRect = CGRectMake(m_monitorRect.origin.x + 7 + 1, 102 m_monitorRect.origin.y + 8 + 1, 103 103 118 - 7 - 2, 104 104 103 - 8 - 2); … … 106 106 } 107 107 108 CGImageRef AbstractDockIconPreviewHelper::stateImage() const108 CGImageRef UIAbstractDockIconPreviewHelper::stateImage() const 109 109 { 110 110 CGImageRef img; 111 if ( m MainWnd->machineState() == KMachineState_Paused112 || m MainWnd->machineState() == KMachineState_TeleportingPausedVM)113 img = m StatePaused;114 else if ( m MainWnd->machineState() == KMachineState_Restoring115 || m MainWnd->machineState() == KMachineState_TeleportingIn)116 img = m StateRestoring;117 else if ( m MainWnd->machineState() == KMachineState_Saving118 || m MainWnd->machineState() == KMachineState_LiveSnapshotting)119 img = m StateSaving;111 if ( m_pSession->machineState() == KMachineState_Paused 112 || m_pSession->machineState() == KMachineState_TeleportingPausedVM) 113 img = m_statePaused; 114 else if ( m_pSession->machineState() == KMachineState_Restoring 115 || m_pSession->machineState() == KMachineState_TeleportingIn) 116 img = m_stateRestoring; 117 else if ( m_pSession->machineState() == KMachineState_Saving 118 || m_pSession->machineState() == KMachineState_LiveSnapshotting) 119 img = m_stateSaving; 120 120 else 121 121 img = NULL; … … 123 123 } 124 124 125 void AbstractDockIconPreviewHelper::drawOverlayIcons (CGContextRef aContext)125 void UIAbstractDockIconPreviewHelper::drawOverlayIcons(CGContextRef context) 126 126 { 127 CGRect overlayRect = CGRectMake 127 CGRect overlayRect = CGRectMake(0, 0, 0, 0); 128 128 /* The overlay image at bottom/right */ 129 if (m OverlayImage)129 if (m_overlayImage) 130 130 { 131 overlayRect = CGRectMake (mDockIconRect.size.width - CGImageGetWidth (mOverlayImage),132 mDockIconRect.size.height - CGImageGetHeight (mOverlayImage),133 CGImageGetWidth (mOverlayImage),134 CGImageGetHeight (mOverlayImage));135 CGContextDrawImage (aContext, flipRect (overlayRect), mOverlayImage);131 overlayRect = CGRectMake(m_dockIconRect.size.width - CGImageGetWidth(m_overlayImage), 132 m_dockIconRect.size.height - CGImageGetHeight(m_overlayImage), 133 CGImageGetWidth(m_overlayImage), 134 CGImageGetHeight(m_overlayImage)); 135 CGContextDrawImage(context, flipRect(overlayRect), m_overlayImage); 136 136 } 137 137 CGImageRef sImage = stateImage(); … … 139 139 if (sImage) 140 140 { 141 CGRect stateRect = CGRectMake (overlayRect.origin.x - CGImageGetWidth(sImage) / 2.0,142 overlayRect.origin.y - CGImageGetHeight(sImage) / 2.0,143 CGImageGetWidth(sImage),144 CGImageGetHeight(sImage));145 CGContextDrawImage (aContext, flipRect(stateRect), sImage);141 CGRect stateRect = CGRectMake(overlayRect.origin.x - CGImageGetWidth(sImage) / 2.0, 142 overlayRect.origin.y - CGImageGetHeight(sImage) / 2.0, 143 CGImageGetWidth(sImage), 144 CGImageGetHeight(sImage)); 145 CGContextDrawImage(context, flipRect(stateRect), sImage); 146 146 } 147 147 } -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/UIAbstractDockIconPreview.h
r27154 r27215 22 22 */ 23 23 24 #ifndef ___ AbstractVBoxDockIconPreview_h___25 #define ___ AbstractVBoxDockIconPreview_h___24 #ifndef ___UIAbstractDockIconPreview_h___ 25 #define ___UIAbstractDockIconPreview_h___ 26 26 27 27 /* System includes */ … … 31 31 #include "VBoxUtils-darwin.h" 32 32 33 class VBoxConsoleWnd;34 class VBoxFrameBuffer;33 class UISession; 34 class UIFrameBuffer; 35 35 36 36 class QPixmap; 37 37 38 class AbstractDockIconPreview38 class UIAbstractDockIconPreview 39 39 { 40 40 public: 41 AbstractDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);42 virtual ~ AbstractDockIconPreview() {};41 UIAbstractDockIconPreview(UISession *pSession, const QPixmap& overlayImage); 42 virtual ~UIAbstractDockIconPreview() {}; 43 43 44 44 virtual void updateDockOverlay() = 0; 45 virtual void updateDockPreview (CGImageRef aVMImage) = 0;46 virtual void updateDockPreview (VBoxFrameBuffer *aFrameBuffer);45 virtual void updateDockPreview(CGImageRef VMImage) = 0; 46 virtual void updateDockPreview(UIFrameBuffer *pFrameBuffer); 47 47 48 virtual void setOriginalSize 48 virtual void setOriginalSize(int /* aWidth */, int /* aHeight */) {} 49 49 }; 50 50 51 class AbstractDockIconPreviewHelper51 class UIAbstractDockIconPreviewHelper 52 52 { 53 53 public: 54 AbstractDockIconPreviewHelper (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);55 virtual ~ AbstractDockIconPreviewHelper();54 UIAbstractDockIconPreviewHelper(UISession *pSession, const QPixmap& overlayImage); 55 virtual ~UIAbstractDockIconPreviewHelper(); 56 56 void initPreviewImages(); 57 57 inline CGImageRef stateImage() const; 58 void drawOverlayIcons (CGContextRef aContext);58 void drawOverlayIcons(CGContextRef context); 59 59 60 60 /* Flipping is necessary cause the drawing context in Carbon is flipped by 180 degree */ 61 inline CGRect flipRect (CGRect aRect) const { return ::darwinFlipCGRect (aRect, mDockIconRect); }62 inline CGRect centerRect (CGRect aRect) const { return ::darwinCenterRectTo (aRect, mDockIconRect); }63 inline CGRect centerRectTo (CGRect aRect, const CGRect& aToRect) const { return ::darwinCenterRectTo (aRect, aToRect); }61 inline CGRect flipRect(CGRect rect) const { return ::darwinFlipCGRect(rect, m_dockIconRect); } 62 inline CGRect centerRect(CGRect rect) const { return ::darwinCenterRectTo(rect, m_dockIconRect); } 63 inline CGRect centerRectTo(CGRect rect, const CGRect& toRect) const { return ::darwinCenterRectTo(rect, toRect); } 64 64 65 65 /* Private member vars */ 66 VBoxConsoleWnd *mMainWnd;67 const CGRect m DockIconRect;66 UISession *m_pSession; 67 const CGRect m_dockIconRect; 68 68 69 CGImageRef m OverlayImage;70 CGImageRef m DockMonitor;71 CGImageRef m DockMonitorGlossy;69 CGImageRef m_overlayImage; 70 CGImageRef m_dockMonitor; 71 CGImageRef m_dockMonitorGlossy; 72 72 73 CGImageRef m StatePaused;74 CGImageRef m StateSaving;75 CGImageRef m StateRestoring;73 CGImageRef m_statePaused; 74 CGImageRef m_stateSaving; 75 CGImageRef m_stateRestoring; 76 76 77 CGRect m UpdateRect;78 CGRect m MonitorRect;77 CGRect m_updateRect; 78 CGRect m_monitorRect; 79 79 }; 80 80 81 #endif /* ___ AbstractVBoxDockIconPreview_h___ */81 #endif /* ___UIAbstractDockIconPreview_h___ */ 82 82 -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/UICocoaDockIconPreview.h
r27154 r27215 3 3 * 4 4 * VBox frontends: Qt GUI ("VirtualBox"): 5 * CocoaDockIconPreview class declaration5 * UICocoaDockIconPreview class declaration 6 6 */ 7 7 … … 22 22 */ 23 23 24 #ifndef ___ CocoaDockIconPreview_h___25 #define ___ CocoaDockIconPreview_h___24 #ifndef ___UICocoaDockIconPreview_h___ 25 #define ___UICocoaDockIconPreview_h___ 26 26 27 27 /* Qt includes */ 28 #include " AbstractDockIconPreview.h"28 #include "UIAbstractDockIconPreview.h" 29 29 30 class CocoaDockIconPreviewPrivate;30 class UICocoaDockIconPreviewPrivate; 31 31 32 class CocoaDockIconPreview: publicAbstractDockIconPreview32 class UICocoaDockIconPreview: public UIAbstractDockIconPreview 33 33 { 34 34 public: 35 CocoaDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage);36 ~ CocoaDockIconPreview();35 UICocoaDockIconPreview(UISession *pSession, const QPixmap& overlayImage); 36 ~UICocoaDockIconPreview(); 37 37 38 38 virtual void updateDockOverlay(); 39 virtual void updateDockPreview (CGImageRef aVMImage);40 virtual void updateDockPreview (VBoxFrameBuffer *aFrameBuffer);39 virtual void updateDockPreview(CGImageRef VMImage); 40 virtual void updateDockPreview(UIFrameBuffer *pFrameBuffer); 41 41 42 virtual void setOriginalSize 42 virtual void setOriginalSize(int aWidth, int aHeight); 43 43 44 44 private: 45 CocoaDockIconPreviewPrivate *d;45 UICocoaDockIconPreviewPrivate *d; 46 46 }; 47 47 48 #endif /* ___ CocoaDockIconPreview_h___ */48 #endif /* ___UICocoaDockIconPreview_h___ */ 49 49 -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/UICocoaDockIconPreview.mm
r27154 r27215 23 23 24 24 /* VBox includes */ 25 #include " CocoaDockIconPreview.h"25 #include "UICocoaDockIconPreview.h" 26 26 #include "VBoxCocoaHelper.h" 27 27 … … 29 29 #import <Cocoa/Cocoa.h> 30 30 31 @interface DockTileMonitor: NSView32 { 33 CocoaDockIconPreviewPrivate *p;31 @interface UIDockTileMonitor: NSView 32 { 33 UICocoaDockIconPreviewPrivate *p; 34 34 35 35 NSImageView *mScreenContent; 36 36 NSImageView *mMonitorGlossy; 37 37 } 38 - (id)initWithFrame:(NSRect)frame parent:( CocoaDockIconPreviewPrivate*)parent;38 - (id)initWithFrame:(NSRect)frame parent:(UICocoaDockIconPreviewPrivate*)parent; 39 39 - (NSImageView*)screenContent; 40 40 - (void)resize:(NSSize)size; 41 41 @end 42 42 43 @interface DockTileOverlay: NSView44 { 45 CocoaDockIconPreviewPrivate *p;46 } 47 - (id)initWithFrame:(NSRect)frame parent:( CocoaDockIconPreviewPrivate*)parent;48 @end 49 50 @interface DockTile: NSView51 { 52 CocoaDockIconPreviewPrivate *p;53 54 DockTileMonitor *mMonitor;43 @interface UIDockTileOverlay: NSView 44 { 45 UICocoaDockIconPreviewPrivate *p; 46 } 47 - (id)initWithFrame:(NSRect)frame parent:(UICocoaDockIconPreviewPrivate*)parent; 48 @end 49 50 @interface UIDockTile: NSView 51 { 52 UICocoaDockIconPreviewPrivate *p; 53 54 UIDockTileMonitor *mMonitor; 55 55 NSImageView *mAppIcon; 56 56 57 DockTileOverlay *mOverlay;58 } 59 - (id)initWithParent:( CocoaDockIconPreviewPrivate*)parent;57 UIDockTileOverlay *mOverlay; 58 } 59 - (id)initWithParent:(UICocoaDockIconPreviewPrivate*)parent; 60 60 - (NSView*)screenContent; 61 61 - (void)cleanup; … … 71 71 * from any Cocoa class. 72 72 */ 73 class CocoaDockIconPreviewPrivate: publicAbstractDockIconPreviewHelper73 class UICocoaDockIconPreviewPrivate: public UIAbstractDockIconPreviewHelper 74 74 { 75 75 public: 76 inline CocoaDockIconPreviewPrivate (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage)77 : AbstractDockIconPreviewHelper (aMainWnd, aOverlayImage)78 { 79 m DockTile = [[DockTile alloc] initWithParent:this];80 } 81 82 inline ~ CocoaDockIconPreviewPrivate()83 { 84 [m DockTile release];76 inline UICocoaDockIconPreviewPrivate(UISession *pSession, const QPixmap& overlayImage) 77 :UIAbstractDockIconPreviewHelper(pSession, overlayImage) 78 { 79 mUIDockTile = [[UIDockTile alloc] initWithParent:this]; 80 } 81 82 inline ~UICocoaDockIconPreviewPrivate() 83 { 84 [mUIDockTile release]; 85 85 } 86 86 87 DockTile *mDockTile;87 UIDockTile *mUIDockTile; 88 88 }; 89 89 … … 91 91 * Cocoa wrapper for the abstract dock icon preview class 92 92 */ 93 CocoaDockIconPreview::CocoaDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage)94 : AbstractDockIconPreview (aMainWnd, aOverlayImage)95 { 96 CocoaAutoreleasePool pool; 97 98 d = new CocoaDockIconPreviewPrivate (aMainWnd, aOverlayImage);99 } 100 101 CocoaDockIconPreview::~CocoaDockIconPreview()93 UICocoaDockIconPreview::UICocoaDockIconPreview(UISession *pSession, const QPixmap& overlayImage) 94 : UIAbstractDockIconPreview(pSession, overlayImage) 95 { 96 CocoaAutoreleasePool pool; 97 98 d = new UICocoaDockIconPreviewPrivate(pSession, overlayImage); 99 } 100 101 UICocoaDockIconPreview::~UICocoaDockIconPreview() 102 102 { 103 103 CocoaAutoreleasePool pool; … … 106 106 } 107 107 108 void CocoaDockIconPreview::updateDockOverlay() 109 { 110 CocoaAutoreleasePool pool; 111 112 [d->mDockTile updateAppIcon]; 113 } 114 115 void CocoaDockIconPreview::updateDockPreview (CGImageRef aVMImage) 116 { 117 CocoaAutoreleasePool pool; 118 119 [d->mDockTile updateMonitorWithImage:aVMImage]; 120 } 121 122 void CocoaDockIconPreview::updateDockPreview (VBoxFrameBuffer *aFrameBuffer) 123 { 124 CocoaAutoreleasePool pool; 125 126 AbstractDockIconPreview::updateDockPreview (aFrameBuffer); 127 } 128 129 130 void CocoaDockIconPreview::setOriginalSize (int aWidth, int aHeight) 131 { 132 CocoaAutoreleasePool pool; 133 134 [d->mDockTile resizeMonitor:NSMakeSize (aWidth, aHeight)]; 108 void UICocoaDockIconPreview::updateDockOverlay() 109 { 110 CocoaAutoreleasePool pool; 111 112 [d->mUIDockTile updateAppIcon]; 113 } 114 115 void UICocoaDockIconPreview::updateDockPreview(CGImageRef VMImage) 116 { 117 CocoaAutoreleasePool pool; 118 119 [d->mUIDockTile updateMonitorWithImage:VMImage]; 120 } 121 122 void UICocoaDockIconPreview::updateDockPreview(UIFrameBuffer *pFrameBuffer) 123 { 124 CocoaAutoreleasePool pool; 125 126 UIAbstractDockIconPreview::updateDockPreview(pFrameBuffer); 127 } 128 129 void UICocoaDockIconPreview::setOriginalSize(int width, int height) 130 { 131 CocoaAutoreleasePool pool; 132 133 [d->mUIDockTile resizeMonitor:NSMakeSize(width, height)]; 135 134 } 136 135 … … 138 137 * Class for arranging/updating the layers for the glossy monitor preview. 139 138 */ 140 @implementation DockTileMonitor;141 - (id)initWithFrame:(NSRect)frame parent:( CocoaDockIconPreviewPrivate*)parent139 @implementation UIDockTileMonitor; 140 - (id)initWithFrame:(NSRect)frame parent:(UICocoaDockIconPreviewPrivate*)parent 142 141 { 143 142 self = [super initWithFrame:frame]; … … 147 146 p = parent; 148 147 /* The screen content view */ 149 mScreenContent = [[NSImageView alloc] initWithFrame:NSRectFromCGRect (p->flipRect (p->mUpdateRect))];148 mScreenContent = [[NSImageView alloc] initWithFrame:NSRectFromCGRect(p->flipRect(p->m_updateRect))]; 150 149 // [mScreenContent setImageAlignment: NSImageAlignCenter]; 151 150 [mScreenContent setImageAlignment: NSImageAlignTop| NSImageAlignLeft]; … … 153 152 [self addSubview: mScreenContent]; 154 153 /* The state view */ 155 mMonitorGlossy = [[NSImageView alloc] initWithFrame:NSRectFromCGRect (p->flipRect (p->mMonitorRect))];156 [mMonitorGlossy setImage: darwinCGImageToNSImage (p->m DockMonitorGlossy)];154 mMonitorGlossy = [[NSImageView alloc] initWithFrame:NSRectFromCGRect(p->flipRect(p->m_monitorRect))]; 155 [mMonitorGlossy setImage: darwinCGImageToNSImage (p->m_dockMonitorGlossy)]; 157 156 [self addSubview: mMonitorGlossy]; 158 157 } … … 163 162 - (void)drawRect:(NSRect)aRect; 164 163 { 165 NSImage *dockMonitor = darwinCGImageToNSImage (p->mDockMonitor);166 [dockMonitor drawInRect:NSRectFromCGRect (p->flipRect (p->mMonitorRect)) fromRect:aRect operation:NSCompositeSourceOver fraction:1.0];164 NSImage *dockMonitor = darwinCGImageToNSImage(p->m_dockMonitor); 165 [dockMonitor drawInRect:NSRectFromCGRect(p->flipRect(p->m_monitorRect)) fromRect:aRect operation:NSCompositeSourceOver fraction:1.0]; 167 166 [dockMonitor release]; 168 167 } … … 180 179 if (size.width > size.height) 181 180 { 182 w = p->m UpdateRect.size.width;183 h = ((float)size.height / size.width * p->m UpdateRect.size.height);181 w = p->m_updateRect.size.width; 182 h = ((float)size.height / size.width * p->m_updateRect.size.height); 184 183 } 185 184 else 186 185 { 187 w = ((float)size.width / size.height * p->m UpdateRect.size.width);188 h = p->m UpdateRect.size.height;189 } 190 CGRect r = (p->flipRect (p->centerRectTo (CGRectMake (0, 0, (int)w, (int)h), p->m UpdateRect)));186 w = ((float)size.width / size.height * p->m_updateRect.size.width); 187 h = p->m_updateRect.size.height; 188 } 189 CGRect r = (p->flipRect (p->centerRectTo (CGRectMake (0, 0, (int)w, (int)h), p->m_updateRect))); 191 190 r.origin.x = (int)r.origin.x; 192 191 r.origin.y = (int)r.origin.y; … … 203 202 * in the application icon & preview mode. 204 203 */ 205 @implementation DockTileOverlay206 - (id)initWithFrame:(NSRect)frame parent:( CocoaDockIconPreviewPrivate*)parent204 @implementation UIDockTileOverlay 205 - (id)initWithFrame:(NSRect)frame parent:(UICocoaDockIconPreviewPrivate*)parent 207 206 { 208 207 self = [super initWithFrame:frame]; … … 226 225 * and preview mode & forwards all update request to the appropriate methods. 227 226 */ 228 @implementation DockTile229 - (id)initWithParent:( CocoaDockIconPreviewPrivate*)parent227 @implementation UIDockTile 228 - (id)initWithParent:(UICocoaDockIconPreviewPrivate*)parent 230 229 { 231 230 self = [super init]; … … 240 239 [self restoreAppIcon]; 241 240 /* The overlay */ 242 mOverlay = [[ DockTileOverlay alloc] initWithFrame:NSRectFromCGRect(p->flipRect (p->mDockIconRect)) parent:p];241 mOverlay = [[UIDockTileOverlay alloc] initWithFrame:NSRectFromCGRect(p->flipRect (p->m_dockIconRect)) parent:p]; 243 242 [self addSubview: mOverlay]; 244 243 } … … 273 272 { 274 273 [self cleanup]; 275 mAppIcon = [[NSImageView alloc] initWithFrame:NSRectFromCGRect (p->flipRect (p->m DockIconRect))];274 mAppIcon = [[NSImageView alloc] initWithFrame:NSRectFromCGRect (p->flipRect (p->m_dockIconRect))]; 276 275 [mAppIcon setImage: [NSImage imageNamed:@"NSApplicationIcon"]]; 277 276 [self addSubview: mAppIcon positioned:NSWindowBelow relativeTo:mOverlay]; … … 291 290 p->initPreviewImages(); 292 291 [self cleanup]; 293 mMonitor = [[ DockTileMonitor alloc] initWithFrame:NSRectFromCGRect (p->flipRect (p->mDockIconRect)) parent:p];292 mMonitor = [[UIDockTileMonitor alloc] initWithFrame:NSRectFromCGRect (p->flipRect (p->m_dockIconRect)) parent:p]; 294 293 [self addSubview: mMonitor positioned:NSWindowBelow relativeTo:mOverlay]; 295 294 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp
r26714 r27215 56 56 #ifdef Q_WS_MAC 57 57 const char* VBoxDefs::GUI_RealtimeDockIconUpdateEnabled = "GUI/RealtimeDockIconUpdateEnabled"; 58 const char* VBoxDefs::GUI_RealtimeDockIconUpdateMonitor = "GUI/RealtimeDockIconUpdateMonitor"; 58 59 const char* VBoxDefs::GUI_PresentationModeEnabled = "GUI/PresentationModeEnabled"; 59 60 #endif /* Q_WS_MAC */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
r26790 r27215 174 174 #ifdef Q_WS_MAC 175 175 static const char* GUI_RealtimeDockIconUpdateEnabled; 176 static const char* GUI_RealtimeDockIconUpdateMonitor; 176 177 static const char* GUI_PresentationModeEnabled; 177 178 #endif /* Q_WS_MAC */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r27096 r27215 35 35 36 36 #ifdef VBOX_WITH_NEW_RUNTIME_CORE 37 #include "UIMachine.h" 37 # include "UIMachine.h" 38 # include "UISession.h" 38 39 #endif 39 40 #ifdef VBOX_WITH_REGISTRATION 40 # include "UIRegistrationWzd.h"41 # include "UIRegistrationWzd.h" 41 42 #endif 42 43 #include "VBoxUpdateDlg.h" … … 395 396 else if (mGlobal.isVMConsoleProcess()) 396 397 { 397 #ifndef VBOX_WITH_NEW_RUNTIME_CORE398 /* TODO_NEW_CORE */399 398 /* Check for the currently running machine */ 400 CMachine machine = mGlobal.consoleWnd().session().GetMachine(); 401 if (QString::fromUtf16(id) == machine.GetId()) 399 if (QString::fromUtf16(id) == mGlobal.vmUuid) 402 400 { 403 401 QString strKey = QString::fromUtf16(key); 404 402 QString strVal = QString::fromUtf16(value); 405 if (strKey == VBoxDefs::GUI_RealtimeDockIconUpdateEnabled) 403 // TODO_NEW_CORE: we should cleanup 404 // VBoxChangeDockIconUpdateEvent to have no parameters. So it 405 // could really be use for both events and the consumer should 406 // ask per GetExtraData how the current values are. 407 if ( strKey == VBoxDefs::GUI_RealtimeDockIconUpdateEnabled 408 || strKey == VBoxDefs::GUI_RealtimeDockIconUpdateMonitor) 406 409 { 407 410 /* Default to true if it is an empty value */ 408 QString strTest = strVal.toLower(); 409 bool f = (strTest.isEmpty() || strTest == "true"); 411 bool f = strVal.toLower() == "false" ? false : true; 410 412 QApplication::postEvent(&mGlobal, new VBoxChangeDockIconUpdateEvent(f)); 411 413 } 412 414 } 413 #endif /* VBOX_WITH_NEW_RUNTIME_CORE */414 415 } 415 416 #endif /* Q_WS_MAC */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r26952 r27215 52 52 /* Public getters: */ 53 53 QWidget* mainWindow() const; 54 UISession *uisession() const { return m_pSession; } 54 55 55 56 private slots: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r27132 r27215 38 38 #include "VBoxVMSettingsSF.h" 39 39 #include "UIFirstRunWzd.h" 40 #ifdef Q_WS_MAC 41 # include "DockIconPreview.h" 42 #endif /* Q_WS_MAC */ 40 43 41 44 //#include "VBoxDownloaderWgt.h" … … 58 61 #ifdef VBOX_WITH_DEBUGGER_GUI 59 62 # include <iprt/ldr.h> 60 #endif 63 #endif /* VBOX_WITH_DEBUGGER_GUI */ 61 64 62 65 #ifdef Q_WS_X11 63 66 # include <XKeyboard.h> 64 #endif65 66 #ifdef Q_WS_X1167 67 # include <QX11Info> 68 #endif 68 #endif /* Q_WS_X11 */ 69 69 70 70 struct MediumTarget … … 396 396 } 397 397 398 #ifdef Q_WS_MAC 399 void UIMachineLogic::updateDockIcon() 400 { 401 if (!isMachineWindowsCreated()) 402 return; 403 404 if ( m_fIsDockIconEnabled 405 && m_pDockIconPreview) 406 if(UIMachineView *pView = machineWindows().at(m_DockIconPreviewMonitor)->machineView()) 407 if (CGImageRef image = pView->vmContentImage()) 408 { 409 m_pDockIconPreview->updateDockPreview(image); 410 CGImageRelease(image); 411 } 412 } 413 #endif /* Q_WS_MAC */ 414 398 415 UIMachineLogic::UIMachineLogic(QObject *pParent, 399 416 UISession *pSession, 400 417 UIActionsPool *pActionsPool, 401 418 UIVisualStateType visualStateType) 402 : Q Object(pParent)419 : QIWithRetranslateUI3<QObject>(pParent) 403 420 , m_pSession(pSession) 404 421 , m_pActionsPool(pActionsPool) … … 409 426 , m_fIsPreventAutoStart(false) 410 427 , m_fIsPreventAutoClose(false) 428 #ifdef Q_WS_MAC 429 , m_fIsDockIconEnabled(true) 430 , m_pDockIconPreview(0) 431 , m_pDockPreviewSelectMonitorGroup(0) 432 , m_DockIconPreviewMonitor(0) 433 #endif /* Q_WS_MAC */ 411 434 { 412 435 } … … 418 441 //dbgDestroy(); 419 442 #endif 443 444 #ifdef Q_WS_MAC 445 if (m_pDockIconPreview) 446 delete m_pDockIconPreview; 447 #endif /* Q_WS_MAC */ 420 448 } 421 449 … … 429 457 m_machineWindowsList << pMachineWindow; 430 458 } 459 460 void UIMachineLogic::retranslateUi() 461 { 462 #ifdef Q_WS_MAC 463 if (m_pDockPreviewSelectMonitorGroup) 464 { 465 const QList<QAction*> &actions = m_pDockPreviewSelectMonitorGroup->actions(); 466 for (int i = 0; i < actions.size(); ++i) 467 { 468 QAction *pAction = actions.at(i); 469 pAction->setText(tr("Preview Monitor %1").arg(pAction->data().toInt() + 1)); 470 } 471 } 472 #endif /* Q_WS_MAC */ 473 } 474 475 #ifdef Q_WS_MAC 476 void UIMachineLogic::updateDockOverlay() 477 { 478 /* Only to an update to the realtime preview if this is enabled by the user 479 * & we are in an state where the framebuffer is likely valid. Otherwise to 480 * the overlay stuff only. */ 481 KMachineState state = uisession()->machineState(); 482 if (m_fIsDockIconEnabled && 483 (state == KMachineState_Running || 484 state == KMachineState_Paused || 485 state == KMachineState_Teleporting || 486 state == KMachineState_LiveSnapshotting || 487 state == KMachineState_Restoring || 488 state == KMachineState_TeleportingPausedVM || 489 state == KMachineState_TeleportingIn || 490 state == KMachineState_Saving)) 491 updateDockIcon(); 492 else if (m_pDockIconPreview) 493 m_pDockIconPreview->updateDockOverlay(); 494 } 495 #endif /* Q_WS_MAC */ 431 496 432 497 void UIMachineLogic::prepareConsoleConnections() … … 578 643 QMenu *pDockSettingsMenu = actionsPool()->action(UIActionIndex_Menu_DockSettings)->menu(); 579 644 QActionGroup *pDockPreviewModeGroup = new QActionGroup(this); 645 QAction *pDockDisablePreview = actionsPool()->action(UIActionIndex_Toggle_DockDisableMonitor); 646 pDockPreviewModeGroup->addAction(pDockDisablePreview); 580 647 QAction *pDockEnablePreviewMonitor = actionsPool()->action(UIActionIndex_Toggle_DockPreviewMonitor); 581 648 pDockPreviewModeGroup->addAction(pDockEnablePreviewMonitor); 582 QAction *pDockDisablePreview = actionsPool()->action(UIActionIndex_Toggle_DockDisableMonitor);583 pDockPreviewModeGroup->addAction(pDockDisablePreview);584 649 pDockSettingsMenu->addActions(pDockPreviewModeGroup->actions()); 585 586 pDockMenu->addMenu(pDockSettingsMenu);587 650 588 651 connect(pDockPreviewModeGroup, SIGNAL(triggered(QAction*)), 589 652 this, SLOT(sltDockPreviewModeChanged(QAction*))); 653 connect(&vboxGlobal(), SIGNAL(dockIconUpdateChanged(const VBoxChangeDockIconUpdateEvent &)), 654 this, SLOT(sltChangeDockIconUpdate(const VBoxChangeDockIconUpdateEvent &))); 655 656 /* Monitor selection if there are more than one monitor */ 657 int cGuestScreens = uisession()->session().GetMachine().GetMonitorCount(); 658 if (cGuestScreens > 1) 659 { 660 pDockSettingsMenu->addSeparator(); 661 m_DockIconPreviewMonitor = session().GetMachine().GetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateMonitor).toInt(); 662 m_pDockPreviewSelectMonitorGroup = new QActionGroup(this); 663 for (int i = 0; i < cGuestScreens; ++i) 664 { 665 QAction *pAction = new QAction(m_pDockPreviewSelectMonitorGroup); 666 pAction->setCheckable(true); 667 pAction->setData(i); 668 if (m_DockIconPreviewMonitor == i) 669 pAction->setChecked(true); 670 } 671 pDockSettingsMenu->addActions(m_pDockPreviewSelectMonitorGroup->actions()); 672 connect(m_pDockPreviewSelectMonitorGroup, SIGNAL(triggered(QAction*)), 673 this, SLOT(sltDockPreviewMonitorChanged(QAction*))); 674 } 675 676 pDockMenu->addMenu(pDockSettingsMenu); 590 677 591 678 /* Add it to the dock. */ 592 679 extern void qt_mac_set_dock_menu(QMenu *); 593 680 qt_mac_set_dock_menu(pDockMenu); 681 682 /* Now the dock icon preview */ 683 QString osTypeId = session().GetConsole().GetGuest().GetOSTypeId(); 684 m_pDockIconPreview = new UIDockIconPreview(m_pSession, vboxGlobal().vmGuestOSTypeIcon(osTypeId)); 685 686 QString strTest = session().GetMachine().GetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled).toLower(); 687 /* Default to true if it is an empty value */ 688 bool f = (strTest.isEmpty() || strTest == "true"); 689 if (f) 690 pDockEnablePreviewMonitor->setChecked(true); 691 else 692 pDockDisablePreview->setChecked(true); 693 694 /* Default to true if it is an empty value */ 695 setDockIconPreviewEnabled(f); 696 updateDockOverlay(); 594 697 } 595 698 #endif /* Q_WS_MAC */ … … 741 844 break; 742 845 } 846 847 #ifdef Q_WS_MAC 848 /* Update Dock Overlay: */ 849 updateDockOverlay(); 850 #endif /* Q_WS_MAC */ 743 851 } 744 852 … … 1434 1542 void UIMachineLogic::sltDockPreviewModeChanged(QAction *pAction) 1435 1543 { 1436 // if (mConsole) 1437 { 1438 CMachine machine = m_pSession->session().GetMachine(); 1439 if (!machine.isNull()) 1440 { 1441 if (pAction == actionsPool()->action(UIActionIndex_Toggle_DockDisableMonitor)) 1442 machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled, "false"); 1443 else if (pAction == actionsPool()->action(UIActionIndex_Toggle_DockPreviewMonitor)) 1444 machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled, "true"); 1445 // mConsole->updateDockOverlay(); 1446 } 1544 CMachine machine = m_pSession->session().GetMachine(); 1545 if (!machine.isNull()) 1546 { 1547 bool fEnabled = true; 1548 if (pAction == actionsPool()->action(UIActionIndex_Toggle_DockDisableMonitor)) 1549 fEnabled = false; 1550 1551 machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled, fEnabled ? "true" : "false"); 1552 updateDockOverlay(); 1553 } 1554 } 1555 1556 void UIMachineLogic::sltDockPreviewMonitorChanged(QAction *pAction) 1557 { 1558 CMachine machine = m_pSession->session().GetMachine(); 1559 if (!machine.isNull()) 1560 { 1561 int monitor = pAction->data().toInt(); 1562 machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateMonitor, QString::number(monitor)); 1563 updateDockOverlay(); 1564 } 1565 } 1566 1567 void UIMachineLogic::sltChangeDockIconUpdate(const VBoxChangeDockIconUpdateEvent &event) 1568 { 1569 if (isMachineWindowsCreated()) 1570 { 1571 setDockIconPreviewEnabled(event.mChanged); 1572 m_pDockPreviewSelectMonitorGroup->setEnabled(event.mChanged); 1573 m_DockIconPreviewMonitor = session().GetMachine().GetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateMonitor).toInt(); 1574 updateDockOverlay(); 1447 1575 } 1448 1576 } … … 1612 1740 1613 1741 #if 0 // TODO: Where to move that? 1614 # ifdef Q_WS_MAC1615 void UIMachineLogic::fadeToBlack()1616 {1617 /* Fade to black */1618 CGAcquireDisplayFadeReservation (kCGMaxDisplayReservationInterval, &mFadeToken);1619 CGDisplayFade (mFadeToken, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, true);1620 }1621 void UIMachineLogic::fadeToNormal()1622 {1623 /* Fade back to the normal gamma */1624 CGDisplayFade (mFadeToken, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, false);1625 CGReleaseDisplayFadeReservation (mFadeToken);1626 mConsole->setMouseCoalescingEnabled (true);1627 }1628 # endif1629 bool UIMachineLogic::toggleFullscreenMode (bool fOn, bool fSeamless)1630 {1631 /* Please note: For some platforms like the Mac, the calling order of the1632 * functions in this methods is vital. So please be careful on changing1633 * this. */1634 1635 QSize initialSize = size();1636 if (fSeamless || mConsole->isAutoresizeGuestActive())1637 {1638 QRect screen = fSeamless ?1639 QApplication::desktop()->availableGeometry (this) :1640 QApplication::desktop()->screenGeometry (this);1641 ULONG64 availBits = mSession.GetMachine().GetVRAMSize() /* vram */1642 * _1M /* mb to bytes */1643 * 8; /* to bits */1644 ULONG guestBpp = mConsole->console().GetDisplay().GetBitsPerPixel();1645 ULONG64 usedBits = (screen.width() /* display width */1646 * screen.height() /* display height */1647 * guestBpp1648 + _1M * 8) /* current cache per screen - may be changed in future */1649 * mSession.GetMachine().GetMonitorCount() /**< @todo fix assumption that all screens have same resolution */1650 + 4096 * 8; /* adapter info */1651 if (fOn && (availBits < usedBits))1652 {1653 if (fSeamless)1654 {1655 vboxProblem().cannotEnterSeamlessMode (1656 screen.width(), screen.height(), guestBpp,1657 (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);1658 return false;1659 }1660 else1661 {1662 int result = vboxProblem().cannotEnterFullscreenMode (1663 screen.width(), screen.height(), guestBpp,1664 (((usedBits + 7) / 8 + _1M - 1) / _1M) * _1M);1665 if (result == QIMessageBox::Cancel)1666 return false;1667 }1668 }1669 }1670 1671 AssertReturn (mConsole, false);1672 AssertReturn ((mHiddenChildren.empty() == fOn), false);1673 AssertReturn ((fSeamless && mIsSeamless != fOn) ||1674 (!fSeamless && mIsFullscreen != fOn), false);1675 if (fOn)1676 AssertReturn ((fSeamless && !mIsFullscreen) ||1677 (!fSeamless && !mIsSeamless), false);1678 1679 if (fOn)1680 {1681 /* Take the toggle hot key from the menu item. Since1682 * VBoxGlobal::extractKeyFromActionText gets exactly the1683 * linked key without the 'Host+' part we are adding it here. */1684 QString hotKey = QString ("Host+%1")1685 .arg (VBoxGlobal::extractKeyFromActionText (fSeamless ?1686 mVmSeamlessAction->text() : mVmFullscreenAction->text()));1687 1688 Assert (!hotKey.isEmpty());1689 1690 /* Show the info message. */1691 bool ok = fSeamless ?1692 vboxProblem().confirmGoingSeamless (hotKey) :1693 vboxProblem().confirmGoingFullscreen (hotKey);1694 if (!ok)1695 return false;1696 }1697 1698 #ifdef Q_WS_MAC1699 if (!fSeamless)1700 {1701 }1702 #endif1703 1704 if (fSeamless)1705 {1706 /* Activate the auto-resize feature required for the seamless mode. */1707 if (!mVmAutoresizeGuestAction->isChecked())1708 mVmAutoresizeGuestAction->setChecked (true);1709 1710 /* Activate the mouse integration feature for the seamless mode. */1711 if (mVmDisableMouseIntegrAction->isChecked())1712 mVmDisableMouseIntegrAction->setChecked (false);1713 1714 mVmAdjustWindowAction->setEnabled (!fOn);1715 mVmFullscreenAction->setEnabled (!fOn);1716 mVmAutoresizeGuestAction->setEnabled (!fOn);1717 mVmDisableMouseIntegrAction->setEnabled (!fOn);1718 1719 mConsole->console().GetDisplay().SetSeamlessMode (fOn);1720 mIsSeamless = fOn;1721 }1722 else1723 {1724 mIsFullscreen = fOn;1725 mVmAdjustWindowAction->setEnabled (!fOn);1726 mVmSeamlessAction->setEnabled (!fOn && m_fIsGuestSupportsSeamless && m_fIsGuestSupportsGraphics);1727 }1728 1729 bool wasHidden = isHidden();1730 1731 /* Temporarily disable the mode-related action to make sure1732 * user can not leave the mode before he enter it and inside out. */1733 fSeamless ? mVmSeamlessAction->setEnabled (false) :1734 mVmFullscreenAction->setEnabled (false);1735 1736 /* Calculate initial console size */1737 QSize consoleSize;1738 1739 if (fOn)1740 {1741 consoleSize = mConsole->frameSize();1742 consoleSize -= QSize (mConsole->frameWidth() * 2, mConsole->frameWidth() * 2);1743 1744 /* Toggle console to manual resize mode. */1745 mConsole->setIgnoreMainwndResize (true);1746 1747 /* Memorize the maximized state. */1748 QDesktopWidget *dtw = QApplication::desktop();1749 mWasMax = isWindowMaximized() &&1750 dtw->availableGeometry().width() == frameSize().width() &&1751 dtw->availableGeometry().height() == frameSize().height();1752 1753 /* Save the previous scroll-view minimum size before entering1754 * fullscreen/seamless state to restore this minimum size before1755 * the exiting fullscreen. Required for correct scroll-view and1756 * guest display update in SDL mode. */1757 mPrevMinSize = mConsole->minimumSize();1758 mConsole->setMinimumSize (0, 0);1759 1760 /* let the widget take the whole available desktop space */1761 QRect scrGeo = fSeamless ?1762 dtw->availableGeometry (this) : dtw->screenGeometry (this);1763 1764 /* It isn't guaranteed that the guest os set the video mode that1765 * we requested. So after all the resizing stuff set the clipping1766 * mask and the spacing shifter to the corresponding values. */1767 if (fSeamless)1768 setViewInSeamlessMode (scrGeo);1769 1770 #ifdef Q_WS_WIN1771 mPrevRegion = dtw->screenGeometry (this);1772 #endif1773 1774 /* Hide all but the central widget containing the console view. */1775 QList <QWidget*> list (findChildren <QWidget*> ());1776 QList <QWidget*> excludes;1777 excludes << centralWidget() << centralWidget()->findChildren <QWidget*> ();1778 foreach (QWidget *w, list)1779 {1780 if (!excludes.contains (w))1781 {1782 if (!w->isHidden())1783 {1784 w->hide();1785 mHiddenChildren.append (w);1786 }1787 }1788 }1789 1790 /* Adjust colors and appearance. */1791 mErasePalette = centralWidget()->palette();1792 QPalette palette(mErasePalette);1793 palette.setColor (centralWidget()->backgroundRole(), Qt::black);1794 centralWidget()->setPalette (palette);1795 centralWidget()->setAutoFillBackground (!fSeamless);1796 mConsoleStyle = mConsole->frameStyle();1797 mConsole->setFrameStyle (QFrame::NoFrame);1798 mConsole->setMaximumSize (scrGeo.size());1799 mConsole->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);1800 mConsole->setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);1801 }1802 else1803 {1804 /* Reset the shifting spacers. */1805 mShiftingSpacerLeft->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);1806 mShiftingSpacerTop->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);1807 mShiftingSpacerRight->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);1808 mShiftingSpacerBottom->changeSize (0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);1809 1810 /* Restore the previous scroll-view minimum size before the exiting1811 * fullscreen. Required for correct scroll-view and guest display1812 * update in SDL mode. */1813 mConsole->setMinimumSize (mPrevMinSize);1814 1815 #ifdef Q_WS_MAC1816 if (fSeamless)1817 {1818 /* Please note: All the stuff below has to be done before the1819 * window switch back to normal size. Qt changes the winId on the1820 * fullscreen switch and make this stuff useless with the old1821 * winId. So please be careful on rearrangement of the method1822 * calls. */1823 /* Undo all mac specific installations */1824 ::darwinSetShowsWindowTransparent (this, false);1825 }1826 #endif1827 1828 /* Adjust colors and appearance. */1829 clearMask();1830 centralWidget()->setPalette (mErasePalette);1831 centralWidget()->setAutoFillBackground (false);1832 mConsole->setFrameStyle (mConsoleStyle);1833 mConsole->setMaximumSize (mConsole->sizeHint());1834 mConsole->setHorizontalScrollBarPolicy (Qt::ScrollBarAsNeeded);1835 mConsole->setVerticalScrollBarPolicy (Qt::ScrollBarAsNeeded);1836 1837 /* Show everything hidden when going fullscreen. */1838 foreach (QPointer <QWidget> child, mHiddenChildren)1839 if (child) child->show();1840 mHiddenChildren.clear();1841 }1842 1843 /* Set flag for waiting host resize if it awaited during mode entering */1844 if ((mIsFullscreen || mIsSeamless) && (consoleSize != initialSize))1845 mIsWaitingModeResize = true;1846 1847 if (!fOn)1848 {1849 /* Animation takes a bit long, the mini toolbar is still disappearing1850 * when switched to normal mode so hide it completely */1851 mMiniToolBar->hide();1852 mMiniToolBar->updateDisplay (false, true);1853 }1854 1855 /* Toggle qt full-screen mode */1856 switchToFullscreen (fOn, fSeamless);1857 1858 if (fOn)1859 {1860 mMiniToolBar->setSeamlessMode (fSeamless);1861 mMiniToolBar->updateDisplay (true, true);1862 }1863 1864 #ifdef Q_WS_MAC1865 if (fOn && fSeamless)1866 {1867 /* Please note: All the stuff below has to be done after the window has1868 * switched to fullscreen. Qt changes the winId on the fullscreen1869 * switch and make this stuff useless with the old winId. So please be1870 * careful on rearrangement of the method calls. */1871 ::darwinSetShowsWindowTransparent (this, true);1872 }1873 #endif1874 1875 /* Send guest size hint */1876 mConsole->toggleFSMode (consoleSize);1877 1878 /* Process all console attributes changes and sub-widget hidings */1879 qApp->processEvents();1880 1881 if (!mIsWaitingModeResize)1882 onExitFullscreen();1883 1884 /* Unlock FS actions locked during modes toggling */1885 QTimer::singleShot (300, this, SLOT (unlockActionsSwitch()));1886 1887 #ifdef Q_WS_MAC /* wasHidden is wrong on the mac it seems. */1888 /** @todo figure out what is really wrong here... */1889 if (!wasHidden)1890 show();1891 #else1892 if (wasHidden)1893 hide();1894 #endif1895 return true;1896 }1897 void UIMachineLogic::switchToFullscreen (bool fOn, bool fSeamless)1898 {1899 #ifdef Q_WS_MAC1900 # ifndef QT_MAC_USE_COCOA1901 /* setWindowState removes the window group connection somehow. So save it1902 * temporary. */1903 WindowGroupRef g = GetWindowGroup (::darwinToNativeWindow (this));1904 # endif /* !QT_MAC_USE_COCOA */1905 if (fSeamless)1906 if (fOn)1907 {1908 /* Save for later restoring */1909 mNormalGeometry = geometry();1910 mSavedFlags = windowFlags();1911 /* Remove the frame from the window */1912 const QRect fullscreen (qApp->desktop()->screenGeometry (qApp->desktop()->screenNumber (this)));1913 setParent (0, Qt::Window | Qt::FramelessWindowHint | (windowFlags() & 0xffff0000));1914 setGeometry (fullscreen);1915 /* Set it maximized */1916 setWindowState (windowState() ^ Qt::WindowMaximized);1917 }1918 else1919 {1920 /* Restore old values */1921 setParent (0, mSavedFlags);1922 setGeometry (mNormalGeometry);1923 }1924 else1925 {1926 /* Here we are going really fullscreen */1927 setWindowState (windowState() ^ Qt::WindowFullScreen);1928 sltChangePresentationMode (VBoxChangePresentationModeEvent(fOn));1929 }1930 1931 # ifndef QT_MAC_USE_COCOA1932 /* Reassign the correct window group. */1933 SetWindowGroup (::darwinToNativeWindow (this), g);1934 # endif /* !QT_MAC_USE_COCOA */1935 #else1936 NOREF (fOn);1937 NOREF (fSeamless);1938 setWindowState (windowState() ^ Qt::WindowFullScreen);1939 #endif1940 }1941 1742 void UIMachineLogic::setViewInSeamlessMode (const QRect &aTargetRect) 1942 1743 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r27180 r27215 24 24 #define __UIMachineLogic_h__ 25 25 26 /* Global includes */27 #include <QObject>28 29 26 /* Local includes */ 30 27 #include "UIMachineDefs.h" 28 #include <QIWithRetranslateUI.h> 31 29 #ifdef VBOX_WITH_DEBUGGER_GUI 32 30 # include <VBox/dbggui.h> … … 46 44 class UIActionsPool; 47 45 class UIMachineWindow; 48 49 class UIMachineLogic : public QObject 46 class UIDockIconPreview; 47 class VBoxChangeDockIconUpdateEvent; 48 49 class UIMachineLogic : public QIWithRetranslateUI3<QObject> 50 50 { 51 51 Q_OBJECT; … … 79 79 void setPreventAutoClose(bool fIsPreventAutoClose) { m_fIsPreventAutoClose = fIsPreventAutoClose; } 80 80 81 #ifdef Q_WS_MAC 82 void updateDockIcon(); 83 #endif /* Q_WS_MAC */ 84 81 85 protected: 82 86 … … 97 101 /* Protected members: */ 98 102 void addMachineWindow(UIMachineWindow *pMachineWindow); 103 void retranslateUi(); 104 #ifdef Q_WS_MAC 105 bool isDockIconPreviewEnabled() const { return m_fIsDockIconEnabled; } 106 void setDockIconPreviewEnabled(bool fIsDockIconPreviewEnabled) { m_fIsDockIconEnabled = fIsDockIconPreviewEnabled; } 107 void updateDockOverlay(); 108 #endif /* Q_WS_MAC */ 99 109 100 110 /* Prepare helpers: */ … … 161 171 #endif 162 172 163 #ifdef Q_WS_MAC173 #ifdef RT_OS_DARWIN /* Something is *really* broken in regards of the moc here */ 164 174 void sltDockPreviewModeChanged(QAction *pAction); 165 #endif /* Q_WS_MAC */ 175 void sltDockPreviewMonitorChanged(QAction *pAction); 176 void sltChangeDockIconUpdate(const VBoxChangeDockIconUpdateEvent &event); 177 #endif /* RT_OS_DARWIN */ 166 178 167 179 private: … … 197 209 #endif 198 210 211 #ifdef Q_WS_MAC 212 bool m_fIsDockIconEnabled; 213 UIDockIconPreview *m_pDockIconPreview; 214 QActionGroup *m_pDockPreviewSelectMonitorGroup; 215 int m_DockIconPreviewMonitor; 216 #endif /* Q_WS_MAC */ 217 199 218 /* Friend classes: */ 200 219 friend class UIMachineWindow; 201 220 202 221 #if 0 // TODO: Where to move that? 203 # ifdef Q_WS_MAC204 void fadeToBlack();205 void fadeToNormal();206 # endif207 bool toggleFullscreenMode(bool aOn, bool aSeamless);208 void switchToFullscreen(bool aOn, bool aSeamless);209 222 void setViewInSeamlessMode(const QRect &aTargetRect); 210 223 #endif -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r27207 r27215 82 82 # include "DockIconPreview.h" 83 83 # include "DarwinKeyboard.h" 84 # ifdef QT_MAC_USE_COCOA 85 # include "darwin/VBoxCocoaApplication.h" 86 # else /* QT_MAC_USE_COCOA */ 87 # include <Carbon/Carbon.h> 88 # endif /* !QT_MAC_USE_COCOA */ 84 # include "darwin/VBoxCocoaApplication.h" 89 85 # include <VBox/err.h> 90 #endif /* defined (Q_WS_MAC)*/86 #endif /* Q_WS_MAC */ 91 87 92 88 class VBoxViewport: public QWidget … … 216 212 #ifdef VBOX_WITH_VIDEOHWACCEL 217 213 , m_fAccelerate2DVideo(bAccelerate2DVideo) 218 #endif 219 #if defined(Q_WS_MAC) 220 # ifndef QT_MAC_USE_COCOA 221 , m_darwinEventHandlerRef(NULL) 222 # endif /* !QT_MAC_USE_COCOA */ 214 #endif /* VBOX_WITH_VIDEOHWACCEL */ 215 #ifdef Q_WS_MAC 223 216 , m_darwinKeyModifiers(0) 224 217 , m_fKeyboardGrabbed (false) 225 , mDockIconEnabled(true) 226 #endif 218 #endif /* Q_WS_MAC */ 227 219 { 228 220 } … … 534 526 NOREF(ok); 535 527 #endif 536 537 #if defined Q_WS_MAC538 /* Dock icon update connection */539 connect(&vboxGlobal(), SIGNAL(dockIconUpdateChanged(const VBoxChangeDockIconUpdateEvent &)),540 this, SLOT(sltChangeDockIconUpdate(const VBoxChangeDockIconUpdateEvent &)));541 542 /* Overlay logo for the dock icon */543 //mVirtualBoxLogo = ::darwinToCGImageRef("VirtualBox_cube_42px.png");544 QString osTypeId = session().GetConsole().GetGuest().GetOSTypeId();545 546 // TODO_NEW_CORE547 // mDockIconPreview = new VBoxDockIconPreview(machineWindowWrapper(), vboxGlobal().vmGuestOSTypeIcon (osTypeId));548 549 # ifdef QT_MAC_USE_COCOA550 /** @todo Carbon -> Cocoa */551 # else /* !QT_MAC_USE_COCOA */552 /* Install the event handler which will proceed external window handling */553 EventHandlerUPP eventHandler = ::NewEventHandlerUPP(::darwinOverlayWindowHandler);554 EventTypeSpec eventTypes[] =555 {556 { kEventClassVBox, kEventVBoxShowWindow },557 { kEventClassVBox, kEventVBoxHideWindow },558 { kEventClassVBox, kEventVBoxMoveWindow },559 { kEventClassVBox, kEventVBoxResizeWindow },560 { kEventClassVBox, kEventVBoxDisposeWindow },561 { kEventClassVBox, kEventVBoxUpdateDock }562 };563 564 mDarwinWindowOverlayHandlerRef = NULL;565 ::InstallApplicationEventHandler(eventHandler, RT_ELEMENTS (eventTypes), &eventTypes[0], this, &mDarwinWindowOverlayHandlerRef);566 ::DisposeEventHandlerUPP(eventHandler);567 # endif /* !QT_MAC_USE_COCOA */568 #endif569 528 } 570 529 … … 628 587 m_fPassCAD = true; 629 588 } 630 631 #ifdef Q_WS_MAC632 QString strSettings = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled).toLower();633 /* Default to true if it is an empty value: */634 bool fIsDockIconEnabled = strSettings.isEmpty() || strSettings == "true";635 setDockIconEnabled(fIsDockIconEnabled);636 updateDockOverlay();637 #endif638 589 } 639 590 640 591 void UIMachineView::cleanupCommon() 641 592 { 642 #if defined (Q_WS_PM)593 #ifdef Q_WS_PM 643 594 bool ok = VBoxHlpUninstallKbdHook(0, winId(), UM_PREACCEL_CHAR); 644 595 Assert(ok); 645 596 NOREF(ok); 646 #endif 647 648 #if defined (Q_WS_WIN)597 #endif /* Q_WS_PM */ 598 599 #ifdef Q_WS_WIN 649 600 if (gKbdHook) 650 601 UnhookWindowsHookEx(gKbdHook); 651 602 gView = 0; 652 #endif 603 #endif /* Q_WS_WIN */ 653 604 654 605 #ifdef Q_WS_MAC … … 657 608 if (m_fKeyboardGrabbed) 658 609 darwinGrabKeyboardEvents (false); 659 # ifndef QT_MAC_USE_COCOA660 if (mDarwinWindowOverlayHandlerRef)661 {662 ::RemoveEventHandler(mDarwinWindowOverlayHandlerRef);663 mDarwinWindowOverlayHandlerRef = NULL;664 }665 # endif /* !QT_MAC_USE_COCOA */666 // TODO_NEW_CORE667 // delete mDockIconPreview;668 mDockIconPreview = NULL;669 610 #endif /* Q_WS_MAC */ 670 611 } … … 1005 946 } 1006 947 #endif /* defined (Q_WS_WIN32) */ 1007 #if defined (Q_WS_MAC)948 #ifdef Q_WS_MAC 1008 949 /* Install/remove the keyboard event handler: */ 1009 950 case QEvent::WindowActivate: … … 1013 954 darwinGrabKeyboardEvents(false); 1014 955 break; 1015 #endif /* defined (Q_WS_MAC)*/956 #endif /* Q_WS_MAC */ 1016 957 default: 1017 958 break; … … 1079 1020 } 1080 1021 1081 #ifdef Q_WS_MAC1082 /* Update Dock Overlay: */1083 updateDockOverlay();1084 #endif /* Q_WS_MAC */1085 1086 1022 m_previousState = state; 1087 1023 } … … 1135 1071 } 1136 1072 } 1137 1138 #ifdef Q_WS_MAC1139 void UIMachineView::sltChangeDockIconUpdate(const VBoxChangeDockIconUpdateEvent &event)1140 {1141 setDockIconEnabled(event.mChanged);1142 updateDockOverlay();1143 }1144 #endif1145 1073 1146 1074 void UIMachineView::focusEvent(bool fHasFocus, bool fReleaseHostKey /* = true */) … … 1413 1341 } 1414 1342 #elif defined (Q_WS_MAC) 1415 // TODO_NEW_CORE1416 1343 if (pUniKey && pUniKey[0] && !pUniKey[1]) 1417 1344 processed = machineWindowWrapper()->machineLogic()->actionsPool()->processHotKey(QKeySequence(Qt::UNICODE_ACCEL + QChar(pUniKey[0]).toUpper().unicode())); … … 1689 1616 { 1690 1617 updateSliders(); 1691 #if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)1692 QRect rectangle = viewport()->geometry();1693 PostBoundsChanged(rectangle);1694 #endif /* Q_WS_MAC */1695 1618 return QAbstractScrollArea::resizeEvent(pEvent); 1696 1619 } … … 1698 1621 void UIMachineView::moveEvent(QMoveEvent *pEvent) 1699 1622 { 1700 #if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)1701 QRect r = viewport()->geometry();1702 PostBoundsChanged (r);1703 #endif /* Q_WS_MAC */1704 1623 return QAbstractScrollArea::moveEvent(pEvent); 1705 1624 } … … 1714 1633 #ifdef Q_WS_MAC 1715 1634 /* Update the dock icon if we are in the running state */ 1716 // TODO_NEW_CORE 1717 // if (uisession()->isRunning()) 1718 // updateDockIcon(); 1719 #endif 1635 if (uisession()->isRunning()) 1636 updateDockIcon(); 1637 #endif /* Q_WS_MAC */ 1720 1638 return; 1721 1639 } … … 1725 1643 { 1726 1644 m_pFrameBuffer->paintEvent(pPaintEvent); 1727 //updateDockIcon();1645 updateDockIcon(); 1728 1646 } 1729 1647 else 1730 #endif 1648 #endif /* VBOX_GUI_USE_QUARTZ2D */ 1731 1649 { 1732 1650 /* We have a snapshot for the paused state: */ … … 1740 1658 viewport()->setAttribute(Qt::WA_PaintOnScreen, paintOnScreen); 1741 1659 #ifdef Q_WS_MAC 1742 //updateDockIcon();1743 #endif 1660 updateDockIcon(); 1661 #endif /* Q_WS_MAC */ 1744 1662 } 1745 1663 } … … 2584 2502 } 2585 2503 2586 #if defined(Q_WS_MAC) 2504 #ifdef Q_WS_MAC 2505 CGImageRef UIMachineView::vmContentImage() 2506 { 2507 if (!m_pauseShot.isNull()) 2508 { 2509 CGImageRef pauseImg = ::darwinToCGImageRef(&m_pauseShot); 2510 /* Use the pause image as background */ 2511 return pauseImg; 2512 } 2513 else 2514 { 2515 # ifdef VBOX_GUI_USE_QUARTZ2D 2516 if (mode() == VBoxDefs::Quartz2DMode) 2517 { 2518 /* If the render mode is Quartz2D we could use the CGImageRef 2519 * of the framebuffer for the dock icon creation. This saves 2520 * some conversion time. */ 2521 CGImageRef image = static_cast<UIFrameBufferQuartz2D*>(m_pFrameBuffer)->imageRef(); 2522 CGImageRetain(image); /* Retain it, cause the consumer will release it. */ 2523 return image; 2524 } 2525 else 2526 # endif /* VBOX_GUI_USE_QUARTZ2D */ 2527 /* In image mode we have to create the image ref out of the 2528 * framebuffer */ 2529 return frameBuffertoCGImageRef(m_pFrameBuffer); 2530 } 2531 return 0; 2532 } 2533 2534 CGImageRef UIMachineView::frameBuffertoCGImageRef(UIFrameBuffer *pFrameBuffer) 2535 { 2536 CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); 2537 Assert(cs); 2538 /* Create the image copy of the framebuffer */ 2539 CGDataProviderRef dp = CGDataProviderCreateWithData(pFrameBuffer, pFrameBuffer->address(), pFrameBuffer->bitsPerPixel() / 8 * pFrameBuffer->width() * pFrameBuffer->height(), NULL); 2540 Assert(dp); 2541 CGImageRef ir = CGImageCreate(pFrameBuffer->width(), pFrameBuffer->height(), 8, 32, pFrameBuffer->bytesPerLine(), cs, 2542 kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host, dp, 0, false, 2543 kCGRenderingIntentDefault); 2544 Assert(ir); 2545 CGDataProviderRelease(dp); 2546 CGColorSpaceRelease(cs); 2547 2548 return ir; 2549 } 2550 2587 2551 void UIMachineView::updateDockIcon() 2588 2552 { 2589 // TODO_NEW_CORE 2590 // if (mDockIconEnabled) 2591 // { 2592 // if (!m_pauseShot.isNull()) 2593 // { 2594 // CGImageRef pauseImg = ::darwinToCGImageRef (&m_pauseShot); 2595 // /* Use the pause image as background */ 2596 // mDockIconPreview->updateDockPreview (pauseImg); 2597 // CGImageRelease (pauseImg); 2598 // } 2599 // else 2600 // { 2601 //# if defined (VBOX_GUI_USE_QUARTZ2D) 2602 // if (mode() == VBoxDefs::Quartz2DMode) 2603 // { 2604 // /* If the render mode is Quartz2D we could use the CGImageRef 2605 // * of the framebuffer for the dock icon creation. This saves 2606 // * some conversion time. */ 2607 // mDockIconPreview->updateDockPreview(static_cast<UIFrameBufferQuartz2D*>(m_pFrameBuffer)->imageRef()); 2608 // } 2609 // else 2610 //# endif 2611 // /* In image mode we have to create the image ref out of the 2612 // * framebuffer */ 2613 // mDockIconPreview->updateDockPreview(m_pFrameBuffer); 2614 // } 2615 // } 2616 } 2617 2618 void UIMachineView::updateDockOverlay() 2619 { 2620 /* Only to an update to the realtime preview if this is enabled by the user 2621 * & we are in an state where the framebuffer is likely valid. Otherwise to 2622 * the overlay stuff only. */ 2623 // TODO_NEW_CORE 2624 // if (mDockIconEnabled && 2625 // (machineState() == KMachineState_Running || 2626 // machineState() == KMachineState_Paused || 2627 // machineState() == KMachineState_Teleporting || 2628 // machineState() == KMachineState_LiveSnapshotting || 2629 // machineState() == KMachineState_Restoring || 2630 // machineState() == KMachineState_TeleportingPausedVM || 2631 // machineState() == KMachineState_TeleportingIn || 2632 // machineState() == KMachineState_Saving)) 2633 // updateDockIcon(); 2634 // else 2635 // mDockIconPreview->updateDockOverlay(); 2553 machineLogic()->updateDockIcon(); 2636 2554 } 2637 2555 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r27124 r27215 42 42 class UIMachineLogic; 43 43 class VBoxGlobalSettings; 44 #ifdef Q_WS_MAC45 class VBoxChangeDockIconUpdateEvent;46 class VBoxDockIconPreview;47 #endif /* Q_WS_MAC */48 44 49 45 class UIMachineView : public QAbstractScrollArea … … 76 72 /* Public members: */ 77 73 virtual void normalizeGeometry(bool /* bAdjustPosition = false */) {} 78 79 #if defined(Q_WS_MAC)80 void updateDockIcon();81 void updateDockOverlay();82 void setMouseCoalescingEnabled(bool fOn);83 void setDockIconEnabled(bool aOn) { mDockIconEnabled = aOn; };84 #endif85 74 86 75 signals: … … 137 126 void updateSliders(); 138 127 128 #ifdef Q_WS_MAC 129 void updateDockIcon(); 130 void setMouseCoalescingEnabled(bool fOn); 131 CGImageRef vmContentImage(); 132 CGImageRef frameBuffertoCGImageRef(UIFrameBuffer *pFrameBuffer); 133 #endif /* Q_WS_MAC */ 134 139 135 /* Prepare routines: */ 140 136 virtual void prepareFrameBuffer(); … … 165 161 /* Session callback handlers: */ 166 162 virtual void sltMouseCapturedStatusChanged(); 167 168 private slots:169 170 #ifdef Q_WS_MAC171 /* Dock icon update handler */172 void sltChangeDockIconUpdate(const VBoxChangeDockIconUpdateEvent &event);173 #endif174 163 175 164 private: … … 254 243 #endif 255 244 256 #if defined(Q_WS_MAC) 257 # ifndef QT_MAC_USE_COCOA 258 /** Event handler reference. NULL if the handler isn't installed. */ 259 EventHandlerRef m_darwinEventHandlerRef; 260 # endif /* !QT_MAC_USE_COCOA */ 245 #ifdef Q_WS_MAC 261 246 /** The current modifier key mask. Used to figure out which modifier 262 247 * key was pressed when we get a kEventRawKeyModifiersChanged event. */ 263 248 UInt32 m_darwinKeyModifiers; 264 249 bool m_fKeyboardGrabbed; 265 #endif 250 #endif /* Q_WS_MAC */ 266 251 267 252 QPixmap m_pauseShot; 268 #if defined(Q_WS_MAC)269 # if !defined (QT_MAC_USE_COCOA)270 EventHandlerRef mDarwinWindowOverlayHandlerRef;271 # endif272 VBoxDockIconPreview *mDockIconPreview;273 bool mDockIconEnabled;274 #endif275 253 276 254 /* Friend classes: */ 255 friend class UIMachineLogic; 277 256 friend class UIMachineWindowFullscreen; 278 257 friend class UIFrameBuffer; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r27144 r27215 154 154 sltAdditionsStateChanged(); 155 155 sltMouseCapabilityChanged(); 156 157 retranslateUi(); 156 158 } 157 159 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
r27132 r27215 78 78 sltAdditionsStateChanged(); 79 79 sltMouseCapabilityChanged(); 80 81 retranslateUi(); 80 82 } 81 83 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
r27145 r27215 146 146 sltAdditionsStateChanged(); 147 147 sltMouseCapabilityChanged(); 148 149 retranslateUi(); 148 150 } 149 151 }
Note:
See TracChangeset
for help on using the changeset viewer.