Improve python wrapping of WindowingData

* If we make WindowingData an empty struct not an opaque one, it won't leak memory
* Similarly we need typemaps to allow python to pass plain ints and have them cast to pointers
This commit is contained in:
baldurk
2018-05-15 19:44:17 +01:00
parent f0d5bc8f2e
commit afb7ea5dab
2 changed files with 17 additions and 1 deletions
+13
View File
@@ -63,6 +63,19 @@
%include "pyconversion.i"
// typemaps for windowing data
%typemap(in) HWND (unsigned long long tmp, int err = 0) {
// convert windowing data pointers from just plain integers
err = SWIG_AsVal_unsigned_SS_long_SS_long($input, &tmp);
if (!SWIG_IsOK(err)) {
%argument_fail(err, "$*ltype", $symname, $argnum);
}
$1 = ($1_type)tmp;
}
%typemap(in) Display* = HWND;
%typemap(in) xcb_connection_t* = HWND;
// completely ignore rdcdatetime, we custom convert to/from a native python datetime
%ignore rdcdatetime;
+4 -1
View File
@@ -357,7 +357,10 @@ struct ANativeWindow;
// for swig bindings treat the windowing data struct as completely opaque
#if defined(SWIG)
struct WindowingData;
DOCUMENT("An opaque structure created to hold windowing setup data");
struct WindowingData
{
};
#else