mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Spin the event loop every 50 ms to allow Rust channels to be processed.
This is the nail in the coffin for GLUT; we need to fix this.
This commit is contained in:
parent
7b28462193
commit
a9ed2d809d
1 changed files with 11 additions and 0 deletions
|
@ -12,6 +12,7 @@ use windowing::{ResizeCallback, ScrollCallback, WindowMethods, WindowMouseEvent,
|
||||||
use windowing::{WindowMouseDownEvent, WindowMouseUpEvent, ZoomCallback};
|
use windowing::{WindowMouseDownEvent, WindowMouseUpEvent, ZoomCallback};
|
||||||
|
|
||||||
use alert::{Alert, AlertMethods};
|
use alert::{Alert, AlertMethods};
|
||||||
|
use core::cell::Cell;
|
||||||
use core::libc::c_int;
|
use core::libc::c_int;
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use geom::size::Size2D;
|
use geom::size::Size2D;
|
||||||
|
@ -71,6 +72,15 @@ impl WindowMethods<Application> for Window {
|
||||||
mouse_down_point: @mut Point2D(0, 0),
|
mouse_down_point: @mut Point2D(0, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Spin the event loop every 50 ms to allow the Rust channels to be polled.
|
||||||
|
//
|
||||||
|
// This requirement is pretty much the nail in the coffin for GLUT's usefulness.
|
||||||
|
//
|
||||||
|
// FIXME(pcwalton): What a mess.
|
||||||
|
let register_timer_callback: @mut @fn() = @mut ||{};
|
||||||
|
*register_timer_callback = || {
|
||||||
|
glut::timer_func(50, *register_timer_callback);
|
||||||
|
};
|
||||||
|
|
||||||
// Register event handlers.
|
// Register event handlers.
|
||||||
do glut::reshape_func(window.glut_window) |width, height| {
|
do glut::reshape_func(window.glut_window) |width, height| {
|
||||||
|
@ -107,6 +117,7 @@ impl WindowMethods<Application> for Window {
|
||||||
_ => window.handle_scroll(Point2D(0.0, delta)),
|
_ => window.handle_scroll(Point2D(0.0, delta)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
(*register_timer_callback)();
|
||||||
|
|
||||||
machack::perform_scroll_wheel_hack();
|
machack::perform_scroll_wheel_hack();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue