#include "DSInputEvent.h"
#include "DSWaylandPointer.h"
#include "DSWaylandSurface.h"
+#include "DSStruct.h"
namespace display_server
{
DSLOG_ERR("DSPointer", "No ptrFocus available.");
return;
}
+
+ if (ev->getType() == DSInputEvent::MouseInEvent)
+ {
+ DSLOG_DBG("DSTouch", "[mouseIn] devicename: %s, timestamp: %u\n",
+ ev->getDevice()->getName().c_str(), ev->getTimestamp());
+ mouseIn(ev->getX(), ev->getY());
+ }
+ else if (ev->getType() == DSInputEvent::MouseOutEvent)
+ {
+ DSLOG_DBG("DSTouch", "[mouseOut] devicename: %s, timestamp: %u\n",
+ ev->getDevice()->getName().c_str(), ev->getTimestamp());
+ mouseOut();
+ }
+ else if (ev->getType() == DSInputEvent::MouseDownEvent)
+ {
+ DSLOG_DBG("DSTouch", "[MouseDown] devicename: %s, timestamp: %u\n",
+ ev->getDevice()->getName().c_str(), ev->getTimestamp());
+ mouseDown(ev->getButton());
+ }
+ else if (ev->getType() == DSInputEvent::MouseMoveEvent)
+ {
+ DSLOG_DBG("DSTouch", "[mouseMove] devicename: %s, timestamp: %u\n",
+ ev->getDevice()->getName().c_str(), ev->getTimestamp());
+ mouseMove(ev->getX(), ev->getY());
+ }
+ else if (ev->getType() == DSInputEvent::MouseUpEvent)
+ {
+ DSLOG_DBG("DSTouch", "[mouseUp] devicename: %s, timestamp: %u\n",
+ ev->getDevice()->getName().c_str(), ev->getTimestamp());
+ mouseUp(ev->getButton());
+ }
+ else
+ {
+ DSLOG_INF("DSPointer", "Event type %d won't be handled right now.", ev->getType());
+ return;
+ }
+}
+
+void DSPointer::mouseDown(uint32_t button)
+{
+ if (__dswlPointer)
+ {
+ __dswlPointer->sendButtonDown(button);
+ }
+}
+
+void DSPointer::mouseUp(uint32_t button)
+{
+ if (__dswlPointer)
+ {
+ __dswlPointer->sendButtonUp(button);
+ }
+}
+
+void DSPointer::mouseMove(int x, int y)
+{
+ if (__dswlPointer)
+ {
+ __dswlPointer->sendMotion(x, y);
+ }
+}
+
+void DSPointer::mouseIn(int x, int y)
+{
+ if (__dswlPointer)
+ {
+ __dswlPointer->sendEnter(x, y);
+ }
+}
+
+void DSPointer::mouseOut()
+{
+ if (__dswlPointer)
+ {
+ __dswlPointer->sendLeave();
+ }
}
void DSPointer::setFocus(std::shared_ptr<DSWindow> window)
{
if (!window)
{
- DSLOG_ERR("DSPointer", "Given window is INVALID. (window : %p)", window);
+ DSLOG_ERR("DSPointer", "__ptrFocus has been changed (%p -> %p)", __ptrFocus, window);
+ __ptrFocus = window;
+ if (__dswlPointer)
+ __dswlPointer->setFocus(nullptr);
return;
}