summaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2023-07-18 15:30:28 +0200
committerGitHub <noreply@github.com>2023-07-18 15:30:28 +0200
commit8370a7fcc4627e6f21395cc8b81298369be5cdaf (patch)
tree6be17dc7ba367ea7322d81f20b89b5cdf7defc4d /src/managers
parent629e61c7a56561ee5d565dda6d0d8b7c41dbe9c7 (diff)
internal: Protocol C++ Wraps + XDGOutput impl (#2733)
move to our own xdgoutput impl instead of wlr's
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/ProtocolManager.cpp6
-rw-r--r--src/managers/ProtocolManager.hpp5
-rw-r--r--src/managers/XWaylandManager.cpp71
-rw-r--r--src/managers/XWaylandManager.hpp4
4 files changed, 11 insertions, 75 deletions
diff --git a/src/managers/ProtocolManager.cpp b/src/managers/ProtocolManager.cpp
index 205f3d02..bc3a4570 100644
--- a/src/managers/ProtocolManager.cpp
+++ b/src/managers/ProtocolManager.cpp
@@ -1,9 +1,13 @@
#include "ProtocolManager.hpp"
+#include "xdg-output-unstable-v1-protocol.h"
+
CProtocolManager::CProtocolManager() {
m_pToplevelExportProtocolManager = std::make_unique<CToplevelExportProtocolManager>();
m_pFractionalScaleProtocolManager = std::make_unique<CFractionalScaleProtocolManager>();
m_pTextInputV1ProtocolManager = std::make_unique<CTextInputV1ProtocolManager>();
m_pGlobalShortcutsProtocolManager = std::make_unique<CGlobalShortcutsProtocolManager>();
m_pScreencopyProtocolManager = std::make_unique<CScreencopyProtocolManager>();
-} \ No newline at end of file
+
+ m_pXDGOutputProtocol = std::make_unique<CXDGOutputProtocol>(&zxdg_output_manager_v1_interface, 3, "XDGOutput");
+}
diff --git a/src/managers/ProtocolManager.hpp b/src/managers/ProtocolManager.hpp
index bc6b776e..223460a1 100644
--- a/src/managers/ProtocolManager.hpp
+++ b/src/managers/ProtocolManager.hpp
@@ -6,16 +6,21 @@
#include "../protocols/TextInputV1.hpp"
#include "../protocols/GlobalShortcuts.hpp"
#include "../protocols/Screencopy.hpp"
+#include "../protocols/XDGOutput.hpp"
class CProtocolManager {
public:
CProtocolManager();
+ // TODO: rewrite to use the new protocol framework
std::unique_ptr<CToplevelExportProtocolManager> m_pToplevelExportProtocolManager;
std::unique_ptr<CFractionalScaleProtocolManager> m_pFractionalScaleProtocolManager;
std::unique_ptr<CTextInputV1ProtocolManager> m_pTextInputV1ProtocolManager;
std::unique_ptr<CGlobalShortcutsProtocolManager> m_pGlobalShortcutsProtocolManager;
std::unique_ptr<CScreencopyProtocolManager> m_pScreencopyProtocolManager;
+
+ // New protocols
+ std::unique_ptr<CXDGOutputProtocol> m_pXDGOutputProtocol;
};
inline std::unique_ptr<CProtocolManager> g_pProtocolManager;
diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp
index 9ef02f71..556b40b7 100644
--- a/src/managers/XWaylandManager.cpp
+++ b/src/managers/XWaylandManager.cpp
@@ -295,73 +295,4 @@ Vector2D CHyprXWaylandManager::getMaxSizeForWindow(CWindow* pWindow) {
MAXSIZE.y = 99999;
return MAXSIZE;
-}
-
-void CHyprXWaylandManager::updateXWaylandScale() {
- static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue;
-
- setXWaylandScale(*PXWLFORCESCALEZERO ? std::optional<double>{1.0} : std::optional<double>{});
-}
-
-void CHyprXWaylandManager::setXWaylandScale(std::optional<double> scale) {
- Debug::log(LOG, "Overriding XWayland scale with %.2f", (float)scale.value_or(0.0));
-
-#ifndef NO_XWAYLAND
- wl_resource* res = nullptr;
- for (auto& m : g_pCompositor->m_vMonitors) {
-
- if (!m->output || !m->m_bEnabled)
- continue;
-
- const Vector2D LOGICALSIZE = m->vecTransformedSize / scale.value_or(m->scale);
-
- wl_resource* outputResource = nullptr;
- bool needsDone = false;
-
- wl_list_for_each(res, &m->output->resources, link) {
- const auto PCLIENT = wl_resource_get_client(res);
-
- if (PCLIENT == m_sWLRXWayland->server->client) {
- const auto VERSION = wl_resource_get_version(res);
-
- wl_output_send_mode(res, WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED, (int32_t)LOGICALSIZE.x, (int32_t)LOGICALSIZE.y, m->output->refresh);
-
- if (VERSION >= WL_OUTPUT_SCALE_SINCE_VERSION)
- wl_output_send_scale(res, (uint32_t)ceil(scale.value_or(m->scale)));
-
- wl_output_send_name(res, getFormat("HL-X11-%d", m->ID).c_str());
-
- outputResource = res;
- needsDone = true;
-
- break;
- }
- }
-
- wlr_xdg_output_v1* output;
- wl_list_for_each(output, &g_pCompositor->m_sWLRXDGOutputMgr->outputs, link) {
- if (output->layout_output->output == m->output) {
- wl_list_for_each(res, &output->resources, link) {
- const auto PCLIENT = wl_resource_get_client(res);
-
- if (PCLIENT == m_sWLRXWayland->server->client) {
- zxdg_output_v1_send_logical_size(res, LOGICALSIZE.x, LOGICALSIZE.y);
-
- if (wl_resource_get_version(res) < OUTPUT_DONE_DEPRECATED_SINCE_VERSION)
- zxdg_output_v1_send_done(res);
-
- needsDone = true;
-
- break;
- }
- }
-
- break;
- }
- }
-
- if (needsDone && outputResource)
- wl_output_send_done(outputResource);
- }
-#endif
-}
+} \ No newline at end of file
diff --git a/src/managers/XWaylandManager.hpp b/src/managers/XWaylandManager.hpp
index e05551e4..27bce17d 100644
--- a/src/managers/XWaylandManager.hpp
+++ b/src/managers/XWaylandManager.hpp
@@ -26,10 +26,6 @@ class CHyprXWaylandManager {
void moveXWaylandWindow(CWindow*, const Vector2D&);
void checkBorders(CWindow*);
Vector2D getMaxSizeForWindow(CWindow*);
- void updateXWaylandScale();
-
- private:
- void setXWaylandScale(std::optional<double> scale);
};
inline std::unique_ptr<CHyprXWaylandManager> g_pXWaylandManager; \ No newline at end of file