Change the touch extension to be always available.
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Wed, 28 Mar 2012 10:58:04 +0000 (13:58 +0300)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>
Wed, 28 Mar 2012 12:09:57 +0000 (14:09 +0200)
Not opt-in anymore. Clients that connect to the extension will get the
extended touch events, others will get the regular events.

Change-Id: I91daec1949814fff5cfa0ebcc82c0977eee963b7
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/compositor/compositor_api/waylandcompositor.cpp
src/compositor/wayland_wrapper/wlcompositor.cpp
src/compositor/wayland_wrapper/wlcompositor.h
src/compositor/wayland_wrapper/wlinputdevice.cpp
src/compositor/wayland_wrapper/wltouch.cpp
src/compositor/wayland_wrapper/wltouch.h

index 301d422..95a7bb5 100644 (file)
@@ -208,7 +208,7 @@ void WaylandCompositor::enableSubSurfaceExtension()
 
 void WaylandCompositor::enableTouchExtension()
 {
-    m_compositor->enableTouchExtension();
+    // nothing to do here
 }
 
 void WaylandCompositor::configureTouchExtension(TouchExtensionFlags flags)
index 4b3876c..d539e2d 100644 (file)
@@ -156,6 +156,7 @@ Compositor::Compositor(WaylandCompositor *qt_compositor)
     m_outputExtension = new OutputExtensionGlobal(this);
     m_surfaceExtension = new SurfaceExtensionGlobal(this);
     m_qtkeyExtension = new QtKeyExtensionGlobal(this);
+    m_touchExtension = new TouchExtensionGlobal(this);
 
     if (wl_display_add_socket(m_display->handle(), qt_compositor->socketName())) {
         fprintf(stderr, "Fatal: Failed to open server socket\n");
@@ -412,13 +413,6 @@ QList<Wayland::Surface *> Compositor::surfacesForClient(wl_client *client)
     return ret;
 }
 
-void Compositor::enableTouchExtension()
-{
-    if (!m_touchExtension) {
-        m_touchExtension = new TouchExtensionGlobal(this);
-    }
-}
-
 void Compositor::configureTouchExtension(int flags)
 {
     if (m_touchExtension)
index 1710619..2ed4a1b 100644 (file)
@@ -127,7 +127,6 @@ public:
 
     void setClientFullScreenHint(bool value);
 
-    void enableTouchExtension();
     TouchExtensionGlobal *touchExtension() { return m_touchExtension; }
     void configureTouchExtension(int flags);
 
index 3c23d48..2e0f4b8 100644 (file)
@@ -199,10 +199,8 @@ void InputDevice::sendFullTouchEvent(QTouchEvent *event)
     }
 
     TouchExtensionGlobal *ext = m_compositor->touchExtension();
-    if (ext) {
-        ext->postTouchEvent(event, mouseFocus());
+    if (ext && ext->postTouchEvent(event, mouseFocus()))
         return;
-    }
 
     const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
     if (points.isEmpty())
index 9038d59..99cb8cb 100644 (file)
@@ -95,12 +95,12 @@ static inline int toFixed(qreal f)
     return int(f * 10000);
 }
 
-void TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, Surface *surface)
+bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, Surface *surface)
 {
     const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
     const int pointCount = points.count();
     if (!pointCount)
-        return;
+        return false;
 
     QPointF surfacePos = surface->pos();
     wl_client *surfaceClient = surface->base()->resource.client;
@@ -166,7 +166,11 @@ void TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, Surface *surface)
                                    pressure, vx, vy,
                                    flags, rawData);
         }
+
+        return true;
     }
+
+    return false;
 }
 
 }
index 0d63def..b44a0ff 100644 (file)
@@ -57,7 +57,7 @@ public:
     TouchExtensionGlobal(Compositor *compositor);
     ~TouchExtensionGlobal();
 
-    void postTouchEvent(QTouchEvent *event, Surface *surface);
+    bool postTouchEvent(QTouchEvent *event, Surface *surface);
 
     void setFlags(int flags) { m_flags = flags; }