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
|
||||
if let Some(path) = prepaint.selection_path.take() {
|
||||
window.paint_path(path, cx.theme().selection);
|
||||
if window.is_window_active() {
|
||||
if let Some(path) = prepaint.selection_path.take() {
|
||||
window.paint_path(path, cx.theme().selection);
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
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>) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue