Warning, /plasma/kwayland/README.md is written in an unsupported language. File is not indexed.
0001 # KWayland 0002 0003 KWayland is a Qt-style API to interact with the wayland-client API. 0004 0005 ## Introduction 0006 0007 The API is Qt-styled removing the needs to interact with a for a Qt developer 0008 uncomfortable low-level C-API. For example the callback mechanism from the Wayland API 0009 is replaced by signals; data types are adjusted to be what a Qt developer expects, e.g. 0010 two arguments of int are represented by a QPoint or a QSize. 0011 0012 ## KWayland Client 0013 0014 The idea around KWayland Client is to provide a drop-in API for the Wayland client library which at 0015 the same time provides convenience Qt-style API. It is not intended to be used as a replacement for 0016 the QtWayland QPA plugin, but rather as a way to interact with Wayland in case one needs Qt to use 0017 a different QPA plugin or in combination with QtWayland to allow a more low-level interaction without 0018 requiring to write C code. 0019 0020 ### Convenience API 0021 0022 The convenience API in KWayland Client provides one class wrapping a Wayland object. Each class can 0023 be casted into the wrapped Wayland type. The API represents events as signals and provides simple 0024 method calls for requests. 0025 0026 Classes representing global Wayland resources can be created through the [Registry](@ref KWayland::Client::Registry). This class eases 0027 the interaction with the Wayland registry and emits signals whenever a new global is announced or gets 0028 removed. The Registry has a list of known interfaces (e.g. common Wayland protocols like `wl_compositor` 0029 or `wl_shell`) which have dedicated announce/removed signals and objects can be factored by the Registry 0030 for those globals. 0031 0032 Many globals function as a factory for further resources. E.g. the Compositor has a factory method for 0033 Surfaces. All objects can also be created in a low-level way interacting directly with the Wayland API, 0034 but provide convenience factory methods in addition. This allows both an easy usage or a more low level 0035 control of the Wayland API if needed. 0036 0037 ### Integration with QtWayland QPA 0038 0039 If the QGuiApplication uses the QtWayland QPA, KWayland allows to integrate with it. That is one does 0040 not need to create a new connection to the Wayland server, but can reuse the one used by Qt. If there 0041 is a way to get a Wayland object from Qt, the respective class provides a static method normally called 0042 `fromApplication`. In addition the API allows to get the Surface from a QWindow. 0043 0044 ## Using KWayland in your application 0045 0046 ### With CMake 0047 0048 KWayland installs a CMake Config file which allows to use KWayland as imported targets. 0049 0050 To find the package use for example: 0051 0052 find_package(KWayland CONFIG) 0053 set_package_properties(KWayland PROPERTIES TYPE OPTIONAL ) 0054 add_feature_info("KWayland" KWayland_FOUND "Required for the awesome Wayland on Qt demo") 0055 0056 Now to link against the Client library use: 0057 0058 add_executable(exampleApp example.cpp) 0059 target_link_libraries(exampleApp Plasma::KWaylandClient) 0060 0061 Please make sure that your project is configured with C++11 support: 0062 0063 CONFIG += c++11