summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-07-30 15:20:30 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:09:42 +0200
commit85b1d4e6524504321fa769457eea5fb3b7e62e7e (patch)
treed584ff5cd14e48ee792c9471b8b078163f787486
parentfb84a2bfd5ac4d4574df63d0f29d7904e043f123 (diff)
Remove transient(inactive|parent|offset) from QWaylandSurface
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp4
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.h2
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp21
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h4
-rw-r--r--src/compositor/extensions/qwlshellsurface.cpp30
-rw-r--r--src/compositor/extensions/qwlshellsurface_p.h11
-rw-r--r--src/compositor/wayland_wrapper/qwlinputdevice.cpp6
-rw-r--r--src/compositor/wayland_wrapper/qwlkeyboard.cpp8
-rw-r--r--src/compositor/wayland_wrapper/qwlkeyboard_p.h2
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface.cpp10
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface_p.h12
11 files changed, 41 insertions, 69 deletions
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index 09c0bfc9c..7d62f3898 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -108,10 +108,10 @@ QWaylandSurface *QWaylandKeyboard::focus() const
return d->focus();
}
-void QWaylandKeyboard::setFocus(QWaylandSurface *surface)
+bool QWaylandKeyboard::setFocus(QWaylandSurface *surface)
{
Q_D(QWaylandKeyboard);
- d->setFocus(surface);
+ return d->setFocus(surface);
}
void QWaylandKeyboard::setKeymap(const QWaylandKeymap &keymap)
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.h b/src/compositor/compositor_api/qwaylandkeyboard.h
index d28b5f6d0..3a7cd18da 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.h
+++ b/src/compositor/compositor_api/qwaylandkeyboard.h
@@ -91,7 +91,7 @@ public:
QWaylandInputDevice *inputDevice() const;
QWaylandCompositor *compositor() const;
- void setFocus(QWaylandSurface *surface);
+ virtual bool setFocus(QWaylandSurface *surface);
virtual void setKeymap(const QWaylandKeymap &keymap);
virtual void sendKeyModifiers(QWaylandClient *client, uint32_t serial);
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index ef7665437..81ad89529 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -201,18 +201,6 @@ QWaylandSurface::Origin QWaylandSurface::origin() const
return d->origin();
}
-QWaylandSurface *QWaylandSurface::transientParent() const
-{
- Q_D(const QWaylandSurface);
- return d->transientParent() ? d->transientParent()->waylandSurface() : 0;
-}
-
-QPointF QWaylandSurface::transientOffset() const
-{
- Q_D(const QWaylandSurface);
- return d->m_transientOffset;
-}
-
QtWayland::Surface * QWaylandSurface::handle()
{
Q_D(QWaylandSurface);
@@ -264,15 +252,6 @@ bool QWaylandSurface::hasInputPanelSurface() const
return d->inputPanelSurface() != 0;
}
-/*!
- * \return True if WL_SHELL_SURFACE_TRANSIENT_INACTIVE was set for this surface, meaning it should not receive keyboard focus.
- */
-bool QWaylandSurface::transientInactive() const
-{
- Q_D(const QWaylandSurface);
- return d->transientInactive();
-}
-
bool QWaylandSurface::inputRegionContains(const QPoint &p) const
{
Q_D(const QWaylandSurface);
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index c84aee05a..6f80f32ed 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -107,8 +107,6 @@ class Q_COMPOSITOR_EXPORT QWaylandSurface : public QObject, public QWaylandExten
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation NOTIFY contentOrientationChanged)
Q_PROPERTY(QString className READ className NOTIFY classNameChanged)
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
- Q_PROPERTY(QWaylandSurface *transientParent READ transientParent)
- Q_PROPERTY(QPointF transientOffset READ transientOffset)
Q_PROPERTY(QWaylandOutput *primaryOutput READ primaryOutput WRITE setPrimaryOutput NOTIFY primaryOutputChanged)
Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged);
@@ -154,8 +152,6 @@ public:
bool hasInputPanelSurface() const;
- bool transientInactive() const;
-
bool inputRegionContains(const QPoint &p) const;
Q_INVOKABLE void destroy();
diff --git a/src/compositor/extensions/qwlshellsurface.cpp b/src/compositor/extensions/qwlshellsurface.cpp
index 58cd6c936..2aea23ba4 100644
--- a/src/compositor/extensions/qwlshellsurface.cpp
+++ b/src/compositor/extensions/qwlshellsurface.cpp
@@ -80,7 +80,6 @@ void Shell::shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl
new ShellSurface(this, resource->client(), id, surface);
}
-
ShellSurface *ShellSurface::get(QWaylandSurface *surface)
{
return static_cast<ShellSurface *>(surface->extension(wl_shell_surface::name()));
@@ -96,6 +95,9 @@ ShellSurface::ShellSurface(Shell *shell, wl_client *client, uint32_t id, Surface
, m_popupGrabber(0)
, m_popupSerial()
, m_surfaceType(None)
+ , m_transientInactive(false)
+ , m_transientParent(0)
+ , m_transientOffset()
{
m_view = surface->compositor()->waylandCompositor()->createSurfaceView(surface->waylandSurface());
m_view->setOutput(surface->waylandSurface()->primaryOutput());
@@ -142,7 +144,7 @@ ShellSurface::SurfaceType ShellSurface::surfaceType() const
void ShellSurface::adjustPosInResize()
{
- if (m_surface->transientParent())
+ if (transientParent())
return;
if (!m_resizeGrabber || !(m_resizeGrabber->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP_LEFT))
return;
@@ -171,7 +173,7 @@ void ShellSurface::resetMoveGrabber()
void ShellSurface::setOffset(const QPointF &offset)
{
- m_surface->setTransientOffset(offset.x(), offset.y());
+ setTransientOffset(offset);
}
void ShellSurface::configure(bool hasBuffer)
@@ -260,8 +262,8 @@ void ShellSurface::shell_surface_resize(Resource *resource,
void ShellSurface::shell_surface_set_toplevel(Resource *resource)
{
Q_UNUSED(resource);
- m_surface->setTransientParent(0);
- m_surface->setTransientOffset(0, 0);
+ setTransientParent(0);
+ setTransientOffset(QPointF(0, 0));
setSurfaceType(QWaylandSurface::Toplevel);
@@ -277,11 +279,13 @@ void ShellSurface::shell_surface_set_transient(Resource *resource,
Q_UNUSED(resource);
Q_UNUSED(flags);
- Surface *parent_surface = Surface::fromResource(parent_surface_resource);
- m_surface->setTransientParent(parent_surface);
- m_surface->setTransientOffset(x, y);
+ QWaylandSurface *parent_surface = QWaylandSurface::fromResource(parent_surface_resource);
+ setTransientParent(parent_surface);
+ setTransientOffset(QPointF(x, y));
if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
- m_surface->setTransientInactive(true);
+ m_transientInactive = true;
+ else
+ m_transientInactive = false;
setSurfaceType(QWaylandSurface::Transient);
@@ -331,8 +335,8 @@ void ShellSurface::shell_surface_set_popup(Resource *resource, wl_resource *inpu
m_popupGrabber = m_shell->getPopupGrabber(input->q_func());
m_popupSerial = serial;
- m_surface->setTransientParent(Surface::fromResource(parent));
- m_surface->setTransientOffset(x, y);
+ setTransientParent(QWaylandSurface::fromResource(parent));
+ setTransientOffset(QPointF(x, y));
setSurfaceType(QWaylandSurface::Popup);
@@ -461,8 +465,8 @@ void ShellSurfaceMoveGrabber::motion(uint32_t time)
QPointF pos(pointer->currentSpacePosition() - m_offset);
shell_surface->m_view->setRequestedPosition(pos);
- if (shell_surface->m_surface->transientParent()) {
- QWaylandSurfaceView *view = shell_surface->m_surface->transientParent()->waylandSurface()->views().first();
+ if (shell_surface->transientParent()) {
+ QWaylandSurfaceView *view = shell_surface->transientParent()->views().first();
if (view)
shell_surface->setOffset(pos - view->requestedPosition());
}
diff --git a/src/compositor/extensions/qwlshellsurface_p.h b/src/compositor/extensions/qwlshellsurface_p.h
index e0bc8a888..8c1bfa710 100644
--- a/src/compositor/extensions/qwlshellsurface_p.h
+++ b/src/compositor/extensions/qwlshellsurface_p.h
@@ -116,6 +116,13 @@ public:
void setSurfaceType(SurfaceType type);
SurfaceType surfaceType() const;
+ bool isTransientInactive() const { return m_transientInactive; }
+
+ QWaylandSurface *transientParent() const { return m_transientParent; }
+ void setTransientParent(QWaylandSurface *parent) { m_transientParent = parent; }
+
+ void setTransientOffset(const QPointF &offset) { m_transientOffset = offset; }
+
Q_SIGNALS:
void surfaceTypeChanged();
@@ -137,6 +144,10 @@ private:
QSet<uint32_t> m_pings;
SurfaceType m_surfaceType;
+ bool m_transientInactive;
+
+ QWaylandSurface *m_transientParent;
+ QPointF m_transientOffset;
void shell_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
diff --git a/src/compositor/wayland_wrapper/qwlinputdevice.cpp b/src/compositor/wayland_wrapper/qwlinputdevice.cpp
index 2f972425f..52060f194 100644
--- a/src/compositor/wayland_wrapper/qwlinputdevice.cpp
+++ b/src/compositor/wayland_wrapper/qwlinputdevice.cpp
@@ -47,6 +47,7 @@
#include "qwlpointer_p.h"
#include "qwlkeyboard_p.h"
#include "qwltouch_p.h"
+#include "qwlshellsurface_p.h"
#include "qwaylandsurfaceview.h"
#include <QtCompositor/QWaylandClient>
@@ -244,11 +245,10 @@ QWaylandSurface *QWaylandInputDevicePrivate::keyboardFocus() const
*/
bool QWaylandInputDevicePrivate::setKeyboardFocus(QWaylandSurface *surface)
{
- if (surface && (surface->transientInactive() || surface->handle()->isDestroyed()))
+ if (surface && surface->handle()->isDestroyed())
return false;
- if (!m_keyboard.isNull()) {
- m_keyboard->setFocus(surface);
+ if (!m_keyboard.isNull() && m_keyboard->setFocus(surface)) {
if (m_data_device)
m_data_device->setFocus(m_keyboard->focusClient());
return true;
diff --git a/src/compositor/wayland_wrapper/qwlkeyboard.cpp b/src/compositor/wayland_wrapper/qwlkeyboard.cpp
index 9811f918a..2a0f857ea 100644
--- a/src/compositor/wayland_wrapper/qwlkeyboard.cpp
+++ b/src/compositor/wayland_wrapper/qwlkeyboard.cpp
@@ -36,7 +36,7 @@
****************************************************************************/
#include "qwlkeyboard_p.h"
-
+#include "qwlshellsurface_p.h"
#include <QFile>
#include <QStandardPaths>
@@ -133,9 +133,13 @@ void QWaylandKeyboardPrivate::focused(QWaylandSurface *surface)
Q_EMIT q_func()->focusChanged(m_focus);
}
-void QWaylandKeyboardPrivate::setFocus(QWaylandSurface* surface)
+bool QWaylandKeyboardPrivate::setFocus(QWaylandSurface* surface)
{
+ QtWayland::ShellSurface *shellsurface = QtWayland::ShellSurface::get(surface);
+ if (shellsurface && shellsurface->isTransientInactive())
+ return false;
m_grab->focused(surface);
+ return true;
}
void QWaylandKeyboardPrivate::setKeymap(const QWaylandKeymap &keymap)
diff --git a/src/compositor/wayland_wrapper/qwlkeyboard_p.h b/src/compositor/wayland_wrapper/qwlkeyboard_p.h
index 2579c2da1..c97021abd 100644
--- a/src/compositor/wayland_wrapper/qwlkeyboard_p.h
+++ b/src/compositor/wayland_wrapper/qwlkeyboard_p.h
@@ -75,7 +75,7 @@ public:
~QWaylandKeyboardPrivate();
QWaylandCompositor *compositor() const { return m_seat->compositor(); }
- void setFocus(QWaylandSurface *surface);
+ bool setFocus(QWaylandSurface *surface);
void setKeymap(const QWaylandKeymap &keymap);
void sendKeyModifiers(Resource *resource, uint32_t serial);
diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp
index d5eed707a..dd2e8aafb 100644
--- a/src/compositor/wayland_wrapper/qwlsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurface.cpp
@@ -46,7 +46,6 @@
#include "qwlregion_p.h"
#include "qwlsubsurface_p.h"
#include "qwlsurfacebuffer_p.h"
-#include "qwlshellsurface_p.h"
#include "qwaylandsurfaceview.h"
#include "qwaylandoutput.h"
@@ -122,9 +121,6 @@ Surface::Surface(struct wl_client *client, uint32_t id, int version, QWaylandCom
, m_subSurface(0)
, m_inputPanelSurface(0)
, m_inputRegion(infiniteRegion())
- , m_transientParent(0)
- , m_transientInactive(false)
- , m_transientOffset(QPointF(0, 0))
, m_isCursorSurface(false)
, m_destroyed(false)
, m_contentOrientation(Qt::PrimaryOrientation)
@@ -164,12 +160,6 @@ bool Surface::setRole(const SurfaceRole *role, wl_resource *errorResource, uint3
return true;
}
-void Surface::setTransientOffset(qreal x, qreal y)
-{
- m_transientOffset.setX(x);
- m_transientOffset.setY(y);
-}
-
Surface *Surface::fromResource(struct ::wl_resource *resource)
{
return static_cast<Surface *>(Resource::fromResource(resource)->surface_object);
diff --git a/src/compositor/wayland_wrapper/qwlsurface_p.h b/src/compositor/wayland_wrapper/qwlsurface_p.h
index e896c48a9..7ebad2c0a 100644
--- a/src/compositor/wayland_wrapper/qwlsurface_p.h
+++ b/src/compositor/wayland_wrapper/qwlsurface_p.h
@@ -67,7 +67,6 @@ namespace QtWayland {
class Compositor;
class Buffer;
-class ShellSurface;
class ExtendedSurface;
class InputPanelSurface;
class SubSurface;
@@ -123,14 +122,6 @@ public:
QString title() const { return m_title; }
void setTitle(const QString &title);
- Surface *transientParent() const { return m_transientParent; }
- void setTransientParent(Surface *parent) { m_transientParent = parent; }
-
- bool transientInactive() const { return m_transientInactive; }
- void setTransientInactive(bool v) { m_transientInactive = v; }
-
- void setTransientOffset(qreal x, qreal y);
-
bool isCursorSurface() const { return m_isCursorSurface; }
void setCursorSurface(bool isCursor) { m_isCursorSurface = isCursor; }
@@ -205,9 +196,6 @@ protected:
QSize m_size;
QString m_className;
QString m_title;
- Surface *m_transientParent;
- bool m_transientInactive;
- QPointF m_transientOffset;
bool m_isCursorSurface;
bool m_destroyed;
Qt::ScreenOrientation m_contentOrientation;