Пример #1
0
/**
 * Move the device's pointer to the x/y coordinates on the given screen.
 * This function generates and enqueues pointer events.
 *
 * @param pDev The device to move
 * @param pScreen The screen the device is on
 * @param x The x coordinate in per-screen coordinates
 * @param y The y coordinate in per-screen coordinates
 */
void
miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
    int i, nevents;
    int valuators[2];
    ValuatorMask mask;

    miPointerMoveNoEvent(pDev, pScreen, x, y);

    /* generate motion notify */
    valuators[0] = x;
    valuators[1] = y;

    if (!events)
    {
        events = InitEventList(GetMaximumEventsNum());

        if (!events)
        {
            FatalError("Could not allocate event store.\n");
            return;
        }
    }

    valuator_mask_set_range(&mask, 0, 2, valuators);
    nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
                               POINTER_SCREEN | POINTER_ABSOLUTE | POINTER_NORAW, &mask);

    OsBlockSignals();
#ifdef XQUARTZ
    darwinEvents_lock();
#endif
    for (i = 0; i < nevents; i++)
        mieqEnqueue(pDev, &events[i]);
#ifdef XQUARTZ
    darwinEvents_unlock();
#endif
    OsReleaseSignals();
}
Пример #2
0
/**
 *  Uninit scheme
 */
void
AccelerationDefaultCleanup(DeviceIntPtr dev)
{
    DeviceVelocityPtr vel = GetDevicePredictableAccelData(dev);

    if (vel) {
        /* the proper guarantee would be that we're not inside of
         * AccelSchemeProc(), but that seems impossible. Schemes don't get
         * switched often anyway.
         */
        OsBlockSignals();
        dev->valuator->accelScheme.AccelSchemeProc = NULL;
        FreeVelocityData(vel);
        free(vel);
        DeletePredictableAccelerationProperties(dev,
                                                (PredictableAccelSchemePtr)
                                                dev->valuator->accelScheme.
                                                accelData);
        free(dev->valuator->accelScheme.accelData);
        dev->valuator->accelScheme.accelData = NULL;
        OsReleaseSignals();
    }
}
Пример #3
0
/**
Initialize a filter chain.
Expected result is a series of filters, each progressively more integrating.

This allows for two strategies: Either you have one filter which is reasonable
and is being coupled to account for fast-changing input, or you have 'one for
every situation'. You might want to have tighter coupling then, e.g. 0.1.
In the filter stats, you can see if a reasonable filter useage emerges.
*/
void
InitFilterChain(DeviceVelocityPtr s, float rdecay, float progression, int stages, int lutsize)
{
    int fn;
    if((stages > 1 && progression < 1.0f) || 0 == progression){
	ErrorF("(dix ptracc) invalid filter chain progression specified\n");
	return;
    }
    /* Block here to support runtime filter adjustment */
    OsBlockSignals();
    for(fn = 0; fn < MAX_VELOCITY_FILTERS; fn++){
	if(fn < stages){
	    InitFilterStage(&s->filters[fn], rdecay, lutsize);
	}else{
	    InitFilterStage(&s->filters[fn], 0, 0);
	}
	rdecay /= progression;
    }
    /* release again. Should the input loop be threaded, we also need
     * memory release here (in principle).
     */
    OsReleaseSignals();
}
Пример #4
0
/**
 * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC1 are
 * unset.  EDID information blocks are interpreted and the results returned in
 * an xf86MonPtr.
 *
 * This function does not affect the list of modes used by drivers -- it is up
 * to the driver to decide policy on what to do with EDID information.
 *
 * @return pointer to a new xf86MonPtr containing the EDID information.
 * @return NULL if no monitor attached or failure to interpret the EDID.
 */
xf86MonPtr
xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed,
                unsigned int (*DDC1Read) (ScrnInfoPtr))
{
    unsigned char *EDID_block = NULL;
    xf86MonPtr tmp = NULL;

    /* Default DDC and DDC1 to enabled. */
    Bool noddc = FALSE, noddc1 = FALSE;
    OptionInfoPtr options;

    options = xnfalloc(sizeof(DDCOptions));
    (void) memcpy(options, DDCOptions, sizeof(DDCOptions));
    xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);

    xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
    xf86GetOptValBool(options, DDCOPT_NODDC1, &noddc1);
    free(options);

    if (noddc || noddc1)
        return NULL;

    OsBlockSignals();
    EDID_block = EDIDRead_DDC1(pScrn, DDC1SetSpeed, DDC1Read);
    OsReleaseSignals();

    if (EDID_block) {
        tmp = xf86InterpretEDID(pScrn->scrnIndex, EDID_block);
    }
#ifdef DEBUG
    else
        ErrorF("No EDID block returned\n");
    if (!tmp)
        ErrorF("Cannot interpret EDID block\n");
#endif
    return tmp;
}
Пример #5
0
static void block_sigio_test(void)
{
#ifdef SIG_BLOCK
    sigset_t current;

    sigemptyset(&current);
    assert(!sig_is_blocked(SIGIO));

    /* block once */
    OsBlockSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSIGIO();
    assert(!sig_is_blocked(SIGIO));

    /* block twice, nested */
    OsBlockSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsBlockSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSIGIO();
    assert(!sig_is_blocked(SIGIO));

    /* block all */
    OsBlockSignals();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSignals();
    assert(!sig_is_blocked(SIGIO));

    /* block all nested */
    OsBlockSignals();
    assert(sig_is_blocked(SIGIO));
    OsBlockSignals();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSignals();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSignals();
    assert(!sig_is_blocked(SIGIO));

    /* mix the two */
    /* ABBA */
    OsBlockSignals();
    assert(sig_is_blocked(SIGIO));
    OsBlockSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSignals();
    assert(!sig_is_blocked(SIGIO));

    /* ABAB */
    OsBlockSignals();
    assert(sig_is_blocked(SIGIO));
    OsBlockSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSignals();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSIGIO();
    assert(!sig_is_blocked(SIGIO));

    /* BAAB */
    OsBlockSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsBlockSignals();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSignals();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSIGIO();
    assert(!sig_is_blocked(SIGIO));

    /* BABA */
    OsBlockSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsBlockSignals();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSIGIO();
    assert(sig_is_blocked(SIGIO));
    OsReleaseSignals();
    assert(!sig_is_blocked(SIGIO));
#endif
}