mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
WindowServer+LibGUI: Expose raw scroll wheel values to applications
This is useful, for instance, in games in which you can switch held items using the scroll wheel. In order to implement this, they previously would have to either add a hard-coded division by 4, or look up your mouse settings to adjust correctly. This commit adds an MouseEvent.wheel_raw_delta_x() and MouseEvent.wheel_raw_delta_y().
This commit is contained in:
parent
148f8169a4
commit
eeeaf410fb
11 changed files with 49 additions and 33 deletions
|
@ -401,7 +401,7 @@ private:
|
|||
|
||||
class MouseEvent final : public Event {
|
||||
public:
|
||||
MouseEvent(Type type, const Gfx::IntPoint& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y)
|
||||
MouseEvent(Type type, const Gfx::IntPoint& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta_x, int wheel_delta_y, int wheel_raw_delta_x, int wheel_raw_delta_y)
|
||||
: Event(type)
|
||||
, m_position(position)
|
||||
, m_buttons(buttons)
|
||||
|
@ -409,6 +409,8 @@ public:
|
|||
, m_modifiers(modifiers)
|
||||
, m_wheel_delta_x(wheel_delta_x)
|
||||
, m_wheel_delta_y(wheel_delta_y)
|
||||
, m_wheel_raw_delta_x(wheel_raw_delta_x)
|
||||
, m_wheel_raw_delta_y(wheel_raw_delta_y)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -424,6 +426,8 @@ public:
|
|||
unsigned modifiers() const { return m_modifiers; }
|
||||
int wheel_delta_x() const { return m_wheel_delta_x; }
|
||||
int wheel_delta_y() const { return m_wheel_delta_y; }
|
||||
int wheel_raw_delta_x() const { return m_wheel_raw_delta_x; }
|
||||
int wheel_raw_delta_y() const { return m_wheel_raw_delta_y; }
|
||||
|
||||
private:
|
||||
Gfx::IntPoint m_position;
|
||||
|
@ -432,6 +436,8 @@ private:
|
|||
unsigned m_modifiers { 0 };
|
||||
int m_wheel_delta_x { 0 };
|
||||
int m_wheel_delta_y { 0 };
|
||||
int m_wheel_raw_delta_x { 0 };
|
||||
int m_wheel_raw_delta_y { 0 };
|
||||
};
|
||||
|
||||
class DragEvent final : public Event {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue