mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-10 05:26:00 +01:00
protocols: refactor protocol logging to a macro (#7324)
this avoids the usage of the unique_ptr PROTO::protocol before it has been constructed incase one wants to log something inside the constructor itself, move the logging to macros and print file:linenumber on ERR,CRIT,WARN and classname on the rest of the levels.
This commit is contained in:
parent
15f942000e
commit
12d9901472
45 changed files with 42 additions and 104 deletions
|
@ -4,8 +4,6 @@
|
||||||
#include "../render/Renderer.hpp"
|
#include "../render/Renderer.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::alphaModifier->protoLog
|
|
||||||
|
|
||||||
CAlphaModifier::CAlphaModifier(SP<CWpAlphaModifierSurfaceV1> resource_, SP<CWLSurfaceResource> surface_) : resource(resource_), pSurface(surface_) {
|
CAlphaModifier::CAlphaModifier(SP<CWpAlphaModifierSurfaceV1> resource_, SP<CWLSurfaceResource> surface_) : resource(resource_), pSurface(surface_) {
|
||||||
if (!resource->resource())
|
if (!resource->resource())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "../helpers/CursorShapes.hpp"
|
#include "../helpers/CursorShapes.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::cursorShape->protoLog
|
|
||||||
|
|
||||||
CCursorShapeProtocol::CCursorShapeProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CCursorShapeProtocol::CCursorShapeProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include <aquamarine/backend/DRM.hpp>
|
#include <aquamarine/backend/DRM.hpp>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#define LOGM PROTO::lease->protoLog
|
|
||||||
|
|
||||||
CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRequestResource> request) : resource(resource_) {
|
CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRequestResource> request) : resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
@ -226,7 +224,7 @@ CDRMLeaseDevice::CDRMLeaseDevice(SP<Aquamarine::CDRMBackend> drmBackend) : backe
|
||||||
auto fd = drm->getNonMasterFD();
|
auto fd = drm->getNonMasterFD();
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
Debug::log(ERR, "[DRMLease] Failed to dup fd for drm node {}", drm->gpuName);
|
LOGM(ERR, "Failed to dup fd for drm node {}", drm->gpuName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#define LOGM PROTO::sync->protoLog
|
|
||||||
|
|
||||||
CDRMSyncobjSurfaceResource::CDRMSyncobjSurfaceResource(SP<CWpLinuxDrmSyncobjSurfaceV1> resource_, SP<CWLSurfaceResource> surface_) : surface(surface_), resource(resource_) {
|
CDRMSyncobjSurfaceResource::CDRMSyncobjSurfaceResource(SP<CWpLinuxDrmSyncobjSurfaceV1> resource_, SP<CWLSurfaceResource> surface_) : surface(surface_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#include "../managers/SeatManager.hpp"
|
#include "../managers/SeatManager.hpp"
|
||||||
#include "core/Seat.hpp"
|
#include "core/Seat.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::dataWlr->protoLog
|
|
||||||
|
|
||||||
CWLRDataOffer::CWLRDataOffer(SP<CZwlrDataControlOfferV1> resource_, SP<IDataSource> source_) : source(source_), resource(resource_) {
|
CWLRDataOffer::CWLRDataOffer(SP<CZwlrDataControlOfferV1> resource_, SP<IDataSource> source_) : source(source_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
|
|
||||||
#define LOGM PROTO::focusGrab->protoLog
|
|
||||||
|
|
||||||
CFocusGrabSurfaceState::CFocusGrabSurfaceState(CFocusGrab* grab, SP<CWLSurfaceResource> surface) {
|
CFocusGrabSurfaceState::CFocusGrabSurfaceState(CFocusGrab* grab, SP<CWLSurfaceResource> surface) {
|
||||||
listeners.destroy = surface->events.destroy.registerListener([=](std::any d) { grab->eraseSurface(surface); });
|
listeners.destroy = surface->events.destroy.registerListener([=](std::any d) { grab->eraseSurface(surface); });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include "ForeignToplevel.hpp"
|
#include "ForeignToplevel.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::foreignToplevel->protoLog
|
|
||||||
|
|
||||||
CForeignToplevelHandle::CForeignToplevelHandle(SP<CExtForeignToplevelHandleV1> resource_, PHLWINDOW pWindow_) : resource(resource_), pWindow(pWindow_) {
|
CForeignToplevelHandle::CForeignToplevelHandle(SP<CExtForeignToplevelHandleV1> resource_, PHLWINDOW pWindow_) : resource(resource_), pWindow(pWindow_) {
|
||||||
if (!resource_->resource())
|
if (!resource_->resource())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include "protocols/core/Output.hpp"
|
#include "protocols/core/Output.hpp"
|
||||||
#include "render/Renderer.hpp"
|
#include "render/Renderer.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::foreignToplevelWlr->protoLog
|
|
||||||
|
|
||||||
CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHandleV1> resource_, PHLWINDOW pWindow_) : resource(resource_), pWindow(pWindow_) {
|
CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHandleV1> resource_, PHLWINDOW pWindow_) : resource(resource_), pWindow(pWindow_) {
|
||||||
if (!resource_->resource())
|
if (!resource_->resource())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::fractional->protoLog
|
|
||||||
|
|
||||||
CFractionalScaleProtocol::CFractionalScaleProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CFractionalScaleProtocol::CFractionalScaleProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../protocols/core/Output.hpp"
|
#include "../protocols/core/Output.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;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include "GlobalShortcuts.hpp"
|
#include "GlobalShortcuts.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::globalShortcuts->protoLog
|
|
||||||
|
|
||||||
CShortcutClient::CShortcutClient(SP<CHyprlandGlobalShortcutsManagerV1> resource_) : resource(resource_) {
|
CShortcutClient::CShortcutClient(SP<CHyprlandGlobalShortcutsManagerV1> resource_) : resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include "IdleNotify.hpp"
|
#include "IdleNotify.hpp"
|
||||||
#include "../managers/eventLoop/EventLoopManager.hpp"
|
#include "../managers/eventLoop/EventLoopManager.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::idle->protoLog
|
|
||||||
|
|
||||||
static int onTimer(SP<CEventLoopTimer> self, void* data) {
|
static int onTimer(SP<CEventLoopTimer> self, void* data) {
|
||||||
|
|
||||||
const auto NOTIF = (CExtIdleNotification*)data;
|
const auto NOTIF = (CExtIdleNotification*)data;
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#define LOGM PROTO::ime->protoLog
|
|
||||||
|
|
||||||
CInputMethodKeyboardGrabV2::CInputMethodKeyboardGrabV2(SP<CZwpInputMethodKeyboardGrabV2> resource_, SP<CInputMethodV2> owner_) : resource(resource_), owner(owner_) {
|
CInputMethodKeyboardGrabV2::CInputMethodKeyboardGrabV2(SP<CZwpInputMethodKeyboardGrabV2> resource_, SP<CInputMethodV2> owner_) : resource(resource_), owner(owner_) {
|
||||||
if (!resource->resource())
|
if (!resource->resource())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include "core/Output.hpp"
|
#include "core/Output.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::layerShell->protoLog
|
|
||||||
|
|
||||||
void CLayerShellResource::SState::reset() {
|
void CLayerShellResource::SState::reset() {
|
||||||
anchor = 0;
|
anchor = 0;
|
||||||
exclusive = 0;
|
exclusive = 0;
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
#include "../render/OpenGL.hpp"
|
#include "../render/OpenGL.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::linuxDma->protoLog
|
|
||||||
|
|
||||||
static std::optional<dev_t> devIDFromFD(int fd) {
|
static std::optional<dev_t> devIDFromFD(int fd) {
|
||||||
struct stat stat;
|
struct stat stat;
|
||||||
if (fstat(fd, &stat) != 0)
|
if (fstat(fd, &stat) != 0)
|
||||||
|
@ -425,7 +423,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||||
auto dev = devIDFromFD(rendererFD);
|
auto dev = devIDFromFD(rendererFD);
|
||||||
|
|
||||||
if (!dev.has_value()) {
|
if (!dev.has_value()) {
|
||||||
protoLog(ERR, "failed to get drm dev, disabling linux dmabuf");
|
LOGM(ERR, "failed to get drm dev, disabling linux dmabuf");
|
||||||
removeGlobal();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -477,7 +475,7 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||||
|
|
||||||
drmDevice* device = nullptr;
|
drmDevice* device = nullptr;
|
||||||
if (drmGetDeviceFromDevId(mainDevice, 0, &device) != 0) {
|
if (drmGetDeviceFromDevId(mainDevice, 0, &device) != 0) {
|
||||||
protoLog(ERR, "failed to get drm dev, disabling linux dmabuf");
|
LOGM(ERR, "failed to get drm dev, disabling linux dmabuf");
|
||||||
removeGlobal();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -487,12 +485,12 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
||||||
mainDeviceFD = open(name, O_RDWR | O_CLOEXEC);
|
mainDeviceFD = open(name, O_RDWR | O_CLOEXEC);
|
||||||
drmFreeDevice(&device);
|
drmFreeDevice(&device);
|
||||||
if (mainDeviceFD < 0) {
|
if (mainDeviceFD < 0) {
|
||||||
protoLog(ERR, "failed to open drm dev, disabling linux dmabuf");
|
LOGM(ERR, "failed to open drm dev, disabling linux dmabuf");
|
||||||
removeGlobal();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
protoLog(ERR, "DRM device {} has no render node, disabling linux dmabuf", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null");
|
LOGM(ERR, "DRM device {} has no render node, disabling linux dmabuf", device->nodes[DRM_NODE_PRIMARY] ? device->nodes[DRM_NODE_PRIMARY] : "null");
|
||||||
drmFreeDevice(&device);
|
drmFreeDevice(&device);
|
||||||
removeGlobal();
|
removeGlobal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "types/WLBuffer.hpp"
|
#include "types/WLBuffer.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::mesaDRM->protoLog
|
|
||||||
|
|
||||||
CMesaDRMBufferResource::CMesaDRMBufferResource(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs attrs_) {
|
CMesaDRMBufferResource::CMesaDRMBufferResource(uint32_t id, wl_client* client, Aquamarine::SDMABUFAttrs attrs_) {
|
||||||
LOGM(LOG, "Creating a Mesa dmabuf, with id {}: size {}, fmt {}, planes {}", id, attrs_.size, attrs_.format, attrs_.planes);
|
LOGM(LOG, "Creating a Mesa dmabuf, with id {}: size {}, fmt {}, planes {}", id, attrs_.size, attrs_.format, attrs_.planes);
|
||||||
for (int i = 0; i < attrs_.planes; ++i) {
|
for (int i = 0; i < attrs_.planes; ++i) {
|
||||||
|
@ -115,7 +113,7 @@ CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, co
|
||||||
drmDevice* dev = nullptr;
|
drmDevice* dev = nullptr;
|
||||||
int drmFD = g_pCompositor->m_iDRMFD;
|
int drmFD = g_pCompositor->m_iDRMFD;
|
||||||
if (drmGetDevice2(drmFD, 0, &dev) != 0) {
|
if (drmGetDevice2(drmFD, 0, &dev) != 0) {
|
||||||
protoLog(ERR, "Failed to get device, disabling MesaDRM");
|
LOGM(ERR, "Failed to get device, disabling MesaDRM");
|
||||||
removeGlobal();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -126,13 +124,13 @@ CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, co
|
||||||
ASSERT(dev->available_nodes & (1 << DRM_NODE_PRIMARY));
|
ASSERT(dev->available_nodes & (1 << DRM_NODE_PRIMARY));
|
||||||
|
|
||||||
if (!dev->nodes[DRM_NODE_PRIMARY]) {
|
if (!dev->nodes[DRM_NODE_PRIMARY]) {
|
||||||
protoLog(ERR, "No DRM render node available, both render and primary are null, disabling MesaDRM");
|
LOGM(ERR, "No DRM render node available, both render and primary are null, disabling MesaDRM");
|
||||||
drmFreeDevice(&dev);
|
drmFreeDevice(&dev);
|
||||||
removeGlobal();
|
removeGlobal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protoLog(WARN, "No DRM render node, falling back to primary {}", dev->nodes[DRM_NODE_PRIMARY]);
|
LOGM(WARN, "No DRM render node, falling back to primary {}", dev->nodes[DRM_NODE_PRIMARY]);
|
||||||
nodeName = dev->nodes[DRM_NODE_PRIMARY];
|
nodeName = dev->nodes[DRM_NODE_PRIMARY];
|
||||||
}
|
}
|
||||||
drmFreeDevice(&dev);
|
drmFreeDevice(&dev);
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
using namespace Aquamarine;
|
using namespace Aquamarine;
|
||||||
|
|
||||||
#define LOGM PROTO::outputManagement->protoLog
|
|
||||||
|
|
||||||
COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : resource(resource_) {
|
COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "core/Output.hpp"
|
#include "core/Output.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::outputPower->protoLog
|
|
||||||
|
|
||||||
COutputPower::COutputPower(SP<CZwlrOutputPowerV1> resource_, CMonitor* pMonitor_) : resource(resource_), pMonitor(pMonitor_) {
|
COutputPower::COutputPower(SP<CZwlrOutputPowerV1> resource_, CMonitor* pMonitor_) : resource(resource_), pMonitor(pMonitor_) {
|
||||||
if (!resource->resource())
|
if (!resource->resource())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#include "../managers/SeatManager.hpp"
|
#include "../managers/SeatManager.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::constraints->protoLog
|
|
||||||
|
|
||||||
CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region_, zwpPointerConstraintsV1Lifetime lifetime_) :
|
CPointerConstraint::CPointerConstraint(SP<CZwpLockedPointerV1> resource_, SP<CWLSurfaceResource> surf, wl_resource* region_, zwpPointerConstraintsV1Lifetime lifetime_) :
|
||||||
resourceL(resource_), locked(true), lifetime(lifetime_) {
|
resourceL(resource_), locked(true), lifetime(lifetime_) {
|
||||||
if (!resource_->resource())
|
if (!resource_->resource())
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include "core/Seat.hpp"
|
#include "core/Seat.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::pointerGestures->protoLog
|
|
||||||
|
|
||||||
CPointerGestureSwipe::CPointerGestureSwipe(SP<CZwpPointerGestureSwipeV1> resource_) : resource(resource_) {
|
CPointerGestureSwipe::CPointerGestureSwipe(SP<CZwpPointerGestureSwipeV1> resource_) : resource(resource_) {
|
||||||
if (!resource->resource())
|
if (!resource->resource())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
#include "core/Output.hpp"
|
#include "core/Output.hpp"
|
||||||
#include <aquamarine/output/Output.hpp>
|
#include <aquamarine/output/Output.hpp>
|
||||||
|
|
||||||
#define LOGM PROTO::presentation->protoLog
|
|
||||||
|
|
||||||
CQueuedPresentationData::CQueuedPresentationData(SP<CWLSurfaceResource> surf) : surface(surf) {
|
CQueuedPresentationData::CQueuedPresentationData(SP<CWLSurfaceResource> surf) : surface(surf) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include "core/Seat.hpp"
|
#include "core/Seat.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::primarySelection->protoLog
|
|
||||||
|
|
||||||
CPrimarySelectionOffer::CPrimarySelectionOffer(SP<CZwpPrimarySelectionOfferV1> resource_, SP<IDataSource> source_) : source(source_), resource(resource_) {
|
CPrimarySelectionOffer::CPrimarySelectionOffer(SP<CZwpPrimarySelectionOfferV1> resource_, SP<IDataSource> source_) : source(source_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define LOGM PROTO::screencopy->protoLog
|
|
||||||
|
|
||||||
CScreencopyFrame::~CScreencopyFrame() {
|
CScreencopyFrame::~CScreencopyFrame() {
|
||||||
if (buffer && buffer->locked())
|
if (buffer && buffer->locked())
|
||||||
buffer->unlock();
|
buffer->unlock();
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include "ServerDecorationKDE.hpp"
|
#include "ServerDecorationKDE.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::serverDecorationKDE->protoLog
|
|
||||||
|
|
||||||
CServerDecorationKDE::CServerDecorationKDE(SP<COrgKdeKwinServerDecoration> resource_, SP<CWLSurfaceResource> surf) : resource(resource_) {
|
CServerDecorationKDE::CServerDecorationKDE(SP<COrgKdeKwinServerDecoration> resource_, SP<CWLSurfaceResource> surf) : resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include "core/Output.hpp"
|
#include "core/Output.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::sessionLock->protoLog
|
|
||||||
|
|
||||||
CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_, SP<CWLSurfaceResource> surface_, CMonitor* pMonitor_, WP<CSessionLock> owner_) :
|
CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_, SP<CWLSurfaceResource> surface_, CMonitor* pMonitor_, WP<CSessionLock> owner_) :
|
||||||
resource(resource_), sessionLock(owner_), pSurface(surface_), pMonitor(pMonitor_) {
|
resource(resource_), sessionLock(owner_), pSurface(surface_), pMonitor(pMonitor_) {
|
||||||
if (!resource->resource())
|
if (!resource->resource())
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::shortcutsInhibit->protoLog
|
|
||||||
|
|
||||||
CKeyboardShortcutsInhibitor::CKeyboardShortcutsInhibitor(SP<CZwpKeyboardShortcutsInhibitorV1> resource_, SP<CWLSurfaceResource> surf) : resource(resource_), pSurface(surf) {
|
CKeyboardShortcutsInhibitor::CKeyboardShortcutsInhibitor(SP<CZwpKeyboardShortcutsInhibitorV1> resource_, SP<CWLSurfaceResource> surf) : resource(resource_), pSurface(surf) {
|
||||||
if (!resource->resource())
|
if (!resource->resource())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#define LOGM PROTO::tablet->protoLog
|
|
||||||
|
|
||||||
CTabletPadStripV2Resource::CTabletPadStripV2Resource(SP<CZwpTabletPadStripV2> resource_, uint32_t id_) : id(id_), resource(resource_) {
|
CTabletPadStripV2Resource::CTabletPadStripV2Resource(SP<CZwpTabletPadStripV2> resource_, uint32_t id_) : id(id_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::textInputV1->protoLog
|
|
||||||
|
|
||||||
CTextInputV1::~CTextInputV1() {
|
CTextInputV1::~CTextInputV1() {
|
||||||
events.destroy.emit();
|
events.destroy.emit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::textInputV3->protoLog
|
|
||||||
|
|
||||||
void CTextInputV3::SState::reset() {
|
void CTextInputV3::SState::reset() {
|
||||||
cause = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD;
|
cause = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD;
|
||||||
surrounding.updated = false;
|
surrounding.updated = false;
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define LOGM PROTO::toplevelExport->protoLog
|
|
||||||
|
|
||||||
CToplevelExportClient::CToplevelExportClient(SP<CHyprlandToplevelExportManagerV1> resource_) : resource(resource_) {
|
CToplevelExportClient::CToplevelExportClient(SP<CHyprlandToplevelExportManagerV1> resource_) : resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define LOGM PROTO::viewport->protoLog
|
|
||||||
|
|
||||||
CViewportResource::CViewportResource(SP<CWpViewport> resource_, SP<CWLSurfaceResource> surface_) : surface(surface_), resource(resource_) {
|
CViewportResource::CViewportResource(SP<CWpViewport> resource_, SP<CWLSurfaceResource> surface_) : surface(surface_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include "../devices/IKeyboard.hpp"
|
#include "../devices/IKeyboard.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::virtualKeyboard->protoLog
|
|
||||||
|
|
||||||
CVirtualKeyboardV1Resource::CVirtualKeyboardV1Resource(SP<CZwpVirtualKeyboardV1> resource_) : resource(resource_) {
|
CVirtualKeyboardV1Resource::CVirtualKeyboardV1Resource(SP<CZwpVirtualKeyboardV1> resource_) : resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include "VirtualPointer.hpp"
|
#include "VirtualPointer.hpp"
|
||||||
#include "core/Output.hpp"
|
#include "core/Output.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::virtualPointer->protoLog
|
|
||||||
|
|
||||||
CVirtualPointerV1Resource::CVirtualPointerV1Resource(SP<CZwlrVirtualPointerV1> resource_, WP<CMonitor> boundOutput_) : boundOutput(boundOutput_), resource(resource_) {
|
CVirtualPointerV1Resource::CVirtualPointerV1Resource(SP<CZwlrVirtualPointerV1> resource_, WP<CMonitor> boundOutput_) : boundOutput(boundOutput_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -21,7 +21,7 @@ IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, co
|
||||||
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) {
|
||||||
protoLog(ERR, "could not create a global");
|
LOGM(ERR, "could not create a global [{}]", m_szName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, co
|
||||||
m_liDisplayDestroy.parent = this;
|
m_liDisplayDestroy.parent = this;
|
||||||
wl_display_add_destroy_listener(g_pCompositor->m_sWLDisplay, &m_liDisplayDestroy.listener);
|
wl_display_add_destroy_listener(g_pCompositor->m_sWLDisplay, &m_liDisplayDestroy.listener);
|
||||||
|
|
||||||
protoLog(LOG, "Registered global");
|
LOGM(LOG, "Registered global [{}]", m_szName);
|
||||||
}
|
}
|
||||||
|
|
||||||
IWaylandProtocol::~IWaylandProtocol() {
|
IWaylandProtocol::~IWaylandProtocol() {
|
||||||
|
|
|
@ -11,6 +11,35 @@
|
||||||
|
|
||||||
#define PROTO NProtocols
|
#define PROTO NProtocols
|
||||||
|
|
||||||
|
#define EXTRACT_CLASS_NAME() \
|
||||||
|
[]() constexpr -> std::string_view { \
|
||||||
|
constexpr std::string_view prettyFunction = __PRETTY_FUNCTION__; \
|
||||||
|
constexpr size_t colons = prettyFunction.find("::"); \
|
||||||
|
if (colons != std::string_view::npos) { \
|
||||||
|
constexpr size_t begin = prettyFunction.substr(0, colons).rfind(' ') + 1; \
|
||||||
|
constexpr size_t end = colons - begin; \
|
||||||
|
return prettyFunction.substr(begin, end); \
|
||||||
|
} else { \
|
||||||
|
return "Global"; \
|
||||||
|
} \
|
||||||
|
}()
|
||||||
|
|
||||||
|
#define LOGM(level, ...) \
|
||||||
|
do { \
|
||||||
|
std::ostringstream oss; \
|
||||||
|
if (level == WARN || level == ERR || level == CRIT) { \
|
||||||
|
oss << "[" << __FILE__ << ":" << __LINE__ << "] "; \
|
||||||
|
} else if (level == LOG || level == INFO || level == TRACE) { \
|
||||||
|
oss << "[" << EXTRACT_CLASS_NAME() << "] "; \
|
||||||
|
} \
|
||||||
|
if constexpr (std::is_same_v<decltype(__VA_ARGS__), std::string>) { \
|
||||||
|
oss << __VA_ARGS__; \
|
||||||
|
Debug::log(level, oss.str()); \
|
||||||
|
} else { \
|
||||||
|
Debug::log(level, std::format("{}{}", oss.str(), std::format(__VA_ARGS__))); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
class IWaylandProtocol;
|
class IWaylandProtocol;
|
||||||
struct IWaylandProtocolDestroyWrapper {
|
struct IWaylandProtocolDestroyWrapper {
|
||||||
wl_listener listener;
|
wl_listener listener;
|
||||||
|
@ -27,11 +56,6 @@ 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...)));
|
|
||||||
};
|
|
||||||
|
|
||||||
IWaylandProtocolDestroyWrapper m_liDisplayDestroy;
|
IWaylandProtocolDestroyWrapper m_liDisplayDestroy;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define LOGM PROTO::activation->protoLog
|
|
||||||
|
|
||||||
CXDGActivationToken::CXDGActivationToken(SP<CXdgActivationTokenV1> resource_) : resource(resource_) {
|
CXDGActivationToken::CXDGActivationToken(SP<CXdgActivationTokenV1> resource_) : resource(resource_) {
|
||||||
if (!resource_->resource())
|
if (!resource_->resource())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#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;
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#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; });
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#define LOGM PROTO::xdgShell->protoLog
|
|
||||||
|
|
||||||
void SXDGPositionerState::setAnchor(xdgPositionerAnchor edges) {
|
void SXDGPositionerState::setAnchor(xdgPositionerAnchor edges) {
|
||||||
anchor.setTop(edges == XDG_POSITIONER_ANCHOR_TOP || edges == XDG_POSITIONER_ANCHOR_TOP_LEFT || edges == XDG_POSITIONER_ANCHOR_TOP_RIGHT);
|
anchor.setTop(edges == XDG_POSITIONER_ANCHOR_TOP || edges == XDG_POSITIONER_ANCHOR_TOP_LEFT || edges == XDG_POSITIONER_ANCHOR_TOP_RIGHT);
|
||||||
anchor.setLeft(edges == XDG_POSITIONER_ANCHOR_LEFT || edges == XDG_POSITIONER_ANCHOR_TOP_LEFT || edges == XDG_POSITIONER_ANCHOR_BOTTOM_LEFT);
|
anchor.setLeft(edges == XDG_POSITIONER_ANCHOR_LEFT || edges == XDG_POSITIONER_ANCHOR_TOP_LEFT || edges == XDG_POSITIONER_ANCHOR_BOTTOM_LEFT);
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include "core/Compositor.hpp"
|
#include "core/Compositor.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define LOGM PROTO::xwaylandShell->protoLog
|
|
||||||
|
|
||||||
CXWaylandSurfaceResource::CXWaylandSurfaceResource(SP<CXwaylandSurfaceV1> resource_, SP<CWLSurfaceResource> surface_) : surface(surface_), resource(resource_) {
|
CXWaylandSurfaceResource::CXWaylandSurfaceResource(SP<CXwaylandSurfaceV1> resource_, SP<CWLSurfaceResource> surface_) : surface(surface_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
#include "../../render/Renderer.hpp"
|
#include "../../render/Renderer.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#define LOGM PROTO::compositor->protoLog
|
|
||||||
|
|
||||||
class CDefaultSurfaceRole : public ISurfaceRole {
|
class CDefaultSurfaceRole : public ISurfaceRole {
|
||||||
public:
|
public:
|
||||||
virtual eSurfaceRole role() {
|
virtual eSurfaceRole role() {
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
#include "Seat.hpp"
|
#include "Seat.hpp"
|
||||||
#include "Compositor.hpp"
|
#include "Compositor.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::data->protoLog
|
|
||||||
|
|
||||||
CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataSource> source_) : source(source_), resource(resource_) {
|
CWLDataOfferResource::CWLDataOfferResource(SP<CWlDataOffer> resource_, SP<IDataSource> source_) : source(source_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#define LOGM PROTO::seat->protoLog
|
|
||||||
|
|
||||||
CWLTouchResource::CWLTouchResource(SP<CWlTouch> resource_, SP<CWLSeatResource> owner_) : owner(owner_), resource(resource_) {
|
CWLTouchResource::CWLTouchResource(SP<CWlTouch> resource_, SP<CWLSeatResource> owner_) : owner(owner_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "../../helpers/Format.hpp"
|
#include "../../helpers/Format.hpp"
|
||||||
|
|
||||||
#define LOGM PROTO::shm->protoLog
|
|
||||||
|
|
||||||
CWLSHMBuffer::CWLSHMBuffer(SP<CWLSHMPoolResource> pool_, uint32_t id, int32_t offset_, const Vector2D& size_, int32_t stride_, uint32_t fmt_) {
|
CWLSHMBuffer::CWLSHMBuffer(SP<CWLSHMPoolResource> pool_, uint32_t id, int32_t offset_, const Vector2D& size_, int32_t stride_, uint32_t fmt_) {
|
||||||
if (!pool_->pool->data)
|
if (!pool_->pool->data)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include "Compositor.hpp"
|
#include "Compositor.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define LOGM PROTO::subcompositor->protoLog
|
|
||||||
|
|
||||||
CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWLSurfaceResource> surface_, SP<CWLSurfaceResource> parent_) :
|
CWLSubsurfaceResource::CWLSubsurfaceResource(SP<CWlSubsurface> resource_, SP<CWLSurfaceResource> surface_, SP<CWLSurfaceResource> parent_) :
|
||||||
surface(surface_), parent(parent_), resource(resource_) {
|
surface(surface_), parent(parent_), resource(resource_) {
|
||||||
if (!good())
|
if (!good())
|
||||||
|
|
Loading…
Reference in a new issue