Skip to content

Commit

Permalink
Improve performance on windows
Browse files Browse the repository at this point in the history
I noticed that things were feeling laggy in general and when I
added some debugging prints I noticed that we were getting a
continuous stream of CursorMoved events with the same coordinates
while the window had focus.

This diff short circuits mouse processing in that situation and
makes things feel a bit more snappy.
  • Loading branch information
wez committed May 19, 2019
1 parent 5d8860f commit c207142
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/frontend/glium/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,13 @@ impl GliumTerminalWindow {
position: PhysicalPosition,
modifiers: glium::glutin::ModifiersState,
) -> Result<(), Error> {
// On Windows, I've observed that we receive a continuous stream of
// CursorMoved events with the same coordinates. Let's avoid
// doing any real work in that situation.
if position == self.last_mouse_coords {
return Ok(());
}

let mux = Mux::get().unwrap();
let tab = match mux.get_active_tab_for_window(self.get_mux_window_id()) {
Some(tab) => tab,
Expand Down

0 comments on commit c207142

Please sign in to comment.