Exemplo n.º 1
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);
    }
}
Exemplo n.º 2
0
static void vgaswitch_entity_init(pointer data, OSTimePtr timeout, pointer readmask)
{
	(void)timeout;(void)readmask;(void)data;

	int i;

	for (i = 0; i < screenInfo.numScreens; i++) {
		ScreenPtr pScreen = screenInfo.screens[i];
		ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
		if (strcmp("radeon", scrn->driverName) == 0) {
			vgaswitch_fake_dev.savedEnterVT = scrn->EnterVT;
			scrn->EnterVT = vgaswitch_enter_vt;

			vgaswitch_fake_dev.savedCloseScreen = scrn->pScreen->CloseScreen;
			scrn->pScreen->CloseScreen = vgaswitch_close_screen;
		}
	}

	for (i = 0; i < screenInfo.numGPUScreens; i++) {
		ScreenPtr pScreen = screenInfo.gpuscreens[i];
		ScrnInfoPtr scrn = xf86ScreenToScrn(pScreen);
		if (strcmp("radeon", scrn->driverName) == 0) {
			vgaswitch_fake_dev.savedEnterVT = scrn->EnterVT;
			scrn->EnterVT = vgaswitch_enter_vt;

			vgaswitch_fake_dev.savedCloseScreen = scrn->pScreen->CloseScreen;
			scrn->pScreen->CloseScreen = vgaswitch_close_screen;
		}
	}

	RemoveBlockAndWakeupHandlers(vgaswitch_entity_init, NULL, NULL);

}
Exemplo n.º 3
0
void
LinuxApmClose(void)
{
    if (LinuxApmFd >= 0)
    {
	RemoveBlockAndWakeupHandlers (LinuxApmBlock, LinuxApmWakeup, 0);
	RemoveEnabledDevice (LinuxApmFd);
	close (LinuxApmFd);
	LinuxApmFd = -1;
    }
}
Exemplo n.º 4
0
void
ephyrUnsetInternalDamage(ScreenPtr pScreen)
{
    KdScreenPriv(pScreen);
    KdScreenInfo *screen = pScreenPriv->screen;
    EphyrScrPriv *scrpriv = screen->driver;

    DamageDestroy(scrpriv->pDamage);

    RemoveBlockAndWakeupHandlers(ephyrInternalDamageBlockHandler,
                                 ephyrInternalDamageWakeupHandler,
                                 (void *) pScreen);
}
Exemplo n.º 5
0
static void
LinuxDisable(void)
{
    ioctl(LinuxConsoleFd, KDSETMODE, KD_TEXT);  /* Back to text mode ... */
    if (kdSwitchPending) {
        kdSwitchPending = FALSE;
        ioctl(LinuxConsoleFd, VT_RELDISP, 1);
    }
    enabled = FALSE;
    if (LinuxApmFd >= 0) {
        RemoveBlockAndWakeupHandlers(LinuxApmBlock, LinuxApmWakeup, 0);
        RemoveEnabledDevice(LinuxApmFd);
        close(LinuxApmFd);
        LinuxApmFd = -1;
    }
}
Exemplo n.º 6
0
static void dtlogin_close_pipe(struct dmdata *dmd)
{
    RemoveBlockAndWakeupHandlers (DtloginBlockHandler,
				  DtloginWakeupHandler, dmd);

    close(dmd->pipeFD);
    remove(dmd->pipename);
    free(dmd->pipename);
    free(dmd->buf);
    free(dmd->user.homedir);
    free(dmd);

    if (dmHandlerData == dmd) {
	dmHandlerData = NULL;
    }
}
Exemplo n.º 7
0
void
shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap)
{
    shadowBuf(pScreen);

    if (pBuf->pPixmap) {
	DamageUnregister(&pBuf->pPixmap->drawable, pBuf->pDamage);
	pBuf->update = 0;
	pBuf->window = 0;
	pBuf->randr = 0;
	pBuf->closure = 0;
	pBuf->pPixmap = 0;
    }

    RemoveBlockAndWakeupHandlers(shadowBlockHandler, shadowWakeupHandler,
				 (pointer) pScreen);
}
Exemplo n.º 8
0
static void
SertafiedWakeupHandler(void *data, int i)
{
    SertafiedPtr pReq, pNext;
    TimeStamp now;

    now.milliseconds = GetTimeInMillis();
    now.months = currentTime.months;
    if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
        now.months++;
    for (pReq = pPending; pReq; pReq = pNext) {
        pNext = pReq->next;
        if (CompareTimeStamps(pReq->revive, now) == LATER)
            break;
        FreeResource(pReq->id, RT_NONE);
    }
    if (!pPending) {
        RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
                                     SertafiedWakeupHandler, (void *) 0);
        BlockHandlerRegistered = FALSE;
    }
}
Exemplo n.º 9
0
Bool
xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
{
    ScrnInfoPtr		pScrn = crtc->scrn;
    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
    ScreenPtr		pScreen = pScrn->pScreen;
    
    if (rotation == RR_Rotate_0)
    {
	/* Free memory from rotation */
	if (crtc->rotatedPixmap || crtc->rotatedData)
	{
	    crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData);
	    crtc->rotatedPixmap = NULL;
	    crtc->rotatedData = NULL;
	}

	if (xf86_config->rotation_damage)
	{
	    /* Free damage structure */
	    DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
			      xf86_config->rotation_damage);
	    xf86_config->rotation_damage_registered = FALSE;
	    DamageDestroy (xf86_config->rotation_damage);
	    xf86_config->rotation_damage = NULL;
	    /* Free block/wakeup handler */
	    RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler,
					  xf86RotateWakeupHandler,
					  (pointer) pScreen);
	}
    }
    else
    {
	/* 
	 * these are the size of the shadow pixmap, which
	 * matches the mode, not the pre-rotated copy in the
	 * frame buffer
	 */
	int	    width = mode->HDisplay;
	int	    height = mode->VDisplay;
	void	    *shadowData = crtc->rotatedData;
	PixmapPtr   shadow = crtc->rotatedPixmap;
	int	    old_width = shadow ? shadow->drawable.width : 0;
	int	    old_height = shadow ? shadow->drawable.height : 0;
	
	/* Allocate memory for rotation */
	if (old_width != width || old_height != height)
	{
	    if (shadow || shadowData)
	    {
		crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
		crtc->rotatedPixmap = NULL;
		crtc->rotatedData = NULL;
	    }
	    shadowData = crtc->funcs->shadow_allocate (crtc, width, height);
	    if (!shadowData)
		goto bail1;
	    crtc->rotatedData = shadowData;
	    /* shadow will be damaged in xf86RotatePrepare */
	}
	else
	{
	    /* mark shadowed area as damaged so it will be repainted */
	    xf86CrtcDamageShadow (crtc);
	}
	
	if (!xf86_config->rotation_damage)
	{
	    /* Create damage structure */
	    xf86_config->rotation_damage = DamageCreate (NULL, NULL,
						DamageReportNone,
						TRUE, pScreen, pScreen);
	    if (!xf86_config->rotation_damage)
		goto bail2;
	    
	    /* Assign block/wakeup handler */
	    if (!RegisterBlockAndWakeupHandlers (xf86RotateBlockHandler,
						 xf86RotateWakeupHandler,
						 (pointer) pScreen))
	    {
		goto bail3;
	    }
	}
	if (0)
	{
bail3:
	    DamageDestroy (xf86_config->rotation_damage);
	    xf86_config->rotation_damage = NULL;
	    
bail2:
	    if (shadow || shadowData)
	    {
		crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
		crtc->rotatedPixmap = NULL;
		crtc->rotatedData = NULL;
	    }
bail1:
	    if (old_width && old_height)
		crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
								  NULL,
								  old_width,
								  old_height);
	    return FALSE;
	}
    }
    
    /* All done */
    return TRUE;
}