flacjacket / pywlroots

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

Output.commit(): Return boolean? #135

Closed heuer closed 8 months ago

heuer commented 9 months ago

Is there a reason why the Output.commit() method is implemented this way:

    def commit(self) -> None:
        """Commit the pending output state

        If `.attach_render` has been called, the pending frame will be
        submitted for display.
        """
        if not lib.wlr_output_test(self._ptr):
            self.rollback()
            raise RuntimeError("Rendering on output failed")
        if not lib.wlr_output_commit(self._ptr):
            raise RuntimeError("Unable to commit output")

Shouldn't the following be sufficient:

    def commit(self) -> bool:
        """Commit the pending output state

        If `.attach_render` has been called, the pending frame will be
        submitted for display.
        """
        return lib.wlr_output_commit(self._ptr)

See the wlroot docs for the commit function:

/**
 * Commit the pending output state. If wlr_output_attach_render() has been
 * called, the pending frame will be submitted for display and a `frame` event
 * will be scheduled.
 *
 * On failure, the pending changes are rolled back.
 */
bool wlr_output_commit(struct wlr_output *output);