VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/platform/nix/VBoxUtils-nix.h

Last change on this file was 99863, checked in by vboxsync, 12 months ago

scm fixes for src\platform\nix\VBoxUtils-nix.h Config.kmk VMM\VMMAll\IEMAllInstructionsThreadedRecompiler.cpp

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
Line 
1/* $Id: VBoxUtils-nix.h 99863 2023-05-19 17:34:53Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - Declarations of utility classes and functions for handling X11 specific tasks.
4 */
5
6/*
7 * Copyright (C) 2006-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#ifndef FEQT_INCLUDED_SRC_platform_nix_VBoxUtils_nix_h
29#define FEQT_INCLUDED_SRC_platform_nix_VBoxUtils_nix_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QString>
36#include <QVector>
37#include <QWindow>
38
39#include <VBox/GuestHost/DisplayServerType.h>
40
41/* GUI includes: */
42#include "UILibraryDefs.h"
43
44/** X11: Known Window Manager types. */
45enum X11WMType
46{
47 X11WMType_Unknown,
48 X11WMType_Compiz,
49 X11WMType_GNOMEShell,
50 X11WMType_KWin,
51 X11WMType_Metacity,
52 X11WMType_Mutter,
53 X11WMType_Xfwm4,
54};
55
56/** X11: Screen-saver inhibit methods. */
57struct SHARED_LIBRARY_STUFF DBusScreenSaverInhibitMethod
58{
59 QString m_strServiceName;
60 QString m_strInterface;
61 QString m_strPath;
62 uint m_iCookie;
63};
64
65/** X11: XCB size-hints. */
66typedef struct
67{
68 /** User specified flags */
69 uint32_t flags;
70 /** User-specified position */
71 int32_t x, y;
72 /** User-specified size */
73 int32_t width, height;
74 /** Program-specified minimum size */
75 int32_t min_width, min_height;
76 /** Program-specified maximum size */
77 int32_t max_width, max_height;
78 /** Program-specified resize increments */
79 int32_t width_inc, height_inc;
80 /** Program-specified minimum aspect ratios */
81 int32_t min_aspect_num, min_aspect_den;
82 /** Program-specified maximum aspect ratios */
83 int32_t max_aspect_num, max_aspect_den;
84 /** Program-specified base size */
85 int32_t base_width, base_height;
86 /** Program-specified window gravity */
87 uint32_t win_gravity;
88} xcb_size_hints_t;
89
90/* X11 structs to avoid dragging in unnecessary X headers: */
91struct xcb_connection_t;
92struct _XDisplay;
93
94/* Namespace for native window sub-system functions: */
95namespace NativeWindowSubsystem
96{
97 /** Wrapper function for X11IsCompositingManagerRunning and WaylandIsCompositingManagerRunning. */
98 bool isCompositingManagerRunning(bool fIsXServerAvailable);
99 /** X11: Determines and returns whether the compositing manager is running. */
100 bool X11IsCompositingManagerRunning();
101 /** Wayland: Determines and returns whether the compositing manager is running. */
102 bool WaylandIsCompositingManagerRunning();
103
104 /** Wrapper for window manager type functions. */
105 X11WMType windowManagerType(bool fIsXServerAvailable);
106 /** X11: Determines and returns current Window Manager type. */
107 X11WMType X11WindowManagerType();
108 /** Wayland: Determines and returns current Window Manager type. */
109 X11WMType WaylandWindowManagerType();
110
111 /** Wrapper for X11CheckExtension and WaylandCheckExtension functions. */
112 bool checkExtension(bool fIsXServerAvailable, const char *extensionName);
113 /** X11: Returns true if XLib extension with name @p extensionName is available, false otherwise. */
114 bool X11CheckExtension(const char *pExtensionName);
115 bool WaylandCheckExtension(const char *pExtensionName);
116
117
118 /** DBus: Returns whether there are any DBus services whose name contains the substring 'screensaver'. */
119 bool checkDBusScreenSaverServices();
120 /** DBus: Returns the list of Inhibit methods found by introspecting DBus services. */
121 SHARED_LIBRARY_STUFF QVector<DBusScreenSaverInhibitMethod*> findDBusScrenSaverInhibitMethods();
122 /** DBus: Disables/enables Screen Saver through QDBus. */
123 SHARED_LIBRARY_STUFF void toggleHostScrenSaver(bool fInhibit, QVector<DBusScreenSaverInhibitMethod*> &inOutInhibitMethods);
124
125 /** Wrapper function for X11ActivateWindow or WaylandActivateWindow. */
126 bool activateWindow(bool fIsXServerAvailable, WId wId, bool fSwitchDesktop);
127 /** Activates window with certain @a wId, @a fSwitchDesktop if requested. */
128 bool X11ActivateWindow(WId wId, bool fSwitchDesktop);
129 /** Activates window with certain @a wId, @a fSwitchDesktop if requested. */
130 bool WaylandActivateWindow(WId wId, bool fSwitchDesktop);
131
132 /** X11: Test whether the current window manager supports full screen mode. */
133 SHARED_LIBRARY_STUFF bool X11SupportsFullScreenMonitorsProtocol();
134 /** X11: Performs mapping of the passed @a pWidget to host-screen with passed @a uScreenId. */
135 SHARED_LIBRARY_STUFF bool X11SetFullScreenMonitor(QWidget *pWidget, ulong uScreenId);
136
137 /** X11: Sets _NET_WM_STATE_SKIP_TASKBAR flag for passed @a pWidget. */
138 SHARED_LIBRARY_STUFF void X11SetSkipTaskBarFlag(QWidget *pWidget);
139 /** X11: Sets _NET_WM_STATE_SKIP_PAGER flag for passed @a pWidget. */
140 SHARED_LIBRARY_STUFF void X11SetSkipPagerFlag(QWidget *pWidget);
141
142 /** Wrapper function for WMClass setters. */
143 SHARED_LIBRARY_STUFF void setWMClass(bool fIsXServerAvailable, QWidget *pWidget, const QString &strNameString, const QString &strClassString);
144 /** X11: Assigns WM_CLASS property for passed @a pWidget. */
145 SHARED_LIBRARY_STUFF void X11SetWMClass(QWidget *pWidget, const QString &strNameString, const QString &strClassString);
146 /** Wayland: Assigns WM_CLASS property for passed @a pWidget. */
147 SHARED_LIBRARY_STUFF void WaylandSetWMClass(QWidget *pWidget, const QString &strNameString, const QString &strClassString);
148
149 /** X11: Tell the WM we are well behaved wrt Xwayland keyboard-grabs. This will
150 * make the WM turn our grab into a Wayland shortcut inhibition request,
151 * so that e.g. alt+tab will get send to the VM instead of moving the
152 * focus away from the VM. */
153 SHARED_LIBRARY_STUFF void setXwaylandMayGrabKeyboardFlag(bool fIsXServerAvailable, QWidget *pWidget);
154
155 /** X11: Gets the X11 display pointer. */
156 SHARED_LIBRARY_STUFF struct _XDisplay *X11GetDisplay();
157 /** X11: Gets the X11 connection. */
158 SHARED_LIBRARY_STUFF struct xcb_connection_t *X11GetConnection();
159 /** X11: Gets the X11 root (desktop) window. */
160 SHARED_LIBRARY_STUFF uint32_t X11GetAppRootWindow();
161}
162
163#endif /* !FEQT_INCLUDED_SRC_platform_nix_VBoxUtils_nix_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use