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

Add SDL_GetWindowBordersSize() #733

Merged
merged 6 commits into from
Dec 12, 2017
Merged

Add SDL_GetWindowBordersSize() #733

merged 6 commits into from
Dec 12, 2017

Conversation

TimDiekmann
Copy link
Contributor

Add SDL_GetWindowBordersSize() as pub fn border_size(&self) -> (i32, i32, i32, i32) to Window

@TimDiekmann
Copy link
Contributor Author

The checks failed btw. because your travis is broken.

The command "pip install 'travis-cargo<0.2' --user &&
  export PATH=$HOME/.local/bin:$PATH &&
  export PATH=~/Library/Python/2.7/bin:$PATH
  " failed and exited with 127 during .

@Cobrand
Copy link
Member

Cobrand commented Nov 30, 2017

According to the documentation, this function can fail, so it should return a Result<(i32, i32, i32, i32)>. Also, this method is only supported with X11 (I assume it sends an error otherwise), so we should specify that in the function's documentation as well.

Why i32s? Can the borders be negative somehow? I think it would be better to have u16 or u32 instead here, if we can confirm that this never goes below 0.

Otherwise LGTM.

@TimDiekmann
Copy link
Contributor Author

According to the documentation, this function can fail, so it should return a Result<(i32, i32, i32, i32)>

It will always return (0, 0, 0, 0) if it fails, so it's well defined behavior imo.

@Cobrand
Copy link
Member

Cobrand commented Nov 30, 2017

And how do you tell the difference between a failure and a borderless window?

@TimDiekmann
Copy link
Contributor Author

TimDiekmann commented Nov 30, 2017

Good point... Fixed, besides this function shouldn't be used for detecting a borderless window ;)

@@ -1167,13 +1167,17 @@ impl Window {
///
/// #Notes
/// If this function fails, (0, 0, 0, 0) will be returned
Copy link
Member

@Cobrand Cobrand Dec 1, 2017

Choose a reason for hiding this comment

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

You forgot to change this part of the documentation.

@TimDiekmann
Copy link
Contributor Author

I removed this part since it's implicit in the return type ;)

@Cobrand Cobrand merged commit b83be89 into Rust-SDL2:master Dec 12, 2017
Cobrand added a commit that referenced this pull request Dec 12, 2017
sypwex pushed a commit to sypwex/rust-sdl2 that referenced this pull request Jun 2, 2024
Add SDL_GetWindowBordersSize()
sypwex pushed a commit to sypwex/rust-sdl2 that referenced this pull request Jun 2, 2024
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 this pull request may close these issues.

2 participants