MouseInOutEvent occurs when the mouse enters or leaves the window.
Change-Id: Iadf73d6755c9deabd1c26ddfeb6c410d5ec5c383
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
END_TEST;
}
+
+int UtcDaliWindowMouseInOutSignalNegative(void)
+{
+ Dali::Window instance;
+ try
+ {
+ DevelWindow::MouseInOutEventSignal(instance);
+ DALI_TEST_CHECK(false); // Should not get here
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(true); // We expect an assert
+ }
+ END_TEST;
+}
--- /dev/null
+#ifndef DALI_WINDOW_DEVEL_MOUSE_IN_OUT_EVENT_H
+#define DALI_WINDOW_DEVEL_MOUSE_IN_OUT_EVENT_H
+
+/*
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/events/device.h>
+#include <dali/public-api/math/vector2.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
+namespace Dali
+{
+namespace DevelWindow
+{
+/**
+ * @brief MouseInOutEvent occurs when the mouse enters or leaves the window.
+ *
+ * A signal is emitted whenever the mouse enters or leaves the window.
+ */
+struct DALI_ADAPTOR_API MouseInOutEvent
+{
+ enum class Type
+ {
+ NONE = 0,
+ IN,
+ OUT
+ };
+
+ /**
+ * @brief Constructor which creates a MouseInOutEvent instance
+ * @param[in] type The type of the event.
+ * @param[in] modifiers The modifier keys pressed during the event (such as shift, alt and control).
+ * @param[in] point The co-ordinates of the cursor relative to the top-left of the screen
+ * @param[in] timeStamp The time when the event being started.
+ * @param[in] deviceClass The device class the event originated from.
+ * @param[in] deviceSubclass The device subclass the event originated from.
+ */
+ MouseInOutEvent(Type type, uint32_t modifiers, Vector2 point, uint32_t timeStamp, const Device::Class::Type deviceClass, const Device::Subclass::Type deviceSubclass)
+ : type(type),
+ modifiers(modifiers),
+ point(point),
+ timeStamp(timeStamp),
+ deviceClass(deviceClass),
+ deviceSubclass(deviceSubclass)
+ {
+ }
+
+ Type type;
+ uint32_t modifiers;
+ Vector2 point;
+ uint32_t timeStamp;
+ const Device::Class::Type deviceClass;
+ const Device::Subclass::Type deviceSubclass;
+};
+
+} // namespace DevelWindow
+
+} // namespace Dali
+
+#endif // DALI_WINDOW_DEVEL_MOUSE_IN_OUT_EVENT_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return GetImplementation(window).InterceptKeyEventSignal();
}
+MouseInOutEventSignalType& MouseInOutEventSignal(Window window)
+{
+ return GetImplementation(window).MouseInOutEventSignal();
+}
+
} // namespace DevelWindow
} // namespace Dali
#define DALI_WINDOW_DEVEL_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <memory>
// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/mouse-in-out-event.h>
#include <dali/public-api/adaptor-framework/window-enumerations.h>
#include <dali/public-api/adaptor-framework/window.h>
#include <dali/public-api/common/vector-wrapper.h>
typedef Signal<bool(const KeyEvent&)> InterceptKeyEventSignalType; ///< Intercept Key event signal type
typedef Signal<void(Window, Dali::Window::WindowPosition)> MovedSignalType; ///< Window Moved signal type
typedef Signal<void(Window, Dali::WindowOrientation)> OrientationChangedSignalType; ///< Window orientation changed signal type
+typedef Signal<void(Window, const Dali::DevelWindow::MouseInOutEvent&)> MouseInOutEventSignalType; ///< MouseInOutEvent signal type
/**
* @brief Creates an initialized handle to a new Window.
*/
DALI_ADAPTOR_API OrientationChangedSignalType& OrientationChangedSignal(Window window);
+/**
+ * @brief This signal is emitted when the mouse in or out event is received.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName( Window window, Dali::MouseInOutEvent event );
+ * @endcode
+ *
+ * @param[in] window The window instance.
+ * @return The signal to connect to
+ */
+DALI_ADAPTOR_API MouseInOutEventSignalType& MouseInOutEventSignal(Window window);
+
} // namespace DevelWindow
} // namespace Dali
${adaptor_devel_api_dir}/adaptor-framework/input-method-options.h
${adaptor_devel_api_dir}/adaptor-framework/keyboard.h
${adaptor_devel_api_dir}/adaptor-framework/lifecycle-controller.h
+ ${adaptor_devel_api_dir}/adaptor-framework/mouse-in-out-event.h
${adaptor_devel_api_dir}/adaptor-framework/native-image-source-devel.h
${adaptor_devel_api_dir}/adaptor-framework/native-image-source-queue.h
${adaptor_devel_api_dir}/adaptor-framework/orientation.h
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
mTransitionEffectEventSignal(),
mKeyboardRepeatSettingsChangedSignal(),
mUpdatePositionSizeSignal(),
- mAuxiliaryMessageSignal()
+ mAuxiliaryMessageSignal(),
+ mMouseInOutEventSignal()
{
}
return mAuxiliaryMessageSignal;
}
+WindowBase::MouseInOutEventSignalType& WindowBase::MouseInOutEventSignal()
+{
+ return mMouseInOutEventSignal;
+}
+
} // namespace Adaptor
} // namespace Internal
#define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_BASE_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <vector>
// INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/mouse-in-out-event.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/internal/graphics/gles/egl-implementation.h>
#include <dali/internal/window-system/common/damage-observer.h>
};
// Window
- typedef Signal<void(bool)> IconifySignalType;
- typedef Signal<void(bool)> MaximizeSignalType;
- typedef Signal<void(bool)> FocusSignalType;
- typedef Signal<void()> OutputSignalType;
- typedef Signal<void()> DeleteSignalType;
- typedef Signal<void(const DamageArea&)> DamageSignalType;
- typedef Signal<void(const RotationEvent&)> RotationSignalType;
- typedef Signal<void(WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType;
- typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType;
- typedef Signal<void()> WindowRedrawRequestSignalType;
- typedef Signal<void(Dali::PositionSize&)> UpdatePositionSizeType;
- typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType;
+ typedef Signal<void(bool)> IconifySignalType;
+ typedef Signal<void(bool)> MaximizeSignalType;
+ typedef Signal<void(bool)> FocusSignalType;
+ typedef Signal<void()> OutputSignalType;
+ typedef Signal<void()> DeleteSignalType;
+ typedef Signal<void(const DamageArea&)> DamageSignalType;
+ typedef Signal<void(const RotationEvent&)> RotationSignalType;
+ typedef Signal<void(WindowEffectState, WindowEffectType)> TransitionEffectEventSignalType;
+ typedef Signal<void()> KeyboardRepeatSettingsChangedSignalType;
+ typedef Signal<void()> WindowRedrawRequestSignalType;
+ typedef Signal<void(Dali::PositionSize&)> UpdatePositionSizeType;
+ typedef Signal<void(const std::string&, const std::string&, const Property::Array&)> AuxiliaryMessageSignalType;
+ typedef Signal<void(const Dali::DevelWindow::MouseInOutEvent&)> MouseInOutEventSignalType;
// Input events
typedef Signal<void(Integration::Point&, uint32_t)> TouchEventSignalType;
typedef Signal<void(void*)> SelectionSignalType;
// Accessibility
- typedef Signal<void(StyleChange::Type)> StyleSignalType;
+ typedef Signal<void(StyleChange::Type)> StyleSignalType;
/**
* @brief Default constructor
*/
AuxiliaryMessageSignalType& AuxiliaryMessageSignal();
+ /**
+ * @brief This signal is emitted when a mouse in or out event is recevied.
+ */
+ MouseInOutEventSignalType& MouseInOutEventSignal();
+
protected:
// Undefined
WindowBase(const WindowBase&) = delete;
WindowRedrawRequestSignalType mWindowRedrawRequestSignal;
UpdatePositionSizeType mUpdatePositionSizeSignal;
AuxiliaryMessageSignalType mAuxiliaryMessageSignal;
+ MouseInOutEventSignalType mMouseInOutEventSignal;
};
} // namespace Adaptor
mAuxiliaryMessageSignal(),
mMovedSignal(),
mOrientationChangedSignal(),
+ mMouseInOutEventSignal(),
mLastKeyEvent(),
mLastTouchEvent(),
mIsTransparent(false),
mWindowBase->WindowRedrawRequestSignal().Connect(this, &Window::OnWindowRedrawRequest);
mWindowBase->UpdatePositionSizeSignal().Connect(this, &Window::OnUpdatePositionSize);
mWindowBase->AuxiliaryMessageSignal().Connect(this, &Window::OnAuxiliaryMessage);
+ mWindowBase->MouseInOutEventSignal().Connect(this, &Window::OnMouseInOutEvent);
mWindowSurface->OutputTransformedSignal().Connect(this, &Window::OnOutputTransformed);
mWindowSurface->RotationFinishedSignal().Connect(this, &Window::OnRotationFinished);
FeedKeyEvent(keyEvent);
}
+void Window::OnMouseInOutEvent(const Dali::DevelWindow::MouseInOutEvent& mouseInOutEvent)
+{
+ Dali::Window handle(this);
+
+ mMouseInOutEventSignal.Emit(handle, mouseInOutEvent);
+}
+
void Window::OnRotation(const RotationEvent& rotation)
{
PositionSize newPositionSize(rotation.x, rotation.y, rotation.width, rotation.height);
class WindowBase;
class Window;
-using WindowPtr = IntrusivePtr<Window>;
-using OrientationPtr = IntrusivePtr<Orientation>;
-using EventHandlerPtr = IntrusivePtr<EventHandler>;
+using WindowPtr = IntrusivePtr<Window>;
+using OrientationPtr = IntrusivePtr<Orientation>;
+using MouseInOutEventPtr = IntrusivePtr<Dali::DevelWindow::MouseInOutEvent>;
+using EventHandlerPtr = IntrusivePtr<EventHandler>;
/**
* Window provides a surface to render onto with orientation & indicator properties.
typedef Dali::DevelWindow::AccessibilityHighlightSignalType AccessibilityHighlightSignalType;
typedef Dali::DevelWindow::MovedSignalType MovedSignalType;
typedef Dali::DevelWindow::OrientationChangedSignalType OrientationChangedSignalType;
+ typedef Dali::DevelWindow::MouseInOutEventSignalType MouseInOutEventSignalType;
typedef Signal<void()> SignalType;
/**
*
* @param[in] renderNotification to use
*/
- void SetRenderNotification(TriggerEventInterface *renderNotification);
+ void SetRenderNotification(TriggerEventInterface* renderNotification);
public: // Dali::Internal::Adaptor::SceneHolder
/**
void OnRotationFinished();
/**
+ * @brief Called when the mouse in or out event is received.
+ * @param[in] mouseInOutEvent the mouse event
+ */
+ void OnMouseInOutEvent(const Dali::DevelWindow::MouseInOutEvent& mouseInOutEvent);
+
+ /**
* @brief Set available orientation to window base.
*/
void SetAvailableAnlges(const std::vector<int>& angles);
return mOrientationChangedSignal;
}
+ /**
+ * @copydoc Dali::DevelWindow::MouseInOutEventSignal()
+ */
+ MouseInOutEventSignalType& MouseInOutEventSignal()
+ {
+ return mMouseInOutEventSignal;
+ }
+
private:
WindowRenderSurface* mWindowSurface; ///< The window rendering surface
WindowBase* mWindowBase;
AccessibilityHighlightSignalType mAccessibilityHighlightSignal;
MovedSignalType mMovedSignal;
OrientationChangedSignalType mOrientationChangedSignal;
+ MouseInOutEventSignalType mMouseInOutEventSignal;
Dali::KeyEvent mLastKeyEvent;
Dali::TouchEvent mLastTouchEvent;
}
/**
+ * Called when a mouse in is received.
+ */
+static Eina_Bool EcoreEventMouseIn(void* data, int type, void* event)
+{
+ WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+ if(windowBase)
+ {
+ windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::IN);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when a mouse out is received.
+ */
+static Eina_Bool EcoreEventMouseOut(void* data, int type, void* event)
+{
+ WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+ if(windowBase)
+ {
+ windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::OUT);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
* Called when a detent rotation event is recevied.
*/
static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
// Register Mouse wheel events
mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
+ // Register Mouse IO events
+ mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, EcoreEventMouseIn, this));
+ mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, EcoreEventMouseOut, this));
+
// Register Detent event
mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
}
}
+void WindowBaseEcoreWl2::OnMouseInOut(void* data, int type, void* event, Dali::DevelWindow::MouseInOutEvent::Type action)
+{
+ Ecore_Event_Mouse_IO* mouseInOutEvent = static_cast<Ecore_Event_Mouse_IO*>(event);
+
+ if(mouseInOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
+ {
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_IN_OUT");
+
+ DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseInOut: timestamp: %d, modifiers: %d, x: %d, y: %d\n", mouseInOutEvent->timestamp, mouseInOutEvent->modifiers, mouseInOutEvent->x, mouseInOutEvent->y);
+
+ Device::Class::Type deviceClass;
+ Device::Subclass::Type deviceSubclass;
+
+ GetDeviceClass(ecore_device_class_get(mouseInOutEvent->dev), deviceClass);
+ GetDeviceSubclass(ecore_device_subclass_get(mouseInOutEvent->dev), deviceSubclass);
+
+ Dali::DevelWindow::MouseInOutEvent inOutEvent(action, mouseInOutEvent->modifiers, Vector2(mouseInOutEvent->x, mouseInOutEvent->y), mouseInOutEvent->timestamp, deviceClass, deviceSubclass);
+
+ mMouseInOutEventSignal.Emit(inOutEvent);
+ }
+}
+
void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
{
Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
#define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_WINDOW_BASE_ECORE_WL2_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void OnMouseWheel(void* data, int type, void* event);
/**
+ * @brief Called when a mouse in or out is received.
+ */
+ void OnMouseInOut(void* data, int type, void* event, Dali::DevelWindow::MouseInOutEvent::Type action);
+
+ /**
* @brief Called when a detent rotation event is recevied.
*/
void OnDetentRotation(void* data, int type, void* event);
*/
void MoveResize(PositionSize positionSize) override;
- /**
+ /**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetLayout()
*/
void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) override;
*/
PositionSize RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize);
-
/**
* @brief Return the rect value to recalulate with the default system coordinates.
*