GUI: Give MouseEvent shift() / ctrl() / alt() / logo() functions
This commit is contained in:
parent
eab7712ab0
commit
cb2d56b909
Notes:
sideshowbarker
2024-07-19 03:52:34 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/cb2d56b9096 Pull-request: https://github.com/SerenityOS/serenity/pull/3102
2 changed files with 5 additions and 1 deletions
Libraries/LibGUI
|
@ -331,6 +331,10 @@ public:
|
|||
int y() const { return m_position.y(); }
|
||||
MouseButton button() const { return m_button; }
|
||||
unsigned buttons() const { return m_buttons; }
|
||||
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; }
|
||||
unsigned modifiers() const { return m_modifiers; }
|
||||
int wheel_delta() const { return m_wheel_delta; }
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ void ScrollableWidget::mousewheel_event(MouseEvent& event)
|
|||
return;
|
||||
}
|
||||
// FIXME: The wheel delta multiplier should probably come from... somewhere?
|
||||
if (event.modifiers() & Mod_Shift) {
|
||||
if (event.shift()) {
|
||||
horizontal_scrollbar().set_value(horizontal_scrollbar().value() + event.wheel_delta() * 60);
|
||||
} else {
|
||||
vertical_scrollbar().set_value(vertical_scrollbar().value() + event.wheel_delta() * 20);
|
||||
|
|
Loading…
Add table
Reference in a new issue