[55401] | 1 | /* $Id: VBoxSDL.h 99494 2023-04-20 19:52:23Z vboxsync $ */
|
---|
[1] | 2 | /** @file
|
---|
| 3 | *
|
---|
| 4 | * VBox frontends: VBoxSDL (simple frontend based on SDL):
|
---|
| 5 | * Main header
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | /*
|
---|
[98103] | 9 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[1] | 10 | *
|
---|
[96407] | 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
|
---|
[1] | 28 | */
|
---|
| 29 |
|
---|
[76582] | 30 | #ifndef VBOX_INCLUDED_SRC_VBoxSDL_VBoxSDL_h
|
---|
| 31 | #define VBOX_INCLUDED_SRC_VBoxSDL_VBoxSDL_h
|
---|
[76532] | 32 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 33 | # pragma once
|
---|
| 34 | #endif
|
---|
[1] | 35 |
|
---|
[55810] | 36 | #include <iprt/cdefs.h>
|
---|
[3669] | 37 | #ifdef RT_OS_WINDOWS /** @todo check why we need to do this on windows. */
|
---|
[1] | 38 | /* convince SDL to not overload main() */
|
---|
[63298] | 39 | # define _SDL_main_h
|
---|
[614] | 40 | #endif
|
---|
[63298] | 41 |
|
---|
[1] | 42 | /* include this first so Windows.h get's in before our stuff. */
|
---|
[63298] | 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*/
|
---|
[81537] | 46 | # pragma warning(disable: 4668) /* warning C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
|
---|
[63298] | 47 | #endif
|
---|
[1] | 48 | #include <SDL.h>
|
---|
[63298] | 49 | #ifdef _MSC_VER
|
---|
| 50 | # pragma warning(pop)
|
---|
| 51 | #endif
|
---|
[1] | 52 |
|
---|
| 53 | /** custom SDL event for display update handling */
|
---|
| 54 | #define SDL_USER_EVENT_UPDATERECT (SDL_USEREVENT + 4)
|
---|
[51547] | 55 | /** custom SDL event for changing the guest resolution */
|
---|
| 56 | #define SDL_USER_EVENT_NOTIFYCHANGE (SDL_USEREVENT + 5)
|
---|
[1] | 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 pointer shape change request */
|
---|
[98302] | 64 | #define SDL_USER_EVENT_POINTER_CHANGE (SDL_USEREVENT + 9)
|
---|
[1] | 65 | /** custom SDL user event for a regular timer */
|
---|
[98302] | 66 | #define SDL_USER_EVENT_TIMER (SDL_USEREVENT + 10)
|
---|
[1] | 67 | /** custom SDL user event for resetting mouse cursor */
|
---|
[98302] | 68 | #define SDL_USER_EVENT_GUEST_CAP_CHANGED (SDL_USEREVENT + 11)
|
---|
[11576] | 69 | /** custom SDL user event for window resize done */
|
---|
[98302] | 70 | #define SDL_USER_EVENT_WINDOW_RESIZE_DONE (SDL_USEREVENT + 12)
|
---|
[1] | 71 |
|
---|
| 72 |
|
---|
| 73 | /** The user.code field of the SDL_USER_EVENT_TERMINATE event.
|
---|
| 74 | * @{
|
---|
| 75 | */
|
---|
| 76 | /** Normal termination. */
|
---|
| 77 | #define VBOXSDL_TERM_NORMAL 0
|
---|
| 78 | /** Abnormal termination. */
|
---|
| 79 | #define VBOXSDL_TERM_ABEND 1
|
---|
| 80 | /** @} */
|
---|
| 81 |
|
---|
| 82 | void ResetVM(void);
|
---|
| 83 | void SaveState(void);
|
---|
| 84 |
|
---|
| 85 | #ifdef VBOX_WIN32_UI
|
---|
[31698] | 86 | int initUI(bool fResizable, int64_t &winId);
|
---|
[1] | 87 | int uninitUI(void);
|
---|
| 88 | int resizeUI(uint16_t width, uint16_t height);
|
---|
| 89 | int setUITitle(char *title);
|
---|
| 90 | #endif /* VBOX_WIN32_UI */
|
---|
| 91 |
|
---|
[99494] | 92 | #if defined(VBOXSDL_WITH_X11) || defined(RT_OS_DARWIN)
|
---|
[3289] | 93 | void PushNotifyUpdateEvent(SDL_Event *event);
|
---|
| 94 | #endif
|
---|
| 95 | int PushSDLEventForSure(SDL_Event *event);
|
---|
| 96 |
|
---|
[55810] | 97 | #ifdef RT_OS_DARWIN
|
---|
| 98 | RT_C_DECLS_BEGIN
|
---|
| 99 | void *VBoxSDLGetDarwinWindowId(void);
|
---|
| 100 | RT_C_DECLS_END
|
---|
| 101 | #endif
|
---|
| 102 |
|
---|
[76582] | 103 | #endif /* !VBOX_INCLUDED_SRC_VBoxSDL_VBoxSDL_h */
|
---|