Skip to content

Commit

Permalink
feat: make plugin-display works in treeland
Browse files Browse the repository at this point in the history
log: support wlr output management and treeland output management
  • Loading branch information
wineee committed Jan 24, 2024
1 parent 118aa2a commit 2e9d5a8
Show file tree
Hide file tree
Showing 29 changed files with 4,279 additions and 118 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ build*/

.transifexrc
lupdate.sh

# nix
.direnv
6 changes: 6 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ License: CC0-1.0
Files: misc/org.deepin.dde.controlcenter.metainfo.xml
Copyright: None
License: CC0-1.0

# 3rdparty
Files: src/plugin-display/wayland/*
Copyright: Marcus Britanicus, Abrar, rahmanshaber
License: MIT

64 changes: 64 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,67 @@ if (BUILD_PLUGIN)
endif()
#--------------------------plugin-display--------------------------
if (BUILD_PLUGIN)

function(ws_generate_local type input_file output_name)
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
execute_process(COMMAND ${WAYLAND_SCANNER}
${type}-header
${input_file}
${CMAKE_CURRENT_BINARY_DIR}/${output_name}.h
)

execute_process(COMMAND ${WAYLAND_SCANNER}
public-code
${input_file}
${CMAKE_CURRENT_BINARY_DIR}/${output_name}.c
)
endfunction()

find_package(PkgConfig REQUIRED)
pkg_check_modules(WaylandClient REQUIRED IMPORTED_TARGET wayland-client)

ws_generate_local(client
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin-display/wayland/libwayqt/protocols/wlr-output-management-unstable-v1.xml
wlr-output-management-unstable-v1-client-protocol)

ws_generate_local(client
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin-display/wayland/libwayqt/protocols/wlr-gamma-control-unstable-v1.xml
wlr-gamma-control-unstable-v1-client-protocol)

ws_generate_local(client
${CMAKE_CURRENT_SOURCE_DIR}/src/plugin-display/wayland/libwayqt/protocols/treeland-output-management.xml
treeland-output-management-client-protocol)

file(GLOB_RECURSE LIBWAYQT_SRCS
"src/plugin-display/wayland/libwayqt/*.cpp"
"src/plugin-display/wayland/libwayqt/*.hpp"
"src/plugin-display/wayland/gammaeffects/*.cpp"
"src/plugin-display/wayland/gammaeffects/*.hpp"
)

add_library(libwayqt
OBJECT
${LIBWAYQT_SRCS}
wlr-output-management-unstable-v1-client-protocol.c
wlr-gamma-control-unstable-v1-client-protocol.c
treeland-output-management-client-protocol.c
)

target_include_directories(libwayqt
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/src/plugin-display/wayland/libwayqt"
"${CMAKE_CURRENT_SOURCE_DIR}/src/plugin-display/wayland/gammaeffects"
PRIVATE
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
)

target_link_libraries(libwayqt
PUBLIC
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
PkgConfig::WaylandClient
)

set(Display_Name dcc-display-plugin)
file(GLOB_RECURSE DISPLAY_SRCS
"src/plugin-display/window/*.cpp"
Expand All @@ -966,11 +1027,14 @@ if (BUILD_PLUGIN)
Qt::Widgets
Qt::DBus
Qt::Concurrent
$<TARGET_OBJECTS:libwayqt>
PkgConfig::WaylandClient
)

target_include_directories(${Display_Name} PUBLIC
src/plugin-display
${Display_Includes}
$<TARGET_PROPERTY:libwayqt,INTERFACE_INCLUDE_DIRECTORIES>
)

target_link_libraries(${Display_Name} PRIVATE
Expand Down
9 changes: 9 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 3 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Build-Depends:
pkg-config,
cmake,
qtbase5-dev,
qtbase5-private-dev,
qttools5-dev-tools,
libdtkwidget-dev,
libdtkcore-dev(>>5.6.18),
Expand All @@ -18,7 +19,8 @@ Build-Depends:
doxygen,
libgtest-dev,
libgsettings-qt-dev,
libicu-dev
libicu-dev,
libwayland-dev
Standards-Version: 4.5.0
Homepage: https://github.com/linuxdeepin/dde-control-center

Expand Down
Loading

0 comments on commit 2e9d5a8

Please sign in to comment.