mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 01:05:59 +01:00
output: handle needs_frame
This commit is contained in:
parent
cd1b982b2a
commit
41d1fdedf2
4 changed files with 15 additions and 4 deletions
|
@ -99,6 +99,7 @@ namespace Events {
|
|||
DYNLISTENFUNC(monitorDestroy);
|
||||
DYNLISTENFUNC(monitorStateRequest);
|
||||
DYNLISTENFUNC(monitorDamage);
|
||||
DYNLISTENFUNC(monitorNeedsFrame);
|
||||
|
||||
// XWayland
|
||||
LISTENER(readyXWayland);
|
||||
|
|
|
@ -203,3 +203,9 @@ void Events::listener_monitorDamage(void* owner, void* data) {
|
|||
|
||||
PMONITOR->addDamage(E->damage);
|
||||
}
|
||||
|
||||
void Events::listener_monitorNeedsFrame(void* owner, void* data) {
|
||||
const auto PMONITOR = (CMonitor*)owner;
|
||||
|
||||
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
|
||||
}
|
||||
|
|
|
@ -21,10 +21,12 @@ void CMonitor::onConnect(bool noRule) {
|
|||
hyprListener_monitorFrame.removeCallback();
|
||||
hyprListener_monitorStateRequest.removeCallback();
|
||||
hyprListener_monitorDamage.removeCallback();
|
||||
hyprListener_monitorNeedsFrame.removeCallback();
|
||||
hyprListener_monitorFrame.initCallback(&output->events.frame, &Events::listener_monitorFrame, this);
|
||||
hyprListener_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this);
|
||||
hyprListener_monitorStateRequest.initCallback(&output->events.request_state, &Events::listener_monitorStateRequest, this);
|
||||
hyprListener_monitorDamage.initCallback(&output->events.damage, &Events::listener_monitorDamage, this);
|
||||
hyprListener_monitorNeedsFrame.initCallback(&output->events.needs_frame, &Events::listener_monitorNeedsFrame, this);
|
||||
|
||||
if (m_bEnabled) {
|
||||
wlr_output_enable(output, 1);
|
||||
|
@ -218,6 +220,7 @@ void CMonitor::onDisconnect() {
|
|||
|
||||
hyprListener_monitorFrame.removeCallback();
|
||||
hyprListener_monitorDamage.removeCallback();
|
||||
hyprListener_monitorNeedsFrame.removeCallback();
|
||||
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
for (auto& ls : m_aLayerSurfaceLayers[i]) {
|
||||
|
@ -293,13 +296,13 @@ void CMonitor::onDisconnect() {
|
|||
}
|
||||
|
||||
void CMonitor::addDamage(const pixman_region32_t* rg) {
|
||||
wlr_damage_ring_add(&damage, rg);
|
||||
g_pCompositor->scheduleFrameForMonitor(this);
|
||||
if (wlr_damage_ring_add(&damage, rg))
|
||||
g_pCompositor->scheduleFrameForMonitor(this);
|
||||
}
|
||||
|
||||
void CMonitor::addDamage(const wlr_box* box) {
|
||||
wlr_damage_ring_add_box(&damage, box);
|
||||
g_pCompositor->scheduleFrameForMonitor(this);
|
||||
if (wlr_damage_ring_add_box(&damage, box))
|
||||
g_pCompositor->scheduleFrameForMonitor(this);
|
||||
}
|
||||
|
||||
bool CMonitor::isMirror() {
|
||||
|
|
|
@ -66,6 +66,7 @@ class CMonitor {
|
|||
DYNLISTENER(monitorDestroy);
|
||||
DYNLISTENER(monitorStateRequest);
|
||||
DYNLISTENER(monitorDamage);
|
||||
DYNLISTENER(monitorNeedsFrame);
|
||||
|
||||
// hack: a group = workspaces on a monitor.
|
||||
// I don't really care lol :P
|
||||
|
|
Loading…
Reference in a new issue