From a7d95540384c0b37e75a4bedb0bff688fee7dcf1 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Thu, 1 Nov 2018 17:23:49 +0000 Subject: Rework cursor configuration There are a couple of cursor-related options in the Alacritty config file now, however they aren't grouped together in any way. To resolve this a new `cursor` field has been added where all cursor configuration options (besides colors) have been moved. The `custom_cursor_colors` option has also been removed, since it's not necessary anymore. Simply making the `colors.cursor.*` fields optional, allows overriding the cursor colors whenever one of them is present. Like that the user doesn't have to think about a relation between two separate configuration options. This PR initially put the `hide_cursor_when_typing` variable under `cursor.hide_when_typing`. However this field is completely unrelated to the cursor, but instead relates to the mouse cursor. Since the word `cursor` is already used for the active cell in the grid of a terminal emulator, all occurences of the word `cursor` when talking about the mouse have been replaced with the word `mouse`. The configuration option has also been moved to `mouse.hide_when_typing`, to make it clear what this option is changing. This fixes #1080. --- src/window.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/window.rs') diff --git a/src/window.rs b/src/window.rs index 2c1bf7b2..cb753d40 100644 --- a/src/window.rs +++ b/src/window.rs @@ -70,7 +70,7 @@ type Result = ::std::result::Result; pub struct Window { event_loop: EventsLoop, window: glutin::GlWindow, - cursor_visible: bool, + mouse_visible: bool, /// Whether or not the window is the focused window. pub is_focused: bool, @@ -243,7 +243,7 @@ impl Window { let window = Window { event_loop, window, - cursor_visible: true, + mouse_visible: true, is_focused: false, }; @@ -326,16 +326,16 @@ impl Window { }); } - /// Set cursor visible - pub fn set_cursor_visible(&mut self, visible: bool) { - if visible != self.cursor_visible { - self.cursor_visible = visible; + /// Set mouse cursor visible + pub fn set_mouse_visible(&mut self, visible: bool) { + if visible != self.mouse_visible { + self.mouse_visible = visible; if let Err(err) = self.window.set_cursor_state(if visible { CursorState::Normal } else { CursorState::Hide }) { - warn!("Failed to set cursor visibility: {}", err); + warn!("Failed to set mouse cursor visibility: {}", err); } } } -- cgit v1.2.3-54-g00ecf