From 262f8d96f31d1ac608beadee680e5f7b63d76353 Mon Sep 17 00:00:00 2001 From: guttermonk Date: Fri, 17 Oct 2025 18:26:06 -0500 Subject: [PATCH] fixed the compilation errors in the `idle_inhibitor.cpp` file --- src/modules/idle_inhibitor.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/modules/idle_inhibitor.cpp b/src/modules/idle_inhibitor.cpp index 6012bb4c..619c52f1 100644 --- a/src/modules/idle_inhibitor.cpp +++ b/src/modules/idle_inhibitor.cpp @@ -195,16 +195,20 @@ void waybar::modules::IdleInhibitor::setupActivityMonitoring() { return; } + // Get non-const reference to the window to set up event monitoring + // This is safe because we're only setting up signal handlers, not modifying the Bar itself + auto& window = const_cast(bar_.window); + // Enable motion and key event monitoring on the bar window - auto window = bar_.window.get_window(); - if (window) { - window->set_events(window->get_events() | Gdk::POINTER_MOTION_MASK | Gdk::KEY_PRESS_MASK); + auto gdk_window = window.get_window(); + if (gdk_window) { + gdk_window->set_events(gdk_window->get_events() | Gdk::POINTER_MOTION_MASK | Gdk::KEY_PRESS_MASK); } // Connect to the bar window's event signals - motion_connection_ = bar_.window.signal_motion_notify_event().connect( + motion_connection_ = window.signal_motion_notify_event().connect( sigc::mem_fun(*this, &IdleInhibitor::handleMotion)); - key_connection_ = bar_.window.signal_key_press_event().connect( + key_connection_ = window.signal_key_press_event().connect( sigc::mem_fun(*this, &IdleInhibitor::handleKey)); }