#include "DSCompositor.h"
#include "DSWaylandSeat.h"
#include "DSWaylandCompositor.h"
+#include "DSInputEvent.h"
namespace display_server
{
+
DSSeat::DSSeat()
: __input(nullptr),
__keyboard(nullptr),
__input->registerCallbackDeviceAdd(this, std::bind(&DSSeat::slotDeviceAdd, this, std::placeholders::_1));
__input->registerCallbackDeviceRemove(this, std::bind(&DSSeat::slotDeviceRemove, this, std::placeholders::_1));
+ __input->registerCallbackKeyDown(this, inputEventHandlerKey);
+ __input->registerCallbackKeyUp(this, inputEventHandlerKey);
+ __input->registerCallbackMouseDown(this, inputEventHandlerMouse);
+ __input->registerCallbackMouseMove(this, inputEventHandlerMouse);
+ __input->registerCallbackMouseUp(this, inputEventHandlerMouse);
+ __input->registerCallbackTouchDown(this, inputEventHandlerTouch);
+ __input->registerCallbackTouchMove(this, inputEventHandlerTouch);
+ __input->registerCallbackTouchUp(this, inputEventHandlerTouch);
__input->init();
}
__dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
}
+Eina_Bool DSSeat::inputEventHandlerKey(void *data, int type, void *event)
+{
+ //DSSeat *seat = static_cast< DSSeat* >(data);
+ DSInputKeyboardEvent *ev = static_cast< DSInputKeyboardEvent* >(event);
+ std::string typeString;
+
+ if (ev->getType() == DSInputEvent::KeyDownEvent)
+ typeString = "down";
+ else
+ typeString = "up";
+
+ DSLOG_DBG("DSSeat", "[key%s] keycode: %d, devicename: %s\n", typeString.c_str(), ev->getKeycode(), ev->getDevice()->getName().c_str());
+
+ return EINA_TRUE;
+}
+
+Eina_Bool DSSeat::inputEventHandlerMouse(void *data, int type, void *event)
+{
+ //DSSeat *seat = static_cast< DSSeat* >(data);
+ DSInputMouseEvent *ev = static_cast< DSInputMouseEvent* >(event);
+ std::string typeString;
+
+ if (ev->getType() == DSInputEvent::MouseDownEvent)
+ typeString = "down";
+ else if (ev->getType() == DSInputEvent::MouseMoveEvent)
+ typeString = "move";
+ else
+ typeString = "up";
+
+ DSLOG_DBG("DSSeat", "[mouse%s] button: %d (%d, %d, %d), devicename: %s\n", typeString.c_str(), ev->getButton(), ev->getX(), ev->getY(), ev->getZ(), ev->getDevice()->getName().c_str());
+
+ return EINA_TRUE;
+}
+
+Eina_Bool DSSeat::inputEventHandlerTouch(void *data, int type, void *event)
+{
+ //DSSeat *seat = static_cast< DSSeat* >(data);
+ DSInputTouchEvent *ev = static_cast< DSInputTouchEvent* >(event);
+ std::string typeString;
+
+ if (ev->getType() == DSInputEvent::TouchDownEvent)
+ typeString = "down";
+ else if (ev->getType() == DSInputEvent::TouchMoveEvent)
+ typeString = "move";
+ else
+ typeString = "up";
+
+ DSLOG_DBG("DSSeat", "[touch%s] index: %d (%d, %d), devicename: %s\n", typeString.c_str(), ev->getIndex(), ev->getX(), ev->getY(), ev->getDevice()->getName().c_str());
+
+ return EINA_TRUE;
+}
+
+
} // namespace display_server
+