Merge branch '5.4' into dev
Merge done by Giulio Camuffo Conflicts: src/client/client.pro src/client/qwaylanddisplay.cpp src/client/qwaylandinputdevice.cpp src/client/qwaylandinputdevice_p.h src/client/qwaylandwindow.cpp src/compositor/compositor_api/qwaylandsurface.cpp src/compositor/compositor_api/qwaylandsurface_p.h src/compositor/wayland_wrapper/qwlsurface.cpp Change-Id: I1df878bb54f49d953c51215a2772869e261ebe81
This commit is contained in:
commit
ab56b7a11f
@ -5,7 +5,8 @@ QT_FOR_PRIVATE += platformsupport-private
|
|||||||
MODULE=waylandclient
|
MODULE=waylandclient
|
||||||
MODULE_PLUGIN_TYPES = \
|
MODULE_PLUGIN_TYPES = \
|
||||||
wayland-graphics-integration-client \
|
wayland-graphics-integration-client \
|
||||||
wayland-inputdevice-integration
|
wayland-inputdevice-integration \
|
||||||
|
wayland-decoration-client
|
||||||
|
|
||||||
load(qt_module)
|
load(qt_module)
|
||||||
|
|
||||||
@ -71,7 +72,9 @@ SOURCES += qwaylandintegration.cpp \
|
|||||||
qwaylandtouch.cpp \
|
qwaylandtouch.cpp \
|
||||||
qwaylandqtkey.cpp \
|
qwaylandqtkey.cpp \
|
||||||
../shared/qwaylandmimehelper.cpp \
|
../shared/qwaylandmimehelper.cpp \
|
||||||
qwaylanddecoration.cpp \
|
qwaylandabstractdecoration.cpp \
|
||||||
|
qwaylanddecorationfactory.cpp \
|
||||||
|
qwaylanddecorationplugin.cpp \
|
||||||
qwaylandeventthread.cpp\
|
qwaylandeventthread.cpp\
|
||||||
qwaylandwindowmanagerintegration.cpp \
|
qwaylandwindowmanagerintegration.cpp \
|
||||||
qwaylandinputcontext.cpp \
|
qwaylandinputcontext.cpp \
|
||||||
@ -102,7 +105,9 @@ HEADERS += qwaylandintegration_p.h \
|
|||||||
qwaylandtouch_p.h \
|
qwaylandtouch_p.h \
|
||||||
qwaylandqtkey_p.h \
|
qwaylandqtkey_p.h \
|
||||||
../shared/qwaylandmimehelper.h \
|
../shared/qwaylandmimehelper.h \
|
||||||
qwaylanddecoration_p.h \
|
qwaylandabstractdecoration_p.h \
|
||||||
|
qwaylanddecorationfactory_p.h \
|
||||||
|
qwaylanddecorationplugin_p.h \
|
||||||
qwaylandeventthread_p.h \
|
qwaylandeventthread_p.h \
|
||||||
qwaylandwindowmanagerintegration_p.h \
|
qwaylandwindowmanagerintegration_p.h \
|
||||||
qwaylandinputcontext_p.h \
|
qwaylandinputcontext_p.h \
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
QWaylandInputDeviceIntegration() {}
|
QWaylandInputDeviceIntegration() {}
|
||||||
virtual ~QWaylandInputDeviceIntegration() {}
|
virtual ~QWaylandInputDeviceIntegration() {}
|
||||||
|
|
||||||
virtual QWaylandInputDevice *createInputDevice(QWaylandDisplay *d, uint32_t id) = 0;
|
virtual QWaylandInputDevice *createInputDevice(QWaylandDisplay *d, int version, uint32_t id) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"Keys": [ "bradient" ]
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
PLUGIN_TYPE = wayland-decoration-client
|
||||||
|
load(qt_plugin)
|
||||||
|
|
||||||
|
QT += waylandclient-private
|
||||||
|
|
||||||
|
OTHER_FILES += \
|
||||||
|
bradient.json
|
||||||
|
|
||||||
|
SOURCES += main.cpp
|
||||||
|
|
||||||
|
contains(QT_CONFIG, no-pkg-config) {
|
||||||
|
LIBS += -lwayland-client
|
||||||
|
} else {
|
||||||
|
CONFIG += link_pkgconfig
|
||||||
|
PKGCONFIG += wayland-client
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
|
** Copyright (C) 2014 Robin Burchell <robin.burchell@viroteck.net>
|
||||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
@ -39,20 +40,18 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qwaylanddecoration_p.h"
|
|
||||||
|
|
||||||
#include "qwaylandwindow_p.h"
|
|
||||||
#include "qwaylandshellsurface_p.h"
|
|
||||||
#include "qwaylandinputdevice_p.h"
|
|
||||||
#include "qwaylandscreen_p.h"
|
|
||||||
|
|
||||||
#include <QtGui/QGuiApplication>
|
|
||||||
#include <QtGui/QImage>
|
|
||||||
#include <QtGui/QCursor>
|
#include <QtGui/QCursor>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtGui/QPalette>
|
#include <QtGui/QPalette>
|
||||||
#include <QtGui/QLinearGradient>
|
#include <QtGui/QLinearGradient>
|
||||||
|
|
||||||
|
#include <qpa/qwindowsysteminterface.h>
|
||||||
|
|
||||||
|
#include <QtWaylandClient/private/qwaylanddecorationplugin_p.h>
|
||||||
|
#include <QtWaylandClient/private/qwaylandabstractdecoration_p.h>
|
||||||
|
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||||
|
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#define BUTTON_SPACING 5
|
#define BUTTON_SPACING 5
|
||||||
@ -123,16 +122,35 @@ static const char * const qt_normalizeup_xpm[] = {
|
|||||||
# define BUTTON_WIDTH 22
|
# define BUTTON_WIDTH 22
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QWaylandDecoration::QWaylandDecoration(QWaylandWindow *window)
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandBradientDecoration : public QWaylandAbstractDecoration
|
||||||
: m_window(window->window())
|
|
||||||
, m_wayland_window(window)
|
|
||||||
, m_isDirty(true)
|
|
||||||
, m_decorationContentImage(0)
|
|
||||||
, m_margins(3,30,3,3)
|
|
||||||
, m_mouseButtons(Qt::NoButton)
|
|
||||||
{
|
{
|
||||||
m_wayland_window->setDecoration(this);
|
public:
|
||||||
|
QWaylandBradientDecoration();
|
||||||
|
protected:
|
||||||
|
QMargins margins() const Q_DECL_OVERRIDE;
|
||||||
|
void paint(QPaintDevice *device) Q_DECL_OVERRIDE;
|
||||||
|
bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) Q_DECL_OVERRIDE;
|
||||||
|
bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) Q_DECL_OVERRIDE;
|
||||||
|
private:
|
||||||
|
void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
||||||
|
void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
||||||
|
void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
||||||
|
void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
||||||
|
|
||||||
|
QRectF closeButtonRect() const;
|
||||||
|
QRectF maximizeButtonRect() const;
|
||||||
|
QRectF minimizeButtonRect() const;
|
||||||
|
|
||||||
|
QColor m_foregroundColor;
|
||||||
|
QColor m_backgroundColor;
|
||||||
|
QStaticText m_windowTitle;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QWaylandBradientDecoration::QWaylandBradientDecoration()
|
||||||
|
: QWaylandAbstractDecoration()
|
||||||
|
{
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText);
|
m_foregroundColor = palette.color(QPalette::Active, QPalette::HighlightedText);
|
||||||
m_backgroundColor = palette.color(QPalette::Active, QPalette::Highlight);
|
m_backgroundColor = palette.color(QPalette::Active, QPalette::Highlight);
|
||||||
@ -142,32 +160,30 @@ QWaylandDecoration::QWaylandDecoration(QWaylandWindow *window)
|
|||||||
m_windowTitle.setTextOption(option);
|
m_windowTitle.setTextOption(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandDecoration::~QWaylandDecoration()
|
QRectF QWaylandBradientDecoration::closeButtonRect() const
|
||||||
{
|
{
|
||||||
m_wayland_window->setDecoration(0);
|
return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 2,
|
||||||
|
(margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QImage &QWaylandDecoration::contentImage()
|
QRectF QWaylandBradientDecoration::maximizeButtonRect() const
|
||||||
{
|
{
|
||||||
if (m_isDirty) {
|
return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 3,
|
||||||
//Update the decoration backingstore
|
(margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
|
||||||
|
|
||||||
m_decorationContentImage = QImage(window()->frameGeometry().size(), QImage::Format_ARGB32_Premultiplied);
|
|
||||||
m_decorationContentImage.fill(Qt::transparent);
|
|
||||||
this->paint(&m_decorationContentImage);
|
|
||||||
|
|
||||||
m_isDirty = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_decorationContentImage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandDecoration::update()
|
QRectF QWaylandBradientDecoration::minimizeButtonRect() const
|
||||||
{
|
{
|
||||||
m_isDirty = true;
|
return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 4,
|
||||||
|
(margins().top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandDecoration::paint(QPaintDevice *device)
|
QMargins QWaylandBradientDecoration::margins() const
|
||||||
|
{
|
||||||
|
return QMargins(3, 30, 3, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWaylandBradientDecoration::paint(QPaintDevice *device)
|
||||||
{
|
{
|
||||||
QRect surfaceRect(QPoint(), window()->frameGeometry().size());
|
QRect surfaceRect(QPoint(), window()->frameGeometry().size());
|
||||||
QRect clips[] =
|
QRect clips[] =
|
||||||
@ -199,7 +215,7 @@ void QWaylandDecoration::paint(QPaintDevice *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Window icon
|
// Window icon
|
||||||
QIcon icon = m_wayland_window->windowIcon();
|
QIcon icon = waylandWindow()->windowIcon();
|
||||||
if (!icon.isNull()) {
|
if (!icon.isNull()) {
|
||||||
QPixmap pixmap = icon.pixmap(QSize(128, 128));
|
QPixmap pixmap = icon.pixmap(QSize(128, 128));
|
||||||
QPixmap scaled = pixmap.scaled(22, 22, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
QPixmap scaled = pixmap.scaled(22, 22, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
@ -219,7 +235,7 @@ void QWaylandDecoration::paint(QPaintDevice *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QRect titleBar = top;
|
QRect titleBar = top;
|
||||||
titleBar.setLeft(m_margins.left() + BUTTON_SPACING +
|
titleBar.setLeft(margins().left() + BUTTON_SPACING +
|
||||||
(icon.isNull() ? 0 : 22 + BUTTON_SPACING));
|
(icon.isNull() ? 0 : 22 + BUTTON_SPACING));
|
||||||
titleBar.setRight(minimizeButtonRect().left() - BUTTON_SPACING);
|
titleBar.setRight(minimizeButtonRect().left() - BUTTON_SPACING);
|
||||||
|
|
||||||
@ -234,7 +250,7 @@ void QWaylandDecoration::paint(QPaintDevice *device)
|
|||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
QPoint windowTitlePoint(top.topLeft().x() + dx,
|
QPoint windowTitlePoint(top.topLeft().x() + dx,
|
||||||
top.topLeft().y() + dy);
|
top.topLeft().y() + dy);
|
||||||
p.drawStaticText(windowTitlePoint,m_windowTitle);
|
p.drawStaticText(windowTitlePoint, m_windowTitle);
|
||||||
p.restore();
|
p.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +262,7 @@ void QWaylandDecoration::paint(QPaintDevice *device)
|
|||||||
p.drawPixmap(closeButtonRect(), closePixmap, closePixmap.rect());
|
p.drawPixmap(closeButtonRect(), closePixmap, closePixmap.rect());
|
||||||
|
|
||||||
// Maximize button
|
// Maximize button
|
||||||
QPixmap maximizePixmap(m_wayland_window->isMaximized()
|
QPixmap maximizePixmap(waylandWindow()->isMaximized()
|
||||||
? qt_normalizeup_xpm : qt_maximize_xpm);
|
? qt_normalizeup_xpm : qt_maximize_xpm);
|
||||||
p.drawPixmap(maximizeButtonRect(), maximizePixmap, maximizePixmap.rect());
|
p.drawPixmap(maximizeButtonRect(), maximizePixmap, maximizePixmap.rect());
|
||||||
|
|
||||||
@ -282,7 +298,7 @@ void QWaylandDecoration::paint(QPaintDevice *device)
|
|||||||
p.save();
|
p.save();
|
||||||
p.drawRect(maximizeButtonRect());
|
p.drawRect(maximizeButtonRect());
|
||||||
rect = maximizeButtonRect().adjusted(5, 5, -5, -5);
|
rect = maximizeButtonRect().adjusted(5, 5, -5, -5);
|
||||||
if (m_wayland_window->isMaximized()) {
|
if (waylandWindow()->isMaximized()) {
|
||||||
QRectF rect1 = rect.adjusted(rect.width() / 3, 0, 0, -rect.height() / 3);
|
QRectF rect1 = rect.adjusted(rect.width() / 3, 0, 0, -rect.height() / 3);
|
||||||
QRectF rect2 = rect.adjusted(0, rect.height() / 4, -rect.width() / 4, 0);
|
QRectF rect2 = rect.adjusted(0, rect.height() / 4, -rect.width() / 4, 0);
|
||||||
p.drawRect(rect1);
|
p.drawRect(rect1);
|
||||||
@ -305,37 +321,37 @@ void QWaylandDecoration::paint(QPaintDevice *device)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
bool QWaylandBradientDecoration::handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
||||||
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(global);
|
Q_UNUSED(global);
|
||||||
|
|
||||||
// Figure out what area mouse is in
|
// Figure out what area mouse is in
|
||||||
if (closeButtonRect().contains(local) && isLeftClicked(b)) {
|
if (closeButtonRect().contains(local) && isLeftClicked(b)) {
|
||||||
QWindowSystemInterface::handleCloseEvent(m_window);
|
QWindowSystemInterface::handleCloseEvent(window());
|
||||||
} else if (maximizeButtonRect().contains(local) && isLeftClicked(b)) {
|
} else if (maximizeButtonRect().contains(local) && isLeftClicked(b)) {
|
||||||
m_window->setWindowState(m_wayland_window->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized);
|
window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized);
|
||||||
} else if (minimizeButtonRect().contains(local) && isLeftClicked(b)) {
|
} else if (minimizeButtonRect().contains(local) && isLeftClicked(b)) {
|
||||||
m_window->setWindowState(Qt::WindowMinimized);
|
window()->setWindowState(Qt::WindowMinimized);
|
||||||
} else if (local.y() <= m_margins.top()) {
|
} else if (local.y() <= margins().top()) {
|
||||||
processMouseTop(inputDevice,local,b,mods);
|
processMouseTop(inputDevice,local,b,mods);
|
||||||
} else if (local.y() > m_window->height() - m_margins.bottom() + m_margins.top()) {
|
} else if (local.y() > window()->height() - margins().bottom() + margins().top()) {
|
||||||
processMouseBottom(inputDevice,local,b,mods);
|
processMouseBottom(inputDevice,local,b,mods);
|
||||||
} else if (local.x() <= m_margins.left()) {
|
} else if (local.x() <= margins().left()) {
|
||||||
processMouseLeft(inputDevice,local,b,mods);
|
processMouseLeft(inputDevice,local,b,mods);
|
||||||
} else if (local.x() > m_window->width() - m_margins.right() + m_margins.left()) {
|
} else if (local.x() > window()->width() - margins().right() + margins().left()) {
|
||||||
processMouseRight(inputDevice,local,b,mods);
|
processMouseRight(inputDevice,local,b,mods);
|
||||||
} else {
|
} else {
|
||||||
m_wayland_window->restoreMouseCursor(inputDevice);
|
waylandWindow()->restoreMouseCursor(inputDevice);
|
||||||
m_mouseButtons = b;
|
setMouseButtons(b);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mouseButtons = b;
|
setMouseButtons(b);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods)
|
bool QWaylandBradientDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods)
|
||||||
{
|
{
|
||||||
Q_UNUSED(inputDevice);
|
Q_UNUSED(inputDevice);
|
||||||
Q_UNUSED(global);
|
Q_UNUSED(global);
|
||||||
@ -343,13 +359,13 @@ bool QWaylandDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPo
|
|||||||
bool handled = state == Qt::TouchPointPressed;
|
bool handled = state == Qt::TouchPointPressed;
|
||||||
if (handled) {
|
if (handled) {
|
||||||
if (closeButtonRect().contains(local))
|
if (closeButtonRect().contains(local))
|
||||||
QWindowSystemInterface::handleCloseEvent(m_window);
|
QWindowSystemInterface::handleCloseEvent(window());
|
||||||
else if (maximizeButtonRect().contains(local))
|
else if (maximizeButtonRect().contains(local))
|
||||||
m_window->setWindowState(m_wayland_window->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized);
|
window()->setWindowState(waylandWindow()->isMaximized() ? Qt::WindowNoState : Qt::WindowMaximized);
|
||||||
else if (minimizeButtonRect().contains(local))
|
else if (minimizeButtonRect().contains(local))
|
||||||
m_window->setWindowState(Qt::WindowMinimized);
|
window()->setWindowState(Qt::WindowMinimized);
|
||||||
else if (local.y() <= m_margins.top())
|
else if (local.y() <= margins().top())
|
||||||
m_wayland_window->shellSurface()->move(inputDevice);
|
waylandWindow()->shellSurface()->move(inputDevice);
|
||||||
else
|
else
|
||||||
handled = false;
|
handled = false;
|
||||||
}
|
}
|
||||||
@ -357,115 +373,80 @@ bool QWaylandDecoration::handleTouch(QWaylandInputDevice *inputDevice, const QPo
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandDecoration::inMouseButtonPressedState() const
|
void QWaylandBradientDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
||||||
{
|
|
||||||
return m_mouseButtons & Qt::NoButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons)
|
|
||||||
{
|
|
||||||
if (isLeftClicked(buttons)) {
|
|
||||||
m_wayland_window->shellSurface()->resize(inputDevice, resize);
|
|
||||||
inputDevice->removeMouseButtonFromState(Qt::LeftButton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons)
|
|
||||||
{
|
|
||||||
if (isLeftClicked(buttons)) {
|
|
||||||
m_wayland_window->shellSurface()->move(inputDevice);
|
|
||||||
inputDevice->removeMouseButtonFromState(Qt::LeftButton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandDecoration::processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
|
||||||
{
|
{
|
||||||
Q_UNUSED(mods);
|
Q_UNUSED(mods);
|
||||||
if (local.y() <= m_margins.bottom()) {
|
if (local.y() <= margins().bottom()) {
|
||||||
if (local.x() <= margins().left()) {
|
if (local.x() <= margins().left()) {
|
||||||
//top left bit
|
//top left bit
|
||||||
m_wayland_window->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
|
waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
|
||||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b);
|
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_LEFT,b);
|
||||||
} else if (local.x() > m_window->width() - margins().right()) {
|
} else if (local.x() > window()->width() - margins().right()) {
|
||||||
//top right bit
|
//top right bit
|
||||||
m_wayland_window->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
|
waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
|
||||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b);
|
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP_RIGHT,b);
|
||||||
} else {
|
} else {
|
||||||
//top reszie bit
|
//top reszie bit
|
||||||
m_wayland_window->setMouseCursor(inputDevice, Qt::SplitVCursor);
|
waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor);
|
||||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b);
|
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_TOP,b);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_wayland_window->restoreMouseCursor(inputDevice);
|
waylandWindow()->restoreMouseCursor(inputDevice);
|
||||||
startMove(inputDevice,b);
|
startMove(inputDevice,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
void QWaylandBradientDecoration::processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
||||||
{
|
{
|
||||||
Q_UNUSED(mods);
|
Q_UNUSED(mods);
|
||||||
if (local.x() <= margins().left()) {
|
if (local.x() <= margins().left()) {
|
||||||
//bottom left bit
|
//bottom left bit
|
||||||
m_wayland_window->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
|
waylandWindow()->setMouseCursor(inputDevice, Qt::SizeBDiagCursor);
|
||||||
startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b);
|
startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT,b);
|
||||||
} else if (local.x() > m_window->width() - margins().right()) {
|
} else if (local.x() > window()->width() - margins().right()) {
|
||||||
//bottom right bit
|
//bottom right bit
|
||||||
m_wayland_window->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
|
waylandWindow()->setMouseCursor(inputDevice, Qt::SizeFDiagCursor);
|
||||||
startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b);
|
startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT,b);
|
||||||
} else {
|
} else {
|
||||||
//bottom bit
|
//bottom bit
|
||||||
m_wayland_window->setMouseCursor(inputDevice, Qt::SplitVCursor);
|
waylandWindow()->setMouseCursor(inputDevice, Qt::SplitVCursor);
|
||||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_BOTTOM,b);
|
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_BOTTOM,b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
void QWaylandBradientDecoration::processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
||||||
{
|
{
|
||||||
Q_UNUSED(local);
|
Q_UNUSED(local);
|
||||||
Q_UNUSED(mods);
|
Q_UNUSED(mods);
|
||||||
m_wayland_window->setMouseCursor(inputDevice, Qt::SplitHCursor);
|
waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor);
|
||||||
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b);
|
startResize(inputDevice,WL_SHELL_SURFACE_RESIZE_LEFT,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
void QWaylandBradientDecoration::processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
|
||||||
{
|
{
|
||||||
Q_UNUSED(local);
|
Q_UNUSED(local);
|
||||||
Q_UNUSED(mods);
|
Q_UNUSED(mods);
|
||||||
m_wayland_window->setMouseCursor(inputDevice, Qt::SplitHCursor);
|
waylandWindow()->setMouseCursor(inputDevice, Qt::SplitHCursor);
|
||||||
startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b);
|
startResize(inputDevice, WL_SHELL_SURFACE_RESIZE_RIGHT,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState)
|
class QWaylandBradientDecorationPlugin : public QWaylandDecorationPlugin
|
||||||
{
|
{
|
||||||
if ((!m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton))
|
Q_OBJECT
|
||||||
return true;
|
Q_PLUGIN_METADATA(IID QWaylandDecorationFactoryInterface_iid FILE "bradient.json")
|
||||||
return false;
|
public:
|
||||||
|
QWaylandAbstractDecoration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
|
||||||
|
};
|
||||||
|
|
||||||
|
QWaylandAbstractDecoration *QWaylandBradientDecorationPlugin::create(const QString& system, const QStringList& paramList)
|
||||||
|
{
|
||||||
|
Q_UNUSED(paramList);
|
||||||
|
Q_UNUSED(system);
|
||||||
|
return new QWaylandBradientDecoration();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandDecoration::isLeftReleased(Qt::MouseButtons newMouseButtonState)
|
|
||||||
{
|
|
||||||
if ((m_mouseButtons & Qt::LeftButton) && !(newMouseButtonState & Qt::LeftButton))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF QWaylandDecoration::closeButtonRect() const
|
|
||||||
{
|
|
||||||
return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH - BUTTON_SPACING * 2,
|
|
||||||
(m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF QWaylandDecoration::maximizeButtonRect() const
|
|
||||||
{
|
|
||||||
return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 2 - BUTTON_SPACING * 3,
|
|
||||||
(m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF QWaylandDecoration::minimizeButtonRect() const
|
|
||||||
{
|
|
||||||
return QRectF(window()->frameGeometry().width() - BUTTON_WIDTH * 3 - BUTTON_SPACING * 4,
|
|
||||||
(m_margins.top() - BUTTON_WIDTH) / 2, BUTTON_WIDTH, BUTTON_WIDTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#include "main.moc"
|
@ -0,0 +1,3 @@
|
|||||||
|
TEMPLATE = subdirs
|
||||||
|
SUBDIRS += \
|
||||||
|
bradient
|
187
src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp
Normal file
187
src/plugins/platforms/wayland/qwaylandabstractdecoration.cpp
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 Robin Burchell <robin.burchell@viroteck.net>
|
||||||
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the plugins of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qwaylandabstractdecoration_p.h"
|
||||||
|
|
||||||
|
#include <private/qobject_p.h>
|
||||||
|
#include "qwaylandwindow_p.h"
|
||||||
|
#include "qwaylandshellsurface_p.h"
|
||||||
|
#include "qwaylandinputdevice_p.h"
|
||||||
|
#include "qwaylandscreen_p.h"
|
||||||
|
|
||||||
|
#include <QtGui/QImage>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class QWaylandAbstractDecorationPrivate : public QObjectPrivate
|
||||||
|
{
|
||||||
|
Q_DECLARE_PUBLIC(QWaylandAbstractDecoration)
|
||||||
|
|
||||||
|
public:
|
||||||
|
QWaylandAbstractDecorationPrivate();
|
||||||
|
~QWaylandAbstractDecorationPrivate();
|
||||||
|
|
||||||
|
QWindow *m_window;
|
||||||
|
QWaylandWindow *m_wayland_window;
|
||||||
|
|
||||||
|
bool m_isDirty;
|
||||||
|
QImage m_decorationContentImage;
|
||||||
|
|
||||||
|
Qt::MouseButtons m_mouseButtons;
|
||||||
|
};
|
||||||
|
|
||||||
|
QWaylandAbstractDecorationPrivate::QWaylandAbstractDecorationPrivate()
|
||||||
|
: m_window(0)
|
||||||
|
, m_wayland_window(0)
|
||||||
|
, m_isDirty(true)
|
||||||
|
, m_decorationContentImage(0)
|
||||||
|
, m_mouseButtons(Qt::NoButton)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QWaylandAbstractDecorationPrivate::~QWaylandAbstractDecorationPrivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QWaylandAbstractDecoration::QWaylandAbstractDecoration()
|
||||||
|
: QObject(*new QWaylandAbstractDecorationPrivate)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QWaylandAbstractDecoration::~QWaylandAbstractDecoration()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// we do this as a setter to get around plugin factory creates not really
|
||||||
|
// being a great way to pass arguments
|
||||||
|
void QWaylandAbstractDecoration::setWaylandWindow(QWaylandWindow *window)
|
||||||
|
{
|
||||||
|
Q_D(QWaylandAbstractDecoration);
|
||||||
|
|
||||||
|
// double initialization is probably not great
|
||||||
|
Q_ASSERT(!d->m_window && !d->m_wayland_window);
|
||||||
|
|
||||||
|
d->m_window = window->window();
|
||||||
|
d->m_wayland_window = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QImage &QWaylandAbstractDecoration::contentImage()
|
||||||
|
{
|
||||||
|
Q_D(QWaylandAbstractDecoration);
|
||||||
|
if (d->m_isDirty) {
|
||||||
|
//Update the decoration backingstore
|
||||||
|
|
||||||
|
d->m_decorationContentImage = QImage(window()->frameGeometry().size(), QImage::Format_ARGB32_Premultiplied);
|
||||||
|
d->m_decorationContentImage.fill(Qt::transparent);
|
||||||
|
this->paint(&d->m_decorationContentImage);
|
||||||
|
|
||||||
|
d->m_isDirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return d->m_decorationContentImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWaylandAbstractDecoration::update()
|
||||||
|
{
|
||||||
|
Q_D(QWaylandAbstractDecoration);
|
||||||
|
d->m_isDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWaylandAbstractDecoration::setMouseButtons(Qt::MouseButtons mb)
|
||||||
|
{
|
||||||
|
Q_D(QWaylandAbstractDecoration);
|
||||||
|
d->m_mouseButtons = mb;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWaylandAbstractDecoration::startResize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize resize, Qt::MouseButtons buttons)
|
||||||
|
{
|
||||||
|
Q_D(QWaylandAbstractDecoration);
|
||||||
|
if (isLeftClicked(buttons)) {
|
||||||
|
d->m_wayland_window->shellSurface()->resize(inputDevice, resize);
|
||||||
|
inputDevice->removeMouseButtonFromState(Qt::LeftButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWaylandAbstractDecoration::startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons)
|
||||||
|
{
|
||||||
|
Q_D(QWaylandAbstractDecoration);
|
||||||
|
if (isLeftClicked(buttons)) {
|
||||||
|
d->m_wayland_window->shellSurface()->move(inputDevice);
|
||||||
|
inputDevice->removeMouseButtonFromState(Qt::LeftButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QWaylandAbstractDecoration::isLeftClicked(Qt::MouseButtons newMouseButtonState)
|
||||||
|
{
|
||||||
|
Q_D(QWaylandAbstractDecoration);
|
||||||
|
if ((!d->m_mouseButtons & Qt::LeftButton) && (newMouseButtonState & Qt::LeftButton))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QWaylandAbstractDecoration::isLeftReleased(Qt::MouseButtons newMouseButtonState)
|
||||||
|
{
|
||||||
|
Q_D(QWaylandAbstractDecoration);
|
||||||
|
if ((d->m_mouseButtons & Qt::LeftButton) && !(newMouseButtonState & Qt::LeftButton))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QWaylandAbstractDecoration::isDirty() const
|
||||||
|
{
|
||||||
|
Q_D(const QWaylandAbstractDecoration);
|
||||||
|
return d->m_isDirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWindow *QWaylandAbstractDecoration::window() const
|
||||||
|
{
|
||||||
|
Q_D(const QWaylandAbstractDecoration);
|
||||||
|
return d->m_window;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWaylandWindow *QWaylandAbstractDecoration::waylandWindow() const
|
||||||
|
{
|
||||||
|
Q_D(const QWaylandAbstractDecoration);
|
||||||
|
return d->m_wayland_window;
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
@ -1,5 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
|
** Copyright (C) 2014 Robin Burchell <robin.burchell@viroteck.net>
|
||||||
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
||||||
** Contact: http://www.qt-project.org/legal
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
@ -39,8 +40,8 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QWAYLANDDECORATION_H
|
#ifndef QWAYLANDABSTRACTDECORATION_H
|
||||||
#define QWAYLANDDECORATION_H
|
#define QWAYLANDABSTRACTDECORATION_H
|
||||||
|
|
||||||
#include <QtCore/QMargins>
|
#include <QtCore/QMargins>
|
||||||
#include <QtCore/QPointF>
|
#include <QtCore/QPointF>
|
||||||
@ -64,77 +65,41 @@ class QEvent;
|
|||||||
class QWaylandScreen;
|
class QWaylandScreen;
|
||||||
class QWaylandWindow;
|
class QWaylandWindow;
|
||||||
class QWaylandInputDevice;
|
class QWaylandInputDevice;
|
||||||
|
class QWaylandAbstractDecorationPrivate;
|
||||||
|
|
||||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandDecoration
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandAbstractDecoration : public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_DECLARE_PRIVATE(QWaylandAbstractDecoration)
|
||||||
public:
|
public:
|
||||||
QWaylandDecoration(QWaylandWindow *window);
|
QWaylandAbstractDecoration();
|
||||||
virtual ~QWaylandDecoration();
|
virtual ~QWaylandAbstractDecoration();
|
||||||
|
|
||||||
|
void setWaylandWindow(QWaylandWindow *window);
|
||||||
|
QWaylandWindow *waylandWindow() const;
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
bool isDirty() const;
|
bool isDirty() const;
|
||||||
|
|
||||||
bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
virtual QMargins margins() const = 0;
|
||||||
bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods);
|
QWindow *window() const;
|
||||||
bool inMouseButtonPressedState() const;
|
const QImage &contentImage();
|
||||||
|
|
||||||
|
virtual bool handleMouse(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global,Qt::MouseButtons b,Qt::KeyboardModifiers mods) = 0;
|
||||||
|
virtual bool handleTouch(QWaylandInputDevice *inputDevice, const QPointF &local, const QPointF &global, Qt::TouchPointState state, Qt::KeyboardModifiers mods) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void paint(QPaintDevice *device) = 0;
|
||||||
|
|
||||||
|
void setMouseButtons(Qt::MouseButtons mb);
|
||||||
|
|
||||||
void startResize(QWaylandInputDevice *inputDevice,enum wl_shell_surface_resize resize, Qt::MouseButtons buttons);
|
void startResize(QWaylandInputDevice *inputDevice,enum wl_shell_surface_resize resize, Qt::MouseButtons buttons);
|
||||||
void startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons);
|
void startMove(QWaylandInputDevice *inputDevice, Qt::MouseButtons buttons);
|
||||||
QMargins margins() const;
|
|
||||||
QWindow *window() const;
|
|
||||||
QWaylandWindow *waylandWindow() const;
|
|
||||||
const QImage &contentImage();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paint(QPaintDevice *device);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void processMouseTop(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
|
||||||
void processMouseBottom(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
|
||||||
void processMouseLeft(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
|
||||||
void processMouseRight(QWaylandInputDevice *inputDevice, const QPointF &local, Qt::MouseButtons b,Qt::KeyboardModifiers mods);
|
|
||||||
|
|
||||||
bool isLeftClicked(Qt::MouseButtons newMouseButtonState);
|
bool isLeftClicked(Qt::MouseButtons newMouseButtonState);
|
||||||
bool isLeftReleased(Qt::MouseButtons newMouseButtonState);
|
bool isLeftReleased(Qt::MouseButtons newMouseButtonState);
|
||||||
|
|
||||||
QRectF closeButtonRect() const;
|
|
||||||
QRectF maximizeButtonRect() const;
|
|
||||||
QRectF minimizeButtonRect() const;
|
|
||||||
|
|
||||||
QWindow *m_window;
|
|
||||||
QWaylandWindow *m_wayland_window;
|
|
||||||
|
|
||||||
bool m_isDirty;
|
|
||||||
QImage m_decorationContentImage;
|
|
||||||
|
|
||||||
QMargins m_margins;
|
|
||||||
Qt::MouseButtons m_mouseButtons;
|
|
||||||
|
|
||||||
QColor m_foregroundColor;
|
|
||||||
QColor m_backgroundColor;
|
|
||||||
QStaticText m_windowTitle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool QWaylandDecoration::isDirty() const
|
|
||||||
{
|
|
||||||
return m_isDirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QMargins QWaylandDecoration::margins() const
|
|
||||||
{
|
|
||||||
return m_margins;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QWindow *QWaylandDecoration::window() const
|
|
||||||
{
|
|
||||||
return m_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QWaylandWindow *QWaylandDecoration::waylandWindow() const
|
|
||||||
{
|
|
||||||
return m_wayland_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QWAYLANDDECORATION_H
|
#endif // QWAYLANDABSTRACTDECORATION_H
|
@ -66,11 +66,14 @@ QWaylandCursor::QWaylandCursor(QWaylandScreen *screen)
|
|||||||
if (!hasCursorSize || cursorSize <= 0)
|
if (!hasCursorSize || cursorSize <= 0)
|
||||||
cursorSize = 32;
|
cursorSize = 32;
|
||||||
mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm());
|
mCursorTheme = wl_cursor_theme_load(cursorTheme, cursorSize, mDisplay->shm());
|
||||||
|
if (!mCursorTheme)
|
||||||
|
qDebug() << "Could not load theme" << cursorTheme;
|
||||||
initCursorMap();
|
initCursorMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandCursor::~QWaylandCursor()
|
QWaylandCursor::~QWaylandCursor()
|
||||||
{
|
{
|
||||||
|
if (mCursorTheme)
|
||||||
wl_cursor_theme_destroy(mCursorTheme);
|
wl_cursor_theme_destroy(mCursorTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +163,9 @@ wl_cursor *QWaylandCursor::requestCursor(WaylandCursor shape)
|
|||||||
|
|
||||||
//If the cursor has not been loaded already, load it
|
//If the cursor has not been loaded already, load it
|
||||||
if (!cursor) {
|
if (!cursor) {
|
||||||
|
if (!mCursorTheme)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
QList<QByteArray> cursorNames = mCursorNamesMap.values(shape);
|
QList<QByteArray> cursorNames = mCursorNamesMap.values(shape);
|
||||||
foreach (QByteArray name, cursorNames) {
|
foreach (QByteArray name, cursorNames) {
|
||||||
cursor = wl_cursor_theme_get_cursor(mCursorTheme, name.constData());
|
cursor = wl_cursor_theme_get_cursor(mCursorTheme, name.constData());
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice)
|
QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice)
|
||||||
: QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat()))
|
: QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat()))
|
||||||
, m_display(manager->display())
|
, m_display(manager->display())
|
||||||
|
, m_inputDevice(inputDevice)
|
||||||
, m_enterSerial(0)
|
, m_enterSerial(0)
|
||||||
, m_dragWindow(0)
|
, m_dragWindow(0)
|
||||||
, m_dragPoint()
|
, m_dragPoint()
|
||||||
@ -92,7 +93,7 @@ void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source)
|
|||||||
m_selectionSource.reset(source);
|
m_selectionSource.reset(source);
|
||||||
if (source)
|
if (source)
|
||||||
connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled);
|
connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled);
|
||||||
set_selection(source ? source->object() : 0, 0 /* TODO m_display->serial() */);
|
set_selection(source ? source->object() : Q_NULLPTR, m_inputDevice->serial());
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandDataOffer *QWaylandDataDevice::dragOffer() const
|
QWaylandDataOffer *QWaylandDataDevice::dragOffer() const
|
||||||
|
@ -88,7 +88,7 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QWaylandDisplay *m_display;
|
QWaylandDisplay *m_display;
|
||||||
|
QWaylandInputDevice *m_inputDevice;
|
||||||
uint32_t m_enterSerial;
|
uint32_t m_enterSerial;
|
||||||
QWindow *m_dragWindow;
|
QWindow *m_dragWindow;
|
||||||
QPoint m_dragPoint;
|
QPoint m_dragPoint;
|
||||||
|
97
src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp
Normal file
97
src/plugins/platforms/wayland/qwaylanddecorationfactory.cpp
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 Robin Burchell <robin.burchell@viroteck.net>
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the plugins of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qwaylanddecorationfactory_p.h"
|
||||||
|
#include "qwaylanddecorationplugin_p.h"
|
||||||
|
|
||||||
|
#include <QtCore/private/qfactoryloader_p.h>
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
#ifndef QT_NO_LIBRARY
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
|
||||||
|
(QWaylandDecorationFactoryInterface_iid, QLatin1String("/wayland-decoration-client"), Qt::CaseInsensitive))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
|
||||||
|
(QWaylandDecorationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QStringList QWaylandDecorationFactory::keys(const QString &pluginPath)
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_LIBRARY
|
||||||
|
QStringList list;
|
||||||
|
if (!pluginPath.isEmpty()) {
|
||||||
|
QCoreApplication::addLibraryPath(pluginPath);
|
||||||
|
list = directLoader()->keyMap().values();
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
const QString postFix = QStringLiteral(" (from ")
|
||||||
|
+ QDir::toNativeSeparators(pluginPath)
|
||||||
|
+ QLatin1Char(')');
|
||||||
|
const QStringList::iterator end = list.end();
|
||||||
|
for (QStringList::iterator it = list.begin(); it != end; ++it)
|
||||||
|
(*it).append(postFix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.append(loader()->keyMap().values());
|
||||||
|
return list;
|
||||||
|
#else
|
||||||
|
return QStringList();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
QWaylandAbstractDecoration *QWaylandDecorationFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_LIBRARY
|
||||||
|
// Try loading the plugin from platformPluginPath first:
|
||||||
|
if (!pluginPath.isEmpty()) {
|
||||||
|
QCoreApplication::addLibraryPath(pluginPath);
|
||||||
|
if (QWaylandAbstractDecoration *ret = qLoadPlugin1<QWaylandAbstractDecoration, QWaylandDecorationPlugin>(directLoader(), name, args))
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
if (QWaylandAbstractDecoration *ret = qLoadPlugin1<QWaylandAbstractDecoration, QWaylandDecorationPlugin>(loader(), name, args))
|
||||||
|
return ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
61
src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h
Normal file
61
src/plugins/platforms/wayland/qwaylanddecorationfactory_p.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 Robin Burchell <robin.burchell@viroteck.net>
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the plugins of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QWAYLANDDECORATIONFACTORY_H
|
||||||
|
#define QWAYLANDDECORATIONFACTORY_H
|
||||||
|
|
||||||
|
#include <QtWaylandClient/private/qwaylandclientexport_p.h>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class QWaylandAbstractDecoration;
|
||||||
|
|
||||||
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static QStringList keys(const QString &pluginPath = QString());
|
||||||
|
static QWaylandAbstractDecoration *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // QWAYLANDDECORATIONFACTORY_H
|
54
src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp
Normal file
54
src/plugins/platforms/wayland/qwaylanddecorationplugin.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 Robin Burchell <robin.burchell@viroteck.net>
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the QtGui module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qwaylanddecorationplugin_p.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
QWaylandDecorationPlugin::QWaylandDecorationPlugin(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
QWaylandDecorationPlugin::~QWaylandDecorationPlugin()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
69
src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h
Normal file
69
src/plugins/platforms/wayland/qwaylanddecorationplugin_p.h
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2014 Robin Burchell <robin.burchell@viroteck.net>
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the plugins of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QWAYLANDDECORATIONPLUGIN_H
|
||||||
|
#define QWAYLANDDECORATIONPLUGIN_H
|
||||||
|
|
||||||
|
#include <QtWaylandClient/private/qwaylandclientexport_p.h>
|
||||||
|
|
||||||
|
#include <QtCore/qplugin.h>
|
||||||
|
#include <QtCore/qfactoryinterface.h>
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class QWaylandAbstractDecoration;
|
||||||
|
|
||||||
|
#define QWaylandDecorationFactoryInterface_iid "org.qt-project.Qt.WaylandClient.QWaylandDecorationFactoryInterface.5.4"
|
||||||
|
|
||||||
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandDecorationPlugin : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QWaylandDecorationPlugin(QObject *parent = 0);
|
||||||
|
~QWaylandDecorationPlugin();
|
||||||
|
|
||||||
|
virtual QWaylandAbstractDecoration *create(const QString &key, const QStringList ¶mList) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // QWAYLANDDECORATIONPLUGIN_H
|
@ -159,6 +159,7 @@ QWaylandDisplay::QWaylandDisplay(QWaylandIntegration *waylandIntegration)
|
|||||||
init(registry);
|
init(registry);
|
||||||
|
|
||||||
connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests()));
|
connect(mEventThreadObject, SIGNAL(newEventsRead()), this, SLOT(flushRequests()));
|
||||||
|
connect(mEventThreadObject, &QWaylandEventThread::fatalError, this, &QWaylandDisplay::exitWithError);
|
||||||
|
|
||||||
mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this));
|
mWindowManagerIntegration.reset(new QWaylandWindowManagerIntegration(this));
|
||||||
|
|
||||||
@ -177,8 +178,10 @@ QWaylandDisplay::~QWaylandDisplay(void)
|
|||||||
|
|
||||||
void QWaylandDisplay::flushRequests()
|
void QWaylandDisplay::flushRequests()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0)
|
if (wl_display_dispatch_queue_pending(mDisplay, mEventQueue) < 0) {
|
||||||
mEventThreadObject->checkErrorAndExit();
|
mEventThreadObject->checkError();
|
||||||
|
exitWithError();
|
||||||
|
}
|
||||||
|
|
||||||
wl_display_flush(mDisplay);
|
wl_display_flush(mDisplay);
|
||||||
}
|
}
|
||||||
@ -186,8 +189,15 @@ void QWaylandDisplay::flushRequests()
|
|||||||
|
|
||||||
void QWaylandDisplay::blockingReadEvents()
|
void QWaylandDisplay::blockingReadEvents()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0)
|
if (wl_display_dispatch_queue(mDisplay, mEventQueue) < 0) {
|
||||||
mEventThreadObject->checkErrorAndExit();
|
mEventThreadObject->checkError();
|
||||||
|
exitWithError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWaylandDisplay::exitWithError()
|
||||||
|
{
|
||||||
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const
|
QWaylandScreen *QWaylandDisplay::screenForOutput(struct wl_output *output) const
|
||||||
@ -226,13 +236,14 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
struct ::wl_registry *registry = object();
|
struct ::wl_registry *registry = object();
|
||||||
|
|
||||||
if (interface == QStringLiteral("wl_output")) {
|
if (interface == QStringLiteral("wl_output")) {
|
||||||
QWaylandScreen *screen = new QWaylandScreen(this, id);
|
QWaylandScreen *screen = new QWaylandScreen(this, version, id);
|
||||||
mScreens.append(screen);
|
mScreens.append(screen);
|
||||||
// We need to get the output events before creating surfaces
|
// We need to get the output events before creating surfaces
|
||||||
forceRoundTrip();
|
forceRoundTrip();
|
||||||
mWaylandIntegration->screenAdded(screen);
|
mWaylandIntegration->screenAdded(screen);
|
||||||
} else if (interface == QStringLiteral("wl_compositor")) {
|
} else if (interface == QStringLiteral("wl_compositor")) {
|
||||||
mCompositor.init(registry, id, 3);
|
mCompositorVersion = qMin((int)version, 3);
|
||||||
|
mCompositor.init(registry, id, mCompositorVersion);
|
||||||
} else if (interface == QStringLiteral("wl_shm")) {
|
} else if (interface == QStringLiteral("wl_shm")) {
|
||||||
mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
|
mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
|
||||||
} else if (interface == QStringLiteral("xdg_shell")
|
} else if (interface == QStringLiteral("xdg_shell")
|
||||||
@ -241,7 +252,7 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
|
|||||||
} else if (interface == QStringLiteral("wl_shell")){
|
} else if (interface == QStringLiteral("wl_shell")){
|
||||||
mShell.reset(new QtWayland::wl_shell(registry, id, 1));
|
mShell.reset(new QtWayland::wl_shell(registry, id, 1));
|
||||||
} else if (interface == QStringLiteral("wl_seat")) {
|
} else if (interface == QStringLiteral("wl_seat")) {
|
||||||
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, id);
|
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
|
||||||
mInputDevices.append(inputDevice);
|
mInputDevices.append(inputDevice);
|
||||||
} else if (interface == QStringLiteral("wl_data_device_manager")) {
|
} else if (interface == QStringLiteral("wl_data_device_manager")) {
|
||||||
mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id));
|
mDndSelectionHandler.reset(new QWaylandDataDeviceManager(this, id));
|
||||||
|
@ -117,6 +117,7 @@ public:
|
|||||||
|
|
||||||
const struct wl_compositor *wl_compositor() const { return mCompositor.object(); }
|
const struct wl_compositor *wl_compositor() const { return mCompositor.object(); }
|
||||||
QtWayland::wl_compositor *compositor() { return &mCompositor; }
|
QtWayland::wl_compositor *compositor() { return &mCompositor; }
|
||||||
|
int compositorVersion() const { return mCompositorVersion; }
|
||||||
|
|
||||||
QtWayland::wl_shell *shell() { return mShell.data(); }
|
QtWayland::wl_shell *shell() { return mShell.data(); }
|
||||||
QtWayland::xdg_shell *shellXdg();
|
QtWayland::xdg_shell *shellXdg();
|
||||||
@ -165,6 +166,7 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void waitForScreens();
|
void waitForScreens();
|
||||||
|
void exitWithError();
|
||||||
|
|
||||||
struct Listener {
|
struct Listener {
|
||||||
RegistryListener listener;
|
RegistryListener listener;
|
||||||
@ -198,6 +200,7 @@ private:
|
|||||||
int mWritableNotificationFd;
|
int mWritableNotificationFd;
|
||||||
bool mScreensInitialized;
|
bool mScreensInitialized;
|
||||||
QList<RegistryGlobal> mGlobals;
|
QList<RegistryGlobal> mGlobals;
|
||||||
|
int mCompositorVersion;
|
||||||
|
|
||||||
void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE;
|
void registry_global(uint32_t id, const QString &interface, uint32_t version) Q_DECL_OVERRIDE;
|
||||||
void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE;
|
void registry_global_remove(uint32_t id) Q_DECL_OVERRIDE;
|
||||||
|
@ -73,7 +73,7 @@ void QWaylandEventThread::displayConnect()
|
|||||||
|
|
||||||
// ### be careful what you do, this function may also be called from other
|
// ### be careful what you do, this function may also be called from other
|
||||||
// threads to clean up & exit.
|
// threads to clean up & exit.
|
||||||
void QWaylandEventThread::checkErrorAndExit()
|
void QWaylandEventThread::checkError() const
|
||||||
{
|
{
|
||||||
int ecode = wl_display_get_error(m_display);
|
int ecode = wl_display_get_error(m_display);
|
||||||
if ((ecode == EPIPE || ecode == ECONNRESET)) {
|
if ((ecode == EPIPE || ecode == ECONNRESET)) {
|
||||||
@ -82,13 +82,16 @@ void QWaylandEventThread::checkErrorAndExit()
|
|||||||
} else {
|
} else {
|
||||||
qErrnoWarning(ecode, "The Wayland connection experienced a fatal error");
|
qErrnoWarning(ecode, "The Wayland connection experienced a fatal error");
|
||||||
}
|
}
|
||||||
::exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandEventThread::readWaylandEvents()
|
void QWaylandEventThread::readWaylandEvents()
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch(m_display) < 0)
|
if (wl_display_dispatch(m_display) < 0) {
|
||||||
checkErrorAndExit();
|
checkError();
|
||||||
|
m_readNotifier->setEnabled(false);
|
||||||
|
emit fatalError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
emit newEventsRead();
|
emit newEventsRead();
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
wl_display *display() const;
|
wl_display *display() const;
|
||||||
|
|
||||||
void checkErrorAndExit();
|
void checkError() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void readWaylandEvents();
|
void readWaylandEvents();
|
||||||
@ -72,6 +72,7 @@ private slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newEventsRead();
|
void newEventsRead();
|
||||||
|
void fatalError();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -157,9 +157,9 @@ QWaylandInputDevice::Touch::~Touch()
|
|||||||
wl_touch_destroy(object());
|
wl_touch_destroy(object());
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, uint32_t id)
|
QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id)
|
||||||
: QObject()
|
: QObject()
|
||||||
, QtWayland::wl_seat(display->wl_registry(), id, 2)
|
, QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 2))
|
||||||
, mQDisplay(display)
|
, mQDisplay(display)
|
||||||
, mDisplay(display->wl_display())
|
, mDisplay(display->wl_display())
|
||||||
, mCaps(0)
|
, mCaps(0)
|
||||||
@ -770,6 +770,17 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
|
|||||||
void QWaylandInputDevice::Keyboard::repeatKey()
|
void QWaylandInputDevice::Keyboard::repeatKey()
|
||||||
{
|
{
|
||||||
mRepeatTimer.setInterval(25);
|
mRepeatTimer.setInterval(25);
|
||||||
|
QWindowSystemInterface::handleExtendedKeyEvent(mFocus->window(),
|
||||||
|
mRepeatTime, QEvent::KeyRelease, mRepeatKey,
|
||||||
|
modifiers(),
|
||||||
|
mRepeatCode,
|
||||||
|
#ifndef QT_NO_WAYLAND_XKB
|
||||||
|
mRepeatSym, mNativeModifiers,
|
||||||
|
#else
|
||||||
|
0, 0,
|
||||||
|
#endif
|
||||||
|
mRepeatText, true);
|
||||||
|
|
||||||
QWindowSystemInterface::handleExtendedKeyEvent(mFocus->window(),
|
QWindowSystemInterface::handleExtendedKeyEvent(mFocus->window(),
|
||||||
mRepeatTime, QEvent::KeyPress, mRepeatKey,
|
mRepeatTime, QEvent::KeyPress, mRepeatKey,
|
||||||
modifiers(),
|
modifiers(),
|
||||||
|
@ -81,7 +81,7 @@ public:
|
|||||||
class Pointer;
|
class Pointer;
|
||||||
class Touch;
|
class Touch;
|
||||||
|
|
||||||
QWaylandInputDevice(QWaylandDisplay *display, uint32_t id);
|
QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id);
|
||||||
~QWaylandInputDevice();
|
~QWaylandInputDevice();
|
||||||
|
|
||||||
uint32_t capabilities() const { return mCaps; }
|
uint32_t capabilities() const { return mCaps; }
|
||||||
|
@ -181,12 +181,14 @@ QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWindow *window) cons
|
|||||||
return new QWaylandShmWindow(window);
|
return new QWaylandShmWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_OPENGL
|
||||||
QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
QPlatformOpenGLContext *QWaylandIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
||||||
{
|
{
|
||||||
if (mDisplay->clientBufferIntegration())
|
if (mDisplay->clientBufferIntegration())
|
||||||
return mDisplay->clientBufferIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle());
|
return mDisplay->clientBufferIntegration()->createPlatformOpenGLContext(context->format(), context->shareHandle());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif // QT_NO_OPENGL
|
||||||
|
|
||||||
QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const
|
QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow *window) const
|
||||||
{
|
{
|
||||||
@ -367,12 +369,12 @@ void QWaylandIntegration::initializeShellIntegration()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandInputDevice *QWaylandIntegration::createInputDevice(QWaylandDisplay *display, uint32_t id)
|
QWaylandInputDevice *QWaylandIntegration::createInputDevice(QWaylandDisplay *display, int version, uint32_t id)
|
||||||
{
|
{
|
||||||
if (mInputDeviceIntegration) {
|
if (mInputDeviceIntegration) {
|
||||||
return mInputDeviceIntegration->createInputDevice(display, id);
|
return mInputDeviceIntegration->createInputDevice(display, version, id);
|
||||||
}
|
}
|
||||||
return new QWaylandInputDevice(display, id);
|
return new QWaylandInputDevice(display, version, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandIntegration::initializeInputDeviceIntegration()
|
void QWaylandIntegration::initializeInputDeviceIntegration()
|
||||||
|
@ -63,7 +63,9 @@ public:
|
|||||||
|
|
||||||
bool hasCapability(QPlatformIntegration::Capability cap) const;
|
bool hasCapability(QPlatformIntegration::Capability cap) const;
|
||||||
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
||||||
|
#ifndef QT_NO_OPENGL
|
||||||
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
|
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
|
||||||
|
#endif
|
||||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
|
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
|
||||||
|
|
||||||
QAbstractEventDispatcher *createEventDispatcher() const;
|
QAbstractEventDispatcher *createEventDispatcher() const;
|
||||||
@ -91,7 +93,7 @@ public:
|
|||||||
|
|
||||||
QPlatformTheme *createPlatformTheme(const QString &name) const;
|
QPlatformTheme *createPlatformTheme(const QString &name) const;
|
||||||
|
|
||||||
QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, uint32_t id);
|
QWaylandInputDevice *createInputDevice(QWaylandDisplay *display, int version, uint32_t id);
|
||||||
|
|
||||||
virtual QWaylandClientBufferIntegration *clientBufferIntegration() const;
|
virtual QWaylandClientBufferIntegration *clientBufferIntegration() const;
|
||||||
virtual QWaylandServerBufferIntegration *serverBufferIntegration() const;
|
virtual QWaylandServerBufferIntegration *serverBufferIntegration() const;
|
||||||
|
@ -53,14 +53,15 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id)
|
QWaylandScreen::QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id)
|
||||||
: QPlatformScreen()
|
: QPlatformScreen()
|
||||||
, QtWayland::wl_output(waylandDisplay->wl_registry(), id, 2)
|
, QtWayland::wl_output(waylandDisplay->wl_registry(), id, qMin(version, 2))
|
||||||
, m_outputId(id)
|
, m_outputId(id)
|
||||||
, mWaylandDisplay(waylandDisplay)
|
, mWaylandDisplay(waylandDisplay)
|
||||||
, mExtendedOutput(0)
|
, mExtendedOutput(0)
|
||||||
, mDepth(32)
|
, mDepth(32)
|
||||||
, mRefreshRate(60000)
|
, mRefreshRate(60000)
|
||||||
|
, mTransform(-1)
|
||||||
, mFormat(QImage::Format_ARGB32_Premultiplied)
|
, mFormat(QImage::Format_ARGB32_Premultiplied)
|
||||||
, mOutputName(QStringLiteral("Screen%1").arg(id))
|
, mOutputName(QStringLiteral("Screen%1").arg(id))
|
||||||
, m_orientation(Qt::PrimaryOrientation)
|
, m_orientation(Qt::PrimaryOrientation)
|
||||||
@ -178,8 +179,24 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y,
|
|||||||
Q_UNUSED(subpixel);
|
Q_UNUSED(subpixel);
|
||||||
Q_UNUSED(make);
|
Q_UNUSED(make);
|
||||||
|
|
||||||
bool isPortrait = height > width;
|
mTransform = transform;
|
||||||
switch (transform) {
|
|
||||||
|
if (!model.isEmpty())
|
||||||
|
mOutputName = model;
|
||||||
|
|
||||||
|
mPhysicalSize = QSize(width, height);
|
||||||
|
mGeometry.moveTopLeft(QPoint(x, y));
|
||||||
|
}
|
||||||
|
|
||||||
|
void QWaylandScreen::output_done()
|
||||||
|
{
|
||||||
|
// the done event is sent after all the geometry and the mode events are sent,
|
||||||
|
// and the last mode event to be sent is the active one, so we can trust the
|
||||||
|
// values of mGeometry and mRefreshRate here
|
||||||
|
|
||||||
|
if (mTransform >= 0) {
|
||||||
|
bool isPortrait = mGeometry.height() > mGeometry.width();
|
||||||
|
switch (mTransform) {
|
||||||
case WL_OUTPUT_TRANSFORM_NORMAL:
|
case WL_OUTPUT_TRANSFORM_NORMAL:
|
||||||
m_orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation;
|
m_orientation = isPortrait ? Qt::PortraitOrientation : Qt::LandscapeOrientation;
|
||||||
break;
|
break;
|
||||||
@ -201,19 +218,8 @@ void QWaylandScreen::output_geometry(int32_t x, int32_t y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation);
|
QWindowSystemInterface::handleScreenOrientationChange(screen(), m_orientation);
|
||||||
|
mTransform = -1;
|
||||||
if (!model.isEmpty())
|
}
|
||||||
mOutputName = model;
|
|
||||||
|
|
||||||
mPhysicalSize = QSize(width, height);
|
|
||||||
mGeometry.moveTopLeft(QPoint(x, y));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWaylandScreen::output_done()
|
|
||||||
{
|
|
||||||
// the done event is sent after all the geometry and the mode events are sent,
|
|
||||||
// and the last mode event to be sent is the active one, so we can trust the
|
|
||||||
// values of mGeometry and mRefreshRate here
|
|
||||||
QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry, mGeometry);
|
QWindowSystemInterface::handleScreenGeometryChange(screen(), mGeometry, mGeometry);
|
||||||
QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate());
|
QWindowSystemInterface::handleScreenRefreshRateChange(screen(), refreshRate());
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class QWaylandExtendedOutput;
|
|||||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandScreen : public QPlatformScreen, QtWayland::wl_output
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QWaylandScreen(QWaylandDisplay *waylandDisplay, uint32_t id);
|
QWaylandScreen(QWaylandDisplay *waylandDisplay, int version, uint32_t id);
|
||||||
~QWaylandScreen();
|
~QWaylandScreen();
|
||||||
|
|
||||||
QWaylandDisplay *display() const;
|
QWaylandDisplay *display() const;
|
||||||
@ -103,6 +103,7 @@ private:
|
|||||||
QRect mGeometry;
|
QRect mGeometry;
|
||||||
int mDepth;
|
int mDepth;
|
||||||
int mRefreshRate;
|
int mRefreshRate;
|
||||||
|
int mTransform;
|
||||||
QImage::Format mFormat;
|
QImage::Format mFormat;
|
||||||
QSize mPhysicalSize;
|
QSize mPhysicalSize;
|
||||||
QString mOutputName;
|
QString mOutputName;
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "qwaylandwindow_p.h"
|
#include "qwaylandwindow_p.h"
|
||||||
#include "qwaylanddisplay_p.h"
|
#include "qwaylanddisplay_p.h"
|
||||||
#include "qwaylandscreen_p.h"
|
#include "qwaylandscreen_p.h"
|
||||||
#include "qwaylanddecoration_p.h"
|
#include "qwaylandabstractdecoration_p.h"
|
||||||
|
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
@ -140,6 +140,9 @@ QWaylandShmBackingStore::QWaylandShmBackingStore(QWindow *window)
|
|||||||
|
|
||||||
QWaylandShmBackingStore::~QWaylandShmBackingStore()
|
QWaylandShmBackingStore::~QWaylandShmBackingStore()
|
||||||
{
|
{
|
||||||
|
if (QWaylandWindow *w = waylandWindow())
|
||||||
|
w->setBackingStore(Q_NULLPTR);
|
||||||
|
|
||||||
if (mFrameCallback)
|
if (mFrameCallback)
|
||||||
wl_callback_destroy(mFrameCallback);
|
wl_callback_destroy(mFrameCallback);
|
||||||
|
|
||||||
@ -175,6 +178,14 @@ void QWaylandShmBackingStore::endPaint()
|
|||||||
waylandWindow()->setCanResize(true);
|
waylandWindow()->setCanResize(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWaylandShmBackingStore::hidden()
|
||||||
|
{
|
||||||
|
if (mFrameCallback) {
|
||||||
|
wl_callback_destroy(mFrameCallback);
|
||||||
|
mFrameCallback = Q_NULLPTR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QWaylandShmBackingStore::ensureSize()
|
void QWaylandShmBackingStore::ensureSize()
|
||||||
{
|
{
|
||||||
waylandWindow()->setBackingStore(this);
|
waylandWindow()->setBackingStore(this);
|
||||||
@ -295,7 +306,7 @@ void QWaylandShmBackingStore::updateDecorations()
|
|||||||
decorationPainter.drawImage(target, sourceImage, target);
|
decorationPainter.drawImage(target, sourceImage, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandDecoration *QWaylandShmBackingStore::windowDecoration() const
|
QWaylandAbstractDecoration *QWaylandShmBackingStore::windowDecoration() const
|
||||||
{
|
{
|
||||||
return waylandWindow()->decoration();
|
return waylandWindow()->decoration();
|
||||||
}
|
}
|
||||||
@ -312,6 +323,7 @@ QWaylandWindow *QWaylandShmBackingStore::waylandWindow() const
|
|||||||
return static_cast<QWaylandWindow *>(window()->handle());
|
return static_cast<QWaylandWindow *>(window()->handle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_OPENGL
|
||||||
QImage QWaylandShmBackingStore::toImage() const
|
QImage QWaylandShmBackingStore::toImage() const
|
||||||
{
|
{
|
||||||
// Invoked from QPlatformBackingStore::composeAndFlush() that is called
|
// Invoked from QPlatformBackingStore::composeAndFlush() that is called
|
||||||
@ -320,6 +332,7 @@ QImage QWaylandShmBackingStore::toImage() const
|
|||||||
|
|
||||||
return *contentSurface();
|
return *contentSurface();
|
||||||
}
|
}
|
||||||
|
#endif // QT_NO_OPENGL
|
||||||
|
|
||||||
void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t time)
|
void QWaylandShmBackingStore::done(void *data, wl_callback *callback, uint32_t time)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QWaylandDisplay;
|
class QWaylandDisplay;
|
||||||
class QWaylandDecoration;
|
class QWaylandAbstractDecoration;
|
||||||
class QWaylandWindow;
|
class QWaylandWindow;
|
||||||
|
|
||||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer {
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer {
|
||||||
@ -82,8 +82,9 @@ public:
|
|||||||
void resize(const QSize &size);
|
void resize(const QSize &size);
|
||||||
void beginPaint(const QRegion &);
|
void beginPaint(const QRegion &);
|
||||||
void endPaint();
|
void endPaint();
|
||||||
|
void hidden();
|
||||||
|
|
||||||
QWaylandDecoration *windowDecoration() const;
|
QWaylandAbstractDecoration *windowDecoration() const;
|
||||||
|
|
||||||
QMargins windowDecorationMargins() const;
|
QMargins windowDecorationMargins() const;
|
||||||
QImage *entireSurface() const;
|
QImage *entireSurface() const;
|
||||||
@ -93,7 +94,9 @@ public:
|
|||||||
QWaylandWindow *waylandWindow() const;
|
QWaylandWindow *waylandWindow() const;
|
||||||
void iterateBuffer();
|
void iterateBuffer();
|
||||||
|
|
||||||
|
#ifndef QT_NO_OPENGL
|
||||||
QImage toImage() const Q_DECL_OVERRIDE;
|
QImage toImage() const Q_DECL_OVERRIDE;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateDecorations();
|
void updateDecorations();
|
||||||
|
@ -50,9 +50,11 @@
|
|||||||
#include "qwaylandwlshellsurface_p.h"
|
#include "qwaylandwlshellsurface_p.h"
|
||||||
#include "qwaylandxdgsurface_p.h"
|
#include "qwaylandxdgsurface_p.h"
|
||||||
#include "qwaylandsubsurface_p.h"
|
#include "qwaylandsubsurface_p.h"
|
||||||
#include "qwaylanddecoration_p.h"
|
#include "qwaylandabstractdecoration_p.h"
|
||||||
#include "qwaylandwindowmanagerintegration_p.h"
|
#include "qwaylandwindowmanagerintegration_p.h"
|
||||||
#include "qwaylandnativeinterface_p.h"
|
#include "qwaylandnativeinterface_p.h"
|
||||||
|
#include "qwaylanddecorationfactory_p.h"
|
||||||
|
#include "qwaylandshmbackingstore_p.h"
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
@ -90,6 +92,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
|
|||||||
, mMouseSerial(0)
|
, mMouseSerial(0)
|
||||||
, mState(Qt::WindowNoState)
|
, mState(Qt::WindowNoState)
|
||||||
, mMask()
|
, mMask()
|
||||||
|
, mBackingStore(Q_NULLPTR)
|
||||||
{
|
{
|
||||||
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
|
init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));
|
||||||
|
|
||||||
@ -249,6 +252,9 @@ void QWaylandWindow::setVisible(bool visible)
|
|||||||
if (!deleteGuard.isNull()) {
|
if (!deleteGuard.isNull()) {
|
||||||
attach(static_cast<QWaylandBuffer *>(0), 0, 0);
|
attach(static_cast<QWaylandBuffer *>(0), 0, 0);
|
||||||
commit();
|
commit();
|
||||||
|
if (mBackingStore) {
|
||||||
|
mBackingStore->hidden();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -443,6 +449,9 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const
|
|||||||
|
|
||||||
void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
|
void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
|
||||||
{
|
{
|
||||||
|
if (mDisplay->compositorVersion() < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
wl_output_transform transform;
|
wl_output_transform transform;
|
||||||
bool isPortrait = window()->screen() && window()->screen()->primaryOrientation() == Qt::PortraitOrientation;
|
bool isPortrait = window()->screen() && window()->screen()->primaryOrientation() == Qt::PortraitOrientation;
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
@ -506,6 +515,7 @@ bool QWaylandWindow::createDecoration()
|
|||||||
if (!mDisplay->supportsWindowDecoration())
|
if (!mDisplay->supportsWindowDecoration())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
static bool decorationPluginFailed = false;
|
||||||
bool decoration = false;
|
bool decoration = false;
|
||||||
switch (window()->type()) {
|
switch (window()->type()) {
|
||||||
case Qt::Window:
|
case Qt::Window:
|
||||||
@ -523,9 +533,40 @@ bool QWaylandWindow::createDecoration()
|
|||||||
if (window()->flags() & Qt::BypassWindowManagerHint)
|
if (window()->flags() & Qt::BypassWindowManagerHint)
|
||||||
decoration = false;
|
decoration = false;
|
||||||
|
|
||||||
if (decoration) {
|
if (decoration && !decorationPluginFailed) {
|
||||||
if (!mWindowDecoration)
|
if (!mWindowDecoration) {
|
||||||
mWindowDecoration = new QWaylandDecoration(this);
|
QStringList decorations = QWaylandDecorationFactory::keys();
|
||||||
|
if (decorations.empty()) {
|
||||||
|
qWarning() << "No decoration plugins available. Running with no decorations.";
|
||||||
|
decorationPluginFailed = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString targetKey;
|
||||||
|
QByteArray decorationPluginName = qgetenv("QT_WAYLAND_DECORATION");
|
||||||
|
if (!decorationPluginName.isEmpty()) {
|
||||||
|
targetKey = QString::fromLocal8Bit(decorationPluginName);
|
||||||
|
if (!decorations.contains(targetKey)) {
|
||||||
|
qWarning() << "Requested decoration " << targetKey << " not found, falling back to default";
|
||||||
|
targetKey = QString(); // fallthrough
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (targetKey.isEmpty())
|
||||||
|
targetKey = decorations.first(); // first come, first served.
|
||||||
|
|
||||||
|
|
||||||
|
mWindowDecoration = QWaylandDecorationFactory::create(targetKey, QStringList());
|
||||||
|
if (!mWindowDecoration) {
|
||||||
|
qWarning() << "Could not create decoration from factory! Running with no decorations.";
|
||||||
|
decorationPluginFailed = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
mWindowDecoration->setWaylandWindow(this);
|
||||||
|
if (subSurfaceWindow()) {
|
||||||
|
subSurfaceWindow()->adjustPositionOfChildren();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
delete mWindowDecoration;
|
delete mWindowDecoration;
|
||||||
mWindowDecoration = 0;
|
mWindowDecoration = 0;
|
||||||
@ -534,19 +575,11 @@ bool QWaylandWindow::createDecoration()
|
|||||||
return mWindowDecoration;
|
return mWindowDecoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWaylandDecoration *QWaylandWindow::decoration() const
|
QWaylandAbstractDecoration *QWaylandWindow::decoration() const
|
||||||
{
|
{
|
||||||
return mWindowDecoration;
|
return mWindowDecoration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandWindow::setDecoration(QWaylandDecoration *decoration)
|
|
||||||
{
|
|
||||||
mWindowDecoration = decoration;
|
|
||||||
if (subSurfaceWindow()) {
|
|
||||||
subSurfaceWindow()->adjustPositionOfChildren();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static QWindow *topLevelWindow(QWindow *window)
|
static QWindow *topLevelWindow(QWindow *window)
|
||||||
{
|
{
|
||||||
while (QWindow *parent = window->parent())
|
while (QWindow *parent = window->parent())
|
||||||
@ -695,7 +728,6 @@ bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state)
|
|||||||
// QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState
|
// QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState
|
||||||
// here. We use then this mState variable.
|
// here. We use then this mState variable.
|
||||||
mState = state;
|
mState = state;
|
||||||
createDecoration();
|
|
||||||
|
|
||||||
if (mShellSurface) {
|
if (mShellSurface) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
@ -60,7 +60,7 @@ class QWaylandDisplay;
|
|||||||
class QWaylandBuffer;
|
class QWaylandBuffer;
|
||||||
class QWaylandShellSurface;
|
class QWaylandShellSurface;
|
||||||
class QWaylandSubSurface;
|
class QWaylandSubSurface;
|
||||||
class QWaylandDecoration;
|
class QWaylandAbstractDecoration;
|
||||||
class QWaylandInputDevice;
|
class QWaylandInputDevice;
|
||||||
class QWaylandScreen;
|
class QWaylandScreen;
|
||||||
class QWaylandShmBackingStore;
|
class QWaylandShmBackingStore;
|
||||||
@ -146,9 +146,7 @@ public:
|
|||||||
bool isExposed() const Q_DECL_OVERRIDE;
|
bool isExposed() const Q_DECL_OVERRIDE;
|
||||||
void unfocus();
|
void unfocus();
|
||||||
|
|
||||||
QWaylandDecoration *decoration() const;
|
QWaylandAbstractDecoration *decoration() const;
|
||||||
void setDecoration(QWaylandDecoration *decoration);
|
|
||||||
|
|
||||||
|
|
||||||
void handleMouse(QWaylandInputDevice *inputDevice,
|
void handleMouse(QWaylandInputDevice *inputDevice,
|
||||||
ulong timestamp,
|
ulong timestamp,
|
||||||
@ -201,7 +199,7 @@ protected:
|
|||||||
QWaylandShellSurface *mShellSurface;
|
QWaylandShellSurface *mShellSurface;
|
||||||
QWaylandSubSurface *mSubSurfaceWindow;
|
QWaylandSubSurface *mSubSurfaceWindow;
|
||||||
|
|
||||||
QWaylandDecoration *mWindowDecoration;
|
QWaylandAbstractDecoration *mWindowDecoration;
|
||||||
bool mMouseEventsInContentArea;
|
bool mMouseEventsInContentArea;
|
||||||
Qt::MouseButtons mMousePressedInContentArea;
|
Qt::MouseButtons mMousePressedInContentArea;
|
||||||
Qt::CursorShape m_cursorShape;
|
Qt::CursorShape m_cursorShape;
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "qwaylanddisplay_p.h"
|
#include "qwaylanddisplay_p.h"
|
||||||
#include "qwaylandwindow_p.h"
|
#include "qwaylandwindow_p.h"
|
||||||
#include "qwaylandinputdevice_p.h"
|
#include "qwaylandinputdevice_p.h"
|
||||||
#include "qwaylanddecoration_p.h"
|
#include "qwaylandabstractdecoration_p.h"
|
||||||
#include "qwaylandscreen_p.h"
|
#include "qwaylandscreen_p.h"
|
||||||
#include "qwaylandextendedsurface_p.h"
|
#include "qwaylandextendedsurface_p.h"
|
||||||
|
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#include "qwaylanddisplay_p.h"
|
#include "qwaylanddisplay_p.h"
|
||||||
#include "qwaylandwindow_p.h"
|
#include "qwaylandwindow_p.h"
|
||||||
#include "qwaylandinputdevice_p.h"
|
#include "qwaylandinputdevice_p.h"
|
||||||
#include "qwaylanddecoration_p.h"
|
|
||||||
#include "qwaylandscreen_p.h"
|
#include "qwaylandscreen_p.h"
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "qwaylanddisplay_p.h"
|
#include "qwaylanddisplay_p.h"
|
||||||
#include "qwaylandwindow_p.h"
|
#include "qwaylandwindow_p.h"
|
||||||
#include "qwaylandinputdevice_p.h"
|
#include "qwaylandinputdevice_p.h"
|
||||||
#include "qwaylanddecoration_p.h"
|
#include "qwaylandabstractdecoration_p.h"
|
||||||
#include "qwaylandscreen_p.h"
|
#include "qwaylandscreen_p.h"
|
||||||
#include "qwaylandextendedsurface_p.h"
|
#include "qwaylandextendedsurface_p.h"
|
||||||
|
|
||||||
|
@ -416,8 +416,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
|
|
||||||
printf(" class %s %s\n {\n", serverExport.constData(), interfaceName);
|
printf(" class %s %s\n {\n", serverExport.constData(), interfaceName);
|
||||||
printf(" public:\n");
|
printf(" public:\n");
|
||||||
printf(" %s(struct ::wl_client *client, int id);\n", interfaceName);
|
printf(" %s(struct ::wl_client *client, int id, int version);\n", interfaceName);
|
||||||
printf(" %s(struct ::wl_display *display);\n", interfaceName);
|
printf(" %s(struct ::wl_display *display, int version);\n", interfaceName);
|
||||||
printf(" %s();\n", interfaceName);
|
printf(" %s();\n", interfaceName);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" virtual ~%s();\n", interfaceName);
|
printf(" virtual ~%s();\n", interfaceName);
|
||||||
@ -432,16 +432,17 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
printf(" struct ::wl_resource *handle;\n");
|
printf(" struct ::wl_resource *handle;\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" struct ::wl_client *client() const { return handle->client; }\n");
|
printf(" struct ::wl_client *client() const { return handle->client; }\n");
|
||||||
|
printf(" int version() const { return wl_resource_get_version(handle); }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" static Resource *fromResource(struct ::wl_resource *resource) { return static_cast<Resource *>(resource->data); }\n");
|
printf(" static Resource *fromResource(struct ::wl_resource *resource) { return static_cast<Resource *>(resource->data); }\n");
|
||||||
printf(" };\n");
|
printf(" };\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" void init(struct ::wl_client *client, int id);\n");
|
printf(" void init(struct ::wl_client *client, int id, int version);\n");
|
||||||
printf(" void init(struct ::wl_display *display);\n");
|
printf(" void init(struct ::wl_display *display, int version);\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" Resource *add(struct ::wl_client *client);\n");
|
printf(" Resource *add(struct ::wl_client *client, int version);\n");
|
||||||
printf(" Resource *add(struct ::wl_client *client, int id);\n");
|
printf(" Resource *add(struct ::wl_client *client, int id, int version);\n");
|
||||||
printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id);\n");
|
printf(" Resource *add(struct wl_list *resource_list, struct ::wl_client *client, int id, int version);\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" Resource *resource() { return m_resource; }\n");
|
printf(" Resource *resource() { return m_resource; }\n");
|
||||||
printf(" const Resource *resource() const { return m_resource; }\n");
|
printf(" const Resource *resource() const { return m_resource; }\n");
|
||||||
@ -491,7 +492,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
printf(" static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);\n");
|
printf(" static void bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id);\n");
|
||||||
printf(" static void destroy_func(struct ::wl_resource *client_resource);\n");
|
printf(" static void destroy_func(struct ::wl_resource *client_resource);\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" Resource *bind(struct ::wl_client *client, uint32_t id);\n");
|
printf(" Resource *bind(struct ::wl_client *client, uint32_t id, int version);\n");
|
||||||
|
|
||||||
if (hasRequests) {
|
if (hasRequests) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -511,6 +512,7 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
printf(" QMultiMap<struct ::wl_client*, Resource*> m_resource_map;\n");
|
printf(" QMultiMap<struct ::wl_client*, Resource*> m_resource_map;\n");
|
||||||
printf(" Resource *m_resource;\n");
|
printf(" Resource *m_resource;\n");
|
||||||
printf(" struct ::wl_global *m_global;\n");
|
printf(" struct ::wl_global *m_global;\n");
|
||||||
|
printf(" uint32_t m_globalVersion;\n");
|
||||||
printf(" };\n");
|
printf(" };\n");
|
||||||
|
|
||||||
if (j < interfaces.size() - 1)
|
if (j < interfaces.size() - 1)
|
||||||
@ -551,21 +553,21 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
QByteArray stripped = stripInterfaceName(interface.name, prefix);
|
QByteArray stripped = stripInterfaceName(interface.name, prefix);
|
||||||
const char *interfaceNameStripped = stripped.constData();
|
const char *interfaceNameStripped = stripped.constData();
|
||||||
|
|
||||||
printf(" %s::%s(struct ::wl_client *client, int id)\n", interfaceName, interfaceName);
|
printf(" %s::%s(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName);
|
||||||
printf(" : m_resource_map()\n");
|
printf(" : m_resource_map()\n");
|
||||||
printf(" , m_resource(0)\n");
|
printf(" , m_resource(0)\n");
|
||||||
printf(" , m_global(0)\n");
|
printf(" , m_global(0)\n");
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" init(client, id);\n");
|
printf(" init(client, id, version);\n");
|
||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf(" %s::%s(struct ::wl_display *display)\n", interfaceName, interfaceName);
|
printf(" %s::%s(struct ::wl_display *display, int version)\n", interfaceName, interfaceName);
|
||||||
printf(" : m_resource_map()\n");
|
printf(" : m_resource_map()\n");
|
||||||
printf(" , m_resource(0)\n");
|
printf(" , m_resource(0)\n");
|
||||||
printf(" , m_global(0)\n");
|
printf(" , m_global(0)\n");
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" init(display);\n");
|
printf(" init(display, version);\n");
|
||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
@ -582,31 +584,32 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf(" void %s::init(struct ::wl_client *client, int id)\n", interfaceName);
|
printf(" void %s::init(struct ::wl_client *client, int id, int version)\n", interfaceName);
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" m_resource = bind(client, id);\n");
|
printf(" m_resource = bind(client, id, version);\n");
|
||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf(" %s::Resource *%s::add(struct ::wl_client *client)\n", interfaceName, interfaceName);
|
printf(" %s::Resource *%s::add(struct ::wl_client *client, int version)\n", interfaceName, interfaceName);
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" Resource *resource = bind(client, 0);\n");
|
printf(" Resource *resource = bind(client, 0, version);\n");
|
||||||
printf(" m_resource_map.insert(client, resource);\n");
|
printf(" m_resource_map.insert(client, resource);\n");
|
||||||
printf(" return resource;\n");
|
printf(" return resource;\n");
|
||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf(" %s::Resource *%s::add(struct ::wl_client *client, int id)\n", interfaceName, interfaceName);
|
printf(" %s::Resource *%s::add(struct ::wl_client *client, int id, int version)\n", interfaceName, interfaceName);
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" Resource *resource = bind(client, id);\n");
|
printf(" Resource *resource = bind(client, id, version);\n");
|
||||||
printf(" m_resource_map.insert(client, resource);\n");
|
printf(" m_resource_map.insert(client, resource);\n");
|
||||||
printf(" return resource;\n");
|
printf(" return resource;\n");
|
||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf(" void %s::init(struct ::wl_display *display)\n", interfaceName);
|
printf(" void %s::init(struct ::wl_display *display, int version)\n", interfaceName);
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" m_global = wl_global_create(display, &::%s_interface, ::%s_interface.version, this, bind_func);\n", interfaceName, interfaceName);
|
printf(" m_global = wl_global_create(display, &::%s_interface, version, this, bind_func);\n", interfaceName);
|
||||||
|
printf(" m_globalVersion = version;\n");
|
||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
@ -628,8 +631,8 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
|
|
||||||
printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName);
|
printf(" void %s::bind_func(struct ::wl_client *client, void *data, uint32_t version, uint32_t id)\n", interfaceName);
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" Q_UNUSED(version);\n");
|
printf(" %s *that = static_cast<%s *>(data);\n", interfaceName, interfaceName);
|
||||||
printf(" static_cast<%s *>(data)->add(client, id);\n", interfaceName);
|
printf(" that->add(client, id, qMin(that->m_globalVersion, version));\n");
|
||||||
printf(" }\n");
|
printf(" }\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
@ -652,12 +655,12 @@ void process(QXmlStreamReader &xml, const QByteArray &headerPath, const QByteArr
|
|||||||
|
|
||||||
//We should consider changing bind so that it doesn't special case id == 0
|
//We should consider changing bind so that it doesn't special case id == 0
|
||||||
//and use function overloading instead. Jan do you have a lot of code dependent on this behavior?
|
//and use function overloading instead. Jan do you have a lot of code dependent on this behavior?
|
||||||
printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id)\n", interfaceName, interfaceName);
|
printf(" %s::Resource *%s::bind(struct ::wl_client *client, uint32_t id, int version)\n", interfaceName, interfaceName);
|
||||||
printf(" {\n");
|
printf(" {\n");
|
||||||
printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped);
|
printf(" Resource *resource = %s_allocate();\n", interfaceNameStripped);
|
||||||
printf(" resource->%s_object = this;\n", interfaceNameStripped);
|
printf(" resource->%s_object = this;\n", interfaceNameStripped);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" struct ::wl_resource *handle = wl_resource_create(client, &::%s_interface, ::%s_interface.version, id);\n", interfaceName, interfaceName);
|
printf(" struct ::wl_resource *handle = wl_resource_create(client, &::%s_interface, version, id);\n", interfaceName);
|
||||||
printf(" wl_resource_set_implementation(handle, %s, resource, destroy_func);", interfaceMember.constData());
|
printf(" wl_resource_set_implementation(handle, %s, resource, destroy_func);", interfaceMember.constData());
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" resource->handle = handle;\n");
|
printf(" resource->handle = handle;\n");
|
||||||
|
@ -238,7 +238,7 @@ void Compositor::dispatchEvents(int timeout)
|
|||||||
static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id)
|
static void compositor_create_surface(wl_client *client, wl_resource *compositorResource, uint32_t id)
|
||||||
{
|
{
|
||||||
Compositor *compositor = static_cast<Compositor *>(compositorResource->data);
|
Compositor *compositor = static_cast<Compositor *>(compositorResource->data);
|
||||||
compositor->addSurface(new Surface(client, id, compositor));
|
compositor->addSurface(new Surface(client, id, wl_resource_get_version(compositorResource), compositor));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id)
|
static void compositor_create_region(wl_client *client, wl_resource *compositorResource, uint32_t id)
|
||||||
|
@ -101,7 +101,7 @@ void Compositor::sendKeyRelease(void *data, const QList<QVariant> ¶meters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Seat::Seat(Compositor *compositor, struct ::wl_display *display)
|
Seat::Seat(Compositor *compositor, struct ::wl_display *display)
|
||||||
: wl_seat(display)
|
: wl_seat(display, 2)
|
||||||
, m_compositor(compositor)
|
, m_compositor(compositor)
|
||||||
, m_keyboard(new Keyboard(compositor))
|
, m_keyboard(new Keyboard(compositor))
|
||||||
, m_pointer(new Pointer(compositor))
|
, m_pointer(new Pointer(compositor))
|
||||||
@ -119,12 +119,12 @@ void Seat::seat_bind_resource(Resource *resource)
|
|||||||
|
|
||||||
void Seat::seat_get_keyboard(Resource *resource, uint32_t id)
|
void Seat::seat_get_keyboard(Resource *resource, uint32_t id)
|
||||||
{
|
{
|
||||||
m_keyboard->add(resource->client(), id);
|
m_keyboard->add(resource->client(), id, resource->version());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seat::seat_get_pointer(Resource *resource, uint32_t id)
|
void Seat::seat_get_pointer(Resource *resource, uint32_t id)
|
||||||
{
|
{
|
||||||
m_pointer->add(resource->client(), id);
|
m_pointer->add(resource->client(), id, resource->version());
|
||||||
}
|
}
|
||||||
|
|
||||||
Keyboard::Keyboard(Compositor *compositor)
|
Keyboard::Keyboard(Compositor *compositor)
|
||||||
@ -240,7 +240,7 @@ DataDevice::~DataDevice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataDeviceManager::DataDeviceManager(Compositor *compositor, wl_display *display)
|
DataDeviceManager::DataDeviceManager(Compositor *compositor, wl_display *display)
|
||||||
: wl_data_device_manager(display)
|
: wl_data_device_manager(display, 1)
|
||||||
, m_compositor(compositor)
|
, m_compositor(compositor)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ void DataDeviceManager::data_device_manager_get_data_device(Resource *resource,
|
|||||||
{
|
{
|
||||||
if (!m_data_device)
|
if (!m_data_device)
|
||||||
m_data_device.reset(new DataDevice(m_compositor));
|
m_data_device.reset(new DataDevice(m_compositor));
|
||||||
m_data_device->add(resource->client(), id);
|
m_data_device->add(resource->client(), id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
|
|
||||||
namespace Impl {
|
namespace Impl {
|
||||||
|
|
||||||
Surface::Surface(wl_client *client, uint32_t id, Compositor *compositor)
|
Surface::Surface(wl_client *client, uint32_t id, int v, Compositor *compositor)
|
||||||
: QtWaylandServer::wl_surface(client, id)
|
: QtWaylandServer::wl_surface(client, id, v)
|
||||||
, m_buffer(Q_NULLPTR)
|
, m_buffer(Q_NULLPTR)
|
||||||
, m_compositor(compositor)
|
, m_compositor(compositor)
|
||||||
, m_mockSurface(new MockSurface(this))
|
, m_mockSurface(new MockSurface(this))
|
||||||
|
@ -50,7 +50,7 @@ namespace Impl {
|
|||||||
class Surface : public QtWaylandServer::wl_surface
|
class Surface : public QtWaylandServer::wl_surface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Surface(wl_client *client, uint32_t id, Compositor *compositor);
|
Surface(wl_client *client, uint32_t id, int v, Compositor *compositor);
|
||||||
~Surface();
|
~Surface();
|
||||||
|
|
||||||
Compositor *compositor() const { return m_compositor; }
|
Compositor *compositor() const { return m_compositor; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user