mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 12:23:46 +03:00
Track focus state and disable cursor blinking when not focused
Issue https://github.com/wez/wezterm/issues/93
This commit is contained in:
parent
71acd7d2a9
commit
0bc0972f75
@ -95,6 +95,7 @@ impl PrevCursorPos {
|
||||
|
||||
pub struct TermWindow {
|
||||
window: Option<Window>,
|
||||
focused: bool,
|
||||
fonts: Rc<FontConfiguration>,
|
||||
/// Window dimensions and dpi
|
||||
dimensions: Dimensions,
|
||||
@ -179,6 +180,11 @@ impl WindowCallbacks for TermWindow {
|
||||
self
|
||||
}
|
||||
|
||||
fn focus_change(&mut self, focused: bool) {
|
||||
log::debug!("Setting focus to {:?}", focused);
|
||||
self.focused = focused;
|
||||
}
|
||||
|
||||
fn mouse_event(&mut self, event: &MouseEvent, context: &dyn WindowOps) {
|
||||
use ::term::input::MouseButton as TMB;
|
||||
use ::term::input::MouseEventKind as TMEK;
|
||||
@ -612,6 +618,7 @@ impl TermWindow {
|
||||
dimensions.pixel_height,
|
||||
Box::new(Self {
|
||||
window: None,
|
||||
focused: false,
|
||||
mux_window_id,
|
||||
fonts: Rc::clone(fontconfig),
|
||||
render_metrics,
|
||||
@ -2111,7 +2118,7 @@ impl TermWindow {
|
||||
// depending on the current time.
|
||||
let config = configuration();
|
||||
let shape = config.default_cursor_style.effective_shape(cursor.shape);
|
||||
if shape.is_blinking() {
|
||||
if shape.is_blinking() && self.focused {
|
||||
if config.cursor_blink_rate == 0 {
|
||||
// The user disabled blinking for their cursor
|
||||
shape
|
||||
|
Loading…
Reference in New Issue
Block a user