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

Stn/unfork glutin #19120

Closed
wants to merge 9 commits into from
Closed

Conversation

@stuartnelson3
Copy link
Contributor

stuartnelson3 commented Nov 5, 2017

continuation of work started in #17311

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes do not require tests because it should be a pure refactoring.

Build is currently working on Linux and mac, need to check other platforms.

Note:

PR is currently blocked by rust-windowing/winit#349


This change is Reviewable

@highfive
Copy link

highfive commented Nov 5, 2017

Heads up! This PR modifies the following files:

  • @paulrouget: ports/glutin/lib.rs, ports/glutin/window.rs, ports/glutin/Cargo.toml, ports/servo/main.rs
@highfive
Copy link

highfive commented Nov 5, 2017

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
},
} => {
// TODO: position is necessary according to @paulrouget, but pos is not given in
// the event's struct.

This comment has been minimized.

@paulrouget

paulrouget Nov 6, 2017

Contributor

Yes. The PR that brings these coordinates to the wheel and click events didn't make it to upstream iirc.

}
}

fn create_event_loop_waker(&self) -> Box<EventLoopWaker> {
struct GlutinEventLoopWaker {
window_proxy: Option<glutin::WindowProxy>,
events_loop: Option<Arc<Mutex<glutin::EventsLoop>>>,

This comment has been minimized.

@paulrouget

paulrouget Nov 6, 2017

Contributor

I don't think you need to use EventsLoop. Things will be probably easier with:

    proxy: Arc<glutin::EventsLoopProxy>,
if let Some(ref window_proxy) = self.window_proxy {
window_proxy.wakeup_event_loop()
if let Some(ref events_loop) = self.events_loop {
events_loop.lock().unwrap().create_proxy().wakeup();

This comment has been minimized.

@paulrouget

paulrouget Nov 6, 2017

Contributor

This will be easier if you use EventsLoopProxy. No need to create a proxy everytime.

@paulrouget
Copy link
Contributor

paulrouget commented Nov 6, 2017

An important change in upstream glutin is the way keys are handled.

If you look at servo glutin, there are 2 code paths, one for Mac+Linux, and one for Windows. Now, with upstream glutin, only the Windows code path is needed. For example, get rid of the pending_key_event_char logic.

@paulrouget
Copy link
Contributor

paulrouget commented Nov 6, 2017

@paulrouget
Copy link
Contributor

paulrouget commented Nov 6, 2017

About coordinates, please look at:

servo/glutin#99
servo/glutin#109

@bors-servo
Copy link
Contributor

bors-servo commented Nov 7, 2017

The latest upstream changes (presumably #19135) made this pull request unmergeable. Please resolve the merge conflicts.

@stuartnelson3 stuartnelson3 force-pushed the stuartnelson3:stn/unfork-glutin branch from 53f3af4 to c10d77c Nov 7, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Nov 9, 2017

The latest upstream changes (presumably #18821) made this pull request unmergeable. Please resolve the merge conflicts.

@stuartnelson3 stuartnelson3 force-pushed the stuartnelson3:stn/unfork-glutin branch from c10d77c to 9ce14f4 Nov 11, 2017

#[cfg(target_os = "windows")]
fn handle_keyboard_input(&self, element_state: ElementState, _scan_code: u8, virtual_key_code: VirtualKeyCode) {
fn set_key(&self, element_state: ElementState, virtual_key_code: VirtualKeyCode) {

This comment has been minimized.

@stuartnelson3

stuartnelson3 Nov 11, 2017

Author Contributor

I had no idea what to name this; any suggestion is welcome.

@stuartnelson3
Copy link
Contributor Author

stuartnelson3 commented Nov 11, 2017

@paulrouget i looked at the two links you provided for getting mouse position, but I feel a bit stuck -- I'm not seeing a way in the glutin library to get anything other than the bounds of the window (inner or outer), and I couldn't see anything in the servo::gl library that would help, either.

any ideas?

@paulrouget
Copy link
Contributor

paulrouget commented Nov 12, 2017

The glutin library does not provide the mouse coordinates on click and wheel events.

So we need to fix the glutin library to do so. Now, glutin is split in 2: glutin for the opengl stuff, and winit for the windowing and events. So what you actually need to fix is winit.

The 2 links show how we did it for the servoglutin.

So someone need to adapt these 2 PRs to the winit library.

@bors-servo
Copy link
Contributor

bors-servo commented Nov 13, 2017

The latest upstream changes (presumably #19201) made this pull request unmergeable. Please resolve the merge conflicts.

@stuartnelson3 stuartnelson3 force-pushed the stuartnelson3:stn/unfork-glutin branch from 49b420b to 7442d4e Nov 14, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Nov 14, 2017

The latest upstream changes (presumably #19152) made this pull request unmergeable. Please resolve the merge conflicts.

@bors-servo
Copy link
Contributor

bors-servo commented Nov 16, 2017

The latest upstream changes (presumably #19229) made this pull request unmergeable. Please resolve the merge conflicts.

@stuartnelson3 stuartnelson3 force-pushed the stuartnelson3:stn/unfork-glutin branch 2 times, most recently from b369eda to d82ad5a Dec 4, 2017
@jdm jdm removed the S-needs-rebase label Dec 5, 2017
@stuartnelson3
Copy link
Contributor Author

stuartnelson3 commented Dec 5, 2017

  • Get the icon loading patches either upstreamed or rebased on a new glutin fork.
  • Get the platform_window() code working [or drop CEF for now?].

@jdm successfully got glutin bumped. The last steps are the above two, I believe. I'm not sure what how folks feel about completing the above two

@stuartnelson3
Copy link
Contributor Author

stuartnelson3 commented Dec 6, 2017

Hm, the build is failing on ./mach test-tidy --no-progress --all, not sure what to do about the duplicate packages it's complaining about.

@Eijebong
Copy link
Member

Eijebong commented Dec 6, 2017

@stuartnelson3 This patch needs to be upstreamed I think servo/glutin@0851887. I would do it myself but don't have any osx to test it. Let's ping @nox about it :)

@bors-servo
Copy link
Contributor

bors-servo commented Dec 7, 2017

The latest upstream changes (presumably #19414) made this pull request unmergeable. Please resolve the merge conflicts.

@stuartnelson3 stuartnelson3 force-pushed the stuartnelson3:stn/unfork-glutin branch from dd07964 to 601663b Dec 7, 2017
@bors-servo
Copy link
Contributor

bors-servo commented Dec 8, 2017

The latest upstream changes (presumably #19510) made this pull request unmergeable. Please resolve the merge conflicts.

@paulrouget
Copy link
Contributor

paulrouget commented Jan 16, 2018

@stuartnelson3 can you describe what's left to be done here? Do you need an early review?

@paulrouget
Copy link
Contributor

paulrouget commented Jan 16, 2018

Also, I'd be happy to take over if you don't have time to continue.

@stuartnelson3
Copy link
Contributor Author

stuartnelson3 commented Jan 16, 2018

@paulrouget yeah feel free to take over. the patch in this comment needs to be upstreamed: #19120 (comment)

Good luck!

@jdm
Copy link
Member

jdm commented Jan 16, 2018

@paulrouget I suspect we're still missing fixes for the work items listed in the original comment in #17311.

@paulrouget paulrouget mentioned this pull request Jan 29, 2018
@paulrouget
Copy link
Contributor

paulrouget commented Jan 29, 2018

Taking over this PR. See #19895

@stuartnelson3 thanks a lot for your initial PR. That made my life a lot easier :)

@paulrouget paulrouget closed this Jan 29, 2018
bors-servo added a commit that referenced this pull request Mar 9, 2018
unfork glutin

I'm taking over #19120.

Fix #18918.

Beside the change in the API, I had to rewrite main loop.

At this point, we should have a very similar behavior as servo-glutin.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19895)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.