1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Basic Frontend (BFE):
|
---|
4 | * Declaration of Mouse 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_MOUSEIMPL
|
---|
24 | #define ____H_MOUSEIMPL
|
---|
25 |
|
---|
26 | #include <VBox/pdm.h>
|
---|
27 |
|
---|
28 | /** Simple mouse event class. */
|
---|
29 | class MouseEvent
|
---|
30 | {
|
---|
31 | public:
|
---|
32 | MouseEvent() : dx(0), dy(0), dz(0), state(-1) {}
|
---|
33 | MouseEvent(int _dx, int _dy, int _dz, int _state) :
|
---|
34 | dx(_dx), dy(_dy), dz(_dz), state(_state) {}
|
---|
35 | bool isValid()
|
---|
36 | {
|
---|
37 | return state != -1;
|
---|
38 | }
|
---|
39 | // not logical to be int but that's how it's defined in QEMU
|
---|
40 | /** @todo r=bird: and what is the logical declaration then? We'll be using int32_t btw. */
|
---|
41 | int dx, dy, dz;
|
---|
42 | int state;
|
---|
43 | };
|
---|
44 |
|
---|
45 | class Mouse
|
---|
46 | {
|
---|
47 | public:
|
---|
48 |
|
---|
49 | Mouse() : fAbsolute(false), fNeedsHostCursor(false), mpDrv(NULL), uHostCaps(0) {}
|
---|
50 |
|
---|
51 | // IMouse methods
|
---|
52 | int PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG buttonState);
|
---|
53 | int PutMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG buttonState);
|
---|
54 |
|
---|
55 | int setAbsoluteCoordinates(bool fAbsolute);
|
---|
56 | int setNeedsHostCursor(bool fNeedsHostCursor);
|
---|
57 | #ifdef __L4ENV__
|
---|
58 | // So far L4Con does not support an own mouse pointer.
|
---|
59 | bool getAbsoluteCoordinates() { return false; }
|
---|
60 | #else
|
---|
61 | bool getAbsoluteCoordinates() { return fAbsolute; }
|
---|
62 | #endif
|
---|
63 | bool getNeedsHostCursor() { return fNeedsHostCursor; }
|
---|
64 | int setHostCursor(bool enable);
|
---|
65 |
|
---|
66 | static const PDMDRVREG DrvReg;
|
---|
67 |
|
---|
68 | private:
|
---|
69 |
|
---|
70 | static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface);
|
---|
71 | static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle);
|
---|
72 | static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
|
---|
73 |
|
---|
74 | /** Guest supports absolute coordinates */
|
---|
75 | bool fAbsolute;
|
---|
76 | /** Guest is not able to draw a cursor itself */
|
---|
77 | bool fNeedsHostCursor;
|
---|
78 | /** Pointer to the associated mouse driver. */
|
---|
79 | struct DRVMAINMOUSE *mpDrv;
|
---|
80 | /** Host capabilities */
|
---|
81 | LONG uHostCaps;
|
---|
82 | };
|
---|
83 |
|
---|
84 | extern Mouse *gMouse;
|
---|
85 |
|
---|
86 | #endif // ____H_MOUSEIMPL
|
---|