From 5259d33cd68ff52b95def1666b3bf9b704f6e456 Mon Sep 17 00:00:00 2001 From: Auri Date: Thu, 11 Mar 2021 15:36:36 -0800 Subject: [PATCH] Fix scroll offsetting streams from source. Bump version to 1.1.1. --- Cargo.toml | 2 +- src/window/about.rs | 2 +- src/window/myxer.rs | 111 ++++++------------------------------------- src/window/style.css | 8 +--- 4 files changed, 18 insertions(+), 105 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 351fa13..435e1eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "myxer" -version = "1.1.0" +version = "1.1.1" description = "A modern Volume Mixer for PulseAudio" readme = "README.md" license = "GPL-3.0" diff --git a/src/window/about.rs b/src/window/about.rs index fae778d..b6d586e 100644 --- a/src/window/about.rs +++ b/src/window/about.rs @@ -4,7 +4,7 @@ pub fn about() { let about = gtk::AboutDialog::new(); about.set_logo_icon_name(Some("multimedia-volume-control")); about.set_program_name("Myxer"); - about.set_version(Some("1.1.0")); + about.set_version(Some("1.1.1")); about.set_comments(Some("A modern Volume Mixer for PulseAudio.")); about.set_website(Some("https://myxer.aurailus.com")); about.set_copyright(Some("© 2021 Auri Collings")); diff --git a/src/window/myxer.rs b/src/window/myxer.rs index 63d5451..c4128be 100644 --- a/src/window/myxer.rs +++ b/src/window/myxer.rs @@ -83,7 +83,6 @@ impl Myxer { let header = gtk::HeaderBar::new(); let stack = gtk::Stack::new(); - // Window Config & Header Bar { window.set_title("Volume Mixer"); window.set_icon_name(Some("multimedia-volume-control")); @@ -116,7 +115,6 @@ impl Myxer { window.set_titlebar(Some(&header)); } - // Preferences Button & Popup Menu { let prefs_button = gtk::Button::from_icon_name(Some("open-menu-symbolic"), gtk::IconSize::SmallToolbar); prefs_button.get_style_context().add_class("flat"); @@ -149,11 +147,6 @@ impl Myxer { prefs_box.pack_start(>k::Separator::new(gtk::Orientation::Horizontal), false, false, 4); - // let help = gtk::ModelButton::new(); - // help.set_property_text(Some("Help")); - // help.set_action_name(Some("app.help")); - // prefs_box.add(&help); - let about = gtk::ModelButton::new(); about.set_property_text(Some("About Myxer")); about.set_action_name(Some("app.about")); @@ -163,58 +156,12 @@ impl Myxer { prefs_button.connect_clicked(move |_| prefs.popup()); } - // Connect Pulse - pulse.borrow_mut().connect(); - let meters = Shared::new(Meters::new(pulse)); - // Window Contents { let output = gtk::Box::new(gtk::Orientation::Horizontal, 0); - { - // let pulse_clone = pulse.clone(); - // let meters_clone = meters.clone(); - // meters.borrow_mut().sink.connect_label_clicked(move |_| { - // let menu = gtk::Menu::new(); - // let pulse = pulse_clone.borrow(); - - // let mut last: Option = None; - // for (i, v) in pulse.sinks.iter() { - // let button = gtk::RadioMenuItem::with_label(v.data.description.as_str()); - // if let Some(last) = last { button.join_group(Some(&last)) } - // last = Some(button.clone()); - // menu.add(&button); - - // if let Some(a) = meters_clone.borrow().active_sink { - // if a == *i { button.set_active(true) } - // } - - // let i = *i; - // let meters = meters_clone.clone(); - // button.connect_toggled(move |c| { - // if !c.get_active() { return } - // meters.borrow_mut().set_active_sink(i); - // }); - // } - - // menu.add(>k::SeparatorMenuItem::new()); - - // let name = meters_clone.borrow().sink.get_name().to_owned(); - // let button = gtk::CheckMenuItem::with_label("Default Output Device"); - // button.set_active(name == pulse.default_sink); - // button.set_sensitive(!button.get_active()); - // let pulse = pulse_clone.clone(); - // button.connect_toggled(move |_| pulse.borrow().set_default_sink(&name)); - // menu.add(&button); - - // menu.show_all(); - // menu.popup_easy(0, 0); - // }); - - output.pack_start(&meters.borrow_mut().sink_box, false, false, 0); - // output.set_border_width(4); - } + output.pack_start(&meters.borrow_mut().sink_box, false, false, 0); output.pack_start(>k::Separator::new(gtk::Orientation::Vertical), false, true, 0); @@ -225,48 +172,7 @@ impl Myxer { output_scroller.add(&meters.borrow().sink_inputs_box); let input = gtk::Box::new(gtk::Orientation::Horizontal, 0); - { - // let pulse_clone = pulse.clone(); - // let meters_clone = meters.clone(); - // meters.borrow_mut().source.connect_label_clicked(move |_| { - // let menu = gtk::Menu::new(); - // let pulse = pulse_clone.borrow(); - - // let mut last: Option = None; - // for (i, v) in pulse.sources.iter() { - // let button = gtk::RadioMenuItem::with_label(v.data.description.as_str()); - // if let Some(last) = last { button.join_group(Some(&last)) } - // last = Some(button.clone()); - // menu.add(&button); - - // if let Some(a) = meters_clone.borrow().active_source { - // if a == *i { button.set_active(true) } - // } - - // let i = *i; - // let meters = meters_clone.clone(); - // button.connect_toggled(move |c| { - // if !c.get_active() { return } - // meters.borrow_mut().set_active_source(i); - // }); - // } - - // menu.add(>k::SeparatorMenuItem::new()); - - // let name = meters_clone.borrow().source.get_name().to_owned(); - // let button = gtk::CheckMenuItem::with_label("Default Input Device"); - // button.set_active(name == pulse.default_source); - // button.set_sensitive(!button.get_active()); - // let pulse = pulse_clone.clone(); - // button.connect_toggled(move |_| pulse.borrow().set_default_source(&name)); - // menu.add(&button); - - // menu.show_all(); - // menu.popup_easy(0, 0); - // }); - - input.pack_start(&meters.borrow_mut().source_box, false, false, 0); - } + input.pack_start(&meters.borrow_mut().source_box, false, false, 0); input.pack_start(>k::Separator::new(gtk::Orientation::Vertical), false, true, 0); @@ -285,7 +191,6 @@ impl Myxer { let profiles = Shared::new(Container { profiles: None }); - // Actions { let actions = gio::SimpleActionGroup::new(); window.insert_action_group("app", Some(&actions)); @@ -328,10 +233,22 @@ impl Myxer { if self.pulse.borrow_mut().update() { let pulse = self.pulse.borrow(); + let mut meters = self.meters.borrow_mut(); + + let offset = meters.sink.widget.get_allocation().height + + meters.sink.widget.get_margin_bottom() - meters.sink_inputs_box.get_allocation().height; + if offset != meters.sink.widget.get_margin_bottom() { meters.sink.widget.set_margin_bottom(offset) } + + let offset = meters.source.widget.get_allocation().height + + meters.source.widget.get_margin_bottom() - meters.source_outputs_box.get_allocation().height; + if offset != meters.source.widget.get_margin_bottom() { meters.source.widget.set_margin_bottom(offset) } + + let show = meters.show_visualizers; let separate = meters.separate_channels; + if let Some(sink) = pulse.sinks.get(&pulse.active_sink) { meters.sink.set_data(&sink.data); meters.sink.split_channels(separate); diff --git a/src/window/style.css b/src/window/style.css index e6c426c..a1aad0a 100644 --- a/src/window/style.css +++ b/src/window/style.css @@ -32,10 +32,6 @@ headerbar box:last-child separator { border-image-source: none; } -scrollbar { - border-color: @border_color; -} - /* At some point, figure out how to replace the hardcoded values with theme colors. */ @@ -68,7 +64,7 @@ Value should be dynamically determined later. */ } #meter #app_label { - padding: 0 4px; + padding: 0 3px; } #meter #app_select { @@ -87,7 +83,7 @@ Value should be dynamically determined later. */ } #meter #mute_toggle label { - margin-left: 4px; + margin-left: 3px; } #meter #mute_toggle.muted {