[Mono-dev] Setting XSetErrorHandler in Cs ?
Quandary
quandary82 at hailmail.net
Wed Mar 23 08:43:37 EDT 2011
Thanks, wow that was fast.
I'll take not throwing Exceptions into consideration.
Wonder what happens, can't wait to try it out.
Stefan
Am 23.03.2011 13:34, schrieb Oskar Berggren:
> 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<quandary82 at hailmail.net>:
>> 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
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
More information about the Mono-devel-list
mailing list