2022-03-21 15:17:04 +01:00
|
|
|
#include "Events.hpp"
|
|
|
|
|
|
|
|
#include "../Compositor.hpp"
|
|
|
|
#include "../helpers/WLClasses.hpp"
|
2022-06-09 12:46:55 +02:00
|
|
|
#include "../managers/input/InputManager.hpp"
|
2022-03-21 15:17:04 +01:00
|
|
|
#include "../render/Renderer.hpp"
|
2024-03-09 17:52:59 +01:00
|
|
|
#include "../managers/CursorManager.hpp"
|
2022-03-21 15:17:04 +01:00
|
|
|
|
|
|
|
// ------------------------------ //
|
|
|
|
// __ __ _____ _____ _____ //
|
|
|
|
// | \/ |_ _|/ ____|/ ____| //
|
|
|
|
// | \ / | | | | (___ | | //
|
|
|
|
// | |\/| | | | \___ \| | //
|
|
|
|
// | | | |_| |_ ____) | |____ //
|
|
|
|
// |_| |_|_____|_____/ \_____| //
|
|
|
|
// //
|
|
|
|
// ------------------------------ //
|
|
|
|
|
2022-08-27 23:10:13 +02:00
|
|
|
void Events::listener_leaseRequest(wl_listener* listener, void* data) {
|
2022-12-16 18:17:31 +01:00
|
|
|
const auto REQUEST = (wlr_drm_lease_request_v1*)data;
|
|
|
|
struct wlr_drm_lease_v1* lease = wlr_drm_lease_request_v1_grant(REQUEST);
|
2022-08-27 23:24:36 +02:00
|
|
|
if (!lease) {
|
2022-08-27 23:10:13 +02:00
|
|
|
Debug::log(ERR, "Failed to grant lease request!");
|
2022-08-27 23:24:36 +02:00
|
|
|
wlr_drm_lease_request_v1_reject(REQUEST);
|
|
|
|
}
|
2022-08-27 23:10:13 +02:00
|
|
|
}
|
|
|
|
|
2022-06-06 13:48:17 +02:00
|
|
|
void Events::listener_RendererDestroy(wl_listener* listener, void* data) {
|
|
|
|
Debug::log(LOG, "!!Renderer destroyed!!");
|
2022-07-13 18:18:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Events::listener_sessionActive(wl_listener* listener, void* data) {
|
2024-06-29 20:04:48 +02:00
|
|
|
if (g_pCompositor->m_sWLRSession->active) {
|
|
|
|
Debug::log(LOG, "Session got activated!");
|
2022-07-13 18:18:23 +02:00
|
|
|
|
2024-06-29 20:04:48 +02:00
|
|
|
g_pCompositor->m_bSessionActive = true;
|
2022-12-02 19:47:57 +01:00
|
|
|
|
2024-06-29 20:04:48 +02:00
|
|
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
|
|
|
g_pCompositor->scheduleFrameForMonitor(m.get());
|
|
|
|
g_pHyprRenderer->applyMonitorRule(m.get(), &m->activeMonitorRule, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_pConfigManager->m_bWantsMonitorReload = true;
|
|
|
|
} else {
|
|
|
|
Debug::log(LOG, "Session got inactivated!");
|
2022-12-02 19:47:57 +01:00
|
|
|
|
2024-06-29 20:04:48 +02:00
|
|
|
g_pCompositor->m_bSessionActive = false;
|
|
|
|
|
|
|
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
|
|
|
m->noFrameSchedule = true;
|
|
|
|
m->framesToSkip = 1;
|
|
|
|
}
|
|
|
|
}
|
2022-07-30 22:41:24 +02:00
|
|
|
}
|