compositor: refactor class member vars (#10141)
This commit is contained in:
parent
3577a6be31
commit
241a4935a2
68 changed files with 751 additions and 756 deletions
|
|
@ -51,7 +51,7 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlM
|
|||
|
||||
LOGM(LOG, "Committing ctms to outputs");
|
||||
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto& m : g_pCompositor->m_monitors) {
|
||||
if (!ctms.contains(m->szName)) {
|
||||
PROTO::ctm->setCTM(m, Mat3x3::identity());
|
||||
continue;
|
||||
|
|
@ -73,7 +73,7 @@ CHyprlandCTMControlResource::~CHyprlandCTMControlResource() {
|
|||
if (blocked)
|
||||
return;
|
||||
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto& m : g_pCompositor->m_monitors) {
|
||||
PROTO::ctm->setCTM(m, Mat3x3::identity());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ CDRMLeaseDevice::CDRMLeaseDevice(SP<Aquamarine::CDRMBackend> drmBackend) : backe
|
|||
}
|
||||
|
||||
CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) {
|
||||
for (auto const& b : g_pCompositor->m_aqBackend->getImplementations()) {
|
||||
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ bool CDRMSyncobjManagerResource::good() {
|
|||
return resource->resource();
|
||||
}
|
||||
|
||||
CDRMSyncobjProtocol::CDRMSyncobjProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name), drmFD(g_pCompositor->m_iDRMFD) {}
|
||||
CDRMSyncobjProtocol::CDRMSyncobjProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name), drmFD(g_pCompositor->m_drmFD) {}
|
||||
|
||||
void CDRMSyncobjProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||
const auto& RESOURCE = m_vManagers.emplace_back(makeUnique<CDRMSyncobjManagerResource>(makeUnique<CWpLinuxDrmSyncobjManagerV1>(client, ver, id)));
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc
|
|||
LOGM(LOG, "CForeignToplevelList: finished");
|
||||
});
|
||||
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (!PROTO::foreignToplevel->windowValidForForeign(w))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ void CForeignToplevelHandleWlr::sendState() {
|
|||
wl_array state;
|
||||
wl_array_init(&state);
|
||||
|
||||
if (PWINDOW == g_pCompositor->m_pLastWindow) {
|
||||
if (PWINDOW == g_pCompositor->m_lastWindow) {
|
||||
auto p = (uint32_t*)wl_array_add(&state, sizeof(uint32_t));
|
||||
*p = ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED;
|
||||
}
|
||||
|
|
@ -205,14 +205,14 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa
|
|||
PROTO::foreignToplevelWlr->onManagerResourceDestroy(this);
|
||||
});
|
||||
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (!PROTO::foreignToplevelWlr->windowValidForForeign(w))
|
||||
continue;
|
||||
|
||||
onMap(w);
|
||||
}
|
||||
|
||||
lastFocus = g_pCompositor->m_pLastWindow;
|
||||
lastFocus = g_pCompositor->m_lastWindow;
|
||||
}
|
||||
|
||||
void CForeignToplevelWlrManager::onMap(PHLWINDOW pWindow) {
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ CInputMethodPopupV2::CInputMethodPopupV2(SP<CZwpInputPopupSurfaceV2> resource_,
|
|||
listeners.destroySurface.reset();
|
||||
listeners.commitSurface.reset();
|
||||
|
||||
if (g_pCompositor->m_pLastFocus == pSurface)
|
||||
g_pCompositor->m_pLastFocus.reset();
|
||||
if (g_pCompositor->m_lastFocus == pSurface)
|
||||
g_pCompositor->m_lastFocus.reset();
|
||||
|
||||
pSurface.reset();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ void CLayerShellResource::sendClosed() {
|
|||
void CLayerShellResource::configure(const Vector2D& size_) {
|
||||
size = size_;
|
||||
|
||||
auto serial = wl_display_next_serial(g_pCompositor->m_sWLDisplay);
|
||||
auto serial = wl_display_next_serial(g_pCompositor->m_wlDisplay);
|
||||
|
||||
serials.push_back({serial, size_});
|
||||
|
||||
|
|
@ -247,7 +247,7 @@ void CLayerShellProtocol::onGetLayerSurface(CZwlrLayerShellV1* pMgr, uint32_t id
|
|||
}
|
||||
|
||||
SURF->role = makeShared<CLayerShellRole>(RESOURCE);
|
||||
g_pCompositor->m_vLayers.emplace_back(CLayerSurface::create(RESOURCE));
|
||||
g_pCompositor->m_layers.emplace_back(CLayerSurface::create(RESOURCE));
|
||||
|
||||
LOGM(LOG, "New wlr_layer_surface {:x}", (uintptr_t)RESOURCE.get());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ void CLinuxDMABUFResource::sendMods() {
|
|||
|
||||
CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
static auto P = g_pHookSystem->hookDynamic("ready", [this](void* self, SCallbackInfo& info, std::any d) {
|
||||
int rendererFD = g_pCompositor->m_iDRMFD;
|
||||
int rendererFD = g_pCompositor->m_drmFD;
|
||||
auto dev = devIDFromFD(rendererFD);
|
||||
|
||||
if (!dev.has_value()) {
|
||||
|
|
@ -428,11 +428,11 @@ CLinuxDMABufV1Protocol::CLinuxDMABufV1Protocol(const wl_interface* iface, const
|
|||
|
||||
std::vector<std::pair<PHLMONITORREF, SDMABUFTranche>> tches;
|
||||
|
||||
if (g_pCompositor->m_pAqBackend->hasSession()) {
|
||||
if (g_pCompositor->m_aqBackend->hasSession()) {
|
||||
// this assumes there's only 1 device used for both scanout and rendering
|
||||
// also that each monitor never changes its primary plane
|
||||
|
||||
for (auto const& mon : g_pCompositor->m_vMonitors) {
|
||||
for (auto const& mon : g_pCompositor->m_monitors) {
|
||||
auto tranche = SDMABUFTranche{
|
||||
.device = mainDevice,
|
||||
.flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT,
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ bool CMesaDRMResource::good() {
|
|||
|
||||
CMesaDRMProtocol::CMesaDRMProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||
drmDevice* dev = nullptr;
|
||||
int drmFD = g_pCompositor->m_iDRMFD;
|
||||
int drmFD = g_pCompositor->m_drmFD;
|
||||
if (drmGetDevice2(drmFD, 0, &dev) != 0) {
|
||||
LOGM(ERR, "Failed to get device, disabling MesaDRM");
|
||||
removeGlobal();
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ COutputManager::COutputManager(SP<CZwlrOutputManagerV1> resource_) : resource(re
|
|||
});
|
||||
|
||||
// send all heads at start
|
||||
for (auto const& m : g_pCompositor->m_vRealMonitors) {
|
||||
if (m == g_pCompositor->m_pUnsafeOutput)
|
||||
for (auto const& m : g_pCompositor->m_realMonitors) {
|
||||
if (m == g_pCompositor->m_unsafeOutput)
|
||||
continue;
|
||||
|
||||
LOGM(LOG, " | sending output head for {}", m->szName);
|
||||
|
|
@ -67,7 +67,7 @@ void COutputManager::makeAndSendNewHead(PHLMONITOR pMonitor) {
|
|||
}
|
||||
|
||||
void COutputManager::ensureMonitorSent(PHLMONITOR pMonitor) {
|
||||
if (pMonitor == g_pCompositor->m_pUnsafeOutput)
|
||||
if (pMonitor == g_pCompositor->m_unsafeOutput)
|
||||
return;
|
||||
|
||||
for (auto const& hw : heads) {
|
||||
|
|
@ -86,7 +86,7 @@ void COutputManager::ensureMonitorSent(PHLMONITOR pMonitor) {
|
|||
}
|
||||
|
||||
void COutputManager::sendDone() {
|
||||
resource->sendDone(wl_display_next_serial(g_pCompositor->m_sWLDisplay));
|
||||
resource->sendDone(wl_display_next_serial(g_pCompositor->m_wlDisplay));
|
||||
}
|
||||
|
||||
COutputHead::COutputHead(SP<CZwlrOutputHeadV1> resource_, PHLMONITOR pMonitor_) : resource(resource_), pMonitor(pMonitor_) {
|
||||
|
|
@ -611,7 +611,7 @@ void COutputManagementProtocol::destroyResource(COutputConfigurationHead* resour
|
|||
}
|
||||
|
||||
void COutputManagementProtocol::updateAllOutputs() {
|
||||
for (auto const& m : g_pCompositor->m_vRealMonitors) {
|
||||
for (auto const& m : g_pCompositor->m_realMonitors) {
|
||||
for (auto const& mgr : m_vManagers) {
|
||||
mgr->ensureMonitorSent(m);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ void CPointerConstraintsProtocol::onNewConstraint(SP<CPointerConstraint> constra
|
|||
|
||||
g_pInputManager->m_vConstraints.emplace_back(constraint);
|
||||
|
||||
if (g_pCompositor->m_pLastFocus == OWNER->resource())
|
||||
if (g_pCompositor->m_lastFocus == OWNER->resource())
|
||||
constraint->activate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ void CScreencopyFrame::copy(CZwlrScreencopyFrameV1* pFrame, wl_resource* buffer_
|
|||
lockedSWCursors = true;
|
||||
// TODO: make it per-monitor
|
||||
if (!PROTO::screencopy->m_bTimerArmed) {
|
||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto const& m : g_pCompositor->m_monitors) {
|
||||
g_pPointerManager->lockSoftwareForMonitor(m);
|
||||
}
|
||||
PROTO::screencopy->m_bTimerArmed = true;
|
||||
|
|
@ -402,7 +402,7 @@ CScreencopyProtocol::CScreencopyProtocol(const wl_interface* iface, const int& v
|
|||
std::nullopt,
|
||||
[this](SP<CEventLoopTimer> self, void* data) {
|
||||
// TODO: make it per-monitor
|
||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto const& m : g_pCompositor->m_monitors) {
|
||||
g_pPointerManager->unlockSoftwareForMonitor(m);
|
||||
}
|
||||
m_bTimerArmed = false;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ static void onSecurityContextClientDestroy(wl_listener* l, void* d) {
|
|||
}
|
||||
|
||||
CSecurityContextSandboxedClient::CSecurityContextSandboxedClient(CFileDescriptor clientFD_) : clientFD(std::move(clientFD_)) {
|
||||
client = wl_client_create(g_pCompositor->m_sWLDisplay, clientFD.get());
|
||||
client = wl_client_create(g_pCompositor->m_wlDisplay, clientFD.get());
|
||||
if (!client)
|
||||
return;
|
||||
|
||||
|
|
@ -113,8 +113,8 @@ CSecurityContext::CSecurityContext(SP<CWpSecurityContextV1> resource_, int liste
|
|||
|
||||
LOGM(LOG, "security_context at 0x{:x} commits", (uintptr_t)this);
|
||||
|
||||
listenSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, listenFD.get(), WL_EVENT_READABLE, ::onListenFdEvent, this);
|
||||
closeSource = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, closeFD.get(), 0, ::onCloseFdEvent, this);
|
||||
listenSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, listenFD.get(), WL_EVENT_READABLE, ::onListenFdEvent, this);
|
||||
closeSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, closeFD.get(), 0, ::onCloseFdEvent, this);
|
||||
|
||||
if (!listenSource || !closeSource) {
|
||||
r->noMemory();
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ CSessionLockSurface::CSessionLockSurface(SP<CExtSessionLockSurfaceV1> resource_,
|
|||
pSurface->unmap();
|
||||
listeners.surfaceCommit.reset();
|
||||
listeners.surfaceDestroy.reset();
|
||||
if (g_pCompositor->m_pLastFocus == pSurface)
|
||||
g_pCompositor->m_pLastFocus.reset();
|
||||
if (g_pCompositor->m_lastFocus == pSurface)
|
||||
g_pCompositor->m_lastFocus.reset();
|
||||
|
||||
pSurface.reset();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -68,14 +68,14 @@ void CKeyboardShortcutsInhibitProtocol::onInhibit(CZwpKeyboardShortcutsInhibitMa
|
|||
}
|
||||
|
||||
bool CKeyboardShortcutsInhibitProtocol::isInhibited() {
|
||||
if (!g_pCompositor->m_pLastFocus)
|
||||
if (!g_pCompositor->m_lastFocus)
|
||||
return false;
|
||||
|
||||
if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus.lock()); PWINDOW && PWINDOW->m_sWindowData.noShortcutsInhibit.valueOrDefault())
|
||||
if (const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock()); PWINDOW && PWINDOW->m_sWindowData.noShortcutsInhibit.valueOrDefault())
|
||||
return false;
|
||||
|
||||
for (auto const& in : m_vInhibitors) {
|
||||
if (in->surface() != g_pCompositor->m_pLastFocus)
|
||||
if (in->surface() != g_pCompositor->m_lastFocus)
|
||||
continue;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ void CTabletToolV2Resource::queueFrame() {
|
|||
if (frameSource)
|
||||
return;
|
||||
|
||||
frameSource = wl_event_loop_add_idle(g_pCompositor->m_sWLEventLoop, [](void* data) { ((CTabletToolV2Resource*)data)->sendFrame(false); }, this);
|
||||
frameSource = wl_event_loop_add_idle(g_pCompositor->m_wlEventLoop, [](void* data) { ((CTabletToolV2Resource*)data)->sendFrame(false); }, this);
|
||||
}
|
||||
|
||||
void CTabletToolV2Resource::sendFrame(bool removeSource) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ CTearingControl::CTearingControl(SP<CWpTearingControlV1> resource_, SP<CWLSurfac
|
|||
resource->setDestroy([this](CWpTearingControlV1* res) { PROTO::tearing->onControllerDestroy(this); });
|
||||
resource->setSetPresentationHint([this](CWpTearingControlV1* res, wpTearingControlV1PresentationHint hint) { this->onHint(hint); });
|
||||
|
||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (w->m_pWLSurface->resource() == surf_) {
|
||||
pWindow = w;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ void IWaylandProtocol::onDisplayDestroy() {
|
|||
}
|
||||
|
||||
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_szName(name), m_pGlobal(wl_global_create(g_pCompositor->m_wlDisplay, iface, ver, this, &bindManagerInternal)) {
|
||||
|
||||
if UNLIKELY (!m_pGlobal) {
|
||||
LOGM(ERR, "could not create a global [{}]", m_szName);
|
||||
|
|
@ -31,7 +31,7 @@ IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, co
|
|||
wl_list_init(&m_liDisplayDestroy.listener.link);
|
||||
m_liDisplayDestroy.listener.notify = displayDestroyInternal;
|
||||
m_liDisplayDestroy.parent = this;
|
||||
wl_display_add_destroy_listener(g_pCompositor->m_sWLDisplay, &m_liDisplayDestroy.listener);
|
||||
wl_display_add_destroy_listener(g_pCompositor->m_wlDisplay, &m_liDisplayDestroy.listener);
|
||||
|
||||
LOGM(LOG, "Registered global [{}]", m_szName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
|
|||
|
||||
LOGM(LOG, "xdg_surface {:x} gets a toplevel {:x}", (uintptr_t)owner.get(), (uintptr_t)RESOURCE.get());
|
||||
|
||||
g_pCompositor->m_vWindows.emplace_back(CWindow::create(self.lock()));
|
||||
g_pCompositor->m_windows.emplace_back(CWindow::create(self.lock()));
|
||||
|
||||
for (auto const& p : popups) {
|
||||
if (!p)
|
||||
|
|
@ -503,8 +503,8 @@ uint32_t CXDGSurfaceResource::scheduleConfigure() {
|
|||
if (configureSource)
|
||||
return scheduledSerial;
|
||||
|
||||
configureSource = wl_event_loop_add_idle(g_pCompositor->m_sWLEventLoop, onConfigure, this);
|
||||
scheduledSerial = wl_display_next_serial(g_pCompositor->m_sWLDisplay);
|
||||
configureSource = wl_event_loop_add_idle(g_pCompositor->m_wlEventLoop, onConfigure, this);
|
||||
scheduledSerial = wl_display_next_serial(g_pCompositor->m_wlDisplay);
|
||||
|
||||
return scheduledSerial;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ void CWLDataDeviceProtocol::updateDrag() {
|
|||
dnd.focusedDevice->sendDataOffer(offer);
|
||||
if (const auto WL = offer->getWayland(); WL)
|
||||
WL->sendData();
|
||||
dnd.focusedDevice->sendEnter(wl_display_next_serial(g_pCompositor->m_sWLDisplay), g_pSeatManager->state.dndPointerFocus.lock(),
|
||||
dnd.focusedDevice->sendEnter(wl_display_next_serial(g_pCompositor->m_wlDisplay), g_pSeatManager->state.dndPointerFocus.lock(),
|
||||
g_pSeatManager->state.dndPointerFocus->current.size / 2.F, offer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ CWLOutputResource::CWLOutputResource(SP<CWlOutput> resource_, PHLMONITOR pMonito
|
|||
if (!GEOMETRY.has_value())
|
||||
return;
|
||||
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto& m : g_pCompositor->m_monitors) {
|
||||
if (!m->logicalBox().expand(-4).overlaps(*GEOMETRY))
|
||||
continue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue