void PVR2D_PerfFini(ScreenPtr pScreen)
{
	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
	FBDevPtr fbdev = FBDEVPTR(pScrn);
	if (fbdev->perf_timer)
		TimerFree(fbdev->perf_timer);
}
Example #2
0
/**
 * Disconnect (if we haven't already been forcefully disconnected), clean up
 * after ourselves, and call all registered disconnect hooks.
 */
static void
teardown(void)
{
    struct dbus_core_hook *hook;

    if (bus_info.timer) {
        TimerFree(bus_info.timer);
        bus_info.timer = NULL;
    }

    /* We should really have pre-disconnect hooks and run them here, for
     * completeness.  But then it gets awkward, given that you can't
     * guarantee that they'll be called ... */
    if (bus_info.connection)
        dbus_connection_unref(bus_info.connection);

    RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, &bus_info);
    if (bus_info.fd != -1)
        RemoveGeneralSocket(bus_info.fd);
    bus_info.fd = -1;
    bus_info.connection = NULL;

    for (hook = bus_info.hooks; hook; hook = hook->next) {
        if (hook->disconnect)
            hook->disconnect(hook->data);
    }
}
Example #3
0
static int
SecurityDeleteAuthorization(
    pointer value,
    XID id)
{
    SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)value;
    unsigned short name_len, data_len;
    char *name, *data;
    int status;
    int i;
    OtherClientsPtr pEventClient;

    /* Remove the auth using the os layer auth manager */

    status = AuthorizationFromID(pAuth->id, &name_len, &name,
				 &data_len, &data);
    assert(status);
    status = RemoveAuthorization(name_len, name, data_len, data);
    assert(status);
    (void)status;

    /* free the auth timer if there is one */

    if (pAuth->timer) TimerFree(pAuth->timer);

    /* send revoke events */

    while ((pEventClient = pAuth->eventClients))
    {
	/* send revocation event event */
	ClientPtr client = rClient(pEventClient);

	if (!client->clientGone)
	{
	    xSecurityAuthorizationRevokedEvent are;
	    are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
	    are.sequenceNumber = client->sequence;
	    are.authId = pAuth->id;
	    WriteEventsToClient(client, 1, (xEvent *)&are);
	}
	FreeResource(pEventClient->resource, RT_NONE);
    }

    /* kill all clients using this auth */

    for (i = 1; i<currentMaxClients; i++)
	if (clients[i]) {
	    SecurityStateRec *state;
	    state = dixLookupPrivate(&clients[i]->devPrivates, stateKey);
	    if (state->haveState && state->authId == pAuth->id)
		CloseDownClient(clients[i]);
	}

    SecurityAudit("revoked authorization ID %d\n", pAuth->id);
    xfree(pAuth);
    return Success;

} /* SecurityDeleteAuthorization */
Example #4
0
void 
FreeAuditTimer(void)
{
    if (auditTimer != NULL) {
	/* Force output of pending messages */
	TimerForce(auditTimer);
	TimerFree(auditTimer);
	auditTimer = NULL;
    }
}
Example #5
0
static CARD32
reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg)
{
    if (connect_to_bus()) {
        TimerFree(bus_info.timer);
        bus_info.timer = NULL;
        return 0;
    }
    else {
        return RECONNECT_DELAY;
    }
}
Example #6
0
static int device_off(LocalDevicePtr local)
{
	struct MTouch *mt = local->private;
	xf86RemoveEnabledDevice(local);
	if (mtouch_close(mt))
		xf86Msg(X_WARNING, "mtrack: cannot ungrab device\n");
	xf86CloseSerial(local->fd);
	if(mt->timer != NULL)
		TimerFree(mt->timer);	// release any existing timer
	mt->timer = NULL;
	mt->is_timer_installed = 0;
	return Success;
}
Example #7
0
static Bool
NestedCloseScreen(int scrnIndex, ScreenPtr pScreen) {
    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];

    xf86DrvMsg(scrnIndex, X_INFO, "NestedCloseScreen\n");

    shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen));

    TimerFree(PNESTED(pScrn)->timer);
    NestedClientCloseScreen(PCLIENTDATA(pScrn));

    pScreen->CloseScreen = PNESTED(pScrn)->CloseScreen;
    return (*pScreen->CloseScreen)(scrnIndex, pScreen);
}
Example #8
0
static int device_on(LocalDevicePtr local)
{
	struct MTouch *mt = local->private;
	local->fd = xf86OpenSerial(local->options);
	if (local->fd < 0) {
		xf86Msg(X_ERROR, "mtrack: cannot open device\n");
		return !Success;
	}
	if (mtouch_open(mt, local->fd)) {
		xf86Msg(X_ERROR, "mtrack: cannot grab device\n");
		return !Success;
	}
	xf86AddEnabledDevice(local);
	if(mt->timer != NULL)
		TimerFree(mt->timer);	// release any existing timer
	mt->timer = NULL;
	mt->is_timer_installed = 0;
	return Success;
}
Example #9
0
/**
 * This is a filter, which only handles the disconnected signal, which
 * doesn't go to the normal message handling function.  This takes
 * precedence over the message handling function, so have have to be
 * careful to ignore anything we don't want to deal with here.
 */
static DBusHandlerResult
message_filter(DBusConnection * connection, DBusMessage * message, void *data)
{
    /* If we get disconnected, then take everything down, and attempt to
     * reconnect immediately (assuming it's just a restart).  The
     * connection isn't valid at this point, so throw it out immediately. */
    if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
        DebugF("[dbus-core] disconnected from bus\n");
        bus_info.connection = NULL;
        teardown();

        if (bus_info.timer)
            TimerFree(bus_info.timer);
        bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);

        return DBUS_HANDLER_RESULT_HANDLED;
    }

    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
Example #10
0
	/*
	 * Be very careful about what does and doesn't get freed by this 
	 * function.  To reduce fragmentation, XkbInitDevice allocates a 
	 * single huge block per device and divides it up into most of the 
	 * fixed-size structures for the device.   Don't free anything that
	 * is part of this larger block.
	 */
void
XkbFreeInfo(XkbSrvInfoPtr xkbi)
{
    if (xkbi->radioGroups) {
	_XkbFree(xkbi->radioGroups);
	xkbi->radioGroups= NULL;
    }
    if (xkbi->mouseKeyTimer) {
	TimerFree(xkbi->mouseKeyTimer);
	xkbi->mouseKeyTimer= NULL;
    }
    if (xkbi->slowKeysTimer) {
	TimerFree(xkbi->slowKeysTimer);
	xkbi->slowKeysTimer= NULL;
    }
    if (xkbi->bounceKeysTimer) {
	TimerFree(xkbi->bounceKeysTimer);
	xkbi->bounceKeysTimer= NULL;
    }
    if (xkbi->repeatKeyTimer) {
	TimerFree(xkbi->repeatKeyTimer);
	xkbi->repeatKeyTimer= NULL;
    }
    if (xkbi->krgTimer) {
	TimerFree(xkbi->krgTimer);
	xkbi->krgTimer= NULL;
    }
    xkbi->beepType= _BEEP_NONE;
    if (xkbi->beepTimer) {
	TimerFree(xkbi->beepTimer);
	xkbi->beepTimer= NULL;
    }
    if (xkbi->desc) {
	XkbFreeKeyboard(xkbi->desc,XkbAllComponentsMask,True);
	xkbi->desc= NULL;
    }
    _XkbFree(xkbi);
    return;
}
Example #11
0
static int
SecurityDeleteAuthorization(void *value, XID id)
{
    SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
    unsigned short name_len, data_len;
    const char *name;
    char *data;
    int status;
    int i;
    OtherClientsPtr pEventClient;

    /* Remove the auth using the os layer auth manager */

    status = AuthorizationFromID(pAuth->id, &name_len, &name, &data_len, &data);
    assert(status);
    status = RemoveAuthorization(name_len, name, data_len, data);
    assert(status);
    (void) status;

    /* free the auth timer if there is one */

    if (pAuth->timer)
        TimerFree(pAuth->timer);

    /* send revoke events */

    while ((pEventClient = pAuth->eventClients)) {
        /* send revocation event event */
        xSecurityAuthorizationRevokedEvent are = {
            .type = SecurityEventBase + XSecurityAuthorizationRevoked,
            .authId = pAuth->id
        };
        WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
        FreeResource(pEventClient->resource, RT_NONE);
    }

    /* kill all clients using this auth */

    for (i = 1; i < currentMaxClients; i++)
        if (clients[i]) {
            SecurityStateRec *state;

            state = dixLookupPrivate(&clients[i]->devPrivates, stateKey);
            if (state->haveState && state->authId == pAuth->id)
                CloseDownClient(clients[i]);
        }

    SecurityAudit("revoked authorization ID %lu\n", (unsigned long)pAuth->id);
    free(pAuth);
    return Success;

}                               /* SecurityDeleteAuthorization */

/* resource delete function for RTEventClient */
static int
SecurityDeleteAuthorizationEventClient(void *value, XID id)
{
    OtherClientsPtr pEventClient, prev = NULL;
    SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;

    for (pEventClient = pAuth->eventClients;
         pEventClient; pEventClient = pEventClient->next) {
        if (pEventClient->resource == id) {
            if (prev)
                prev->next = pEventClient->next;
            else
                pAuth->eventClients = pEventClient->next;
            free(pEventClient);
            return Success;
        }
        prev = pEventClient;
    }
     /*NOTREACHED*/ return -1;  /* make compiler happy */
}                               /* SecurityDeleteAuthorizationEventClient */
Example #12
0
_X_HIDDEN void
sunPostKbdEvent(int sun_ktype, Firm_event *event)
{
    Bool        down;
    KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key;
    Bool        updateLeds = FALSE;
    xEvent      kevent;
    KeySym      *keysym;
    int         keycode;
    static int  lockkeys = 0;

    /* Give down a value */
    if (event->value == VKEY_DOWN)
	down = TRUE;
    else
	down = FALSE;


#if defined(KB_USB)
    if(sun_ktype == KB_USB)
	keycode = usbmap[event->id];
    else
#endif
	keycode = map[event->id];

    /*
     * and now get some special keysequences
     */
    
#ifdef XKB
    if (((xf86Info.ddxSpecialKeys == SKWhenNeeded) &&
	 (!xf86Info.ActionKeyBindingsSet)) ||
	noXkbExtension || (xf86Info.ddxSpecialKeys == SKAlways))
#endif
    {
	if (!(ModifierDown(ShiftMask)) &&
	    ((ModifierDown(ControlMask | AltMask)) ||
	     (ModifierDown(ControlMask | AltLangMask))))
	{
	    switch (keycode) {
	    /*
	     * The idea here is to pass the scancode down to a list of 
	     * registered routines.  There should be some standard conventions
	     * for processing certain keys.
	     */
	    case KEY_BackSpace:
		xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
		break;
		
	    /*
	     * Check grabs
	     */
	    case KEY_KP_Divide:
		xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
		break;
	    case KEY_KP_Multiply:
		xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
		break;
		
	    /*
	     * Video mode switches
	     */
	    case KEY_KP_Minus:   /* Keypad - */
		if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
		if (!xf86Info.dontZoom) return;
		break;
		
	    case KEY_KP_Plus:   /* Keypad + */
		if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
		if (!xf86Info.dontZoom) return;
		break;
	    }
	}
    }

    /*
     * Now map the scancodes to real X-keycodes ...
     */
    if (keycode == KEY_NOTUSED) {
	xf86MsgVerb(X_INFO, 0,
	    "raw code %d mapped to KEY_NOTUSED -- please report\n", event->id);
	return;
    }
    if (keycode == KEY_UNKNOWN) {
	xf86MsgVerb(X_INFO, 0,
	    "raw code %d mapped to KEY_UNKNOWN -- please report\n", event->id);
	return;
    }
    keycode += MIN_KEYCODE;
    keysym = keyc->curKeySyms.map +
	     (keyc->curKeySyms.mapWidth *
	      (keycode - keyc->curKeySyms.minKeyCode));

#ifdef XKB
    if (noXkbExtension)
#endif
    {
	/*
	 * Toggle lock keys.
	 */
#define CAPSFLAG 0x01
#define NUMFLAG 0x02
#define SCROLLFLAG 0x04
#define MODEFLAG 0x08

	if (down) {
	    /*
	     * Handle the KeyPresses of the lock keys.
	     */

	    switch (keysym[0]) {

	    case XK_Caps_Lock:
		if (lockkeys & CAPSFLAG) {
		    lockkeys &= ~CAPSFLAG;
		    return;
		}
		lockkeys |= CAPSFLAG;
		updateLeds = TRUE;
		xf86Info.capsLock = down;
		break;

	    case XK_Num_Lock:
		if (lockkeys & NUMFLAG) {
		    lockkeys &= ~NUMFLAG;
		    return;
		}
		lockkeys |= NUMFLAG;
		updateLeds = TRUE;
		xf86Info.numLock = down;
		break;

	    case XK_Scroll_Lock:
		if (lockkeys & SCROLLFLAG) {
		    lockkeys &= ~SCROLLFLAG;
		    return;
		}
		lockkeys |= SCROLLFLAG;
		updateLeds = TRUE;
		xf86Info.scrollLock = down;
		break;
	    }
	} else {
	    /*
	     * Handle the releases of the lock keys.
	     */

	    switch (keysym[0]) {

	    case XK_Caps_Lock:
		if (lockkeys & CAPSFLAG)
		    return;
		updateLeds = TRUE;
		xf86Info.capsLock = down;
		break;

	    case XK_Num_Lock:
		if (lockkeys & NUMFLAG)
		    return;
		updateLeds = TRUE;
		xf86Info.numLock = down;
		break;

	    case XK_Scroll_Lock:
		if (lockkeys & SCROLLFLAG)
		    return;
		updateLeds = TRUE;
		xf86Info.scrollLock = down;
		break;
	    }
	}

  	if (updateLeds)
	    xf86KbdLeds();

	/*
	 * If this keycode is not a modifier key, and its down initiate the
	 * autorepeate sequence.  (Only necessary if not using XKB).
	 *
	 * If its not down, then reset the timer.
	 */
	if (!keyc->modifierMap[keycode]) {
	    if (down) {
		startautorepeat(keycode);
	    } else {
		TimerFree(sunTimer);
		sunTimer = NULL;
	    }
  	}
    }

    xf86Info.lastEventTime =
	kevent.u.keyButtonPointer.time =
	    GetTimeInMillis();

    /*
     * And now send these prefixes ...
     * NOTE: There cannot be multiple Mode_Switch keys !!!!
     */

    ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
}