tags:

views:

52

answers:

0

I'm wrapping a foreign Win32 window with gdk_window_foreign_new. If I do e.g. gdk_window_get_root_origin on the GdkWindow after the foreign window has been destroyed, GDK prints a warning about the invalid handle. So the user is well informed but is there a way for my program to get informed too?

One possibility is to call IsWindow on the handle before or after the operation. It has limitations but could be usable for some cases. I'd like to avoid backend-specific code though. Is there a GDK function to check whether a native handle is valid? gdk_window_foreign_new can be used for that purpose though.

I'm looking for a general solution. The Windows backend was used as an example.

Edit: It seems gdk_window_foreign_new doesn't act as documented on the Windows backend. I haven't got it to return NULL. I haven't tested on X yet.