Пример #1
0
static PyObject *PyFFFont_removeGtkWindowToMainEventLoop(PyFF_Font *self, PyObject *args)
{
    PyObject *result = NULL;
    PyObject *temp;
    int v = 0;

    if ( !PyArg_ParseTuple( args, "i", &v ))
        return( NULL );

    gpointer gdkwindow = gdk_xid_table_lookup( v );

    if( gdkwindow )
    {
        Display* d = GDK_WINDOW_XDISPLAY(gdkwindow);
        int fd = XConnectionNumber(d);
        if( fd )
        {
            gpointer udata = 0;
            GDrawRemoveReadFD( 0, fd, udata );
        }
    }
    
    /* Boilerplate to return "None" */
    Py_INCREF(Py_None);
    result = Py_None;
    return result;
}
Пример #2
0
static PyObject *PyFFFont_removeGtkWindowToMainEventLoopByFD(PyFF_Font *self, PyObject *args)
{
    PyObject *result = NULL;
    PyObject *temp;
    int v = 0;

    if ( !PyArg_ParseTuple( args, "i", &v ))
        return( NULL );

    int fd = v;
    gpointer udata = 0;
    GDrawRemoveReadFD( 0, fd, udata );
    
    /* Boilerplate to return "None" */
    Py_INCREF(Py_None);
    result = Py_None;
    return result;
}
Пример #3
0
static void python_ui_fd_callback( int fd, void* udata )
{
#ifndef __MINGW32__
    char data[ 1024*100 + 1 ];
    memset(data, '\0', 1024*100 );
//    sleep( 1 );
    int sz = read( fd, data, 1024*100 );
//    fprintf( stderr, "python_ui_fd_callback() sz:%d d:%s\n", sz, data );

    CharView* cv = CharViewFindActive();
    if( cv )
    {
	int layer = 0;
	PyFF_ScriptString( cv->b.fv, cv->b.sc, layer, data );
    }
    
    GDrawRemoveReadFD( 0, fd, udata );
    python_ui_setup_callback( 0 );
#endif    
}
Пример #4
0
void collabclient_free( void** ccvp )
{
#ifdef BUILD_COLLAB
    
    cloneclient_t* cc = (cloneclient_t*)*ccvp;
    if( !cc )
	return;
    if( cc->magic_number != MAGIC_VALUE )
    {
	fprintf(stderr,"collabclient_free() called on an invalid client object!\n");
	return;
    }
    cc->magic_number = MAGIC_VALUE + 1;

    {
	int fd = 0;
	size_t fdsz = sizeof(fd);
	int rc = zmq_getsockopt( cc->subscriber, ZMQ_FD, &fd, &fdsz );
	GDrawRemoveReadFD( 0, fd, cc );
    }
    
    
    zsocket_destroy( cc->ctx, cc->snapshot   );
    zsocket_destroy( cc->ctx, cc->subscriber );
    zsocket_destroy( cc->ctx, cc->publisher  );
    BackgroundTimer_remove( cc->roundTripTimer );

    FontView* fv = FontViewFind( FontViewFind_byCollabPtr, cc );
    if( fv )
    {
	fv->b.collabClient = 0;
    }

    zhash_destroy (&cc->kvmap);
    free(cc->address);
    free(cc);
    *ccvp = 0;

#endif
}