wayland/screencopy: add screencopy

This commit is contained in:
outfoxxed 2025-01-14 04:43:05 -08:00
parent 918dd2392d
commit cd429142a4
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
37 changed files with 3149 additions and 3 deletions

View file

@ -0,0 +1,56 @@
#include "manager.hpp"
#include <qobject.h>
#include "build.hpp"
#if SCREENCOPY_ICC || SCREENCOPY_WLR
#include "../../core/qmlscreen.hpp"
#endif
#if SCREENCOPY_ICC
#include "image_copy_capture/image_copy_capture.hpp"
#endif
#if SCREENCOPY_WLR
#include "wlr_screencopy/wlr_screencopy.hpp"
#endif
#if SCREENCOPY_HYPRLAND_TOPLEVEL
#include "../toplevel_management/qml.hpp"
#include "hyprland_screencopy/hyprland_screencopy.hpp"
#endif
namespace qs::wayland::screencopy {
ScreencopyContext* ScreencopyManager::createContext(QObject* object, bool paintCursors) {
if (auto* screen = qobject_cast<QuickshellScreenInfo*>(object)) {
#if SCREENCOPY_ICC
{
auto* manager = icc::IccOutputSourceManager::instance();
if (manager->isActive()) {
return manager->captureOutput(screen->screen, paintCursors);
}
}
#endif
#if SCREENCOPY_WLR
{
auto* manager = wlr::WlrScreencopyManager::instance();
if (manager->isActive()) {
return manager->captureOutput(screen->screen, paintCursors);
}
}
#endif
#if SCREENCOPY_HYPRLAND_TOPLEVEL
} else if (auto* toplevel = qobject_cast<toplevel_management::Toplevel*>(object)) {
auto* manager = hyprland::HyprlandScreencopyManager::instance();
if (manager->isActive()) {
return manager->captureToplevel(toplevel->implHandle(), paintCursors);
}
#endif
}
return nullptr;
}
} // namespace qs::wayland::screencopy