diff options
author | bors-servo <release+servo@mozilla.com> | 2014-02-12 11:58:51 -0500 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-02-12 11:58:51 -0500 |
commit | a0a61fe976c7d4e84cd33b3f121385acc76f3fa2 (patch) | |
tree | 54b0c834742712d99388de1706b8d2bf46aafe78 /src | |
parent | 31e36b7bd75f73170d5036e3583bc6360bd109dd (diff) | |
parent | f89eec140b5bbc051184790a687967311fea1766 (diff) | |
download | servo-a0a61fe976c7d4e84cd33b3f121385acc76f3fa2.tar.gz servo-a0a61fe976c7d4e84cd33b3f121385acc76f3fa2.zip |
auto merge of #1668 : larsbergstrom/servo/windowing_android_fixups, r=metajack
When I was doing my earlier PR for @mut-removal in windowing, I failed to add/commit/fetch/merge/push the changes in my Android-targeting copy of the repo and only just noticed.
r? @metajack
Diffstat (limited to 'src')
-rw-r--r-- | src/components/main/platform/common/glut_windowing.rs | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/components/main/platform/common/glut_windowing.rs b/src/components/main/platform/common/glut_windowing.rs index 51819207de1..ccb0c7411ab 100644 --- a/src/components/main/platform/common/glut_windowing.rs +++ b/src/components/main/platform/common/glut_windowing.rs @@ -96,14 +96,16 @@ impl WindowMethods<Application> for Window { struct ReshapeCallbackState; impl glut::ReshapeCallback for ReshapeCallbackState { fn call(&self, width: c_int, height: c_int) { - local_window().event_queue.with_mut(|queue| queue.push(ResizeWindowEvent(width as uint, height as uint))) + let tmp = local_window(); + tmp.borrow().event_queue.with_mut(|queue| queue.push(ResizeWindowEvent(width as uint, height as uint))) } } glut::reshape_func(glut_window, ~ReshapeCallbackState); struct KeyboardCallbackState; impl glut::KeyboardCallback for KeyboardCallbackState { fn call(&self, key: c_uchar, _x: c_int, _y: c_int) { - local_window().handle_key(key) + let tmp = local_window(); + tmp.borrow().handle_key(key) } } glut::keyboard_func(~KeyboardCallbackState); @@ -111,14 +113,17 @@ impl WindowMethods<Application> for Window { impl glut::MouseCallback for MouseCallbackState { fn call(&self, button: c_int, state: c_int, x: c_int, y: c_int) { if button < 3 { - local_window().handle_mouse(button, state, x, y); + let tmp = local_window(); + tmp.borrow().handle_mouse(button, state, x, y); } else { match button { 3 => { - local_window().event_queue.with_mut(|queue| queue.push(ScrollWindowEvent(Point2D(0.0, 5.0 as f32), Point2D(0.0 as i32, 5.0 as i32)))); + let tmp = local_window(); + tmp.borrow().event_queue.with_mut(|queue| queue.push(ScrollWindowEvent(Point2D(0.0, 5.0 as f32), Point2D(0.0 as i32, 5.0 as i32)))); }, 4 => { - local_window().event_queue.with_mut(|queue| queue.push(ScrollWindowEvent(Point2D(0.0, -5.0 as f32), Point2D(0.0 as i32, -5.0 as i32)))); + let tmp = local_window(); + tmp.borrow().event_queue.with_mut(|queue| queue.push(ScrollWindowEvent(Point2D(0.0, -5.0 as f32), Point2D(0.0 as i32, -5.0 as i32)))); }, _ => {} } @@ -127,9 +132,9 @@ impl WindowMethods<Application> for Window { } glut::mouse_func(~MouseCallbackState); - let wrapped_window = Rc::new(window); + let wrapped_window = Rc::from_send(window); - install_local_window(wrapped_window); + install_local_window(wrapped_window.clone()); wrapped_window } @@ -144,7 +149,7 @@ impl WindowMethods<Application> for Window { glut::swap_buffers(); } - fn recv(@self) -> WindowEvent { + fn recv(&self) -> WindowEvent { if !self.event_queue.with_mut(|queue| queue.is_empty()) { return self.event_queue.with_mut(|queue| queue.shift()) } @@ -157,14 +162,14 @@ impl WindowMethods<Application> for Window { } /// Sets the ready state. - fn set_ready_state(@self, ready_state: ReadyState) { + fn set_ready_state(&self, ready_state: ReadyState) { self.ready_state.set(ready_state); //FIXME: set_window_title causes crash with Android version of freeGLUT. Temporarily blocked. //self.update_window_title() } /// Sets the render state. - fn set_render_state(@self, render_state: RenderState) { + fn set_render_state(&self, render_state: RenderState) { if self.ready_state.get() == FinishedLoading && self.render_state.get() == RenderingRenderState && render_state == IdleRenderState { @@ -177,7 +182,7 @@ impl WindowMethods<Application> for Window { //self.update_window_title() } - fn hidpi_factor(@self) -> f32 { + fn hidpi_factor(&self) -> f32 { //FIXME: Do nothing in GLUT now. 0f32 } |