summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2012-01-10 12:28:32 +0100
committerSamuel Rødal <samuel.rodal@nokia.com>2012-01-10 16:01:22 +0100
commit86aae9eac30cda7757ee7a4eb1946985342553e9 (patch)
tree928bc17096361cfb303e28745ef2e664525c6ee8 /src/compositor/wayland_wrapper
parentdebc2fe12192cbd2ae1899ab4e3d237bbd915f0b (diff)
Add global x and y coordinates to our mouse events
Qt applications don't need global x and y, but the protocol dictates it, so someone else might need it. We still keep the api to just use the local coordinates Change-Id: I4b34df935a6692a8d72946c16603d3d600514161 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper')
-rw-r--r--src/compositor/wayland_wrapper/wlcompositor.cpp8
-rw-r--r--src/compositor/wayland_wrapper/wlcompositor.h2
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.cpp31
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.h4
4 files changed, 35 insertions, 10 deletions
diff --git a/src/compositor/wayland_wrapper/wlcompositor.cpp b/src/compositor/wayland_wrapper/wlcompositor.cpp
index 98a96258e..806a5f7d3 100644
--- a/src/compositor/wayland_wrapper/wlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/wlcompositor.cpp
@@ -285,9 +285,13 @@ Surface *Compositor::keyFocus() const
return wayland_cast<Surface *>(m_input->base()->keyboard_focus);
}
-void Compositor::setPointerFocus(Surface *surface, const QPoint &pos)
+void Compositor::setPointerFocus(Surface *surface, const QPoint &globalPos, const QPoint &localPos)
{
- wl_input_device_set_pointer_focus(m_input->base(), surface ? surface->base() : 0, currentTimeMsecs(), pos.x(), pos.y(), pos.x(), pos.y());
+ wl_input_device_set_pointer_focus(m_input->base(),
+ surface ? surface->base() : 0,
+ currentTimeMsecs(),
+ globalPos.x(), globalPos.y(),
+ localPos.x(), localPos.y());
}
Surface *Compositor::pointerFocus() const
diff --git a/src/compositor/wayland_wrapper/wlcompositor.h b/src/compositor/wayland_wrapper/wlcompositor.h
index 3ca4fd2f4..b3afe861d 100644
--- a/src/compositor/wayland_wrapper/wlcompositor.h
+++ b/src/compositor/wayland_wrapper/wlcompositor.h
@@ -78,7 +78,7 @@ public:
void setInputFocus(Surface *surface);
void setKeyFocus(Surface *surface);
Surface *keyFocus() const;
- void setPointerFocus(Surface *surface, const QPoint &point = QPoint());
+ void setPointerFocus(Surface *surface, const QPoint &globalPos = QPoint(), const QPoint &localPos = QPoint());
Surface *pointerFocus() const;
Surface *getSurfaceFromWinId(uint winId) const;
diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp
index 324b94a28..c81f746bc 100644
--- a/src/compositor/wayland_wrapper/wlsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlsurface.cpp
@@ -345,7 +345,8 @@ public:
QByteArray authenticationToken;
QVariantMap windowProperties;
- QPoint lastMousePos;
+ QPoint lastLocalMousePos;
+ QPoint lastGlobalMousePos;
struct wl_list frame_callback_list;
@@ -624,7 +625,7 @@ uint32_t BTN_MIDDLE = 0x112;
QPoint Surface::lastMousePos() const
{
Q_D(const Surface);
- return d->lastMousePos;
+ return d->lastLocalMousePos;
}
void Surface::setExtendedSurface(ExtendedSurface *extendedSurface)
@@ -665,8 +666,13 @@ ShellSurface *Surface::shellSurface() const
void Surface::sendMousePressEvent(int x, int y, Qt::MouseButton button)
{
+ sendMousePressEvent(x,y,x,y,button);
+}
+
+void Surface::sendMousePressEvent(int global_x, int global_y, int local_x, int local_y, Qt::MouseButton button)
+{
Q_D(Surface);
- sendMouseMoveEvent(x, y);
+ sendMouseMoveEvent(global_x,global_y,local_x,local_y);
uint32_t time = d->compositor->currentTimeMsecs();
struct wl_resource *pointer_focus_resource = d->compositor->defaultInputDevice()->base()->pointer_focus_resource;
if (pointer_focus_resource) {
@@ -677,8 +683,13 @@ void Surface::sendMousePressEvent(int x, int y, Qt::MouseButton button)
void Surface::sendMouseReleaseEvent(int x, int y, Qt::MouseButton button)
{
+ sendMouseReleaseEvent(x,y,x,y,button);
+}
+
+void Surface::sendMouseReleaseEvent(int global_x, int global_y, int local_x, int local_y, Qt::MouseButton button)
+{
Q_D(Surface);
- sendMouseMoveEvent(x, y);
+ sendMouseMoveEvent(global_x,global_y,local_x, local_y);
uint32_t time = d->compositor->currentTimeMsecs();
struct wl_resource *pointer_focus_resource = d->compositor->defaultInputDevice()->base()->pointer_focus_resource;
if (pointer_focus_resource) {
@@ -689,14 +700,20 @@ void Surface::sendMouseReleaseEvent(int x, int y, Qt::MouseButton button)
void Surface::sendMouseMoveEvent(int x, int y)
{
+ sendMouseMoveEvent(x,y,x,y);
+}
+
+void Surface::sendMouseMoveEvent(int global_x, int global_y, int local_x, int local_y)
+{
Q_D(Surface);
- d->lastMousePos = QPoint(x, y);
+ d->lastLocalMousePos = QPoint(local_x, local_y);
+ d->lastGlobalMousePos = QPoint(global_x, global_y);
uint32_t time = d->compositor->currentTimeMsecs();
- d->compositor->setPointerFocus(this, QPoint(x, y));
+ d->compositor->setPointerFocus(this, d->lastGlobalMousePos, d->lastLocalMousePos);
struct wl_resource *pointer_focus_resource = d->compositor->defaultInputDevice()->base()->pointer_focus_resource;
if (pointer_focus_resource) {
wl_resource_post_event(pointer_focus_resource,
- WL_INPUT_DEVICE_MOTION, time, x, y, x, y);
+ WL_INPUT_DEVICE_MOTION, time, global_x, global_y, local_x, local_y);
}
}
diff --git a/src/compositor/wayland_wrapper/wlsurface.h b/src/compositor/wayland_wrapper/wlsurface.h
index 1edf1e72f..06dd3bdb0 100644
--- a/src/compositor/wayland_wrapper/wlsurface.h
+++ b/src/compositor/wayland_wrapper/wlsurface.h
@@ -98,8 +98,12 @@ public:
#endif
void sendMousePressEvent(int x, int y, Qt::MouseButton button);
+ void sendMousePressEvent(int global_x, int global_y, int local_x, int local_y, Qt::MouseButton button);
void sendMouseReleaseEvent(int x, int y, Qt::MouseButton button);
+ void sendMouseReleaseEvent(int global_x, int global_y, int local_x, int local_y, Qt::MouseButton button);
void sendMouseMoveEvent(int x, int y);
+ void sendMouseMoveEvent(int global_x, int global_y, int local_x, int local_y);
+
void sendKeyPressEvent(uint code);
void sendKeyReleaseEvent(uint code);