CMake support for keygrab-plugin

This commit is contained in:
Victor Tran 2023-09-24 17:39:10 +10:00
parent f15e2a5bbb
commit 9c2374d2d8
No known key found for this signature in database
25 changed files with 116 additions and 29 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.24.0)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
project(thedesk VERSION 1.0.0 LANGUAGES CXX)
@ -18,3 +18,4 @@ add_subdirectory(plugins)
add_subdirectory(polkitagent)
add_subdirectory(locker)
add_subdirectory(desktop-portal)
add_subdirectory(wayfire-plugins)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21.0)
cmake_minimum_required(VERSION 3.24.0)
project(xdg-portal VERSION 1.0.0 LANGUAGES CXX)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21.0)
cmake_minimum_required(VERSION 3.24.0)
project(thedesk VERSION 1.0.0 LANGUAGES CXX)

View file

@ -271,13 +271,15 @@ void BarWindow::updatePrimaryScreen() {
connect(primaryScreen, &SystemScreen::rotationChanged, this, &BarWindow::updatePrimaryScreen);
d->oldPrimaryScreen = primaryScreen;
// Qt adjusts the size of the window for us, so we'll need to adjust for that
auto primaryGeometry = primaryScreen->geometry();
primaryGeometry.setSize(primaryGeometry.size() / primaryScreen->qtScreen()->devicePixelRatio());
if (primaryScreen) {
// Qt adjusts the size of the window for us, so we'll need to adjust for that
auto primaryGeometry = primaryScreen->geometry();
primaryGeometry.setSize(primaryGeometry.size() / primaryScreen->qtScreen()->devicePixelRatio());
this->setFixedWidth(primaryGeometry.width());
this->move(primaryGeometry.topLeft());
d->statusCenterWidget->setFixedHeight(primaryGeometry.height());
this->setFixedWidth(primaryGeometry.width());
this->move(primaryGeometry.topLeft());
d->statusCenterWidget->setFixedHeight(primaryGeometry.height());
}
// Refresh the state of all the windows
for (const DesktopWmWindowPtr& window : DesktopWm::openWindows()) {
@ -288,7 +290,7 @@ void BarWindow::updatePrimaryScreen() {
}
void BarWindow::barHeightChanged() {
DesktopWm::setScreenMarginForWindow(this, qApp->primaryScreen(), Qt::TopEdge, d->mainBarWidget->statusBarHeight() * ScreenDaemon::instance()->primayScreen()->qtScreen()->devicePixelRatio() + 1);
DesktopWm::setScreenMarginForWindow(this, qApp->primaryScreen(), Qt::TopEdge, d->mainBarWidget->statusBarHeight() * (ScreenDaemon::instance()->primayScreen() ? ScreenDaemon::instance()->primayScreen()->qtScreen()->devicePixelRatio() + 1 : 1));
d->mainBarWidget->setFixedHeight(d->mainBarWidget->expandedHeight());
if (!d->statusCenterShown) {

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
project(lib VERSION 1.0.0 LANGUAGES CXX)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus Positioning)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Svg)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0)
cmake_minimum_required(VERSION 3.24.0)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets DBus)
find_package(libcontemporary)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21.0)
cmake_minimum_required(VERSION 3.24.0)
project(polkitagent VERSION 1.0.0 LANGUAGES CXX)

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.21.0)
cmake_minimum_required(VERSION 3.24.0)
project(startdesk VERSION 1.0.0 LANGUAGES CXX)

View file

@ -0,0 +1,34 @@
find_program(WAYLAND_SCANNER wayland-scanner)
if(NOT WAYLAND_SCANNER)
message(FATAL_ERROR "wayland-scanner not found!")
endif()
message(STATUS "Found wayland-scanner: ${WAYLAND_SCANNER}")
function(thedesk_wayfire_plugin_wayland_protocols target)
set(multiValueArgs FILES)
cmake_parse_arguments(REGISTER_WAYLAND_PROTOCOL_EXTENSIONS "" "" "${multiValueArgs}" ${ARGN})
foreach(_file ${REGISTER_WAYLAND_PROTOCOL_EXTENSIONS_FILES})
get_filename_component(_basename ${_file} NAME_WE)
# Wayland scanner
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.h"
COMMAND ${WAYLAND_SCANNER} server-header ${_file} "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.h"
DEPENDS ${_file}
VERBATIM)
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.c"
COMMAND ${WAYLAND_SCANNER} public-code ${_file} "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.c"
DEPENDS ${_file}
VERBATIM)
# Include in sources
set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.c" PROPERTY SKIP_AUTOGEN ON)
set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.h" PROPERTY SKIP_AUTOGEN ON)
target_sources(${target} PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.c"
"${CMAKE_CURRENT_BINARY_DIR}/wayland-${_basename}-server-protocol.h")
endforeach()
endfunction()
add_subdirectory(keygrab-plugin)

View file

@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.24.0)
project(lib VERSION 1.0.0 LANGUAGES CXX)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
find_package(libcontemporary REQUIRED)
cntp_find_pkgconfig(wayfire wayfire)
cntp_find_pkgconfig(pixman pixman-1)
set(SOURCES
keygrabplugin.cpp
)
set(HEADERS
keygrabplugin.h
)
set(PRIVATE_HEADERS
)
add_library(wf-thedesk-keygrab SHARED)
cntp_init(wf-thedesk-keygrab 20)
set_target_properties(wf-thedesk-keygrab PROPERTIES
OUTPUT_NAME thedesk-keygrab
)
find_file(TDESKTOPENVIRONMENT_KEYGRAB_FILE NAMES tdesktopenvironment-keygrab-v1.xml
PATHS ENV XDG_DATA_DIRS
PATH_SUFFIXES libtdesktopenvironment/wayland-protocols/tdesktopenvironment-protocols
NO_DEFAULT_PATH
REQUIRED
)
if(NOT TDESKTOPENVIRONMENT_KEYGRAB_FILE)
message(FATAL_ERROR "Could not find tdesktopenvironment-keygrab-v1.xml")
endif()
thedesk_wayfire_plugin_wayland_protocols(wf-thedesk-keygrab FILES
${TDESKTOPENVIRONMENT_KEYGRAB_FILE}
)
target_link_libraries(wf-thedesk-keygrab Qt::Core libcontemporary PkgConfig::wayfire PkgConfig::pixman)
target_compile_definitions(wf-thedesk-keygrab PRIVATE KEYGRABPLUGIN_LIBRARY WLR_USE_UNSTABLE)
target_sources(wf-thedesk-keygrab PRIVATE ${SOURCES} ${HEADERS} ${PRIVATE_HEADERS})
install(TARGETS wf-thedesk-keygrab
INCLUDES DESTINATION ${INCLUDE_INSTALL_DIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/wayfire
)