VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.h@ 82781

Last change on this file since 82781 was 81537, checked in by vboxsync, 5 years ago

FE/VBoxSDL: Added first support for SDL2 (by setting VBOX_WITH_SDL2). Very rough / hacky by now and needs more testing first before enabling by default. Also fixed non-starting with SDL 1.2.x on Windows hosts.

Known limitations / todos when running with SDL 2 for now:

  • No alpha channel support for cursors.
  • No mouse wheel support.
  • Desktop geometry handling needs a revamp for multi monitor setups.
  • Check / revamp dirty rectangle blitting.
  • OpenGL renderer needs testing wrt texture blitting.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/* $Id: VBoxSDL.h 81537 2019-10-25 11:46:30Z vboxsync $ */
2/** @file
3 *
4 * VBox frontends: VBoxSDL (simple frontend based on SDL):
5 * Main header
6 */
7
8/*
9 * Copyright (C) 2006-2019 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#ifndef VBOX_INCLUDED_SRC_VBoxSDL_VBoxSDL_h
21#define VBOX_INCLUDED_SRC_VBoxSDL_VBoxSDL_h
22#ifndef RT_WITHOUT_PRAGMA_ONCE
23# pragma once
24#endif
25
26#include <iprt/cdefs.h>
27#ifdef RT_OS_WINDOWS /** @todo check why we need to do this on windows. */
28/* convince SDL to not overload main() */
29# define _SDL_main_h
30#endif
31
32/* include this first so Windows.h get's in before our stuff. */
33#ifdef _MSC_VER
34# pragma warning(push)
35# pragma warning(disable: 4121) /* warning C4121: 'SDL_SysWMmsg' : alignment of a member was sensitive to packing*/
36# pragma warning(disable: 4668) /* warning C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
37#endif
38#include <SDL.h>
39#ifdef _MSC_VER
40# pragma warning(pop)
41#endif
42
43/** custom SDL event for display update handling */
44#define SDL_USER_EVENT_UPDATERECT (SDL_USEREVENT + 4)
45/** custom SDL event for changing the guest resolution */
46#define SDL_USER_EVENT_NOTIFYCHANGE (SDL_USEREVENT + 5)
47/** custom SDL for XPCOM event queue processing */
48#define SDL_USER_EVENT_XPCOM_EVENTQUEUE (SDL_USEREVENT + 6)
49/** custom SDL event for updating the titlebar */
50#define SDL_USER_EVENT_UPDATE_TITLEBAR (SDL_USEREVENT + 7)
51/** custom SDL user event for terminating the session */
52#define SDL_USER_EVENT_TERMINATE (SDL_USEREVENT + 8)
53/** custom SDL user event for secure label update notification */
54#define SDL_USER_EVENT_SECURELABEL_UPDATE (SDL_USEREVENT + 9)
55/** custom SDL user event for pointer shape change request */
56#define SDL_USER_EVENT_POINTER_CHANGE (SDL_USEREVENT + 10)
57/** custom SDL user event for a regular timer */
58#define SDL_USER_EVENT_TIMER (SDL_USEREVENT + 11)
59/** custom SDL user event for resetting mouse cursor */
60#define SDL_USER_EVENT_GUEST_CAP_CHANGED (SDL_USEREVENT + 12)
61/** custom SDL user event for window resize done */
62#define SDL_USER_EVENT_WINDOW_RESIZE_DONE (SDL_USEREVENT + 13)
63
64
65/** The user.code field of the SDL_USER_EVENT_TERMINATE event.
66 * @{
67 */
68/** Normal termination. */
69#define VBOXSDL_TERM_NORMAL 0
70/** Abnormal termination. */
71#define VBOXSDL_TERM_ABEND 1
72/** @} */
73
74void ResetVM(void);
75void SaveState(void);
76
77#ifdef VBOX_WIN32_UI
78int initUI(bool fResizable, int64_t &winId);
79int uninitUI(void);
80int resizeUI(uint16_t width, uint16_t height);
81int setUITitle(char *title);
82#endif /* VBOX_WIN32_UI */
83
84#ifdef VBOXSDL_WITH_X11
85void PushNotifyUpdateEvent(SDL_Event *event);
86#endif
87int PushSDLEventForSure(SDL_Event *event);
88
89#ifdef RT_OS_DARWIN
90RT_C_DECLS_BEGIN
91void *VBoxSDLGetDarwinWindowId(void);
92RT_C_DECLS_END
93#endif
94
95#endif /* !VBOX_INCLUDED_SRC_VBoxSDL_VBoxSDL_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use