VirtualBox

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

Last change on this file since 69498 was 69498, checked in by vboxsync, 7 years ago

backed out r118835 as it incorrectly updated the 'This file is based on' file headers.

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

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