mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
LibVT: Don't leave 50ms auto-scroll timer running at all times
This timer was causing wake-ups every 50ms in all terminals, just to right back to sleep unless we were in the middle of an auto-scroll.
This commit is contained in:
parent
d0df249666
commit
7d7950b322
2 changed files with 15 additions and 6 deletions
|
@ -176,7 +176,7 @@ void TerminalWidget::set_logical_focus(bool focus)
|
||||||
m_cursor_blink_state = true;
|
m_cursor_blink_state = true;
|
||||||
m_cursor_blink_timer->start();
|
m_cursor_blink_timer->start();
|
||||||
}
|
}
|
||||||
m_auto_scroll_direction = AutoScrollDirection::None;
|
set_auto_scroll_direction(AutoScrollDirection::None);
|
||||||
invalidate_cursor();
|
invalidate_cursor();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -774,7 +774,7 @@ void TerminalWidget::mouseup_event(GUI::MouseEvent& event)
|
||||||
m_active_href_id = {};
|
m_active_href_id = {};
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
m_auto_scroll_direction = AutoScrollDirection::None;
|
set_auto_scroll_direction(AutoScrollDirection::None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,11 +873,11 @@ void TerminalWidget::mousemove_event(GUI::MouseEvent& event)
|
||||||
|
|
||||||
auto adjusted_position = event.position().translated(-(frame_thickness() + m_inset), -(frame_thickness() + m_inset));
|
auto adjusted_position = event.position().translated(-(frame_thickness() + m_inset), -(frame_thickness() + m_inset));
|
||||||
if (adjusted_position.y() < 0)
|
if (adjusted_position.y() < 0)
|
||||||
m_auto_scroll_direction = AutoScrollDirection::Up;
|
set_auto_scroll_direction(AutoScrollDirection::Up);
|
||||||
else if (adjusted_position.y() > m_terminal.rows() * m_line_height)
|
else if (adjusted_position.y() > m_terminal.rows() * m_line_height)
|
||||||
m_auto_scroll_direction = AutoScrollDirection::Down;
|
set_auto_scroll_direction(AutoScrollDirection::Down);
|
||||||
else
|
else
|
||||||
m_auto_scroll_direction = AutoScrollDirection::None;
|
set_auto_scroll_direction(AutoScrollDirection::None);
|
||||||
|
|
||||||
VT::Position old_selection_end = m_selection.end();
|
VT::Position old_selection_end = m_selection.end();
|
||||||
VT::Position old_selection_start = m_selection.start();
|
VT::Position old_selection_start = m_selection.start();
|
||||||
|
@ -915,7 +915,7 @@ void TerminalWidget::mousewheel_event(GUI::MouseEvent& event)
|
||||||
{
|
{
|
||||||
if (!is_scrollable())
|
if (!is_scrollable())
|
||||||
return;
|
return;
|
||||||
m_auto_scroll_direction = AutoScrollDirection::None;
|
set_auto_scroll_direction(AutoScrollDirection::None);
|
||||||
m_scrollbar->set_value(m_scrollbar->value() + event.wheel_delta() * scroll_length());
|
m_scrollbar->set_value(m_scrollbar->value() + event.wheel_delta() * scroll_length());
|
||||||
GUI::Frame::mousewheel_event(event);
|
GUI::Frame::mousewheel_event(event);
|
||||||
}
|
}
|
||||||
|
@ -1286,4 +1286,11 @@ void TerminalWidget::send_non_user_input(ReadonlyBytes bytes)
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TerminalWidget::set_auto_scroll_direction(AutoScrollDirection direction)
|
||||||
|
{
|
||||||
|
m_auto_scroll_direction = direction;
|
||||||
|
m_auto_scroll_timer->set_active(direction != AutoScrollDirection::None);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,6 +201,8 @@ private:
|
||||||
Down
|
Down
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void set_auto_scroll_direction(AutoScrollDirection);
|
||||||
|
|
||||||
AutoScrollDirection m_auto_scroll_direction { AutoScrollDirection::None };
|
AutoScrollDirection m_auto_scroll_direction { AutoScrollDirection::None };
|
||||||
|
|
||||||
RefPtr<Core::Timer> m_cursor_blink_timer;
|
RefPtr<Core::Timer> m_cursor_blink_timer;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue