aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/window.rs
diff options
context:
space:
mode:
authorElaina Martineau <elainamartineau@gmail.com>2019-07-08 12:13:55 -0600
committerChristian Duerr <chrisduerr@users.noreply.github.com>2019-07-08 18:13:55 +0000
commit84aca672964e29b5b4503b7da7bc34fc395f08ab (patch)
tree01c6d670624809ad7e7b560c0beb76f8f77f5bd0 /alacritty_terminal/src/window.rs
parent7331e89122c464e7b1a73b2e7b20399f832a5913 (diff)
downloadalacritty-84aca672964e29b5b4503b7da7bc34fc395f08ab.tar.gz
alacritty-84aca672964e29b5b4503b7da7bc34fc395f08ab.zip
Change mouse cursor when hovering over the message bar
Diffstat (limited to 'alacritty_terminal/src/window.rs')
-rw-r--r--alacritty_terminal/src/window.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/alacritty_terminal/src/window.rs b/alacritty_terminal/src/window.rs
index d4c673ba..0292cab9 100644
--- a/alacritty_terminal/src/window.rs
+++ b/alacritty_terminal/src/window.rs
@@ -61,6 +61,9 @@ pub struct Window {
windowed_context: glutin::WindowedContext<PossiblyCurrent>,
mouse_visible: bool,
+ /// Keep track of the current mouse cursor to avoid unnecessarily changing it
+ current_mouse_cursor: MouseCursor,
+
/// Whether or not the window is the focused window.
pub is_focused: bool,
}
@@ -164,8 +167,13 @@ impl Window {
// Set OpenGL symbol loader. This call MUST be after window.make_current on windows.
gl::load_with(|symbol| windowed_context.get_proc_address(symbol) as *const _);
- let window =
- Window { event_loop, windowed_context, mouse_visible: true, is_focused: false };
+ let window = Window {
+ event_loop,
+ current_mouse_cursor: MouseCursor::Default,
+ windowed_context,
+ mouse_visible: true,
+ is_focused: false,
+ };
window.run_os_extensions();
@@ -239,8 +247,11 @@ impl Window {
}
#[inline]
- pub fn set_mouse_cursor(&self, cursor: MouseCursor) {
- self.window().set_cursor(cursor);
+ pub fn set_mouse_cursor(&mut self, cursor: MouseCursor) {
+ if cursor != self.current_mouse_cursor {
+ self.current_mouse_cursor = cursor;
+ self.window().set_cursor(cursor);
+ }
}
/// Set mouse cursor visible