Specify inputTransformation in Toplevel

InputRedirection uses the inputTransformation() to pass to SeatInterface
for focused pointer surface. This prepares for proper input
transformation including scaling and rotation.
This commit is contained in:
Martin Gräßlin 2015-12-07 14:25:08 +01:00
parent 6c746764b4
commit 55bae74aae
3 changed files with 19 additions and 3 deletions

View file

@ -538,7 +538,7 @@ void InputRedirection::updatePointerWindow()
}
}
if (t && t->surface()) {
seat->setFocusedPointerSurface(t->surface(), t->pos());
seat->setFocusedPointerSurface(t->surface(), t->inputTransformation());
connect(t, &Toplevel::geometryChanged, this, &InputRedirection::updateFocusedPointerPosition);
if (AbstractBackend *b = waylandServer()->backend()) {
b->installCursorFromServer();
@ -679,7 +679,7 @@ void InputRedirection::updateFocusedPointerPosition()
if (m_pointerWindow.data()->surface() != seat->focusedPointerSurface()) {
return;
}
seat->setFocusedPointerSurfacePosition(m_pointerWindow.data()->pos());
seat->setFocusedPointerSurfaceTransformation(m_pointerWindow.data()->inputTransformation());
}
}
@ -710,7 +710,7 @@ void InputRedirection::processPointerMotion(const QPointF &pos, uint32_t time)
Toplevel *t = findToplevel(m_globalPointer.toPoint());
if (t && t->surface()) {
if (auto seat = findSeat()) {
seat->setFocusedPointerSurface(t->surface(), t->pos());
seat->setFocusedPointerSurface(t->surface(), t->inputTransformation());
seat->setTimestamp(time);
seat->setPointerPos(m_globalPointer);
}

View file

@ -517,6 +517,13 @@ void Toplevel::setInternalFramebufferObject(const QSharedPointer<QOpenGLFramebuf
setDepth(32);
}
QMatrix4x4 Toplevel::inputTransformation() const
{
QMatrix4x4 m;
m.translate(-x(), -y());
return m;
}
} // namespace
#include "toplevel.moc"

View file

@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <NETWM>
// Qt
#include <QObject>
#include <QMatrix4x4>
// xcb
#include <xcb/damage.h>
#include <xcb/xfixes.h>
@ -371,6 +372,14 @@ public:
virtual void setInternalFramebufferObject(const QSharedPointer<QOpenGLFramebufferObject> &fbo);
const QSharedPointer<QOpenGLFramebufferObject> &internalFramebufferObject() const;
/**
* @returns Transformation to map from global to window coordinates.
*
* Default implementation returns a translation on negative pos().
* @see pos
**/
virtual QMatrix4x4 inputTransformation() const;
/**
* @brief Finds the Toplevel matching the condition expressed in @p func in @p list.
*