Follow the naming convention of other extensions.
The events are now posted only to the client to which the focus
surface belongs, the check was previously missing.
Change-Id: Ie43b6e887b64c7bed1377babb368129753a3cd0f
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
****************************************************************************/
</copyright>
- <interface name="wl_touch" version="1">
+ <interface name="wl_touch_extension" version="1">
<event name="touch">
<arg name="time" type="uint" />
<arg name="id" type="uint" />
{
}
-const struct wl_touch_interface TouchExtensionGlobal::touch_interface = {
+const struct wl_touch_extension_interface TouchExtensionGlobal::touch_interface = {
dummy
};
: m_compositor(compositor)
{
wl_display_add_global(compositor->wl_display(),
- &wl_touch_interface,
+ &wl_touch_extension_interface,
this,
TouchExtensionGlobal::bind_func);
}
void TouchExtensionGlobal::bind_func(wl_client *client, void *data, uint32_t version, uint32_t id)
{
Q_UNUSED(version);
- wl_resource *resource = wl_client_add_object(client, &wl_touch_interface, &touch_interface, id, data);
+ wl_resource *resource = wl_client_add_object(client, &wl_touch_extension_interface, &touch_interface, id, data);
resource->destroy = destroy_resource;
TouchExtensionGlobal *self = static_cast<TouchExtensionGlobal *>(resource->data);
self->m_resources.append(resource);
return;
QPointF surfacePos = surface->pos();
+ wl_client *surfaceClient = surface->base()->resource.client;
uint32_t time = m_compositor->currentTimeMsecs();
const int rescount = m_resources.count();
+
for (int res = 0; res < rescount; ++res) {
wl_resource *target = m_resources.at(res);
+ if (target->client != surfaceClient)
+ continue;
for (int i = 0; i < pointCount; ++i) {
const QTouchEvent::TouchPoint &tp(points.at(i));
int vy = toFixed(tp.velocity().y());
uint32_t pressure = uint32_t(tp.pressure() * 255);
wl_array *rawData = 0;
- wl_resource_post_event(target, WL_TOUCH_TOUCH,
+ wl_resource_post_event(target, WL_TOUCH_EXTENSION_TOUCH,
time, id, state,
x, y, nx, ny, w, h,
pressure, vx, vy,
flags, rawData);
}
- wl_resource_post_event(target, WL_TOUCH_TOUCH_FRAME);
+ wl_resource_post_event(target, WL_TOUCH_EXTENSION_TOUCH_FRAME);
}
}
static void destroy_resource(wl_resource *resource);
- static const struct wl_touch_interface touch_interface;
+ static const struct wl_touch_extension_interface touch_interface;
QList<wl_resource *> m_resources;
};
mWindowExtension = new QWaylandSurfaceExtension(this,id);
} else if (interface == "wl_sub_surface_extension") {
mSubSurfaceExtension = new QWaylandSubSurfaceExtension(this,id);
- } else if (interface == "wl_touch") {
+ } else if (interface == "wl_touch_extension") {
mTouchExtension = new QWaylandTouchExtension(this, id);
}
}
QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id)
{
mDisplay = display;
- mTouch = static_cast<struct wl_touch *>(wl_display_bind(display->wl_display(), id, &wl_touch_interface));
- wl_touch_add_listener(mTouch, &touch_listener, this);
+ mTouch = static_cast<struct wl_touch_extension *>(wl_display_bind(display->wl_display(), id, &wl_touch_extension_interface));
+ wl_touch_extension_add_listener(mTouch, &touch_listener, this);
QTouchDevice::Capabilities caps = QTouchDevice::Position
| QTouchDevice::Area
return f / qreal(10000);
}
-void QWaylandTouchExtension::handle_touch(void *data, wl_touch *wl_touch, uint32_t time,
+void QWaylandTouchExtension::handle_touch(void *data, wl_touch_extension *ext, uint32_t time,
uint32_t id, uint32_t state, int32_t x, int32_t y,
int32_t normalized_x, int32_t normalized_y,
int32_t width, int32_t height, uint32_t pressure,
int32_t velocity_x, int32_t velocity_y,
uint32_t flags, wl_array *rawdata)
{
- Q_UNUSED(wl_touch);
+ Q_UNUSED(ext);
QWaylandTouchExtension *self = static_cast<QWaylandTouchExtension *>(data);
QList<QWaylandInputDevice *> inputDevices = self->mDisplay->inputDevices();
if (inputDevices.isEmpty()) {
- qWarning("handle_touch: No input device");
+ qWarning("wl_touch_extension: handle_touch: No input device");
return;
}
QWaylandInputDevice *dev = inputDevices.first();
win = dev->mPointerFocus;
if (!win)
win = dev->mKeyboardFocus;
- if (!win || !win->window())
+ if (!win || !win->window()) {
+ qWarning("wl_touch_extension: handle_touch: No pointer focus");
return;
+ }
QWindowSystemInterface::TouchPoint tp;
tp.id = id;
self->mTimestamp = time;
}
-void QWaylandTouchExtension::handle_touch_frame(void *data, wl_touch *wl_touch)
+void QWaylandTouchExtension::handle_touch_frame(void *data, wl_touch_extension *ext)
{
- Q_UNUSED(wl_touch);
+ Q_UNUSED(ext);
QWaylandTouchExtension *self = static_cast<QWaylandTouchExtension *>(data);
self->sendTouchEvent();
}
mPrevTouchPoints.clear();
}
-const struct wl_touch_listener QWaylandTouchExtension::touch_listener = {
+const struct wl_touch_extension_listener QWaylandTouchExtension::touch_listener = {
QWaylandTouchExtension::handle_touch,
QWaylandTouchExtension::handle_touch_frame
};
#include "qwaylanddisplay.h"
#include <QWindowSystemInterface>
-class wl_touch;
+class wl_touch_extension;
class QWaylandTouchExtension
{
private:
QWaylandDisplay *mDisplay;
- wl_touch *mTouch;
- static const struct wl_touch_listener touch_listener;
+ wl_touch_extension *mTouch;
+ static const struct wl_touch_extension_listener touch_listener;
static void handle_touch(void *data,
- struct wl_touch *wl_touch,
+ struct wl_touch_extension *ext,
uint32_t time,
uint32_t id,
uint32_t state,
struct wl_array *rawdata);
static void handle_touch_frame(void *data,
- struct wl_touch *wl_touch);
+ struct wl_touch_extension *ext);
void sendTouchEvent();