summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-02-07 11:39:49 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2012-02-07 16:16:52 +0100
commit083ece74feedb93c0ed208017658c85a4bb1e532 (patch)
tree430cd31526d56e838df38a24e344e91b789e1223 /examples
parenta39e37100a86aa64a6463c36d5a6444df01ec169 (diff)
Add mouse event synthesizing to the touch extension protocol.
The compositor can now be configured to tell the clients to generate mouse events when receiving touch events. In touchscreen-only systems this can be used to reduce the number of Wayland events. Change-Id: I231a15cd4ed463ee81c510c082a270efa255a1f3 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/qwindow-compositor/qopenglwindow.cpp8
-rw-r--r--examples/qwindow-compositor/qopenglwindow.h3
-rw-r--r--examples/qwindow-compositor/qwindowcompositor.cpp5
3 files changed, 15 insertions, 1 deletions
diff --git a/examples/qwindow-compositor/qopenglwindow.cpp b/examples/qwindow-compositor/qopenglwindow.cpp
index d70c4a965..473e4c151 100644
--- a/examples/qwindow-compositor/qopenglwindow.cpp
+++ b/examples/qwindow-compositor/qopenglwindow.cpp
@@ -39,6 +39,7 @@
****************************************************************************/
#include "qopenglwindow.h"
+#include <QTouchEvent>
QOpenGLWindow::QOpenGLWindow(const QSurfaceFormat &format, const QRect &geometry)
: m_format(format)
@@ -51,3 +52,10 @@ QOpenGLWindow::QOpenGLWindow(const QSurfaceFormat &format, const QRect &geometry
m_context->setFormat(format);
m_context->create();
}
+
+void QOpenGLWindow::touchEvent(QTouchEvent *event)
+{
+ // Do not want any automatically synthesized mouse events
+ // so make sure the touch is always accepted.
+ event->accept();
+}
diff --git a/examples/qwindow-compositor/qopenglwindow.h b/examples/qwindow-compositor/qopenglwindow.h
index 0d1cfbf7a..2ba883cf0 100644
--- a/examples/qwindow-compositor/qopenglwindow.h
+++ b/examples/qwindow-compositor/qopenglwindow.h
@@ -53,7 +53,8 @@ public:
QOpenGLContext* context() { return m_context; }
bool makeCurrent() { return m_context->makeCurrent(this); }
void swapBuffers() { m_context->swapBuffers(this); }
-
+protected:
+ void touchEvent(QTouchEvent *event);
private:
QOpenGLContext *m_context;
QSurfaceFormat m_format;
diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp
index 90192f98d..a7132101e 100644
--- a/examples/qwindow-compositor/qwindowcompositor.cpp
+++ b/examples/qwindow-compositor/qwindowcompositor.cpp
@@ -58,6 +58,11 @@ QWindowCompositor::QWindowCompositor(QOpenGLWindow *window)
// using a custom protocol extension.
// enableTouchExtension();
+ // Enable the following to have mouse events generated from touch
+ // on client side. This is not the same as synthesizing mouse events
+ // in the compositor because it avoids sending data through the wire.
+ // configureTouchExtension(WaylandCompositor::TouchExtMouseFromTouch);
+
enableSubSurfaceExtension();
m_window->makeCurrent();