1 | /* $Id: VBoxSDL.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | *
|
---|
4 | * VBox frontends: VBoxSDL (simple frontend based on SDL):
|
---|
5 | * Main header
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox base platform packages, as
|
---|
12 | * available from https://www.virtualbox.org.
|
---|
13 | *
|
---|
14 | * This program is free software; you can redistribute it and/or
|
---|
15 | * modify it under the terms of the GNU General Public License
|
---|
16 | * as published by the Free Software Foundation, in version 3 of the
|
---|
17 | * License.
|
---|
18 | *
|
---|
19 | * This program is distributed in the hope that it will be useful, but
|
---|
20 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
22 | * General Public License for more details.
|
---|
23 | *
|
---|
24 | * You should have received a copy of the GNU General Public License
|
---|
25 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
26 | *
|
---|
27 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef VBOX_INCLUDED_SRC_VBoxSDL_VBoxSDL_h
|
---|
31 | #define VBOX_INCLUDED_SRC_VBoxSDL_VBoxSDL_h
|
---|
32 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
33 | # pragma once
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | #include <iprt/cdefs.h>
|
---|
37 | #ifdef RT_OS_WINDOWS /** @todo check why we need to do this on windows. */
|
---|
38 | /* convince SDL to not overload main() */
|
---|
39 | # define _SDL_main_h
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | /* include this first so Windows.h get's in before our stuff. */
|
---|
43 | #ifdef _MSC_VER
|
---|
44 | # pragma warning(push)
|
---|
45 | # pragma warning(disable: 4121) /* warning C4121: 'SDL_SysWMmsg' : alignment of a member was sensitive to packing*/
|
---|
46 | # pragma warning(disable: 4668) /* warning C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
|
---|
47 | #endif
|
---|
48 | #include <SDL.h>
|
---|
49 | #ifdef _MSC_VER
|
---|
50 | # pragma warning(pop)
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | /** custom SDL event for display update handling */
|
---|
54 | #define SDL_USER_EVENT_UPDATERECT (SDL_USEREVENT + 4)
|
---|
55 | /** custom SDL event for changing the guest resolution */
|
---|
56 | #define SDL_USER_EVENT_NOTIFYCHANGE (SDL_USEREVENT + 5)
|
---|
57 | /** custom SDL for XPCOM event queue processing */
|
---|
58 | #define SDL_USER_EVENT_XPCOM_EVENTQUEUE (SDL_USEREVENT + 6)
|
---|
59 | /** custom SDL event for updating the titlebar */
|
---|
60 | #define SDL_USER_EVENT_UPDATE_TITLEBAR (SDL_USEREVENT + 7)
|
---|
61 | /** custom SDL user event for terminating the session */
|
---|
62 | #define SDL_USER_EVENT_TERMINATE (SDL_USEREVENT + 8)
|
---|
63 | /** custom SDL user event for secure label update notification */
|
---|
64 | #define SDL_USER_EVENT_SECURELABEL_UPDATE (SDL_USEREVENT + 9)
|
---|
65 | /** custom SDL user event for pointer shape change request */
|
---|
66 | #define SDL_USER_EVENT_POINTER_CHANGE (SDL_USEREVENT + 10)
|
---|
67 | /** custom SDL user event for a regular timer */
|
---|
68 | #define SDL_USER_EVENT_TIMER (SDL_USEREVENT + 11)
|
---|
69 | /** custom SDL user event for resetting mouse cursor */
|
---|
70 | #define SDL_USER_EVENT_GUEST_CAP_CHANGED (SDL_USEREVENT + 12)
|
---|
71 | /** custom SDL user event for window resize done */
|
---|
72 | #define SDL_USER_EVENT_WINDOW_RESIZE_DONE (SDL_USEREVENT + 13)
|
---|
73 |
|
---|
74 |
|
---|
75 | /** The user.code field of the SDL_USER_EVENT_TERMINATE event.
|
---|
76 | * @{
|
---|
77 | */
|
---|
78 | /** Normal termination. */
|
---|
79 | #define VBOXSDL_TERM_NORMAL 0
|
---|
80 | /** Abnormal termination. */
|
---|
81 | #define VBOXSDL_TERM_ABEND 1
|
---|
82 | /** @} */
|
---|
83 |
|
---|
84 | void ResetVM(void);
|
---|
85 | void SaveState(void);
|
---|
86 |
|
---|
87 | #ifdef VBOX_WIN32_UI
|
---|
88 | int initUI(bool fResizable, int64_t &winId);
|
---|
89 | int uninitUI(void);
|
---|
90 | int resizeUI(uint16_t width, uint16_t height);
|
---|
91 | int setUITitle(char *title);
|
---|
92 | #endif /* VBOX_WIN32_UI */
|
---|
93 |
|
---|
94 | #ifdef VBOXSDL_WITH_X11
|
---|
95 | void PushNotifyUpdateEvent(SDL_Event *event);
|
---|
96 | #endif
|
---|
97 | int PushSDLEventForSure(SDL_Event *event);
|
---|
98 |
|
---|
99 | #ifdef RT_OS_DARWIN
|
---|
100 | RT_C_DECLS_BEGIN
|
---|
101 | void *VBoxSDLGetDarwinWindowId(void);
|
---|
102 | RT_C_DECLS_END
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | #endif /* !VBOX_INCLUDED_SRC_VBoxSDL_VBoxSDL_h */
|
---|