mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 07:05:58 +01:00
log signals
This commit is contained in:
parent
144a79ee00
commit
17e88bf059
11 changed files with 74 additions and 55 deletions
|
@ -97,23 +97,23 @@ CCompositor::~CCompositor() {
|
|||
}
|
||||
|
||||
void CCompositor::initAllSignals() {
|
||||
wl_signal_add(&m_sWLRBackend->events.new_output, &Events::listen_newOutput);
|
||||
wl_signal_add(&m_sWLRXDGShell->events.new_surface, &Events::listen_newXDGSurface);
|
||||
wl_signal_add(&m_sWLRCursor->events.motion, &Events::listen_mouseMove);
|
||||
wl_signal_add(&m_sWLRCursor->events.motion_absolute, &Events::listen_mouseMoveAbsolute);
|
||||
wl_signal_add(&m_sWLRCursor->events.button, &Events::listen_mouseButton);
|
||||
wl_signal_add(&m_sWLRCursor->events.axis, &Events::listen_mouseAxis);
|
||||
wl_signal_add(&m_sWLRCursor->events.frame, &Events::listen_mouseFrame);
|
||||
wl_signal_add(&m_sWLRBackend->events.new_input, &Events::listen_newInput);
|
||||
wl_signal_add(&m_sSeat.seat->events.request_set_cursor, &Events::listen_requestMouse);
|
||||
wl_signal_add(&m_sSeat.seat->events.request_set_selection, &Events::listen_requestSetSel);
|
||||
wl_signal_add(&m_sSeat.seat->events.request_start_drag, &Events::listen_requestDrag);
|
||||
wl_signal_add(&m_sWLRLayerShell->events.new_surface, &Events::listen_newLayerSurface);
|
||||
wl_signal_add(&m_sWLROutputLayout->events.change, &Events::listen_change);
|
||||
wl_signal_add(&m_sWLROutputMgr->events.apply, &Events::listen_outputMgrApply);
|
||||
wl_signal_add(&m_sWLROutputMgr->events.test, &Events::listen_outputMgrTest);
|
||||
wl_signal_add(&m_sWLRInhibitMgr->events.activate, &Events::listen_InhibitActivate);
|
||||
wl_signal_add(&m_sWLRInhibitMgr->events.deactivate, &Events::listen_InhibitDeactivate);
|
||||
addWLSignal(&m_sWLRBackend->events.new_output, &Events::listen_newOutput, m_sWLRBackend, "Backend");
|
||||
addWLSignal(&m_sWLRXDGShell->events.new_surface, &Events::listen_newXDGSurface, m_sWLRXDGShell, "XDG Shell");
|
||||
addWLSignal(&m_sWLRCursor->events.motion, &Events::listen_mouseMove, m_sWLRCursor, "WLRCursor");
|
||||
addWLSignal(&m_sWLRCursor->events.motion_absolute, &Events::listen_mouseMoveAbsolute, m_sWLRCursor, "WLRCursor");
|
||||
addWLSignal(&m_sWLRCursor->events.button, &Events::listen_mouseButton, m_sWLRCursor, "WLRCursor");
|
||||
addWLSignal(&m_sWLRCursor->events.axis, &Events::listen_mouseAxis, m_sWLRCursor, "WLRCursor");
|
||||
addWLSignal(&m_sWLRCursor->events.frame, &Events::listen_mouseFrame, m_sWLRCursor, "WLRCursor");
|
||||
addWLSignal(&m_sWLRBackend->events.new_input, &Events::listen_newInput, m_sWLRBackend, "Backend");
|
||||
addWLSignal(&m_sSeat.seat->events.request_set_cursor, &Events::listen_requestMouse, &m_sSeat, "Seat");
|
||||
addWLSignal(&m_sSeat.seat->events.request_set_selection, &Events::listen_requestSetSel, &m_sSeat, "Seat");
|
||||
addWLSignal(&m_sSeat.seat->events.request_start_drag, &Events::listen_requestDrag, &m_sSeat, "Seat");
|
||||
addWLSignal(&m_sWLRLayerShell->events.new_surface, &Events::listen_newLayerSurface, m_sWLRLayerShell, "LayerShell");
|
||||
addWLSignal(&m_sWLROutputLayout->events.change, &Events::listen_change, m_sWLROutputLayout, "OutputLayout");
|
||||
addWLSignal(&m_sWLROutputMgr->events.apply, &Events::listen_outputMgrApply, m_sWLROutputMgr, "OutputMgr");
|
||||
addWLSignal(&m_sWLROutputMgr->events.test, &Events::listen_outputMgrTest, m_sWLROutputMgr, "OutputMgr");
|
||||
addWLSignal(&m_sWLRInhibitMgr->events.activate, &Events::listen_InhibitActivate, m_sWLRInhibitMgr, "InhibitMgr");
|
||||
addWLSignal(&m_sWLRInhibitMgr->events.deactivate, &Events::listen_InhibitDeactivate, m_sWLRInhibitMgr, "InhibitMgr");
|
||||
}
|
||||
|
||||
void CCompositor::startCompositor() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "includes.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "helpers/MiscFunctions.hpp"
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define ISDEBUG true
|
||||
|
@ -26,10 +27,14 @@
|
|||
|
||||
#define HYPRATOM(name) {name, 0}
|
||||
|
||||
#ifndef __INTELLISENSE__
|
||||
#define RASSERT(expr, reason) \
|
||||
if (!expr) { \
|
||||
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", std::string(reason).c_str(), __LINE__, ([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \
|
||||
RIP("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \
|
||||
}
|
||||
#else
|
||||
#define RASSERT(expr, reason)
|
||||
#endif
|
||||
|
||||
#define ASSERT(expr) RASSERT(expr, "?")
|
|
@ -39,11 +39,11 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
|||
WLRLAYERSURFACE->output = g_pCompositor->m_lMonitors.front().output; // TODO: current mon
|
||||
}
|
||||
|
||||
wl_signal_add(&WLRLAYERSURFACE->surface->events.commit, &layerSurface->listen_commitLayerSurface);
|
||||
wl_signal_add(&WLRLAYERSURFACE->surface->events.destroy, &layerSurface->listen_destroyLayerSurface);
|
||||
wl_signal_add(&WLRLAYERSURFACE->events.map, &layerSurface->listen_mapLayerSurface);
|
||||
wl_signal_add(&WLRLAYERSURFACE->events.unmap, &layerSurface->listen_unmapLayerSurface);
|
||||
wl_signal_add(&WLRLAYERSURFACE->events.new_popup, &layerSurface->listen_newPopup);
|
||||
addWLSignal(&WLRLAYERSURFACE->surface->events.commit, &layerSurface->listen_commitLayerSurface, layerSurface, "layerSurface");
|
||||
addWLSignal(&WLRLAYERSURFACE->surface->events.destroy, &layerSurface->listen_destroyLayerSurface, layerSurface, "layerSurface");
|
||||
addWLSignal(&WLRLAYERSURFACE->events.map, &layerSurface->listen_mapLayerSurface, layerSurface, "layerSurface");
|
||||
addWLSignal(&WLRLAYERSURFACE->events.unmap, &layerSurface->listen_unmapLayerSurface, layerSurface, "layerSurface");
|
||||
addWLSignal(&WLRLAYERSURFACE->events.new_popup, &layerSurface->listen_newPopup, layerSurface, "layerSurface");
|
||||
|
||||
layerSurface->layerSurface = WLRLAYERSURFACE;
|
||||
layerSurface->layer = WLRLAYERSURFACE->current.layer;
|
||||
|
|
|
@ -79,8 +79,8 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
|||
g_pCompositor->m_lMonitors.push_back(newMonitor);
|
||||
//
|
||||
|
||||
wl_signal_add(&OUTPUT->events.frame, &g_pCompositor->m_lMonitors.back().listen_monitorFrame);
|
||||
wl_signal_add(&OUTPUT->events.destroy, &g_pCompositor->m_lMonitors.back().listen_monitorDestroy);
|
||||
addWLSignal(&OUTPUT->events.frame, &g_pCompositor->m_lMonitors.back().listen_monitorFrame, &g_pCompositor->m_lMonitors.back(), "Monitor");
|
||||
addWLSignal(&OUTPUT->events.destroy, &g_pCompositor->m_lMonitors.back().listen_monitorDestroy, &g_pCompositor->m_lMonitors.back(), "Monitor");
|
||||
|
||||
wlr_output_enable(OUTPUT, 1);
|
||||
if (!wlr_output_commit(OUTPUT)) {
|
||||
|
|
|
@ -48,10 +48,10 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) {
|
|||
pHyprPopup->listen_destroyPopupXDG.notify = Events::listener_destroyPopupXDG;
|
||||
pHyprPopup->listen_newPopupFromPopupXDG.notify = Events::listener_newPopupXDG;
|
||||
|
||||
wl_signal_add(&popup->base->events.map, &pHyprPopup->listen_mapPopupXDG);
|
||||
wl_signal_add(&popup->base->events.unmap, &pHyprPopup->listen_unmapPopupXDG);
|
||||
wl_signal_add(&popup->base->surface->events.destroy, &pHyprPopup->listen_destroyPopupXDG);
|
||||
wl_signal_add(&popup->base->events.new_popup, &pHyprPopup->listen_newPopupFromPopupXDG);
|
||||
addWLSignal(&popup->base->events.map, &pHyprPopup->listen_mapPopupXDG, pHyprPopup, "HyprPopup");
|
||||
addWLSignal(&popup->base->events.unmap, &pHyprPopup->listen_unmapPopupXDG, pHyprPopup, "HyprPopup");
|
||||
addWLSignal(&popup->base->surface->events.destroy, &pHyprPopup->listen_destroyPopupXDG, pHyprPopup, "HyprPopup");
|
||||
addWLSignal(&popup->base->events.new_popup, &pHyprPopup->listen_newPopupFromPopupXDG, pHyprPopup, "HyprPopup");
|
||||
|
||||
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@ void Events::listener_mapWindow(wl_listener* listener, void* data) {
|
|||
return;
|
||||
}
|
||||
|
||||
// wl_signal_add(&PWINDOWSURFACE->events.new_subsurface, &PWINDOW->listen_newSubsurfaceWindow);
|
||||
|
||||
if (g_pXWaylandManager->shouldBeFloated(PWINDOW))
|
||||
PWINDOW->m_bIsFloating = true;
|
||||
|
||||
|
@ -223,13 +221,13 @@ void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
|
|||
PNEWWINDOW->m_iX11Type = XWSURFACE->override_redirect ? 2 : 1;
|
||||
PNEWWINDOW->m_bIsX11 = true;
|
||||
|
||||
wl_signal_add(&XWSURFACE->events.map, &PNEWWINDOW->listen_mapWindow);
|
||||
wl_signal_add(&XWSURFACE->events.unmap, &PNEWWINDOW->listen_unmapWindow);
|
||||
wl_signal_add(&XWSURFACE->events.request_activate, &PNEWWINDOW->listen_activateX11);
|
||||
wl_signal_add(&XWSURFACE->events.request_configure, &PNEWWINDOW->listen_configureX11);
|
||||
wl_signal_add(&XWSURFACE->events.set_title, &PNEWWINDOW->listen_setTitleWindow);
|
||||
wl_signal_add(&XWSURFACE->events.destroy, &PNEWWINDOW->listen_destroyWindow);
|
||||
wl_signal_add(&XWSURFACE->events.request_fullscreen, &PNEWWINDOW->listen_fullscreenWindow);
|
||||
addWLSignal(&XWSURFACE->events.map, &PNEWWINDOW->listen_mapWindow, PNEWWINDOW, "XWayland Window");
|
||||
addWLSignal(&XWSURFACE->events.unmap, &PNEWWINDOW->listen_unmapWindow, PNEWWINDOW, "XWayland Window");
|
||||
addWLSignal(&XWSURFACE->events.request_activate, &PNEWWINDOW->listen_activateX11, PNEWWINDOW, "XWayland Window");
|
||||
addWLSignal(&XWSURFACE->events.request_configure, &PNEWWINDOW->listen_configureX11, PNEWWINDOW, "XWayland Window");
|
||||
addWLSignal(&XWSURFACE->events.set_title, &PNEWWINDOW->listen_setTitleWindow, PNEWWINDOW, "XWayland Window");
|
||||
addWLSignal(&XWSURFACE->events.destroy, &PNEWWINDOW->listen_destroyWindow, PNEWWINDOW, "XWayland Window");
|
||||
addWLSignal(&XWSURFACE->events.request_fullscreen, &PNEWWINDOW->listen_fullscreenWindow, PNEWWINDOW, "XWayland Window");
|
||||
}
|
||||
|
||||
void Events::listener_newXDGSurface(wl_listener* listener, void* data) {
|
||||
|
@ -245,11 +243,11 @@ void Events::listener_newXDGSurface(wl_listener* listener, void* data) {
|
|||
const auto PNEWWINDOW = &g_pCompositor->m_lWindows.back();
|
||||
PNEWWINDOW->m_uSurface.xdg = XDGSURFACE;
|
||||
|
||||
wl_signal_add(&XDGSURFACE->surface->events.commit, &PNEWWINDOW->listen_commitWindow);
|
||||
wl_signal_add(&XDGSURFACE->events.map, &PNEWWINDOW->listen_mapWindow);
|
||||
wl_signal_add(&XDGSURFACE->events.unmap, &PNEWWINDOW->listen_unmapWindow);
|
||||
wl_signal_add(&XDGSURFACE->events.destroy, &PNEWWINDOW->listen_destroyWindow);
|
||||
wl_signal_add(&XDGSURFACE->toplevel->events.set_title, &PNEWWINDOW->listen_setTitleWindow);
|
||||
wl_signal_add(&XDGSURFACE->toplevel->events.request_fullscreen, &PNEWWINDOW->listen_fullscreenWindow);
|
||||
wl_signal_add(&XDGSURFACE->events.new_popup, &PNEWWINDOW->listen_newPopupXDG);
|
||||
addWLSignal(&XDGSURFACE->surface->events.commit, &PNEWWINDOW->listen_commitWindow, PNEWWINDOW, "XDG Window");
|
||||
addWLSignal(&XDGSURFACE->events.map, &PNEWWINDOW->listen_mapWindow, PNEWWINDOW, "XDG Window");
|
||||
addWLSignal(&XDGSURFACE->events.unmap, &PNEWWINDOW->listen_unmapWindow, PNEWWINDOW, "XDG Window");
|
||||
addWLSignal(&XDGSURFACE->events.destroy, &PNEWWINDOW->listen_destroyWindow, PNEWWINDOW, "XDG Window");
|
||||
addWLSignal(&XDGSURFACE->toplevel->events.set_title, &PNEWWINDOW->listen_setTitleWindow, PNEWWINDOW, "XDG Window");
|
||||
addWLSignal(&XDGSURFACE->toplevel->events.request_fullscreen, &PNEWWINDOW->listen_fullscreenWindow, PNEWWINDOW, "XDG Window");
|
||||
addWLSignal(&XDGSURFACE->events.new_popup, &PNEWWINDOW->listen_newPopupXDG, PNEWWINDOW, "XDG Window");
|
||||
}
|
||||
|
|
11
src/helpers/MiscFunctions.cpp
Normal file
11
src/helpers/MiscFunctions.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include "MiscFunctions.hpp"
|
||||
#include "../defines.hpp"
|
||||
|
||||
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
|
||||
ASSERT(pSignal);
|
||||
ASSERT(pListener);
|
||||
|
||||
wl_signal_add(pSignal, pListener);
|
||||
|
||||
Debug::log(LOG, "Registered signal for owner %x: %x -> %x (owner: %s)", pOwner, pSignal, pListener, ownerString.c_str());
|
||||
}
|
5
src/helpers/MiscFunctions.hpp
Normal file
5
src/helpers/MiscFunctions.hpp
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include "../includes.hpp"
|
||||
|
||||
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, std::string ownerString);
|
|
@ -30,9 +30,9 @@ SSurfaceTreeNode* createTree(wlr_surface* pSurface) {
|
|||
PNODE->listen_commit.notify = Events::listener_commitSubsurface;
|
||||
PNODE->listen_destroy.notify = Events::listener_destroySubsurfaceNode;
|
||||
|
||||
wl_signal_add(&pSurface->events.commit, &PNODE->listen_commit);
|
||||
wl_signal_add(&pSurface->events.destroy, &PNODE->listen_destroy);
|
||||
wl_signal_add(&pSurface->events.new_subsurface, &PNODE->listen_newSubsurface);
|
||||
addWLSignal(&pSurface->events.commit, &PNODE->listen_commit, PNODE, "SurfaceTreeNode");
|
||||
addWLSignal(&pSurface->events.destroy, &PNODE->listen_destroy, PNODE, "SurfaceTreeNode");
|
||||
addWLSignal(&pSurface->events.new_subsurface, &PNODE->listen_newSubsurface, PNODE, "SurfaceTreeNode");
|
||||
|
||||
return PNODE;
|
||||
}
|
||||
|
@ -110,9 +110,9 @@ void Events::listener_newSubsurfaceNode(wl_listener* listener, void* data) {
|
|||
PNEWSUBSURFACE->listen_unmap.notify = Events::listener_unmapSubsurface;
|
||||
PNEWSUBSURFACE->listen_destroy.notify = Events::listener_destroySubsurface;
|
||||
|
||||
wl_signal_add(&PSUBSURFACE->events.map, &PNEWSUBSURFACE->listen_map);
|
||||
wl_signal_add(&PSUBSURFACE->events.unmap, &PNEWSUBSURFACE->listen_unmap);
|
||||
wl_signal_add(&PSUBSURFACE->events.destroy, &PNEWSUBSURFACE->listen_destroy);
|
||||
addWLSignal(&PSUBSURFACE->events.map, &PNEWSUBSURFACE->listen_map, PNEWSUBSURFACE, "Subsurface");
|
||||
addWLSignal(&PSUBSURFACE->events.unmap, &PNEWSUBSURFACE->listen_unmap, PNEWSUBSURFACE, "Subsurface");
|
||||
addWLSignal(&PSUBSURFACE->events.destroy, &PNEWSUBSURFACE->listen_destroy, PNEWSUBSURFACE, "Subsurface");
|
||||
}
|
||||
|
||||
void Events::listener_mapSubsurface(wl_listener* listener, void* data) {
|
||||
|
|
|
@ -137,9 +137,9 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
|
|||
xkb_context_unref(CONTEXT);
|
||||
wlr_keyboard_set_repeat_info(keyboard->keyboard, 25, 600);
|
||||
|
||||
wl_signal_add(&keyboard->keyboard->events.modifiers, &PNEWKEYBOARD->listen_keyboardMod);
|
||||
wl_signal_add(&keyboard->keyboard->events.key, &PNEWKEYBOARD->listen_keyboardKey);
|
||||
wl_signal_add(&keyboard->events.destroy, &PNEWKEYBOARD->listen_keyboardDestroy);
|
||||
addWLSignal(&keyboard->keyboard->events.modifiers, &PNEWKEYBOARD->listen_keyboardMod, PNEWKEYBOARD, "Keyboard");
|
||||
addWLSignal(&keyboard->keyboard->events.key, &PNEWKEYBOARD->listen_keyboardKey, PNEWKEYBOARD, "Keyboard");
|
||||
addWLSignal(&keyboard->events.destroy, &PNEWKEYBOARD->listen_keyboardDestroy, PNEWKEYBOARD, "Keyboard");
|
||||
|
||||
wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, keyboard->keyboard);
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ CHyprXWaylandManager::CHyprXWaylandManager() {
|
|||
return;
|
||||
}
|
||||
|
||||
wl_signal_add(&m_sWLRXWayland->events.ready, &Events::listen_readyXWayland);
|
||||
wl_signal_add(&m_sWLRXWayland->events.new_surface, &Events::listen_surfaceXWayland);
|
||||
addWLSignal(&m_sWLRXWayland->events.ready, &Events::listen_readyXWayland, m_sWLRXWayland, "XWayland Manager");
|
||||
addWLSignal(&m_sWLRXWayland->events.new_surface, &Events::listen_surfaceXWayland, m_sWLRXWayland, "XWayland Manager");
|
||||
|
||||
setenv("DISPLAY", m_sWLRXWayland->display_name, 1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue