aboutsummaryrefslogtreecommitdiff
path: root/src/awake.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-03-31 13:54:26 -0500
committerCharles Kerr <charles.kerr@canonical.com>2015-03-31 13:54:26 -0500
commit845067b3f37ff48eab3b612d52518e529559b738 (patch)
tree94f6104d71d25f2c000d4fa67880b895ab71c90e /src/awake.cpp
parent4bf70c7afae44d4005d25105690304b4e9e361f3 (diff)
downloadayatana-indicator-datetime-845067b3f37ff48eab3b612d52518e529559b738.tar.gz
ayatana-indicator-datetime-845067b3f37ff48eab3b612d52518e529559b738.tar.bz2
ayatana-indicator-datetime-845067b3f37ff48eab3b612d52518e529559b738.zip
simplify the awake display timeout code
Diffstat (limited to 'src/awake.cpp')
-rw-r--r--src/awake.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/awake.cpp b/src/awake.cpp
index a37d185..e1bec6c 100644
--- a/src/awake.cpp
+++ b/src/awake.cpp
@@ -36,10 +36,9 @@ class Awake::Impl
{
public:
- Impl(const std::string& app_name, unsigned int display_on_seconds):
+ Impl(const std::string& app_name):
m_app_name(app_name),
- m_cancellable(g_cancellable_new()),
- m_display_on_seconds(display_on_seconds)
+ m_cancellable(g_cancellable_new())
{
g_bus_get(G_BUS_TYPE_SYSTEM, m_cancellable, on_system_bus_ready, this);
}
@@ -251,9 +250,19 @@ private:
GCancellable * m_cancellable = nullptr;
GDBusConnection * m_system_bus = nullptr;
char * m_awake_cookie = nullptr;
+
+ /**
+ * As described by bug #1434637, alarms should have the display turn on,
+ * dim, and turn off "just like it would if you'd woken it up yourself".
+ * USC may be adding an intent-based bus API to handle this use case,
+ * e.g. turnDisplayOnTemporarily(intent), but there's no timeframe for it.
+ *
+ * Until that's avaialble, we can get close to Design's specs by
+ * requesting a display-on cookie and then releasing the cookie
+ * a moment later. */
+ const guint m_display_on_seconds = 1;
+ guint m_display_on_timer = 0;
int32_t m_display_on_cookie = NO_DISPLAY_ON_COOKIE;
- const guint m_display_on_seconds;
- guint m_display_on_timer;
static constexpr int32_t NO_DISPLAY_ON_COOKIE { std::numeric_limits<int32_t>::min() };
};
@@ -262,8 +271,8 @@ private:
****
***/
-Awake::Awake(const std::string& app_name, unsigned int display_on_seconds):
- impl(new Impl (app_name, display_on_seconds))
+Awake::Awake(const std::string& app_name):
+ impl(new Impl(app_name))
{
}