Changeset 35247 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Dec 20, 2010 2:19:48 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 69094
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r33579 r35247 141 141 } 142 142 143 double UIMachineView::aspectRatio() const 144 { 145 return frameBuffer() ? (double)(frameBuffer()->width()) / frameBuffer()->height() : 0; 146 } 147 143 148 void UIMachineView::sltMachineStateChanged() 144 149 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r31698 r35247 63 63 /* Public members: */ 64 64 virtual void normalizeGeometry(bool /* bAdjustPosition = false */) = 0; 65 66 /* Framebuffer aspect ratio: */ 67 double aspectRatio() const; 65 68 66 69 signals: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
r31321 r35247 150 150 return QIWithRetranslateUI2<QMainWindow>::event(pEvent); 151 151 } 152 153 #ifdef Q_WS_WIN 154 bool UIMachineWindowScale::winEvent(MSG *pMessage, long *pResult) 155 { 156 /* Try to keep aspect ratio during window resize if: 157 * 1. machine view exists and 2. event-type is WM_SIZING and 3. shift key is NOT pressed: */ 158 if (machineView() && pMessage->message == WM_SIZING && !(QApplication::keyboardModifiers() & Qt::ShiftModifier)) 159 { 160 if (double dAspectRatio = machineView()->aspectRatio()) 161 { 162 RECT *pRect = reinterpret_cast<RECT*>(pMessage->lParam); 163 switch (pMessage->wParam) 164 { 165 case WMSZ_LEFT: 166 case WMSZ_RIGHT: 167 { 168 pRect->bottom = pRect->top + (double)(pRect->right - pRect->left) / dAspectRatio; 169 break; 170 } 171 case WMSZ_TOP: 172 case WMSZ_BOTTOM: 173 { 174 pRect->right = pRect->left + (double)(pRect->bottom - pRect->top) * dAspectRatio; 175 break; 176 } 177 case WMSZ_BOTTOMLEFT: 178 case WMSZ_BOTTOMRIGHT: 179 { 180 pRect->bottom = pRect->top + (double)(pRect->right - pRect->left) / dAspectRatio; 181 break; 182 } 183 case WMSZ_TOPLEFT: 184 case WMSZ_TOPRIGHT: 185 { 186 pRect->top = pRect->bottom - (double)(pRect->right - pRect->left) / dAspectRatio; 187 break; 188 } 189 default: 190 break; 191 } 192 } 193 } 194 /* Pass event to base-class: */ 195 return QMainWindow::winEvent(pMessage, pResult); 196 } 197 #endif /* Q_WS_WIN */ 152 198 153 199 #ifdef Q_WS_X11 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h
r30848 r35247 55 55 /* Event handlers: */ 56 56 bool event(QEvent *pEvent); 57 #ifdef Q_WS_WIN 58 bool winEvent(MSG *pMessage, long *pResult); 59 #endif 57 60 #ifdef Q_WS_X11 58 61 bool x11Event(XEvent *pEvent);
Note:
See TracChangeset
for help on using the changeset viewer.