Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #29 from pcwalton/post-empty-event
Browse files Browse the repository at this point in the history
Add a binding for `glfwPostEmptyEvent()`
  • Loading branch information
metajack committed Nov 1, 2014
2 parents cec2861 + a16de54 commit 8edf667
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ extern "C" {

pub fn glfwPollEvents();
pub fn glfwWaitEvents();
pub fn glfwPostEmptyEvent();

pub fn glfwGetInputMode(window: *mut GLFWwindow, mode: c_int) -> c_int;
pub fn glfwSetInputMode(window: *mut GLFWwindow, mode: c_int, value: c_int);
Expand Down
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,15 @@ impl Glfw {
unsafe { ffi::glfwWaitEvents(); }
}

/// Posts an empty event from the current thread to the event queue,
/// causing `wait_events()` to return.
///
/// Because of the multithreaded nature of this function, it is static and
/// does not take a `Glfw` instance.
pub fn post_empty_event() {
unsafe { ffi::glfwPostEmptyEvent() }
}

/// Returns the current value of the GLFW timer. Unless the timer has been
/// set using `glfw::set_time`, the timer measures time elapsed since GLFW
/// was initialized.
Expand Down

0 comments on commit 8edf667

Please sign in to comment.