3
* VBox frontends: Basic Frontend (BFE):
4
* Declaration of SDLConsole class
8
* Copyright (C) 2006-2007 innotek GmbH
10
* This file is part of VirtualBox Open Source Edition (OSE), as
11
* available from http://www.virtualbox.org. This file is free software;
12
* you can redistribute it and/or modify it under the terms of the GNU
13
* General Public License as published by the Free Software Foundation,
14
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15
* distribution. VirtualBox OSE is distributed in the hope that it will
16
* be useful, but WITHOUT ANY WARRANTY of any kind.
22
/* include this first so Windows.h get's in before our stuff. */
25
# include <SDL_syswm.h>
27
#if defined(RT_OS_WINDOWS) /// @todo someone please explain why this is necessary. This breaks darwin solid.
28
// damn SDL redefines main!
32
#include "ConsoleImpl.h"
33
#include <iprt/string.h>
35
/** Pointer shape change event data strucure */
36
struct PointerShapeChangeData
38
PointerShapeChangeData (BOOL aVisible, BOOL aAlpha, ULONG aXHot, ULONG aYHot,
39
ULONG aWidth, ULONG aHeight,
40
const uint8_t *aShape)
41
: visible (aVisible), alpha (aAlpha), xHot (aXHot), yHot (aYHot)
42
, width (aWidth), height (aHeight), shape (NULL)
44
// make a copy of the shape
46
uint32_t shapeSize = ((((aWidth + 7) / 8) * aHeight + 3) & ~3) + aWidth * 4 * aHeight;
47
shape = new uint8_t [shapeSize];
49
memcpy ((void *) shape, (void *) aShape, shapeSize);
53
~PointerShapeChangeData()
55
if (shape) delete[] shape;
67
/** custom SDL event for display update handling */
68
#define SDL_USER_EVENT_UPDATERECT (SDL_USEREVENT + 4)
69
/** custom SDL event for resize handling */
70
#define SDL_USER_EVENT_RESIZE (SDL_USEREVENT + 5)
71
/** custom SDL for XPCOM event queue processing */
72
#define SDL_USER_EVENT_XPCOM_EVENTQUEUE (SDL_USEREVENT + 6)
75
/** custom SDL for XPCOM event queue processing */
76
#define SDL_USER_EVENT_GRAB (SDL_USEREVENT + 6)
78
/** custom SDL event for updating the titlebar */
79
#define SDL_USER_EVENT_UPDATE_TITLEBAR (SDL_USEREVENT + 7)
80
/** custom SDL user event for terminating the session */
81
#define SDL_USER_EVENT_TERMINATE (SDL_USEREVENT + 8)
82
/** custom SDL user event for secure label update notification */
83
#define SDL_USER_EVENT_SECURELABEL_UPDATE (SDL_USEREVENT + 9)
84
/** custom SDL user event for pointer shape change request */
85
#define SDL_USER_EVENT_POINTER_CHANGE (SDL_USEREVENT + 10)
90
class SDLConsole : public Console
96
virtual void updateTitlebar();
97
virtual void updateTitlebarSave(int iPercent);
99
virtual void inputGrabStart();
100
virtual void inputGrabEnd();
102
virtual void mouseSendEvent(int dz);
103
virtual void onMousePointerShapeChange(bool fVisible,
104
bool fAlpha, uint32_t xHot,
105
uint32_t yHot, uint32_t width,
106
uint32_t height, void *pShape);
108
virtual CONEVENT eventWait();
109
virtual void eventQuit();
110
virtual void resetCursor();
114
int handleHostKey(const SDL_KeyboardEvent *pEv);
115
uint8_t keyEventToKeyCode(const SDL_KeyboardEvent *ev);
116
void processKey(SDL_KeyboardEvent *ev);
117
void setPointerShape (const PointerShapeChangeData *data);
119
void resetKeys(void);
121
/** flag whether keyboard/mouse events are grabbed */
124
/** modifier keypress status (scancode as index) */
125
uint8_t gaModifiersState[256];
127
SDL_Cursor *gpDefaultCursor;
128
SDL_Cursor *gpCustomCursor;
129
/** Custom window manager cursor? */
130
WMcursor *gpCustomWMcursor;
131
#ifdef VBOXBFE_WITH_X11
132
SDL_SysWMinfo gSdlInfo;
137
SDL_Event EvHKeyDown;
140
#endif // __H_VBOXSDL