summaryrefslogtreecommitdiff
path: root/src/desktop/Window.cpp
diff options
context:
space:
mode:
authorUjinT34 <41110182+UjinT34@users.noreply.github.com>2025-02-02 22:25:29 +0300
committerGitHub <noreply@github.com>2025-02-02 20:25:29 +0100
commit31431a92714ab7f53c25d2ececb26c5b7264b7e3 (patch)
treeb5a9ff0e57493b503b09eb9f0e70e96075d70add /src/desktop/Window.cpp
parent70d94fec134c4b91916812901310e7765acf8405 (diff)
protocols: Support content-type-v1 proto (#9226)
Diffstat (limited to 'src/desktop/Window.cpp')
-rw-r--r--src/desktop/Window.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp
index 6e580e49..6a523eec 100644
--- a/src/desktop/Window.cpp
+++ b/src/desktop/Window.cpp
@@ -15,6 +15,7 @@
#include "../managers/AnimationManager.hpp"
#include "../protocols/XDGShell.hpp"
#include "../protocols/core/Compositor.hpp"
+#include "../protocols/ContentType.hpp"
#include "../xwayland/XWayland.hpp"
#include "../helpers/Color.hpp"
#include "../events/Events.hpp"
@@ -29,6 +30,7 @@
using namespace Hyprutils::String;
using namespace Hyprutils::Animation;
+using enum NContentType::eContentType;
PHLWINDOW CWindow::create(SP<CXWaylandSurface> surface) {
PHLWINDOW pWindow = SP<CWindow>(new CWindow(surface));
@@ -1724,3 +1726,16 @@ void CWindow::sendWindowSize(Vector2D size, bool force, std::optional<Vector2D>
else if (m_pXDGSurface && m_pXDGSurface->toplevel)
m_vPendingSizeAcks.emplace_back(m_pXDGSurface->toplevel->setSize(size), size.floor());
}
+
+NContentType::eContentType CWindow::getContentType() {
+ return m_pWLSurface->resource()->contentType.valid() ? m_pWLSurface->resource()->contentType->value : CONTENT_TYPE_NONE;
+}
+
+void CWindow::setContentType(NContentType::eContentType contentType) {
+ if (!m_pWLSurface->resource()->contentType.valid())
+ m_pWLSurface->resource()->contentType = PROTO::contentType->getContentType(m_pWLSurface->resource());
+ // else disallow content type change if proto is used?
+
+ Debug::log(INFO, "ContentType for window {}", (int)contentType);
+ m_pWLSurface->resource()->contentType->value = contentType;
+}