mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
LibVT: Clean up TerminalWidget a bit, removing unused cruft
This commit is contained in:
parent
d9aaa8afe9
commit
fc2a4511ec
2 changed files with 11 additions and 25 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -25,7 +25,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "TerminalWidget.h"
|
#include "TerminalWidget.h"
|
||||||
#include "XtermColors.h"
|
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
|
@ -40,7 +39,6 @@
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/Clipboard.h>
|
#include <LibGUI/Clipboard.h>
|
||||||
#include <LibGUI/DragOperation.h>
|
#include <LibGUI/DragOperation.h>
|
||||||
#include <LibGUI/FileIconProvider.h>
|
|
||||||
#include <LibGUI/Icon.h>
|
#include <LibGUI/Icon.h>
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/Painter.h>
|
#include <LibGUI/Painter.h>
|
||||||
|
@ -109,7 +107,7 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Co
|
||||||
m_scrollbar = add<GUI::ScrollBar>(Orientation::Vertical);
|
m_scrollbar = add<GUI::ScrollBar>(Orientation::Vertical);
|
||||||
m_scrollbar->set_relative_rect(0, 0, 16, 0);
|
m_scrollbar->set_relative_rect(0, 0, 16, 0);
|
||||||
m_scrollbar->on_change = [this](int) {
|
m_scrollbar->on_change = [this](int) {
|
||||||
force_repaint();
|
update();
|
||||||
};
|
};
|
||||||
|
|
||||||
dbgln("Load config file from {}", m_config->file_name());
|
dbgln("Load config file from {}", m_config->file_name());
|
||||||
|
@ -485,12 +483,6 @@ void TerminalWidget::flush_dirty_lines()
|
||||||
update(rect);
|
update(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalWidget::force_repaint()
|
|
||||||
{
|
|
||||||
m_needs_background_fill = true;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TerminalWidget::resize_event(GUI::ResizeEvent& event)
|
void TerminalWidget::resize_event(GUI::ResizeEvent& event)
|
||||||
{
|
{
|
||||||
relayout(event.size());
|
relayout(event.size());
|
||||||
|
@ -542,7 +534,7 @@ void TerminalWidget::set_opacity(u8 new_opacity)
|
||||||
|
|
||||||
window()->set_has_alpha_channel(new_opacity < 255);
|
window()->set_has_alpha_channel(new_opacity < 255);
|
||||||
m_opacity = new_opacity;
|
m_opacity = new_opacity;
|
||||||
force_repaint();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TerminalWidget::has_selection() const
|
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);
|
set_fixed_size(m_pixel_width, m_pixel_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_needs_background_fill = true;
|
update();
|
||||||
force_repaint();
|
|
||||||
|
|
||||||
winsize ws;
|
winsize ws;
|
||||||
ws.ws_row = rows;
|
ws.ws_row = rows;
|
||||||
|
@ -992,9 +983,9 @@ void TerminalWidget::beep()
|
||||||
m_visual_beep_timer->restart(200);
|
m_visual_beep_timer->restart(200);
|
||||||
m_visual_beep_timer->set_single_shot(true);
|
m_visual_beep_timer->set_single_shot(true);
|
||||||
m_visual_beep_timer->on_timeout = [this] {
|
m_visual_beep_timer->on_timeout = [this] {
|
||||||
force_repaint();
|
update();
|
||||||
};
|
};
|
||||||
force_repaint();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalWidget::emit(const u8* data, size_t size)
|
void TerminalWidget::emit(const u8* data, size_t size)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -37,9 +37,11 @@
|
||||||
#include <LibVT/Range.h>
|
#include <LibVT/Range.h>
|
||||||
#include <LibVT/Terminal.h>
|
#include <LibVT/Terminal.h>
|
||||||
|
|
||||||
class TerminalWidget final : public GUI::Frame
|
class TerminalWidget final
|
||||||
|
: public GUI::Frame
|
||||||
, public VT::TerminalClient {
|
, public VT::TerminalClient {
|
||||||
C_OBJECT(TerminalWidget)
|
C_OBJECT(TerminalWidget);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Core::ConfigFile> config);
|
TerminalWidget(int ptm_fd, bool automatic_size_policy, RefPtr<Core::ConfigFile> config);
|
||||||
virtual ~TerminalWidget() override;
|
virtual ~TerminalWidget() override;
|
||||||
|
@ -51,10 +53,7 @@ public:
|
||||||
flush_dirty_lines();
|
flush_dirty_lines();
|
||||||
}
|
}
|
||||||
|
|
||||||
void create_window();
|
|
||||||
|
|
||||||
void flush_dirty_lines();
|
void flush_dirty_lines();
|
||||||
void force_repaint();
|
|
||||||
|
|
||||||
void apply_size_increments_to_window(GUI::Window&);
|
void apply_size_increments_to_window(GUI::Window&);
|
||||||
|
|
||||||
|
@ -172,7 +171,6 @@ private:
|
||||||
String m_context_menu_href;
|
String m_context_menu_href;
|
||||||
|
|
||||||
BellMode m_bell_mode { BellMode::Visible };
|
BellMode m_bell_mode { BellMode::Visible };
|
||||||
bool m_belling { false };
|
|
||||||
bool m_alt_key_held { false };
|
bool m_alt_key_held { false };
|
||||||
bool m_rectangle_selection { false };
|
bool m_rectangle_selection { false };
|
||||||
|
|
||||||
|
@ -190,14 +188,11 @@ private:
|
||||||
RefPtr<Core::Notifier> m_notifier;
|
RefPtr<Core::Notifier> m_notifier;
|
||||||
|
|
||||||
u8 m_opacity { 255 };
|
u8 m_opacity { 255 };
|
||||||
bool m_needs_background_fill { true };
|
|
||||||
bool m_cursor_blink_state { true };
|
bool m_cursor_blink_state { true };
|
||||||
bool m_automatic_size_policy { false };
|
bool m_automatic_size_policy { false };
|
||||||
|
|
||||||
RefPtr<Gfx::Font> m_bold_font;
|
RefPtr<Gfx::Font> m_bold_font;
|
||||||
|
|
||||||
int m_glyph_width { 0 };
|
|
||||||
|
|
||||||
enum class AutoScrollDirection {
|
enum class AutoScrollDirection {
|
||||||
None,
|
None,
|
||||||
Up,
|
Up,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue