083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync/* $Id$ */
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync/** @file
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Mouse.
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync */
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2007-2012 Oracle Corporation
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync *
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync * available from http://www.virtualbox.org. This file is free software;
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync * you can redistribute it and/or modify it under the terms of the GNU
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync * General Public License (GPL) as published by the Free Software
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync *
aba0e602e244ae7c4f11b50fc6d2440f5a762038vboxsync * The contents of this file may alternatively be used under the terms
aba0e602e244ae7c4f11b50fc6d2440f5a762038vboxsync * of the Common Development and Distribution License Version 1.0
aba0e602e244ae7c4f11b50fc6d2440f5a762038vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
aba0e602e244ae7c4f11b50fc6d2440f5a762038vboxsync * VirtualBox OSE distribution, in which case the provisions of the
aba0e602e244ae7c4f11b50fc6d2440f5a762038vboxsync * CDDL are applicable instead of those of the GPL.
aba0e602e244ae7c4f11b50fc6d2440f5a762038vboxsync *
aba0e602e244ae7c4f11b50fc6d2440f5a762038vboxsync * You may elect to license modified versions of this file under the
aba0e602e244ae7c4f11b50fc6d2440f5a762038vboxsync * terms and conditions of either the GPL or the CDDL or both.
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync */
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync/*******************************************************************************
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync* Header Files *
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync*******************************************************************************/
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync#include "VBGLR3Internal.h"
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync/**
285baa736e37470efab3a69a9bdd76be471dfe8avboxsync * Retrieve mouse coordinates and features from the host.
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync *
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync * @returns VBox status code.
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync *
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync * @param pfFeatures Where to store the mouse features.
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync * @param px Where to store the X co-ordinate.
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync * @param py Where to store the Y co-ordinate.
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync */
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsyncVBGLR3DECL(int) VbglR3GetMouseStatus(uint32_t *pfFeatures, uint32_t *px, uint32_t *py)
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync{
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync VMMDevReqMouseStatus Req;
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync vmmdevInitRequest(&Req.header, VMMDevReq_GetMouseStatus);
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync Req.mouseFeatures = 0;
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync Req.pointerXPos = 0;
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync Req.pointerYPos = 0;
0c1bdc5adae416967cb64e09f8ec81a5b77fe31dvboxsync int rc = vbglR3GRPerform(&Req.header);
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync if (RT_SUCCESS(rc))
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync {
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync if (pfFeatures)
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync *pfFeatures = Req.mouseFeatures;
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync if (px)
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync *px = Req.pointerXPos;
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync if (py)
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync *py = Req.pointerYPos;
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync }
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync return rc;
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync}
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync/**
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync * Send mouse features to the host.
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync *
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync * @returns VBox status code.
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync *
ef78fcbc798650f56698f8978bd4194fcfc55a78vboxsync * @param fFeatures Supported mouse pointer features. The main guest driver
ef78fcbc798650f56698f8978bd4194fcfc55a78vboxsync * will mediate different callers and show the host any
ef78fcbc798650f56698f8978bd4194fcfc55a78vboxsync * feature enabled by any guest caller.
bc830c4bf23fbfb4373b949a1d408b4a1c67017dvboxsync */
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsyncVBGLR3DECL(int) VbglR3SetMouseStatus(uint32_t fFeatures)
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync{
4e54ef30d55406d3cdda81fdf1e74b567c378425vboxsync return vbglR3DoIOCtl(VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &fFeatures,
4e54ef30d55406d3cdda81fdf1e74b567c378425vboxsync sizeof(fFeatures));
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync}
083dd76e9fd7a829b1ed67ffc9003276643e7db1vboxsync