mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 14:45:58 +01:00
added forcerendererreload and some more vt changes
This commit is contained in:
parent
322a495412
commit
d743ac7bb1
8 changed files with 38 additions and 6 deletions
|
@ -142,6 +142,7 @@ void CCompositor::initAllSignals() {
|
|||
addWLSignal(&m_sWLRPointerConstraints->events.new_constraint, &Events::listen_newConstraint, m_sWLRPointerConstraints, "PointerConstraints");
|
||||
addWLSignal(&m_sWLRXDGDecoMgr->events.new_toplevel_decoration, &Events::listen_NewXDGDeco, m_sWLRXDGDecoMgr, "XDGDecoMgr");
|
||||
addWLSignal(&m_sWLRVirtPtrMgr->events.new_virtual_pointer, &Events::listen_newVirtPtr, m_sWLRVirtPtrMgr, "VirtPtrMgr");
|
||||
addWLSignal(&m_sWLRRenderer->events.destroy, &Events::listen_RendererDestroy, m_sWLRRenderer, "WLRRenderer");
|
||||
|
||||
signal(SIGINT, handleCritSignal);
|
||||
signal(SIGTERM, handleCritSignal);
|
||||
|
|
|
@ -109,4 +109,7 @@ namespace Events {
|
|||
|
||||
// Deco XDG
|
||||
LISTENER(NewXDGDeco);
|
||||
|
||||
// Renderer destroy
|
||||
LISTENER(RendererDestroy);
|
||||
};
|
|
@ -154,3 +154,7 @@ void Events::listener_InhibitDeactivate(wl_listener* listener, void* data) {
|
|||
g_pCompositor->m_sSeat.exclusiveClient = nullptr;
|
||||
g_pInputManager->refocus();
|
||||
}
|
||||
|
||||
void Events::listener_RendererDestroy(wl_listener* listener, void* data) {
|
||||
Debug::log(LOG, "!!Renderer destroyed!!");
|
||||
}
|
|
@ -180,9 +180,14 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
|||
g_pConfigManager->performMonitorReload();
|
||||
}
|
||||
|
||||
if (PMONITOR->needsFrameSkip) {
|
||||
PMONITOR->needsFrameSkip = false;
|
||||
if (PMONITOR->framesToSkip > 0) {
|
||||
PMONITOR->framesToSkip -= 1;
|
||||
|
||||
if (!PMONITOR->noFrameSchedule)
|
||||
wlr_output_schedule_frame(PMONITOR->output);
|
||||
else {
|
||||
Debug::log(LOG, "NoFrameSchedule hit for %s.", PMONITOR->szName.c_str());
|
||||
}
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,8 @@ struct SMonitor {
|
|||
wlr_output* output = nullptr;
|
||||
float refreshRate = 60;
|
||||
wlr_output_damage* damage = nullptr;
|
||||
bool needsFrameSkip = false;
|
||||
int framesToSkip = 0;
|
||||
bool noFrameSchedule = false;
|
||||
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
|
||||
// for the special workspace
|
||||
|
|
|
@ -24,6 +24,7 @@ CKeybindManager::CKeybindManager() {
|
|||
m_mDispatchers["movecurrentworkspacetomonitor"] = moveCurrentWorkspaceToMonitor;
|
||||
m_mDispatchers["moveworkspacetomonitor"] = moveWorkspaceToMonitor;
|
||||
m_mDispatchers["togglespecialworkspace"] = toggleSpecialWorkspace;
|
||||
m_mDispatchers["forcerendererreload"] = forceRendererReload;
|
||||
}
|
||||
|
||||
void CKeybindManager::addKeybind(SKeybind kb) {
|
||||
|
@ -109,8 +110,17 @@ bool CKeybindManager::handleInternalKeybinds(xkb_keysym_t keysym) {
|
|||
|
||||
const auto PSESSION = wlr_backend_get_session(g_pCompositor->m_sWLRBackend);
|
||||
if (PSESSION) {
|
||||
const auto TTY = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
|
||||
const int TTY = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
|
||||
wlr_session_change_vt(PSESSION, TTY);
|
||||
|
||||
for (auto& m : g_pCompositor->m_lMonitors) {
|
||||
g_pHyprOpenGL->destroyMonitorResources(&m); // mark resources as unusable anymore
|
||||
m.noFrameSchedule = true;
|
||||
m.framesToSkip = 2;
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Switched to VT %i, destroyed all render data, frames to skip for each: 2", TTY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -827,3 +837,10 @@ void CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
|||
|
||||
g_pInputManager->refocus();
|
||||
}
|
||||
|
||||
void CKeybindManager::forceRendererReload(std::string args) {
|
||||
for (auto& m : g_pCompositor->m_lMonitors) {
|
||||
auto rule = g_pConfigManager->getMonitorRuleFor(m.szName);
|
||||
g_pHyprRenderer->applyMonitorRule(&m, &rule, true);
|
||||
}
|
||||
}
|
|
@ -54,6 +54,7 @@ private:
|
|||
static void moveCurrentWorkspaceToMonitor(std::string);
|
||||
static void moveWorkspaceToMonitor(std::string);
|
||||
static void toggleSpecialWorkspace(std::string);
|
||||
static void forceRendererReload(std::string);
|
||||
|
||||
friend class CCompositor;
|
||||
};
|
||||
|
|
|
@ -717,5 +717,5 @@ void CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorR
|
|||
arrangeLayersForMonitor(pMonitor->ID);
|
||||
|
||||
// frame skip
|
||||
pMonitor->needsFrameSkip = true;
|
||||
pMonitor->framesToSkip = 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue