VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/xmouse/VBoxUtils.c@ 8518

Last change on this file since 8518 was 8155, checked in by vboxsync, 17 years ago

The Big Sun Rebranding Header Change

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1/** @file
2 *
3 * VirtualBox X11 Additions mouse driver utility functions
4 */
5
6/*
7 * Copyright (C) 2006-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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#include <iprt/assert.h>
23#include <VBox/VBoxGuest.h>
24#include "VBoxUtils.h"
25
26#include "xf86.h"
27#define NEED_XF86_TYPES
28#include "xf86_ansic.h"
29#include "compiler.h"
30
31int VBoxMouseInit(void)
32{
33 int rc = VbglR3Init();
34 if (RT_FAILURE(rc))
35 {
36 ErrorF("VbglR3Init failed.\n");
37 return 1;
38 }
39
40 rc = VbglR3SetMouseStatus(VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE /* | VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR */);
41 if (VBOX_FAILURE(rc))
42 {
43 ErrorF("Error sending mouse pointer capabilities to VMM! rc = %d (%s)\n",
44 errno, strerror(errno));
45 return 1;
46 }
47 xf86Msg(X_INFO, "VirtualBox mouse pointer integration available.\n");
48 return 0;
49}
50
51
52int VBoxMouseQueryPosition(unsigned int *puAbsXPos, unsigned int *puAbsYPos)
53{
54 int rc;
55 uint32_t pointerXPos;
56 uint32_t pointerYPos;
57
58 AssertPtrReturn(puAbsXPos, VERR_INVALID_PARAMETER);
59 AssertPtrReturn(puAbsYPos, VERR_INVALID_PARAMETER);
60 rc = VbglR3GetMouseStatus(NULL, &pointerXPos, &pointerYPos);
61 if (VBOX_SUCCESS(rc))
62 {
63 *puAbsXPos = pointerXPos;
64 *puAbsYPos = pointerYPos;
65 return 0;
66 }
67 ErrorF("Error querying host mouse position! rc = %d\n", rc);
68 return 2;
69}
70
71
72int VBoxMouseFini(void)
73{
74 int rc = VbglR3SetMouseStatus(0);
75 VbglR3Term();
76 return rc;
77}
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