summaryrefslogtreecommitdiffstats
path: root/examples/qwidget-compositor
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2011-08-19 17:08:27 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2011-08-31 13:23:08 +0200
commit772573d867280747b724b4f2e57023d3febe5d87 (patch)
tree8c30cf0612d959e4e6d28e225ee6f49d93241dda /examples/qwidget-compositor
parent19db756c2a27afc1ea1a6ac345902eb936677688 (diff)
Added buffer release
Also Removed the touch stuff from the widget compositor Also fixed a multiple inheritance problem in widget compositor Also Removed some stupid pkg-config variable for includes hack
Diffstat (limited to 'examples/qwidget-compositor')
-rw-r--r--examples/qwidget-compositor/main.cpp130
-rw-r--r--examples/qwidget-compositor/qwidget-compositor.pro15
2 files changed, 74 insertions, 71 deletions
diff --git a/examples/qwidget-compositor/main.cpp b/examples/qwidget-compositor/main.cpp
index 635db2a80..2217d10ec 100644
--- a/examples/qwidget-compositor/main.cpp
+++ b/examples/qwidget-compositor/main.cpp
@@ -55,23 +55,23 @@
#include <QDebug>
-#include "qtouchscreen.h"
-
-static int touch_x_min, touch_x_max, touch_y_min, touch_y_max;
-
-class QWidgetCompositor;
-
-class TouchObserver : public QTouchScreenObserver
-{
-public:
- TouchObserver(QWidgetCompositor *compositor)
- : m_compositor(compositor) { }
- void touch_configure(int x_min, int x_max, int y_min, int y_max);
- void touch_point(QEvent::Type state, const QList<QWindowSystemInterface::TouchPoint> &points);
-
-private:
- QWidgetCompositor *m_compositor;
-};
+//#include "qtouchscreen.h"
+//
+//static int touch_x_min, touch_x_max, touch_y_min, touch_y_max;
+//
+//class QWidgetCompositor;
+//
+//class TouchObserver : public QTouchScreenObserver
+//{
+//public:
+// TouchObserver(QWidgetCompositor *compositor)
+// : m_compositor(compositor) { }
+// void touch_configure(int x_min, int x_max, int y_min, int y_max);
+// void touch_point(QEvent::Type state, const QList<QWindowSystemInterface::TouchPoint> &points);
+//
+//private:
+// QWidgetCompositor *m_compositor;
+//};
#ifdef QT_COMPOSITOR_WAYLAND_GL
class QWidgetCompositor : public QGLWidget, public WaylandCompositor
@@ -81,7 +81,7 @@ class QWidgetCompositor : public QWidget, public WaylandCompositor
{
Q_OBJECT
public:
- QWidgetCompositor() : WaylandCompositor(this), m_moveSurface(0), m_dragSourceSurface(0) {
+ QWidgetCompositor() : WaylandCompositor(windowHandle(),const_cast<QGLContext *>(context())), m_moveSurface(0), m_dragSourceSurface(0) {
setMouseTracking(true);
setRetainedSelectionEnabled(true);
m_background = QImage(QLatin1String("background.jpg"));
@@ -300,52 +300,52 @@ private:
friend class TouchObserver;
};
-void TouchObserver::touch_configure(int x_min, int x_max, int y_min, int y_max)
-{
- touch_x_min = x_min;
- touch_x_max = x_max;
- touch_y_min = y_min;
- touch_y_max = y_max;
-}
-
-void TouchObserver::touch_point(QEvent::Type state, const QList<QWindowSystemInterface::TouchPoint> &points)
-{
- Q_UNUSED(state);
- WaylandSurface *focusSurface = m_compositor->inputFocus();
- if (focusSurface) {
- if (points.isEmpty())
- return;
- for (int i = 0; i < points.count(); ++i) {
- const QWindowSystemInterface::TouchPoint &point(points.at(i));
-
- // These are hw coordinates.
- int x = int(point.area.left());
- int y = int(point.area.top());
-
- // Wayland expects surface-relative coordinates.
-
- // Translate so that (0, 0) is the top-left corner.
- x = qBound(touch_x_min, x, touch_x_max) - touch_x_min;
- y = qBound(touch_y_min, y, touch_y_max) - touch_y_min;
-
- // Get a normalized position in range 0..1.
- const int hw_w = touch_x_max - touch_x_min;
- const int hw_h = touch_y_max - touch_y_min;
- const qreal nx = x / qreal(hw_w);
- const qreal ny = y / qreal(hw_h);
-
- // Map to surface.
- QRect winRect(focusSurface->geometry());
- x = int(nx * winRect.width());
- y = int(ny * winRect.height());
-
- focusSurface->sendTouchPointEvent(point.id,
- x, y,
- point.state);
- }
- focusSurface->sendTouchFrameEvent();
- }
-}
+//void TouchObserver::touch_configure(int x_min, int x_max, int y_min, int y_max)
+//{
+// touch_x_min = x_min;
+// touch_x_max = x_max;
+// touch_y_min = y_min;
+// touch_y_max = y_max;
+//}
+
+//void TouchObserver::touch_point(QEvent::Type state, const QList<QWindowSystemInterface::TouchPoint> &points)
+//{
+// Q_UNUSED(state);
+// WaylandSurface *focusSurface = m_compositor->inputFocus();
+// if (focusSurface) {
+// if (points.isEmpty())
+// return;
+// for (int i = 0; i < points.count(); ++i) {
+// const QWindowSystemInterface::TouchPoint &point(points.at(i));
+
+// // These are hw coordinates.
+// int x = int(point.area.left());
+// int y = int(point.area.top());
+
+// // Wayland expects surface-relative coordinates.
+
+// // Translate so that (0, 0) is the top-left corner.
+// x = qBound(touch_x_min, x, touch_x_max) - touch_x_min;
+// y = qBound(touch_y_min, y, touch_y_max) - touch_y_min;
+
+// // Get a normalized position in range 0..1.
+// const int hw_w = touch_x_max - touch_x_min;
+// const int hw_h = touch_y_max - touch_y_min;
+// const qreal nx = x / qreal(hw_w);
+// const qreal ny = y / qreal(hw_h);
+
+// // Map to surface.
+// QRect winRect(focusSurface->geometry());
+// x = int(nx * winRect.width());
+// y = int(ny * winRect.height());
+
+// focusSurface->sendTouchPointEvent(point.id,
+// x, y,
+// point.state);
+// }
+// focusSurface->sendTouchFrameEvent();
+// }
+//}
int main(int argc, char *argv[])
{
@@ -355,7 +355,7 @@ int main(int argc, char *argv[])
compositor.resize(800, 600);
compositor.show();
- QTouchScreenHandlerThread t(QString(), new TouchObserver(&compositor));
+// QTouchScreenHandlerThread t(QString(), new TouchObserver(&compositor));
return app.exec();
}
diff --git a/examples/qwidget-compositor/qwidget-compositor.pro b/examples/qwidget-compositor/qwidget-compositor.pro
index 353b34ca5..88dd757f2 100644
--- a/examples/qwidget-compositor/qwidget-compositor.pro
+++ b/examples/qwidget-compositor/qwidget-compositor.pro
@@ -23,9 +23,12 @@ isEmpty(QT_SOURCE_TREE) {
} else {
QTBASE = $$QT_SOURCE_TREE
}
-TOUCHSCREEN_BASE = $$QTBASE/src/plugins/generic/touchscreen
-SOURCES += $$TOUCHSCREEN_BASE/qtouchscreen.cpp
-HEADERS += $$TOUCHSCREEN_BASE/qtouchscreen.h
-INCLUDEPATH += $$TOUCHSCREEN_BASE
-LIBS += -ludev -lmtdev
-QT += gui-private
+#TOUCHSCREEN_BASE = $$QTBASE/src/plugins/generic/touchscreen
+#SOURCES += $$TOUCHSCREEN_BASE/qtouchscreen.cpp
+#HEADERS += $$TOUCHSCREEN_BASE/qtouchscreen.h
+#INCLUDEPATH += $$TOUCHSCREEN_BASE
+#LIBS += -ludev -lmtdev
+QT += gui-private widgets widgets-private
+
+target.path += $$[QT_INSTALL_DATA]/bin
+INSTALLS += target