1 | /* $Id: VBoxGuestR3LibMouse.cpp 26425 2010-02-11 11:37:08Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Mouse.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | *
|
---|
26 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
27 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
28 | * additional information or have any questions.
|
---|
29 | */
|
---|
30 |
|
---|
31 |
|
---|
32 | /*******************************************************************************
|
---|
33 | * Header Files *
|
---|
34 | *******************************************************************************/
|
---|
35 | #include "VBGLR3Internal.h"
|
---|
36 |
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Retrieve mouse coordinates and features from the host.
|
---|
40 | *
|
---|
41 | * @returns VBox status code.
|
---|
42 | *
|
---|
43 | * @param pfFeatures Where to store the mouse features.
|
---|
44 | * @param px Where to store the X co-ordinate.
|
---|
45 | * @param py Where to store the Y co-ordinate.
|
---|
46 | */
|
---|
47 | VBGLR3DECL(int) VbglR3GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py)
|
---|
48 | {
|
---|
49 | VMMDevReqMouseStatus Req;
|
---|
50 | vmmdevInitRequest(&Req.header, VMMDevReq_GetMouseStatus);
|
---|
51 | Req.mouseFeatures = 0;
|
---|
52 | Req.pointerXPos = 0;
|
---|
53 | Req.pointerYPos = 0;
|
---|
54 | int rc = vbglR3GRPerform(&Req.header);
|
---|
55 | if (RT_SUCCESS(rc))
|
---|
56 | {
|
---|
57 | if (pfFeatures)
|
---|
58 | *pfFeatures = Req.mouseFeatures;
|
---|
59 | if (px)
|
---|
60 | *px = Req.pointerXPos;
|
---|
61 | if (py)
|
---|
62 | *py = Req.pointerYPos;
|
---|
63 | }
|
---|
64 | return rc;
|
---|
65 | }
|
---|
66 |
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Send mouse features to the host.
|
---|
70 | *
|
---|
71 | * @returns VBox status code.
|
---|
72 | *
|
---|
73 | * @param fFeatures Supported mouse pointer features.
|
---|
74 | */
|
---|
75 | VBGLR3DECL(int) VbglR3SetMouseStatus(uint32_t fFeatures)
|
---|
76 | {
|
---|
77 | VMMDevReqMouseStatus Req;
|
---|
78 | vmmdevInitRequest(&Req.header, VMMDevReq_SetMouseStatus);
|
---|
79 | Req.mouseFeatures = fFeatures;
|
---|
80 | Req.pointerXPos = 0;
|
---|
81 | Req.pointerYPos = 0;
|
---|
82 | return vbglR3GRPerform(&Req.header);
|
---|
83 | }
|
---|
84 |
|
---|