VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/vboxvideo/helpers.c@ 55393

Last change on this file since 55393 was 55393, checked in by vboxsync, 9 years ago

Additions/x11/vboxvideo: update testing documentation.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/* $Id: helpers.c 55393 2015-04-22 20:01:10Z vboxsync $ */
2/** @file
3 * VirtualBox X11 Additions graphics driver X server helper functions
4 *
5 * This file contains helpers which call back into the X server. The longer-
6 * term idea is to eliminate X server version dependencies in as many files as
7 * possible inside the driver code. Ideally most files should not directly
8 * depend on X server symbols at all.
9 */
10
11/*
12 * Copyright (C) 2014 Oracle Corporation
13 *
14 * This file is part of VirtualBox Open Source Edition (OSE), as
15 * available from http://www.virtualbox.org. This file is free software;
16 * you can redistribute it and/or modify it under the terms of the GNU
17 * General Public License (GPL) as published by the Free Software
18 * Foundation, in version 2 as it comes in the "COPYING" file of the
19 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
20 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
21 */
22
23#include "vboxvideo.h"
24#include <os.h>
25#include <propertyst.h>
26#include <windowstr.h>
27#include <xf86.h>
28#include <X11/Xatom.h>
29#ifdef XORG_7X
30# include <string.h>
31#endif
32
33void vbvxMsg(const char *pszFormat, ...)
34{
35 va_list args;
36
37 va_start(args, pszFormat);
38 VErrorF(pszFormat, args);
39 va_end(args);
40}
41
42void vbvxMsgV(const char *pszFormat, va_list args)
43{
44 VErrorF(pszFormat, args);
45}
46
47void vbvxAbortServer(void)
48{
49 FatalError("Assertion");
50}
51
52VBOXPtr vbvxGetRec(ScrnInfoPtr pScrn)
53{
54 return ((VBOXPtr)pScrn->driverPrivate);
55}
56
57int vbvxGetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t *pcData, int32_t **ppaData)
58{
59 Atom atom;
60 PropertyPtr prop;
61
62 /* We can get called early, before the root window is created. */
63 if (!ROOT_WINDOW(pScrn))
64 return VERR_NOT_FOUND;
65 atom = MakeAtom(pszName, strlen(pszName), TRUE);
66 if (atom == BAD_RESOURCE)
67 return VERR_NOT_FOUND;
68 for (prop = wUserProps(ROOT_WINDOW(pScrn));
69 prop != NULL && prop->propertyName != atom; prop = prop->next);
70 if (prop == NULL)
71 return VERR_NOT_FOUND;
72 if (prop->type != XA_INTEGER || prop->format != 32)
73 return VERR_NOT_FOUND;
74 *pcData = prop->size;
75 *ppaData = (int32_t *)prop->data;
76 return VINF_SUCCESS;
77}
78
79void vbvxSetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t cData, int32_t *paData, Bool fSendEvent)
80{
81 Atom property_name;
82 int i;
83
84 property_name = MakeAtom(pszName, strlen(pszName), TRUE);
85 VBVXASSERT(property_name != BAD_RESOURCE, ("Failed to set atom \"%s\"\n", pszName));
86 ChangeWindowProperty(ROOT_WINDOW(pScrn), property_name, XA_INTEGER, 32, PropModeReplace, cData, paData, fSendEvent);
87}
88
89void vbvxReprobeCursor(ScrnInfoPtr pScrn)
90{
91 if (ROOT_WINDOW(pScrn) == NULL)
92 return;
93#ifdef XF86_SCRN_INTERFACE
94 pScrn->EnableDisableFBAccess(pScrn, FALSE);
95 pScrn->EnableDisableFBAccess(pScrn, TRUE);
96#else
97 pScrn->EnableDisableFBAccess(pScrn->scrnIndex, FALSE);
98 pScrn->EnableDisableFBAccess(pScrn->scrnIndex, TRUE);
99#endif
100}
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use