VirtualBox

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

Last change on this file since 53777 was 53777, checked in by vboxsync, 10 years ago

Additions/x11/vboxvideo: more refactoring.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1/* $Id: helpers.c 53777 2015-01-12 20:28:13Z 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 <X11/Xatom.h>
28#ifdef XORG_7X
29# include <string.h>
30#endif
31
32void vbvxMsg(const char *pszFormat, ...)
33{
34 va_list args;
35
36 va_start(args, pszFormat);
37 VErrorF(pszFormat, args);
38 va_end(args);
39}
40
41void vbvxMsgV(const char *pszFormat, va_list args)
42{
43 VErrorF(pszFormat, args);
44}
45
46void vbvxAbortServer(void)
47{
48 FatalError("Assertion");
49}
50
51VBOXPtr vbvxGetRec(ScrnInfoPtr pScrn)
52{
53 return ((VBOXPtr)pScrn->driverPrivate);
54}
55
56/* TESTING: if this is broken, dynamic resizing will not work on old X servers (1.2 and older). */
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), FALSE);
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}
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