Beispiel #1
0
void DBusHandler::Callbacks::toggleTimeout(DBusTimeout* timeout, void* data)
{
    wl_event_source* s = (wl_event_source*) dbus_timeout_get_data(timeout);
    if(!s)
    {
		ny::sendWarning("dbusToggleTimeout: dbus timeout has no data");
        return;
    }

    adjustTimeout(timeout, s);
}
Beispiel #2
0
/*
 * This function is called by the VM periodically. It has to check if
 * system has sent a signal to MIDP and return the result in the
 * structs given.
 *
 * Values for the <timeout> paramater:
 *  >0 = Block until a signal sent to MIDP, or until <timeout> milliseconds
 *       has elapsed.
 *   0 = Check the system for a signal but do not block. Return to the
 *       caller immediately regardless of the if a signal was sent.
 *  -1 = Do not timeout. Block until a signal is sent to MIDP.
 *
 * IMPL NOTE: this function now is definitely not highlevelui-only. Redesign is
 * strongly recommended
 */
void checkForSystemSignal(MidpReentryData* pNewSignal,
    MidpEvent* pNewMidpEvent, jlong timeout) {

    jboolean pendingSignal = KNI_FALSE;
    jlong currentTime = JVM_JavaMilliSeconds();

    /* Pending event should be processed prior to other events */
    pendingSignal = checkForPendingSignals(
            pNewSignal, pNewMidpEvent, currentTime);

    if (!pendingSignal) {
        /* Adjust timeout regarding near timers */
        adjustTimeout(currentTime, &timeout);
        /* Call all registered signal checkers during timeout */
        checkForAllSignals(pNewSignal, pNewMidpEvent, timeout);
    }
}
Beispiel #3
0
unsigned int DBusHandler::Callbacks::addTimeout(DBusTimeout* timeout, void* data)
{
	if(!data) return 0;
	auto& loop = static_cast<DBusHandler*>(data)->compositor().wlEventLoop();

    wl_event_source* source;
    if(!(source = wl_event_loop_add_timer(&loop, dispatchTimeout, timeout)))
    {
		ny::sendWarning("dbusAddTimeout: failed to add wl_event_loop_timer");
        return 0;
    }

    if(adjustTimeout(timeout, source) < 0)
    {
		ny::sendWarning("dbusAddTimeout: failed to adjust timeout");
        wl_event_source_remove(source);
        return 0;
    }

    dbus_timeout_set_data(timeout, source, nullptr);
    return true;
}