VirtualBox

Ignore:
Timestamp:
Jan 12, 2015 8:28:13 PM (10 years ago)
Author:
vboxsync
Message:

Additions/x11/vboxvideo: more refactoring.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/vboxvideo/getmode.c

    r53770 r53777  
    2929#include "windowstr.h"
    3030#include <X11/extensions/randrproto.h>
    31 #include <X11/Xatom.h>
    3231
    3332#ifdef XORG_7X
     
    258257{
    259258    VBOXPtr pVBox = VBOXGetRec(pScrn);
    260     Atom atom = MakeAtom(SIZE_HINTS_PROPERTY, sizeof(SIZE_HINTS_PROPERTY) - 1,
    261                          FALSE);
    262     PropertyPtr prop = NULL;
     259    size_t cModes;
     260    int32_t *paModes;
    263261    unsigned i;
    264262
     
    282280    }
    283281#endif
    284     /* We can get called early, before the root window is created. */
    285     if (!ROOT_WINDOW(pScrn))
     282    if (vbvxGetIntegerPropery(pScrn, SIZE_HINTS_PROPERTY, &cModes, &paModes) != VINF_SUCCESS)
    286283        return;
    287     if (atom != BAD_RESOURCE)
    288     {
    289         for (prop = wUserProps(ROOT_WINDOW(pScrn));
    290              prop != NULL && prop->propertyName != atom; prop = prop->next);
    291     }
    292     if (prop && prop->type == XA_INTEGER && prop->format == 32)
    293         for (i = 0; i < prop->size && i < pVBox->cScreens; ++i)
     284    for (i = 0; i < cModes && i < pVBox->cScreens; ++i)
     285    {
     286        if (paModes[i] != 0)
    294287        {
    295             if (((int32_t *)prop->data)[i] != 0)
    296             {
    297                 pVBox->pScreens[i].aPreferredSize.cx =
    298                     ((int32_t *)prop->data)[i] >> 16;
    299                 pVBox->pScreens[i].aPreferredSize.cy =
    300                     ((int32_t *)prop->data)[i] & 0x8fff;
    301             }
     288            pVBox->pScreens[i].aPreferredSize.cx =
     289                paModes[i] >> 16;
     290            pVBox->pScreens[i].aPreferredSize.cy =
     291                paModes[i] & 0x8fff;
    302292        }
     293    }
    303294}
    304295
  • trunk/src/VBox/Additions/x11/vboxvideo/helpers.c

    r53773 r53777  
    2323#include "vboxvideo.h"
    2424#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
    2531
    2632void vbvxMsg(const char *pszFormat, ...)
     
    4753    return ((VBOXPtr)pScrn->driverPrivate);
    4854}
     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}
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h

    r53773 r53777  
    239239extern VBOXPtr vbvxGetRec(ScrnInfoPtr pScrn);
    240240#define VBOXGetRec vbvxGetRec  /* Temporary */
     241extern int vbvxGetIntegerPropery(ScrnInfoPtr pScrn, char *pszName, size_t *pcData, int32_t **ppaData);
    241242
    242243/* setmode.c */
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