mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 12:46:00 +01:00
monitor: cleanup and modernize scheduleDone
This commit is contained in:
parent
3a5052a714
commit
a815b14bf1
2 changed files with 17 additions and 14 deletions
|
@ -12,6 +12,7 @@
|
|||
#include "../protocols/DRMSyncobj.hpp"
|
||||
#include "../protocols/core/Output.hpp"
|
||||
#include "../managers/PointerManager.hpp"
|
||||
#include "../managers/eventLoop/EventLoopManager.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "sync/SyncTimeline.hpp"
|
||||
#include <aquamarine/output/Output.hpp>
|
||||
|
@ -789,20 +790,22 @@ CBox CMonitor::logicalBox() {
|
|||
return {vecPosition, vecSize};
|
||||
}
|
||||
|
||||
static void onDoneSource(void* data) {
|
||||
auto pMonitor = (CMonitor*)data;
|
||||
|
||||
if (!PROTO::outputs.contains(pMonitor->szName))
|
||||
return;
|
||||
|
||||
PROTO::outputs.at(pMonitor->szName)->sendDone();
|
||||
}
|
||||
|
||||
void CMonitor::scheduleDone() {
|
||||
if (doneSource)
|
||||
if (doneScheduled)
|
||||
return;
|
||||
|
||||
doneSource = wl_event_loop_add_idle(g_pCompositor->m_sWLEventLoop, ::onDoneSource, this);
|
||||
doneScheduled = true;
|
||||
|
||||
g_pEventLoopManager->doLater([M = self] {
|
||||
if (!M) // if M is gone, we got destroyed, doesn't matter.
|
||||
return;
|
||||
|
||||
if (!PROTO::outputs.contains(M->szName))
|
||||
return;
|
||||
|
||||
PROTO::outputs.at(M->szName)->sendDone();
|
||||
M->doneScheduled = false;
|
||||
});
|
||||
}
|
||||
|
||||
bool CMonitor::attemptDirectScanout() {
|
||||
|
|
|
@ -193,7 +193,7 @@ class CMonitor {
|
|||
void setupDefaultWS(const SMonitorRule&);
|
||||
WORKSPACEID findAvailableDefaultWS();
|
||||
|
||||
wl_event_source* doneSource = nullptr;
|
||||
bool doneScheduled = false;
|
||||
|
||||
struct {
|
||||
CHyprSignalListener frame;
|
||||
|
|
Loading…
Reference in a new issue