From fc2a4511ece972886c0e6caa16313d9a097339ae Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 15 Feb 2021 19:58:18 +0100 Subject: [PATCH] LibVT: Clean up TerminalWidget a bit, removing unused cruft --- Userland/Libraries/LibVT/TerminalWidget.cpp | 21 ++++++--------------- Userland/Libraries/LibVT/TerminalWidget.h | 15 +++++---------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/Userland/Libraries/LibVT/TerminalWidget.cpp b/Userland/Libraries/LibVT/TerminalWidget.cpp index 91afd205d2..c38a0f7600 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.cpp +++ b/Userland/Libraries/LibVT/TerminalWidget.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,6 @@ */ #include "TerminalWidget.h" -#include "XtermColors.h" #include #include #include @@ -40,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -109,7 +107,7 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr(Orientation::Vertical); m_scrollbar->set_relative_rect(0, 0, 16, 0); m_scrollbar->on_change = [this](int) { - force_repaint(); + update(); }; dbgln("Load config file from {}", m_config->file_name()); @@ -485,12 +483,6 @@ void TerminalWidget::flush_dirty_lines() update(rect); } -void TerminalWidget::force_repaint() -{ - m_needs_background_fill = true; - update(); -} - void TerminalWidget::resize_event(GUI::ResizeEvent& event) { relayout(event.size()); @@ -542,7 +534,7 @@ void TerminalWidget::set_opacity(u8 new_opacity) window()->set_has_alpha_channel(new_opacity < 255); m_opacity = new_opacity; - force_repaint(); + update(); } bool TerminalWidget::has_selection() const @@ -966,8 +958,7 @@ void TerminalWidget::terminal_did_resize(u16 columns, u16 rows) set_fixed_size(m_pixel_width, m_pixel_height); } - m_needs_background_fill = true; - force_repaint(); + update(); winsize ws; ws.ws_row = rows; @@ -992,9 +983,9 @@ void TerminalWidget::beep() m_visual_beep_timer->restart(200); m_visual_beep_timer->set_single_shot(true); m_visual_beep_timer->on_timeout = [this] { - force_repaint(); + update(); }; - force_repaint(); + update(); } void TerminalWidget::emit(const u8* data, size_t size) diff --git a/Userland/Libraries/LibVT/TerminalWidget.h b/Userland/Libraries/LibVT/TerminalWidget.h index a9a8370ecc..49d76ca4b4 100644 --- a/Userland/Libraries/LibVT/TerminalWidget.h +++ b/Userland/Libraries/LibVT/TerminalWidget.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2018-2021, Andreas Kling * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,9 +37,11 @@ #include #include -class TerminalWidget final : public GUI::Frame +class TerminalWidget final + : public GUI::Frame , public VT::TerminalClient { - C_OBJECT(TerminalWidget) + C_OBJECT(TerminalWidget); + public: TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr config); virtual ~TerminalWidget() override; @@ -51,10 +53,7 @@ public: flush_dirty_lines(); } - void create_window(); - void flush_dirty_lines(); - void force_repaint(); void apply_size_increments_to_window(GUI::Window&); @@ -172,7 +171,6 @@ private: String m_context_menu_href; BellMode m_bell_mode { BellMode::Visible }; - bool m_belling { false }; bool m_alt_key_held { false }; bool m_rectangle_selection { false }; @@ -190,14 +188,11 @@ private: RefPtr m_notifier; u8 m_opacity { 255 }; - bool m_needs_background_fill { true }; bool m_cursor_blink_state { true }; bool m_automatic_size_policy { false }; RefPtr m_bold_font; - int m_glyph_width { 0 }; - enum class AutoScrollDirection { None, Up,