VirtualBox

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

Last change on this file since 7937 was 7274, checked in by vboxsync, 17 years ago

Additions/x11: * fix for the case in which the video driver is loaded but the mouse driver not - in this case the mouse pointer will be drawn in software. * More logging clean-ups

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