Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output.commit(): Return boolean? #135

Closed
heuer opened this issue Feb 27, 2024 · 0 comments · Fixed by #144
Closed

Output.commit(): Return boolean? #135

heuer opened this issue Feb 27, 2024 · 0 comments · Fixed by #144

Comments

@heuer
Copy link
Contributor

heuer commented Feb 27, 2024

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);
flacjacket added a commit that referenced this issue Mar 10, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant