mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-02 16:25:34 +03:00
Everywhere: Rename "logo" key to "super" key
This seems to be the most common way to refer to this key, so let's call it what people actually call it.
This commit is contained in:
parent
822d7da6cc
commit
38f11cc1ba
Notes:
sideshowbarker
2024-07-18 21:30:46 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/38f11cc1ba3
@ -134,7 +134,7 @@
|
||||
__ENUMERATE_KEY_CODE(Pipe, "|") \
|
||||
__ENUMERATE_KEY_CODE(Tilde, "~") \
|
||||
__ENUMERATE_KEY_CODE(Backtick, "`") \
|
||||
__ENUMERATE_KEY_CODE(Logo, "Logo") \
|
||||
__ENUMERATE_KEY_CODE(Super, "Super") \
|
||||
__ENUMERATE_KEY_CODE(Menu, "Menu")
|
||||
|
||||
enum KeyCode : u8 {
|
||||
@ -145,14 +145,14 @@ enum KeyCode : u8 {
|
||||
Key_Shift
|
||||
= Key_LeftShift,
|
||||
};
|
||||
const int key_code_count = Key_Logo;
|
||||
const int key_code_count = Key_Super;
|
||||
|
||||
enum KeyModifier {
|
||||
Mod_None = 0x00,
|
||||
Mod_Alt = 0x01,
|
||||
Mod_Ctrl = 0x02,
|
||||
Mod_Shift = 0x04,
|
||||
Mod_Logo = 0x08,
|
||||
Mod_Super = 0x08,
|
||||
Mod_AltGr = 0x10,
|
||||
Mod_Mask = 0x1f,
|
||||
|
||||
@ -169,7 +169,7 @@ struct KeyEvent {
|
||||
bool alt() const { return flags & Mod_Alt; }
|
||||
bool ctrl() const { return flags & Mod_Ctrl; }
|
||||
bool shift() const { return flags & Mod_Shift; }
|
||||
bool logo() const { return flags & Mod_Logo; }
|
||||
bool super() const { return flags & Mod_Super; }
|
||||
bool altgr() const { return flags & Mod_AltGr; }
|
||||
unsigned modifiers() const { return flags & Mod_Mask; }
|
||||
bool is_press() const { return flags & Is_Press; }
|
||||
|
@ -131,7 +131,7 @@ static const KeyCode unshifted_key_map[0x80] = {
|
||||
Key_F12,
|
||||
Key_Invalid,
|
||||
Key_Invalid,
|
||||
Key_Logo,
|
||||
Key_Super,
|
||||
Key_Invalid,
|
||||
Key_Menu,
|
||||
};
|
||||
@ -228,7 +228,7 @@ static const KeyCode shifted_key_map[0x100] = {
|
||||
Key_F12,
|
||||
Key_Invalid,
|
||||
Key_Invalid,
|
||||
Key_Logo,
|
||||
Key_Super,
|
||||
Key_Invalid,
|
||||
Key_Menu,
|
||||
};
|
||||
@ -312,7 +312,7 @@ void KeyboardDevice::irq_handle_byte_read(u8 byte)
|
||||
update_modifier(Mod_Ctrl, pressed);
|
||||
break;
|
||||
case 0x5b:
|
||||
update_modifier(Mod_Logo, pressed);
|
||||
update_modifier(Mod_Super, pressed);
|
||||
break;
|
||||
case 0x2a:
|
||||
case 0x36:
|
||||
|
@ -52,8 +52,8 @@ String KeyEvent::to_string() const
|
||||
parts.append("Shift");
|
||||
if (m_modifiers & Mod_Alt)
|
||||
parts.append("Alt");
|
||||
if (m_modifiers & Mod_Logo)
|
||||
parts.append("Logo");
|
||||
if (m_modifiers & Mod_Super)
|
||||
parts.append("Super");
|
||||
|
||||
if (auto* key_name = key_code_to_string(static_cast<KeyCode>(m_key)))
|
||||
parts.append(key_name);
|
||||
|
@ -290,7 +290,7 @@ public:
|
||||
bool ctrl() const { return m_modifiers & Mod_Ctrl; }
|
||||
bool alt() const { return m_modifiers & Mod_Alt; }
|
||||
bool shift() const { return m_modifiers & Mod_Shift; }
|
||||
bool logo() const { return m_modifiers & Mod_Logo; }
|
||||
bool super() const { return m_modifiers & Mod_Super; }
|
||||
u8 modifiers() const { return m_modifiers; }
|
||||
u32 code_point() const { return m_code_point; }
|
||||
String text() const
|
||||
@ -331,7 +331,7 @@ public:
|
||||
bool ctrl() const { return m_modifiers & Mod_Ctrl; }
|
||||
bool alt() const { return m_modifiers & Mod_Alt; }
|
||||
bool shift() const { return m_modifiers & Mod_Shift; }
|
||||
bool logo() const { return m_modifiers & Mod_Logo; }
|
||||
bool super() const { return m_modifiers & Mod_Super; }
|
||||
unsigned modifiers() const { return m_modifiers; }
|
||||
int wheel_delta() const { return m_wheel_delta; }
|
||||
|
||||
|
@ -41,8 +41,8 @@ String Shortcut::to_string() const
|
||||
parts.append("Shift");
|
||||
if (m_modifiers & Mod_Alt)
|
||||
parts.append("Alt");
|
||||
if (m_modifiers & Mod_Logo)
|
||||
parts.append("Logo");
|
||||
if (m_modifiers & Mod_Super)
|
||||
parts.append("Super");
|
||||
|
||||
if (auto* key_name = key_code_to_string(m_key))
|
||||
parts.append(key_name);
|
||||
|
@ -445,7 +445,7 @@ void Widget::hide_event(HideEvent&)
|
||||
|
||||
void Widget::keydown_event(KeyEvent& event)
|
||||
{
|
||||
if (!event.alt() && !event.ctrl() && !event.logo()) {
|
||||
if (!event.alt() && !event.ctrl() && !event.super()) {
|
||||
if (event.key() == KeyCode::Key_Tab) {
|
||||
if (event.shift())
|
||||
focus_previous_widget(FocusSource::Keyboard, false);
|
||||
|
@ -422,7 +422,7 @@ void Window::handle_multi_paint_event(MultiPaintEvent& event)
|
||||
|
||||
void Window::handle_key_event(KeyEvent& event)
|
||||
{
|
||||
if (!m_focused_widget && event.type() == Event::KeyDown && event.key() == Key_Tab && !event.ctrl() && !event.alt() && !event.logo()) {
|
||||
if (!m_focused_widget && event.type() == Event::KeyDown && event.key() == Key_Tab && !event.ctrl() && !event.alt() && !event.super()) {
|
||||
focus_a_widget_if_possible(FocusSource::Keyboard);
|
||||
return;
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ void TerminalWidget::keydown_event(GUI::KeyEvent& event)
|
||||
|
||||
m_terminal.handle_key_press(event.key(), event.code_point(), event.modifiers());
|
||||
|
||||
if (event.key() != Key_Control && event.key() != Key_Alt && event.key() != Key_LeftShift && event.key() != Key_RightShift && event.key() != Key_Logo)
|
||||
if (event.key() != Key_Control && event.key() != Key_Alt && event.key() != Key_LeftShift && event.key() != Key_RightShift && event.key() != Key_Super)
|
||||
scroll_to_bottom();
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
bool ctrl() const { return m_modifiers & Mod_Ctrl; }
|
||||
bool alt() const { return m_modifiers & Mod_Alt; }
|
||||
bool shift() const { return m_modifiers & Mod_Shift; }
|
||||
bool logo() const { return m_modifiers & Mod_Logo; }
|
||||
bool super() const { return m_modifiers & Mod_Super; }
|
||||
u8 modifiers() const { return m_modifiers; }
|
||||
u32 code_point() const { return m_code_point; }
|
||||
u32 scancode() const { return m_scancode; }
|
||||
|
@ -564,8 +564,8 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove
|
||||
Gfx::IntPoint pos = m_move_window_origin.translated(event.position() - m_move_origin);
|
||||
m_move_window->set_position_without_repaint(pos);
|
||||
// "Bounce back" the window if it would end up too far outside the screen.
|
||||
// If the user has let go of Mod_Logo, maybe they didn't intentionally press it to begin with. Therefore, refuse to go into a state where knowledge about super-drags is necessary.
|
||||
bool force_titlebar_visible = !(m_keyboard_modifiers & Mod_Logo);
|
||||
// If the user has let go of Mod_Super, maybe they didn't intentionally press it to begin with. Therefore, refuse to go into a state where knowledge about super-drags is necessary.
|
||||
bool force_titlebar_visible = !(m_keyboard_modifiers & Mod_Super);
|
||||
m_move_window->nudge_into_desktop(force_titlebar_visible);
|
||||
} else if (pixels_moved_from_start > 5) {
|
||||
m_move_window->set_untiled(event.position());
|
||||
@ -957,22 +957,22 @@ void WindowManager::process_mouse_event(MouseEvent& event, Window*& hovered_wind
|
||||
if (&window != m_resize_candidate.ptr())
|
||||
clear_resize_candidate();
|
||||
|
||||
// First check if we should initiate a move or resize (Logo+LMB or Logo+RMB).
|
||||
// First check if we should initiate a move or resize (Super+LMB or Super+RMB).
|
||||
// In those cases, the event is swallowed by the window manager.
|
||||
if (window.is_movable()) {
|
||||
if (!window.is_fullscreen() && m_keyboard_modifiers == Mod_Logo && event.type() == Event::MouseDown && event.button() == MouseButton::Left) {
|
||||
if (!window.is_fullscreen() && m_keyboard_modifiers == Mod_Super && event.type() == Event::MouseDown && event.button() == MouseButton::Left) {
|
||||
hovered_window = &window;
|
||||
start_window_move(window, event);
|
||||
return;
|
||||
}
|
||||
if (window.is_resizable() && m_keyboard_modifiers == Mod_Logo && event.type() == Event::MouseDown && event.button() == MouseButton::Right && !window.blocking_modal_window()) {
|
||||
if (window.is_resizable() && m_keyboard_modifiers == Mod_Super && event.type() == Event::MouseDown && event.button() == MouseButton::Right && !window.blocking_modal_window()) {
|
||||
hovered_window = &window;
|
||||
start_window_resize(window, event);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_keyboard_modifiers == Mod_Logo && event.type() == Event::MouseWheel) {
|
||||
if (m_keyboard_modifiers == Mod_Super && event.type() == Event::MouseWheel) {
|
||||
float opacity_change = -event.wheel_delta() * 0.05f;
|
||||
float new_opacity = window.opacity() + opacity_change;
|
||||
if (new_opacity < 0.05f)
|
||||
@ -1164,17 +1164,17 @@ void WindowManager::event(Core::Event& event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_event.type() == Event::KeyDown && (key_event.modifiers() == (Mod_Ctrl | Mod_Logo | Mod_Shift) && key_event.key() == Key_I)) {
|
||||
if (key_event.type() == Event::KeyDown && (key_event.modifiers() == (Mod_Ctrl | Mod_Super | Mod_Shift) && key_event.key() == Key_I)) {
|
||||
reload_icon_bitmaps_after_scale_change(!m_allow_hidpi_icons);
|
||||
Compositor::the().invalidate_screen();
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_event.type() == Event::KeyDown && key_event.key() == Key_Logo) {
|
||||
if (key_event.type() == Event::KeyDown && key_event.key() == Key_Super) {
|
||||
m_previous_event_is_key_down_logo = true;
|
||||
} else if (m_previous_event_is_key_down_logo) {
|
||||
m_previous_event_is_key_down_logo = false;
|
||||
if (key_event.type() == Event::KeyUp && key_event.key() == Key_Logo) {
|
||||
if (key_event.type() == Event::KeyUp && key_event.key() == Key_Super) {
|
||||
if (MenuManager::the().has_open_menu()) {
|
||||
MenuManager::the().close_everyone();
|
||||
} else {
|
||||
@ -1189,7 +1189,7 @@ void WindowManager::event(Core::Event& event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_event.type() == Event::KeyDown && ((key_event.modifiers() == Mod_Logo && key_event.key() == Key_Tab) || (key_event.modifiers() == (Mod_Logo | Mod_Shift) && key_event.key() == Key_Tab)))
|
||||
if (key_event.type() == Event::KeyDown && ((key_event.modifiers() == Mod_Super && key_event.key() == Key_Tab) || (key_event.modifiers() == (Mod_Super | Mod_Shift) && key_event.key() == Key_Tab)))
|
||||
m_switcher.show();
|
||||
if (m_switcher.is_visible()) {
|
||||
m_switcher.on_key_event(key_event);
|
||||
@ -1197,7 +1197,7 @@ void WindowManager::event(Core::Event& event)
|
||||
}
|
||||
|
||||
if (m_active_input_window) {
|
||||
if (key_event.type() == Event::KeyDown && key_event.modifiers() == Mod_Logo) {
|
||||
if (key_event.type() == Event::KeyDown && key_event.modifiers() == Mod_Super) {
|
||||
if (key_event.key() == Key_Down) {
|
||||
if (m_active_input_window->is_resizable() && m_active_input_window->is_maximized()) {
|
||||
maximize_windows(*m_active_input_window, false);
|
||||
|
@ -106,7 +106,7 @@ void WindowSwitcher::event(Core::Event& event)
|
||||
void WindowSwitcher::on_key_event(const KeyEvent& event)
|
||||
{
|
||||
if (event.type() == Event::KeyUp) {
|
||||
if (event.key() == Key_Logo) {
|
||||
if (event.key() == Key_Super) {
|
||||
if (auto* window = selected_window()) {
|
||||
window->set_minimized(false);
|
||||
WindowManager::the().move_to_front_and_make_active(*window);
|
||||
|
Loading…
Reference in New Issue
Block a user