From b02b032942338667196c71d811530e5584e06113 Mon Sep 17 00:00:00 2001 From: Kevin Leung Date: Thu, 9 Sep 2021 09:59:52 +0800 Subject: [PATCH] Don't use signal select for now see: https://github.com/haxetink/tink_core/issues/164 --- src/why/dbus/client/Interface.hx | 13 +++++-------- src/why/dbus/client/Property.hx | 14 ++++++-------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/why/dbus/client/Interface.hx b/src/why/dbus/client/Interface.hx index d45ab59..b3ef1fa 100644 --- a/src/why/dbus/client/Interface.hx +++ b/src/why/dbus/client/Interface.hx @@ -15,19 +15,16 @@ class InterfaceBase { function __signal(iface:String, member:String, signature:SignatureCode):Signal { return new Signal(cb -> { - final binding = object.destination.transport.signals.select( - message -> { - return if( + final binding = object.destination.transport.signals.handle( + message -> + if( (object.path == null || message.path == object.path) && message.iface == iface && message.member == member && message.signature == signature ) - Some(cast message.body); - else - None; - } - ).handle(cb); + cb(cast message.body) + ); final registrar = object.destination.sibling('org.freedesktop.DBus').getObject('/org/freedesktop/DBus').getInterface(org.freedesktop.DBus); final rule = new why.dbus.MatchRule({type: Signal, sender: object.destination.name, path: object.path, iface: iface, member: member}).toString(); diff --git a/src/why/dbus/client/Property.hx b/src/why/dbus/client/Property.hx index dc57ba5..e215425 100644 --- a/src/why/dbus/client/Property.hx +++ b/src/why/dbus/client/Property.hx @@ -19,16 +19,14 @@ class Property implements ReadWriteProperty { this.name = name; this.signature = signature; this.optional = optional; - this.changed = properties.propertiesChanged.select(v -> { - if(v.v0 == iface) { - switch v.v1.get(name) { - case null: None; - case variant: Some((variant.value:T)); + this.changed = new Signal(cb -> properties.propertiesChanged.handle((iface, updated, invalidated) -> { + if(iface == this.iface) { + switch updated.get(name) { + case null: // skip + case variant: cb((variant.value:T)); } - } else { - None; } - }); + })); } public function get():Promise {