From 418dadf0b926b41a58970debf167297f1d72a26b Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 20 Dec 2016 07:04:13 +0100 Subject: [PATCH] fix(xbacklight): Close cmd blocks --- src/modules/xbacklight.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/xbacklight.cpp b/src/modules/xbacklight.cpp index daf277d2..f6f276dd 100644 --- a/src/modules/xbacklight.cpp +++ b/src/modules/xbacklight.cpp @@ -132,15 +132,20 @@ namespace modules { */ string xbacklight_module::get_output() { // Get the module output early so that - // the format prefix/suffix also gets wrapper + // the format prefix/suffix also gets wrapped // with the cmd handlers string output{module::get_output()}; + bool scroll_up{m_scroll && m_percentage < 100}; + bool scroll_down{m_scroll && m_percentage > 0}; - m_builder->cmd(mousebtn::SCROLL_UP, string{EVENT_SCROLLUP}, m_scroll && m_percentage < 100); - m_builder->cmd(mousebtn::SCROLL_DOWN, string{EVENT_SCROLLDOWN}, m_scroll && m_percentage > 0); + m_builder->cmd(mousebtn::SCROLL_UP, string{EVENT_SCROLLUP}, scroll_up); + m_builder->cmd(mousebtn::SCROLL_DOWN, string{EVENT_SCROLLDOWN}, scroll_down); m_builder->append(output); + m_builder->cmd_close(scroll_down); + m_builder->cmd_close(scroll_up); + return m_builder->flush(); }