mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 13:05:58 +01:00
wlr-output-power: move to new impl
This commit is contained in:
parent
a5a6480917
commit
33e0bb1478
13 changed files with 143 additions and 28 deletions
|
@ -252,7 +252,6 @@ target_link_libraries(Hyprland
|
||||||
protocol("protocols/idle.xml" "idle" true)
|
protocol("protocols/idle.xml" "idle" true)
|
||||||
protocol("protocols/tablet-unstable-v2.xml" "tablet-unstable-v2" true)
|
protocol("protocols/tablet-unstable-v2.xml" "tablet-unstable-v2" true)
|
||||||
protocol("protocols/wlr-layer-shell-unstable-v1.xml" "wlr-layer-shell-unstable-v1" true)
|
protocol("protocols/wlr-layer-shell-unstable-v1.xml" "wlr-layer-shell-unstable-v1" true)
|
||||||
protocol("protocols/wlr-output-power-management-unstable-v1.xml" "wlr-output-power-management-unstable-v1" true)
|
|
||||||
protocol("protocols/wlr-screencopy-unstable-v1.xml" "wlr-screencopy-unstable-v1" true)
|
protocol("protocols/wlr-screencopy-unstable-v1.xml" "wlr-screencopy-unstable-v1" true)
|
||||||
protocol("subprojects/hyprland-protocols/protocols/hyprland-global-shortcuts-v1.xml" "hyprland-global-shortcuts-v1" true)
|
protocol("subprojects/hyprland-protocols/protocols/hyprland-global-shortcuts-v1.xml" "hyprland-global-shortcuts-v1" true)
|
||||||
protocol("subprojects/hyprland-protocols/protocols/hyprland-toplevel-export-v1.xml" "hyprland-toplevel-export-v1" true)
|
protocol("subprojects/hyprland-protocols/protocols/hyprland-toplevel-export-v1.xml" "hyprland-toplevel-export-v1" true)
|
||||||
|
@ -262,6 +261,7 @@ protocol("unstable/text-input/text-input-unstable-v1.xml" "text-input-unstable-v
|
||||||
|
|
||||||
protocolNew("protocols/wlr-gamma-control-unstable-v1.xml" "wlr-gamma-control-unstable-v1" true)
|
protocolNew("protocols/wlr-gamma-control-unstable-v1.xml" "wlr-gamma-control-unstable-v1" true)
|
||||||
protocolNew("protocols/wlr-foreign-toplevel-management-unstable-v1.xml" "wlr-foreign-toplevel-management-unstable-v1" true)
|
protocolNew("protocols/wlr-foreign-toplevel-management-unstable-v1.xml" "wlr-foreign-toplevel-management-unstable-v1" true)
|
||||||
|
protocolNew("protocols/wlr-output-power-management-unstable-v1.xml" "wlr-output-power-management-unstable-v1" true)
|
||||||
protocolNew("staging/tearing-control/tearing-control-v1.xml" "tearing-control-v1" false)
|
protocolNew("staging/tearing-control/tearing-control-v1.xml" "tearing-control-v1" false)
|
||||||
protocolNew("staging/fractional-scale/fractional-scale-v1.xml" "fractional-scale-v1" false)
|
protocolNew("staging/fractional-scale/fractional-scale-v1.xml" "fractional-scale-v1" false)
|
||||||
protocolNew("unstable/xdg-output/xdg-output-unstable-v1.xml" "xdg-output-unstable-v1" false)
|
protocolNew("unstable/xdg-output/xdg-output-unstable-v1.xml" "xdg-output-unstable-v1" false)
|
||||||
|
|
|
@ -28,7 +28,6 @@ protocols = [
|
||||||
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
|
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
|
||||||
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v1.xml'],
|
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v1.xml'],
|
||||||
['wlr-layer-shell-unstable-v1.xml'],
|
['wlr-layer-shell-unstable-v1.xml'],
|
||||||
['wlr-output-power-management-unstable-v1.xml'],
|
|
||||||
['wlr-screencopy-unstable-v1.xml'],
|
['wlr-screencopy-unstable-v1.xml'],
|
||||||
['tablet-unstable-v2.xml'],
|
['tablet-unstable-v2.xml'],
|
||||||
['idle.xml'],
|
['idle.xml'],
|
||||||
|
@ -39,6 +38,7 @@ protocols = [
|
||||||
new_protocols = [
|
new_protocols = [
|
||||||
['wlr-gamma-control-unstable-v1.xml'],
|
['wlr-gamma-control-unstable-v1.xml'],
|
||||||
['wlr-foreign-toplevel-management-unstable-v1.xml'],
|
['wlr-foreign-toplevel-management-unstable-v1.xml'],
|
||||||
|
['wlr-output-power-management-unstable-v1.xml'],
|
||||||
[wl_protocol_dir, 'staging/tearing-control/tearing-control-v1.xml'],
|
[wl_protocol_dir, 'staging/tearing-control/tearing-control-v1.xml'],
|
||||||
[wl_protocol_dir, 'staging/fractional-scale/fractional-scale-v1.xml'],
|
[wl_protocol_dir, 'staging/fractional-scale/fractional-scale-v1.xml'],
|
||||||
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
|
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
|
||||||
|
|
|
@ -228,8 +228,6 @@ void CCompositor::initServer() {
|
||||||
|
|
||||||
m_sWLROutputLayout = wlr_output_layout_create(m_sWLDisplay);
|
m_sWLROutputLayout = wlr_output_layout_create(m_sWLDisplay);
|
||||||
|
|
||||||
m_sWLROutputPowerMgr = wlr_output_power_manager_v1_create(m_sWLDisplay);
|
|
||||||
|
|
||||||
m_sWLRXDGShell = wlr_xdg_shell_create(m_sWLDisplay, 6);
|
m_sWLRXDGShell = wlr_xdg_shell_create(m_sWLDisplay, 6);
|
||||||
|
|
||||||
m_sWLRCursor = wlr_cursor_create();
|
m_sWLRCursor = wlr_cursor_create();
|
||||||
|
@ -319,7 +317,6 @@ void CCompositor::initAllSignals() {
|
||||||
addWLSignal(&m_sWLRVirtPtrMgr->events.new_virtual_pointer, &Events::listen_newVirtPtr, m_sWLRVirtPtrMgr, "VirtPtrMgr");
|
addWLSignal(&m_sWLRVirtPtrMgr->events.new_virtual_pointer, &Events::listen_newVirtPtr, m_sWLRVirtPtrMgr, "VirtPtrMgr");
|
||||||
addWLSignal(&m_sWLRVKeyboardMgr->events.new_virtual_keyboard, &Events::listen_newVirtualKeyboard, m_sWLRVKeyboardMgr, "VKeyboardMgr");
|
addWLSignal(&m_sWLRVKeyboardMgr->events.new_virtual_keyboard, &Events::listen_newVirtualKeyboard, m_sWLRVKeyboardMgr, "VKeyboardMgr");
|
||||||
addWLSignal(&m_sWLRRenderer->events.destroy, &Events::listen_RendererDestroy, m_sWLRRenderer, "WLRRenderer");
|
addWLSignal(&m_sWLRRenderer->events.destroy, &Events::listen_RendererDestroy, m_sWLRRenderer, "WLRRenderer");
|
||||||
addWLSignal(&m_sWLROutputPowerMgr->events.set_mode, &Events::listen_powerMgrSetMode, m_sWLROutputPowerMgr, "PowerMgr");
|
|
||||||
addWLSignal(&m_sWLRIMEMgr->events.input_method, &Events::listen_newIME, m_sWLRIMEMgr, "IMEMgr");
|
addWLSignal(&m_sWLRIMEMgr->events.input_method, &Events::listen_newIME, m_sWLRIMEMgr, "IMEMgr");
|
||||||
addWLSignal(&m_sWLRActivation->events.request_activate, &Events::listen_activateXDG, m_sWLRActivation, "ActivationV1");
|
addWLSignal(&m_sWLRActivation->events.request_activate, &Events::listen_activateXDG, m_sWLRActivation, "ActivationV1");
|
||||||
addWLSignal(&m_sWLRSessionLockMgr->events.new_lock, &Events::listen_newSessionLock, m_sWLRSessionLockMgr, "SessionLockMgr");
|
addWLSignal(&m_sWLRSessionLockMgr->events.new_lock, &Events::listen_newSessionLock, m_sWLRSessionLockMgr, "SessionLockMgr");
|
||||||
|
@ -365,7 +362,6 @@ void CCompositor::removeAllSignals() {
|
||||||
removeWLSignal(&Events::listen_newVirtPtr);
|
removeWLSignal(&Events::listen_newVirtPtr);
|
||||||
removeWLSignal(&Events::listen_newVirtualKeyboard);
|
removeWLSignal(&Events::listen_newVirtualKeyboard);
|
||||||
removeWLSignal(&Events::listen_RendererDestroy);
|
removeWLSignal(&Events::listen_RendererDestroy);
|
||||||
removeWLSignal(&Events::listen_powerMgrSetMode);
|
|
||||||
removeWLSignal(&Events::listen_newIME);
|
removeWLSignal(&Events::listen_newIME);
|
||||||
removeWLSignal(&Events::listen_activateXDG);
|
removeWLSignal(&Events::listen_activateXDG);
|
||||||
removeWLSignal(&Events::listen_newSessionLock);
|
removeWLSignal(&Events::listen_newSessionLock);
|
||||||
|
|
|
@ -66,7 +66,6 @@ class CCompositor {
|
||||||
wlr_virtual_pointer_manager_v1* m_sWLRVirtPtrMgr;
|
wlr_virtual_pointer_manager_v1* m_sWLRVirtPtrMgr;
|
||||||
wlr_tablet_manager_v2* m_sWLRTabletManager;
|
wlr_tablet_manager_v2* m_sWLRTabletManager;
|
||||||
wlr_xdg_foreign_registry* m_sWLRForeignRegistry;
|
wlr_xdg_foreign_registry* m_sWLRForeignRegistry;
|
||||||
wlr_output_power_manager_v1* m_sWLROutputPowerMgr;
|
|
||||||
wlr_input_method_manager_v2* m_sWLRIMEMgr;
|
wlr_input_method_manager_v2* m_sWLRIMEMgr;
|
||||||
wlr_xdg_activation_v1* m_sWLRActivation;
|
wlr_xdg_activation_v1* m_sWLRActivation;
|
||||||
wlr_linux_dmabuf_v1* m_sWLRLinuxDMABuf;
|
wlr_linux_dmabuf_v1* m_sWLRLinuxDMABuf;
|
||||||
|
|
|
@ -111,9 +111,6 @@ namespace Events {
|
||||||
LISTENER(pinchUpdate);
|
LISTENER(pinchUpdate);
|
||||||
LISTENER(pinchEnd);
|
LISTENER(pinchEnd);
|
||||||
|
|
||||||
// Power
|
|
||||||
LISTENER(powerMgrSetMode);
|
|
||||||
|
|
||||||
// IME
|
// IME
|
||||||
LISTENER(newIME);
|
LISTENER(newIME);
|
||||||
LISTENER(newVirtualKeyboard);
|
LISTENER(newVirtualKeyboard);
|
||||||
|
|
|
@ -188,23 +188,6 @@ void Events::listener_sessionActive(wl_listener* listener, void* data) {
|
||||||
g_pConfigManager->m_bWantsMonitorReload = true;
|
g_pConfigManager->m_bWantsMonitorReload = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_powerMgrSetMode(wl_listener* listener, void* data) {
|
|
||||||
Debug::log(LOG, "PowerMgr set mode!");
|
|
||||||
|
|
||||||
const auto EVENT = (wlr_output_power_v1_set_mode_event*)data;
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(EVENT->output);
|
|
||||||
|
|
||||||
if (!PMONITOR) {
|
|
||||||
Debug::log(ERR, "Invalid powerMgrSetMode output");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_output_state_set_enabled(PMONITOR->state.wlr(), EVENT->mode == 1);
|
|
||||||
|
|
||||||
if (!PMONITOR->state.commit())
|
|
||||||
Debug::log(ERR, "Couldn't set power mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Events::listener_newIME(wl_listener* listener, void* data) {
|
void Events::listener_newIME(wl_listener* listener, void* data) {
|
||||||
Debug::log(LOG, "New IME added!");
|
Debug::log(LOG, "New IME added!");
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,8 @@ class CMonitor {
|
||||||
CSignal destroy;
|
CSignal destroy;
|
||||||
CSignal connect;
|
CSignal connect;
|
||||||
CSignal disconnect;
|
CSignal disconnect;
|
||||||
|
CSignal dpmsChanged;
|
||||||
|
CSignal modeChanged;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
std::array<std::vector<std::unique_ptr<SLayerSurface>>, 4> m_aLayerSurfaceLayers;
|
std::array<std::vector<std::unique_ptr<SLayerSurface>>, 4> m_aLayerSurfaceLayers;
|
||||||
|
|
|
@ -84,7 +84,6 @@ extern "C" {
|
||||||
#include <wlr/types/wlr_xdg_foreign_registry.h>
|
#include <wlr/types/wlr_xdg_foreign_registry.h>
|
||||||
#include <wlr/types/wlr_xdg_foreign_v1.h>
|
#include <wlr/types/wlr_xdg_foreign_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_foreign_v2.h>
|
#include <wlr/types/wlr_xdg_foreign_v2.h>
|
||||||
#include <wlr/types/wlr_output_power_management_v1.h>
|
|
||||||
#include <wlr/types/wlr_input_method_v2.h>
|
#include <wlr/types/wlr_input_method_v2.h>
|
||||||
#include <wlr/types/wlr_touch.h>
|
#include <wlr/types/wlr_touch.h>
|
||||||
#include <wlr/types/wlr_switch.h>
|
#include <wlr/types/wlr_switch.h>
|
||||||
|
|
|
@ -2006,6 +2006,8 @@ void CKeybindManager::dpms(std::string arg) {
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
g_pHyprRenderer->damageMonitor(m.get());
|
g_pHyprRenderer->damageMonitor(m.get());
|
||||||
|
|
||||||
|
m->events.dpmsChanged.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pCompositor->m_bDPMSStateON = enable;
|
g_pCompositor->m_bDPMSStateON = enable;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "../protocols/ShortcutsInhibit.hpp"
|
#include "../protocols/ShortcutsInhibit.hpp"
|
||||||
#include "../protocols/TextInputV3.hpp"
|
#include "../protocols/TextInputV3.hpp"
|
||||||
#include "../protocols/PointerConstraints.hpp"
|
#include "../protocols/PointerConstraints.hpp"
|
||||||
|
#include "../protocols/OutputPower.hpp"
|
||||||
|
|
||||||
#include "tearing-control-v1.hpp"
|
#include "tearing-control-v1.hpp"
|
||||||
#include "fractional-scale-v1.hpp"
|
#include "fractional-scale-v1.hpp"
|
||||||
|
@ -31,6 +32,7 @@
|
||||||
#include "keyboard-shortcuts-inhibit-unstable-v1.hpp"
|
#include "keyboard-shortcuts-inhibit-unstable-v1.hpp"
|
||||||
#include "text-input-unstable-v3.hpp"
|
#include "text-input-unstable-v3.hpp"
|
||||||
#include "pointer-constraints-unstable-v1.hpp"
|
#include "pointer-constraints-unstable-v1.hpp"
|
||||||
|
#include "wlr-output-power-management-unstable-v1.hpp"
|
||||||
|
|
||||||
CProtocolManager::CProtocolManager() {
|
CProtocolManager::CProtocolManager() {
|
||||||
|
|
||||||
|
@ -49,6 +51,7 @@ CProtocolManager::CProtocolManager() {
|
||||||
PROTO::shortcutsInhibit = std::make_unique<CKeyboardShortcutsInhibitProtocol>(&zwp_keyboard_shortcuts_inhibit_manager_v1_interface, 1, "ShortcutsInhibit");
|
PROTO::shortcutsInhibit = std::make_unique<CKeyboardShortcutsInhibitProtocol>(&zwp_keyboard_shortcuts_inhibit_manager_v1_interface, 1, "ShortcutsInhibit");
|
||||||
PROTO::textInputV3 = std::make_unique<CTextInputV3Protocol>(&zwp_text_input_manager_v3_interface, 1, "TextInputV3");
|
PROTO::textInputV3 = std::make_unique<CTextInputV3Protocol>(&zwp_text_input_manager_v3_interface, 1, "TextInputV3");
|
||||||
PROTO::constraints = std::make_unique<CPointerConstraintsProtocol>(&zwp_pointer_constraints_v1_interface, 1, "PointerConstraints");
|
PROTO::constraints = std::make_unique<CPointerConstraintsProtocol>(&zwp_pointer_constraints_v1_interface, 1, "PointerConstraints");
|
||||||
|
PROTO::outputPower = std::make_unique<COutputPowerProtocol>(&zwlr_output_power_manager_v1_interface, 1, "OutputPower");
|
||||||
|
|
||||||
// Old protocol implementations.
|
// Old protocol implementations.
|
||||||
// TODO: rewrite them to use hyprwayland-scanner.
|
// TODO: rewrite them to use hyprwayland-scanner.
|
||||||
|
|
80
src/protocols/OutputPower.cpp
Normal file
80
src/protocols/OutputPower.cpp
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
#include "OutputPower.hpp"
|
||||||
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
|
#define LOGM PROTO::outputPower->protoLog
|
||||||
|
|
||||||
|
COutputPower::COutputPower(SP<CZwlrOutputPowerV1> resource_, CMonitor* pMonitor_) : resource(resource_), pMonitor(pMonitor_) {
|
||||||
|
if (!resource->resource())
|
||||||
|
return;
|
||||||
|
|
||||||
|
resource->setDestroy([this](CZwlrOutputPowerV1* r) { PROTO::outputPower->destroyOutputPower(this); });
|
||||||
|
resource->setOnDestroy([this](CZwlrOutputPowerV1* r) { PROTO::outputPower->destroyOutputPower(this); });
|
||||||
|
|
||||||
|
resource->setSetMode([this](CZwlrOutputPowerV1* r, zwlrOutputPowerV1Mode mode) {
|
||||||
|
if (!pMonitor)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pMonitor->dpmsStatus = mode == ZWLR_OUTPUT_POWER_V1_MODE_ON;
|
||||||
|
|
||||||
|
wlr_output_state_set_enabled(pMonitor->state.wlr(), pMonitor->dpmsStatus);
|
||||||
|
|
||||||
|
if (!pMonitor->state.commit())
|
||||||
|
LOGM(ERR, "Couldn't set dpms to {} for {}", pMonitor->dpmsStatus, pMonitor->szName);
|
||||||
|
});
|
||||||
|
|
||||||
|
resource->sendMode(pMonitor->dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF);
|
||||||
|
|
||||||
|
listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any v) {
|
||||||
|
pMonitor = nullptr;
|
||||||
|
resource->sendFailed();
|
||||||
|
});
|
||||||
|
|
||||||
|
listeners.monitorDpms = pMonitor->events.dpmsChanged.registerListener(
|
||||||
|
[this](std::any v) { resource->sendMode(pMonitor->dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
|
||||||
|
listeners.monitorState = pMonitor->events.modeChanged.registerListener(
|
||||||
|
[this](std::any v) { resource->sendMode(pMonitor->dpmsStatus ? ZWLR_OUTPUT_POWER_V1_MODE_ON : ZWLR_OUTPUT_POWER_V1_MODE_OFF); });
|
||||||
|
}
|
||||||
|
|
||||||
|
bool COutputPower::good() {
|
||||||
|
return resource->resource();
|
||||||
|
}
|
||||||
|
|
||||||
|
COutputPowerProtocol::COutputPowerProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutputPowerProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||||
|
const auto RESOURCE = m_vManagers.emplace_back(std::make_unique<CZwlrOutputPowerManagerV1>(client, ver, id)).get();
|
||||||
|
RESOURCE->setOnDestroy([this](CZwlrOutputPowerManagerV1* p) { this->onManagerResourceDestroy(p->resource()); });
|
||||||
|
|
||||||
|
RESOURCE->setDestroy([this](CZwlrOutputPowerManagerV1* pMgr) { this->onManagerResourceDestroy(pMgr->resource()); });
|
||||||
|
RESOURCE->setGetOutputPower([this](CZwlrOutputPowerManagerV1* hiThereFriend, uint32_t id, wl_resource* output) { this->onGetOutputPower(hiThereFriend, id, output); });
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutputPowerProtocol::onManagerResourceDestroy(wl_resource* res) {
|
||||||
|
std::erase_if(m_vManagers, [&](const auto& other) { return other->resource() == res; });
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutputPowerProtocol::destroyOutputPower(COutputPower* power) {
|
||||||
|
std::erase_if(m_vOutputPowers, [&](const auto& other) { return other.get() == power; });
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutputPowerProtocol::onGetOutputPower(CZwlrOutputPowerManagerV1* pMgr, uint32_t id, wl_resource* output) {
|
||||||
|
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(wlr_output_from_resource(output));
|
||||||
|
|
||||||
|
if (!PMONITOR) {
|
||||||
|
wl_resource_post_error(pMgr->resource(), 0, "Invalid output resource");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto CLIENT = wl_resource_get_client(pMgr->resource());
|
||||||
|
const auto RESOURCE =
|
||||||
|
m_vOutputPowers.emplace_back(std::make_unique<COutputPower>(std::make_shared<CZwlrOutputPowerV1>(CLIENT, wl_resource_get_version(pMgr->resource()), id), PMONITOR)).get();
|
||||||
|
|
||||||
|
if (!RESOURCE->good()) {
|
||||||
|
wl_resource_post_no_memory(pMgr->resource());
|
||||||
|
m_vOutputPowers.pop_back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
50
src/protocols/OutputPower.hpp
Normal file
50
src/protocols/OutputPower.hpp
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
#include "WaylandProtocol.hpp"
|
||||||
|
#include "wlr-output-power-management-unstable-v1.hpp"
|
||||||
|
#include "../helpers/signal/Listener.hpp"
|
||||||
|
|
||||||
|
class CMonitor;
|
||||||
|
|
||||||
|
class COutputPower {
|
||||||
|
public:
|
||||||
|
COutputPower(SP<CZwlrOutputPowerV1> resource_, CMonitor* pMonitor);
|
||||||
|
|
||||||
|
bool good();
|
||||||
|
|
||||||
|
private:
|
||||||
|
SP<CZwlrOutputPowerV1> resource;
|
||||||
|
|
||||||
|
CMonitor* pMonitor = nullptr;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
CHyprSignalListener monitorDestroy;
|
||||||
|
CHyprSignalListener monitorState;
|
||||||
|
CHyprSignalListener monitorDpms;
|
||||||
|
} listeners;
|
||||||
|
};
|
||||||
|
|
||||||
|
class COutputPowerProtocol : public IWaylandProtocol {
|
||||||
|
public:
|
||||||
|
COutputPowerProtocol(const wl_interface* iface, const int& ver, const std::string& name);
|
||||||
|
|
||||||
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onManagerResourceDestroy(wl_resource* res);
|
||||||
|
void destroyOutputPower(COutputPower* pointer);
|
||||||
|
void onGetOutputPower(CZwlrOutputPowerManagerV1* pMgr, uint32_t id, wl_resource* output);
|
||||||
|
|
||||||
|
//
|
||||||
|
std::vector<UP<CZwlrOutputPowerManagerV1>> m_vManagers;
|
||||||
|
std::vector<UP<COutputPower>> m_vOutputPowers;
|
||||||
|
|
||||||
|
friend class COutputPower;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace PROTO {
|
||||||
|
inline UP<COutputPowerProtocol> outputPower;
|
||||||
|
};
|
|
@ -1904,6 +1904,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
if (pMonitor->m_bEnabled)
|
if (pMonitor->m_bEnabled)
|
||||||
pMonitor->onDisconnect();
|
pMonitor->onDisconnect();
|
||||||
|
|
||||||
|
pMonitor->events.modeChanged.emit();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2301,6 +2303,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("monitorLayoutChanged", nullptr);
|
EMIT_HOOK_EVENT("monitorLayoutChanged", nullptr);
|
||||||
|
|
||||||
|
pMonitor->events.modeChanged.emit();
|
||||||
|
|
||||||
Events::listener_change(nullptr, nullptr);
|
Events::listener_change(nullptr, nullptr);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue