VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/UICursor.cpp@ 102493

Last change on this file since 102493 was 100064, checked in by vboxsync, 16 months ago

FE/Qt: bugref:10421. Replacing VBOX_WS_X11 with VBOX_WS_NIX.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: UICursor.cpp 100064 2023-06-04 09:10:01Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UICursor namespace implementation.
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/* Qt includes: */
29#include <QGraphicsWidget>
30#include <QWidget>
31
32/* GUI includes: */
33#include "UICommon.h"
34#include "UICursor.h"
35
36
37/* static */
38void UICursor::setCursor(QWidget *pWidget, const QCursor &cursor)
39{
40 if (!pWidget)
41 return;
42
43#ifdef VBOX_WS_NIX
44 /* As reported in https://www.virtualbox.org/ticket/16348,
45 * in X11 QWidget::setCursor(..) call uses RENDER
46 * extension. Qt (before 5.11) fails to handle the case where the mentioned extension
47 * is missing. Please see https://codereview.qt-project.org/#/c/225665/ for Qt patch: */
48 if ((UICommon::qtRTMajorVersion() < 5) ||
49 (UICommon::qtRTMajorVersion() == 5 && UICommon::qtRTMinorVersion() < 11))
50 {
51 if (NativeWindowSubsystem::checkExtension(uiCommon().X11ServerAvailable(), "RENDER"))
52 pWidget->setCursor(cursor);
53 }
54 else
55 {
56 pWidget->setCursor(cursor);
57 }
58#else
59 pWidget->setCursor(cursor);
60#endif
61}
62
63/* static */
64void UICursor::setCursor(QGraphicsWidget *pWidget, const QCursor &cursor)
65{
66 if (!pWidget)
67 return;
68
69#ifdef VBOX_WS_NIX
70 /* As reported in https://www.virtualbox.org/ticket/16348,
71 * in X11 QGraphicsWidget::setCursor(..) call uses RENDER
72 * extension. Qt (before 5.11) fails to handle the case where the mentioned extension
73 * is missing. Please see https://codereview.qt-project.org/#/c/225665/ for Qt patch: */
74 if ((UICommon::qtRTMajorVersion() < 5) ||
75 (UICommon::qtRTMajorVersion() == 5 && UICommon::qtRTMinorVersion() < 11))
76 {
77 if (NativeWindowSubsystem::checkExtension(uiCommon().X11ServerAvailable(), "RENDER"))
78 pWidget->setCursor(cursor);
79 }
80 else
81 {
82 pWidget->setCursor(cursor);
83 }
84#else
85 pWidget->setCursor(cursor);
86#endif
87}
88
89/* static */
90void UICursor::unsetCursor(QWidget *pWidget)
91{
92 if (!pWidget)
93 return;
94
95#ifdef VBOX_WS_NIX
96 /* As reported in https://www.virtualbox.org/ticket/16348,
97 * in X11 QWidget::unsetCursor(..) call uses RENDER
98 * extension. Qt (before 5.11) fails to handle the case where the mentioned extension
99 * is missing. Please see https://codereview.qt-project.org/#/c/225665/ for Qt patch: */
100 if ((UICommon::qtRTMajorVersion() < 5) ||
101 (UICommon::qtRTMajorVersion() == 5 && UICommon::qtRTMinorVersion() < 11))
102 {
103 if (NativeWindowSubsystem::checkExtension(uiCommon().X11ServerAvailable(), "RENDER"))
104 pWidget->unsetCursor();
105 }
106 else
107 {
108 pWidget->unsetCursor();
109 }
110#else
111 pWidget->unsetCursor();
112#endif
113}
114
115/* static */
116void UICursor::unsetCursor(QGraphicsWidget *pWidget)
117{
118 if (!pWidget)
119 return;
120
121#ifdef VBOX_WS_NIX
122 /* As reported in https://www.virtualbox.org/ticket/16348,
123 * in X11 QGraphicsWidget::unsetCursor(..) call uses RENDER
124 * extension. Qt (before 5.11) fails to handle the case where the mentioned extension
125 * is missing. Please see https://codereview.qt-project.org/#/c/225665/ for Qt patch: */
126 if ((UICommon::qtRTMajorVersion() < 5) ||
127 (UICommon::qtRTMajorVersion() == 5 && UICommon::qtRTMinorVersion() < 11))
128 {
129 if (NativeWindowSubsystem::checkExtension(uiCommon().X11ServerAvailable(), "RENDER"))
130 pWidget->unsetCursor();
131 }
132 else
133 {
134 pWidget->unsetCursor();
135 }
136#else
137 pWidget->unsetCursor();
138#endif
139}
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