1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Basic Frontend (BFE):
|
---|
4 | * Declaration of Console class
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
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 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.
|
---|
17 | *
|
---|
18 | * If you received this file as part of a commercial VirtualBox
|
---|
19 | * distribution, then only the terms of your commercial VirtualBox
|
---|
20 | * license agreement apply instead of the previous paragraph.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef ____H_CONSOLEIMPL
|
---|
24 | #define ____H_CONSOLEIMPL
|
---|
25 |
|
---|
26 | /*
|
---|
27 | * Host key handling.
|
---|
28 | *
|
---|
29 | * The golden rule is that host-key combinations should not be seen
|
---|
30 | * by the guest. For instance a CAD should not have any extra RCtrl down
|
---|
31 | * and RCtrl up around itself. Nor should a resume be followed by a Ctrl-P
|
---|
32 | * that could encourage applications to start printing.
|
---|
33 | *
|
---|
34 | * We must not confuse the hostkey processing into any release sequences
|
---|
35 | * either, the host key is supposed to be explicitly pressing one key.
|
---|
36 | *
|
---|
37 | * Quick state diagram:
|
---|
38 | *
|
---|
39 | * host key down alone
|
---|
40 | * (Normal) ---------------
|
---|
41 | * ^ ^ |
|
---|
42 | * | | v host combination key down
|
---|
43 | * | | (Host key down) ----------------
|
---|
44 | * | | host key up v | |
|
---|
45 | * | |-------------- | other key down v host combination key down
|
---|
46 | * | | (host key used) -------------
|
---|
47 | * | | | ^ |
|
---|
48 | * | (not host key)-- | |---------------
|
---|
49 | * | | | | |
|
---|
50 | * | | ---- other |
|
---|
51 | * | modifiers = 0 v v
|
---|
52 | * -----------------------------------------------
|
---|
53 | */
|
---|
54 | typedef enum _HKEYSTATE
|
---|
55 | {
|
---|
56 | /** The initial and most common state, pass keystrokes to the guest.
|
---|
57 | * Next state: HKEYSTATE_DOWN
|
---|
58 | * Prev state: Any */
|
---|
59 | HKEYSTATE_NORMAL = 1,
|
---|
60 | /** The host key has been pressed down.
|
---|
61 | * Prev state: HKEYSTATE_NORMAL
|
---|
62 | * Next state: HKEYSTATE_NORMAL - host key up, capture toggle.
|
---|
63 | * Next state: HKEYSTATE_USED - host key combination down.
|
---|
64 | * Next state: HKEYSTATE_NOT_IT - non-host key combination down.
|
---|
65 | */
|
---|
66 | HKEYSTATE_DOWN,
|
---|
67 | /** A host key combination was pressed.
|
---|
68 | * Prev state: HKEYSTATE_DOWN
|
---|
69 | * Next state: HKEYSTATE_NORMAL - when modifiers are all 0
|
---|
70 | */
|
---|
71 | HKEYSTATE_USED,
|
---|
72 | /** A non-host key combination was attempted. Send hostkey down to the
|
---|
73 | * guest and continue until all modifiers have been released.
|
---|
74 | * Prev state: HKEYSTATE_DOWN
|
---|
75 | * Next state: HKEYSTATE_NORMAL - when modifiers are all 0
|
---|
76 | */
|
---|
77 | HKEYSTATE_NOT_IT
|
---|
78 | } HKEYSTATE;
|
---|
79 |
|
---|
80 | typedef enum _CONEVENT
|
---|
81 | {
|
---|
82 | CONEVENT_SCREENUPDATE = 1,
|
---|
83 | CONEVENT_KEYUP,
|
---|
84 | CONEVENT_KEYDOWN,
|
---|
85 | CONEVENT_MOUSEMOVE,
|
---|
86 | CONEVENT_MOUSEBUTTONUP,
|
---|
87 | CONEVENT_MOUSEBUTTONDOWN,
|
---|
88 | CONEVENT_FOCUSCHANGE,
|
---|
89 |
|
---|
90 | CONEVENT_USR_QUIT,
|
---|
91 | CONEVENT_USR_SCREENUPDATERECT,
|
---|
92 | CONEVENT_USR_SCREENRESIZE,
|
---|
93 | CONEVENT_USR_TITLEBARUPDATE,
|
---|
94 | CONEVENT_USR_SECURELABELUPDATE,
|
---|
95 | CONEVENT_USR_MOUSEPOINTERCHANGE,
|
---|
96 |
|
---|
97 | CONEVENT_QUIT,
|
---|
98 |
|
---|
99 | CONEVENT_NONE
|
---|
100 | } CONEVENT;
|
---|
101 |
|
---|
102 | class Console
|
---|
103 | {
|
---|
104 | public:
|
---|
105 | Console()
|
---|
106 | {
|
---|
107 | enmHKeyState = HKEYSTATE_NORMAL;
|
---|
108 | mfInitialized = false;
|
---|
109 | }
|
---|
110 |
|
---|
111 | virtual void updateTitlebar() = 0;
|
---|
112 | virtual void updateTitlebarSave(int iPercent) = 0;
|
---|
113 |
|
---|
114 | virtual void inputGrabStart() = 0;
|
---|
115 | virtual void inputGrabEnd() = 0;
|
---|
116 | virtual void resetCursor() {}
|
---|
117 |
|
---|
118 | virtual void mouseSendEvent(int dz) = 0;
|
---|
119 | virtual void onMousePointerShapeChange(bool fVisible,
|
---|
120 | bool fAlpha, uint32_t xHot,
|
---|
121 | uint32_t yHot, uint32_t width,
|
---|
122 | uint32_t height, void *pShape) = 0;
|
---|
123 |
|
---|
124 | virtual CONEVENT eventWait() = 0;
|
---|
125 | virtual void eventQuit() = 0;
|
---|
126 | bool initialized() { return mfInitialized; }
|
---|
127 |
|
---|
128 | protected:
|
---|
129 | HKEYSTATE enmHKeyState;
|
---|
130 | bool mfInitialized;
|
---|
131 | };
|
---|
132 |
|
---|
133 | extern Console *gConsole;
|
---|
134 |
|
---|
135 |
|
---|
136 | #endif // ____H_CONSOLEIMPL
|
---|