input: Hide cursor and selection when window is deactivated. (#1066)
This commit is contained in:
parent
eca7949583
commit
ea1f5331c8
2 changed files with 7 additions and 3 deletions
|
|
@ -900,8 +900,10 @@ impl Element for TextElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paint selections
|
// Paint selections
|
||||||
if let Some(path) = prepaint.selection_path.take() {
|
if window.is_window_active() {
|
||||||
window.paint_path(path, cx.theme().selection);
|
if let Some(path) = prepaint.selection_path.take() {
|
||||||
|
window.paint_path(path, cx.theme().selection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paint text
|
// Paint text
|
||||||
|
|
|
||||||
|
|
@ -1963,7 +1963,9 @@ impl InputState {
|
||||||
|
|
||||||
/// Returns the true to let InputElement to render cursor, when Input is focused and current BlinkCursor is visible.
|
/// Returns the true to let InputElement to render cursor, when Input is focused and current BlinkCursor is visible.
|
||||||
pub(crate) fn show_cursor(&self, window: &Window, cx: &App) -> bool {
|
pub(crate) fn show_cursor(&self, window: &Window, cx: &App) -> bool {
|
||||||
self.focus_handle.is_focused(window) && self.blink_cursor.read(cx).visible()
|
self.focus_handle.is_focused(window)
|
||||||
|
&& self.blink_cursor.read(cx).visible()
|
||||||
|
&& window.is_window_active()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_focus(&mut self, _: &mut Window, cx: &mut Context<Self>) {
|
fn on_focus(&mut self, _: &mut Window, cx: &mut Context<Self>) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue