return true;
}
-void DSCompositorPrivate::__initializeWlDisplay()
+DSWaylandCompositor *DSCompositorPrivate::getWlCompositor()
{
- __wlCompositor->create();
+ return __wlCompositor.get();
}
-DSWaylandCompositor *DSCompositorPrivate::getWlCompositor()
+void DSCompositorPrivate::__initializeWlDisplay()
{
- return __wlCompositor.get();
+ __wlCompositor->create();
}
void DSCompositorPrivate::__initializeOutputs()
#include "DSInput.h"
#include "DSInputPrivate.h"
+#include "DSSeat.h"
namespace display_server
{
DSInputPrivate::~DSInputPrivate()
{
- if (__dsLibinput) delete __dsLibinput;
+ if (__dsLibinput)
+ delete __dsLibinput;
}
void DSInputPrivate::Init()
{
__dsLibinput = new DSLibinput(this);
+ DS_ASSERT(__dsLibinput != nullptr);
}
void DSInputPrivate::PostDeviceAddEvent(std::string seat, std::string name, std::string identifier, DSInput::DeviceClass devClass)
}
DSInput::DSInput()
- : DS_INIT_PRIVATE_PTR(DSInput)
+ : DS_INIT_PRIVATE_PTR(DSInput),
+ __seat(nullptr)
{
}
+DSInput::DSInput(std::shared_ptr<DSSeat> seat)
+ : DS_INIT_PRIVATE_PTR(DSInput),
+ __seat(seat)
+{
+ if (seat == nullptr)
+ {
+ DSLOG_ERR("DSInput", "DSSeat ptr is required.");
+ return;
+ }
+}
+
DSInput::~DSInput()
{
}
-void DSInput::Init()
+void DSInput::init()
{
DS_GET_PRIV(DSInput);
namespace display_server
{
+class DSSeat;
class DSInputPrivate;
class DSInputDevice;
};
public:
DSInput();
+ DSInput(std::shared_ptr<DSSeat> seat);
~DSInput() override;
- void Init();
+ void init();
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 registerCallbackDeviceRemove(DSObject *slot, std::function<void(std::shared_ptr<DSInputDevice>)> func);
private:
+ std::shared_ptr<DSSeat> __seat;
std::list<DSInputDevice*> devList;
DSSignal<std::shared_ptr<DSInputDevice>> __deviceAddSignal;
+#include "DSCore.h"
#include "DSSeat.h"
+#include "DSInput.h"
+#include "DSCompositor.h"
+#include "DSCompositorPrivate.h"
+#include "DSWaylandSeat.h"
+#include "DSWaylandCompositor.h"
namespace display_server
{
: __input(nullptr),
__keyboard(nullptr),
__pointer(nullptr),
- __touch(nullptr)
-{}
+ __touch(nullptr),
+ __dswlSeat(nullptr),
+ __dswlComp(nullptr),
+ __compositor(nullptr),
+ __numPointer(0),
+ __numKeyboard(0),
+ __numTouch(0)
+{
+}
+
+DSSeat::DSSeat(DSCompositor *compositor, std::string name)
+ : __input(nullptr),
+ __keyboard(nullptr),
+ __pointer(nullptr),
+ __touch(nullptr),
+ __dswlSeat(nullptr),
+ __dswlComp(nullptr),
+ __compositor(compositor),
+ __numPointer(0),
+ __numKeyboard(0),
+ __numTouch(0)
+{
+ if (!compositor)
+ return;
+
+ DSCompositorPrivate *compPriv = DSCompositorPrivate::getPrivate(compositor);
+ DS_ASSERT(compPriv != nullptr);
+
+ __dswlComp = compPriv->getWlCompositor();
+ DS_ASSERT(__dswlComp != nullptr);
+
+ __dswlSeat = __dswlComp->addSeat(DSWaylandSeat::capNone);
+ DS_ASSERT(__dswlSeat != nullptr);
+
+ if (!name.empty())
+ __dswlSeat->setName(name);
+}
DSSeat::~DSSeat()
-{}
+{
+ if (__dswlComp && __dswlSeat)
+ __dswlComp->removeSeat(__dswlSeat);
+}
bool DSSeat::addInput(std::shared_ptr<DSInput> input)
{
{
std::cout << "DSSeat slotDeviceAdd!" << std::endl;
device->print();
+
+ uint32_t cap = (uint32_t)__dswlSeat->getCapability();
+ bool capNeedUpdate = false;
+
+ if ((device->getClass() == DSInput::PointerClass) && (__numPointer == 0))
+ {
+ __numPointer++;
+ cap = cap | DSWaylandSeat::capPointer;
+ capNeedUpdate = true;
+ }
+ else if ((device->getClass() == DSInput::KeyboardClass) && (__numKeyboard == 0))
+ {
+ __numKeyboard++;
+ cap = cap | DSWaylandSeat::capKeyboard;
+ capNeedUpdate = true;
+ }
+ else if ((device->getClass() == DSInput::TouchClass) && (__numTouch == 0))
+ {
+ __numTouch++;
+ cap = cap | DSWaylandSeat::capTouch;
+ capNeedUpdate = true;
+ }
+
+ if (capNeedUpdate)
+ __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
}
void DSSeat::slotDeviceRemove(std::shared_ptr<DSInputDevice> device)
{
std::cout << "DSSeat slotDeviceRemove!" << std::endl;
device->print();
+
+ uint32_t cap = (uint32_t)__dswlSeat->getCapability();
+ bool capNeedUpdate = false;
+
+ if ((device->getClass() == DSInput::PointerClass) && ((--__numPointer) == 0))
+ {
+ cap = cap & (~DSWaylandSeat::capPointer);
+ capNeedUpdate = true;
+ }
+ else if ((device->getClass() == DSInput::KeyboardClass) && ((--__numKeyboard) == 0))
+ {
+ cap = cap & (~DSWaylandSeat::capKeyboard);
+ capNeedUpdate = true;
+ }
+ else if ((device->getClass() == DSInput::TouchClass) && ((--__numTouch) == 0))
+ {
+ cap = cap & (~DSWaylandSeat::capTouch);
+ capNeedUpdate = true;
+ }
+
+ if (capNeedUpdate)
+ __dswlSeat->setCapability((DSWaylandSeat::seatCapability)cap);
}
} // namespace display_server
\ No newline at end of file
class DSPointer;
class DSTouch;
class DSInputDevice;
+class DSCompositor;
+class DSWaylandSeat;
+class DSWaylandCompositor;
class DSSeat : public DSObject
{
public:
DSSeat();
+ DSSeat(DSCompositor *compositor, std::string name);
virtual ~DSSeat();
bool addInput(std::shared_ptr<DSInput> input);
DSKeyboard *__keyboard;
DSPointer *__pointer;
DSTouch *__touch;
+ DSWaylandSeat *__dswlSeat;
+ DSWaylandCompositor *__dswlComp;
+ DSCompositor *__compositor;
+
+ uint32_t __numPointer;
+ uint32_t __numKeyboard;
+ uint32_t __numTouch;
};
}
#include "DSWaylandCompositor.h"
#include "DSWaylandCompositorPrivate.h"
#include "DSWaylandClient.h"
+#include "DSWaylandSeat.h"
#include "DSWaylandSurface.h"
#include "DSDebugLog.h"
return priv->_created;
}
+DSWaylandSeat *DSWaylandCompositorPrivate::addSeat(uint32_t cap)
+{
+ DSWaylandSeat *dswlSeat = new DSWaylandSeat(_compositor, (DSWaylandSeat::seatCapability)cap);
+
+ if (!dswlSeat)
+ {
+ DSLOG_ERR("DSWaylandCompositorPrivate", "Failed to create DSWaylandSeat !");
+ return nullptr;
+ }
+
+ //TODO : check if the client is in clients already ?
+ _seats.push_back(dswlSeat);
+
+ DSLOG_INF("DSWaylandCompositorPrivate", "Seat(%p) has been added.", dswlSeat);
+
+ //TODO : emit seatAdded signal
+
+ return dswlSeat;
+}
+
+void DSWaylandCompositorPrivate::removeSeat(DSWaylandSeat *dswlSeat)
+{
+ DS_ASSERT(dswlSeat != nullptr);
+
+ //TODO : check if the client is in clients already ?
+ _seats.remove(dswlSeat);
+ DSLOG_INF("DSWaylandCompositorPrivate", "Seat(%p) has been removed.", dswlSeat);
+
+ //TODO : emit seatRemoved signal before deleting a seat;
+ delete dswlSeat;
+}
+
std::string DSWaylandCompositor::socketName()
{
DS_GET_PRIV(DSWaylandCompositor);
return priv->_socketName;
}
-struct wl_display *DSWaylandCompositor::display()
+struct ::wl_display *DSWaylandCompositor::display()
{
DS_GET_PRIV(DSWaylandCompositor);
priv->removeClient(client);
}
-void DSWaylandCompositor::addSeat(DSWaylandSeat *seat)
+DSWaylandSeat *DSWaylandCompositor::addSeat(uint32_t cap)
{
DS_GET_PRIV(DSWaylandCompositor);
- priv->addSeat(seat);
+ return priv->addSeat(cap);
}
void DSWaylandCompositor::removeSeat(DSWaylandSeat *seat)
class DSWaylandSeat;
class DSWaylandSurface;
class DSWaylandCompositorPrivate;
+
class DS_DECL_EXPORT DSWaylandCompositor : public DSObject
{
DS_PIMPL_USE_PRIVATE(DSWaylandCompositor);
void addClient(DSWaylandClient *client);
void removeClient(DSWaylandClient *client);
- void addSeat(DSWaylandSeat *seat);
+ DSWaylandSeat *addSeat(uint32_t cap);
void removeSeat(DSWaylandSeat *seat);
std::string socketName();
- ::wl_display *display();
+ struct ::wl_display *display();
uint32_t nextSerial();
std::list<DSWaylandClient *> clients();
DSWaylandSeat *defaultSeat();
private:
// signals
- DSSignal<std::shared_ptr<DSWaylandSurface>> __surfaceCreatedSignal;
+ DSSignal<std::shared_ptr<DSWaylandSurface>> __surfaceCreatedSignal;
};
}
-#endif //__DS_WAYLAND_COMPOSITOR_H__
\ No newline at end of file
+#endif //__DS_WAYLAND_COMPOSITOR_H__
void initSocket(std::string sName, std::string sDir);
inline void addClient(DSWaylandClient *client);
inline void removeClient(DSWaylandClient *client);
- inline void addSeat(DSWaylandSeat *seat);
- inline void removeSeat(DSWaylandSeat *seat);
+ DSWaylandSeat *addSeat(uint32_t cap);
+ void removeSeat(DSWaylandSeat *seat);
static void client_created_callback(struct ::wl_listener *listener, void *data);
struct ClientCreatedListener : ::wl_listener {
bool _created;
int _socketFD;
std::string _socketName;
- struct wl_display *_display;
+ struct ::wl_display *_display;
wl_event_loop *_loop;
Ecore_Fd_Handler *_socket_fd_handler;
DSWaylandCompositor *_compositor;
DSLOG_INF("DSWaylandCompositorPrivate", "Client(%p, PID:%d) has been removed.", client, client->pid());
}
-void DSWaylandCompositorPrivate::addSeat(DSWaylandSeat *seat)
-{
- DS_ASSERT(seat != nullptr);
-
- //TODO : check if the client is in clients already ?
- _seats.push_back(seat);
-}
-
-void DSWaylandCompositorPrivate::removeSeat(DSWaylandSeat *seat)
-{
- DS_ASSERT(seat != nullptr);
-
- //TODO : check if the client is in clients already ?
- _seats.remove(seat);
-}
-
}
#endif //__DS_WAYLAND_COMPOSITOR_PRIVATE_H__
\ No newline at end of file
#include "DSWaylandSeat.h"
#include "DSWaylandSeatPrivate.h"
+#include "DSWaylandCompositor.h"
+#include "DSWaylandClient.h"
+#include "DSWaylandPointer.h"
+#include "DSWaylandKeyboard.h"
+#include "DSWaylandTouch.h"
namespace display_server
{
: DSObjectPrivate(seat),
__p_ptr(seat),
__cap(DSWaylandSeat::capNone),
- __compositor(compositor)
+ __compositor(compositor),
+ __pointer(nullptr),
+ __keyboard(nullptr),
+ __touch(nullptr)
{
+ if (!compositor)
+ return;
+
+ wl_seat::init(compositor->display(), 4);
}
DSWaylandSeatPrivate::~DSWaylandSeatPrivate()
{
}
+void DSWaylandSeatPrivate::sendCapabilitiesToAllClients(uint32_t cap)
+{
+ auto func = [&](std::pair<struct ::wl_client*, Resource*> res)
+ { wl_seat::send_capabilities(res.second->handle, cap); };
+ auto resMap = resourceMap();
+ std::for_each(resMap.begin(), resMap.end(), func);
+}
+
void DSWaylandSeatPrivate::seat_bind_resource(Resource *resource)
{
+ /* send capabilities */
+ wl_seat::send_capabilities(resource->handle, (uint32_t)__cap);
+
+ /* send seat name */
+ if (!__seatName.empty())
+ wl_seat::send_name(resource->handle, __seatName);
}
void DSWaylandSeatPrivate::seat_destroy_resource(Resource *resource)
{
+ //Nothing to do as wl_seat::destroy_func has removed the resource->handle from m_resource_map
}
void DSWaylandSeatPrivate::seat_get_pointer(Resource *resource, uint32_t id)
{
+ //TODO : add DSWaylandPointer here
+ //TODO : send pointer_enter here if this client equals to top-visible window's client
+ if (!__pointer)
+ return;
+
+ __pointer->addClient(DSWaylandClient::fromWlClient(resource->client()), id, resource->version());
}
void DSWaylandSeatPrivate::seat_get_keyboard(Resource *resource, uint32_t id)
{
+ //TODO : add DSWaylandKeyboard here
+ //TODO : send repeat info to the client
+ //TODO : send keyboard_enter here if this client equals to focus window's client
+ if (!__keyboard)
+ return;
+
+ __keyboard->addClient(DSWaylandClient::fromWlClient(resource->client()), id, resource->version());
}
void DSWaylandSeatPrivate::seat_get_touch(Resource *resource, uint32_t id)
{
+ //TODO : add DSWaylandTouch here
+ if (!__touch)
+ return;
+
+ __touch->addClient(DSWaylandClient::fromWlClient(resource->client()), id, resource->version());
}
void DSWaylandSeatPrivate::seat_release(Resource *resource)
{
+ //TODO : Check if we should destroy wl_resource here.
}
/* Begin Public Class Implementation */
DSWaylandSeat::DSWaylandSeat(DSWaylandCompositor *compositor, DSWaylandSeat::seatCapability cap)
: DSObject(), _d_ptr(std::make_unique<DSWaylandSeatPrivate>(compositor, this))
{
- DS_GET_PRIV(DSWaylandSeat);
-
- priv->__cap = cap;
+ setCapability(cap);
}
DSWaylandSeat::~DSWaylandSeat()
{
}
-void DSWaylandSeat::setCapability(DSWaylandSeat::seatCapability cap)
+void DSWaylandSeat::sendCapabilitiesToAllClients(uint32_t cap)
{
DS_GET_PRIV(DSWaylandSeat);
- priv->__cap = cap;
+ priv->sendCapabilitiesToAllClients(cap);
}
-void DSWaylandSeat::updateCapability(DSWaylandSeat::seatCapability cap)
+void DSWaylandSeat::setCapability(DSWaylandSeat::seatCapability cap)
{
DS_GET_PRIV(DSWaylandSeat);
- priv->__cap = (DSWaylandSeat::seatCapability)((int)priv->__cap | cap);
+ DSLOG_INF("DSWaylandSeat","cap=%d, priv->__cap=%d", cap, priv->__cap);
+
+ if (cap == priv->__cap)
+ {
+ return;
+ }
+
+ DSWaylandSeat::seatCapability diff = DSWaylandSeat::seatCapability((uint32_t)priv->__cap ^ cap);
+
+ if (diff & DSWaylandSeat::capPointer)
+ {
+ if (!priv->__pointer)
+ {
+ priv->__pointer = new DSWaylandPointer(this);
+ DS_ASSERT(priv->__pointer);
+ DSLOG_INF("DSWaylandSeat", "DSWaylandPointer has been created.");
+ }
+ }
+
+ if (diff & DSWaylandSeat::capKeyboard)
+ {
+ if (!priv->__keyboard)
+ {
+ priv->__keyboard = new DSWaylandKeyboard(this);
+ DS_ASSERT(priv->__keyboard);
+ DSLOG_INF("DSWaylandSeat", "DSWaylandKeyboard has been created.");
+ }
+ }
+
+ if (diff & DSWaylandSeat::capTouch)
+ {
+ if (!priv->__touch)
+ {
+ priv->__touch = new DSWaylandTouch(this);
+ DS_ASSERT(priv->__touch);
+ DSLOG_INF("DSWaylandSeat", "DSWaylandTouch has been created.");
+ }
+ }
+
+ /* send capabilities when it is updated */
+ sendCapabilitiesToAllClients((uint32_t)cap);
+
+ //TODO : check if we should set focus if the keyboard cap has been added newly.
+
+ priv->__cap = cap;
}
DSWaylandSeat::seatCapability DSWaylandSeat::getCapability(void)
return priv->__cap;
}
+void DSWaylandSeat::setName(std::string name)
+{
+ DS_GET_PRIV(DSWaylandSeat);
+
+ //TODO : check if we should send name to client(s) when it has a name.
+
+ priv->__seatName = name;
+}
+
}
DSWaylandSeat(DSWaylandCompositor *compositor, DSWaylandSeat::seatCapability cap);
~DSWaylandSeat() override;
+ void sendCapabilitiesToAllClients(uint32_t cap);
void setCapability(DSWaylandSeat::seatCapability cap);
- void updateCapability(DSWaylandSeat::seatCapability cap);
DSWaylandSeat::seatCapability getCapability(void);
+ void setName(std::string name);
protected:
namespace display_server
{
+class DSWaylandPointer;
+class DSWaylandKeyboard;
+class DSWaylandTouch;
+
class DS_DECL_EXPORT DSWaylandSeatPrivate : public DSObjectPrivate, public DSWaylandServer::wl_seat
{
DS_PIMPL_USE_PUBLIC(DSWaylandSeat);
DSWaylandSeatPrivate(DSWaylandCompositor *compositor, DSWaylandSeat *seat);
~DSWaylandSeatPrivate() override;
+ void sendCapabilitiesToAllClients(uint32_t cap);
+
protected:
void seat_bind_resource(Resource *resource) override;
void seat_destroy_resource(Resource *resource) override;
private:
DSWaylandSeat::seatCapability __cap;
DSWaylandCompositor *__compositor;
+ std::string __seatName;
+
+ DSWaylandPointer *__pointer;
+ DSWaylandKeyboard *__keyboard;
+ DSWaylandTouch *__touch;
};
}
#include "libds-tests.h"
#include "DSInput.h"
+#include "DSSeat.h"
using namespace display_server;
TEST_F(DSInputTest, NewDSInput)
{
- DSInput *input = new DSInput;
- delete input;
- ASSERT_TRUE(true);
+ DSInput *input = new DSInput();
+ EXPECT_TRUE(input != nullptr);
+
+ if (input)
+ delete input;
}
TEST_F(DSInputTest, DSInputInit)
{
- DSInput *input = new DSInput;
-
- input->Init();
- delete input;
+ DSInput *input = new DSInput();
+ EXPECT_TRUE(input != nullptr);
- EXPECT_TRUE(true);
+ if (input)
+ {
+ input->init();
+ delete input;
+ }
}
TEST_F(DSInputTest, DSInputDeviceAddedRemoved)
{
- DSInput *input = new DSInput;
+ DSInput *input = new DSInput();
DSInputDevice *device = new DSInputDevice("MockTestDevice", "MockTest", DSInput::KeyboardClass, DSInput::NoneSubclass);
MockInput *mockInput = new MockInput;
MockInput *mockInput2 = new MockInput;
- input->Init();
+ EXPECT_TRUE(input != nullptr);
+ EXPECT_TRUE(device != nullptr);
+ EXPECT_TRUE(mockInput != nullptr);
+ EXPECT_TRUE(mockInput2 != nullptr);
+
+ if (input)
+ {
+ input->init();
- input->registerCallbackDeviceAdd(mockInput, std::bind(&MockInput::slotDeviceAdded, mockInput, std::placeholders::_1));
- input->deviceAdd(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
- EXPECT_TRUE(*(mockInput->device.get()) == *device);
+ input->registerCallbackDeviceAdd(mockInput, std::bind(&MockInput::slotDeviceAdded, mockInput, std::placeholders::_1));
+ input->deviceAdd(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
+ EXPECT_TRUE(*(mockInput->device.get()) == *device);
- input->registerCallbackDeviceAdd(mockInput2, std::bind(&MockInput::slotDeviceAdded, mockInput2, std::placeholders::_1));
- input->deviceAdd(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
- EXPECT_FALSE(*(mockInput2->device.get()) == *device);
+ input->registerCallbackDeviceAdd(mockInput2, std::bind(&MockInput::slotDeviceAdded, mockInput2, std::placeholders::_1));
+ input->deviceAdd(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
+ EXPECT_FALSE(*(mockInput2->device.get()) == *device);
- input->registerCallbackDeviceRemove(mockInput, std::bind(&MockInput::slotDeviceRemoved, mockInput, std::placeholders::_1));
- input->deviceRemove(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
- EXPECT_TRUE(*(mockInput->device.get()) == *device);
+ input->registerCallbackDeviceRemove(mockInput, std::bind(&MockInput::slotDeviceRemoved, mockInput, std::placeholders::_1));
+ input->deviceRemove(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
+ EXPECT_TRUE(*(mockInput->device.get()) == *device);
- input->registerCallbackDeviceRemove(mockInput2, std::bind(&MockInput::slotDeviceRemoved, mockInput2, std::placeholders::_1));
- input->deviceRemove(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
+ input->registerCallbackDeviceRemove(mockInput2, std::bind(&MockInput::slotDeviceRemoved, mockInput2, std::placeholders::_1));
+ input->deviceRemove(device->getName(), device->getIdentifier(), device->getClass(), device->getSubclass());
- EXPECT_FALSE(*(mockInput2->device.get()) == *device);
+ EXPECT_FALSE(*(mockInput2->device.get()) == *device);
- delete mockInput2;
- delete mockInput;
- delete device;
- delete input;
+ delete mockInput2;
+ delete mockInput;
+ delete device;
+ delete input;
+ }
}
#include "libds-tests.h"
#include "DSSeat.h"
+#include "DSCompositor.h"
using namespace display_server;
{}
};
+class MockCompositor : public DSCompositor
+{
+public:
+ MockCompositor() {}
+ ~MockCompositor() {}
+
+ std::shared_ptr<DSCanvas> _onInitialized() override
+ {
+ auto canvas = std::make_shared<DSCanvas>();
+ return canvas;
+ }
+
+ void _onOutputAdded(std::shared_ptr<IDSOutput> output) override
+ {}
+
+ void _onOutputRemoved(std::shared_ptr<IDSOutput> output) override
+ {}
+
+ void _onInputAdded(std::shared_ptr<DSInput> input) override
+ {}
+
+ void _onInputRemoved(std::shared_ptr<DSInput> input) override
+ {}
+};
+
TEST_F(DSSeatTest, NewDSSeat)
{
- DSSeat *seat = new DSSeat;
- delete seat;
- ASSERT_TRUE(true);
+ DSSeat *seat = new DSSeat();
+
+ EXPECT_TRUE(seat != nullptr);
+
+ if (seat)
+ delete seat;
}
TEST_F(DSSeatTest, BasicMethods)
{
- DSSeat seat;
- auto input = std::make_shared<DSInput>();
+ std::string seatName{"default"};
+ std::shared_ptr<DSCompositor> compositor = std::make_shared<MockCompositor>();
+ EXPECT_TRUE(compositor != nullptr);
+
+ if (compositor)
+ {
+ std::shared_ptr<DSSeat> seat = std::make_shared<DSSeat>(compositor.get(), seatName);
+ EXPECT_TRUE(seat != nullptr);
+
+ auto input = std::make_shared<DSInput>(seat);
+ EXPECT_TRUE(input != nullptr);
- EXPECT_TRUE(seat.addInput(input) == true);
- EXPECT_TRUE(seat.removeInput(input) == true);
+ if (input)
+ {
+ EXPECT_TRUE(seat->addInput(input) == true);
+ EXPECT_TRUE(seat->removeInput(input) == true);
+ }
+ }
}
res = comp->create();
EXPECT_TRUE(res == true);
- DSWaylandSeat *seat = new DSWaylandSeat(comp, DSWaylandSeat::capDefault);
+ DSWaylandSeat *seat = comp->addSeat((uint32_t)DSWaylandSeat::capDefault);
EXPECT_TRUE(seat != nullptr);
if (seat)
{
- comp->addSeat(seat);
EXPECT_TRUE(comp->defaultSeat() != nullptr);
comp->removeSeat(seat);
EXPECT_TRUE(comp->defaultSeat() == nullptr);
-
- delete seat;
}
delete comp;
seat->setCapability(DSWaylandSeat::capKeyboard);
EXPECT_TRUE(DSWaylandSeat::capKeyboard == seat->getCapability());
- seat->updateCapability(DSWaylandSeat::capPointer);
- EXPECT_TRUE(DSWaylandSeat::capKeyboard & seat->getCapability());
- EXPECT_TRUE(DSWaylandSeat::capPointer & seat->getCapability());
-
+ seat->setCapability(DSWaylandSeat::capPointer);
+ EXPECT_TRUE(DSWaylandSeat::capPointer == seat->getCapability());
+
+ seat->setCapability(DSWaylandSeat::capTouch);
+ EXPECT_TRUE(DSWaylandSeat::capTouch == seat->getCapability());
+
delete seat;
}