From: dongsug.song Date: Tue, 29 May 2018 08:59:34 +0000 (+0900) Subject: Add GetMouseButton to identify right/left mouse button click X-Git-Tag: dali_1.3.31~1^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=3e8f9461bebd667af2c12e9fd9c3dd10b6e23454 Add GetMouseButton to identify right/left mouse button click Change-Id: I7948b1cf98a3a140d0162777f7105e6e889d575a Signed-off-by: dongsug.song --- diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp old mode 100644 new mode 100755 index a4306c7..bcb08cc --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp @@ -30,6 +30,7 @@ // EXTERNAL_HEADERS #include +#include #include #include #include @@ -863,22 +864,25 @@ void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event ) if( touchEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) ) { - PointState::Type state ( PointState::DOWN ); - - // Check if the buttons field is set and ensure it's the primary touch button. - // If this event was triggered by buttons other than the primary button (used for touch), then - // just send an interrupted event to Core. - if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) ) - { - state = PointState::INTERRUPTED; - } - Device::Class::Type deviceClass; Device::Subclass::Type deviceSubclass; GetDeviceClass( ecore_device_class_get( touchEvent->dev ), deviceClass ); GetDeviceSubclass( ecore_device_subclass_get( touchEvent->dev ), deviceSubclass ); + PointState::Type state ( PointState::DOWN ); + + if( deviceClass != Device::Class::Type::MOUSE ) + { + // Check if the buttons field is set and ensure it's the primary touch button. + // If this event was triggered by buttons other than the primary button (used for touch), then + // just send an interrupted event to Core. + if( touchEvent->buttons && (touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) ) + { + state = PointState::INTERRUPTED; + } + } + Integration::Point point; point.SetDeviceId( touchEvent->multi.device ); point.SetState( state ); @@ -888,6 +892,7 @@ void WindowBaseEcoreWl2::OnMouseButtonDown( void* data, int type, void* event ) point.SetAngle( Degree( touchEvent->multi.angle ) ); point.SetDeviceClass( deviceClass ); point.SetDeviceSubclass( deviceSubclass ); + point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) ); mTouchEventSignal.Emit( point, touchEvent->timestamp ); } @@ -914,6 +919,7 @@ void WindowBaseEcoreWl2::OnMouseButtonUp( void* data, int type, void* event ) point.SetAngle( Degree( touchEvent->multi.angle ) ); point.SetDeviceClass( deviceClass ); point.SetDeviceSubclass( deviceSubclass ); + point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) ); mTouchEventSignal.Emit( point, touchEvent->timestamp ); } diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp old mode 100644 new mode 100755 index e4b5975..639a334 --- a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp +++ b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp @@ -29,6 +29,7 @@ // EXTERNAL_HEADERS #include +#include #include #include @@ -439,14 +440,6 @@ void WindowBaseEcoreX::OnMouseButtonDown( void* data, int type, void* event ) { PointState::Type state ( PointState::DOWN ); - // Check if the buttons field is set and ensure it's the primary touch button. - // If this event was triggered by buttons other than the primary button (used for touch), then - // just send an interrupted event to Core. - if( touchEvent->buttons && ( touchEvent->buttons != PRIMARY_TOUCH_BUTTON_ID ) ) - { - state = PointState::INTERRUPTED; - } - Integration::Point point; point.SetDeviceId( touchEvent->multi.device ); point.SetState( state ); @@ -454,6 +447,10 @@ void WindowBaseEcoreX::OnMouseButtonDown( void* data, int type, void* event ) point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) ); point.SetPressure( touchEvent->multi.pressure ); point.SetAngle( Degree( touchEvent->multi.angle ) ); + if( touchEvent->buttons) + { + point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) ); + } mTouchEventSignal.Emit( point, touchEvent->timestamp ); } @@ -472,6 +469,10 @@ void WindowBaseEcoreX::OnMouseButtonUp( void* data, int type, void* event ) point.SetRadius( touchEvent->multi.radius, Vector2( touchEvent->multi.radius_x, touchEvent->multi.radius_y ) ); point.SetPressure( touchEvent->multi.pressure ); point.SetAngle( Degree( touchEvent->multi.angle ) ); + if( touchEvent->buttons) + { + point.SetMouseButton( static_cast< MouseButton::Type >( touchEvent->buttons) ); + } mTouchEventSignal.Emit( point, touchEvent->timestamp ); }