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

wl: Make setting surface sizes more robust #638

Merged
merged 2 commits into from
Oct 31, 2023
Merged

wl: Make setting surface sizes more robust #638

merged 2 commits into from
Oct 31, 2023

Conversation

aperezdc
Copy link
Member

This PR includes two commits which improve robustness when handling setting Wayland surface sizes:

  • First, only read the COG_PLATFORM_WL_VIEW_{WIDTH,HEIGHT} environment variables only once during instantiation of the CogWlPlatform instance. There is no need to read those every time the surface is resized. This also brings in a helper function to do more thorough validation of the values from the environment variables.
  • Second, use g_return_if_fail() to check that the width and height passed to cog_wl_platform_configure_geometry() are non-zero.

@aperezdc aperezdc added the enhancement New feature or request label Oct 31, 2023
@aperezdc aperezdc requested a review from psaavedra October 31, 2023 13:26
@aperezdc aperezdc self-assigned this Oct 31, 2023
Move the code that determines the initial Wayland surface size
to cog_wl_platform_init(), to ensure it is done only once during
instantiation of CogWlPlatform. There is no need to read and
validate environment variables every time the surface geometry
is configured.

While at it, factor out reading and validating values from environment
variables into a getenv_uint32() utility function.
Add safeguards to ensure a zero size is never used to configure the
Wayland surface geometry.
Copy link
Member

@psaavedra psaavedra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@aperezdc aperezdc merged commit 1680072 into master Oct 31, 2023
5 checks passed
@aperezdc aperezdc deleted the aperezdc/fixes branch October 31, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants