fixed some oopsies

This commit is contained in:
vaxerski 2022-03-19 13:54:24 +01:00
parent d615033526
commit 5ea20cd041
3 changed files with 15 additions and 5 deletions

View file

@ -53,6 +53,14 @@ CCompositor::CCompositor() {
m_sWLRPresentation = wlr_presentation_create(m_sWLDisplay, m_sWLRBackend); m_sWLRPresentation = wlr_presentation_create(m_sWLDisplay, m_sWLRBackend);
m_sWLRIdle = wlr_idle_create(m_sWLDisplay); m_sWLRIdle = wlr_idle_create(m_sWLDisplay);
m_sWLRLayerShell = wlr_layer_shell_v1_create(m_sWLDisplay);
wlr_server_decoration_manager_set_default_mode(wlr_server_decoration_manager_create(m_sWLDisplay), WLR_SERVER_DECORATION_MANAGER_MODE_SERVER);
wlr_xdg_decoration_manager_v1_create(m_sWLDisplay);
wlr_xdg_output_manager_v1_create(m_sWLDisplay, m_sWLROutputLayout);
m_sWLROutputMgr = wlr_output_manager_v1_create(m_sWLDisplay);
} }
CCompositor::~CCompositor() { CCompositor::~CCompositor() {
@ -70,6 +78,8 @@ void CCompositor::initAllSignals() {
wl_signal_add(&m_sWLRBackend->events.new_input, &Events::listen_newInput); wl_signal_add(&m_sWLRBackend->events.new_input, &Events::listen_newInput);
wl_signal_add(&m_sWLRSeat->events.request_set_cursor, &Events::listen_requestMouse); wl_signal_add(&m_sWLRSeat->events.request_set_cursor, &Events::listen_requestMouse);
wl_signal_add(&m_sWLRSeat->events.request_set_selection, &Events::listen_requestSetSel); wl_signal_add(&m_sWLRSeat->events.request_set_selection, &Events::listen_requestSetSel);
wl_signal_add(&m_sWLRLayerShell->events.new_surface, &Events::listen_newLayerSurface);
wl_signal_add(&m_sWLROutputLayout->events.change, &Events::listen_change);
} }
void CCompositor::startCompositor() { void CCompositor::startCompositor() {

View file

@ -120,7 +120,7 @@ void Events::listener_monitorDestroy(wl_listener* listener, void* data) {
void Events::listener_newLayerSurface(wl_listener* listener, void* data) { void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
const auto WLRLAYERSURFACE = (wlr_layer_surface_v1*)data; const auto WLRLAYERSURFACE = (wlr_layer_surface_v1*)data;
const auto PMONITOR = (SMonitor*)WLRLAYERSURFACE->output->data; const auto PMONITOR = (SMonitor*)(WLRLAYERSURFACE->output->data ? WLRLAYERSURFACE->output->data : g_pCompositor->getMonitorFromCursor());
PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].push_back(SLayerSurface()); PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].push_back(SLayerSurface());
SLayerSurface* layerSurface = &PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].back(); SLayerSurface* layerSurface = &PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].back();
@ -147,7 +147,7 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
if (layersurface->layerSurface->mapped) if (layersurface->layerSurface->mapped)
layersurface->layerSurface->mapped = 0; layersurface->layerSurface->mapped = 0;
wl_list_remove(&layersurface->link);
wl_list_remove(&layersurface->listen_destroyLayerSurface.link); wl_list_remove(&layersurface->listen_destroyLayerSurface.link);
wl_list_remove(&layersurface->listen_mapLayerSurface.link); wl_list_remove(&layersurface->listen_mapLayerSurface.link);
wl_list_remove(&layersurface->listen_unmapLayerSurface.link); wl_list_remove(&layersurface->listen_unmapLayerSurface.link);
@ -160,8 +160,7 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
// remove the layersurface as it's not used anymore // remove the layersurface as it's not used anymore
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->pending.layer].remove(*layersurface); PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->pending.layer].remove(*layersurface);
free(layersurface);
Debug::log(LOG, "LayerSurface %x destroyed", layersurface); Debug::log(LOG, "LayerSurface %x destroyed", layersurface);
} }

View file

@ -4,6 +4,7 @@
#include <deque> #include <deque>
#include "WLClasses.hpp" #include "WLClasses.hpp"
#include <list> #include <list>
#include <array>
struct SMonitor { struct SMonitor {
Vector2D vecPosition = Vector2D(0,0); Vector2D vecPosition = Vector2D(0,0);
@ -22,7 +23,7 @@ struct SMonitor {
wlr_output* output = nullptr; wlr_output* output = nullptr;
// Double-linked list because we need to have constant mem addresses for signals // Double-linked list because we need to have constant mem addresses for signals
std::array<std::list<SLayerSurface>,4> m_aLayerSurfaceLists; std::array<std::list<SLayerSurface>, 4> m_aLayerSurfaceLists;
DYNLISTENER(monitorFrame); DYNLISTENER(monitorFrame);
DYNLISTENER(monitorDestroy); DYNLISTENER(monitorDestroy);