Changeset 2700 in vbox for trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
- Timestamp:
- May 17, 2007 3:34:02 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 21279
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r2540 r2700 225 225 }; 226 226 227 /** Guest Additions property changes. */ 228 class GuestAdditionsEvent : public QEvent 229 { 230 public: 231 GuestAdditionsEvent (const QString &aOsTypeId, 232 const QString &aAddVersion, 233 bool aAddActive) : 234 QEvent ((QEvent::Type) VBoxDefs::AdditionsStateChangeEventType), 235 mOsTypeId (aOsTypeId), mAddVersion (aAddVersion), mAddActive (aAddActive) {} 236 const QString &osTypeId() const { return mOsTypeId; } 237 const QString &additionVersion() const { return mAddVersion; } 238 bool additionActive() const { return mAddActive; } 239 private: 240 QString mOsTypeId; 241 QString mAddVersion; 242 bool mAddActive; 243 }; 244 227 245 /** Menu activation event */ 228 246 class ActivateMenuEvent : public QEvent … … 352 370 guest.GetAdditionsVersion().latin1(), 353 371 guest.GetAdditionsActive())); 354 /** @todo */ 372 QApplication::postEvent (mView, 373 new GuestAdditionsEvent ( 374 guest.GetOSTypeId(), 375 guest.GetAdditionsVersion(), 376 guest.GetAdditionsActive())); 355 377 return S_OK; 356 378 } … … 811 833 case VBoxDefs::ResizeEventType: 812 834 { 835 bool old_ignore_mainwnd_resize = ignore_mainwnd_resize; 813 836 ignore_mainwnd_resize = true; 814 837 … … 842 865 * full screen */ 843 866 if (!mainwnd->isTrueFullscreen() && 844 !topLevelWidget()->isMaximized() && 845 !resize_hint_timer->isActive()) 867 !topLevelWidget()->isMaximized()) 846 868 normalizeGeometry (true /* adjustPosition */); 847 869 … … 849 871 cconsole.GetDisplay().ResizeCompleted(); 850 872 851 ignore_mainwnd_resize = false;873 ignore_mainwnd_resize = old_ignore_mainwnd_resize; 852 874 853 875 return true; … … 912 934 onStateChange (me->machineState()); 913 935 emit machineStateChanged (me->machineState()); 936 return true; 937 } 938 939 case VBoxDefs::AdditionsStateChangeEventType: 940 { 941 GuestAdditionsEvent *ge = (GuestAdditionsEvent *) e; 942 LogFlowFunc (("AdditionsStateChangeEventType\n")); 943 emit additionsStateChanged (ge->additionVersion(), ge->additionActive()); 914 944 return true; 915 945 } … … 1004 1034 } 1005 1035 1036 case VBoxDefs::AutoResizeEventType: 1037 { 1038 performAutoResize(); 1039 return true; 1040 } 1041 1006 1042 default: 1007 1043 break; … … 1105 1141 if (autoresize_guest) 1106 1142 resize_hint_timer->start (300, TRUE); 1143 /* During window maximization WindowStateChange event is 1144 * processed before Resize event, so the ignore_mainwnd_resize 1145 * variable should be set to true here in case of mainwnd is 1146 * maximized or in fullscreen state. */ 1147 if (mainwnd->isMaximized() || mainwnd->isTrueFullscreen()) 1148 ignore_mainwnd_resize = true; 1107 1149 } 1108 1150 break; … … 1110 1152 case QEvent::WindowStateChange: 1111 1153 { 1112 if (!mainwnd->isMinimized()) 1113 { 1114 if (!mainwnd->isMaximized()) 1115 { 1116 /* The guest screen size (and therefore the contents 1117 * size) could have been changed while we were maximized 1118 * or minimized, so normalize the main window size 1119 * unless we're in true fullscreen mode. Calling 1120 * normalizeGeometry() directly from here doesn't work 1121 * for some reason, so use a single shot timer. */ 1122 if (!mainwnd->isTrueFullscreen()) 1123 QTimer::singleShot (0, this, SLOT (normalizeGeo())); 1124 } 1125 } 1154 /* The guest screen size (and therefore the contents size) 1155 * could have been changed while we were maximized or minimized, 1156 * so posting event for auto-resize and normalization. */ 1157 if (!mainwnd->isMinimized() && 1158 !mainwnd->isMaximized() && 1159 !mainwnd->isTrueFullscreen()) 1160 QApplication::postEvent (this, new AutoResizeEvent ()); 1126 1161 } 1127 1162 … … 1483 1518 m_darwinKeyModifiers = newMask; 1484 1519 1485 /* Always return true here because we'll otherwise getting a Qt event 1520 /* Always return true here because we'll otherwise getting a Qt event 1486 1521 we don't want and that will only cause the Pause warning to pop up. */ 1487 1522 ret = true; … … 1671 1706 1672 1707 1708 } 1709 1710 void VBoxConsoleView::performAutoResize() 1711 { 1712 if (autoresize_guest) 1713 { 1714 doResizeHint(); 1715 QTimer::singleShot (200, this, SLOT (normalizeGeo())); 1716 } 1717 else 1718 { 1719 normalizeGeo(); 1720 } 1721 ignore_mainwnd_resize = false; 1673 1722 } 1674 1723 … … 2452 2501 // Note, that it's just a guess that sending RESEND will give the desired 2453 2502 // effect :), but at least it works with NT and W2k guests. 2454 /** @todo This seems to causes linux guests (in console mode) to cough a bit. 2503 /** @todo This seems to causes linux guests (in console mode) to cough a bit. 2455 2504 * We need to check if this is the cause of #1944 and/or #1949. --bird */ 2456 2505 codes [0] = 0xFE; … … 2477 2526 m_darwinKeyModifiers &= alphaLock | kEventKeyModifierNumLockMask 2478 2527 | (release_hostkey ? 0 : ::DarwinKeyCodeToDarwinModifierMask (gs.hostKey())); 2479 #endif 2528 #endif 2480 2529 2481 2530 emitKeyboardStateChanged ();
Note:
See TracChangeset
for help on using the changeset viewer.