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

Fix linux mouse wheel #21

Merged
merged 3 commits into from Jun 11, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

10 glut.rs
@@ -9,7 +9,7 @@

/* automatically generated by rust-bindgen */

use glut::bindgen::{glutCreateWindow, glutDestroyWindow, glutDisplayFunc, glutMouseFunc};
use glut::bindgen::{glutCreateWindow, glutDestroyWindow, glutDisplayFunc, glutMouseFunc, glutMouseWheelFunc};
use glut::bindgen::{glutKeyboardFunc, glutGetModifiers, glutMotionFunc, glutPassiveMotionFunc};
use glut::bindgen::{glutGet, glutGetWindow};
use glut::bindgen::{glutInit, glutInitDisplayMode, glutPostRedisplay, glutReshapeFunc};
@@ -111,7 +111,7 @@ pub fn set_window(window: Window) {
}
}

pub fn set_window_title(window: Window, title: &str) {
pub fn set_window_title(_window: Window, title: &str) {
unsafe {
let bytes = to_bytes(title);
glutSetWindowTitle(to_ptr(bytes) as *c_char);
@@ -296,15 +296,15 @@ pub fn mouse_wheel_callback_tls_key(_callback: @@fn(wheel: c_int,
#[cfg(target_os="linux")]
pub extern fn mouse_wheel_callback(wheel: c_int, direction: c_int, x: c_int, y: c_int) {
unsafe {
let callback = local_data_get(wheel_callback_tls_key).get();
let callback = local_data_get(mouse_wheel_callback_tls_key).get();
(*callback)(wheel, direction, x, y)
}
}

#[cfg(target_os="linux")]
pub fn mouse_wheel_func(callback: @fn(wheel: c_int, direction: c_int, x: c_int, y: c_int)) {
unsafe {
local_data_set(wheel_callback_tls_key, @callback);
local_data_set(mouse_wheel_callback_tls_key, @callback);
glutMouseWheelFunc(mouse_wheel_callback);
}
}
@@ -489,6 +489,8 @@ pub fn glutKeyboardFunc(func: *u8);

pub fn glutMouseFunc(func: *u8);

pub fn glutMouseWheelFunc(func: *u8);

pub fn glutMotionFunc(func: *u8);

pub fn glutPassiveMotionFunc(func: *u8);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.