[69474] | 1 | /* $Id: DarwinKeyboard.h 103704 2024-03-06 15:15:36Z vboxsync $ */
|
---|
[2387] | 2 | /** @file
|
---|
[71659] | 3 | * VBox Qt GUI - Declarations of utility functions for handling Darwin Keyboard specific tasks.
|
---|
[2387] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[2387] | 8 | *
|
---|
[96407] | 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
|
---|
[2387] | 26 | */
|
---|
| 27 |
|
---|
[76581] | 28 | #ifndef FEQT_INCLUDED_SRC_platform_darwin_DarwinKeyboard_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_platform_darwin_DarwinKeyboard_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[2387] | 33 |
|
---|
[71665] | 34 | /* GUI includes: */
|
---|
| 35 | #include "UILibraryDefs.h"
|
---|
| 36 |
|
---|
[71659] | 37 | /* External includes: */
|
---|
[16469] | 38 | #include <CoreFoundation/CFBase.h>
|
---|
[2387] | 39 |
|
---|
[71659] | 40 |
|
---|
[20374] | 41 | RT_C_DECLS_BEGIN
|
---|
[2387] | 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 |
|
---|
[71659] | 55 | /** Converts a darwin (virtual) key code to a set 1 scan code. */
|
---|
[71665] | 56 | SHARED_LIBRARY_STUFF unsigned DarwinKeycodeToSet1Scancode(unsigned uKeyCode);
|
---|
[71659] | 57 | /** Adjusts the modifier mask left / right using the current keyboard state. */
|
---|
[71665] | 58 | SHARED_LIBRARY_STUFF UInt32 DarwinAdjustModifierMask(UInt32 fModifiers, const void *pvCocoaEvent);
|
---|
[71659] | 59 | /** Converts a single modifier to a set 1 scan code. */
|
---|
[71665] | 60 | SHARED_LIBRARY_STUFF unsigned DarwinModifierMaskToSet1Scancode(UInt32 fModifiers);
|
---|
[71659] | 61 | /** Converts a single modifier to a darwin keycode. */
|
---|
[71665] | 62 | SHARED_LIBRARY_STUFF unsigned DarwinModifierMaskToDarwinKeycode(UInt32 fModifiers);
|
---|
[71659] | 63 | /** Converts a darwin keycode to a modifier mask. */
|
---|
[71665] | 64 | SHARED_LIBRARY_STUFF UInt32 DarwinKeyCodeToDarwinModifierMask(unsigned uKeyCode);
|
---|
[71659] | 65 |
|
---|
| 66 | /** Disables or enabled global hot keys. */
|
---|
[71665] | 67 | SHARED_LIBRARY_STUFF void DarwinDisableGlobalHotKeys(bool fDisable);
|
---|
[71659] | 68 |
|
---|
| 69 | /** Start grabbing keyboard events.
|
---|
| 70 | * @param fGlobalHotkeys Brings whether to disable global hotkeys or not. */
|
---|
[71665] | 71 | SHARED_LIBRARY_STUFF void DarwinGrabKeyboard(bool fGlobalHotkeys);
|
---|
[71659] | 72 | /** Reverses the actions taken by DarwinGrabKeyboard. */
|
---|
[71665] | 73 | SHARED_LIBRARY_STUFF void DarwinReleaseKeyboard();
|
---|
[2387] | 74 |
|
---|
[71659] | 75 | /** Saves the states of leds for all HID devices attached to the system and return it. */
|
---|
[71665] | 76 | SHARED_LIBRARY_STUFF void *DarwinHidDevicesKeepLedsState();
|
---|
[71659] | 77 |
|
---|
| 78 | /** Applies LEDs @a pState release its resources afterwards. */
|
---|
[71665] | 79 | SHARED_LIBRARY_STUFF int DarwinHidDevicesApplyAndReleaseLedsState(void *pState);
|
---|
[71659] | 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 */
|
---|
[71665] | 87 | SHARED_LIBRARY_STUFF void DarwinHidDevicesBroadcastLeds(void *pState, bool fNumLockOn, bool fCapsLockOn, bool fScrollLockOn);
|
---|
[48496] | 88 |
|
---|
[20374] | 89 | RT_C_DECLS_END
|
---|
[2387] | 90 |
|
---|
| 91 |
|
---|
[76581] | 92 | #endif /* !FEQT_INCLUDED_SRC_platform_darwin_DarwinKeyboard_h */
|
---|
[71659] | 93 |
|
---|