all: refactor windows code out of core

There are still some links from core to window but its now separate
enough to fix PanelWindow in qml tooling.
This commit is contained in:
outfoxxed 2024-10-28 16:18:41 -07:00
parent 1adad9e822
commit 4e48c6eefb
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
45 changed files with 1171 additions and 1142 deletions

View file

@ -64,15 +64,6 @@ boption(SERVICE_GREETD "Greetd" ON)
boption(SERVICE_UPOWER "UPower" ON) boption(SERVICE_UPOWER "UPower" ON)
boption(SERVICE_NOTIFICATIONS "Notifications" ON) boption(SERVICE_NOTIFICATIONS "Notifications" ON)
if (NOT DEFINED GIT_REVISION)
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
add_compile_options(-Wall -Wextra) add_compile_options(-Wall -Wextra)
if (FRAME_POINTERS) if (FRAME_POINTERS)

View file

@ -1,8 +1,13 @@
qt_add_executable(quickshell main.cpp) qt_add_executable(quickshell main.cpp)
target_link_libraries(quickshell PRIVATE ${QT_DEPS} quickshell-build)
install(TARGETS quickshell RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS quickshell RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
add_subdirectory(build)
add_subdirectory(core) add_subdirectory(core)
add_subdirectory(ipc)
add_subdirectory(window)
add_subdirectory(io) add_subdirectory(io)
add_subdirectory(widgets) add_subdirectory(widgets)

26
src/build/CMakeLists.txt Normal file
View file

@ -0,0 +1,26 @@
add_library(quickshell-build INTERFACE)
if (NOT DEFINED GIT_REVISION)
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
if (CRASH_REPORTER)
set(CRASH_REPORTER_DEF 1)
else()
set(CRASH_REPORTER_DEF 0)
endif()
if (DISTRIBUTOR_DEBUGINFO_AVAILABLE)
set(DEBUGINFO_AVAILABLE 1)
else()
set(DEBUGINFO_AVAILABLE 0)
endif()
configure_file(build.hpp.in build.hpp @ONLY ESCAPE_QUOTES)
target_include_directories(quickshell-build INTERFACE ${CMAKE_CURRENT_BINARY_DIR})

View file

@ -1,22 +1,16 @@
find_package(CLI11 CONFIG REQUIRED) find_package(CLI11 CONFIG REQUIRED)
qt_add_library(quickshell-core STATIC qt_add_library(quickshell-core STATIC
main.cpp
plugin.cpp plugin.cpp
shell.cpp shell.cpp
variants.cpp variants.cpp
rootwrapper.cpp rootwrapper.cpp
proxywindow.cpp
reload.cpp reload.cpp
rootwrapper.cpp rootwrapper.cpp
qmlglobal.cpp qmlglobal.cpp
qmlscreen.cpp qmlscreen.cpp
region.cpp region.cpp
persistentprops.cpp persistentprops.cpp
windowinterface.cpp
floatingwindow.cpp
panelinterface.cpp
popupwindow.cpp
singleton.cpp singleton.cpp
generation.cpp generation.cpp
scan.cpp scan.cpp
@ -43,32 +37,20 @@ qt_add_library(quickshell-core STATIC
paths.cpp paths.cpp
instanceinfo.cpp instanceinfo.cpp
common.cpp common.cpp
ipc.cpp
) )
if (CRASH_REPORTER)
set(CRASH_REPORTER_DEF 1)
else()
set(CRASH_REPORTER_DEF 0)
endif()
if (DISTRIBUTOR_DEBUGINFO_AVAILABLE)
set(DEBUGINFO_AVAILABLE 1)
else()
set(DEBUGINFO_AVAILABLE 0)
endif()
add_library(quickshell-build INTERFACE)
configure_file(build.hpp.in build.hpp @ONLY ESCAPE_QUOTES)
target_include_directories(quickshell-build INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(quickshell-core PRIVATE quickshell-build) target_link_libraries(quickshell-core PRIVATE quickshell-build)
qt_add_qml_module(quickshell-core URI Quickshell VERSION 0.1) qt_add_qml_module(quickshell-core
URI Quickshell
VERSION 0.1
IMPORTS Quickshell._Window
)
target_link_libraries(quickshell-core PRIVATE ${QT_DEPS} CLI11::CLI11)
target_link_libraries(quickshell-core PRIVATE ${QT_DEPS} Qt6::QuickPrivate CLI11::CLI11)
qs_pch(quickshell-core) qs_pch(quickshell-core)
qs_pch(quickshell-coreplugin)
target_link_libraries(quickshell PRIVATE quickshell-coreplugin) target_link_libraries(quickshell PRIVATE quickshell-coreplugin)

File diff suppressed because it is too large Load diff

View file

@ -1,7 +0,0 @@
#pragma once
namespace qs::launch {
int main(int argc, char** argv); // NOLINT
}

View file

@ -17,11 +17,11 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qwindow.h> #include <qwindow.h>
#include "../window/proxywindow.hpp"
#include "../window/windowinterface.hpp"
#include "generation.hpp" #include "generation.hpp"
#include "popupanchor.hpp" #include "popupanchor.hpp"
#include "proxywindow.hpp"
#include "qsmenu.hpp" #include "qsmenu.hpp"
#include "windowinterface.hpp"
namespace qs::menu::platform { namespace qs::menu::platform {

View file

@ -13,7 +13,7 @@
#include <qtclasshelpermacros.h> #include <qtclasshelpermacros.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include "popupanchor.hpp" #include "../core/popupanchor.hpp"
#include "qsmenu.hpp" #include "qsmenu.hpp"
namespace qs::menu::platform { namespace qs::menu::platform {

View file

@ -7,9 +7,9 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qwindow.h> #include <qwindow.h>
#include "proxywindow.hpp" #include "../window/proxywindow.hpp"
#include "../window/windowinterface.hpp"
#include "types.hpp" #include "types.hpp"
#include "windowinterface.hpp"
bool PopupAnchorState::operator==(const PopupAnchorState& other) const { bool PopupAnchorState::operator==(const PopupAnchorState& other) const {
return this->rect == other.rect && this->edges == other.edges && this->gravity == other.gravity return this->rect == other.rect && this->edges == other.edges && this->gravity == other.gravity

View file

@ -13,8 +13,8 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qwindow.h> #include <qwindow.h>
#include "../window/proxywindow.hpp"
#include "doc.hpp" #include "doc.hpp"
#include "proxywindow.hpp"
#include "types.hpp" #include "types.hpp"
///! Adjustment strategy for popups that do not fit on screen. ///! Adjustment strategy for popups that do not fit on screen.

View file

@ -1,9 +1,8 @@
function (qs_test name) function (qs_test name)
add_executable(${name} ${ARGN}) add_executable(${name} ${ARGN})
target_link_libraries(${name} PRIVATE ${QT_DEPS} Qt6::Test quickshell-core) target_link_libraries(${name} PRIVATE ${QT_DEPS} Qt6::Test quickshell-core quickshell-window)
add_test(NAME ${name} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMAND $<TARGET_FILE:${name}>) add_test(NAME ${name} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMAND $<TARGET_FILE:${name}>)
endfunction() endfunction()
qs_test(popupwindow popupwindow.cpp)
qs_test(transformwatcher transformwatcher.cpp) qs_test(transformwatcher transformwatcher.cpp)
qs_test(ringbuffer ringbuf.cpp) qs_test(ringbuffer ringbuf.cpp)

View file

@ -1,18 +0,0 @@
#pragma once
#include <qobject.h>
#include <qtmetamacros.h>
class TestPopupWindow: public QObject {
Q_OBJECT;
private slots:
void initiallyVisible();
void reloadReparent();
void reloadUnparent();
void invisibleWithoutParent();
void moveWithParent();
void attachParentLate();
void reparentLate();
void xMigrationFix();
};

View file

@ -4,7 +4,7 @@
#include <qobjectdefs.h> #include <qobjectdefs.h>
#include <qtclasshelpermacros.h> #include <qtclasshelpermacros.h>
#include "../core/ipc.hpp" #include "../ipc/ipc.hpp"
namespace qs::io::ipc { namespace qs::io::ipc {

View file

@ -9,9 +9,9 @@
#include <qtypes.h> #include <qtypes.h>
#include "../core/generation.hpp" #include "../core/generation.hpp"
#include "../core/ipc.hpp"
#include "../core/ipccommand.hpp"
#include "../core/logging.hpp" #include "../core/logging.hpp"
#include "../ipc/ipc.hpp"
#include "../ipc/ipccommand.hpp"
#include "ipc.hpp" #include "ipc.hpp"
#include "ipchandler.hpp" #include "ipchandler.hpp"

View file

@ -3,7 +3,7 @@
#include <qcontainerfwd.h> #include <qcontainerfwd.h>
#include <qflags.h> #include <qflags.h>
#include "../core/ipc.hpp" #include "../ipc/ipc.hpp"
namespace qs::io::ipc::comm { namespace qs::io::ipc::comm {

7
src/ipc/CMakeLists.txt Normal file
View file

@ -0,0 +1,7 @@
qt_add_library(quickshell-ipc STATIC
ipc.cpp
)
target_link_libraries(quickshell-ipc PRIVATE ${QT_DEPS})
target_link_libraries(quickshell PRIVATE quickshell-ipc)

View file

@ -9,9 +9,9 @@
#include <qloggingcategory.h> #include <qloggingcategory.h>
#include <qobject.h> #include <qobject.h>
#include "generation.hpp" #include "../core/generation.hpp"
#include "../core/paths.hpp"
#include "ipccommand.hpp" #include "ipccommand.hpp"
#include "paths.hpp"
namespace qs::ipc { namespace qs::ipc {

File diff suppressed because it is too large Load diff

View file

@ -8,8 +8,8 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qwindow.h> #include <qwindow.h>
#include "../../../core/proxywindow.hpp" #include "../../../window/proxywindow.hpp"
#include "../../../core/windowinterface.hpp" #include "../../../window/windowinterface.hpp"
#include "grab.hpp" #include "grab.hpp"
#include "manager.hpp" #include "manager.hpp"

View file

@ -3,11 +3,11 @@
#include <qobject.h> #include <qobject.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include "../../core/util.hpp"
#include "../../core/model.hpp" #include "../../core/model.hpp"
#include "../../core/proxywindow.hpp"
#include "../../core/qmlscreen.hpp" #include "../../core/qmlscreen.hpp"
#include "../../core/windowinterface.hpp" #include "../../core/util.hpp"
#include "../../window/proxywindow.hpp"
#include "../../window/windowinterface.hpp"
#include "handle.hpp" #include "handle.hpp"
#include "manager.hpp" #include "manager.hpp"

View file

@ -5,9 +5,9 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include "../../core/model.hpp" #include "../../core/model.hpp"
#include "../../core/proxywindow.hpp"
#include "../../core/qmlscreen.hpp" #include "../../core/qmlscreen.hpp"
#include "../../core/util.hpp" #include "../../core/util.hpp"
#include "../../window/proxywindow.hpp"
namespace qs::wayland::toplevel_management { namespace qs::wayland::toplevel_management {

View file

@ -9,9 +9,9 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h> #include <qtypes.h>
#include "../core/panelinterface.hpp"
#include "../core/proxywindow.hpp"
#include "../core/qmlscreen.hpp" #include "../core/qmlscreen.hpp"
#include "../window/panelinterface.hpp"
#include "../window/proxywindow.hpp"
#include "wlr_layershell/window.hpp" #include "wlr_layershell/window.hpp"
WlrLayershell::WlrLayershell(QObject* parent) WlrLayershell::WlrLayershell(QObject* parent)

View file

@ -8,8 +8,8 @@
#include <qtypes.h> #include <qtypes.h>
#include "../core/doc.hpp" #include "../core/doc.hpp"
#include "../core/panelinterface.hpp" #include "../window/panelinterface.hpp"
#include "../core/proxywindow.hpp" #include "../window/proxywindow.hpp"
#include "wlr_layershell/window.hpp" #include "wlr_layershell/window.hpp"
///! Wlroots layershell window ///! Wlroots layershell window

View file

@ -14,7 +14,7 @@
#include <qtypes.h> #include <qtypes.h>
#include <qwayland-wlr-layer-shell-unstable-v1.h> #include <qwayland-wlr-layer-shell-unstable-v1.h>
#include "../../core/panelinterface.hpp" #include "../../window/panelinterface.hpp"
#include "shell_integration.hpp" #include "shell_integration.hpp"
#include "window.hpp" #include "window.hpp"

View file

@ -9,7 +9,7 @@
#include <qvariant.h> #include <qvariant.h>
#include <qwindow.h> #include <qwindow.h>
#include "../../core/panelinterface.hpp" #include "../../window/panelinterface.hpp"
#include "shell_integration.hpp" #include "shell_integration.hpp"
#include "surface.hpp" #include "surface.hpp"

View file

@ -7,7 +7,7 @@
#include <qtypes.h> #include <qtypes.h>
#include <qwindow.h> #include <qwindow.h>
#include "../../core/panelinterface.hpp" #include "../../window/panelinterface.hpp"
///! WlrLayershell layer. ///! WlrLayershell layer.
/// See @@WlrLayershell.layer. /// See @@WlrLayershell.layer.

23
src/window/CMakeLists.txt Normal file
View file

@ -0,0 +1,23 @@
qt_add_library(quickshell-window STATIC
proxywindow.cpp
windowinterface.cpp
panelinterface.cpp
floatingwindow.cpp
popupwindow.cpp
)
qt_add_qml_module(quickshell-window
URI Quickshell._Window
VERSION 0.1
)
target_link_libraries(quickshell-window PRIVATE ${QT_DEPS} Qt6::QuickPrivate)
qs_pch(quickshell-window)
qs_pch(quickshell-windowplugin)
target_link_libraries(quickshell PRIVATE quickshell-windowplugin)
if (BUILD_TESTING)
add_subdirectory(test)
endif()

View file

@ -3,7 +3,7 @@
#include <qqmlintegration.h> #include <qqmlintegration.h>
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include "doc.hpp" #include "../core/doc.hpp"
#include "windowinterface.hpp" #include "windowinterface.hpp"
class Anchors { class Anchors {

View file

@ -7,9 +7,8 @@
#include <qtypes.h> #include <qtypes.h>
#include <qwindow.h> #include <qwindow.h>
#include "popupanchor.hpp" #include "../core/popupanchor.hpp"
#include "proxywindow.hpp" #include "../core/qmlscreen.hpp"
#include "qmlscreen.hpp"
#include "windowinterface.hpp" #include "windowinterface.hpp"
ProxyPopupWindow::ProxyPopupWindow(QObject* parent): ProxyWindowBase(parent) { ProxyPopupWindow::ProxyPopupWindow(QObject* parent): ProxyWindowBase(parent) {

View file

@ -6,10 +6,10 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h> #include <qtypes.h>
#include "doc.hpp" #include "../core/doc.hpp"
#include "popupanchor.hpp" #include "../core/popupanchor.hpp"
#include "../core/qmlscreen.hpp"
#include "proxywindow.hpp" #include "proxywindow.hpp"
#include "qmlscreen.hpp"
#include "windowinterface.hpp" #include "windowinterface.hpp"
///! Popup window. ///! Popup window.

View file

@ -14,11 +14,11 @@
#include <qvariant.h> #include <qvariant.h>
#include <qwindow.h> #include <qwindow.h>
#include "generation.hpp" #include "../core/generation.hpp"
#include "qmlglobal.hpp" #include "../core/qmlglobal.hpp"
#include "qmlscreen.hpp" #include "../core/qmlscreen.hpp"
#include "region.hpp" #include "../core/region.hpp"
#include "reload.hpp" #include "../core/reload.hpp"
#include "windowinterface.hpp" #include "windowinterface.hpp"
ProxyWindowBase::ProxyWindowBase(QObject* parent) ProxyWindowBase::ProxyWindowBase(QObject* parent)

View file

@ -12,10 +12,9 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h> #include <qtypes.h>
#include "qmlglobal.hpp" #include "../core/qmlscreen.hpp"
#include "qmlscreen.hpp" #include "../core/region.hpp"
#include "region.hpp" #include "../core/reload.hpp"
#include "reload.hpp"
#include "windowinterface.hpp" #include "windowinterface.hpp"
// Proxy to an actual window exposing a limited property set with the ability to // Proxy to an actual window exposing a limited property set with the ability to

View file

@ -0,0 +1,7 @@
function (qs_test name)
add_executable(${name} ${ARGN})
target_link_libraries(${name} PRIVATE ${QT_DEPS} Qt6::Test quickshell-window quickshell-core)
add_test(NAME ${name} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" COMMAND $<TARGET_FILE:${name}>)
endfunction()
qs_test(popupwindow popupwindow.cpp)

View file

@ -0,0 +1,18 @@
#pragma once
#include <qobject.h>
#include <qtmetamacros.h>
class TestPopupWindow: public QObject {
Q_OBJECT;
private slots:
void initiallyVisible();
void reloadReparent();
void reloadUnparent();
void invisibleWithoutParent();
void moveWithParent();
void attachParentLate();
void reparentLate();
void xMigrationFix();
};

View file

@ -8,9 +8,9 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include <qtypes.h> #include <qtypes.h>
#include "qmlscreen.hpp" #include "../core/qmlscreen.hpp"
#include "region.hpp" #include "../core/region.hpp"
#include "reload.hpp" #include "../core/reload.hpp"
class ProxyWindowBase; class ProxyWindowBase;
class QsWindowAttached; class QsWindowAttached;

View file

@ -17,9 +17,9 @@
#include <xcb/xproto.h> #include <xcb/xproto.h>
#include "../core/generation.hpp" #include "../core/generation.hpp"
#include "../core/panelinterface.hpp"
#include "../core/proxywindow.hpp"
#include "../core/qmlscreen.hpp" #include "../core/qmlscreen.hpp"
#include "../window/panelinterface.hpp"
#include "../window/proxywindow.hpp"
#include "util.hpp" #include "util.hpp"
class XPanelStack { class XPanelStack {

View file

@ -8,8 +8,8 @@
#include <qtmetamacros.h> #include <qtmetamacros.h>
#include "../core/doc.hpp" #include "../core/doc.hpp"
#include "../core/panelinterface.hpp" #include "../window/panelinterface.hpp"
#include "../core/proxywindow.hpp" #include "../window/proxywindow.hpp"
class XPanelStack; class XPanelStack;