VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 4 months ago

Copyright year updates by scm.

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