VirtualBox

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

Last change on this file since 104158 was 103538, checked in by vboxsync, 11 months ago

FE/Qt: Moving out logging stuff from UIDefs.h to separate UILoggingDefs.h; This breaks dependency of UIDefs/UICommon headers from VBox/log.h

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