Changeset 28342 in vbox
- Timestamp:
- Apr 14, 2010 11:33:05 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 60101
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/darwin/UIAbstractDockIconPreview.cpp
r27215 r28342 22 22 /* VBox includes */ 23 23 #include "UIAbstractDockIconPreview.h" 24 #include "UIFrameBuffer.h" 25 #include "UIMachineLogic.h" 26 #include "UIMachineView.h" 24 27 #include "UISession.h" 25 #include "UIFrameBuffer.h"26 28 27 29 UIAbstractDockIconPreview::UIAbstractDockIconPreview(UISession * /* pSession */, const QPixmap& /* overlayImage */) … … 67 69 m_stateRestoring = ::darwinToCGImageRef("state_restoring_16px.png"); 68 70 Assert(m_stateRestoring); 71 } 72 73 void* UIAbstractDockIconPreviewHelper::currentPreviewWindowId() const 74 { 75 /* Get the MachineView which is currently previewed and return the win id 76 of the viewport. */ 77 UIMachineView* pView = m_pSession->machineLogic()->dockPreviewView(); 78 if (pView) 79 return (void*)pView->viewport()->winId(); 80 return 0; 69 81 } 70 82 -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/UIAbstractDockIconPreview.h
r27215 r28342 31 31 #include "VBoxUtils-darwin.h" 32 32 33 class UIFrameBuffer; 33 34 class UISession; 34 class UIFrameBuffer;35 35 36 36 class QPixmap; … … 58 58 void drawOverlayIcons(CGContextRef context); 59 59 60 void* currentPreviewWindowId() const; 61 60 62 /* Flipping is necessary cause the drawing context in Carbon is flipped by 180 degree */ 61 63 inline CGRect flipRect(CGRect rect) const { return ::darwinFlipCGRect(rect, m_dockIconRect); } -
trunk/src/VBox/Frontends/VirtualBox/src/darwin/UICocoaDockIconPreview.mm
r28279 r28342 53 53 54 54 UIDockTileMonitor *mMonitor; 55 NSImageView *mAppIcon;55 NSImageView *mAppIcon; 56 56 57 57 UIDockTileOverlay *mOverlay; … … 59 59 - (id)initWithParent:(UICocoaDockIconPreviewPrivate*)parent; 60 60 - (void)destroy; 61 - (NSView*)screenContent ;61 - (NSView*)screenContentWithParentView:(NSView*)parentView; 62 62 - (void)cleanup; 63 63 - (void)restoreAppIcon; … … 261 261 } 262 262 263 - (NSView*)screenContent 264 { 265 return [mMonitor screenContent]; 263 - (NSView*)screenContentWithParentView:(NSView*)parentView 264 { 265 if (mMonitor != nil) 266 { 267 void *pId = p->currentPreviewWindowId(); 268 if (parentView == pId) 269 return [mMonitor screenContent]; 270 } 271 return nil; 266 272 } 267 273 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r28294 r28342 268 268 } 269 269 270 UIMachineWindow* UIMachineLogic::mainMachineWindow() 270 UIMachineWindow* UIMachineLogic::mainMachineWindow() const 271 271 { 272 272 /* Return null if windows are not created yet: */ … … 277 277 } 278 278 279 UIMachineWindow* UIMachineLogic::defaultMachineWindow() 279 UIMachineWindow* UIMachineLogic::defaultMachineWindow() const 280 280 { 281 281 /* Return null if windows are not created yet: */ … … 325 325 && m_DockIconPreviewMonitor == screenId) 326 326 m_pDockIconPreview->setOriginalSize(width, height); 327 } 328 329 UIMachineView* UIMachineLogic::dockPreviewView() const 330 { 331 if ( m_fIsDockIconEnabled 332 && m_pDockIconPreview) 333 return machineWindows().at(m_DockIconPreviewMonitor)->machineView(); 334 return 0; 327 335 } 328 336 #endif /* Q_WS_MAC */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r28279 r28342 44 44 class UIActionsPool; 45 45 class UIMachineWindow; 46 class UIMachineView; 46 47 class UIDockIconPreview; 47 48 class VBoxChangeDockIconUpdateEvent; … … 70 71 UIActionsPool* actionsPool() const { return m_pActionsPool; } 71 72 UIVisualStateType visualStateType() const { return m_visualStateType; } 72 QList<UIMachineWindow*>& machineWindows(){ return m_machineWindowsList; }73 UIMachineWindow* mainMachineWindow() ;74 UIMachineWindow* defaultMachineWindow() ;73 const QList<UIMachineWindow*>& machineWindows() const { return m_machineWindowsList; } 74 UIMachineWindow* mainMachineWindow() const; 75 UIMachineWindow* defaultMachineWindow() const; 75 76 76 77 /* Maintenance getters/setters: */ … … 81 82 void updateDockIcon(); 82 83 void updateDockIconSize(int screenId, int width, int height); 84 UIMachineView* dockPreviewView() const; 83 85 #endif /* Q_WS_MAC */ 84 86 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r27768 r28342 755 755 } 756 756 757 UIMachineLogic* UISession::machineLogic() const 758 { 759 return uimachine()->machineLogic(); 760 } 761 757 762 QMenu* UISession::newMenu(UIMainMenuType fOptions /* = UIMainMenuType_ALL */) 758 763 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r27768 r28342 41 41 class UIFrameBuffer; 42 42 class UIMachine; 43 class UIMachineLogic; 43 44 class UIMachineMenuBar; 44 45 … … 86 87 UIActionsPool* actionsPool() const; 87 88 QWidget* mainMachineWindow() const; 89 UIMachineLogic* machineLogic() const; 88 90 QMenu* newMenu(UIMainMenuType fOptions = UIMainMenuType_All); 89 91 QMenuBar* newMenuBar(UIMainMenuType fOptions = UIMainMenuType_All); -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
r28279 r28342 1200 1200 NSView *contentView = [[[NSApplication sharedApplication] dockTile] contentView]; 1201 1201 NSView *screenContent = nil; 1202 if ([contentView respondsToSelector:@selector(screenContent)]) 1202 /* First try the new variant which checks if this window is within the 1203 screen which is previewed in the dock. */ 1204 if ([contentView respondsToSelector:@selector(screenContentWithParentView:)]) 1205 screenContent = [contentView performSelector:@selector(screenContentWithParentView:) withObject:(id)m_pParentView]; 1206 /* If it fails, fall back to the old variant (VBox...) */ 1207 else if ([contentView respondsToSelector:@selector(screenContent)]) 1203 1208 screenContent = [contentView performSelector:@selector(screenContent)]; 1204 1209 return screenContent; … … 1207 1212 - (void)reshapeDockTile 1208 1213 { 1209 NSRect dockFrame = [[self dockTileScreen] frame]; 1210 NSRect parentFrame = [m_pParentView frame]; 1211 1212 m_FBOThumbScaleX = (float)dockFrame.size.width / parentFrame.size.width; 1213 m_FBOThumbScaleY = (float)dockFrame.size.height / parentFrame.size.height; 1214 NSRect newFrame = NSMakeRect ((int)(m_Pos.x * m_FBOThumbScaleX), (int)(dockFrame.size.height - (m_Pos.y + m_Size.height - m_RootShift.y) * m_FBOThumbScaleY), (int)(m_Size.width * m_FBOThumbScaleX), (int)(m_Size.height * m_FBOThumbScaleY)); 1214 NSView *pView = [self dockTileScreen]; 1215 if (pView != nil) 1216 { 1217 NSRect dockFrame = [pView frame]; 1218 NSRect parentFrame = [m_pParentView frame]; 1219 1220 m_FBOThumbScaleX = (float)dockFrame.size.width / parentFrame.size.width; 1221 m_FBOThumbScaleY = (float)dockFrame.size.height / parentFrame.size.height; 1222 NSRect newFrame = NSMakeRect ((int)(m_Pos.x * m_FBOThumbScaleX), (int)(dockFrame.size.height - (m_Pos.y + m_Size.height - m_RootShift.y) * m_FBOThumbScaleY), (int)(m_Size.width * m_FBOThumbScaleX), (int)(m_Size.height * m_FBOThumbScaleY)); 1215 1223 // NSRect newFrame = NSMakeRect ((int)roundf(m_Pos.x * m_FBOThumbScaleX), (int)roundf(dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (int)roundf(m_Size.width * m_FBOThumbScaleX), (int)roundf(m_Size.height * m_FBOThumbScaleY)); 1216 1224 // NSRect newFrame = NSMakeRect ((m_Pos.x * m_FBOThumbScaleX), (dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (m_Size.width * m_FBOThumbScaleX), (m_Size.height * m_FBOThumbScaleY)); 1217 1225 // printf ("%f %f %f %f - %f %f\n", newFrame.origin.x, newFrame.origin.y, newFrame.size.width, newFrame.size.height, m_Size.height, m_FBOThumbScaleY); 1218 [m_DockTileView setFrame: newFrame]; 1226 [m_DockTileView setFrame: newFrame]; 1227 } 1219 1228 } 1220 1229 … … 1352 1361 /* Add the overlay window as a child to the new parent window */ 1353 1362 [[pParentView window] addChildWindow:[pOView overlayWin] ordered:NSWindowAbove]; 1363 [pOView createFBO]; 1354 1364 } 1355 1365
Note:
See TracChangeset
for help on using the changeset viewer.