Fix crash of test client
No wl_data_device_manager created in Mock compositor Change-Id: If80f71165c28678f296bc18f0fea572dcb1a2f77 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
This commit is contained in:
parent
76c98e7671
commit
45fdcd4818
@ -209,6 +209,8 @@ Compositor::Compositor()
|
||||
|
||||
wl_display_add_global(m_display, &wl_compositor_interface, this, bindCompositor);
|
||||
|
||||
m_data_device_manager.reset(new DataDeviceManager(this, m_display));
|
||||
|
||||
wl_display_init_shm(m_display);
|
||||
|
||||
m_seat.reset(new Seat(this, m_display));
|
||||
|
@ -61,6 +61,7 @@ typedef void (**Implementation)(void);
|
||||
class Keyboard;
|
||||
class Pointer;
|
||||
class Seat;
|
||||
class DataDeviceManager;
|
||||
class Surface;
|
||||
|
||||
class Compositor
|
||||
@ -111,6 +112,7 @@ private:
|
||||
QScopedPointer<Seat> m_seat;
|
||||
Pointer *m_pointer;
|
||||
Keyboard *m_keyboard;
|
||||
QScopedPointer<DataDeviceManager> m_data_device_manager;
|
||||
QVector<Surface *> m_surfaces;
|
||||
};
|
||||
|
||||
|
@ -227,4 +227,35 @@ void Pointer::pointer_destroy_resource(wl_pointer::Resource *resource)
|
||||
m_focusResource = 0;
|
||||
}
|
||||
|
||||
DataDevice::DataDevice(Compositor *compositor)
|
||||
: wl_data_device()
|
||||
, m_compositor(compositor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DataDevice::~DataDevice()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DataDeviceManager::DataDeviceManager(Compositor *compositor, wl_display *display)
|
||||
: wl_data_device_manager(display)
|
||||
, m_compositor(compositor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DataDeviceManager::~DataDeviceManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat)
|
||||
{
|
||||
if (!m_data_device)
|
||||
m_data_device.reset(new DataDevice(m_compositor));
|
||||
m_data_device->add(resource->client(), id);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -120,6 +120,31 @@ private:
|
||||
Surface *m_focus;
|
||||
};
|
||||
|
||||
class DataDevice : public QtWaylandServer::wl_data_device
|
||||
{
|
||||
public:
|
||||
DataDevice(Compositor *compositor);
|
||||
~DataDevice();
|
||||
|
||||
private:
|
||||
Compositor *m_compositor;
|
||||
};
|
||||
|
||||
class DataDeviceManager : public QtWaylandServer::wl_data_device_manager
|
||||
{
|
||||
public:
|
||||
DataDeviceManager(Compositor *compositor, struct ::wl_display *display);
|
||||
~DataDeviceManager();
|
||||
|
||||
protected:
|
||||
void data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Compositor *m_compositor;
|
||||
|
||||
QScopedPointer<DataDevice> m_data_device;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // MOCKINPUT_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user