mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-03 03:31:03 +02:00
fix(regression): GTK refactor causing updates to be missed
Regression introduced by recent GTK refactor. The `glib_recv` macros previously using the passed in expression as the receiver, which was causing a new receiver to be created *every* time an event was received. This caused some peculiar behaviours where some events just never got through if sent too close to each other. This was most obvious in the `workspaces` module. Fixes #381
This commit is contained in:
parent
b2a37a32b0
commit
b4d75450ac
14 changed files with 27 additions and 23 deletions
|
@ -145,7 +145,7 @@ impl Module<Button> for ClipboardModule {
|
|||
fn into_popup(
|
||||
self,
|
||||
tx: mpsc::Sender<Self::ReceiveMessage>,
|
||||
mut rx: broadcast::Receiver<Self::SendMessage>,
|
||||
rx: broadcast::Receiver<Self::SendMessage>,
|
||||
_info: &ModuleInfo,
|
||||
) -> Option<gtk::Box>
|
||||
where
|
||||
|
|
|
@ -110,7 +110,7 @@ impl Module<Button> for ClockModule {
|
|||
let format = self.format.clone();
|
||||
let locale = Locale::try_from(self.locale.as_str()).unwrap_or(Locale::POSIX);
|
||||
|
||||
let mut rx = context.subscribe();
|
||||
let rx = context.subscribe();
|
||||
glib_recv!(rx, date => {
|
||||
let date_string = format!("{}", date.format_localized(&format, locale));
|
||||
label.set_label(&date_string);
|
||||
|
@ -126,7 +126,7 @@ impl Module<Button> for ClockModule {
|
|||
fn into_popup(
|
||||
self,
|
||||
_tx: mpsc::Sender<Self::ReceiveMessage>,
|
||||
mut rx: broadcast::Receiver<Self::SendMessage>,
|
||||
rx: broadcast::Receiver<Self::SendMessage>,
|
||||
_info: &ModuleInfo,
|
||||
) -> Option<gtk::Box> {
|
||||
let container = gtk::Box::new(Orientation::Vertical, 0);
|
||||
|
|
|
@ -47,7 +47,7 @@ impl CustomWidget for ProgressWidget {
|
|||
let script = Script::from(value);
|
||||
let progress = progress.clone();
|
||||
|
||||
let (tx, mut rx) = mpsc::channel(128);
|
||||
let (tx, rx) = mpsc::channel(128);
|
||||
|
||||
spawn(async move {
|
||||
script
|
||||
|
|
|
@ -106,7 +106,7 @@ impl CustomWidget for SliderWidget {
|
|||
let script = Script::from(value);
|
||||
let scale = scale.clone();
|
||||
|
||||
let (tx, mut rx) = mpsc::channel(128);
|
||||
let (tx, rx) = mpsc::channel(128);
|
||||
|
||||
spawn(async move {
|
||||
script
|
||||
|
|
|
@ -337,7 +337,7 @@ impl Module<gtk::Box> for LauncherModule {
|
|||
let mut buttons = IndexMap::<String, ItemButton>::new();
|
||||
|
||||
let tx = context.tx.clone();
|
||||
let mut rx = context.subscribe();
|
||||
let rx = context.subscribe();
|
||||
glib_recv!(rx, event => {
|
||||
match event {
|
||||
LauncherUpdate::AddItem(item) => {
|
||||
|
@ -428,7 +428,7 @@ impl Module<gtk::Box> for LauncherModule {
|
|||
fn into_popup(
|
||||
self,
|
||||
controller_tx: mpsc::Sender<Self::ReceiveMessage>,
|
||||
mut rx: broadcast::Receiver<Self::SendMessage>,
|
||||
rx: broadcast::Receiver<Self::SendMessage>,
|
||||
_info: &ModuleInfo,
|
||||
) -> Option<gtk::Box> {
|
||||
const MAX_WIDTH: i32 = 250;
|
||||
|
|
|
@ -256,7 +256,7 @@ fn register_popup_content(
|
|||
/// and communicating update messages between controllers and widgets/popups.
|
||||
fn setup_receiver<TSend>(
|
||||
tx: broadcast::Sender<TSend>,
|
||||
mut rx: mpsc::Receiver<ModuleUpdateEvent<TSend>>,
|
||||
rx: mpsc::Receiver<ModuleUpdateEvent<TSend>>,
|
||||
popup: Rc<RefCell<Popup>>,
|
||||
name: &'static str,
|
||||
id: usize,
|
||||
|
|
|
@ -214,7 +214,7 @@ impl Module<Button> for MusicModule {
|
|||
let button = button.clone();
|
||||
|
||||
let tx = context.tx.clone();
|
||||
let mut rx = context.subscribe();
|
||||
let rx = context.subscribe();
|
||||
|
||||
glib_recv!(rx, event => {
|
||||
let ControllerEvent::Update(mut event) = event else {
|
||||
|
@ -263,7 +263,7 @@ impl Module<Button> for MusicModule {
|
|||
fn into_popup(
|
||||
self,
|
||||
tx: mpsc::Sender<Self::ReceiveMessage>,
|
||||
mut rx: broadcast::Receiver<Self::SendMessage>,
|
||||
rx: broadcast::Receiver<Self::SendMessage>,
|
||||
info: &ModuleInfo,
|
||||
) -> Option<gtk::Box> {
|
||||
let icon_theme = info.icon_theme;
|
||||
|
|
|
@ -181,7 +181,7 @@ impl Module<gtk::Button> for UpowerModule {
|
|||
label.set_angle(info.bar_position.get_angle());
|
||||
let format = self.format.clone();
|
||||
|
||||
let mut rx = context.subscribe();
|
||||
let rx = context.subscribe();
|
||||
glib_recv!(rx, properties => {
|
||||
let format = format.replace("{percentage}", &properties.percentage.to_string());
|
||||
let icon_name = String::from("icon:") + &properties.icon_name;
|
||||
|
@ -203,7 +203,7 @@ impl Module<gtk::Button> for UpowerModule {
|
|||
fn into_popup(
|
||||
self,
|
||||
_tx: mpsc::Sender<Self::ReceiveMessage>,
|
||||
mut rx: broadcast::Receiver<Self::SendMessage>,
|
||||
rx: broadcast::Receiver<Self::SendMessage>,
|
||||
_info: &ModuleInfo,
|
||||
) -> Option<gtk::Box>
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue