{
wl_list_insert(&client_resources,&resource->link);
struct wl_listener *listener = new struct wl_listener;
- listener->func = ResourceCollection::destroy_listener_func;
- wl_list_insert(&resource->destroy_listener_list,&listener->link);
+ listener->notify = ResourceCollection::destroy_listener_notify;
+ wl_signal_add(&resource->destroy_signal, listener);
}
struct wl_resource *ResourceCollection::resourceForClient(wl_client *client) const
return wl_list_empty(const_cast<struct wl_list *>(&client_resources));
}
-void ResourceCollection::destroy_listener_func(struct wl_listener *listener,
- wl_resource *resource,
- uint32_t time)
+void ResourceCollection::destroy_listener_notify(struct wl_listener *listener, void *data)
{
- Q_UNUSED(time);
+ struct wl_resource *resource = reinterpret_cast<struct wl_resource *>(data);
wl_list_remove(&resource->link);
delete listener;
}
protected:
struct wl_list client_resources;
private:
- static void destroy_listener_func(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time);
-
+ static void destroy_listener_notify(struct wl_listener *listener, void *data);
};
}
qDebug() << "destroying source";
if (m_manager)
m_manager->sourceDestroyed(this);
- wl_resource_destroy(m_data_source_resource,Compositor::currentTimeMsecs());
+ wl_resource_destroy(m_data_source_resource);
}
void DataSource::resource_destroy(wl_resource *resource)
{
if (base()->keyboard_focus_resource != NULL) {
uint32_t time = m_compositor->currentTimeMsecs();
+ uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
wl_input_device_send_key(base()->keyboard_focus_resource,
- time, code - 8, 1);
+ serial, time, code - 8, 1);
}
}
{
if (base()->keyboard_focus_resource != NULL) {
uint32_t time = m_compositor->currentTimeMsecs();
+ uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
wl_input_device_send_key(base()->keyboard_focus_resource,
- time, code - 8, 0);
+ serial, time, code - 8, 0);
}
}
void InputDevice::sendTouchPointEvent(int id, int x, int y, Qt::TouchPointState state)
{
uint32_t time = m_compositor->currentTimeMsecs();
+ uint32_t serial = 0;
struct wl_resource *resource = base()->pointer_focus_resource;
if (!resource)
return;
switch (state) {
case Qt::TouchPointPressed:
- wl_input_device_send_touch_down(resource, time, &base()->pointer_focus->resource, id, x, y);
+ wl_input_device_send_touch_down(resource, serial, time, &base()->pointer_focus->resource, id, x, y);
break;
case Qt::TouchPointMoved:
wl_input_device_send_touch_motion(resource, time, id, x, y);
break;
case Qt::TouchPointReleased:
- wl_input_device_send_touch_up(resource, time, id);
+ wl_input_device_send_touch_up(resource, serial, time, id);
break;
case Qt::TouchPointStationary:
// stationary points are not sent through wayland, the client must cache them
void InputDevice::setKeyboardFocus(Surface *surface)
{
sendSelectionFocus(surface);
- wl_input_device_set_keyboard_focus(base(), surface ? surface->base() : 0, m_compositor->currentTimeMsecs());
+ wl_input_device_set_keyboard_focus(base(), surface ? surface->base() : 0);
}
Surface *InputDevice::mouseFocus() const
base()->current_x = localPos.x();
base()->current_y = localPos.y();
base()->pointer_grab->interface->focus(base()->pointer_grab,
- m_compositor->currentTimeMsecs(),
surface ? surface->base() : 0,
localPos.x(), localPos.y());
}
void Region::region_destroy(wl_client *client, wl_resource *region)
{
Q_UNUSED(client);
- wl_resource_destroy(region, Compositor::currentTimeMsecs());
+ wl_resource_destroy(region);
}
void Region::region_add(wl_client *client, wl_resource *region,
self->m_moveGrabber->offset_x = input_device->base()->x - self->surface()->pos().x();
self->m_moveGrabber->offset_y = input_device->base()->y - self->surface()->pos().y();
- wl_input_device_start_pointer_grab(input_device->base(),self->m_moveGrabber->base(),Compositor::currentTimeMsecs());
+ wl_input_device_start_pointer_grab(input_device->base(),self->m_moveGrabber->base());
}
void ShellSurface::resize(struct wl_client *client,
self->m_resizeGrabber->width = self->surface()->size().width();
self->m_resizeGrabber->height = self->surface()->size().height();
- wl_input_device_start_pointer_grab(input_device->base(),self->m_resizeGrabber->base(),Compositor::currentTimeMsecs());
+ wl_input_device_start_pointer_grab(input_device->base(),self->m_resizeGrabber->base());
}
void ShellSurface::set_toplevel(struct wl_client *client,
{
}
-void ShellSurfaceResizeGrabber::focus(wl_pointer_grab *grab, uint32_t time, wl_surface *surface, int32_t x, int32_t y)
+void ShellSurfaceResizeGrabber::focus(wl_pointer_grab *grab, wl_surface *surface, int32_t x, int32_t y)
{
}
ShellSurfaceResizeGrabber *self = reinterpret_cast<ShellSurfaceResizeGrabber *>(grab);
ShellSurface *shell_surface = self->shell_surface;
if (toQtButton(button) == Qt::LeftButton && !state) {
- wl_input_device_end_pointer_grab(grab->input_device,Compositor::currentTimeMsecs());
+ wl_input_device_end_pointer_grab(grab->input_device);
shell_surface->resetResizeGrabber();
delete self;
}
{
}
-void ShellSurfaceMoveGrabber::focus(wl_pointer_grab *grab, uint32_t time, wl_surface *surface, int32_t x, int32_t y)
+void ShellSurfaceMoveGrabber::focus(wl_pointer_grab *grab, wl_surface *surface, int32_t x, int32_t y)
{
}
ShellSurfaceResizeGrabber *self = reinterpret_cast<ShellSurfaceResizeGrabber *>(grab);
ShellSurface *shell_surface = self->shell_surface;
if (toQtButton(button) == Qt::LeftButton && !state) {
- wl_input_device_set_pointer_focus(grab->input_device,0,Compositor::currentTimeMsecs(),0,0);
- wl_input_device_end_pointer_grab(grab->input_device,Compositor::currentTimeMsecs());
+ wl_input_device_set_pointer_focus(grab->input_device,0,0,0);
+ wl_input_device_end_pointer_grab(grab->input_device);
shell_surface->resetMoveGrabber();
delete self;
}
int32_t width;
int32_t height;
- static void focus(struct wl_pointer_grab *grab, uint32_t time,
+ static void focus(struct wl_pointer_grab *grab,
struct wl_surface *surface, int32_t x, int32_t y);
static void motion(struct wl_pointer_grab *grab,
uint32_t time, int32_t x, int32_t y);
int32_t offset_x;
int32_t offset_y;
- static void focus(struct wl_pointer_grab *grab, uint32_t time,
+ static void focus(struct wl_pointer_grab *grab,
struct wl_surface *surface, int32_t x, int32_t y);
static void motion(struct wl_pointer_grab *grab,
uint32_t time, int32_t x, int32_t y);
struct wl_resource *frame_callback;
wl_list_for_each(frame_callback, &m_frame_callback_list, link) {
wl_callback_send_done(frame_callback, time);
- wl_resource_destroy(frame_callback,Compositor::currentTimeMsecs());
+ wl_resource_destroy(frame_callback);
}
wl_list_init(&m_frame_callback_list);
void Surface::surface_destroy(struct wl_client *, struct wl_resource *surface_resource)
{
- wl_resource_destroy(surface_resource,Compositor::currentTimeMsecs());
+ wl_resource_destroy(surface_resource);
}
void Surface::surface_attach(struct wl_client *client, struct wl_resource *surface,
m_is_displayed = false;
m_destroyed = false;
m_destroy_listener.surfaceBuffer = this;
- m_destroy_listener.listener.func = destroy_listener_callback;
+ m_destroy_listener.listener.notify = destroy_listener_callback;
if (buffer)
- wl_list_insert(&buffer->resource.destroy_listener_list,&m_destroy_listener.listener.link);
+ wl_signal_add(&buffer->resource.destroy_signal, &m_destroy_listener.listener);
m_damageRect = QRect();
}
return m_handle;
}
-void SurfaceBuffer::destroy_listener_callback(wl_listener *listener, wl_resource *resource, uint32_t time)
+void SurfaceBuffer::destroy_listener_callback(wl_listener *listener, void *data)
{
- Q_UNUSED(resource);
- Q_UNUSED(time);
+ Q_UNUSED(data);
struct surface_buffer_destroy_listener *destroy_listener =
reinterpret_cast<struct surface_buffer_destroy_listener *>(listener);
SurfaceBuffer *d = destroy_listener->surfaceBuffer;
#endif
void *m_handle;
- static void destroy_listener_callback(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time);
-
+ static void destroy_listener_callback(wl_listener *listener, void *data);
};
GLuint SurfaceBuffer::texture() const
void QWaylandInputDevice::inputHandleButton(void *data,
struct wl_input_device *input_device,
- uint32_t time, uint32_t button, uint32_t state)
+ uint32_t serial, uint32_t time,
+ uint32_t button, uint32_t state)
{
Q_UNUSED(input_device);
+ Q_UNUSED(serial);
QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
QWaylandWindow *window = inputDevice->mPointerFocus;
Qt::MouseButton qt_button;
void QWaylandInputDevice::inputHandleKey(void *data,
struct wl_input_device *input_device,
- uint32_t time, uint32_t key, uint32_t state)
+ uint32_t serial, uint32_t time,
+ uint32_t key, uint32_t state)
{
Q_UNUSED(input_device);
+ Q_UNUSED(serial);
QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
QWaylandWindow *window = inputDevice->mKeyboardFocus;
#ifndef QT_NO_WAYLAND_XKB
void QWaylandInputDevice::inputHandleTouchDown(void *data,
struct wl_input_device *wl_input_device,
+ uint32_t serial,
uint32_t time,
struct wl_surface *surface,
int id,
int y)
{
Q_UNUSED(wl_input_device);
+ Q_UNUSED(serial);
Q_UNUSED(time);
QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
inputDevice->mTouchFocus = static_cast<QWaylandWindow *>(wl_surface_get_user_data(surface));
void QWaylandInputDevice::inputHandleTouchUp(void *data,
struct wl_input_device *wl_input_device,
+ uint32_t serial,
uint32_t time,
int id)
{
Q_UNUSED(wl_input_device);
+ Q_UNUSED(serial);
Q_UNUSED(time);
QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
inputDevice->mTouchFocus = 0;
int32_t sx, int32_t sy);
static void inputHandleButton(void *data,
struct wl_input_device *input_device,
- uint32_t time, uint32_t button, uint32_t state);
+ uint32_t serial, uint32_t time,
+ uint32_t button, uint32_t state);
static void inputHandleAxis(void *data,
struct wl_input_device *wl_input_device,
uint32_t time,
int32_t value);
static void inputHandleKey(void *data,
struct wl_input_device *input_device,
- uint32_t time, uint32_t key, uint32_t state);
+ uint32_t serial, uint32_t time,
+ uint32_t key, uint32_t state);
static void inputHandlePointerEnter(void *data,
struct wl_input_device *input_device,
uint32_t time, struct wl_surface *surface,
struct wl_surface *surface);
static void inputHandleTouchDown(void *data,
struct wl_input_device *wl_input_device,
+ uint32_t serial,
uint32_t time,
struct wl_surface *surface,
int id,
int y);
static void inputHandleTouchUp(void *data,
struct wl_input_device *wl_input_device,
+ uint32_t serial,
uint32_t time,
int id);
static void inputHandleTouchMotion(void *data,
void QWaylandShellSurface::configure(void *data,
wl_shell_surface *wl_shell_surface,
- uint32_t time,
uint32_t edges,
int32_t width,
int32_t height)
{
Q_UNUSED(wl_shell_surface);
QWaylandShellSurface *shell_surface = static_cast<QWaylandShellSurface *>(data);
- shell_surface->m_window->configure(time,edges,width,height);
+ shell_surface->m_window->configure(edges, width, height);
}
void QWaylandShellSurface::popup_done(void *data,
static void configure(void *data,
struct wl_shell_surface *wl_shell_surface,
- uint32_t time,
uint32_t edges,
int32_t width,
int32_t height);
}
-void QWaylandWindow::configure(uint32_t time, uint32_t edges,
- int32_t width, int32_t height)
+void QWaylandWindow::configure(uint32_t edges, int32_t width, int32_t height)
{
- Q_UNUSED(time);
Q_UNUSED(edges);
int widthWithoutMargins = qMax(width-(frameMargins().left() +frameMargins().right()),1);
void setGeometry(const QRect &rect);
- void configure(uint32_t time, uint32_t edges,
- int32_t width, int32_t height);
+ void configure(uint32_t edges, int32_t width, int32_t height);
void attach(QWaylandBuffer *buffer);
QWaylandBuffer *attached() const;
wl_client_add_object(client, &wl_compositor_interface, &compositorInterface, id, compositorData);
}
-static void unregisterResourceCallback(wl_listener *listener,
- wl_resource *resource,
- uint32_t time)
+static void unregisterResourceCallback(wl_listener *listener, void *data)
{
- Q_UNUSED(time);
+ struct wl_resource *resource = reinterpret_cast<struct wl_resource *>(data);
wl_list_remove(&resource->link);
delete listener;
}
wl_list_insert(list, &resource->link);
wl_listener *listener = new wl_listener;
- listener->func = unregisterResourceCallback;
+ listener->notify = unregisterResourceCallback;
- wl_list_insert(&resource->destroy_listener_list, &listener->link);
+ wl_signal_add(&resource->destroy_signal, listener);
}
QVector<Surface *> Compositor::surfaces() const
return m_surfaces;
}
+uint32_t Compositor::nextSerial()
+{
+ return wl_display_next_serial(m_display);
+}
+
void Compositor::addSurface(Surface *surface)
{
m_surfaces << surface;
int fileDescriptor() const { return m_fd; }
void dispatchEvents(int timeout = 0);
+ uint32_t nextSerial();
uint32_t time() { return ++m_time; }
static void setOutputGeometry(void *compositor, const QList<QVariant> ¶meters);
void Compositor::setKeyboardFocus(void *data, const QList<QVariant> ¶meters)
{
Compositor *compositor = static_cast<Compositor *>(data);
- wl_input_device_set_keyboard_focus(&compositor->m_input, resolveSurface(parameters.first()), compositor->time());
+ wl_input_device_set_keyboard_focus(&compositor->m_input, resolveSurface(parameters.first()));
}
void Compositor::sendMousePress(void *data, const QList<QVariant> ¶meters)
return;
QPoint pos = parameters.last().toPoint();
- wl_input_device_set_pointer_focus(&compositor->m_input, surface, compositor->time(), pos.x(), pos.y());
+ wl_input_device_set_pointer_focus(&compositor->m_input, surface, pos.x(), pos.y());
wl_input_device_send_motion(compositor->m_input.pointer_focus_resource, compositor->time(), pos.x(), pos.y());
- wl_input_device_send_button(compositor->m_input.pointer_focus_resource, compositor->time(), 0x110, 1);
+ wl_input_device_send_button(compositor->m_input.pointer_focus_resource,
+ compositor->nextSerial(), compositor->time(), 0x110, 1);
}
void Compositor::sendMouseRelease(void *data, const QList<QVariant> ¶meters)
if (!surface)
return;
- wl_input_device_send_button(compositor->m_input.pointer_focus_resource, compositor->time(), 0x110, 0);
+ wl_input_device_send_button(compositor->m_input.pointer_focus_resource,
+ compositor->nextSerial(), compositor->time(), 0x110, 0);
}
void Compositor::sendKeyPress(void *data, const QList<QVariant> ¶meters)
return;
QPoint pos = parameters.last().toPoint();
- wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, compositor->time(), parameters.last().toUInt() - 8, 1);
+ wl_input_device_send_key(compositor->m_input.keyboard_focus_resource,
+ compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 1);
}
void Compositor::sendKeyRelease(void *data, const QList<QVariant> ¶meters)
if (!surface)
return;
- wl_input_device_send_key(compositor->m_input.keyboard_focus_resource, compositor->time(), parameters.last().toUInt() - 8, 0);
+ wl_input_device_send_key(compositor->m_input.keyboard_focus_resource,
+ compositor->nextSerial(), compositor->time(), parameters.last().toUInt() - 8, 0);
}
}
static void surface_destroy(wl_client *, wl_resource *surfaceResource)
{
- Surface *surface = static_cast<Surface *>(surfaceResource->data);
- wl_resource_destroy(surfaceResource, surface->compositor()->time());
+ wl_resource_destroy(surfaceResource);
}
void surface_attach(wl_client *client, wl_resource *surfaceResource,
wl_resource *frameCallback;
wl_list_for_each(frameCallback, &surface->m_frameCallbackList, link) {
wl_callback_send_done(frameCallback, surface->m_compositor->time());
- wl_resource_destroy(frameCallback, surface->m_compositor->time());
+ wl_resource_destroy(frameCallback);
}
wl_list_init(&surface->m_frameCallbackList);
This version of Qt-Compositor is checked against the following sha1 from the
Wayland repository:
-a13aab4e15f7defe8207dfc18277321166577d7a
+677c5180e67be18b7a0867fafb7f205b57a6e9ff