summaryrefslogtreecommitdiffstats
path: root/examples/qwindow-compositor
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2012-02-04 12:02:42 +0100
committerJørgen Lind <jorgen.lind@nokia.com>2012-04-11 09:54:04 +0200
commit03c12a8dc06f5d72640fe0640588a39251cd0d27 (patch)
treee22e765f32891719d472e51f2ceb6049f6391858 /examples/qwindow-compositor
parentf0feb01c35717aa60258b06bf96dcfdf9d2bf1b8 (diff)
Fix QWindow Compositors input handling
Change-Id: I500c0a8e824abcf9a1e7662e1bd030ecc1b85170 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'examples/qwindow-compositor')
-rw-r--r--examples/qwindow-compositor/qwindowcompositor.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp
index 8c4f9cd34..994a991f7 100644
--- a/examples/qwindow-compositor/qwindowcompositor.cpp
+++ b/examples/qwindow-compositor/qwindowcompositor.cpp
@@ -39,6 +39,7 @@
****************************************************************************/
#include "qwindowcompositor.h"
+
#include <QMouseEvent>
#include <QKeyEvent>
#include <QTouchEvent>
@@ -184,7 +185,7 @@ GLuint QWindowCompositor::composeSurface(WaylandSurface *surface)
if (surface->type() == WaylandSurface::Shm) {
texture = m_textureCache->bindTexture(QOpenGLContext::currentContext(),surface->image());
- } else {
+ } else if (surface->type() == WaylandSurface::Texture) {
texture = surface->texture(QOpenGLContext::currentContext());
}
@@ -266,19 +267,17 @@ bool QWindowCompositor::eventFilter(QObject *obj, QEvent *event)
QPoint local;
QMouseEvent *me = static_cast<QMouseEvent *>(event);
WaylandSurface *targetSurface = surfaceAt(me->pos(), &local);
- if (targetSurface) {
- if (m_dragKeyIsPressed) {
- m_draggingWindow = targetSurface;
- m_drag_diff = local;
- } else {
- if (input->keyboardFocus() != targetSurface) {
- input->setKeyboardFocus(targetSurface);
- m_surfaces.removeOne(targetSurface);
- m_surfaces.append(targetSurface);
- m_renderScheduler.start(0);
- }
- input->sendMousePressEvent(me->button(),local,me->pos());
+ if (m_dragKeyIsPressed && targetSurface) {
+ m_draggingWindow = targetSurface;
+ m_drag_diff = local;
+ } else {
+ if (targetSurface && input->keyboardFocus() != targetSurface) {
+ input->setKeyboardFocus(targetSurface);
+ m_surfaces.removeOne(targetSurface);
+ m_surfaces.append(targetSurface);
+ m_renderScheduler.start(0);
}
+ input->sendMousePressEvent(me->button(),local,me->pos());
}
break;
}
@@ -287,9 +286,12 @@ bool QWindowCompositor::eventFilter(QObject *obj, QEvent *event)
if (m_draggingWindow) {
m_draggingWindow = 0;
m_drag_diff = QPoint();
- } else if (targetSurface) {
+ } else {
QMouseEvent *me = static_cast<QMouseEvent *>(event);
- input->sendMouseReleaseEvent(me->button(),toSurface(targetSurface, me->pos()).toPoint(),me->pos());
+ QPointF localPos;
+ if (targetSurface)
+ localPos = toSurface(targetSurface, me->pos());
+ input->sendMouseReleaseEvent(me->button(),localPos.toPoint(),me->pos());
}
break;
}