VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIKeyboardHandlerFullscreen.cpp@ 104158

Last change on this file since 104158 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/* $Id: UIKeyboardHandlerFullscreen.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIKeyboardHandlerFullscreen class implementation.
4 */
5
6/*
7 * Copyright (C) 2010-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 <QKeyEvent>
30#include <QTimer>
31
32/* GUI includes: */
33#include "UIKeyboardHandlerFullscreen.h"
34#include "UIMachineLogic.h"
35#include "UIShortcutPool.h"
36
37
38/* Namespaces: */
39using namespace UIExtraDataDefs;
40
41UIKeyboardHandlerFullscreen::UIKeyboardHandlerFullscreen(UIMachineLogic* pMachineLogic)
42 : UIKeyboardHandler(pMachineLogic)
43{
44}
45
46UIKeyboardHandlerFullscreen::~UIKeyboardHandlerFullscreen()
47{
48}
49
50bool UIKeyboardHandlerFullscreen::eventFilter(QObject *pWatchedObject, QEvent *pEvent)
51{
52 /* Check if pWatchedObject object is view: */
53 if (UIMachineView *pWatchedView = isItListenedView(pWatchedObject))
54 {
55 /* Get corresponding screen index: */
56 ulong uScreenId = m_views.key(pWatchedView);
57 NOREF(uScreenId);
58 /* Handle view events: */
59 switch (pEvent->type())
60 {
61 case QEvent::KeyPress:
62 {
63 /* Get key-event: */
64 QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent);
65 /* Process Host+Home for menu popup: */
66 if ( isHostKeyPressed()
67 && gShortcutPool->shortcut(GUI_Input_MachineShortcuts, QString("PopupMenu")).sequences().contains(QKeySequence(pKeyEvent->key())))
68 {
69 /* Post request to show popup-menu: */
70 QTimer::singleShot(0, m_pMachineLogic, SLOT(sltInvokePopupMenu()));
71 /* Filter-out this event: */
72 return true;
73 }
74 break;
75 }
76 default:
77 break;
78 }
79 }
80
81 /* Else just propagate to base-class: */
82 return UIKeyboardHandler::eventFilter(pWatchedObject, pEvent);
83}
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