diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2012-02-04 12:02:42 +0100 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2012-04-11 09:54:04 +0200 |
commit | 03c12a8dc06f5d72640fe0640588a39251cd0d27 (patch) | |
tree | e22e765f32891719d472e51f2ceb6049f6391858 /examples | |
parent | f0feb01c35717aa60258b06bf96dcfdf9d2bf1b8 (diff) | |
download | qtwayland-03c12a8dc06f5d72640fe0640588a39251cd0d27.tar.gz |
Fix QWindow Compositors input handling
Change-Id: I500c0a8e824abcf9a1e7662e1bd030ecc1b85170
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qwindow-compositor/qwindowcompositor.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/examples/qwindow-compositor/qwindowcompositor.cpp b/examples/qwindow-compositor/qwindowcompositor.cpp index 8c4f9cd3..994a991f 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; } |