pub->deviceRemove(name, identifier, devClass, DSInput::NoneSubclass);
}
+void DSInputPrivate::PostKeyboardEvent(int keycode, bool pressed, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ DS_GET_PUB(DSInput);
+
+ if (pressed)
+ pub->keyDown(keycode, devIdentifier, devClass);
+ else
+ pub->keyUp(keycode, devIdentifier, devClass);
+}
+
+void DSInputPrivate::PostPointerEvent(int button, int x, int y, int z, DSInputEvent::Type type, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ DS_GET_PUB(DSInput);
+
+ if (type == DSInputEvent::MouseDownEvent)
+ pub->mouseDown(button, x, y, z, devIdentifier, devClass);
+ else if (type == DSInputEvent::MouseMoveEvent)
+ pub->mouseMove(button, x, y, z, devIdentifier, devClass);
+ else if (type == DSInputEvent::MouseUpEvent)
+ pub->mouseUp(button, x, y, z, devIdentifier, devClass);
+}
+
+void DSInputPrivate::PostTouchEvent(int index, int x, int y, DSInputEvent::Type type, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ DS_GET_PUB(DSInput);
+
+ if (type == DSInputEvent::TouchDownEvent)
+ pub->touchDown(index, x, y, devIdentifier, devClass);
+ else if (type == DSInputEvent::TouchMoveEvent)
+ pub->touchMove(index, x, y, devIdentifier, devClass);
+ else if (type == DSInputEvent::TouchUpEvent)
+ pub->touchUp(index, x, y, devIdentifier, devClass);
+}
+
+
DSInput::DSInput()
: DS_INIT_PRIVATE_PTR(DSInput),
__seat(nullptr)
delete device;
}
+void DSInput::keyDown(int keycode, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ std::cout << "[keyDown] keycode: " << keycode << ", identifier: " << devIdentifier << std::endl;
+}
+
+void DSInput::keyUp(int keycode, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ std::cout << "[keyUp] keycode: " << keycode << ", identifier: " << devIdentifier << std::endl;
+}
+
+void DSInput::mouseDown(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ std::cout << "[mouseDown] button: " << button << " (" << x << ", " << y << "), " << ", identifier: " << devIdentifier << std::endl;
+}
+
+void DSInput::mouseMove(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ std::cout << "[mouseMove] button: " << button << " (" << x << ", " << y << "), " << ", identifier: " << devIdentifier << std::endl;
+}
+
+void DSInput::mouseUp(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ std::cout << "[mouseUp] button: " << button << " (" << x << ", " << y << "), " << ", identifier: " << devIdentifier << std::endl;
+}
+
+void DSInput::touchDown(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ std::cout << "[touchDown] index: " << index << " (" << x << ", " << y << "), " << ", identifier: " << devIdentifier << std::endl;
+}
+
+void DSInput::touchMove(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ std::cout << "[touchMove] index: " << index << " (" << x << ", " << y << "), " << ", identifier: " << devIdentifier << std::endl;
+}
+
+void DSInput::touchUp(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass)
+{
+ std::cout << "[touchUp] index: " << index << " (" << x << ", " << y << "), " << ", identifier: " << devIdentifier << std::endl;
+}
+
+
void DSInput::registerCallbackDeviceAdd(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func)
{
this->__deviceAddSignal.connect(slot, func);
this->__deviceRemoveSignal.connect(slot, func);
}
+void DSInput::registerCallbackKeyDown(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func)
+{
+}
+
+void DSInput::registerCallbackKeyUp(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func)
+{
+}
+
+void DSInput::registerCallbackMouseDown(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func)
+{
+}
+
+void DSInput::registerCallbackMouseMove(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func)
+{
+}
+
+void DSInput::registerCallbackMouseUp(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func)
+{
+}
+
+void DSInput::registerCallbackTouchDown(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func)
+{
+}
+
+void DSInput::registerCallbackTouchMove(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func)
+{
+}
+
+void DSInput::registerCallbackTouchUp(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func)
+{
+}
+
DSInputDevice::DSInputDevice()
: __deviceName(""),
#include <DSSignal.h>
#include <functional>
+#include <Ecore.h>
+
namespace display_server
{
void deviceAdd(std::string name, std::string identifier, DSInput::DeviceClass devClass, DSInput::DeviceSubclass devSubclass);
void deviceRemove(std::string name, std::string identifier, DSInput::DeviceClass devClass, DSInput::DeviceSubclass devSubclass);
+ void keyDown(int keycode, std::string devIdentifier, DSInput::DeviceClass devClass);
+ void keyUp(int keycode, std::string devIdentifier, DSInput::DeviceClass devClass);
+ void mouseDown(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass);
+ void mouseMove(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass);
+ void mouseUp(int button, int x, int y, int z, std::string devIdentifier, DSInput::DeviceClass devClass);
+ void touchDown(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass);
+ void touchMove(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass);
+ void touchUp(int index, int x, int y, std::string devIdentifier, DSInput::DeviceClass devClass);
void registerCallbackDeviceAdd(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func);
void registerCallbackDeviceRemove(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func);
+ void registerCallbackKeyDown(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func);
+ void registerCallbackKeyUp(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func);
+ void registerCallbackMouseDown(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func);
+ void registerCallbackMouseMove(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func);
+ void registerCallbackMouseUp(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func);
+ void registerCallbackTouchDown(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func);
+ void registerCallbackTouchMove(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func);
+ void registerCallbackTouchUp(DSObject *slot, std::function<Eina_Bool(void *,int,void *)> func);
private:
DSSeat* __seat;
MouseWheelEvent,
MouseHWheelEvent,
TouchDownEvent,
- TOuchMoveEvent,
+ TouchMoveEvent,
TouchUpEvent
};
#include "DSInput.h"
#include "DSLibinput.h"
+#include "DSInputEvent.h"
namespace display_server
{
void PostDeviceAddEvent(std::string seat, std::string name, std::string identifier, DSInput::DeviceClass devClass);
void PostDeviceRemoveEvent(std::string seat, std::string name, std::string identifier, DSInput::DeviceClass devClass);
+ void PostKeyboardEvent(int keycode, bool pressed, std::string devIdentifier, DSInput::DeviceClass devClass);
+ void PostPointerEvent(int button, int x, int y, int z, DSInputEvent::Type type, std::string devIdentifier, DSInput::DeviceClass devClass);
+ void PostTouchEvent(int index, int x, int y, DSInputEvent::Type type, std::string devIdentifier, DSInput::DeviceClass devClass);
private:
DSLibinput *__dsLibinput;
}
}
-void DSLibinput::__processKeyboardKeyEvent(struct ::libinput_event *event)
+void DSLibinput::__processKeyboardKeyEvent(struct:: libinput_event *event)
{
- ;
+ struct:: libinput_event_keyboard *keyboard_event = libinput_event_get_keyboard_event(event);
+ int keycode = libinput_event_keyboard_get_key(keyboard_event) + 8;
+ int state = libinput_event_keyboard_get_key_state(keyboard_event);
+ bool pressed;
+ if (state == LIBINPUT_KEY_STATE_PRESSED) pressed = true;
+ else pressed = false;
+
+ struct ::libinput_device *device = libinput_event_get_device(event);
+ std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
+
+ inputPrivate->PostKeyboardEvent(keycode, pressed, identifier, DSInput::KeyboardClass);
}
void DSLibinput::__processPointerMotionEvent(struct ::libinput_event *event)
{
- ;
+ struct:: libinput_event_pointer *pointer_event = libinput_event_get_pointer_event(event);
+ int dx, dy;
+
+ struct ::libinput_device *device = libinput_event_get_device(event);
+ std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
+
+ dx = libinput_event_pointer_get_dx(pointer_event);
+ dy = libinput_event_pointer_get_dy(pointer_event);
+
+ inputPrivate->PostPointerEvent(0, dx, dy, 0, DSInputEvent::MouseMoveEvent, identifier, DSInput::PointerClass);
}
void DSLibinput::__processPointerMotionAbsoluteEvent(struct ::libinput_event *event)
void DSLibinput::__processPointerButtonEvent(struct ::libinput_event *event)
{
- ;
+ struct:: libinput_event_pointer *pointer_event = libinput_event_get_pointer_event(event);
+ DSInputEvent::Type eventType;
+ int button;
+ int state;
+
+ struct ::libinput_device *device = libinput_event_get_device(event);
+ std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
+
+ button = libinput_event_pointer_get_button(pointer_event);
+ state = libinput_event_pointer_get_button_state(pointer_event);
+
+ if (state)
+ eventType = DSInputEvent::MouseDownEvent;
+ else
+ eventType = DSInputEvent::MouseUpEvent;
+
+ inputPrivate->PostPointerEvent(button, 0, 0, 0, eventType, identifier, DSInput::PointerClass);
}
void DSLibinput::__processPointerAxisEvent(struct ::libinput_event *event)
void DSLibinput::__processTouchDownEvent(struct ::libinput_event *event)
{
- ;
+ struct:: libinput_event_touch *touch_event = libinput_event_get_touch_event(event);
+ int index, x, y;
+
+ struct ::libinput_device *device = libinput_event_get_device(event);
+ std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
+
+ index = libinput_event_touch_get_slot(touch_event);
+ x = libinput_event_touch_get_x(touch_event);
+ y = libinput_event_touch_get_y(touch_event);
+
+ inputPrivate->PostTouchEvent(index, x, y, DSInputEvent::TouchDownEvent, identifier, DSInput::TouchClass);
}
void DSLibinput::__processTouchMotionEvent(struct ::libinput_event *event)
{
- ;
+ struct:: libinput_event_touch *touch_event = libinput_event_get_touch_event(event);
+ int index, x, y;
+
+ struct ::libinput_device *device = libinput_event_get_device(event);
+ std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
+
+ index = libinput_event_touch_get_slot(touch_event);
+ x = libinput_event_touch_get_x(touch_event);
+ y = libinput_event_touch_get_y(touch_event);
+
+ inputPrivate->PostTouchEvent(index, x, y, DSInputEvent::TouchMoveEvent, identifier, DSInput::TouchClass);
}
void DSLibinput::__processTouchUpEvent(struct ::libinput_event *event)
{
- ;
+ struct:: libinput_event_touch *touch_event = libinput_event_get_touch_event(event);
+ int index, x, y;
+
+ struct ::libinput_device *device = libinput_event_get_device(event);
+ std::string identifier = (std::string)"/dev/input/" + (std::string)libinput_device_get_sysname(device);
+
+ index = libinput_event_touch_get_slot(touch_event);
+ x = 0;
+ y = 0;
+
+ inputPrivate->PostTouchEvent(index, x, y, DSInputEvent::TouchUpEvent, identifier, DSInput::TouchClass);
}
void DSLibinput::__processTouchCancelEvent(struct ::libinput_event *event)
libds_declared_dep = declare_dependency(
link_with : libds_lib,
- dependencies : libds_deps,
+ dependencies : [libds_deps, ecore_dep],
include_directories : [libds_include_dirs]
)