VirtualBox

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

Last change on this file since 8846 was 8155, checked in by vboxsync, 17 years ago

The Big Sun Rebranding Header Change

  • 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 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef __H_VBOXSDL
24#define __H_VBOXSDL
25
26/* include this first so Windows.h get's in before our stuff. */
27#include <SDL.h>
28#ifndef RT_OS_DARWIN
29# include <SDL_syswm.h>
30#endif
31#if defined(RT_OS_WINDOWS) /// @todo someone please explain why this is necessary. This breaks darwin solid.
32// damn SDL redefines main!
33#undef main
34#endif
35
36#include "ConsoleImpl.h"
37#include <iprt/string.h>
38
39/** Pointer shape change event data strucure */
40struct PointerShapeChangeData
41{
42 PointerShapeChangeData (BOOL aVisible, BOOL aAlpha, ULONG aXHot, ULONG aYHot,
43 ULONG aWidth, ULONG aHeight,
44 const uint8_t *aShape)
45 : visible (aVisible), alpha (aAlpha), xHot (aXHot), yHot (aYHot)
46 , width (aWidth), height (aHeight), shape (NULL)
47 {
48 // make a copy of the shape
49 if (aShape) {
50 uint32_t shapeSize = ((((aWidth + 7) / 8) * aHeight + 3) & ~3) + aWidth * 4 * aHeight;
51 shape = new uint8_t [shapeSize];
52 if (shape)
53 memcpy ((void *) shape, (void *) aShape, shapeSize);
54 }
55 }
56
57 ~PointerShapeChangeData()
58 {
59 if (shape) delete[] shape;
60 }
61
62 const BOOL visible;
63 const BOOL alpha;
64 const ULONG xHot;
65 const ULONG yHot;
66 const ULONG width;
67 const ULONG height;
68 const uint8_t *shape;
69};
70
71/** custom SDL event for display update handling */
72#define SDL_USER_EVENT_UPDATERECT (SDL_USEREVENT + 4)
73/** custom SDL event for resize handling */
74#define SDL_USER_EVENT_RESIZE (SDL_USEREVENT + 5)
75/** custom SDL for XPCOM event queue processing */
76#define SDL_USER_EVENT_XPCOM_EVENTQUEUE (SDL_USEREVENT + 6)
77
78
79/** custom SDL for XPCOM event queue processing */
80#define SDL_USER_EVENT_GRAB (SDL_USEREVENT + 6)
81
82/** custom SDL event for updating the titlebar */
83#define SDL_USER_EVENT_UPDATE_TITLEBAR (SDL_USEREVENT + 7)
84/** custom SDL user event for terminating the session */
85#define SDL_USER_EVENT_TERMINATE (SDL_USEREVENT + 8)
86/** custom SDL user event for secure label update notification */
87#define SDL_USER_EVENT_SECURELABEL_UPDATE (SDL_USEREVENT + 9)
88/** custom SDL user event for pointer shape change request */
89#define SDL_USER_EVENT_POINTER_CHANGE (SDL_USEREVENT + 10)
90
91#define SDL_USER_
92
93
94class SDLConsole : public Console
95{
96public:
97 SDLConsole();
98 ~SDLConsole();
99
100 virtual void updateTitlebar();
101 virtual void updateTitlebarProgress(const char *pszStr, int iPercent);
102
103 virtual void inputGrabStart();
104 virtual void inputGrabEnd();
105
106 virtual void mouseSendEvent(int dz);
107 virtual void onMousePointerShapeChange(bool fVisible,
108 bool fAlpha, uint32_t xHot,
109 uint32_t yHot, uint32_t width,
110 uint32_t height, void *pShape);
111 virtual void progressInfo(PVM pVM, unsigned uPercent, void *pvUser);
112
113 virtual CONEVENT eventWait();
114 virtual void eventQuit();
115 virtual void resetCursor();
116 virtual void resetKeys(void);
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