1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-25 13:55:47 -05:00

fix(tray): Follow window fade

This commit is contained in:
Michael Carlberg 2016-12-16 07:10:45 +01:00
parent a7005be82c
commit 697638db2b
5 changed files with 17 additions and 1 deletions

View file

@ -80,6 +80,9 @@ namespace signals {
const ValueType* operator()() const {
return reinterpret_cast<const ValueType*>(&m_data);
}
const ValueType* data() const {
return reinterpret_cast<const ValueType*>(&m_data);
}
private:
char m_data[sizeof(ValueType)];
@ -112,6 +115,7 @@ namespace signals {
namespace ui {
DEFINE_VALUE_SIGNAL(50, button_press, string);
DEFINE_VALUE_SIGNAL(51, visibility_change, bool);
DEFINE_VALUE_SIGNAL(52, dim_window, double);
}
namespace parser {

View file

@ -25,6 +25,7 @@ namespace signals {
namespace ui {
struct button_press;
struct visibility_change;
struct dim_window;
}
namespace parser {
struct change_background;

View file

@ -63,7 +63,7 @@ struct tray_settings {
class tray_manager : public xpp::event::sink<evt::expose, evt::visibility_notify, evt::client_message,
evt::configure_request, evt::resize_request, evt::selection_clear, evt::property_notify,
evt::reparent_notify, evt::destroy_notify, evt::map_notify, evt::unmap_notify>,
public signal_receiver<SIGN_PRIORITY_TRAY, visibility_change> {
public signal_receiver<SIGN_PRIORITY_TRAY, visibility_change, dim_window> {
public:
using make_type = unique_ptr<tray_manager>;
static make_type make();
@ -128,6 +128,7 @@ class tray_manager : public xpp::event::sink<evt::expose, evt::visibility_notify
void handle(const evt::unmap_notify& evt);
bool on(const visibility_change& evt);
bool on(const dim_window& evt);
private:
connection& m_connection;

View file

@ -425,6 +425,7 @@ void bar::handle(const evt::enter_notify&) {
if (m_opts.dimmed) {
window win{m_connection, m_opts.window};
wm_util::set_wm_window_opacity(m_connection, m_opts.window, 1.0 * 0xFFFFFFFF);
m_sig.emit(dim_window{1.0});
m_opts.dimmed = false;
}
}
@ -439,6 +440,7 @@ void bar::handle(const evt::leave_notify&) {
if (!m_opts.dimmed) {
window win{m_connection, m_opts.window};
wm_util::set_wm_window_opacity(m_connection, m_opts.window, m_opts.dimvalue * 0xFFFFFFFF);
m_sig.emit(dim_window{double{m_opts.dimvalue}});
m_opts.dimmed = true;
}
}

View file

@ -1146,4 +1146,12 @@ bool tray_manager::on(const visibility_change& evt) {
return true;
}
bool tray_manager::on(const dim_window& evt) {
if (m_activated) {
wm_util::set_wm_window_opacity(m_connection, m_tray, *evt.data() * 0xFFFFFFFF);
}
// let the event bubble
return false;
}
POLYBAR_NS_END