Commit b3e930f9 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Build standalone

parent 185f4019
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Gui @REQUIRED_QT_VERSION@)
find_dependency(KF5Wayland "@KF5_DEP_VERSION@")
include("${CMAKE_CURRENT_LIST_DIR}/KWaylandServerTargets.cmake")
@PACKAGE_INCLUDE_QCHTARGETS@
remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
remove_definitions(-DQT_NO_CAST_TO_ASCII)
# needed to access QPA
include_directories(SYSTEM ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
set(CLIENT_LIB_SRCS
appmenu.cpp
buffer.cpp
blur.cpp
compositor.cpp
connection_thread.cpp
contrast.cpp
slide.cpp
event_queue.cpp
datadevice.cpp
datadevicemanager.cpp
dataoffer.cpp
datasource.cpp
dpms.cpp
fakeinput.cpp
fullscreen_shell.cpp
idle.cpp
idleinhibit.cpp
keyboard.cpp
keystate.cpp
remote_access.cpp
outputconfiguration.cpp
outputmanagement.cpp
outputdevice.cpp
output.cpp
pointer.cpp
pointerconstraints.cpp
pointergestures.cpp
plasmashell.cpp
plasmavirtualdesktop.cpp
plasmawindowmanagement.cpp
plasmawindowmodel.cpp
region.cpp
registry.cpp
relativepointer.cpp
seat.cpp
server_decoration.cpp
server_decoration_palette.cpp
shadow.cpp
shell.cpp
shm_pool.cpp
subcompositor.cpp
subsurface.cpp
surface.cpp
touch.cpp
textinput.cpp
textinput_v0.cpp
textinput_v2.cpp
xdgdecoration.cpp
xdgshell.cpp
xdgforeign_v2.cpp
xdgforeign.cpp
xdgshell_v5.cpp
xdgshell_v6.cpp
xdgshell_stable.cpp
xdgoutput.cpp
../compat/wayland-xdg-shell-v5-protocol.c
)
ecm_qt_declare_logging_category(CLIENT_LIB_SRCS
HEADER logging.h
IDENTIFIER KWAYLAND_CLIENT
CATEGORY_NAME kwayland-client
DEFAULT_SEVERITY Critical
DESCRIPTION "KWayland Client Library"
EXPORT KWAYLAND
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/fullscreen-shell.xml
BASENAME fullscreen-shell
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/output-management.xml
BASENAME output-management
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/outputdevice.xml
BASENAME org_kde_kwin_outputdevice
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/plasma-shell.xml
BASENAME plasma-shell
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/plasma-virtual-desktop.xml
BASENAME plasma-virtual-desktop
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/plasma-window-management.xml
BASENAME plasma-window-management
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/idle.xml
BASENAME idle
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/fake-input.xml
BASENAME fake-input
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/shadow.xml
BASENAME shadow
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/blur.xml
BASENAME blur
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/contrast.xml
BASENAME contrast
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/slide.xml
BASENAME slide
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/dpms.xml
BASENAME dpms
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/server-decoration.xml
BASENAME server-decoration
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/text-input.xml
BASENAME text-input-v0
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/text-input-unstable-v2.xml
BASENAME text-input-v2
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-shell/xdg-shell-unstable-v6.xml
BASENAME xdg-shell-v6
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml
BASENAME relativepointer-unstable-v1
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml
BASENAME pointer-gestures-unstable-v1
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml
BASENAME pointer-constraints-unstable-v1
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml
BASENAME xdg-foreign-unstable-v2
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml
BASENAME idle-inhibit-unstable-v1
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/appmenu.xml
BASENAME appmenu
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/server-decoration-palette.xml
BASENAME server-decoration-palette
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-output/xdg-output-unstable-v1.xml
BASENAME xdg-output-unstable-v1
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
BASENAME xdg-shell
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
BASENAME xdg-decoration-unstable-v1
)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/keystate.xml
BASENAME keystate
)
set(CLIENT_GENERATED_FILES
${CMAKE_CURRENT_BINARY_DIR}/wayland-fullscreen-shell-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-output-management-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-org_kde_kwin_outputdevice-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-plasma-shell-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-plasma-shell-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-plasma-window-management-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-idle-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-fake-input-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-shadow-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-blur-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-contrast-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-slide-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-dpms-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-server-decoration-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-server-decoration-palette-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-text-input-v0-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-text-input-v2-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-xdg-shell-v6-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-relativepointer-unstable-v1-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-pointer-gestures-unstable-v1-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-pointer-constraints-unstable-v1-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-xdg-foreign-unstable-v2-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-idle-inhibit-unstable-v1-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-xdg-output-unstable-v1-client-protocol.h
${CMAKE_CURRENT_BINARY_DIR}/wayland-xdg-decoration-unstable-v1-client-protocol.h
)
set_source_files_properties(${CLIENT_GENERATED_FILES} PROPERTIES SKIP_AUTOMOC ON)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/remote-access.xml
BASENAME remote-access
)
add_library(KF5WaylandClient ${CLIENT_LIB_SRCS})
add_library(KF5::WaylandClient ALIAS KF5WaylandClient)
ecm_generate_export_header(KF5WaylandClient
BASE_NAME
KWaylandClient
EXPORT_FILE_NAME
KWayland/Client/kwaylandclient_export.h
GROUP_BASE_NAME KF
VERSION ${KF5_VERSION}
DEPRECATED_BASE_VERSION 0
DEPRECATION_VERSIONS 5.49 5.50 5.52 5.53
)
# TODO: add support for EXCLUDE_DEPRECATED_BEFORE_AND_AT to all KWayland libs
# needs fixing of undeprecated API being still implemented using own deprecated API
target_include_directories(KF5WaylandClient INTERFACE "$<INSTALL_INTERFACE:${KF5_INCLUDE_INSTALL_DIR}/KWayland/Client>")
target_link_libraries(KF5WaylandClient
PUBLIC Qt5::Gui
PRIVATE Wayland::Client
Qt5::Concurrent
)
set_target_properties(KF5WaylandClient PROPERTIES VERSION ${KWAYLAND_VERSION_STRING}
SOVERSION ${KWAYLAND_SOVERSION}
EXPORT_NAME WaylandClient
)
install(TARGETS KF5WaylandClient EXPORT KF5WaylandTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
set(CLIENT_LIB_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/KWayland/Client/kwaylandclient_export.h
appmenu.h
blur.h
buffer.h
compositor.h
connection_thread.h
contrast.h
event_queue.h
datadevice.h
datadevicemanager.h
dataoffer.h
datasource.h
dpms.h
fakeinput.h
fullscreen_shell.h
idle.h
idleinhibit.h
keyboard.h
keystate.h
remote_access.h
outputconfiguration.h
outputmanagement.h
outputdevice.h
output.h
pointer.h
pointerconstraints.h
plasmashell.h
plasmavirtualdesktop.h
plasmawindowmanagement.h
plasmawindowmodel.h
pointergestures.h
region.h
registry.h
relativepointer.h
seat.h
server_decoration.h
server_decoration_palette.h
shadow.h
shell.h
shm_pool.h
slide.h
subcompositor.h
subsurface.h
surface.h
touch.h
textinput.h
xdgdecoration.h
xdgshell.h
xdgforeign.h
xdgoutput.h
)
install(FILES
${CLIENT_LIB_HEADERS}
DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KWayland/Client COMPONENT Devel
)
# make available to ecm_add_qch in parent folder
set(KWaylandClient_APIDOX_SRCS ${CLIENT_LIB_HEADERS} PARENT_SCOPE)
set(KWaylandClient_APIDOX_BUILD_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
include(ECMGeneratePriFile)
ecm_generate_pri_file(BASE_NAME KWaylandClient LIB_NAME KF5WaylandClient DEPS "core" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5})
install(FILES ${PRI_FILENAME}
DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
/*
SPDX-FileCopyrightText: 2017 David Edmundson <kde@davidedmundson.co.uk>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "appmenu.h"
#include "event_queue.h"
#include "surface.h"
#include "wayland_pointer_p.h"
#include <wayland-appmenu-client-protocol.h>
namespace KWayland
{
namespace Client
{
class AppMenuManager::Private
{
public:
Private() = default;
void setup(org_kde_kwin_appmenu_manager *arg);
WaylandPointer<org_kde_kwin_appmenu_manager, org_kde_kwin_appmenu_manager_destroy> appmenumanager;
EventQueue *queue = nullptr;
};
AppMenuManager::AppMenuManager(QObject *parent)
: QObject(parent)
, d(new Private)
{
}
void AppMenuManager::Private::setup(org_kde_kwin_appmenu_manager *arg)
{
Q_ASSERT(arg);
Q_ASSERT(!appmenumanager);
appmenumanager.setup(arg);
}
AppMenuManager::~AppMenuManager()
{
release();
}
void AppMenuManager::setup(org_kde_kwin_appmenu_manager *appmenumanager)
{
d->setup(appmenumanager);
}
void AppMenuManager::release()
{
d->appmenumanager.release();
}
void AppMenuManager::destroy()
{
d->appmenumanager.destroy();
}
AppMenuManager::operator org_kde_kwin_appmenu_manager*() {
return d->appmenumanager;
}
AppMenuManager::operator org_kde_kwin_appmenu_manager*() const {
return d->appmenumanager;
}
bool AppMenuManager::isValid() const
{
return d->appmenumanager.isValid();
}
void AppMenuManager::setEventQueue(EventQueue *queue)
{
d->queue = queue;
}
EventQueue *AppMenuManager::eventQueue()
{
return d->queue;
}
AppMenu *AppMenuManager::create(Surface *surface, QObject *parent)
{
Q_ASSERT(isValid());
auto p = new AppMenu(parent);
auto w = org_kde_kwin_appmenu_manager_create(d->appmenumanager, *surface);
if (d->queue) {
d->queue->addProxy(w);
}
p->setup(w);
return p;
}
class AppMenu::Private
{
public:
void setup(org_kde_kwin_appmenu *arg);
WaylandPointer<org_kde_kwin_appmenu, org_kde_kwin_appmenu_release> appmenu;
};
AppMenu::AppMenu(QObject *parent)
: QObject(parent)
, d(new Private)
{
}
void AppMenu::Private::setup(org_kde_kwin_appmenu *arg)
{
Q_ASSERT(arg);
Q_ASSERT(!appmenu);
appmenu.setup(arg);
}
AppMenu::~AppMenu()
{
release();
}
void AppMenu::setup(org_kde_kwin_appmenu *appmenu)
{
d->setup(appmenu);
}
void AppMenu::release()
{
d->appmenu.release();
}
void AppMenu::destroy()
{
d->appmenu.destroy();
}
AppMenu::operator org_kde_kwin_appmenu*() {
return d->appmenu;
}
AppMenu::operator org_kde_kwin_appmenu*() const {
return d->appmenu;
}
bool AppMenu::isValid() const
{
return d->appmenu.isValid();
}
void AppMenu::setAddress(const QString &serviceName, const QString &objectPath)
{
Q_ASSERT(isValid());
org_kde_kwin_appmenu_set_address(d->appmenu, serviceName.toLatin1(), objectPath.toLatin1());
}
}
}
/*
SPDX-FileCopyrightText: 2017 David Edmundson <kde@davidedmundson.co.uk>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#ifndef KWAYLAND_CLIENT_APPMENU_H
#define KWAYLAND_CLIENT_APPMENU_H
#include <QObject>
#include <KWayland/Client/kwaylandclient_export.h>
struct org_kde_kwin_appmenu_manager;
struct org_kde_kwin_appmenu;
namespace KWayland
{
namespace Client
{
class EventQueue;
class Surface;
class AppMenu;
/**
* @short Wrapper for the org_kde_kwin_appmenu_manager interface.
*
* This class provides a convenient wrapper for the org_kde_kwin_appmenu_manager interface.
*
* To use this class one needs to interact with the Registry. There are two
* possible ways to create the AppMenuManager interface:
* @code
* AppMenuManager *c = registry->createAppMenuManager(name, version);
* @endcode
*
* This creates the AppMenuManager and sets it up directly. As an alternative this
* can also be done in a more low level way:
* @code
* AppMenuManager *c = new AppMenuManager;
* c->setup(registry->bindAppMenuManager(name, version));
* @endcode
*
* The AppMenuManager can be used as a drop-in replacement for any org_kde_kwin_appmenu_manager
* pointer as it provides matching cast operators.
*
* @see Registry
* @since 5.42
**/
class KWAYLANDCLIENT_EXPORT AppMenuManager : public QObject
{
Q_OBJECT
public:
/**
* Creates a new AppMenuManager.
* Note: after constructing the AppMenuManager it is not yet valid and one needs
* to call setup. In order to get a ready to use AppMenuManager prefer using
* Registry::createAppMenuManager.
**/
explicit AppMenuManager(QObject *parent = nullptr);
virtual ~AppMenuManager();
/**
* Setup this AppMenuManager to manage the @p appmenumanager.
* When using Registry::createAppMenuManager there is no need to call this
* method.
**/
void setup(org_kde_kwin_appmenu_manager *appmenumanager);
/**
* @returns @c true if managing a org_kde_kwin_appmenu_manager.
**/
bool isValid() const;
/**
* Releases the org_kde_kwin_appmenu_manager interface.
* After the interface has been released the AppMenuManager instance is no
* longer valid and can be setup with another org_kde_kwin_appmenu_manager interface.
**/
void release();
/**
* Destroys the data held by this AppMenuManager.
* This method is supposed to be used when the connection to the Wayland
* server goes away. If the connection is not valid anymore, it's not
* possible to call release anymore as that calls into the Wayland
* connection and the call would fail. This method cleans up the data, so
* that the instance can be deleted or set up to a new org_kde_kwin_appmenu_manager interface
* once there is a new connection available.
*
* It is suggested to connect this method to ConnectionThread::connectionDied:
* @code
* connect(connection, &ConnectionThread::connectionDied, appmenumanager, &AppMenuManager::destroy);
* @endcode
*
* @see release
**/
void destroy();
/**
* Sets the @p queue to use for creating objects with this AppMenuManager.
**/
void setEventQueue(EventQueue *queue);
/**
* @returns The event queue to use for creating objects with this AppMenuManager.
**/
EventQueue *eventQueue();
AppMenu *create(Surface *surface, QObject *parent = nullptr);
operator org_kde_kwin_appmenu_manager*();
operator org_kde_kwin_appmenu_manager*() const;
Q_SIGNALS:
/**
* The corresponding global for this interface on the Registry got removed.
*
* This signal gets only emitted if the AppMenuManager got created by
* Registry::createAppMenuManager
**/
void removed();
private:
class Private;
QScopedPointer<Private> d;
};
/**
*
* @since 5.42
**/
class KWAYLANDCLIENT_EXPORT AppMenu : public QObject
{
Q_OBJECT