forked from quickshell/quickshell
		
	window: generate qmltypes
This commit is contained in:
		
							parent
							
								
									4e48c6eefb
								
							
						
					
					
						commit
						9980f8587e
					
				
					 9 changed files with 51 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -44,7 +44,8 @@ target_link_libraries(quickshell-core PRIVATE quickshell-build)
 | 
			
		|||
qt_add_qml_module(quickshell-core
 | 
			
		||||
	URI Quickshell
 | 
			
		||||
	VERSION 0.1
 | 
			
		||||
	IMPORTS Quickshell._Window
 | 
			
		||||
	OPTIONAL_IMPORTS Quickshell._Window
 | 
			
		||||
	DEFAULT_IMPORTS Quickshell._Window
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(quickshell-core PRIVATE ${QT_DEPS} CLI11::CLI11)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,9 @@
 | 
			
		|||
#define QSDOC_ELEMENT
 | 
			
		||||
#define QSDOC_NAMED_ELEMENT(name)
 | 
			
		||||
 | 
			
		||||
// unmark uncreatable (will be overlayed by other types)
 | 
			
		||||
#define QSDOC_CREATABLE
 | 
			
		||||
 | 
			
		||||
// change the cname used for this type
 | 
			
		||||
#define QSDOC_CNAME(name)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,12 +7,12 @@ headers = [
 | 
			
		|||
	"shell.hpp",
 | 
			
		||||
	"variants.hpp",
 | 
			
		||||
	"region.hpp",
 | 
			
		||||
	"proxywindow.hpp",
 | 
			
		||||
	"../window/proxywindow.hpp",
 | 
			
		||||
	"persistentprops.hpp",
 | 
			
		||||
	"windowinterface.hpp",
 | 
			
		||||
	"panelinterface.hpp",
 | 
			
		||||
	"floatingwindow.hpp",
 | 
			
		||||
	"popupwindow.hpp",
 | 
			
		||||
	"../window/windowinterface.hpp",
 | 
			
		||||
	"../window/panelinterface.hpp",
 | 
			
		||||
	"../window/floatingwindow.hpp",
 | 
			
		||||
	"../window/popupwindow.hpp",
 | 
			
		||||
	"singleton.hpp",
 | 
			
		||||
	"lazyloader.hpp",
 | 
			
		||||
	"easingcurve.hpp",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,6 +19,10 @@ void QuickshellPlugin::initPlugins() {
 | 
			
		|||
	    plugins.end()
 | 
			
		||||
	);
 | 
			
		||||
 | 
			
		||||
	std::sort(plugins.begin(), plugins.end(), [](QuickshellPlugin* a, QuickshellPlugin* b) {
 | 
			
		||||
		return b->dependencies().contains(a->name());
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	for (QuickshellPlugin* plugin: plugins) {
 | 
			
		||||
		plugin->init();
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
 | 
			
		||||
#include <qcontainerfwd.h>
 | 
			
		||||
#include <qfunctionpointer.h>
 | 
			
		||||
#include <qlist.h>
 | 
			
		||||
 | 
			
		||||
class EngineGeneration;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -14,6 +15,8 @@ public:
 | 
			
		|||
	void operator=(QuickshellPlugin&&) = delete;
 | 
			
		||||
	void operator=(const QuickshellPlugin&) = delete;
 | 
			
		||||
 | 
			
		||||
	virtual QString name() { return QString(); }
 | 
			
		||||
	virtual QList<QString> dependencies() { return {}; }
 | 
			
		||||
	virtual bool applies() { return true; }
 | 
			
		||||
	virtual void init() {}
 | 
			
		||||
	virtual void registerTypes() {}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
#include <qguiapplication.h>
 | 
			
		||||
#include <qlist.h>
 | 
			
		||||
#include <qlogging.h>
 | 
			
		||||
#include <qqml.h>
 | 
			
		||||
#include <qtenvironmentvariables.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +16,8 @@ void installPopupPositioner();
 | 
			
		|||
namespace {
 | 
			
		||||
 | 
			
		||||
class WaylandPlugin: public QuickshellPlugin {
 | 
			
		||||
	QList<QString> dependencies() override { return {"window"}; }
 | 
			
		||||
 | 
			
		||||
	bool applies() override {
 | 
			
		||||
		auto isWayland = QGuiApplication::platformName() == "wayland";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,12 +11,17 @@ qt_add_qml_module(quickshell-window
 | 
			
		|||
	VERSION 0.1
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
add_library(quickshell-window-init OBJECT init.cpp)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(quickshell-window PRIVATE ${QT_DEPS} Qt6::QuickPrivate)
 | 
			
		||||
target_link_libraries(quickshell-windowplugin PRIVATE ${QT_DEPS})
 | 
			
		||||
target_link_libraries(quickshell-window-init PRIVATE ${QT_DEPS})
 | 
			
		||||
 | 
			
		||||
qs_pch(quickshell-window)
 | 
			
		||||
qs_pch(quickshell-windowplugin)
 | 
			
		||||
qs_pch(quickshell-window-init)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(quickshell PRIVATE quickshell-windowplugin)
 | 
			
		||||
target_link_libraries(quickshell PRIVATE quickshell-windowplugin quickshell-window-init)
 | 
			
		||||
 | 
			
		||||
if (BUILD_TESTING)
 | 
			
		||||
	add_subdirectory(test)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										22
									
								
								src/window/init.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/window/init.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
#include "../core/plugin.hpp"
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
class WindowPlugin: public QuickshellPlugin {
 | 
			
		||||
	// _Window has to be registered before wayland or x11 modules, otherwise module overlays
 | 
			
		||||
	// will apply in the wrong order.
 | 
			
		||||
	QString name() override { return "window"; }
 | 
			
		||||
 | 
			
		||||
	void registerTypes() override {
 | 
			
		||||
		qmlRegisterModuleImport(
 | 
			
		||||
		    "Quickshell",
 | 
			
		||||
		    QQmlModuleImportModuleAny,
 | 
			
		||||
		    "Quickshell._Window",
 | 
			
		||||
		    QQmlModuleImportLatest
 | 
			
		||||
		);
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
QS_REGISTER_PLUGIN(WindowPlugin);
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
| 
						 | 
				
			
			@ -128,7 +128,9 @@ class PanelWindowInterface: public WindowInterface {
 | 
			
		|||
	/// Note: On Wayland this property corrosponds to @@Quickshell.Wayland.WlrLayershell.keyboardFocus.
 | 
			
		||||
	Q_PROPERTY(bool focusable READ focusable WRITE setFocusable NOTIFY focusableChanged);
 | 
			
		||||
	// clang-format on
 | 
			
		||||
	QSDOC_NAMED_ELEMENT(PanelWindow);
 | 
			
		||||
	QML_NAMED_ELEMENT(PanelWindow);
 | 
			
		||||
	QML_UNCREATABLE("No PanelWindow backend loaded.");
 | 
			
		||||
	QSDOC_CREATABLE;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	explicit PanelWindowInterface(QObject* parent = nullptr): WindowInterface(parent) {}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue