VBoxGuestR3LibMouse.cpp revision 1c94c0a63ba68be1a7b2c640e70d7a06464e4fca
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync/* $Id$ */
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync/** @file
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Mouse.
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync */
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync/*
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Copyright (C) 2007 Sun Microsystems, Inc.
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync *
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * available from http://www.virtualbox.org. This file is free software;
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync *
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync * additional information or have any questions.
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync */
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync/*******************************************************************************
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync* Header Files *
f84cd77241a1c4b9106a92280611c659243e10d1vboxsync*******************************************************************************/
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync#include "VBGLR3Internal.h"
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync/**
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * Retrieve mouse coordinates and features from the host.
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync *
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * @returns VBox status code.
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync *
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync * @param pfFeatures Where to store the mouse features.
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync * @param px Where to store the X co-ordinate.
134a71c1528b56afe4db843ab63ec5a5b849535bvboxsync * @param py Where to store the Y co-ordinate.
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync */
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsyncVBGLR3DECL(int) VbglR3GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py)
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync{
134a71c1528b56afe4db843ab63ec5a5b849535bvboxsync VMMDevReqMouseStatus Req;
134a71c1528b56afe4db843ab63ec5a5b849535bvboxsync vmmdevInitRequest(&Req.header, VMMDevReq_GetMouseStatus);
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync Req.mouseFeatures = 0;
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync Req.pointerXPos = 0;
134a71c1528b56afe4db843ab63ec5a5b849535bvboxsync Req.pointerYPos = 0;
134a71c1528b56afe4db843ab63ec5a5b849535bvboxsync int rc = vbglR3GRPerform(&Req.header);
289060a0c3cb1d509f2cb01fca060796212376f6vboxsync if (RT_SUCCESS(rc))
289060a0c3cb1d509f2cb01fca060796212376f6vboxsync {
289060a0c3cb1d509f2cb01fca060796212376f6vboxsync if (pfFeatures)
289060a0c3cb1d509f2cb01fca060796212376f6vboxsync *pfFeatures = Req.mouseFeatures;
611910c4ba57eb6db5c0d508ca7b923efd654aecvboxsync if (px)
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync *px = Req.pointerXPos;
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync if (py)
6420f75ffc86ab6494eb5e95418f0c95e71e8068vboxsync *py = Req.pointerYPos;
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync }
6420f75ffc86ab6494eb5e95418f0c95e71e8068vboxsync return rc;
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync}
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync
6420f75ffc86ab6494eb5e95418f0c95e71e8068vboxsync/**
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * Send mouse features to the host.
6420f75ffc86ab6494eb5e95418f0c95e71e8068vboxsync *
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync * @returns VBox status code.
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync *
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsync * @param fFeatures Supported mouse pointer features.
9ad5e3912962c3dbccc1afc4e7d62890fe906814vboxsync */
3609dfc9f2733f4dc836c6a6bb3745398f280fcevboxsyncVBGLR3DECL(int) VbglR3SetMouseStatus(uint32_t fFeatures)
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync{
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync VMMDevReqMouseStatus Req;
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync vmmdevInitRequest(&Req.header, VMMDevReq_SetMouseStatus);
f2490b062661a961f03e88eda47a763e5b2ff221vboxsync Req.mouseFeatures = fFeatures;
f2490b062661a961f03e88eda47a763e5b2ff221vboxsync Req.pointerXPos = 0;
0d4bc23ca3867d6dbedd76d5b1e3725c766adb75vboxsync Req.pointerYPos = 0;
f2490b062661a961f03e88eda47a763e5b2ff221vboxsync return vbglR3GRPerform(&Req.header);
f2490b062661a961f03e88eda47a763e5b2ff221vboxsync}
f2490b062661a961f03e88eda47a763e5b2ff221vboxsync
436b5c616e019c5e62053657c52d3ab5562ecbbfvboxsync