VirtualBox

Changeset 7086 in vbox


Ignore:
Timestamp:
Feb 21, 2008 8:06:06 PM (17 years ago)
Author:
vboxsync
Message:

Additions/x11: reverted the XFree86/X.org 6.8 additions to their old state (not using IPRT or the guest library)

Location:
trunk/src/VBox/Additions/x11
Files:
2 edited
2 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/xgraphics/Makefile.kmk

    r6756 r7086  
    9797 vboxvideo_drv_SOURCES = \
    9898        vboxvideo_68.c \
    99         vboxutils-new.c
     99        vboxutils_68.c
    100100endif   # target linux, l4
    101101
  • trunk/src/VBox/Additions/x11/xgraphics/vboxutils_68.c

    r7076 r7086  
    3131#endif
    3232
    33 #include "vboxvideo.h"
     33#include "vboxvideo_68.h"
    3434
    3535#define VBOX_MAX_CURSOR_WIDTH 64
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_68.h

    r7076 r7086  
    7575/* VBE/DDC support */
    7676#include "vbe.h"
    77 #ifdef XORG_7X
    78 #include "vbeModes.h"
    79 #endif
    8077#include "xf86DDC.h"
    8178
     
    118115#include "afb.h"
    119116#include "mfb.h"
    120 #ifndef XORG_7X
    121 #include "cfb24_32.h"
    122 #endif
    123117
    124118#define VBOX_VERSION            4000
     
    137131    PCITAG pciTag;
    138132    CARD16 maxBytesPerScanline;
    139 #ifdef XORG_7X
    140     unsigned long mapPhys, mapOff;
    141     int mapSize;        /* video memory */
    142 #else
    143133    int mapPhys, mapOff, mapSize;       /* video memory */
    144 #endif
    145134    void *base, *VGAbase;
    146135    CARD8 *state, *pstate;      /* SVGA state */
     
    153142    CloseScreenProcPtr CloseScreen;
    154143    OptionInfoPtr Options;
    155 #ifdef XORG_7X
    156     IOADDRESS ioBase;
    157 #endif  /* XORG_7X defined */
    158 #if 0
    159144    int vbox_fd;
    160 #endif
    161145    VMMDevReqMousePointer *reqp;
    162146    xf86CursorInfoPtr pCurs;
     
    166150    Bool pointerOffscreen;
    167151    Bool useVbva;
    168 #if 0
    169152    VMMDevVideoAccelFlush *reqf;
    170153    VMMDevVideoAccelEnable *reqe;
    171 #endif
    172154    VMMDevMemory *pVMMDevMemory;
    173155    VBVAMEMORY *pVbvaMemory;
    174156} VBOXRec, *VBOXPtr;
    175157
    176 #ifndef XORG_7X
    177158typedef struct _ModeInfoData
    178159{
     
    181162    VbeCRTCInfoBlock *block;
    182163} ModeInfoData;
    183 #endif
    184164
    185165Bool vbox_cursor_init (ScreenPtr pScreen);
  • trunk/src/VBox/Additions/x11/xmouse/Makefile.kmk

    r6756 r7086  
    5050        mouse.c \
    5151        pnp.c \
    52         VBoxUtils.c
     52        VBoxUtils_68.c
    5353endif
    5454
  • trunk/src/VBox/Additions/x11/xmouse/VBoxUtils_68.c

    r7076 r7086  
    2525#include "compiler.h"
    2626
     27#ifndef RT_OS_SOLARIS
     28#include <asm/ioctl.h>
     29#endif
     30
     31#ifdef RT_OS_SOLARIS        /** @todo later Linux should also use R3 lib for this */
    2732int VBoxMouseInit(void)
    2833{
     
    7277    return rc;
    7378}
     79#else
     80/* the vboxadd module file handle */
     81static int g_vboxaddHandle = -1;
     82/* the request structure */
     83static VMMDevReqMouseStatus *g_vmmreqMouseStatus = NULL;
     84
     85/**
     86 * Initialise mouse integration.  Returns 0 on success and 1 on failure
     87 * (for example, if the VBox kernel module is not loaded).
     88 */
     89int VBoxMouseInit(void)
     90{
     91    VMMDevReqMouseStatus req;
     92
     93    /* return immediately if already initialized */
     94    if (g_vboxaddHandle != -1)
     95        return 0;
     96
     97    /* open the driver */
     98    g_vboxaddHandle = open(VBOXGUEST_DEVICE_NAME, O_RDWR, 0);
     99    if (g_vboxaddHandle < 0)
     100    {
     101        ErrorF("Unable to open the virtual machine device: %s\n",
     102               strerror(errno));
     103        return 1;
     104    }
     105
     106    /* prepare the request structure */
     107    g_vmmreqMouseStatus = malloc(vmmdevGetRequestSize(VMMDevReq_GetMouseStatus));
     108    if (!g_vmmreqMouseStatus)
     109    {
     110        ErrorF("Ran out of memory while querying the virtual machine for the mouse capabilities.\n");
     111        return 1;
     112    }
     113    vmmdevInitRequest((VMMDevRequestHeader*)g_vmmreqMouseStatus, VMMDevReq_GetMouseStatus);
     114
     115    /* tell the host that we want absolute coordinates */
     116    vmmdevInitRequest((VMMDevRequestHeader*)&req, VMMDevReq_SetMouseStatus);
     117    req.mouseFeatures = VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE | VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR;
     118    req.pointerXPos = 0;
     119    req.pointerYPos = 0;
     120    if (ioctl(g_vboxaddHandle, IOCTL_VBOXGUEST_VMMREQUEST, (void*)&req) < 0)
     121    {
     122        ErrorF("Error sending mouse pointer capabilities to VMM! rc = %d (%s)\n",
     123               errno, strerror(errno));
     124        return 1;
     125    }
     126    /* everything is fine, put out some branding */
     127    xf86Msg(X_INFO, "VirtualBox mouse pointer integration available.\n");
     128    return 0;
     129}
     130
     131/**
     132 * Queries the absolute mouse position from the host.
     133 *
     134 * Returns 0 on success.
     135 * Returns 1 when the host doesn't want absolute coordinates (no coordinates returned)
     136 * Otherwise > 1 which means unsuccessful.
     137 */
     138int VBoxMouseQueryPosition(unsigned int *abs_x, unsigned int *abs_y)
     139{
     140    /* If we failed to initialise, say that we don't want absolute co-ordinates. */
     141    if (g_vboxaddHandle < 0)
     142        return 1;
     143    /* perform VMM request */
     144    if (ioctl(g_vboxaddHandle, IOCTL_VBOXGUEST_VMMREQUEST, (void*)g_vmmreqMouseStatus) >= 0)
     145    {
     146        if (VBOX_SUCCESS(g_vmmreqMouseStatus->header.rc))
     147        {
     148            /* does the host want absolute coordinates? */
     149            if (g_vmmreqMouseStatus->mouseFeatures & VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE)
     150            {
     151                *abs_x = g_vmmreqMouseStatus->pointerXPos;
     152                *abs_y = g_vmmreqMouseStatus->pointerYPos;
     153                return 0;
     154            }
     155            else
     156                return 1;
     157        }
     158        else
     159        {
     160            ErrorF("Error querying host mouse position! header.rc = %d\n", g_vmmreqMouseStatus->header.rc);
     161        }
     162    }
     163    else
     164    {
     165        ErrorF("Error performing VMM request! errno = %d (%s)\n",
     166               errno, strerror(errno));
     167    }
     168    /* error! */
     169    return 2;
     170}
     171
     172int VBoxMouseFini(void)
     173{
     174    VMMDevReqMouseStatus req;
     175    /* If we are not initialised, there is nothing to do */
     176    if (g_vboxaddHandle < 0)
     177        return 0;
     178    /* tell VMM that we no longer support absolute mouse handling */
     179    vmmdevInitRequest((VMMDevRequestHeader*)&req, VMMDevReq_SetMouseStatus);
     180    req.mouseFeatures = 0;
     181    req.pointerXPos = 0;
     182    req.pointerYPos = 0;
     183    if (ioctl(g_vboxaddHandle, IOCTL_VBOXGUEST_VMMREQUEST, (void*)&req) < 0)
     184    {
     185        ErrorF("ioctl to vboxadd module failed, rc = %d (%s)\n",
     186               errno, strerror(errno));
     187    }
     188
     189    free(g_vmmreqMouseStatus);
     190    g_vmmreqMouseStatus = NULL;
     191    close(g_vboxaddHandle);
     192    g_vboxaddHandle = -1;
     193    return 0;
     194}
     195#endif  /* !RT_OS_SOLARIS */
     196
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