VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/Mouse.cpp@ 41852

Last change on this file since 41852 was 41852, checked in by vboxsync, 13 years ago

Additions/common and solaris/vboxmouse: large code drop.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1/* $Revision: 41852 $ */
2/** @file
3 * VBoxGuestLibR0 - Mouse Integration.
4 */
5
6/*
7 * Copyright (C) 2012 Oracle Corporation
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
27#include "VBGLInternal.h"
28
29DECLVBGL(int) VbglSetMouseNotifyCallback(PFNVBOXGUESTMOUSENOTIFY pfnNotify,
30 void *pvUser)
31{
32 VBoxGuestMouseSetNotifyCallback NotifyCallback;
33 VBGLDRIVER *pDriver;
34 int rc;
35
36 rc = vbglGetDriver(&pDriver);
37 if (RT_FAILURE(rc))
38 return rc;
39 NotifyCallback.pfnNotify = pfnNotify;
40 NotifyCallback.pvUser = pvUser;
41 return vbglDriverIOCtl(pDriver, VBOXGUEST_IOCTL_SET_MOUSE_NOTIFY_CALLBACK,
42 &NotifyCallback, sizeof(NotifyCallback));
43}
44
45DECLVBGL(int) VbglGetMouseStatus(uint32_t *pfFeatures, uint32_t *px,
46 uint32_t *py)
47{
48 VMMDevReqMouseStatus Req;
49 VBGLDRIVER *pDriver;
50 int rc;
51
52 rc = vbglGetDriver(&pDriver);
53 if (RT_FAILURE(rc))
54 return rc;
55 vmmdevInitRequest(&Req.header, VMMDevReq_GetMouseStatus);
56 Req.mouseFeatures = 0;
57 Req.pointerXPos = 0;
58 Req.pointerYPos = 0;
59 rc = vbglDriverIOCtl(pDriver, VBOXGUEST_IOCTL_VMMREQUEST(sizeof(Req)),
60 &Req.header, sizeof(Req));
61 if (RT_FAILURE(rc))
62 return rc;
63 if (pfFeatures)
64 *pfFeatures = Req.mouseFeatures;
65 if (px)
66 *px = Req.pointerXPos;
67 if (py)
68 *py = Req.pointerYPos;
69 return VINF_SUCCESS;
70}
71
72DECLVBGL(int) VbglSetMouseStatus(uint32_t fFeatures)
73{
74 VBGLDRIVER *pDriver;
75 int rc;
76
77 rc = vbglGetDriver(&pDriver);
78 if (RT_FAILURE(rc))
79 return rc;
80 return vbglDriverIOCtl(pDriver, VBOXGUEST_IOCTL_SET_MOUSE_STATUS,
81 &fFeatures, sizeof(fFeatures));
82}
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