VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

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: 7.2 KB
Line 
1/* $Id: UIMachineLogicFullscreen.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIMachineLogicFullscreen class declaration.
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#ifndef FEQT_INCLUDED_SRC_runtime_fullscreen_UIMachineLogicFullscreen_h
29#define FEQT_INCLUDED_SRC_runtime_fullscreen_UIMachineLogicFullscreen_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* GUI includes: */
35#include "UIMachineLogic.h"
36
37/* Other includes: */
38#ifdef VBOX_WS_MAC
39# include <ApplicationServices/ApplicationServices.h>
40#endif /* VBOX_WS_MAC */
41
42/* Forward declarations: */
43class UIMultiScreenLayout;
44
45/** UIMachineLogic subclass used as full-screen machine logic implementation. */
46class UIMachineLogicFullscreen : public UIMachineLogic
47{
48 Q_OBJECT;
49
50#ifdef RT_OS_DARWIN
51signals:
52
53 /** Mac OS X: Notifies listeners about native fullscreen mode should be entered on @a pMachineWindow. */
54 void sigNotifyAboutNativeFullscreenShouldBeEntered(UIMachineWindow *pMachineWindow = 0);
55 /** Mac OS X: Notifies listeners about native fullscreen mode should be exited on @a pMachineWindow. */
56 void sigNotifyAboutNativeFullscreenShouldBeExited(UIMachineWindow *pMachineWindow = 0);
57#endif /* RT_OS_DARWIN */
58
59public:
60
61 /** Constructs a logic passing @a pMachine and @a pSession to the base-class.
62 * @param pMachine Brings the machine this logic belongs to. */
63 UIMachineLogicFullscreen(UIMachine *pMachine);
64 /** Destructs the logic. */
65 virtual ~UIMachineLogicFullscreen() RT_OVERRIDE;
66
67 /** Returns visual state type. */
68 virtual UIVisualStateType visualStateType() const RT_OVERRIDE { return UIVisualStateType_Fullscreen; }
69
70 /** Returns an index of host-screen for guest-screen with @a iScreenId specified. */
71 int hostScreenForGuestScreen(int iScreenId) const;
72 /** Returns whether there is a host-screen for guest-screen with @a iScreenId specified. */
73 bool hasHostScreenForGuestScreen(int iScreenId) const;
74
75#ifdef VBOX_WS_MAC
76 /** Returns whether screens have separate spaces. */
77 bool screensHaveSeparateSpaces() const { return m_fScreensHaveSeparateSpaces; }
78#endif /* VBOX_WS_MAC */
79
80protected:
81
82 /* Check if this logic is available: */
83 bool checkAvailability() RT_OVERRIDE;
84
85 /** Returns machine-window flags for 'Fullscreen' machine-logic and passed @a uScreenId. */
86 virtual Qt::WindowFlags windowFlags(ulong uScreenId) const RT_OVERRIDE;
87
88 /** Adjusts machine-window geometry if necessary for 'Fullscreen'. */
89 virtual void adjustMachineWindowsGeometry() RT_OVERRIDE;
90
91private slots:
92
93#ifdef RT_OS_DARWIN
94 /** Mac OS X: Handles native notification about 'fullscreen' will be entered. */
95 void sltHandleNativeFullscreenWillEnter();
96 /** Mac OS X: Handles native notification about 'fullscreen' entered. */
97 void sltHandleNativeFullscreenDidEnter();
98 /** Mac OS X: Handles native notification about 'fullscreen' will be exited. */
99 void sltHandleNativeFullscreenWillExit();
100 /** Mac OS X: Handles native notification about 'fullscreen' exited. */
101 void sltHandleNativeFullscreenDidExit();
102 /** Mac OS X: Handles native notification about 'fullscreen' fail to enter. */
103 void sltHandleNativeFullscreenFailToEnter();
104
105 /** Mac OS X: Requests visual-state change from 'fullscreen' to 'normal' (window). */
106 void sltChangeVisualStateToNormal() RT_OVERRIDE;
107 /** Mac OS X: Requests visual-state change from 'fullscreen' to 'seamless'. */
108 void sltChangeVisualStateToSeamless() RT_OVERRIDE;
109 /** Mac OS X: Requests visual-state change from 'fullscreen' to 'scale'. */
110 void sltChangeVisualStateToScale() RT_OVERRIDE;
111
112 /** Mac OS X: Checks if some visual-state type was requested. */
113 void sltCheckForRequestedVisualStateType() RT_OVERRIDE;
114#endif /* RT_OS_DARWIN */
115
116 /* Handler: Console callback stuff: */
117 void sltMachineStateChanged() RT_OVERRIDE;
118
119 /** Invokes popup-menu. */
120 void sltInvokePopupMenu();
121
122 /** Updates machine-window(s) location/size on screen-layout changes. */
123 void sltScreenLayoutChanged();
124
125 /** Handles guest-screen count change. */
126 virtual void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo) RT_OVERRIDE;
127 /** Handles host-screen count change. */
128 virtual void sltHostScreenCountChange() RT_OVERRIDE;
129 /** Handles host-screen available-area change. */
130 virtual void sltHostScreenAvailableAreaChange() RT_OVERRIDE;
131 /** Handles additions-state change. */
132 virtual void sltAdditionsStateChanged() RT_OVERRIDE;
133
134private:
135
136 /* Prepare helpers: */
137 void prepareActionGroups() RT_OVERRIDE;
138 void prepareActionConnections() RT_OVERRIDE;
139 void prepareMachineWindows() RT_OVERRIDE;
140 void prepareMenu() RT_OVERRIDE;
141
142 /* Cleanup helpers: */
143 void cleanupMenu() RT_OVERRIDE;
144 void cleanupMachineWindows() RT_OVERRIDE;
145 void cleanupActionConnections() RT_OVERRIDE;
146 void cleanupActionGroups() RT_OVERRIDE;
147
148#ifdef VBOX_WS_MAC
149 /** Mac OS X: Revalidates 'fullscreen' mode for @a pMachineWindow. */
150 void revalidateNativeFullScreen(UIMachineWindow *pMachineWindow);
151 /** Mac OS X: Revalidates 'fullscreen' mode for all windows. */
152 void revalidateNativeFullScreen();
153
154 /** Mac OS X: Proxies native notification about application activation. */
155 static void nativeHandlerForApplicationActivation(QObject *pObject, const QMap<QString, QString> &userInfo);
156 /** Mac OS X: Handles native notification about application activation. */
157 void nativeHandlerForApplicationActivation(const QMap<QString, QString> &userInfo);
158
159 /** Mac OS X: Proxies native notification about active space change. */
160 static void nativeHandlerForActiveSpaceChange(QObject *pObject, const QMap<QString, QString> &userInfo);
161 /** Mac OS X: Handles native notification about active space change. */
162 void nativeHandlerForActiveSpaceChange(const QMap<QString, QString> &userInfo);
163#endif /* VBOX_WS_MAC */
164
165 /** Holds the popup-menu instance. */
166 QMenu *m_pPopupMenu;
167
168 /* Variables: */
169 UIMultiScreenLayout *m_pScreenLayout;
170
171#ifdef VBOX_WS_MAC
172 /** Mac OS X: Holds whether screens have separate spaces. */
173 const bool m_fScreensHaveSeparateSpaces;
174
175 /** Mac OS X: Contains machine-window(s) marked as 'fullscreen'. */
176 QSet<UIMachineWindow*> m_fullscreenMachineWindows;
177 /** Mac OS X: Contains machine-window(s) marked as 'invalid fullscreen'. */
178 QSet<UIMachineWindow*> m_invalidFullscreenMachineWindows;
179#endif /* VBOX_WS_MAC */
180};
181
182#endif /* !FEQT_INCLUDED_SRC_runtime_fullscreen_UIMachineLogicFullscreen_h */
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