mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-17 06:06:01 +01:00
internal: nuke wlsignal and related
old semi-wrappers for wl_signal, they are no longer used
This commit is contained in:
parent
508bde1f61
commit
f79497087b
17 changed files with 1 additions and 128 deletions
|
@ -1,6 +1,5 @@
|
||||||
#include "includes.hpp"
|
#include "includes.hpp"
|
||||||
#include "debug/Log.hpp"
|
#include "debug/Log.hpp"
|
||||||
#include "helpers/WLListener.hpp"
|
|
||||||
#include "helpers/Color.hpp"
|
#include "helpers/Color.hpp"
|
||||||
#include "macros.hpp"
|
#include "macros.hpp"
|
||||||
#include "desktop/DesktopTypes.hpp"
|
#include "desktop/DesktopTypes.hpp"
|
||||||
|
|
|
@ -30,13 +30,7 @@ CSubsurface::CSubsurface(SP<CWLSubsurfaceResource> pSubsurface, CPopup* pOwner)
|
||||||
}
|
}
|
||||||
|
|
||||||
CSubsurface::~CSubsurface() {
|
CSubsurface::~CSubsurface() {
|
||||||
hyprListener_newSubsurface.removeCallback();
|
;
|
||||||
|
|
||||||
if (!m_pSubsurface)
|
|
||||||
return;
|
|
||||||
|
|
||||||
hyprListener_commitSubsurface.removeCallback();
|
|
||||||
hyprListener_destroySubsurface.removeCallback();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSubsurface::initSignals() {
|
void CSubsurface::initSignals() {
|
||||||
|
|
|
@ -35,10 +35,6 @@ class CSubsurface {
|
||||||
void recheckDamageForSubsurfaces();
|
void recheckDamageForSubsurfaces();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DYNLISTENER(destroySubsurface);
|
|
||||||
DYNLISTENER(commitSubsurface);
|
|
||||||
DYNLISTENER(newSubsurface);
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
CHyprSignalListener destroySubsurface;
|
CHyprSignalListener destroySubsurface;
|
||||||
CHyprSignalListener commitSubsurface;
|
CHyprSignalListener commitSubsurface;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "IHID.hpp"
|
#include "IHID.hpp"
|
||||||
#include "../helpers/WLListener.hpp"
|
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "IHID.hpp"
|
#include "IHID.hpp"
|
||||||
#include "../helpers/WLListener.hpp"
|
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "IHID.hpp"
|
#include "IHID.hpp"
|
||||||
#include "../helpers/WLListener.hpp"
|
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "IHID.hpp"
|
#include "IHID.hpp"
|
||||||
#include "../helpers/WLListener.hpp"
|
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
#include "WLListener.hpp"
|
|
||||||
#include "MiscFunctions.hpp"
|
|
||||||
#include <string>
|
|
||||||
#include "../debug/Log.hpp"
|
|
||||||
#include "Watchdog.hpp"
|
|
||||||
|
|
||||||
void handleWrapped(wl_listener* listener, void* data) {
|
|
||||||
CHyprWLListener::SWrapper* pWrap = wl_container_of(listener, pWrap, m_sListener);
|
|
||||||
|
|
||||||
if (g_pWatchdog)
|
|
||||||
g_pWatchdog->startWatching();
|
|
||||||
|
|
||||||
try {
|
|
||||||
pWrap->m_pSelf->emit(data);
|
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "Listener {} threw or timed out and was killed by Watchdog!!! This is bad. what(): {}", (uintptr_t)listener, e.what()); }
|
|
||||||
|
|
||||||
if (g_pWatchdog)
|
|
||||||
g_pWatchdog->endWatching();
|
|
||||||
}
|
|
||||||
|
|
||||||
CHyprWLListener::CHyprWLListener(wl_signal* pSignal, std::function<void(void*, void*)> const& callback, void* pOwner) {
|
|
||||||
initCallback(pSignal, callback, pOwner);
|
|
||||||
}
|
|
||||||
|
|
||||||
CHyprWLListener::CHyprWLListener() {
|
|
||||||
m_swWrapper.m_pSelf = this;
|
|
||||||
m_swWrapper.m_sListener.notify = &handleWrapped;
|
|
||||||
wl_list_init(&m_swWrapper.m_sListener.link);
|
|
||||||
}
|
|
||||||
|
|
||||||
CHyprWLListener::~CHyprWLListener() {
|
|
||||||
removeCallback();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CHyprWLListener::removeCallback() {
|
|
||||||
if (isConnected()) {
|
|
||||||
Debug::log(LOG, "Callback {:x} -> {:x}, {} removed.", (uintptr_t)&m_pCallback, (uintptr_t)&m_pOwner, m_szAuthor);
|
|
||||||
wl_list_remove(&m_swWrapper.m_sListener.link);
|
|
||||||
wl_list_init(&m_swWrapper.m_sListener.link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CHyprWLListener::isConnected() {
|
|
||||||
return !wl_list_empty(&m_swWrapper.m_sListener.link);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CHyprWLListener::initCallback(wl_signal* pSignal, std::function<void(void*, void*)> const& callback, void* pOwner, std::string author) {
|
|
||||||
if (isConnected()) {
|
|
||||||
Debug::log(ERR, "Tried to connect a listener twice?!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pOwner = pOwner;
|
|
||||||
m_pCallback = callback;
|
|
||||||
m_szAuthor = author;
|
|
||||||
|
|
||||||
addWLSignal(pSignal, &m_swWrapper.m_sListener, pOwner, m_szAuthor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CHyprWLListener::emit(void* data) {
|
|
||||||
m_pCallback(m_pOwner, data);
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <functional>
|
|
||||||
#include <wayland-server.h>
|
|
||||||
|
|
||||||
class CHyprWLListener {
|
|
||||||
public:
|
|
||||||
CHyprWLListener(wl_signal*, std::function<void(void*, void*)> const&, void* owner);
|
|
||||||
CHyprWLListener();
|
|
||||||
~CHyprWLListener();
|
|
||||||
|
|
||||||
CHyprWLListener(const CHyprWLListener&) = delete;
|
|
||||||
CHyprWLListener(CHyprWLListener&&) = delete;
|
|
||||||
CHyprWLListener& operator=(const CHyprWLListener&) = delete;
|
|
||||||
CHyprWLListener& operator=(CHyprWLListener&&) = delete;
|
|
||||||
|
|
||||||
void initCallback(wl_signal*, std::function<void(void*, void*)> const&, void* owner, std::string author = "");
|
|
||||||
|
|
||||||
void removeCallback();
|
|
||||||
|
|
||||||
bool isConnected();
|
|
||||||
|
|
||||||
struct SWrapper {
|
|
||||||
wl_listener m_sListener;
|
|
||||||
CHyprWLListener* m_pSelf;
|
|
||||||
};
|
|
||||||
|
|
||||||
void emit(void*);
|
|
||||||
|
|
||||||
private:
|
|
||||||
SWrapper m_swWrapper;
|
|
||||||
|
|
||||||
void* m_pOwner = nullptr;
|
|
||||||
|
|
||||||
std::function<void(void*, void*)> m_pCallback = nullptr;
|
|
||||||
|
|
||||||
std::string m_szAuthor = "";
|
|
||||||
};
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <wayland-server-protocol.h>
|
#include <wayland-server-protocol.h>
|
||||||
#include "../helpers/WLListener.hpp"
|
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
#include "../helpers/signal/Signal.hpp"
|
#include "../helpers/signal/Signal.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../helpers/WLListener.hpp"
|
|
||||||
#include "../../desktop/WLSurface.hpp"
|
#include "../../desktop/WLSurface.hpp"
|
||||||
#include "../../macros.hpp"
|
#include "../../macros.hpp"
|
||||||
#include "../../helpers/math/Math.hpp"
|
#include "../../helpers/math/Math.hpp"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../helpers/WLListener.hpp"
|
|
||||||
#include "../../macros.hpp"
|
#include "../../macros.hpp"
|
||||||
#include "../../helpers/math/Math.hpp"
|
#include "../../helpers/math/Math.hpp"
|
||||||
#include "../../helpers/signal/Signal.hpp"
|
#include "../../helpers/signal/Signal.hpp"
|
||||||
|
|
|
@ -53,9 +53,6 @@ class CFocusGrab {
|
||||||
|
|
||||||
bool m_bGrabActive = false;
|
bool m_bGrabActive = false;
|
||||||
|
|
||||||
DYNLISTENER(pointerGrabStarted);
|
|
||||||
DYNLISTENER(keyboardGrabStarted);
|
|
||||||
DYNLISTENER(touchGrabStarted);
|
|
||||||
friend class CFocusGrabSurfaceState;
|
friend class CFocusGrabSurfaceState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@ class CQueuedPresentationData {
|
||||||
WP<CMonitor> pMonitor;
|
WP<CMonitor> pMonitor;
|
||||||
WP<CWLSurfaceResource> surface;
|
WP<CWLSurfaceResource> surface;
|
||||||
|
|
||||||
DYNLISTENER(destroySurface);
|
|
||||||
|
|
||||||
friend class CPresentationFeedback;
|
friend class CPresentationFeedback;
|
||||||
friend class CPresentationProtocol;
|
friend class CPresentationProtocol;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include "../helpers/signal/Signal.hpp"
|
#include "../helpers/signal/Signal.hpp"
|
||||||
#include "../helpers/memory/Memory.hpp"
|
#include "../helpers/memory/Memory.hpp"
|
||||||
#include "../helpers/WLListener.hpp"
|
|
||||||
#include "Framebuffer.hpp"
|
#include "Framebuffer.hpp"
|
||||||
#include <aquamarine/buffer/Buffer.hpp>
|
#include <aquamarine/buffer/Buffer.hpp>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../helpers/WLListener.hpp"
|
|
||||||
#include "../helpers/signal/Signal.hpp"
|
#include "../helpers/signal/Signal.hpp"
|
||||||
#include "../helpers/memory/Memory.hpp"
|
#include "../helpers/memory/Memory.hpp"
|
||||||
#include "../helpers/math/Math.hpp"
|
#include "../helpers/math/Math.hpp"
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
#include "XDataSource.hpp"
|
#include "XDataSource.hpp"
|
||||||
#include "../helpers/WLListener.hpp"
|
|
||||||
#include "../helpers/memory/Memory.hpp"
|
#include "../helpers/memory/Memory.hpp"
|
||||||
#include "../helpers/signal/Signal.hpp"
|
#include "../helpers/signal/Signal.hpp"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue