diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2023-02-13 08:28:46 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2023-03-06 07:58:48 +0000 |
commit | 6ffff6b50be77cda196851fe81e30445e8a1e723 (patch) | |
tree | 788d65623eaf686353ea20f9c02019690a3868da /examples | |
parent | 5826c898b6a624c669bf1bfeea4265b7f4934ffe (diff) | |
download | qtwayland-6ffff6b50be77cda196851fe81e30445e8a1e723.tar.gz |
Rename pure-qml to fancy-compositor
The pure-qml name made sense when the example was made, but since
then we have added a lot of examples that are all in Pure QML.
Minimal QML covers the basics of how to set up a compositor in QML,
but Pure QML shows a more advanced use case, with animations,
windowing system features, virtual keyboard support, etc.
To make it clear what the example is demonstrating, we call it
Fancy Compositor instead.
Task-number: QTBUG-110993
Change-Id: Iad1cfb11b6461858ebcdaa388ed16e1fd3ec8805
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/wayland/CMakeLists.txt | 2 | ||||
-rw-r--r-- | examples/wayland/fancy-compositor/CMakeLists.txt (renamed from examples/wayland/pure-qml/CMakeLists.txt) | 18 | ||||
-rw-r--r-- | examples/wayland/fancy-compositor/doc/src/fancy-compositor.qdoc (renamed from examples/wayland/pure-qml/doc/src/pure-qml.qdoc) | 36 | ||||
-rw-r--r-- | examples/wayland/fancy-compositor/fancy-compositor.pro | 18 | ||||
-rw-r--r-- | examples/wayland/fancy-compositor/fancy-compositor.qrc (renamed from examples/wayland/pure-qml/pure-qml.qrc) | 0 | ||||
-rw-r--r-- | examples/wayland/fancy-compositor/images/background.jpg (renamed from examples/wayland/pure-qml/images/background.jpg) | bin | 30730 -> 30730 bytes | |||
-rw-r--r-- | examples/wayland/fancy-compositor/main.cpp (renamed from examples/wayland/pure-qml/main.cpp) | 0 | ||||
-rw-r--r-- | examples/wayland/fancy-compositor/qml/Chrome.qml (renamed from examples/wayland/pure-qml/qml/Chrome.qml) | 0 | ||||
-rw-r--r-- | examples/wayland/fancy-compositor/qml/CompositorScreen.qml (renamed from examples/wayland/pure-qml/qml/CompositorScreen.qml) | 0 | ||||
-rw-r--r-- | examples/wayland/fancy-compositor/qml/Keyboard.qml (renamed from examples/wayland/pure-qml/qml/Keyboard.qml) | 0 | ||||
-rw-r--r-- | examples/wayland/fancy-compositor/qml/main.qml (renamed from examples/wayland/pure-qml/qml/main.qml) | 0 | ||||
-rw-r--r-- | examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc | 2 | ||||
-rw-r--r-- | examples/wayland/pure-qml/pure-qml.pro | 18 | ||||
-rw-r--r-- | examples/wayland/wayland.pro | 2 |
14 files changed, 48 insertions, 48 deletions
diff --git a/examples/wayland/CMakeLists.txt b/examples/wayland/CMakeLists.txt index 9ccfa5a5..965af718 100644 --- a/examples/wayland/CMakeLists.txt +++ b/examples/wayland/CMakeLists.txt @@ -8,7 +8,7 @@ endif() if(TARGET Qt::Quick) qt_internal_add_example(minimal-qml) qt_internal_add_example(spanning-screens) - qt_internal_add_example(pure-qml) + qt_internal_add_example(fancy-compositor) qt_internal_add_example(multi-output) qt_internal_add_example(multi-screen) qt_internal_add_example(overview-compositor) diff --git a/examples/wayland/pure-qml/CMakeLists.txt b/examples/wayland/fancy-compositor/CMakeLists.txt index 2642ca7a..f6126c2d 100644 --- a/examples/wayland/pure-qml/CMakeLists.txt +++ b/examples/wayland/fancy-compositor/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BSD-3-Clause cmake_minimum_required(VERSION 3.16) -project(pure-qml LANGUAGES CXX) +project(fancy-compositor LANGUAGES CXX) set(CMAKE_AUTOMOC ON) @@ -10,27 +10,27 @@ if(NOT DEFINED INSTALL_EXAMPLESDIR) set(INSTALL_EXAMPLESDIR "examples") endif() -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/pure-qml") +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/wayland/fancy-compositor") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml) -qt_add_executable(pure-qml +qt_add_executable(fancy-compositor main.cpp ) -set_target_properties(pure-qml PROPERTIES +set_target_properties(fancy-compositor PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) -target_link_libraries(pure-qml PUBLIC +target_link_libraries(fancy-compositor PUBLIC Qt::Core Qt::Gui Qt::Qml ) # Resources: -set(pure-qml_resource_files +set(fancy-compositor_resource_files "images/background.jpg" "qml/Chrome.qml" "qml/CompositorScreen.qml" @@ -38,14 +38,14 @@ set(pure-qml_resource_files "qml/main.qml" ) -qt6_add_resources(pure-qml "pure-qml" +qt6_add_resources(fancy-compositor "fancy-compositor" PREFIX "/" FILES - ${pure-qml_resource_files} + ${fancy-compositor_resource_files} ) -install(TARGETS pure-qml +install(TARGETS fancy-compositor RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/wayland/pure-qml/doc/src/pure-qml.qdoc b/examples/wayland/fancy-compositor/doc/src/fancy-compositor.qdoc index 0fcb231d..4ccd8356 100644 --- a/examples/wayland/pure-qml/doc/src/pure-qml.qdoc +++ b/examples/wayland/fancy-compositor/doc/src/fancy-compositor.qdoc @@ -2,26 +2,26 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! - \title Pure QML - \example pure-qml + \title Fancy Compositor + \example fancy-compositor \meta category {Embedded} - \brief Pure QML is an example that demonstrates how to write a Wayland compositor in pure QML. + \brief Fancy Compositor is an example that demonstrates how to write a fancy Wayland compositor in pure QML. \ingroup qtwaylandcompositor-examples \section1 Introduction - Pure QML is a small desktop-style Wayland compositor example that demonstrates the power and + Fancy Compositor is a small desktop-style Wayland compositor example that demonstrates the power and ease of the \l{Qt Wayland Compositor} QML APIs. - The Pure QML example is similar to the \l{Minimal QML}{Minimal QML example}, in that it is a + The Fancy Compositor example is similar to the \l{Minimal QML}{Minimal QML example}, in that it is a full-blown Wayland compositor, implemented only using QML code. \section1 Initializing the Compositor - Like the \l{Minimal QML}{Minimal QML example}, Pure QML supports the main + Like the \l{Minimal QML}{Minimal QML example}, Fancy Compositor supports the main \l{Shell Extensions - Qt Wayland Compositor}{shell extensions} that are supported by Qt. - \snippet pure-qml/qml/main.qml shell extensions + \snippet fancy-compositor/qml/main.qml shell extensions These are instantiated as children of the \l{WaylandCompositor} which automatically adds them to the list of supported interfaces which is broadcasted to clients from the server. @@ -30,7 +30,7 @@ corresponding signal is emitted. This then calls a method inside our custom \l WaylandOutput class, which appends the \l ShellSurface to a \l{ListModel}. - \snippet pure-qml/qml/CompositorScreen.qml handleShellSurface + \snippet fancy-compositor/qml/CompositorScreen.qml handleShellSurface This model is used as the source for a \l Repeater which creates \l{ShellSurfaceItem}{ShellSurfaceItems} inside the compositor's \l WaylandOutput. This adds a @@ -38,20 +38,20 @@ certain interaction options for the user of the compositor, depending on which shell extension is in use. - \snippet pure-qml/qml/CompositorScreen.qml repeater + \snippet fancy-compositor/qml/CompositorScreen.qml repeater \section1 Keyboard - In addition to the basic windowing system functions, the Pure QML compositor also supports an + In addition to the basic windowing system functions, the Fancy Compositor also supports an optional on-screen keyboard running in-process. This uses the \l{Qt Virtual Keyboard} module, and will be enabled if the module is available. - \snippet pure-qml/qml/Keyboard.qml keyboard + \snippet fancy-compositor/qml/Keyboard.qml keyboard The code is simple. We instantiate an \l InputPanel in the bottom of the output, and make sure it is visible if and only if it is currently active. - \snippet pure-qml/qml/CompositorScreen.qml keyboard + \snippet fancy-compositor/qml/CompositorScreen.qml keyboard The keyboard is then added to the \l WaylandOutput using a \l Loader element. The \l Loader is used here to avoid having a hard dependency on the \l{Qt Virtual Keyboard} module. If loading @@ -59,10 +59,10 @@ on-screen keyboard. Finally, we need a way for the compositor to communicate the text input to its clients. This - is done via a \c{text-input} extension. The Pure QML example only supports the + is done via a \c{text-input} extension. The Fancy Compositor example only supports the \c{qt_text_input_method_unstable_v1} protocol. - \snippet pure-qml/qml/main.qml text input + \snippet fancy-compositor/qml/main.qml text input The extension is added to the compositor by instantiating the \l QtTextInputMethodManager as a child of the \l{WaylandCompositor}. @@ -76,22 +76,22 @@ \section1 Transitions - In addition to the basic functionality, the Pure QML example also demonstrates animated + In addition to the basic functionality, the Fancy Compositor example also demonstrates animated transitions between states. The first of these is the \e{activation} transition. This is only supported on the \l{XdgShell}, since this is the only shell extension which has an \l{XdgToplevel::}{activated} state. - \snippet pure-qml/qml/Chrome.qml activation + \snippet fancy-compositor/qml/Chrome.qml activation When a client window becomes activated under the \l XdgShell protocol, we trigger an animation which makes the window "pop out" for 200 ms. - The Pure QML compositor also supports a \e{destruction} animation. This triggers whenever the + The Fancy Compositor also supports a \e{destruction} animation. This triggers whenever the window closes and surface is destroyed, whether this was because the client gracefully closed its window, or even if it crashes. - \snippet pure-qml/qml/Chrome.qml destruction + \snippet fancy-compositor/qml/Chrome.qml destruction To ensure that the content exists for the duration of the animation, we start by locking the buffer. This means the final frame rendered by the client will remain in memory until we are diff --git a/examples/wayland/fancy-compositor/fancy-compositor.pro b/examples/wayland/fancy-compositor/fancy-compositor.pro new file mode 100644 index 00000000..bd6a2923 --- /dev/null +++ b/examples/wayland/fancy-compositor/fancy-compositor.pro @@ -0,0 +1,18 @@ +QT += gui qml + +SOURCES += \ + main.cpp + +OTHER_FILES = \ + qml/main.qml \ + qml/CompositorScreen.qml \ + qml/Chrome.qml \ + qml/Keyboard.qml \ + images/background.jpg \ + +RESOURCES += fancy-compositor.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/wayland/fancy-compositor +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS fancy-compositor.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/wayland/fancy-compositor +INSTALLS += target sources diff --git a/examples/wayland/pure-qml/pure-qml.qrc b/examples/wayland/fancy-compositor/fancy-compositor.qrc index 145b3f25..145b3f25 100644 --- a/examples/wayland/pure-qml/pure-qml.qrc +++ b/examples/wayland/fancy-compositor/fancy-compositor.qrc diff --git a/examples/wayland/pure-qml/images/background.jpg b/examples/wayland/fancy-compositor/images/background.jpg Binary files differindex 445567fb..445567fb 100644 --- a/examples/wayland/pure-qml/images/background.jpg +++ b/examples/wayland/fancy-compositor/images/background.jpg diff --git a/examples/wayland/pure-qml/main.cpp b/examples/wayland/fancy-compositor/main.cpp index dca8dfe0..dca8dfe0 100644 --- a/examples/wayland/pure-qml/main.cpp +++ b/examples/wayland/fancy-compositor/main.cpp diff --git a/examples/wayland/pure-qml/qml/Chrome.qml b/examples/wayland/fancy-compositor/qml/Chrome.qml index b8d71c75..b8d71c75 100644 --- a/examples/wayland/pure-qml/qml/Chrome.qml +++ b/examples/wayland/fancy-compositor/qml/Chrome.qml diff --git a/examples/wayland/pure-qml/qml/CompositorScreen.qml b/examples/wayland/fancy-compositor/qml/CompositorScreen.qml index 4b2ba36d..4b2ba36d 100644 --- a/examples/wayland/pure-qml/qml/CompositorScreen.qml +++ b/examples/wayland/fancy-compositor/qml/CompositorScreen.qml diff --git a/examples/wayland/pure-qml/qml/Keyboard.qml b/examples/wayland/fancy-compositor/qml/Keyboard.qml index 2985ffcb..2985ffcb 100644 --- a/examples/wayland/pure-qml/qml/Keyboard.qml +++ b/examples/wayland/fancy-compositor/qml/Keyboard.qml diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/fancy-compositor/qml/main.qml index 87feedf1..87feedf1 100644 --- a/examples/wayland/pure-qml/qml/main.qml +++ b/examples/wayland/fancy-compositor/qml/main.qml diff --git a/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc b/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc index 2be82ac4..9dcd3372 100644 --- a/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc +++ b/examples/wayland/minimal-qml/doc/src/minimal-qml.qdoc @@ -89,5 +89,5 @@ * * And this is all the code needed to create a functional Wayland compositor using Qt Quick and * QML. For another example of a compositor written in QML but which has a few more features, take - * a look at the \l{Pure QML}{Pure QML example}. + * a look at the \l{Fancy Compositor}{Fancy Compositor example}. */ diff --git a/examples/wayland/pure-qml/pure-qml.pro b/examples/wayland/pure-qml/pure-qml.pro deleted file mode 100644 index 2214922e..00000000 --- a/examples/wayland/pure-qml/pure-qml.pro +++ /dev/null @@ -1,18 +0,0 @@ -QT += gui qml - -SOURCES += \ - main.cpp - -OTHER_FILES = \ - qml/main.qml \ - qml/CompositorScreen.qml \ - qml/Chrome.qml \ - qml/Keyboard.qml \ - images/background.jpg \ - -RESOURCES += pure-qml.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/wayland/pure-qml -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS pure-qml.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/wayland/pure-qml -INSTALLS += target sources diff --git a/examples/wayland/wayland.pro b/examples/wayland/wayland.pro index f339656e..145e1ec6 100644 --- a/examples/wayland/wayland.pro +++ b/examples/wayland/wayland.pro @@ -11,7 +11,7 @@ qtConfig(opengl) { qtHaveModule(quick) { SUBDIRS += minimal-qml SUBDIRS += spanning-screens - SUBDIRS += pure-qml + SUBDIRS += fancy-compositor SUBDIRS += multi-output SUBDIRS += multi-screen SUBDIRS += overview-compositor |