mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:57:35 +00:00
GWindow: Make SerenityKeys labels look better
This commit is contained in:
parent
185bff6714
commit
6e0e9481a4
1 changed files with 8 additions and 6 deletions
|
@ -339,16 +339,21 @@ void GWindow::paint_keybinds() {
|
||||||
|
|
||||||
for (auto& keypair: m_hashed_potential_keybind_widgets) {
|
for (auto& keypair: m_hashed_potential_keybind_widgets) {
|
||||||
auto widget = keypair.value;
|
auto widget = keypair.value;
|
||||||
auto rect = Rect(widget->x()-5, widget->y()-5, 12, 12);
|
|
||||||
bool could_be_keybind = true;
|
bool could_be_keybind = true;
|
||||||
for (size_t i = 0; i < m_entered_keybind.length(); i++) {
|
for (size_t i = 0; i < m_entered_keybind.length(); i++) {
|
||||||
if (keypair.key.characters()[i] != m_entered_keybind.characters()[i]) {
|
if (keypair.key.characters()[i] != m_entered_keybind.characters()[i]) {
|
||||||
could_be_keybind = false;
|
could_be_keybind = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (could_be_keybind) {
|
if (could_be_keybind) {
|
||||||
painter.draw_text(rect, keypair.key.characters(), TextAlignment::TopLeft, Color::Black);
|
auto rect = Rect(widget->x()-5, widget->y()-5, 4+Font::default_font().width(keypair.key), 16);
|
||||||
painter.draw_text(rect, m_entered_keybind.characters(), TextAlignment::TopLeft, Color::Green);
|
auto highlight_rect = Rect(widget->x()-3, widget->y()-5, 0, 16);
|
||||||
|
|
||||||
|
painter.fill_rect(rect, Color::LightGray);
|
||||||
|
painter.draw_rect(rect, Color::Black, false);
|
||||||
|
painter.draw_text(rect, keypair.key.characters(), TextAlignment::Center, Color::Black);
|
||||||
|
painter.draw_text(highlight_rect, m_entered_keybind.characters(), TextAlignment::CenterLeft, Color::MidGray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,9 +406,6 @@ void GWindow::update(const Rect& a_rect)
|
||||||
if (!m_window_id)
|
if (!m_window_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//We probably shouldn't clear the buffer on updates
|
|
||||||
//find_keyboard_selectable();
|
|
||||||
|
|
||||||
for (auto& pending_rect : m_pending_paint_event_rects) {
|
for (auto& pending_rect : m_pending_paint_event_rects) {
|
||||||
if (pending_rect.contains(a_rect)) {
|
if (pending_rect.contains(a_rect)) {
|
||||||
#ifdef UPDATE_COALESCING_DEBUG
|
#ifdef UPDATE_COALESCING_DEBUG
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue