Address code formatting
This commit is contained in:
parent
1bf7276d53
commit
cd9b1a6fd3
|
@ -23,11 +23,11 @@ include(KDECMakeSettings)
|
|||
include(KDECompilerSettings NO_POLICY_SCOPE)
|
||||
include(ECMSetupVersion)
|
||||
include(ECMGenerateHeaders)
|
||||
include(CheckIncludeFiles)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(FeatureSummary)
|
||||
include(GenerateExportHeader)
|
||||
include(KDEClangFormat)
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
|
||||
find_package(WaylandScanner)
|
||||
find_package(QtWaylandScanner)
|
||||
|
@ -36,7 +36,6 @@ find_package(WaylandProtocols)
|
|||
|
||||
set_package_properties(Wayland PROPERTIES
|
||||
TYPE REQUIRED)
|
||||
# adjusting CMAKE_C_FLAGS to get wayland protocols to compile
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90")
|
||||
|
||||
ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX LAYERSHELLQT
|
||||
|
@ -44,7 +43,8 @@ ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX LAYERSHELLQT
|
|||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LayerShellQtConfigVersion.cmake"
|
||||
SOVERSION 5)
|
||||
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
|
||||
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(tests)
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*/
|
||||
|
||||
#include "shell.h"
|
||||
#include <qglobal.h>
|
||||
#include <QByteArray>
|
||||
#include <qglobal.h>
|
||||
|
||||
using namespace LayerShellQt;
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
namespace LayerShellQt
|
||||
{
|
||||
|
||||
/**
|
||||
* Sets the right environment so the shells created from now on use wlr-layer-shell.
|
||||
*/
|
||||
class LAYERSHELLQT_EXPORT Shell {
|
||||
class LAYERSHELLQT_EXPORT Shell
|
||||
{
|
||||
public:
|
||||
static void useLayerShell();
|
||||
};
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
*/
|
||||
|
||||
#include "window.h"
|
||||
#include <private/qwaylandwindow_p.h>
|
||||
#include <private/qwaylandshellsurface_p.h>
|
||||
#include <layershellqt_logging.h>
|
||||
#include "../qwaylandlayersurface_p.h"
|
||||
#include <layershellqt_logging.h>
|
||||
#include <private/qwaylandshellsurface_p.h>
|
||||
#include <private/qwaylandwindow_p.h>
|
||||
|
||||
using namespace LayerShellQt;
|
||||
|
||||
|
@ -47,7 +47,8 @@ void Window::setKeyboardInteractivity(bool enabled)
|
|||
|
||||
Window::Window(WindowPrivate *d)
|
||||
: d(d)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
Window *Window::get(QWindow *window)
|
||||
{
|
||||
|
@ -56,7 +57,7 @@ Window *Window::get(QWindow *window)
|
|||
qCDebug(LAYERSHELLQT) << "window not a wayland window" << window;
|
||||
return nullptr;
|
||||
}
|
||||
QWaylandLayerSurface* s = qobject_cast<QWaylandLayerSurface *>(ww->shellSurface());
|
||||
QWaylandLayerSurface *s = qobject_cast<QWaylandLayerSurface *>(ww->shellSurface());
|
||||
if (!s) {
|
||||
qCDebug(LAYERSHELLQT) << "window not using wlr-layer-shell" << window << ww->shellSurface();
|
||||
return nullptr;
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
|
||||
namespace LayerShellQt {
|
||||
|
||||
namespace LayerShellQt
|
||||
{
|
||||
QWaylandLayerShell::QWaylandLayerShell(QtWayland::zwlr_layer_shell_v1 *shell)
|
||||
: QtWayland::zwlr_layer_shell_v1(shell->object())
|
||||
{
|
||||
|
@ -22,8 +22,7 @@ QWaylandLayerShell::~QWaylandLayerShell()
|
|||
zwlr_layer_shell_v1_destroy(object());
|
||||
}
|
||||
|
||||
QWaylandLayerSurface *QWaylandLayerShell::createLayerSurface(
|
||||
QtWaylandClient::QWaylandWindow *window)
|
||||
QWaylandLayerSurface *QWaylandLayerShell::createLayerSurface(QtWaylandClient::QWaylandWindow *window)
|
||||
{
|
||||
return new QWaylandLayerSurface(this, window);
|
||||
}
|
||||
|
|
|
@ -10,21 +10,20 @@
|
|||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
|
||||
#include "qwaylandlayersurface_p.h"
|
||||
|
||||
namespace LayerShellQt {
|
||||
|
||||
namespace LayerShellQt
|
||||
{
|
||||
class LAYERSHELLQT_EXPORT QWaylandLayerShell : public QtWayland::zwlr_layer_shell_v1
|
||||
{
|
||||
public:
|
||||
QWaylandLayerShell(QtWayland::zwlr_layer_shell_v1 *shell);
|
||||
virtual ~QWaylandLayerShell();
|
||||
|
||||
QWaylandLayerSurface *createLayerSurface(
|
||||
QtWaylandClient::QWaylandWindow *window);
|
||||
QWaylandLayerSurface *createLayerSurface(QtWaylandClient::QWaylandWindow *window);
|
||||
// TODO: Popups
|
||||
};
|
||||
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
* SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#include "qwaylandlayershellintegration_p.h"
|
||||
#include "qwaylandlayershell_p.h"
|
||||
#include "qwaylandlayershellintegration_p.h"
|
||||
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
|
||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
|
||||
namespace LayerShellQt {
|
||||
|
||||
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration() :
|
||||
m_layerShell(Q_NULLPTR)
|
||||
namespace LayerShellQt
|
||||
{
|
||||
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
|
||||
: m_layerShell(Q_NULLPTR)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,22 +26,17 @@ bool QWaylandLayerShellIntegration::initialize(QtWaylandClient::QWaylandDisplay
|
|||
return m_layerShell != nullptr;
|
||||
}
|
||||
|
||||
QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::
|
||||
createShellSurface(QtWaylandClient::QWaylandWindow *window)
|
||||
QtWaylandClient::QWaylandShellSurface *QWaylandLayerShellIntegration::createShellSurface(QtWaylandClient::QWaylandWindow *window)
|
||||
{
|
||||
return m_layerShell->createLayerSurface(window);
|
||||
}
|
||||
|
||||
void QWaylandLayerShellIntegration::registryLayer(void *data,
|
||||
struct wl_registry *registry, uint32_t id,
|
||||
const QString &interface, uint32_t version)
|
||||
void QWaylandLayerShellIntegration::registryLayer(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version)
|
||||
{
|
||||
QWaylandLayerShellIntegration *shell =
|
||||
static_cast<QWaylandLayerShellIntegration *>(data);
|
||||
QWaylandLayerShellIntegration *shell = static_cast<QWaylandLayerShellIntegration *>(data);
|
||||
|
||||
if (interface == QStringLiteral("zwlr_layer_shell_v1"))
|
||||
shell->m_layerShell = new QWaylandLayerShell(
|
||||
new QtWayland::zwlr_layer_shell_v1(registry, id, version));
|
||||
shell->m_layerShell = new QWaylandLayerShell(new QtWayland::zwlr_layer_shell_v1(registry, id, version));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
|
||||
#include "layershellqt_export.h"
|
||||
#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
|
||||
|
||||
namespace LayerShellQt {
|
||||
|
||||
namespace LayerShellQt
|
||||
{
|
||||
class QWaylandLayerShell;
|
||||
|
||||
class LAYERSHELLQT_EXPORT QWaylandLayerShellIntegration : public QtWaylandClient::QWaylandShellIntegration
|
||||
|
@ -23,12 +23,10 @@ public:
|
|||
QWaylandLayerShellIntegration();
|
||||
|
||||
bool initialize(QtWaylandClient::QWaylandDisplay *display) override;
|
||||
QtWaylandClient::QWaylandShellSurface *createShellSurface(
|
||||
QtWaylandClient::QWaylandWindow *window) override;
|
||||
QtWaylandClient::QWaylandShellSurface *createShellSurface(QtWaylandClient::QWaylandWindow *window) override;
|
||||
|
||||
private:
|
||||
static void registryLayer(void *data, struct wl_registry *registry,
|
||||
uint32_t id, const QString &interface, uint32_t version);
|
||||
static void registryLayer(void *data, struct wl_registry *registry, uint32_t id, const QString &interface, uint32_t version);
|
||||
|
||||
QWaylandLayerShell *m_layerShell;
|
||||
};
|
||||
|
|
|
@ -5,27 +5,26 @@
|
|||
* SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
|
||||
#include "qwaylandlayershellintegration_p.h"
|
||||
#include <QtWaylandClient/private/qwaylandshellintegrationplugin_p.h>
|
||||
|
||||
using namespace LayerShellQt;
|
||||
|
||||
class QWaylandLayerShellIntegrationPlugin :
|
||||
public QtWaylandClient::QWaylandShellIntegrationPlugin
|
||||
class QWaylandLayerShellIntegrationPlugin : public QtWaylandClient::QWaylandShellIntegrationPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(
|
||||
IID QWaylandShellIntegrationFactoryInterface_iid
|
||||
FILE "layer-shell.json")
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID QWaylandShellIntegrationFactoryInterface_iid FILE "layer-shell.json")
|
||||
|
||||
public:
|
||||
QWaylandLayerShellIntegrationPlugin() {}
|
||||
QWaylandLayerShellIntegrationPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
QtWaylandClient::QWaylandShellIntegration *create(
|
||||
const QString &key, const QStringList ¶mList) override {
|
||||
Q_UNUSED(key);
|
||||
Q_UNUSED(paramList);
|
||||
return new QWaylandLayerShellIntegration();
|
||||
QtWaylandClient::QWaylandShellIntegration *create(const QString &key, const QStringList ¶mList) override
|
||||
{
|
||||
Q_UNUSED(key);
|
||||
Q_UNUSED(paramList);
|
||||
return new QWaylandLayerShellIntegration();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -8,21 +8,21 @@
|
|||
#include "qwaylandlayershell_p.h"
|
||||
#include "qwaylandlayersurface_p.h"
|
||||
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||
#include <QtWaylandClient/private/qwaylandsurface_p.h>
|
||||
#include <QtWaylandClient/private/qwaylandscreen_p.h>
|
||||
#include <QtWaylandClient/private/qwaylandsurface_p.h>
|
||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
|
||||
namespace LayerShellQt {
|
||||
|
||||
namespace LayerShellQt
|
||||
{
|
||||
QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandClient::QWaylandWindow *window)
|
||||
: QtWaylandClient::QWaylandShellSurface(window)
|
||||
, QtWayland::zwlr_layer_surface_v1(
|
||||
// TODO: Specify namespace
|
||||
shell->get_layer_surface(window->waylandSurface()->object(),
|
||||
window->waylandScreen()->output(),
|
||||
QtWayland::zwlr_layer_shell_v1::layer_top,
|
||||
QStringLiteral("qt")))
|
||||
// TODO: Specify namespace
|
||||
shell->get_layer_surface(window->waylandSurface()->object(),
|
||||
window->waylandScreen()->output(),
|
||||
QtWayland::zwlr_layer_shell_v1::layer_top,
|
||||
QStringLiteral("qt")))
|
||||
{
|
||||
set_anchor(anchor_top | anchor_bottom | anchor_left | anchor_right);
|
||||
}
|
||||
|
@ -37,8 +37,7 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
|
|||
window()->window()->close();
|
||||
}
|
||||
|
||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial,
|
||||
uint32_t width, uint32_t height)
|
||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height)
|
||||
{
|
||||
ack_configure(serial);
|
||||
m_pendingSize = QSize(width, height);
|
||||
|
|
|
@ -10,24 +10,23 @@
|
|||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
#include "layershellqt_export.h"
|
||||
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
|
||||
namespace LayerShellQt {
|
||||
|
||||
namespace LayerShellQt
|
||||
{
|
||||
class QWaylandLayerShell;
|
||||
|
||||
class LAYERSHELLQT_EXPORT QWaylandLayerSurface : public QtWaylandClient::QWaylandShellSurface,
|
||||
public QtWayland::zwlr_layer_surface_v1
|
||||
class LAYERSHELLQT_EXPORT QWaylandLayerSurface : public QtWaylandClient::QWaylandShellSurface, public QtWayland::zwlr_layer_surface_v1
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QWaylandLayerSurface(QWaylandLayerShell *shell,
|
||||
QtWaylandClient::QWaylandWindow *window);
|
||||
QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandClient::QWaylandWindow *window);
|
||||
virtual ~QWaylandLayerSurface();
|
||||
|
||||
bool isExposed() const override {
|
||||
bool isExposed() const override
|
||||
{
|
||||
return m_configured;
|
||||
}
|
||||
|
||||
|
@ -39,8 +38,7 @@ public:
|
|||
void applyConfigure() override;
|
||||
|
||||
private:
|
||||
void zwlr_layer_surface_v1_configure(uint32_t serial,
|
||||
uint32_t width, uint32_t height) override;
|
||||
void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;
|
||||
void zwlr_layer_surface_v1_closed() override;
|
||||
|
||||
QSize m_pendingSize;
|
||||
|
|
|
@ -9,24 +9,26 @@
|
|||
#include <interfaces/shell.h>
|
||||
#include <interfaces/window.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
LayerShellQt::Shell::useLayerShell();
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
QQmlApplicationEngine engine;
|
||||
engine.loadData("import QtQuick.Controls 2.10\n"
|
||||
"import QtQuick 2.10\n"
|
||||
"\n"
|
||||
"ApplicationWindow {"
|
||||
" width: 100; height: 100\n"
|
||||
" visible: true\n"
|
||||
" Rectangle { color: 'red'; anchors.fill: parent }"
|
||||
"}"
|
||||
engine.loadData(
|
||||
"import QtQuick.Controls 2.10\n"
|
||||
"import QtQuick 2.10\n"
|
||||
"\n"
|
||||
"ApplicationWindow {"
|
||||
" width: 100; height: 100\n"
|
||||
" visible: true\n"
|
||||
" Rectangle { color: 'red'; anchors.fill: parent }"
|
||||
"}"
|
||||
|
||||
, QStringLiteral("bananaland:/potato.qml"));
|
||||
,
|
||||
QStringLiteral("bananaland:/potato.qml"));
|
||||
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [] (QObject *object) {
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [](QObject *object) {
|
||||
auto layerWindow = LayerShellQt::Window::get(qobject_cast<QWindow *>(object));
|
||||
Q_ASSERT(layerWindow);
|
||||
layerWindow->setMargins({50, 50, 50, 50});
|
||||
|
|
Loading…
Reference in a new issue