Exemple #1
0
void
XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
{
    EventListPtr        events;
    int                 nevents, i;
    DeviceIntPtr        ptr;

    /* If dev is a slave device, and the SD is attached, do nothing. If we'd
     * post through the attached master pointer we'd get duplicate events.
     *
     * if dev is a master keyboard, post through the XTEST device
     *
     * if dev is a floating slave, post through the device itself.
     */

    if (IsMaster(dev))
        ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
    else if (!dev->u.master)
        ptr = dev;
    else
        return;

    events = InitEventList(GetMaximumEventsNum());
    OsBlockSignals();
    nevents = GetPointerEvents(events, ptr,
                               press ? ButtonPress : ButtonRelease, button,
                               0 /* flags */, 0 /* first */,
                               0 /* num_val */, NULL);
    OsReleaseSignals();

    for (i = 0; i < nevents; i++)
        mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);

    FreeEventList(events, GetMaximumEventsNum());
}
Exemple #2
0
/**
 * Destroy screen-specific information.
 *
 * @param index Screen index of the screen in screenInfo.screens[]
 * @param pScreen The actual screen pointer
 */
static Bool
miPointerCloseScreen(ScreenPtr pScreen)
{
    SetupScreen(pScreen);

    pScreen->CloseScreen = pScreenPriv->CloseScreen;
    free((pointer) pScreenPriv);
    FreeEventList(mipointermove_events, GetMaximumEventsNum());
    mipointermove_events = NULL;
    return (*pScreen->CloseScreen) (pScreen);
}
Exemple #3
0
/**
 * Destroy screen-specific information.
 *
 * @param index Screen index of the screen in screenInfo.screens[]
 * @param pScreen The actual screen pointer
 */
static Bool
miPointerCloseScreen (int index, ScreenPtr pScreen)
{
    SetupScreen(pScreen);

    pScreen->CloseScreen = pScreenPriv->CloseScreen;
    free((pointer) pScreenPriv);
    FreeEventList(events, GetMaximumEventsNum());
    events = NULL;
    return (*pScreen->CloseScreen) (index, pScreen);
}
Exemple #4
0
static Bool
miPointerCloseScreen (int index, ScreenPtr pScreen)
{
#if 0
    miPointerPtr pPointer;
    DeviceIntPtr pDev;
#endif

    SetupScreen(pScreen);

#if 0
    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
    {
        if (DevHasCursor(pDev))
        {
            pPointer = MIPOINTER(pDev);

            if (pScreen == pPointer->pScreen)
                pPointer->pScreen = 0;
            if (pScreen == pPointer->pSpriteScreen)
                pPointer->pSpriteScreen = 0;
        }
    }

    if (MIPOINTER(inputInfo.pointer)->pScreen == pScreen)
        MIPOINTER(inputInfo.pointer)->pScreen = 0;
    if (MIPOINTER(inputInfo.pointer)->pSpriteScreen == pScreen)
        MIPOINTER(inputInfo.pointer)->pSpriteScreen = 0;
#endif

    pScreen->CloseScreen = pScreenPriv->CloseScreen;
    free((pointer) pScreenPriv);
    FreeEventList(events, GetMaximumEventsNum());
    events = NULL;
    return (*pScreen->CloseScreen) (index, pScreen);
}
Exemple #5
0
int unload_module( const char *modname, Client * u )
{
	Module *mod_ptr;
	hnode_t *modnode;
	int moduleindex;
	int( *ModFini )( void );
	CmdParams *cmdparams;

	SET_SEGV_LOCATION();
	/* Check to see if module is loaded */
	modnode = hash_lookup( modulehash, modname );
	if( !modnode ) {
		if( u ) {
			irc_prefmsg( ns_botptr, u, __( "Module %s not loaded, try /msg %s modlist", u ), modname, ns_botptr->name );
			irc_chanalert( ns_botptr, _( "%s tried to unload %s but its not loaded" ), u->name, modname );
		}
		return NS_FAILURE;
	}
	mod_ptr = hnode_get( modnode );
	irc_chanalert( ns_botptr, _( "Unloading module %s" ), modname );

	MQModuleDelcmd(mod_ptr);
	
	if( mod_ptr->info->flags & MODULE_FLAG_AUTH )
		DelAuthModule( mod_ptr );
	if( mod_ptr->info->flags & MODULE_FLAG_CTCP_VERSION )
		me.versionscan --;
	moduleindex = mod_ptr->modnum;
	/* canx any DNS queries used by this module */
	canx_dns( mod_ptr );
	/* Delete any timers used by this module */
	del_timers( mod_ptr );
	/* Delete any sockets used by this module */
	del_sockets( mod_ptr );
	/* Delete any associated event list */
	FreeEventList( mod_ptr );

#ifdef USE_PERL
	/* unload any extensions first */
	if ((mod_ptr->pm) && (mod_ptr->pm->type == TYPE_EXTENSION)) {
		PerlExtensionFini(mod_ptr);
		unload_perlextension(mod_ptr);
	}
#endif /* USE_PERL */

	/* Remove from the module hash so we dont call events for this module 
	 * during signoff 
	 */
	dlog( DEBUG1, "Deleting Module %s from Hash", modname );
	hash_delete_destroy_node( modulehash, modnode );		

	/* now determine if its perl, or standard module */
	if( IS_STANDARD_MOD( mod_ptr ) ) {
		/* call ModFini( replacement for library __fini() call */
		ModFini = ns_dlsym( ( int * ) mod_ptr->handle, "ModFini" );
		if( ModFini ) {
			SET_RUN_LEVEL( mod_ptr );
			( *ModFini )();
			RESET_RUN_LEVEL();
			SET_SEGV_LOCATION();
		}
#ifdef USE_PERL
	} else {
		SET_RUN_LEVEL( mod_ptr );
		PerlModFini( mod_ptr );
		RESET_RUN_LEVEL();
		SET_SEGV_LOCATION();
#endif /* USE_PERL */
	}
	/* Delete any bots used by this module. Done after ModFini, so the bot 
	 * can still send messages during ModFini 
	 */
	DelModuleBots( mod_ptr );
	/* Close module */
	irc_globops( NULL, _( "%s Module unloaded" ), modname );
	SET_RUN_LEVEL( mod_ptr );
	if( mod_ptr->info->flags & MODULE_FLAG_LOCAL_EXCLUDES ) 
	{
		FiniModExcludes( mod_ptr );
	}
	cmdparams = ns_calloc( sizeof( CmdParams ) );
	cmdparams->param = ( char * )modname;
	SendAllModuleEvent( EVENT_MODULEUNLOAD, cmdparams );
	ns_free( cmdparams );
	RESET_RUN_LEVEL();

	SET_RUN_LEVEL( mod_ptr );
	DBACloseDatabase();
	/* Cleanup moddata */
	CleanupUserModdata();
	CleanupServerModdata();
	CleanupChannelModdata();

	if( IS_STANDARD_MOD( mod_ptr ) )
		ns_dlclose( mod_ptr->handle );
#ifdef USE_PERL
	else
		unload_perlmod( mod_ptr );
#endif /* USE_PERL */
	RESET_RUN_LEVEL();
	ns_free( mod_ptr );
	/* free the module number */
	if( moduleindex >= 0 ) {
		dlog( DEBUG1, "Free %d from Module Numbers", moduleindex );
		ModList[moduleindex] = NULL;
	}
	return NS_SUCCESS;
}
static void
XTestExtensionTearDown(ExtensionEntry * e)
{
    FreeEventList(xtest_evlist, GetMaximumEventsNum());
    xtest_evlist = NULL;
}