aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/notifications.cpp6
-rw-r--r--tests/notification-fixture.h2
-rw-r--r--tests/test-sound.cpp10
3 files changed, 18 insertions, 0 deletions
diff --git a/src/notifications.cpp b/src/notifications.cpp
index b962e68..a2a1fc3 100644
--- a/src/notifications.cpp
+++ b/src/notifications.cpp
@@ -249,6 +249,10 @@ public:
const auto& d= info.m_duration;
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(d);
notify_notification_set_timeout (nn.get (), ms.count ());
+ // Lomiri has its own logic regarding timeout.
+ notify_notification_set_hint (nn.get(),
+ HINT_LOMIRI_TIMEOUT,
+ g_variant_new_int32(ms.count()));
}
for (const auto& hint : info.m_string_hints)
@@ -509,6 +513,8 @@ private:
// server capabilities.
// as the name indicates, don't use this directly: use server_caps() instead
mutable std::set<std::string> m_lazy_caps;
+
+ static constexpr char const * HINT_LOMIRI_TIMEOUT {"x-lomiri-snap-decisions-timeout"};
};
/***
diff --git a/tests/notification-fixture.h b/tests/notification-fixture.h
index 33bcd7e..7dcc8bf 100644
--- a/tests/notification-fixture.h
+++ b/tests/notification-fixture.h
@@ -77,6 +77,8 @@ protected:
static constexpr char const * SIGNAL_CLOSED {"NotificationClosed"};
+ static constexpr char const * HINT_LOMIRI_TIMEOUT {"x-lomiri-snap-decisions-timeout"};
+
static constexpr char const * AS_BUSNAME {"org.freedesktop.Accounts"};
static constexpr char const * AS_INTERFACE {"com.lomiri.touch.AccountsService.Sound"};
static constexpr char const * PROP_OTHER_VIBRATIONS {"OtherVibrate"};
diff --git a/tests/test-sound.cpp b/tests/test-sound.cpp
index 19dffe3..db1402a 100644
--- a/tests/test-sound.cpp
+++ b/tests/test-sound.cpp
@@ -100,6 +100,16 @@ TEST_F(NotificationFixture, InteractiveDuration)
g_variant_get_child (params, 7, "i", &i32);
const auto duration = std::chrono::minutes(duration_minutes);
EXPECT_EQ(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(), i32);
+
+ // Due to custom logic in Lomiri, also make sure custom timeout hint is set.
+ bool b;
+ auto hints = g_variant_get_child_value (params, 6);
+ i32 = 0;
+ b = g_variant_lookup (hints, HINT_LOMIRI_TIMEOUT, "i", &i32);
+ EXPECT_TRUE(b);
+ EXPECT_EQ(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(), i32);
+ g_variant_unref(hints);
+
ne.reset();
}