flacjacket / pywlroots

Python binding to the wlroots library using cffi
University of Illinois/NCSA Open Source License
51 stars 12 forks source link

Change some exceptions to return values #144

Closed flacjacket closed 6 months ago

flacjacket commented 6 months ago

Modify Backend.start and Output.commit to return boolean values rather than checking the return value and raising an error. Move the logic for the Pythonic APIs into the Python-specific functions, in particular the __enter__ and __exit__ so these objects will be well behaved when using the context manager.

Closes #135 Closes #136

flacjacket commented 6 months ago

@heuer Let me know if you think this would address your tickets!

heuer commented 6 months ago

Thanks, looks good to me.

I am not sure if if not self.test(): self.rollback() is necessary (line 163), though. The wlr-docs mention in the description of the wlr_output_commit function:

[…] On failure, the pending changes are rolled back. […]

So wlroots should do the right thing (rollback) without the check?