VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxBFE/SDLConsole.h@ 43629

Last change on this file since 43629 was 33540, checked in by vboxsync, 14 years ago

*: spelling fixes, thanks Timeless!

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1/** @file
2 *
3 * VBox frontends: Basic Frontend (BFE):
4 * Declaration of SDLConsole class
5 */
6
7/*
8 * Copyright (C) 2006-2007 Oracle Corporation
9 *
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 (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef __H_VBOXSDL
20#define __H_VBOXSDL
21
22/* include this first so Windows.h get's in before our stuff. */
23#include <SDL.h>
24#ifndef RT_OS_DARWIN
25# define Display Display_ /* Xlib defines "Display" and so do we... */
26# include <SDL_syswm.h>
27# undef Display
28#endif
29#if defined(RT_OS_WINDOWS) /// @todo someone please explain why this is necessary. This breaks darwin solid.
30// damn SDL redefines main!
31#undef main
32#endif
33
34#include "ConsoleImpl.h"
35#include <iprt/string.h>
36
37/** Pointer shape change event data structure */
38struct PointerShapeChangeData
39{
40 PointerShapeChangeData (BOOL aVisible, BOOL aAlpha, ULONG aXHot, ULONG aYHot,
41 ULONG aWidth, ULONG aHeight,
42 const uint8_t *aShape)
43 : visible (aVisible), alpha (aAlpha), xHot (aXHot), yHot (aYHot)
44 , width (aWidth), height (aHeight), shape (NULL)
45 {
46 // make a copy of the shape
47 if (aShape) {
48 uint32_t shapeSize = ((((aWidth + 7) / 8) * aHeight + 3) & ~3) + aWidth * 4 * aHeight;
49 shape = new uint8_t [shapeSize];
50 if (shape)
51 memcpy ((void *) shape, (void *) aShape, shapeSize);
52 }
53 }
54
55 ~PointerShapeChangeData()
56 {
57 if (shape) delete[] shape;
58 }
59
60 const BOOL visible;
61 const BOOL alpha;
62 const ULONG xHot;
63 const ULONG yHot;
64 const ULONG width;
65 const ULONG height;
66 const uint8_t *shape;
67};
68
69/** custom SDL event for display update handling */
70#define SDL_USER_EVENT_UPDATERECT (SDL_USEREVENT + 4)
71/** custom SDL event for resize handling */
72#define SDL_USER_EVENT_RESIZE (SDL_USEREVENT + 5)
73/** custom SDL for XPCOM event queue processing */
74#define SDL_USER_EVENT_XPCOM_EVENTQUEUE (SDL_USEREVENT + 6)
75
76
77/** custom SDL for XPCOM event queue processing */
78#define SDL_USER_EVENT_GRAB (SDL_USEREVENT + 6)
79
80/** custom SDL event for updating the titlebar */
81#define SDL_USER_EVENT_UPDATE_TITLEBAR (SDL_USEREVENT + 7)
82/** custom SDL user event for terminating the session */
83#define SDL_USER_EVENT_TERMINATE (SDL_USEREVENT + 8)
84/** custom SDL user event for secure label update notification */
85#define SDL_USER_EVENT_SECURELABEL_UPDATE (SDL_USEREVENT + 9)
86/** custom SDL user event for pointer shape change request */
87#define SDL_USER_EVENT_POINTER_CHANGE (SDL_USEREVENT + 10)
88
89#define SDL_USER_
90
91
92class SDLConsole : public Console
93{
94public:
95 SDLConsole();
96 ~SDLConsole();
97
98 virtual void updateTitlebar();
99 virtual void updateTitlebarProgress(const char *pszStr, int iPercent);
100
101 virtual void inputGrabStart();
102 virtual void inputGrabEnd();
103
104 virtual void mouseSendEvent(int dz);
105 virtual void onMousePointerShapeChange(bool fVisible,
106 bool fAlpha, uint32_t xHot,
107 uint32_t yHot, uint32_t width,
108 uint32_t height, void *pShape);
109 virtual void progressInfo(PVM pVM, unsigned uPercent, void *pvUser);
110
111 virtual CONEVENT eventWait();
112 virtual void eventQuit();
113 virtual void resetCursor();
114 virtual void resetKeys(void);
115 virtual VMMDev *getVMMDev();
116 virtual Display *getDisplay();
117
118private:
119
120 int handleHostKey(const SDL_KeyboardEvent *pEv);
121 uint8_t keyEventToKeyCode(const SDL_KeyboardEvent *ev);
122 void processKey(SDL_KeyboardEvent *ev);
123 void setPointerShape (const PointerShapeChangeData *data);
124 static void doEventQuit(void);
125
126 /** modifier keypress status (scancode as index) */
127 uint8_t gaModifiersState[256];
128
129 SDL_Cursor *gpDefaultCursor;
130 SDL_Cursor *gpCustomCursor;
131 /** Custom window manager cursor? */
132 WMcursor *gpCustomWMcursor;
133 /** the application Icon */
134 SDL_Surface *mWMIcon;
135#ifdef VBOXBFE_WITH_X11
136 SDL_SysWMinfo gSdlInfo;
137#endif
138
139 /* Current event */
140 SDL_Event ev1;
141 SDL_Event EvHKeyDown;
142};
143
144#endif // __H_VBOXSDL
145
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette