You need to define delegate that matches the signature of the callback, and pass this down from managed code. The CLR will then do the necessary marshalling.
Something like this: http://blogs.msdn.com/b/davidnotario/archive/2006/01/13/512436.aspx /Oskar 2011/3/23 Quandary <[email protected]>: > Question: > > I started porting XSendEvent of KeyboardKeys from C to C#. > I have only one minor question: > > Consider the below method ResizeWindow: > How can I set XSetErrorHandler to a managed code (C#) function ? > Delegate ? > > > // gcc -o xwinspy xwinspy.c -L/usr/X11R6/lib -lX11 > > // ERROR HANDLER, GENERIC > static int ErrorHandler (Display *display, XErrorEvent *error) > { > //printf ("\r\n error! \r\n"); > return 0; > } > // END ERROR HANDLER > > > void ResizeWindow(char* szWindow, unsigned int width, unsigned int height) > { > Display *display = XOpenDisplay (NULL); > > XSetErrorHandler(ErrorHandler); > > Window wdThisWindow = FindWindow(szWindow); > > char* win_name; > if (XFetchName(display, wdThisWindow, &win_name)) > { > printf("Moving: %s\n", win_name); > } > > XResizeWindow(display, wdThisWindow, width, height); > > XCloseDisplay (display); > } > > _______________________________________________ > Mono-devel-list mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/mono-devel-list > _______________________________________________ Mono-devel-list mailing list [email protected] http://lists.ximian.com/mailman/listinfo/mono-devel-list
