mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 18:45:59 +01:00
Protocols: implement protoLog
This commit is contained in:
parent
741c75d907
commit
012a2802e0
10 changed files with 84 additions and 45 deletions
|
@ -32,3 +32,38 @@ void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) {
|
||||||
if (!disableStdout)
|
if (!disableStdout)
|
||||||
std::cout << output << "\n";
|
std::cout << output << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Debug::log(LogLevel level, std::string str) {
|
||||||
|
if (level == TRACE && !trace)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (shuttingDown)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (level) {
|
||||||
|
case LOG: str = "[LOG] " + str; break;
|
||||||
|
case WARN: str = "[WARN] " + str; break;
|
||||||
|
case ERR: str = "[ERR] " + str; break;
|
||||||
|
case CRIT: str = "[CRITICAL] " + str; break;
|
||||||
|
case INFO: str = "[INFO] " + str; break;
|
||||||
|
case TRACE: str = "[TRACE] " + str; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
rollingLog += str + "\n";
|
||||||
|
if (rollingLog.size() > ROLLING_LOG_SIZE)
|
||||||
|
rollingLog = rollingLog.substr(rollingLog.size() - ROLLING_LOG_SIZE);
|
||||||
|
|
||||||
|
if (!disableLogs || !**disableLogs) {
|
||||||
|
// log to a file
|
||||||
|
std::ofstream ofs;
|
||||||
|
ofs.open(logFile, std::ios::out | std::ios::app);
|
||||||
|
ofs << str << "\n";
|
||||||
|
|
||||||
|
ofs.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// log it to the stdout too.
|
||||||
|
if (!disableStdout)
|
||||||
|
std::cout << str << "\n";
|
||||||
|
}
|
|
@ -31,6 +31,10 @@ namespace Debug {
|
||||||
inline std::string rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log
|
inline std::string rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log
|
||||||
|
|
||||||
void init(const std::string& IS);
|
void init(const std::string& IS);
|
||||||
|
|
||||||
|
//
|
||||||
|
void log(LogLevel level, std::string str);
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void log(LogLevel level, std::format_string<Args...> fmt, Args&&... args) {
|
void log(LogLevel level, std::format_string<Args...> fmt, Args&&... args) {
|
||||||
if (level == TRACE && !trace)
|
if (level == TRACE && !trace)
|
||||||
|
@ -41,16 +45,6 @@ namespace Debug {
|
||||||
|
|
||||||
std::string logMsg = "";
|
std::string logMsg = "";
|
||||||
|
|
||||||
switch (level) {
|
|
||||||
case LOG: logMsg += "[LOG] "; break;
|
|
||||||
case WARN: logMsg += "[WARN] "; break;
|
|
||||||
case ERR: logMsg += "[ERR] "; break;
|
|
||||||
case CRIT: logMsg += "[CRITICAL] "; break;
|
|
||||||
case INFO: logMsg += "[INFO] "; break;
|
|
||||||
case TRACE: logMsg += "[TRACE] "; break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// print date and time to the ofs
|
// print date and time to the ofs
|
||||||
if (disableTime && !**disableTime) {
|
if (disableTime && !**disableTime) {
|
||||||
#ifndef _LIBCPP_VERSION
|
#ifndef _LIBCPP_VERSION
|
||||||
|
@ -58,7 +52,6 @@ namespace Debug {
|
||||||
#else
|
#else
|
||||||
auto c = std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())};
|
auto c = std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())};
|
||||||
logMsg += std::format("{:%H}:{:%M}:{:%S}", c.hours(), c.minutes(), c.subseconds());
|
logMsg += std::format("{:%H}:{:%M}:{:%S}", c.hours(), c.minutes(), c.subseconds());
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,22 +62,7 @@ namespace Debug {
|
||||||
// 3. this is actually what std::format in stdlib does
|
// 3. this is actually what std::format in stdlib does
|
||||||
logMsg += std::vformat(fmt.get(), std::make_format_args(args...));
|
logMsg += std::vformat(fmt.get(), std::make_format_args(args...));
|
||||||
|
|
||||||
rollingLog += logMsg + "\n";
|
log(level, logMsg);
|
||||||
if (rollingLog.size() > ROLLING_LOG_SIZE)
|
|
||||||
rollingLog = rollingLog.substr(rollingLog.size() - ROLLING_LOG_SIZE);
|
|
||||||
|
|
||||||
if (!disableLogs || !**disableLogs) {
|
|
||||||
// log to a file
|
|
||||||
std::ofstream ofs;
|
|
||||||
ofs.open(logFile, std::ios::out | std::ios::app);
|
|
||||||
ofs << logMsg << "\n";
|
|
||||||
|
|
||||||
ofs.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// log it to the stdout too.
|
|
||||||
if (!disableStdout)
|
|
||||||
std::cout << logMsg << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
|
void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "../desktop/WLSurface.hpp"
|
#include "../desktop/WLSurface.hpp"
|
||||||
#include "../render/Renderer.hpp"
|
#include "../render/Renderer.hpp"
|
||||||
|
|
||||||
|
#define LOGM PROTO::alphaModifier->protoLog
|
||||||
|
|
||||||
CAlphaModifier::CAlphaModifier(SP<CWpAlphaModifierSurfaceV1> resource_, wlr_surface* surface_) : resource(resource_), pSurface(surface_) {
|
CAlphaModifier::CAlphaModifier(SP<CWpAlphaModifierSurfaceV1> resource_, wlr_surface* surface_) : resource(resource_), pSurface(surface_) {
|
||||||
if (!resource->resource())
|
if (!resource->resource())
|
||||||
return;
|
return;
|
||||||
|
@ -21,6 +23,7 @@ CAlphaModifier::CAlphaModifier(SP<CWpAlphaModifierSurfaceV1> resource_, wlr_surf
|
||||||
|
|
||||||
resource->setSetMultiplier([this](CWpAlphaModifierSurfaceV1* mod, uint32_t alpha) {
|
resource->setSetMultiplier([this](CWpAlphaModifierSurfaceV1* mod, uint32_t alpha) {
|
||||||
if (!pSurface) {
|
if (!pSurface) {
|
||||||
|
LOGM(ERR, "Resource {:x} tried to setMultiplier but surface is gone", (uintptr_t)mod->resource());
|
||||||
wl_resource_post_error(mod->resource(), WP_ALPHA_MODIFIER_SURFACE_V1_ERROR_NO_SURFACE, "Surface is gone");
|
wl_resource_post_error(mod->resource(), WP_ALPHA_MODIFIER_SURFACE_V1_ERROR_NO_SURFACE, "Surface is gone");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +50,7 @@ void CAlphaModifier::setSurfaceAlpha(float a) {
|
||||||
CWLSurface* surf = CWLSurface::surfaceFromWlr(pSurface);
|
CWLSurface* surf = CWLSurface::surfaceFromWlr(pSurface);
|
||||||
|
|
||||||
if (!surf) {
|
if (!surf) {
|
||||||
Debug::log(ERR, "Error in CAlphaModifier::setSurfaceAlpha: No CWLSurface for given surface??");
|
LOGM(ERR, "CAlphaModifier::setSurfaceAlpha: No CWLSurface for given surface??");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +96,7 @@ void CAlphaModifierProtocol::destroyModifier(CAlphaModifier* modifier) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!deadptr) {
|
if (!deadptr) {
|
||||||
Debug::log(ERR, "CAlphaModifierProtocol::destroyModifier: dead resource but no deadptr???");
|
LOGM(ERR, "CAlphaModifierProtocol::destroyModifier: dead resource but no deadptr???");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +106,7 @@ void CAlphaModifierProtocol::destroyModifier(CAlphaModifier* modifier) {
|
||||||
|
|
||||||
void CAlphaModifierProtocol::onGetSurface(CWpAlphaModifierV1* pMgr, uint32_t id, wlr_surface* surface) {
|
void CAlphaModifierProtocol::onGetSurface(CWpAlphaModifierV1* pMgr, uint32_t id, wlr_surface* surface) {
|
||||||
if (m_mAlphaModifiers.contains(surface)) {
|
if (m_mAlphaModifiers.contains(surface)) {
|
||||||
|
LOGM(ERR, "AlphaModifier already present for surface {:x}", (uintptr_t)surface);
|
||||||
wl_resource_post_error(pMgr->resource(), WP_ALPHA_MODIFIER_V1_ERROR_ALREADY_CONSTRUCTED, "AlphaModifier already present");
|
wl_resource_post_error(pMgr->resource(), WP_ALPHA_MODIFIER_V1_ERROR_ALREADY_CONSTRUCTED, "AlphaModifier already present");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "CursorShape.hpp"
|
#include "CursorShape.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#define LOGM PROTO::cursorShape->protoLog
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
constexpr const char* SHAPE_NAMES[] = {
|
constexpr const char* SHAPE_NAMES[] = {
|
||||||
"invalid",
|
"invalid",
|
||||||
|
@ -72,6 +74,7 @@ void CCursorShapeProtocol::onGetTabletToolV2(CWpCursorShapeManagerV1* pMgr, uint
|
||||||
|
|
||||||
void CCursorShapeProtocol::createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource) {
|
void CCursorShapeProtocol::createCursorShapeDevice(CWpCursorShapeManagerV1* pMgr, uint32_t id, wl_resource* resource) {
|
||||||
if (m_mDevices.contains(resource)) {
|
if (m_mDevices.contains(resource)) {
|
||||||
|
LOGM(ERR, "CursorShape device already exists for {:x}", (uintptr_t)resource);
|
||||||
wl_resource_post_error(resource, 0, "Device already exists");
|
wl_resource_post_error(resource, 0, "Device already exists");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "FractionalScale.hpp"
|
#include "FractionalScale.hpp"
|
||||||
|
|
||||||
|
#define LOGM PROTO::fractional->protoLog
|
||||||
|
|
||||||
static void onWlrSurfaceDestroy(void* owner, void* data) {
|
static void onWlrSurfaceDestroy(void* owner, void* data) {
|
||||||
const auto SURF = (wlr_surface*)owner;
|
const auto SURF = (wlr_surface*)owner;
|
||||||
|
|
||||||
|
@ -28,6 +30,12 @@ void CFractionalScaleProtocol::onManagerResourceDestroy(wl_resource* res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, wlr_surface* surface) {
|
void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, wlr_surface* surface) {
|
||||||
|
if (m_mAddons.contains(surface)) {
|
||||||
|
LOGM(ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface);
|
||||||
|
wl_resource_post_error(pMgr->resource(), WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS, "Fractional scale already exists");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto PADDON = m_mAddons
|
const auto PADDON = m_mAddons
|
||||||
.emplace(surface,
|
.emplace(surface,
|
||||||
std::make_unique<CFractionalScaleAddon>(
|
std::make_unique<CFractionalScaleAddon>(
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "../helpers/Monitor.hpp"
|
#include "../helpers/Monitor.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
|
#define LOGM PROTO::gamma->protoLog
|
||||||
|
|
||||||
CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* output) : resource(resource_) {
|
CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* output) : resource(resource_) {
|
||||||
if (!resource_->resource())
|
if (!resource_->resource())
|
||||||
return;
|
return;
|
||||||
|
@ -11,7 +13,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
||||||
wlr_output* wlrOutput = wlr_output_from_resource(output);
|
wlr_output* wlrOutput = wlr_output_from_resource(output);
|
||||||
|
|
||||||
if (!wlrOutput) {
|
if (!wlrOutput) {
|
||||||
Debug::log(ERR, "[gamma] No wlr_output");
|
LOGM(ERR, "No wlr_output in CGammaControl");
|
||||||
resource->sendFailed();
|
resource->sendFailed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +21,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
||||||
pMonitor = g_pCompositor->getRealMonitorFromOutput(wlrOutput);
|
pMonitor = g_pCompositor->getRealMonitorFromOutput(wlrOutput);
|
||||||
|
|
||||||
if (!pMonitor) {
|
if (!pMonitor) {
|
||||||
Debug::log(ERR, "[gamma] No CMonitor");
|
LOGM(ERR, "No CMonitor");
|
||||||
resource->sendFailed();
|
resource->sendFailed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +36,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
||||||
gammaSize = wlr_output_get_gamma_size(wlrOutput);
|
gammaSize = wlr_output_get_gamma_size(wlrOutput);
|
||||||
|
|
||||||
if (gammaSize <= 0) {
|
if (gammaSize <= 0) {
|
||||||
Debug::log(ERR, "[gamma] Output {} doesn't support gamma", pMonitor->szName);
|
LOGM(ERR, "Output {} doesn't support gamma", pMonitor->szName);
|
||||||
resource->sendFailed();
|
resource->sendFailed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -45,18 +47,18 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
||||||
resource->setOnDestroy([this](CZwlrGammaControlV1* gamma) { PROTO::gamma->destroyGammaControl(this); });
|
resource->setOnDestroy([this](CZwlrGammaControlV1* gamma) { PROTO::gamma->destroyGammaControl(this); });
|
||||||
|
|
||||||
resource->setSetGamma([this](CZwlrGammaControlV1* gamma, int32_t fd) {
|
resource->setSetGamma([this](CZwlrGammaControlV1* gamma, int32_t fd) {
|
||||||
Debug::log(LOG, "[gamma] setGamma for {}", pMonitor->szName);
|
LOGM(LOG, "setGamma for {}", pMonitor->szName);
|
||||||
|
|
||||||
int fdFlags = fcntl(fd, F_GETFL, 0);
|
int fdFlags = fcntl(fd, F_GETFL, 0);
|
||||||
if (fdFlags < 0) {
|
if (fdFlags < 0) {
|
||||||
Debug::log(ERR, "[gamma] Failed to get fd flags");
|
LOGM(ERR, "Failed to get fd flags");
|
||||||
resource->sendFailed();
|
resource->sendFailed();
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fcntl(fd, F_SETFL, fdFlags | O_NONBLOCK) < 0) {
|
if (fcntl(fd, F_SETFL, fdFlags | O_NONBLOCK) < 0) {
|
||||||
Debug::log(ERR, "[gamma] Failed to set fd flags");
|
LOGM(ERR, "Failed to set fd flags");
|
||||||
resource->sendFailed();
|
resource->sendFailed();
|
||||||
close(fd);
|
close(fd);
|
||||||
return;
|
return;
|
||||||
|
@ -64,7 +66,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
||||||
|
|
||||||
ssize_t readBytes = pread(fd, gammaTable.data(), gammaTable.size() * sizeof(uint16_t), 0);
|
ssize_t readBytes = pread(fd, gammaTable.data(), gammaTable.size() * sizeof(uint16_t), 0);
|
||||||
if (readBytes < 0 || (size_t)readBytes != gammaTable.size() * sizeof(uint16_t)) {
|
if (readBytes < 0 || (size_t)readBytes != gammaTable.size() * sizeof(uint16_t)) {
|
||||||
Debug::log(ERR, "[gamma] Failed to read bytes");
|
LOGM(ERR, "Failed to read bytes");
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if ((size_t)readBytes != gammaTable.size() * sizeof(uint16_t)) {
|
if ((size_t)readBytes != gammaTable.size() * sizeof(uint16_t)) {
|
||||||
|
@ -103,7 +105,7 @@ void CGammaControl::applyToMonitor() {
|
||||||
if (!pMonitor)
|
if (!pMonitor)
|
||||||
return; // ??
|
return; // ??
|
||||||
|
|
||||||
Debug::log(LOG, "[gamma] setting to monitor {}", pMonitor->szName);
|
LOGM(LOG, "setting to monitor {}", pMonitor->szName);
|
||||||
|
|
||||||
if (!gammaTableSet) {
|
if (!gammaTableSet) {
|
||||||
wlr_output_state_set_gamma_lut(pMonitor->state.wlr(), 0, nullptr, nullptr, nullptr);
|
wlr_output_state_set_gamma_lut(pMonitor->state.wlr(), 0, nullptr, nullptr, nullptr);
|
||||||
|
@ -117,7 +119,7 @@ void CGammaControl::applyToMonitor() {
|
||||||
wlr_output_state_set_gamma_lut(pMonitor->state.wlr(), gammaSize, red, green, blue);
|
wlr_output_state_set_gamma_lut(pMonitor->state.wlr(), gammaSize, red, green, blue);
|
||||||
|
|
||||||
if (!pMonitor->state.test()) {
|
if (!pMonitor->state.test()) {
|
||||||
Debug::log(LOG, "[gamma] setting to monitor {} failed", pMonitor->szName);
|
LOGM(LOG, "setting to monitor {} failed", pMonitor->szName);
|
||||||
wlr_output_state_set_gamma_lut(pMonitor->state.wlr(), 0, nullptr, nullptr, nullptr);
|
wlr_output_state_set_gamma_lut(pMonitor->state.wlr(), 0, nullptr, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,18 +13,18 @@ void IWaylandProtocol::onDisplayDestroy() {
|
||||||
wl_global_destroy(m_pGlobal);
|
wl_global_destroy(m_pGlobal);
|
||||||
}
|
}
|
||||||
|
|
||||||
IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, const std::string& name) {
|
IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, const std::string& name) : m_szName(name) {
|
||||||
m_pGlobal = wl_global_create(g_pCompositor->m_sWLDisplay, iface, ver, this, &bindManagerInternal);
|
m_pGlobal = wl_global_create(g_pCompositor->m_sWLDisplay, iface, ver, this, &bindManagerInternal);
|
||||||
|
|
||||||
if (!m_pGlobal) {
|
if (!m_pGlobal) {
|
||||||
Debug::log(ERR, "[proto {}] could not create a global", name);
|
protoLog(ERR, "could not create a global");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_liDisplayDestroy.notify = displayDestroyInternal;
|
m_liDisplayDestroy.notify = displayDestroyInternal;
|
||||||
wl_display_add_destroy_listener(g_pCompositor->m_sWLDisplay, &m_liDisplayDestroy);
|
wl_display_add_destroy_listener(g_pCompositor->m_sWLDisplay, &m_liDisplayDestroy);
|
||||||
|
|
||||||
Debug::log(LOG, "[proto {}] started", name);
|
protoLog(LOG, "Registered global");
|
||||||
}
|
}
|
||||||
|
|
||||||
IWaylandProtocol::~IWaylandProtocol() {
|
IWaylandProtocol::~IWaylandProtocol() {
|
||||||
|
|
|
@ -24,7 +24,13 @@ class IWaylandProtocol {
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) = 0;
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) = 0;
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
void protoLog(LogLevel level, std::format_string<Args...> fmt, Args&&... args) {
|
||||||
|
Debug::log(level, std::format("[{}] ", m_szName) + std::vformat(fmt.get(), std::make_format_args(args...)));
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string m_szName;
|
||||||
wl_global* m_pGlobal = nullptr;
|
wl_global* m_pGlobal = nullptr;
|
||||||
wl_listener m_liDisplayDestroy;
|
wl_listener m_liDisplayDestroy;
|
||||||
};
|
};
|
|
@ -1,6 +1,8 @@
|
||||||
#include "XDGDecoration.hpp"
|
#include "XDGDecoration.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#define LOGM PROTO::xdgDecoration->protoLog
|
||||||
|
|
||||||
CXDGDecoration::CXDGDecoration(SP<CZxdgToplevelDecorationV1> resource_, wl_resource* toplevel) : resource(resource_), pToplevelResource(toplevel) {
|
CXDGDecoration::CXDGDecoration(SP<CZxdgToplevelDecorationV1> resource_, wl_resource* toplevel) : resource(resource_), pToplevelResource(toplevel) {
|
||||||
if (!resource->resource())
|
if (!resource->resource())
|
||||||
return;
|
return;
|
||||||
|
@ -16,13 +18,12 @@ CXDGDecoration::CXDGDecoration(SP<CZxdgToplevelDecorationV1> resource_, wl_resou
|
||||||
default: modeString = "INVALID"; break;
|
default: modeString = "INVALID"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "[xdgDecoration] setMode: {}. {} MODE_SERVER_SIDE as reply.", modeString,
|
LOGM(LOG, "setMode: {}. {} MODE_SERVER_SIDE as reply.", modeString, (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE ? "Sending" : "Ignoring and sending"));
|
||||||
(mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE ? "Sending" : "Ignoring and sending"));
|
|
||||||
resource->sendConfigure(ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
resource->sendConfigure(ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
||||||
});
|
});
|
||||||
|
|
||||||
resource->setUnsetMode([this](CZxdgToplevelDecorationV1*) {
|
resource->setUnsetMode([this](CZxdgToplevelDecorationV1*) {
|
||||||
Debug::log(LOG, "[xdgDecoration] unsetMode. Sending MODE_SERVER_SIDE.");
|
LOGM(LOG, "unsetMode. Sending MODE_SERVER_SIDE.");
|
||||||
resource->sendConfigure(ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
resource->sendConfigure(ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#define LOGM PROTO::xdgOutput->protoLog
|
||||||
|
|
||||||
void CXDGOutputProtocol::onManagerResourceDestroy(wl_resource* res) {
|
void CXDGOutputProtocol::onManagerResourceDestroy(wl_resource* res) {
|
||||||
std::erase_if(m_vManagerResources, [&](const auto& other) { return other->resource() == res; });
|
std::erase_if(m_vManagerResources, [&](const auto& other) { return other->resource() == res; });
|
||||||
}
|
}
|
||||||
|
@ -22,7 +24,7 @@ void CXDGOutputProtocol::bindManager(wl_client* client, void* data, uint32_t ver
|
||||||
const auto RESOURCE = m_vManagerResources.emplace_back(std::make_unique<CZxdgOutputManagerV1>(client, ver, id)).get();
|
const auto RESOURCE = m_vManagerResources.emplace_back(std::make_unique<CZxdgOutputManagerV1>(client, ver, id)).get();
|
||||||
|
|
||||||
if (!RESOURCE->resource()) {
|
if (!RESOURCE->resource()) {
|
||||||
Debug::log(LOG, "Couldn't bind XDGOutputMgr");
|
LOGM(LOG, "Couldn't bind XDGOutputMgr");
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue