VirtualBox

Changeset 50981 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Apr 7, 2014 7:15:37 AM (11 years ago)
Author:
vboxsync
Message:

Additions/x11/vboxvideo: set a root window property to say whether we own the active VT. Adjusted to match what was accepted in upstream X.Org.

Location:
trunk/src/VBox/Additions/x11/vboxvideo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/vboxvideo/undefined

    r50979 r50981  
     1ChangeWindowProperty
    12DRI2CloseScreen
    23DRI2ScreenInit
     
    1920ShadowFBInit2
    2021VErrorF
     22WindowTable
    2123XNFcalloc
    2224XNFstrdup
     
    166168xf86PrintDepthBpp
    167169xf86PrintModes
     170xf86RegisterRootWindowProperty
    168171xf86SaveScreen
    169172xf86ScreenToScrn
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c

    r50979 r50981  
    6666#endif
    6767
     68/* This was accepted upstream in X.Org Server 1.16 which bumped the video
     69 * driver ABI to 17. */
     70#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 17
     71# define SET_HAVE_VT_PROPERTY
     72#endif
     73
    6874#ifndef PCIACCESS
    6975/* Drivers for PCI hardware need this */
     
    101107# include "xf86Crtc.h"
    102108# include "xf86Modes.h"
    103 # include <X11/Xatom.h>
    104 #endif
     109#endif
     110
     111/* For setting the root window property. */
     112#include <X11/Xatom.h>
     113#include "property.h"
    105114
    106115#ifdef VBOX_DRI
     
    979988}
    980989
     990#ifdef SET_HAVE_VT_PROPERTY
     991# define HAS_VT_ATOM_NAME "XFree86_has_VT"
     992/* The memory storing the initial value of the XFree86_has_VT root window
     993 * property.  This has to remain available until server start-up, so we just
     994 * use a global. */
     995static CARD32 HasVTValue = 1;
     996
     997/** Initialise a flag property on the root window to say whether the server VT
     998 *  is currently the active one as some clients need to know this. */
     999static void initialiseHasVTProperty(ScrnInfoPtr pScrn)
     1000{
     1001    Atom HasVTAtom = -1;
     1002    CARD32 *HasVT = &HasVTValue;
     1003    HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1, TRUE);
     1004    if (!xf86RegisterRootWindowProperty(pScrn->scrnIndex, HasVTAtom, XA_INTEGER,
     1005                                        32, 1, HasVT))
     1006        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
     1007                   "Failed to register VT property\n");
     1008}
     1009
     1010/** Helper to work round different ways of getting the root window in different
     1011 * server versions. */
     1012#if defined(XORG_VERSION_CURRENT) && XORG_VERSION_CURRENT < 700000000 \
     1013    && XORG_VERSION_CURRENT >= 100900000
     1014# define ROOT_WINDOW(pScrn) xf86ScrnToScreen(pScrn)->root
     1015#else
     1016# define ROOT_WINDOW(pScrn) WindowTable[xf86ScrnToScreen(pScrn)->myNum]
     1017#endif
     1018
     1019/** Update a flag property on the root window to say whether the server VT
     1020 *  is currently the active one as some clients need to know this. */
     1021static void updateHasVTProperty(ScrnInfoPtr pScrn, Bool hasVT)
     1022{
     1023    Atom property_name;
     1024    int32_t value = hasVT ? 1 : 0;
     1025    int i;
     1026
     1027    property_name = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
     1028                             FALSE);
     1029    if (property_name == BAD_RESOURCE)
     1030        FatalError("Failed to retrieve \"HAS_VT\" atom\n");
     1031    ChangeWindowProperty(ROOT_WINDOW(pScrn), property_name, XA_INTEGER, 32,
     1032                         PropModeReplace, 1, &value, TRUE);
     1033}
     1034#endif /* SET_HAVE_VT_PROPERTY */
     1035
    9811036/*
    9821037 * QUOTE from the XFree86 DESIGN document:
     
    11781233        pVBox->useDRI = VBOXDRIFinishScreenInit(pScreen);
    11791234#endif
     1235
     1236#ifdef SET_HAVE_VT_PROPERTY
     1237    initialiseHasVTProperty(pScrn);
     1238#endif
     1239
    11801240    return (TRUE);
    11811241}
     
    12091269        return FALSE;
    12101270#endif
     1271#ifdef SET_HAVE_VT_PROPERTY
     1272    updateHasVTProperty(pScrn, TRUE);
     1273#endif
    12111274    return TRUE;
    12121275}
     
    12301293#endif
    12311294        VBOXRestoreMode(pScrn);
     1295#ifdef SET_HAVE_VT_PROPERTY
     1296    updateHasVTProperty(pScrn, FALSE);
     1297#endif
    12321298    TRACE_EXIT();
    12331299}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette