VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp@ 79365

Last change on this file since 79365 was 79365, checked in by vboxsync, 6 years ago

Renaming VBoxGlobal to UICommon for bugref:9049 as planned.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.4 KB
Line 
1/* $Id: UIMachineWindowFullscreen.cpp 79365 2019-06-26 15:57:32Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMachineWindowFullscreen class implementation.
4 */
5
6/*
7 * Copyright (C) 2010-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/* Qt includes: */
19#include <QMenu>
20#include <QTimer>
21#ifdef VBOX_WS_WIN
22# include <QWindow>
23#endif
24
25/* GUI includes: */
26#include "UICommon.h"
27#include "UIDesktopWidgetWatchdog.h"
28#include "UIExtraDataManager.h"
29#include "UISession.h"
30#include "UIActionPoolRuntime.h"
31#include "UIMachineLogicFullscreen.h"
32#include "UIMachineWindowFullscreen.h"
33#include "UIMachineView.h"
34#if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
35# include "UIMachineDefs.h"
36# include "UIMiniToolBar.h"
37#elif defined(VBOX_WS_MAC)
38# include "UIFrameBuffer.h"
39# include "VBoxUtils-darwin.h"
40# include "UICocoaApplication.h"
41#endif /* VBOX_WS_MAC */
42
43/* COM includes: */
44#include "CSnapshot.h"
45
46
47UIMachineWindowFullscreen::UIMachineWindowFullscreen(UIMachineLogic *pMachineLogic, ulong uScreenId)
48 : UIMachineWindow(pMachineLogic, uScreenId)
49#if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
50 , m_pMiniToolBar(0)
51#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
52#ifdef VBOX_WS_MAC
53 , m_fIsInFullscreenTransition(false)
54#endif /* VBOX_WS_MAC */
55 , m_fWasMinimized(false)
56#ifdef VBOX_WS_X11
57 , m_fIsMinimizationRequested(false)
58 , m_fIsMinimized(false)
59#endif
60{
61}
62
63#ifdef VBOX_WS_MAC
64void UIMachineWindowFullscreen::handleNativeNotification(const QString &strNativeNotificationName)
65{
66 /* Make sure this method is only used for ML and next: */
67 AssertReturnVoid(uiCommon().osRelease() > MacOSXRelease_Lion);
68
69 /* Log all arrived notifications: */
70 LogRel(("UIMachineWindowFullscreen::handleNativeNotification: Notification '%s' received.\n",
71 strNativeNotificationName.toLatin1().constData()));
72
73 /* Handle 'NSWindowWillEnterFullScreenNotification' notification: */
74 if (strNativeNotificationName == "NSWindowWillEnterFullScreenNotification")
75 {
76 LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
77 "Native fullscreen mode about to enter, notifying listener...\n"));
78 emit sigNotifyAboutNativeFullscreenWillEnter();
79 }
80 /* Handle 'NSWindowDidEnterFullScreenNotification' notification: */
81 else if (strNativeNotificationName == "NSWindowDidEnterFullScreenNotification")
82 {
83 /* Mark window transition complete: */
84 m_fIsInFullscreenTransition = false;
85 LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
86 "Native fullscreen mode entered, notifying listener...\n"));
87 /* Update console's display viewport and 3D overlay: */
88 machineView()->updateViewport();
89 emit sigNotifyAboutNativeFullscreenDidEnter();
90 }
91 /* Handle 'NSWindowWillExitFullScreenNotification' notification: */
92 else if (strNativeNotificationName == "NSWindowWillExitFullScreenNotification")
93 {
94 LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
95 "Native fullscreen mode about to exit, notifying listener...\n"));
96 emit sigNotifyAboutNativeFullscreenWillExit();
97 }
98 /* Handle 'NSWindowDidExitFullScreenNotification' notification: */
99 else if (strNativeNotificationName == "NSWindowDidExitFullScreenNotification")
100 {
101 /* Mark window transition complete: */
102 m_fIsInFullscreenTransition = false;
103 LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
104 "Native fullscreen mode exited, notifying listener...\n"));
105 /* Update console's display viewport and 3D overlay: */
106 machineView()->updateViewport();
107 emit sigNotifyAboutNativeFullscreenDidExit();
108 }
109 /* Handle 'NSWindowDidFailToEnterFullScreenNotification' notification: */
110 else if (strNativeNotificationName == "NSWindowDidFailToEnterFullScreenNotification")
111 {
112 /* Mark window transition complete: */
113 m_fIsInFullscreenTransition = false;
114 LogRel(("UIMachineWindowFullscreen::handleNativeNotification: "
115 "Native fullscreen mode fail to enter, notifying listener...\n"));
116 emit sigNotifyAboutNativeFullscreenFailToEnter();
117 }
118}
119#endif /* VBOX_WS_MAC */
120
121#if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
122void UIMachineWindowFullscreen::sltMachineStateChanged()
123{
124 /* Call to base-class: */
125 UIMachineWindow::sltMachineStateChanged();
126
127 /* Update mini-toolbar: */
128 updateAppearanceOf(UIVisualElement_MiniToolBar);
129}
130
131void UIMachineWindowFullscreen::sltRevokeWindowActivation()
132{
133#ifdef VBOX_WS_X11
134 // WORKAROUND:
135 // We could be asked to minimize already, but just
136 // not yet executed that order to current moment.
137 if (m_fIsMinimizationRequested)
138 return;
139#endif
140
141 /* Make sure window is visible: */
142 if (!isVisible() || isMinimized())
143 return;
144
145 /* Revoke stolen activation: */
146#ifdef VBOX_WS_X11
147 raise();
148#endif /* VBOX_WS_X11 */
149 activateWindow();
150}
151#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
152
153#ifdef VBOX_WS_MAC
154void UIMachineWindowFullscreen::sltEnterNativeFullscreen(UIMachineWindow *pMachineWindow)
155{
156 /* Make sure this slot is called only under ML and next: */
157 AssertReturnVoid(uiCommon().osRelease() > MacOSXRelease_Lion);
158
159 /* Make sure it is NULL or 'this' window passed: */
160 if (pMachineWindow && pMachineWindow != this)
161 return;
162
163 /* Make sure this window has fullscreen logic: */
164 UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
165 AssertPtrReturnVoid(pFullscreenLogic);
166
167 /* Make sure this window should be shown and mapped to host-screen: */
168 if (!uisession()->isScreenVisible(m_uScreenId) ||
169 !pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
170 return;
171
172 /* Mark window 'transitioned to fullscreen': */
173 m_fIsInFullscreenTransition = true;
174
175 /* Enter native fullscreen mode if necessary: */
176 if ( (pFullscreenLogic->screensHaveSeparateSpaces() || m_uScreenId == 0)
177 && !darwinIsInFullscreenMode(this))
178 darwinToggleFullscreenMode(this);
179}
180
181void UIMachineWindowFullscreen::sltExitNativeFullscreen(UIMachineWindow *pMachineWindow)
182{
183 /* Make sure this slot is called only under ML and next: */
184 AssertReturnVoid(uiCommon().osRelease() > MacOSXRelease_Lion);
185
186 /* Make sure it is NULL or 'this' window passed: */
187 if (pMachineWindow && pMachineWindow != this)
188 return;
189
190 /* Make sure this window has fullscreen logic: */
191 UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
192 AssertPtrReturnVoid(pFullscreenLogic);
193
194 /* Mark window 'transitioned from fullscreen': */
195 m_fIsInFullscreenTransition = true;
196
197 /* Exit native fullscreen mode if necessary: */
198 if ( (pFullscreenLogic->screensHaveSeparateSpaces() || m_uScreenId == 0)
199 && darwinIsInFullscreenMode(this))
200 darwinToggleFullscreenMode(this);
201}
202#endif /* VBOX_WS_MAC */
203
204void UIMachineWindowFullscreen::sltShowMinimized()
205{
206#ifdef VBOX_WS_X11
207 /* Remember that we are asked to minimize: */
208 m_fIsMinimizationRequested = true;
209#endif
210
211 showMinimized();
212}
213
214void UIMachineWindowFullscreen::prepareVisualState()
215{
216 /* Call to base-class: */
217 UIMachineWindow::prepareVisualState();
218
219 /* The background has to go black: */
220 QPalette palette(centralWidget()->palette());
221 palette.setColor(centralWidget()->backgroundRole(), Qt::black);
222 centralWidget()->setPalette(palette);
223 centralWidget()->setAutoFillBackground(true);
224 setAutoFillBackground(true);
225
226#if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
227 /* Prepare mini-toolbar: */
228 prepareMiniToolbar();
229#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
230
231#ifdef VBOX_WS_MAC
232 /* Native fullscreen stuff on ML and next: */
233 if (uiCommon().osRelease() > MacOSXRelease_Lion)
234 {
235 /* Make sure this window has fullscreen logic: */
236 UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
237 AssertPtrReturnVoid(pFullscreenLogic);
238 /* Enable fullscreen support for every screen which requires it: */
239 if (pFullscreenLogic->screensHaveSeparateSpaces() || m_uScreenId == 0)
240 darwinEnableFullscreenSupport(this);
241 /* Enable transience support for other screens: */
242 else
243 darwinEnableTransienceSupport(this);
244 /* Register to native fullscreen notifications: */
245 UICocoaApplication::instance()->registerToNotificationOfWindow("NSWindowWillEnterFullScreenNotification", this,
246 UIMachineWindow::handleNativeNotification);
247 UICocoaApplication::instance()->registerToNotificationOfWindow("NSWindowDidEnterFullScreenNotification", this,
248 UIMachineWindow::handleNativeNotification);
249 UICocoaApplication::instance()->registerToNotificationOfWindow("NSWindowWillExitFullScreenNotification", this,
250 UIMachineWindow::handleNativeNotification);
251 UICocoaApplication::instance()->registerToNotificationOfWindow("NSWindowDidExitFullScreenNotification", this,
252 UIMachineWindow::handleNativeNotification);
253 UICocoaApplication::instance()->registerToNotificationOfWindow("NSWindowDidFailToEnterFullScreenNotification", this,
254 UIMachineWindow::handleNativeNotification);
255}
256#endif /* VBOX_WS_MAC */
257}
258
259#if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
260void UIMachineWindowFullscreen::prepareMiniToolbar()
261{
262 /* Make sure mini-toolbar is not restricted: */
263 if (!gEDataManager->miniToolbarEnabled(uiCommon().managedVMUuid()))
264 return;
265
266 /* Create mini-toolbar: */
267 m_pMiniToolBar = new UIMiniToolBar(this,
268 GeometryType_Full,
269 gEDataManager->miniToolbarAlignment(uiCommon().managedVMUuid()),
270 gEDataManager->autoHideMiniToolbar(uiCommon().managedVMUuid()),
271 screenId());
272 AssertPtrReturnVoid(m_pMiniToolBar);
273 {
274 /* Configure mini-toolbar: */
275 m_pMiniToolBar->addMenus(actionPool()->menus());
276 connect(m_pMiniToolBar, SIGNAL(sigMinimizeAction()),
277 this, SLOT(sltShowMinimized()), Qt::QueuedConnection);
278 connect(m_pMiniToolBar, SIGNAL(sigExitAction()),
279 actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SLOT(trigger()));
280 connect(m_pMiniToolBar, SIGNAL(sigCloseAction()),
281 actionPool()->action(UIActionIndex_M_Application_S_Close), SLOT(trigger()));
282 connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutWindowActivationStolen()),
283 this, SLOT(sltRevokeWindowActivation()), Qt::QueuedConnection);
284 }
285}
286#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
287
288#if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
289void UIMachineWindowFullscreen::cleanupMiniToolbar()
290{
291 /* Make sure mini-toolbar was created: */
292 if (!m_pMiniToolBar)
293 return;
294
295 /* Save mini-toolbar settings: */
296 gEDataManager->setAutoHideMiniToolbar(m_pMiniToolBar->autoHide(), uiCommon().managedVMUuid());
297 /* Delete mini-toolbar: */
298 delete m_pMiniToolBar;
299 m_pMiniToolBar = 0;
300}
301#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
302
303void UIMachineWindowFullscreen::cleanupVisualState()
304{
305#ifdef VBOX_WS_MAC
306 /* Native fullscreen stuff on ML and next: */
307 if (uiCommon().osRelease() > MacOSXRelease_Lion)
308 {
309 /* Unregister from native fullscreen notifications: */
310 UICocoaApplication::instance()->unregisterFromNotificationOfWindow("NSWindowWillEnterFullScreenNotification", this);
311 UICocoaApplication::instance()->unregisterFromNotificationOfWindow("NSWindowDidEnterFullScreenNotification", this);
312 UICocoaApplication::instance()->unregisterFromNotificationOfWindow("NSWindowWillExitFullScreenNotification", this);
313 UICocoaApplication::instance()->unregisterFromNotificationOfWindow("NSWindowDidExitFullScreenNotification", this);
314 UICocoaApplication::instance()->unregisterFromNotificationOfWindow("NSWindowDidFailToEnterFullScreenNotification", this);
315 }
316#endif /* VBOX_WS_MAC */
317
318#if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
319 /* Cleanup mini-toolbar: */
320 cleanupMiniToolbar();
321#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
322
323 /* Call to base-class: */
324 UIMachineWindow::cleanupVisualState();
325}
326
327void UIMachineWindowFullscreen::placeOnScreen()
328{
329 /* Make sure this window has fullscreen logic: */
330 UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
331 AssertPtrReturnVoid(pFullscreenLogic);
332
333 /* Get corresponding host-screen: */
334 const int iHostScreen = pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId);
335 /* And corresponding working area: */
336 const QRect workingArea = gpDesktop->screenGeometry(iHostScreen);
337 Q_UNUSED(workingArea);
338
339#if defined(VBOX_WS_MAC)
340
341 /* Move window to the appropriate position: */
342 move(workingArea.topLeft());
343
344 /* Resize window to the appropriate size on Lion and previous: */
345 if (uiCommon().osRelease() <= MacOSXRelease_Lion)
346 resize(workingArea.size());
347 /* Resize window to the appropriate size on ML and next if it's screen has no own user-space: */
348 else if (!pFullscreenLogic->screensHaveSeparateSpaces() && m_uScreenId != 0)
349 resize(workingArea.size());
350 /* Resize the window if we are already in the full screen mode. This covers cases like host-resolution changes while in full screen mode: */
351 else if(darwinIsInFullscreenMode(this))
352 resize(workingArea.size());
353 else
354 {
355 /* Load normal geometry first of all: */
356 QRect geo = gEDataManager->machineWindowGeometry(UIVisualStateType_Normal, m_uScreenId, uiCommon().managedVMUuid());
357 /* If normal geometry is null => use frame-buffer size: */
358 if (geo.isNull())
359 {
360 const UIFrameBuffer *pFrameBuffer = uisession()->frameBuffer(m_uScreenId);
361 geo = QRect(QPoint(0, 0), QSize(pFrameBuffer->width(), pFrameBuffer->height()).boundedTo(workingArea.size()));
362 }
363 /* If normal geometry still null => use default size: */
364 if (geo.isNull())
365 geo = QRect(QPoint(0, 0), QSize(800, 600).boundedTo(workingArea.size()));
366 /* Move window to the center of working-area: */
367 geo.moveCenter(workingArea.center());
368 UICommon::setTopLevelGeometry(this, geo);
369 }
370
371#elif defined(VBOX_WS_WIN)
372
373 /* Map window onto required screen: */
374 windowHandle()->setScreen(qApp->screens().at(iHostScreen));
375 /* Set appropriate window size: */
376 resize(workingArea.size());
377
378#elif defined(VBOX_WS_X11)
379
380 /* Determine whether we should use the native full-screen mode: */
381 const bool fUseNativeFullScreen = UICommon::supportsFullScreenMonitorsProtocolX11() &&
382 !gEDataManager->legacyFullscreenModeRequested();
383 if (fUseNativeFullScreen)
384 {
385 /* Tell recent window managers which host-screen this window should be mapped to: */
386 UICommon::setFullScreenMonitorX11(this, pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId));
387 }
388
389 /* Set appropriate window geometry: */
390 resize(workingArea.size());
391 move(workingArea.topLeft());
392
393#else
394
395# warning "port me"
396
397#endif
398}
399
400void UIMachineWindowFullscreen::showInNecessaryMode()
401{
402 /* Make sure window has fullscreen logic: */
403 UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
404 AssertPtrReturnVoid(pFullscreenLogic);
405
406#if defined(VBOX_WS_MAC)
407
408 /* If window shouldn't be shown or mapped to some host-screen: */
409 if (!uisession()->isScreenVisible(m_uScreenId) ||
410 !pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
411 {
412 /* Hide window: */
413 hide();
414 }
415 /* If window should be shown and mapped to some host-screen: */
416 else
417 {
418 /* Make sure window have appropriate geometry: */
419 placeOnScreen();
420
421 /* Simple show() for ML and next, showFullScreen() otherwise: */
422 if (uiCommon().osRelease() > MacOSXRelease_Lion)
423 show();
424 else
425 showFullScreen();
426
427 /* Adjust machine-view size if necessary: */
428 adjustMachineViewSize();
429
430 /* Make sure machine-view have focus: */
431 m_pMachineView->setFocus();
432 }
433
434#elif defined(VBOX_WS_WIN)
435
436 /* If window shouldn't be shown or mapped to some host-screen: */
437 if (!uisession()->isScreenVisible(m_uScreenId) ||
438 !pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
439 {
440 /* Remember whether the window was minimized: */
441 if (isMinimized())
442 m_fWasMinimized = true;
443
444 /* Hide window and reset it's state to NONE: */
445 setWindowState(Qt::WindowNoState);
446 hide();
447 }
448 /* If window should be shown and mapped to some host-screen: */
449 else
450 {
451 /* Check whether window was minimized: */
452 const bool fWasMinimized = isMinimized() && isVisible();
453 /* And reset it's state in such case before exposing: */
454 if (fWasMinimized)
455 setWindowState(Qt::WindowNoState);
456
457 /* Make sure window have appropriate geometry: */
458 placeOnScreen();
459
460 /* Show window: */
461 showFullScreen();
462
463 /* Restore minimized state if necessary: */
464 if (m_fWasMinimized || fWasMinimized)
465 {
466 m_fWasMinimized = false;
467 QMetaObject::invokeMethod(this, "showMinimized", Qt::QueuedConnection);
468 }
469
470 /* Adjust machine-view size if necessary: */
471 adjustMachineViewSize();
472
473 /* Make sure machine-view have focus: */
474 m_pMachineView->setFocus();
475 }
476
477#elif defined(VBOX_WS_X11)
478
479 /* If window shouldn't be shown or mapped to some host-screen: */
480 if (!uisession()->isScreenVisible(m_uScreenId) ||
481 !pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
482 {
483 /* Remember whether the window was minimized: */
484 if (isMinimized())
485 m_fWasMinimized = true;
486
487 /* Hide window and reset it's state to NONE: */
488 setWindowState(Qt::WindowNoState);
489 hide();
490 }
491 /* If window should be shown and mapped to some host-screen: */
492 else
493 {
494 /* Check whether window was minimized: */
495 const bool fWasMinimized = isMinimized() && isVisible();
496 /* And reset it's state in such case before exposing: */
497 if (fWasMinimized)
498 setWindowState(Qt::WindowNoState);
499
500 /* Show window: */
501 showFullScreen();
502
503 /* Make sure window have appropriate geometry: */
504 placeOnScreen();
505
506 /* Restore full-screen state after placeOnScreen() call: */
507 setWindowState(Qt::WindowFullScreen);
508
509 /* Restore minimized state if necessary: */
510 if (m_fWasMinimized || fWasMinimized)
511 {
512 m_fWasMinimized = false;
513 QMetaObject::invokeMethod(this, "showMinimized", Qt::QueuedConnection);
514 }
515
516 /* Adjust machine-view size if necessary: */
517 adjustMachineViewSize();
518
519 /* Make sure machine-view have focus: */
520 m_pMachineView->setFocus();
521 }
522
523#else
524
525# warning "port me"
526
527#endif
528}
529
530#if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
531void UIMachineWindowFullscreen::updateAppearanceOf(int iElement)
532{
533 /* Call to base-class: */
534 UIMachineWindow::updateAppearanceOf(iElement);
535
536 /* Update mini-toolbar: */
537 if (iElement & UIVisualElement_MiniToolBar)
538 {
539 /* If there is a mini-toolbar: */
540 if (m_pMiniToolBar)
541 {
542 /* Get snapshot(s): */
543 QString strSnapshotName;
544 if (machine().GetSnapshotCount() > 0)
545 {
546 CSnapshot snapshot = machine().GetCurrentSnapshot();
547 strSnapshotName = " (" + snapshot.GetName() + ")";
548 }
549 /* Update mini-toolbar text: */
550 m_pMiniToolBar->setText(machineName() + strSnapshotName);
551 }
552 }
553}
554#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
555
556#ifdef VBOX_WS_X11
557void UIMachineWindowFullscreen::changeEvent(QEvent *pEvent)
558{
559 switch (pEvent->type())
560 {
561 case QEvent::WindowStateChange:
562 {
563 /* Watch for window state changes: */
564 QWindowStateChangeEvent *pChangeEvent = static_cast<QWindowStateChangeEvent*>(pEvent);
565 LogRel2(("GUI: UIMachineWindowFullscreen::changeEvent: Window state changed from %d to %d\n",
566 (int)pChangeEvent->oldState(), (int)windowState()));
567 if ( windowState() == Qt::WindowMinimized
568 && pChangeEvent->oldState() == Qt::WindowNoState
569 && !m_fIsMinimized)
570 {
571 /* Mark window minimized, isMinimized() is not enough due to Qt5vsX11 fight: */
572 LogRel2(("GUI: UIMachineWindowFullscreen::changeEvent: Window minimized\n"));
573 m_fIsMinimized = true;
574 }
575 else
576 if ( windowState() == Qt::WindowNoState
577 && pChangeEvent->oldState() == Qt::WindowMinimized
578 && m_fIsMinimized)
579 {
580 /* Mark window restored, and do manual restoring with showInNecessaryMode(): */
581 LogRel2(("GUI: UIMachineWindowFullscreen::changeEvent: Window restored\n"));
582 m_fIsMinimized = false;
583 /* Remember that we no more asked to minimize: */
584 m_fIsMinimizationRequested = false;
585 showInNecessaryMode();
586 }
587 break;
588 }
589 default:
590 break;
591 }
592
593 /* Call to base-class: */
594 UIMachineWindow::changeEvent(pEvent);
595}
596#endif /* VBOX_WS_X11 */
597
598#ifdef VBOX_WS_WIN
599void UIMachineWindowFullscreen::showEvent(QShowEvent *pEvent)
600{
601 /* Expose workaround again,
602 * Qt devs will never fix that it seems.
603 * This time they forget to set 'Mapped'
604 * attribute for initially frame-less window. */
605 setAttribute(Qt::WA_Mapped);
606
607 /* Call to base-class: */
608 UIMachineWindow::showEvent(pEvent);
609}
610#endif /* VBOX_WS_WIN */
611
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette