VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.h

Last change on this file was 106061, checked in by vboxsync, 4 weeks ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/* $Id: DarwinKeyboard.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - Declarations of utility functions for handling Darwin Keyboard specific tasks.
4 */
5
6/*
7 * Copyright (C) 2006-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_platform_darwin_DarwinKeyboard_h
29#define FEQT_INCLUDED_SRC_platform_darwin_DarwinKeyboard_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* GUI includes: */
35#include "UILibraryDefs.h"
36
37/* External includes: */
38#include <CoreFoundation/CFBase.h>
39
40
41RT_C_DECLS_BEGIN
42
43/** Private hack for missing rightCmdKey enum. */
44#define kEventKeyModifierRightCmdKeyMask (1<<27)
45
46/** The scancode mask. */
47#define VBOXKEY_SCANCODE_MASK 0x007f
48/** Extended key. */
49#define VBOXKEY_EXTENDED 0x0080
50/** Modifier key. */
51#define VBOXKEY_MODIFIER 0x0400
52/** Lock key (like num lock and caps lock). */
53#define VBOXKEY_LOCK 0x0800
54
55/** Converts a darwin (virtual) key code to a set 1 scan code. */
56SHARED_LIBRARY_STUFF unsigned DarwinKeycodeToSet1Scancode(unsigned uKeyCode);
57/** Adjusts the modifier mask left / right using the current keyboard state. */
58SHARED_LIBRARY_STUFF UInt32 DarwinAdjustModifierMask(UInt32 fModifiers, const void *pvCocoaEvent);
59/** Converts a single modifier to a set 1 scan code. */
60SHARED_LIBRARY_STUFF unsigned DarwinModifierMaskToSet1Scancode(UInt32 fModifiers);
61/** Converts a single modifier to a darwin keycode. */
62SHARED_LIBRARY_STUFF unsigned DarwinModifierMaskToDarwinKeycode(UInt32 fModifiers);
63/** Converts a darwin keycode to a modifier mask. */
64SHARED_LIBRARY_STUFF UInt32 DarwinKeyCodeToDarwinModifierMask(unsigned uKeyCode);
65
66/** Disables or enabled global hot keys. */
67SHARED_LIBRARY_STUFF void DarwinDisableGlobalHotKeys(bool fDisable);
68
69/** Start grabbing keyboard events.
70 * @param fGlobalHotkeys Brings whether to disable global hotkeys or not. */
71SHARED_LIBRARY_STUFF void DarwinGrabKeyboard(bool fGlobalHotkeys);
72/** Reverses the actions taken by DarwinGrabKeyboard. */
73SHARED_LIBRARY_STUFF void DarwinReleaseKeyboard();
74
75/** Saves the states of leds for all HID devices attached to the system and return it. */
76SHARED_LIBRARY_STUFF void *DarwinHidDevicesKeepLedsState();
77
78/** Applies LEDs @a pState release its resources afterwards. */
79SHARED_LIBRARY_STUFF int DarwinHidDevicesApplyAndReleaseLedsState(void *pState);
80/** Set states for host keyboard LEDs.
81 * @note This function will set led values for all
82 * keyboard devices attached to the system.
83 * @param pState Brings the pointer to saved LEDs state.
84 * @param fNumLockOn Turns on NumLock led if TRUE, off otherwise
85 * @param fCapsLockOn Turns on CapsLock led if TRUE, off otherwise
86 * @param fScrollLockOn Turns on ScrollLock led if TRUE, off otherwise */
87SHARED_LIBRARY_STUFF void DarwinHidDevicesBroadcastLeds(void *pState, bool fNumLockOn, bool fCapsLockOn, bool fScrollLockOn);
88
89RT_C_DECLS_END
90
91
92#endif /* !FEQT_INCLUDED_SRC_platform_darwin_DarwinKeyboard_h */
93
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