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

feat(window): expose a few more window-options #968

Merged
merged 15 commits into from
Jul 26, 2020
Merged

Conversation

lessp
Copy link
Member

@lessp lessp commented Jul 24, 2020

This adds a transparency-option to Window.

EDIT: I guess though, that this puts a transparency on everything, not only the "background-window" as you'd expect. 🤔

Would close #506

@lessp lessp added the WIP label Jul 24, 2020
@lessp lessp marked this pull request as draft July 24, 2020 12:14
@lessp lessp removed the WIP label Jul 24, 2020
@github-actions
Copy link

I have updated your lock dirs and formatted the code.
Please @lessp pull the last commit before pushing any more changes.

@lessp lessp changed the title feat(window): add transparency-option feat(window): expose a few more window-options Jul 24, 2020
@lessp lessp marked this pull request as ready for review July 25, 2020 15:18
@lessp
Copy link
Member Author

lessp commented Jul 25, 2020

I'm not sure what to do about the transparency-flag. I think it makes sense to expose it for full opacity, but perhaps we should name it something else as to reserve it for pure background-transparency?

Copy link
Member

@glennsl glennsl left a comment

Choose a reason for hiding this comment

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

Apart from the minor issues noted below, this looks good to me!

@@ -72,10 +84,13 @@ let create =
~maximized=false,
~decorated=true,
~titlebarStyle=WindowStyles.System,
~transparency=1.0,
Copy link
Member

Choose a reason for hiding this comment

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

This sets the opacity, not transparency, which is its inverse. Fully transparent means it's see-through, while fully opaque means it's solid.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, that's true! Switch our naming to opacity and leave a comment perhaps?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that sounds good!

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated, let me know if you think we're good to go!

src/Core/WindowCreateOptions.re Outdated Show resolved Hide resolved
src/Core/WindowCreateOptions.re Outdated Show resolved Hide resolved
src/Core/WindowCreateOptions.re Outdated Show resolved Hide resolved
src/Core/Window.re Outdated Show resolved Hide resolved
src/Core/Window.re Outdated Show resolved Hide resolved
src/Core/Window.re Outdated Show resolved Hide resolved
@glennsl
Copy link
Member

glennsl commented Jul 25, 2020

I'm not sure what to do about the transparency-flag. I think it makes sense to expose it for full opacity, but perhaps we should name it something else as to reserve it for pure background-transparency?

Since it's associated with the window, I don't think it''s a problem. Background transparency would instead be associated with painting I think.

@lessp
Copy link
Member Author

lessp commented Jul 25, 2020

I'm not sure what to do about the transparency-flag. I think it makes sense to expose it for full opacity, but perhaps we should name it something else as to reserve it for pure background-transparency?

Since it's associated with the window, I don't think it''s a problem. Background transparency would instead be associated with painting I think.

Thanks for reviewing and the suggested changes @glennsl!

Comment on lines +701 to +703
// Sdl2 has this named as Transparency, but it actually works as opacity
// where a value of 1.0 means it's fully opaque
Sdl2.Window.setTransparency(sdlWindow, options.opacity);
Copy link
Member

Choose a reason for hiding this comment

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

SDL2 actually has it right. It's reason-sdl that gets it wrong. And since reason-sdl is in this repo we could fix it completely in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Must have missed this!

Copy link
Member

@glennsl glennsl left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes @lessp. Looks great!

Comment on lines +27 to +31
/**
[opacity] sets the opacity of the window.
A value of 1.0 means the window is fully opaque,
and a value of 0.0 means the window is completely transparent.
*/
Copy link
Member

Choose a reason for hiding this comment

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

💯

@lessp lessp merged commit 1531d5f into master Jul 26, 2020
@lessp lessp deleted the feat/window/transparency branch July 26, 2020 20:16
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.

Allow windows to be transparent
2 participants