[55401] | 1 | /* $Id: UIMachineView.h 103803 2024-03-12 11:15:18Z vboxsync $ */
|
---|
[382] | 2 | /** @file
|
---|
[52727] | 3 | * VBox Qt GUI - UIMachineView class declaration.
|
---|
[382] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
[382] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
| 25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
[382] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_runtime_UIMachineView_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_runtime_UIMachineView_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[382] | 33 |
|
---|
[41587] | 34 | /* Qt includes: */
|
---|
[7590] | 35 | #include <QAbstractScrollArea>
|
---|
[27124] | 36 | #include <QEventLoop>
|
---|
[382] | 37 |
|
---|
[41587] | 38 | /* GUI includes: */
|
---|
[58943] | 39 | #include "UIExtraDataDefs.h"
|
---|
[88678] | 40 | #include "UIFrameBuffer.h"
|
---|
[58943] | 41 | #include "UIMachineDefs.h"
|
---|
[55821] | 42 | #ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
| 43 | # include "UIDnDHandler.h"
|
---|
[58943] | 44 | #endif /* VBOX_WITH_DRAG_AND_DROP */
|
---|
[26699] | 45 |
|
---|
[41587] | 46 | /* COM includes: */
|
---|
[103803] | 47 | #include "KMachineState.h"
|
---|
[41587] | 48 |
|
---|
[54554] | 49 | /* Other VBox includes: */
|
---|
| 50 | #include "VBox/com/ptr.h"
|
---|
[60362] | 51 | #ifdef VBOX_WS_MAC
|
---|
[59342] | 52 | # include <ApplicationServices/ApplicationServices.h>
|
---|
[60362] | 53 | #endif /* VBOX_WS_MAC */
|
---|
[54554] | 54 |
|
---|
[58943] | 55 | /* External includes: */
|
---|
[60362] | 56 | #ifdef VBOX_WS_MAC
|
---|
[58943] | 57 | # include <CoreFoundation/CFBase.h>
|
---|
[60362] | 58 | #endif /* VBOX_WS_MAC */
|
---|
[58943] | 59 |
|
---|
[41587] | 60 | /* Forward declarations: */
|
---|
[58943] | 61 | class UIActionPool;
|
---|
[98378] | 62 | class UIMachine;
|
---|
[30551] | 63 | class UIMachineLogic;
|
---|
| 64 | class UIMachineWindow;
|
---|
[68315] | 65 | class UINativeEventFilter;
|
---|
[53076] | 66 | class CGuest;
|
---|
[58943] | 67 | class CSession;
|
---|
| 68 | #ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
[68315] | 69 | class CDnDTarget;
|
---|
[63578] | 70 | #endif
|
---|
[26699] | 71 |
|
---|
[58943] | 72 |
|
---|
[26637] | 73 | class UIMachineView : public QAbstractScrollArea
|
---|
[382] | 74 | {
|
---|
[26637] | 75 | Q_OBJECT;
|
---|
[382] | 76 |
|
---|
[52179] | 77 | signals:
|
---|
| 78 |
|
---|
[82030] | 79 | /** Notifies about mouse pointer shape change. */
|
---|
| 80 | void sigMousePointerShapeChange();
|
---|
[52179] | 81 | /** Notifies about frame-buffer resize. */
|
---|
| 82 | void sigFrameBufferResize();
|
---|
| 83 |
|
---|
[382] | 84 | public:
|
---|
| 85 |
|
---|
[30544] | 86 | /* Factory function to create machine-view: */
|
---|
[84790] | 87 | static UIMachineView* create(UIMachineWindow *pMachineWindow, ulong uScreenId, UIVisualStateType visualStateType);
|
---|
[30544] | 88 | /* Factory function to destroy required machine-view: */
|
---|
| 89 | static void destroy(UIMachineView *pMachineView);
|
---|
[382] | 90 |
|
---|
[60703] | 91 | /** Returns whether the guest-screen auto-resize is enabled. */
|
---|
| 92 | virtual bool isGuestAutoresizeEnabled() const { return true; }
|
---|
| 93 | /** Defines whether the guest-screen auto-resize is @a fEnabled. */
|
---|
| 94 | virtual void setGuestAutoresizeEnabled(bool fEnabled) { Q_UNUSED(fEnabled); }
|
---|
[382] | 95 |
|
---|
[56443] | 96 | /** Send saved guest-screen size-hint to the guest.
|
---|
| 97 | * @note Reimplemented in sub-classes. Base implementation does nothing. */
|
---|
| 98 | virtual void resendSizeHint() {}
|
---|
| 99 |
|
---|
[52705] | 100 | /** Adjusts guest-screen size to correspond current visual-style.
|
---|
[49177] | 101 | * @note Reimplemented in sub-classes. Base implementation does nothing. */
|
---|
[52705] | 102 | virtual void adjustGuestScreenSize() {}
|
---|
[26815] | 103 |
|
---|
[53892] | 104 | /** Applies machine-view scale-factor. */
|
---|
[53962] | 105 | virtual void applyMachineViewScaleFactor();
|
---|
[53864] | 106 |
|
---|
[98037] | 107 | /** Returns screen ID for this view. */
|
---|
| 108 | ulong screenId() const { return m_uScreenId; }
|
---|
| 109 |
|
---|
[98378] | 110 | /** Returns the machine UI reference. */
|
---|
| 111 | UIMachine *uimachine() const;
|
---|
[98037] | 112 | /** Returns the machine-logic reference. */
|
---|
| 113 | UIMachineLogic *machineLogic() const;
|
---|
| 114 | /** Returns the machine-window reference. */
|
---|
| 115 | UIMachineWindow *machineWindow() const { return m_pMachineWindow; }
|
---|
| 116 | /** Returns view's frame-buffer reference. */
|
---|
[98841] | 117 | UIFrameBuffer *frameBuffer() const;
|
---|
[98037] | 118 |
|
---|
| 119 | /** Returns actual contents width. */
|
---|
| 120 | int contentsWidth() const;
|
---|
| 121 | /** Returns actual contents height. */
|
---|
| 122 | int contentsHeight() const;
|
---|
| 123 | /** Returns actual contents x origin. */
|
---|
| 124 | int contentsX() const;
|
---|
| 125 | /** Returns actual contents y origin. */
|
---|
| 126 | int contentsY() const;
|
---|
| 127 | /** Returns visible contents width. */
|
---|
| 128 | int visibleWidth() const;
|
---|
| 129 | /** Returns visible contents height. */
|
---|
| 130 | int visibleHeight() const;
|
---|
| 131 | /** Translates viewport point to contents point. */
|
---|
| 132 | QPoint viewportToContents(const QPoint &viewportPoint) const;
|
---|
| 133 | /** Scrolls contents by @a iDx x iDy pixels. */
|
---|
| 134 | void scrollBy(int iDx, int iDy);
|
---|
| 135 |
|
---|
| 136 | /** What view mode (normal, fullscreen etc.) are we in? */
|
---|
| 137 | UIVisualStateType visualStateType() const;
|
---|
| 138 |
|
---|
| 139 | /** Returns cached mouse cursor. */
|
---|
| 140 | QCursor cursor() const { return m_cursor; }
|
---|
| 141 |
|
---|
[35247] | 142 | /* Framebuffer aspect ratio: */
|
---|
| 143 | double aspectRatio() const;
|
---|
| 144 |
|
---|
[98037] | 145 | /** Atomically store the maximum guest resolution which we currently wish
|
---|
| 146 | * to handle for @a maximumGuestSize() to read. Should be called if anything
|
---|
| 147 | * happens (e.g. a screen hotplug) which might cause the value to change.
|
---|
| 148 | * @sa m_u64MaximumGuestSize. */
|
---|
| 149 | void setMaximumGuestSize(const QSize &minimumSizeHint = QSize());
|
---|
| 150 | /** Atomically read the maximum guest resolution which we currently wish to
|
---|
| 151 | * handle. This may safely be called from another thread (called by
|
---|
| 152 | * UIFramebuffer on EMT).
|
---|
| 153 | * @sa m_u64MaximumGuestSize. */
|
---|
| 154 | QSize maximumGuestSize();
|
---|
| 155 |
|
---|
[58011] | 156 | /** Updates console's display viewport.
|
---|
| 157 | * @remarks Used to update 3D-service overlay viewport as well. */
|
---|
| 158 | void updateViewport();
|
---|
| 159 |
|
---|
[98037] | 160 | #ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
| 161 | /** Checks for a pending drag and drop event within the guest and
|
---|
| 162 | * (optionally) starts a drag and drop operation on the host. */
|
---|
| 163 | int dragCheckPending();
|
---|
| 164 | /** Starts a drag and drop operation from guest to the host.
|
---|
| 165 | * This internally either uses Qt's abstract QDrag methods
|
---|
| 166 | * or some other OS-dependent implementation. */
|
---|
| 167 | int dragStart();
|
---|
| 168 | /** Aborts (and resets) the current (pending)
|
---|
| 169 | * guest to host drag and drop operation. */
|
---|
| 170 | int dragStop();
|
---|
| 171 | #endif /* VBOX_WITH_DRAG_AND_DROP */
|
---|
| 172 |
|
---|
| 173 | /** Performs pre-processing of all the native events. */
|
---|
| 174 | virtual bool nativeEventPreprocessor(const QByteArray &eventType, void *pMessage);
|
---|
| 175 |
|
---|
[98038] | 176 | #ifdef VBOX_WS_MAC
|
---|
| 177 | /** Returns VM contents image. */
|
---|
| 178 | CGImageRef vmContentImage();
|
---|
| 179 | #endif
|
---|
| 180 |
|
---|
[98037] | 181 | public slots:
|
---|
| 182 |
|
---|
| 183 | /** Handles NotifyChange event received from frame-buffer.
|
---|
| 184 | * @todo To make it right, this have to be protected, but
|
---|
| 185 | * connection should be moved from frame-buffer to this class. */
|
---|
| 186 | virtual void sltHandleNotifyChange(int iWidth, int iHeight);
|
---|
| 187 |
|
---|
| 188 | /** Handles NotifyUpdate event received from frame-buffer.
|
---|
| 189 | * @todo To make it right, this have to be protected, but
|
---|
| 190 | * connection should be moved from frame-buffer to this class. */
|
---|
| 191 | virtual void sltHandleNotifyUpdate(int iX, int iY, int iWidth, int iHeight);
|
---|
| 192 |
|
---|
| 193 | /** Handles SetVisibleRegion event received from frame-buffer.
|
---|
| 194 | * @todo To make it right, this have to be protected, but
|
---|
| 195 | * connection should be moved from frame-buffer to this class. */
|
---|
| 196 | virtual void sltHandleSetVisibleRegion(QRegion region);
|
---|
| 197 |
|
---|
[30636] | 198 | protected slots:
|
---|
| 199 |
|
---|
[88245] | 200 | /* Performs guest-screen resize to a size specified.
|
---|
| 201 | * @param toSize Brings the size guest-screen needs to be resized to.
|
---|
| 202 | * @note If toSize isn't valid or sane one, it will be replaced with actual
|
---|
| 203 | * size of centralWidget() containing this machine-view currently.
|
---|
| 204 | * @note Also, take into acount that since this method is also called to
|
---|
| 205 | * resize to centralWidget() size, the size passed is expected to be
|
---|
| 206 | * tranformed to internal coordinate system and thus to be restored to
|
---|
| 207 | * guest coordinate system (absolute one) before passing to guest. */
|
---|
| 208 | void sltPerformGuestResize(const QSize &toSize = QSize());
|
---|
[38947] | 209 |
|
---|
[88247] | 210 | /** Handles guest-screen toggle request.
|
---|
| 211 | * @param iScreen Brings the number of screen being referred.
|
---|
| 212 | * @param fEnabled Brings whether this screen should be enabled. */
|
---|
| 213 | void sltHandleActionTriggerViewScreenToggle(int iScreen, bool fEnabled);
|
---|
| 214 | /** Handles guest-screen resize request.
|
---|
| 215 | * @param iScreen Brings the number of screen being referred.
|
---|
| 216 | * @param size Brings the size of screen to be applied. */
|
---|
| 217 | void sltHandleActionTriggerViewScreenResize(int iScreen, const QSize &size);
|
---|
| 218 |
|
---|
[42318] | 219 | /* Watch dog for desktop resizes: */
|
---|
| 220 | void sltDesktopResized();
|
---|
| 221 |
|
---|
[53389] | 222 | /** Handles the scale-factor change. */
|
---|
[74942] | 223 | void sltHandleScaleFactorChange(const QUuid &uMachineID);
|
---|
[53389] | 224 |
|
---|
[55187] | 225 | /** Handles the scaling-optimization change. */
|
---|
[74942] | 226 | void sltHandleScalingOptimizationChange(const QUuid &uMachineID);
|
---|
[55187] | 227 |
|
---|
[30636] | 228 | /* Console callback handlers: */
|
---|
| 229 | virtual void sltMachineStateChanged();
|
---|
[82032] | 230 | /** Handles guest request to change the mouse pointer shape. */
|
---|
| 231 | void sltMousePointerShapeChange();
|
---|
[30636] | 232 |
|
---|
[90705] | 233 | /** Detaches COM. */
|
---|
| 234 | void sltDetachCOM();
|
---|
| 235 |
|
---|
[26637] | 236 | protected:
|
---|
[896] | 237 |
|
---|
[30544] | 238 | /* Machine-view constructor: */
|
---|
[84790] | 239 | UIMachineView(UIMachineWindow *pMachineWindow, ulong uScreenId);
|
---|
[30544] | 240 | /* Machine-view destructor: */
|
---|
[59380] | 241 | virtual ~UIMachineView() {}
|
---|
[2835] | 242 |
|
---|
[30549] | 243 | /* Prepare routines: */
|
---|
[59380] | 244 | virtual void loadMachineViewSettings();
|
---|
[66256] | 245 | //virtual void prepareNativeFilters() {}
|
---|
[59380] | 246 | virtual void prepareViewport();
|
---|
| 247 | virtual void prepareFrameBuffer();
|
---|
[30549] | 248 | virtual void prepareCommon();
|
---|
[90705] | 249 | #ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
[97792] | 250 | virtual int prepareDnd();
|
---|
[90705] | 251 | #endif
|
---|
[30549] | 252 | virtual void prepareFilters();
|
---|
[42318] | 253 | virtual void prepareConnections();
|
---|
[30549] | 254 | virtual void prepareConsoleConnections();
|
---|
| 255 |
|
---|
| 256 | /* Cleanup routines: */
|
---|
| 257 | //virtual void cleanupConsoleConnections() {}
|
---|
[59380] | 258 | //virtual void cleanupConnections() {}
|
---|
[66256] | 259 | //virtual void cleanupFilters() {}
|
---|
[90705] | 260 | #ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
| 261 | virtual void cleanupDnd();
|
---|
| 262 | #endif
|
---|
[30637] | 263 | //virtual void cleanupCommon() {}
|
---|
[30549] | 264 | virtual void cleanupFrameBuffer();
|
---|
[30752] | 265 | //virtual void cleanupViewport();
|
---|
[66256] | 266 | virtual void cleanupNativeFilters();
|
---|
[59380] | 267 | //virtual void saveMachineViewSettings() {}
|
---|
[30549] | 268 |
|
---|
[26637] | 269 | /* Protected getters: */
|
---|
[52202] | 270 | UIActionPool* actionPool() const;
|
---|
[26637] | 271 | QSize sizeHint() const;
|
---|
[97976] | 272 |
|
---|
[97977] | 273 | /** Retrieves the last guest-screen size-hint from extra-data. */
|
---|
| 274 | QSize storedGuestScreenSizeHint() const;
|
---|
| 275 | /** Stores a guest-screen @a sizeHint to extra-data. */
|
---|
| 276 | void setStoredGuestScreenSizeHint(const QSize &sizeHint);
|
---|
| 277 |
|
---|
[97978] | 278 | /** Retrieves the sent guest-screen size-hint from display or frame-buffer. */
|
---|
| 279 | QSize requestedGuestScreenSizeHint() const;
|
---|
| 280 |
|
---|
[56704] | 281 | /** Retrieves the last guest-screen visibility status from extra-data. */
|
---|
| 282 | bool guestScreenVisibilityStatus() const;
|
---|
| 283 |
|
---|
[54104] | 284 | /** Handles machine-view scale changes. */
|
---|
| 285 | void handleScaleChange();
|
---|
| 286 |
|
---|
[53363] | 287 | /** Returns the pause-pixmap: */
|
---|
| 288 | const QPixmap& pausePixmap() const { return m_pausePixmap; }
|
---|
[53372] | 289 | /** Returns the scaled pause-pixmap: */
|
---|
| 290 | const QPixmap& pausePixmapScaled() const { return m_pausePixmapScaled; }
|
---|
[53363] | 291 | /** Resets the pause-pixmap. */
|
---|
[53372] | 292 | void resetPausePixmap();
|
---|
[53363] | 293 | /** Acquires live pause-pixmap. */
|
---|
[53372] | 294 | void takePausePixmapLive();
|
---|
[53363] | 295 | /** Acquires snapshot pause-pixmap. */
|
---|
[53372] | 296 | void takePausePixmapSnapshot();
|
---|
| 297 | /** Updates the scaled pause-pixmap. */
|
---|
| 298 | void updateScaledPausePixmap();
|
---|
[53363] | 299 |
|
---|
[39021] | 300 | /** The available area on the current screen for application windows. */
|
---|
| 301 | virtual QRect workingArea() const = 0;
|
---|
| 302 | /** Calculate how big the guest desktop can be while still fitting on one
|
---|
| 303 | * host screen. */
|
---|
[39023] | 304 | virtual QSize calculateMaxGuestSize() const = 0;
|
---|
[27335] | 305 | virtual void updateSliders();
|
---|
[30549] | 306 | static void dimImage(QImage &img);
|
---|
| 307 | void scrollContentsBy(int dx, int dy);
|
---|
[60362] | 308 | #ifdef VBOX_WS_MAC
|
---|
[27215] | 309 | void updateDockIcon();
|
---|
| 310 | CGImageRef frameBuffertoCGImageRef(UIFrameBuffer *pFrameBuffer);
|
---|
[60362] | 311 | #endif /* VBOX_WS_MAC */
|
---|
[38987] | 312 | /** Is this a fullscreen-type view? */
|
---|
[39108] | 313 | bool isFullscreenOrSeamless() const;
|
---|
[27215] | 314 |
|
---|
[26878] | 315 | /* Cross-platforms event processors: */
|
---|
| 316 | bool eventFilter(QObject *pWatched, QEvent *pEvent);
|
---|
[26754] | 317 | void resizeEvent(QResizeEvent *pEvent);
|
---|
| 318 | void moveEvent(QMoveEvent *pEvent);
|
---|
| 319 | void paintEvent(QPaintEvent *pEvent);
|
---|
| 320 |
|
---|
[63578] | 321 | /** Handles focus-in @a pEvent. */
|
---|
| 322 | void focusInEvent(QFocusEvent *pEvent);
|
---|
| 323 | /** Handles focus-out @a pEvent. */
|
---|
| 324 | void focusOutEvent(QFocusEvent *pEvent);
|
---|
[100064] | 325 | #ifdef VBOX_WS_NIX
|
---|
[100043] | 326 | virtual void keyPressEvent(QKeyEvent *pEvent) override;
|
---|
| 327 | virtual void keyReleaseEvent(QKeyEvent *pEvent) override;
|
---|
| 328 | #endif
|
---|
[63578] | 329 |
|
---|
[39451] | 330 | #ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
[55845] | 331 | /**
|
---|
[56497] | 332 | * Returns @true if the VM window can accept (start is, start) a drag and drop
|
---|
| 333 | * operation, @false if not.
|
---|
| 334 | */
|
---|
[98700] | 335 | bool dragAndDropCanAccept() const;
|
---|
[56497] | 336 |
|
---|
| 337 | /**
|
---|
[56321] | 338 | * Returns @true if drag and drop for this machine is active
|
---|
| 339 | * (that is, host->guest, guest->host or bidirectional), @false if not.
|
---|
[56077] | 340 | */
|
---|
[98700] | 341 | bool dragAndDropIsActive() const;
|
---|
[56077] | 342 |
|
---|
| 343 | /**
|
---|
[55845] | 344 | * Host -> Guest: Issued when the host cursor enters the guest (VM) window.
|
---|
| 345 | * The guest will receive the relative cursor coordinates of the
|
---|
| 346 | * appropriate screen ID.
|
---|
| 347 | *
|
---|
| 348 | * @param pEvent Related enter event.
|
---|
| 349 | */
|
---|
[39451] | 350 | void dragEnterEvent(QDragEnterEvent *pEvent);
|
---|
[55845] | 351 |
|
---|
| 352 | /**
|
---|
| 353 | * Host -> Guest: Issued when the host cursor moves inside (over) the guest (VM) window.
|
---|
| 354 | * The guest will receive the relative cursor coordinates of the
|
---|
| 355 | * appropriate screen ID.
|
---|
| 356 | *
|
---|
| 357 | * @param pEvent Related move event.
|
---|
| 358 | */
|
---|
[39451] | 359 | void dragLeaveEvent(QDragLeaveEvent *pEvent);
|
---|
[55845] | 360 |
|
---|
| 361 | /**
|
---|
| 362 | * Host -> Guest: Issued when the host cursor leaves the guest (VM) window again.
|
---|
| 363 | * This will ask the guest to stop any further drag'n drop operation.
|
---|
| 364 | *
|
---|
| 365 | * @param pEvent Related leave event.
|
---|
| 366 | */
|
---|
[39451] | 367 | void dragMoveEvent(QDragMoveEvent *pEvent);
|
---|
[55845] | 368 |
|
---|
| 369 | /**
|
---|
| 370 | * Host -> Guest: Issued when the host drops data into the guest (VM) window.
|
---|
| 371 | *
|
---|
| 372 | * @param pEvent Related drop event.
|
---|
| 373 | */
|
---|
[39451] | 374 | void dropEvent(QDropEvent *pEvent);
|
---|
| 375 | #endif /* VBOX_WITH_DRAG_AND_DROP */
|
---|
| 376 |
|
---|
[53912] | 377 | /** Scales passed size forward. */
|
---|
| 378 | QSize scaledForward(QSize size) const;
|
---|
| 379 | /** Scales passed size backward. */
|
---|
| 380 | QSize scaledBackward(QSize size) const;
|
---|
| 381 |
|
---|
[82032] | 382 | /** Updates mouse pointer @a pixmap, @a uXHot and @a uYHot according to scaling attributes. */
|
---|
| 383 | void updateMousePointerPixmapScaling(QPixmap &pixmap, uint &uXHot, uint &uYHot);
|
---|
| 384 |
|
---|
[38947] | 385 | /* Protected members: */
|
---|
[26637] | 386 | UIMachineWindow *m_pMachineWindow;
|
---|
[26921] | 387 | ulong m_uScreenId;
|
---|
[26816] | 388 | KMachineState m_previousState;
|
---|
[39094] | 389 | /** HACK: when switching out of fullscreen or seamless we wish to override
|
---|
| 390 | * the default size hint to avoid short resizes back to fullscreen size.
|
---|
| 391 | * Not explicitly initialised (i.e. invalid by default). */
|
---|
| 392 | QSize m_sizeHintOverride;
|
---|
[382] | 393 |
|
---|
[91696] | 394 | /** Last size hint sent as a part of guest auto-resize feature.
|
---|
| 395 | * @note Useful to avoid spamming CDisplay with same hint before
|
---|
| 396 | * frame-buffer finally resized to requested size. */
|
---|
| 397 | QSize m_lastSizeHint;
|
---|
| 398 |
|
---|
[58011] | 399 | /** Holds current host-screen number. */
|
---|
| 400 | int m_iHostScreenNumber;
|
---|
| 401 |
|
---|
[86977] | 402 | /** Holds the maximum guest screen size policy. */
|
---|
| 403 | MaximumGuestScreenSizePolicy m_enmMaximumGuestScreenSizePolicy;
|
---|
[39021] | 404 | /** The maximum guest size for fixed size policy. */
|
---|
| 405 | QSize m_fixedMaxGuestSize;
|
---|
[39023] | 406 | /** Maximum guest resolution which we wish to handle. Must be accessed
|
---|
[42318] | 407 | * atomically.
|
---|
| 408 | * @note The background for this variable is that we need this value to be
|
---|
| 409 | * available to the EMT thread, but it can only be calculated by the
|
---|
| 410 | * GUI, and GUI code can only safely be called on the GUI thread due to
|
---|
| 411 | * (at least) X11 threading issues. So we calculate the value in advance,
|
---|
| 412 | * monitor things in case it changes and update it atomically when it does.
|
---|
| 413 | */
|
---|
[39023] | 414 | /** @todo This should be private. */
|
---|
[97976] | 415 | volatile uint64_t m_u64MaximumGuestSize;
|
---|
[27012] | 416 |
|
---|
[53363] | 417 | /** Holds the pause-pixmap. */
|
---|
| 418 | QPixmap m_pausePixmap;
|
---|
[53372] | 419 | /** Holds the scaled pause-pixmap. */
|
---|
| 420 | QPixmap m_pausePixmapScaled;
|
---|
[26730] | 421 |
|
---|
[82032] | 422 | /** Holds cached mouse cursor. */
|
---|
| 423 | QCursor m_cursor;
|
---|
| 424 |
|
---|
[55821] | 425 | #ifdef VBOX_WITH_DRAG_AND_DROP
|
---|
| 426 | /** Pointer to drag and drop handler instance. */
|
---|
| 427 | UIDnDHandler *m_pDnDHandler;
|
---|
[56497] | 428 | # ifdef VBOX_WITH_DRAG_AND_DROP_GH
|
---|
| 429 | /** Flag indicating whether a guest->host drag currently is in
|
---|
| 430 | * progress or not. */
|
---|
| 431 | bool m_fIsDraggingFromGuest;
|
---|
| 432 | # endif
|
---|
[55821] | 433 | #endif
|
---|
| 434 |
|
---|
[63578] | 435 | /** Holds the native event filter instance. */
|
---|
| 436 | UINativeEventFilter *m_pNativeEventFilter;
|
---|
[382] | 437 | };
|
---|
| 438 |
|
---|
[27124] | 439 | /* This maintenance class is a part of future roll-back mechanism.
|
---|
| 440 | * It allows to block main GUI thread until specific event received.
|
---|
| 441 | * Later it will become more abstract but now its just used to help
|
---|
| 442 | * fullscreen & seamless modes to restore normal guest size hint. */
|
---|
[39081] | 443 | /** @todo This class is now unused - can it be removed altogether? */
|
---|
[27124] | 444 | class UIMachineViewBlocker : public QEventLoop
|
---|
| 445 | {
|
---|
| 446 | Q_OBJECT;
|
---|
| 447 |
|
---|
| 448 | public:
|
---|
| 449 |
|
---|
[27379] | 450 | UIMachineViewBlocker()
|
---|
[27124] | 451 | : QEventLoop(0)
|
---|
| 452 | , m_iTimerId(0)
|
---|
| 453 | {
|
---|
| 454 | /* Also start timer to unlock pool in case of
|
---|
| 455 | * required condition doesn't happens by some reason: */
|
---|
| 456 | m_iTimerId = startTimer(3000);
|
---|
| 457 | }
|
---|
| 458 |
|
---|
| 459 | virtual ~UIMachineViewBlocker()
|
---|
| 460 | {
|
---|
| 461 | /* Kill the timer: */
|
---|
| 462 | killTimer(m_iTimerId);
|
---|
| 463 | }
|
---|
| 464 |
|
---|
| 465 | protected:
|
---|
| 466 |
|
---|
| 467 | void timerEvent(QTimerEvent *pEvent)
|
---|
| 468 | {
|
---|
| 469 | /* If that timer event occurs => it seems
|
---|
| 470 | * guest resize event doesn't comes in time,
|
---|
| 471 | * shame on it, but we just unlocking 'this': */
|
---|
| 472 | QEventLoop::timerEvent(pEvent);
|
---|
| 473 | exit();
|
---|
| 474 | }
|
---|
| 475 |
|
---|
| 476 | int m_iTimerId;
|
---|
| 477 | };
|
---|
| 478 |
|
---|
[76581] | 479 | #endif /* !FEQT_INCLUDED_SRC_runtime_UIMachineView_h */
|
---|