Skip to content

Commit 386bf50

Browse files
committed
Fixed the glutin event conversion API for compatibility with glutin_gfx example.
1 parent 98ae59f commit 386bf50

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

examples/glutin_gfx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ mod feature {
301301
let dpi_factor = dpi_factor as conrod::Scalar;
302302

303303
// Convert glutin event to conrod event, requires conrod to be built with the `glutin` feature
304-
if let Some(event) = conrod::backend::glutin::convert(event.clone(), w, h, dpi_factor) {
304+
if let Some(event) = conrod::backend::glutin::convert(event.clone(), &window) {
305305
ui.handle_event(event);
306306
}
307307

examples/glutin_glium.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ mod feature {
8585
// NOTE: This will be removed in a future version of conrod as Render events shouldn't
8686
// be necessary.
8787
let window = display.get_window().unwrap();
88-
ui.handle_event(conrod::backend::glutin::render_event(&window).unwrap());
88+
ui.handle_event(conrod::backend::glutin::render_event(window).unwrap());
8989

9090
// Poll for events.
9191
for event in display.poll_events() {
9292

9393
// Use the `glutin` backend feature to convert the glutin event to a conrod one.
94-
if let Some(event) = conrod::backend::glutin::convert(event.clone(), &window) {
94+
let window = display.get_window().unwrap();
95+
if let Some(event) = conrod::backend::glutin::convert(event.clone(), window) {
9596
ui.handle_event(event);
9697
}
9798

@@ -112,7 +113,7 @@ mod feature {
112113
// `window_resize_callback`. https://github.com/tomaka/winit/pull/88
113114
if let Some(win_rect) = ui.rect_of(ui.window) {
114115
let (win_w, win_h) = (win_rect.w() as u32, win_rect.h() as u32);
115-
let (w, h) = window.get_inner_size_points().unwrap();
116+
let (w, h) = display.get_window().unwrap().get_inner_size_points().unwrap();
116117
if w != win_w || h != win_h {
117118
let event: conrod::event::Raw = conrod::event::Input::Resize(w, h).into();
118119
ui.handle_event(event);

src/backend/glutin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use input;
1010
use std;
1111

1212
/// A function for converting a `glutin::Event` to a `conrod::event::Raw`.
13-
pub fn convert<W>(e: glutin::Event, window: &W) -> Option<event::Raw>
13+
pub fn convert<W>(e: glutin::Event, window: W) -> Option<event::Raw>
1414
where W: std::ops::Deref<Target=glutin::Window>,
1515
{
1616

@@ -102,7 +102,7 @@ pub fn convert<W>(e: glutin::Event, window: &W) -> Option<event::Raw>
102102
///
103103
/// NOTE: This will be removed in a future version of conrod as Render events shouldn't be
104104
/// necessary.
105-
pub fn render_event<W>(window: &W) -> Option<event::Raw>
105+
pub fn render_event<W>(window: W) -> Option<event::Raw>
106106
where W: std::ops::Deref<Target=glutin::Window>,
107107
{
108108
window.get_inner_size_pixels().map(|(win_w, win_h)| {

0 commit comments

Comments
 (0)