def __init__(self, function): self._handle = ffi.new_handle(self) # we need a way to get this Python object from the `struct # wl_listener*`, so we put the pointer in a container struct that # contains both the wl_listener and a pointer to our ffi handle self.container = ffi.new("struct wl_listener_container *") self.container.handle = self._handle self._ptr = ffi.addressof(self.container.destroy_listener) self._ptr.notify = lib.notify_func self._notify = function self._signal = None
def remove(self): """Remove the listener""" if self._ptr.link != ffi.NULL: lib.wl_list_remove(ffi.addressof(self._ptr.link)) self.link = None
def remove(self): """Remove the listener""" if self.link: lib.wl_list_remove(ffi.addressof(self._ptr.link)) self.link = None