Skip to content

Child window - #96

Merged
tomaka merged 6 commits into
rust-windowing:masterfrom
k-brac:child_window
Dec 2, 2016
Merged

tomaka merged 6 commits into
rust-windowing:masterfrom
k-brac:child_window

Conversation

@k-brac

@k-brac k-brac commented Nov 28, 2016

Copy link
Copy Markdown
Contributor

Here is my attempt to implement #93 for windows.

I am not sure it is the way to go (I changed some members visibility).

I have added an example as a proof of concept.

@tomaka

tomaka commented Nov 28, 2016 •

Copy link
Copy Markdown
Contributor

I don't think WindowProxy should be exposed. It's just an implementation detail.
What about passing directly a HWND to with_parent_window?

@k-brac

k-brac commented Nov 29, 2016

Copy link
Copy Markdown
Contributor Author

I thought it would be more convenient to use WindowProxy because it implements the send and sync traits.
But it seems that I was wrong, and I think it is cleaner now

pub fn new_window(window: &WindowAttributes, pl_attribs: &PlatformSpecificWindowBuilderAttributes) -> Result<Window, CreationError> {
let window = window.clone();

let attribs = pl_attribs.clone();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not pass the attributes by reference to init instead of cloning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Passing by reference causes a lifetime error that I don't know how to fix. Since we are cloning WindowAttributes I did the same.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh right I forgot we were spawning a thread, so nevermind.

@tomaka

tomaka commented Nov 29, 2016 •

Copy link
Copy Markdown
Contributor

I also think that the example is maybe a bit too complicated.
It's nice to have some sort of code to test child windows, but it's really not the kind of code that people should be looking at.

This is just a remark. I'm not sure what to do between removing the example altogether or keeping it.

@k-brac

k-brac commented Nov 29, 2016

Copy link
Copy Markdown
Contributor Author

I agree with you about the example.
I left it because it is my test case and I thought it could be useful when implementing this feature for other platform.
Once there is something correct for windows I may try to do it for mac os too

@tomaka

tomaka commented Dec 2, 2016

Copy link
Copy Markdown
Contributor

Oh sorry, I forgot about this PR. I wanted to wait for travis/appveyor to pass before merging, but apparently Cargo is still broken sigh.

@tomaka
tomaka merged commit 1ee9136 into rust-windowing:master Dec 2, 2016
@k-brac
k-brac deleted the child_window branch December 2, 2016 14:37
jrmuizel pushed a commit to jrmuizel/winit that referenced this pull request Mar 29, 2017
…etajack

cocoa: Activate the `NSApplication` instance after the event loop is set up, and use `orderFrontRegardless` to more reliably pop up the main window.

This makes the menus work right away when the app is started.

See e.g. http://czak.pl/2015/09/23/single-file-cocoa-app-with-swift.html

r? @metajack

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/glutin/96)
<!-- Reviewable:end -->
@t-sin t-sin mentioned this pull request Dec 15, 2021
8 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants