diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-06-28 02:56:52 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2020-06-28 12:51:08 +0200 |
commit | c97fea54813052953fc0ff2ef0b506c372689ac8 (patch) | |
tree | e65d5b9da7b287251b7f027ef7a725fb538d3d63 /vcl | |
parent | 09c01a8d6f5dc072991450d215558555152764a8 (diff) |
VCL refactor Sal*MouseEvent structures
Moves the common members of SalWheelMouseEvent and SalMouseEvent
into a new SalAbstractMouseEvent.
Change-Id: I68019a33be47b983976a38a1a5b8d15d12b4c504
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97342
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salwtype.hxx | 27 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 2 |
2 files changed, 17 insertions, 12 deletions
diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index fc8aeb4976c0..c6820fbc8cb9 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -88,17 +88,26 @@ enum class SalEvent { Gesture, }; +struct SalAbstractMouseEvent +{ + sal_uInt64 mnTime; // Time in ms, when event is created + long mnX; // X-Position (Pixel, TopLeft-Output) + long mnY; // Y-Position (Pixel, TopLeft-Output) + sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2|MOUSE_LEFT|MOUSE_MIDDLE|MOUSE_RIGHT) + +protected: + SalAbstractMouseEvent() : mnTime(0), mnX(0), mnY(0), mnCode(0) {} +}; + // MOUSELEAVE must send, when the pointer leave the client area and // the mouse is not captured // MOUSEMOVE, MOUSELEAVE, MOUSEBUTTONDOWN and MOUSEBUTTONUP // MAC: Ctrl+Button is MOUSE_RIGHT -struct SalMouseEvent +struct SalMouseEvent final : public SalAbstractMouseEvent { - sal_uInt64 mnTime; // Time in ms, when event is created - long mnX; // X-Position (Pixel, TopLeft-Output) - long mnY; // Y-Position (Pixel, TopLeft-Output) sal_uInt16 mnButton; // 0-MouseMove/MouseLeave, MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE - sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2|MOUSE_LEFT|MOUSE_MIDDLE|MOUSE_RIGHT) + + SalMouseEvent() : mnButton(0) {} }; // KEYINPUT and KEYUP @@ -144,20 +153,16 @@ struct SalPaintEvent }; #define SAL_WHEELMOUSE_EVENT_PAGESCROLL (sal_uLong(0xFFFFFFFF)) -struct SalWheelMouseEvent +struct SalWheelMouseEvent final : public SalAbstractMouseEvent { - sal_uInt64 mnTime; // Time in ms, when event is created - long mnX; // X-Position (Pixel, TopLeft-Output) - long mnY; // Y-Position (Pixel, TopLeft-Output) long mnDelta; // Number of rotations long mnNotchDelta; // Number of fixed rotations double mnScrollLines; // Actual number of lines to scroll - sal_uInt16 mnCode; // SV-Modifiercode (KEY_SHIFT|KEY_MOD1|KEY_MOD2|MOUSE_LEFT|MOUSE_MIDDLE|MOUSE_RIGHT) bool mbHorz; // Horizontal bool mbDeltaIsPixel; // delta value is a pixel value (on touch devices) SalWheelMouseEvent() - : mnTime( 0 ), mnX( 0 ), mnY( 0 ), mnDelta( 0 ), mnNotchDelta( 0 ), mnScrollLines( 0 ), mnCode( 0 ), mbHorz( false ), mbDeltaIsPixel( false ) + : mnDelta(0), mnNotchDelta(0), mnScrollLines(0), mbHorz(false), mbDeltaIsPixel(false) {} }; diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index a246a975a3d5..5b24c04b9b9a 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2598,7 +2598,7 @@ Bool compressWheelEvents( Display*, XEvent* event, XPointer p ) bool X11SalFrame::HandleMouseEvent( XEvent *pEvent ) { - SalMouseEvent aMouseEvt = {0, 0, 0, 0, 0}; + SalMouseEvent aMouseEvt; SalEvent nEvent = SalEvent::NONE; bool bClosePopups = false; |