mirror of https://github.com/lapce/lapce.git
cursor blink when switching window tab
This commit is contained in:
parent
a79254b445
commit
1268fb9ec8
|
@ -550,6 +550,8 @@ fn event(
|
||||||
Event::Command(cmd) if cmd.is(LAPCE_UI_COMMAND) => {
|
Event::Command(cmd) if cmd.is(LAPCE_UI_COMMAND) => {
|
||||||
let command = cmd.get_unchecked(LAPCE_UI_COMMAND);
|
let command = cmd.get_unchecked(LAPCE_UI_COMMAND);
|
||||||
if let LapceUICommand::Focus = command {
|
if let LapceUICommand::Focus = command {
|
||||||
|
self.cursor_blink_timer =
|
||||||
|
ctx.request_timer(Duration::from_millis(500), None);
|
||||||
self.request_focus(ctx, data, true);
|
self.request_focus(ctx, data, true);
|
||||||
let editor_data = data.editor_view_content(self.view_id);
|
let editor_data = data.editor_view_content(self.view_id);
|
||||||
self.ensure_cursor_visible(
|
self.ensure_cursor_visible(
|
||||||
|
@ -563,7 +565,7 @@ fn event(
|
||||||
}
|
}
|
||||||
Event::Timer(id) if self.cursor_blink_timer == *id => {
|
Event::Timer(id) if self.cursor_blink_timer == *id => {
|
||||||
ctx.set_handled();
|
ctx.set_handled();
|
||||||
if data.focus == self.view_id {
|
if ctx.is_focused() {
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
self.cursor_blink_timer =
|
self.cursor_blink_timer =
|
||||||
ctx.request_timer(Duration::from_millis(500), None);
|
ctx.request_timer(Duration::from_millis(500), None);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use druid::{
|
use druid::{
|
||||||
kurbo::Line,
|
kurbo::Line,
|
||||||
widget::{LensWrap, WidgetExt},
|
widget::{LensWrap, WidgetExt},
|
||||||
BoxConstraints, Command, Env, Event, EventCtx, InternalEvent, LayoutCtx,
|
BoxConstraints, Command, Env, Event, EventCtx, LayoutCtx, LifeCycle,
|
||||||
LifeCycle, LifeCycleCtx, PaintCtx, Point, RenderContext, Size, Target, Widget,
|
LifeCycleCtx, PaintCtx, Point, RenderContext, Size, Target, Widget, WidgetId,
|
||||||
WidgetId, WidgetPod, WindowState,
|
WidgetPod, WindowState,
|
||||||
};
|
};
|
||||||
use lapce_data::{
|
use lapce_data::{
|
||||||
command::{LapceUICommand, LAPCE_UI_COMMAND},
|
command::{LapceUICommand, LAPCE_UI_COMMAND},
|
||||||
|
@ -356,10 +356,8 @@ fn event(
|
||||||
| Event::MouseUp(_)
|
| Event::MouseUp(_)
|
||||||
| Event::MouseMove(_)
|
| Event::MouseMove(_)
|
||||||
| Event::Wheel(_)
|
| Event::Wheel(_)
|
||||||
| Event::KeyDown(_)
|
|
||||||
| Event::Timer(_)
|
|
||||||
| Event::AnimFrame(_)
|
| Event::AnimFrame(_)
|
||||||
| Event::Internal(InternalEvent::RouteTimer(..))
|
| Event::KeyDown(_)
|
||||||
| Event::KeyUp(_) => {}
|
| Event::KeyUp(_) => {}
|
||||||
_ => {
|
_ => {
|
||||||
for (i, tab) in self.tabs.iter_mut().enumerate() {
|
for (i, tab) in self.tabs.iter_mut().enumerate() {
|
||||||
|
|
Loading…
Reference in New Issue