Ejemplo n.º 1
0
void* vncRandRSetPreferredMode(void* out, void* m)
{
    RRModePtr mode;
    RROutputPtr output;
    int width, height;

    mode = m;
    output = out;

    width = mode->mode.width;
    height = mode->mode.height;

    /* Already the preferred mode? */
    if ((output->numModes >= 1) && (output->numPreferred == 1) &&
        (output->modes[0] == mode))
        return mode;

    /* Recreate the list, with the mode we want as preferred */
    vncRandRSetModes(output, width, height);

    /* Sanity check */
    if ((output->numModes >= 1) && (output->numPreferred == 1) &&
        (output->modes[0]->mode.width == width) &&
        (output->modes[0]->mode.height == height))
        return output->modes[0];

    /* Something went horribly wrong */
    return NULL;
}
Ejemplo n.º 2
0
static RRCrtcPtr vncRandRCrtcCreate(ScreenPtr pScreen)
{
    RRCrtcPtr crtc;
    RROutputPtr output;
    char name[100];

    /* First we create the CRTC... */
    crtc = RRCrtcCreate(pScreen, NULL);

    /* We don't actually support gamma, but xrandr complains when it is missing */
    RRCrtcGammaSetSize (crtc, 256);

    /* Then we create a dummy output for it... */
    sprintf(name, "VNC-%d", vncRandRIndex);
    vncRandRIndex++;

    output = RROutputCreate(pScreen, name, strlen(name), NULL);

    RROutputSetCrtcs(output, &crtc, 1);
    RROutputSetConnection(output, RR_Disconnected);

    /* Make sure the CRTC has this output set */
    vncRandRCrtcSet(pScreen, crtc, NULL, 0, 0, RR_Rotate_0, 1, &output);

    /* Populate a list of default modes */
    vncRandRSetModes(output, -1, -1);

    return crtc;
}
Ejemplo n.º 3
0
void* vncRandRCreateMode(void* out, int width, int height)
{
    RROutputPtr output;

    output = out;

    /* Do we already have the mode? */
    for (int i = 0; i < output->numModes; i++) {
        if ((output->modes[i]->mode.width == width) &&
            (output->modes[i]->mode.height == height))
            return output->modes[i];
    }

    /* Just recreate the entire list */
    vncRandRSetModes(output, width, height);

    /* Find the new mode */
    for (int i = 0; i < output->numModes; i++) {
        if ((output->modes[i]->mode.width == width) &&
            (output->modes[i]->mode.height == height))
            return output->modes[i];
    }

    /* Something went horribly wrong */
    return NULL;
}
Ejemplo n.º 4
0
/* Used to create a preferred mode from various places */
void *vncRandRCreatePreferredMode(void *out, int width, int height)
{
    RROutputPtr output;

    output = out;

    /* Already the preferred mode? */
    if ((output->numModes >= 1) && (output->numPreferred == 1) &&
        (output->modes[0]->mode.width == width) &&
        (output->modes[0]->mode.height == height))
        return output->modes[0];

    /* Recreate the list, with the mode we want as preferred */
    vncRandRSetModes(output, width, height);

    if ((output->numModes >= 1) && (output->numPreferred == 1) &&
        (output->modes[0]->mode.width == width) &&
        (output->modes[0]->mode.height == height))
        return output->modes[0];

    return NULL;
}