Merge lp:~mterry/powerd/consistent-state into lp:powerd

Proposed by Michael Terry
Status: Merged
Approved by: Oliver Grawert
Approved revision: 125
Merged at revision: 125
Proposed branch: lp:~mterry/powerd/consistent-state
Merge into: lp:powerd
Diff against target: 69 lines (+8/-5)
4 files modified
src/display-request.c (+0/-1)
src/display.c (+2/-0)
src/powerd-internal.h (+2/-1)
src/powerd-object.c (+4/-3)
To merge this branch: bzr merge lp:~mterry/powerd/consistent-state
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
Oliver Grawert Approve
PS Jenkins bot continuous-integration Approve
Alberto Aguirre Pending
Review via email: mp+215761@code.launchpad.net

Commit message

Emit display state changed signals any time state changes, not just when requested state changes.

Description of the change

Emit display state changed signals any time state changes, not just when requested state changes.

Without this, we don't emit a changed signal on power button presses if we have an existing display-on request. Which was stopping autopilot from being able to lock unity8 by simulating a power button press (jenkins keeps screen from timing out with powerd-cli, unity8 listens for the display state changed signal to lock).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Oliver Grawert (ogra) wrote :

i see no ill effects with that patch applied, approving

review: Approve
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Code if fine, and works as expected, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/display-request.c'
--- src/display-request.c 2013-08-12 04:45:17 +0000
+++ src/display-request.c 2014-04-14 21:20:04 +0000
@@ -78,7 +78,6 @@
78 new_state.state, new_state.flags);78 new_state.state, new_state.flags);
79 internal_state = new_state;79 internal_state = new_state;
80 powerd_set_display_state(&internal_state);80 powerd_set_display_state(&internal_state);
81 powerd_display_state_signal_emit(&internal_state);
82}81}
8382
84static void __add_request(struct powerd_display_request *req)83static void __add_request(struct powerd_display_request *req)
8584
=== modified file 'src/display.c'
--- src/display.c 2014-03-28 21:30:25 +0000
+++ src/display.c 2014-04-14 21:20:04 +0000
@@ -270,6 +270,8 @@
270 }270 }
271271
272 actual_screen_state = applied_state;272 actual_screen_state = applied_state;
273
274 powerd_display_state_signal_emit(actual_screen_state, req->flags);
273}275}
274276
275static void update_flags(guint32 flags)277static void update_flags(guint32 flags)
276278
=== modified file 'src/powerd-internal.h'
--- src/powerd-internal.h 2014-03-26 12:36:15 +0000
+++ src/powerd-internal.h 2014-04-14 21:20:04 +0000
@@ -140,7 +140,8 @@
140enum SysPowerStates current_system_power_state(void);140enum SysPowerStates current_system_power_state(void);
141const gchar * state_to_string(int state);141const gchar * state_to_string(int state);
142void powerd_sys_state_signal_emit(enum SysPowerStates state);142void powerd_sys_state_signal_emit(enum SysPowerStates state);
143void powerd_display_state_signal_emit(struct powerd_display_request *req);143void powerd_display_state_signal_emit(enum powerd_display_state state,
144 guint32 flags);
144void clear_sys_state_by_owner(const char *owner);145void clear_sys_state_by_owner(const char *owner);
145gboolean powerd_suspend_active(void);146gboolean powerd_suspend_active(void);
146147
147148
=== modified file 'src/powerd-object.c'
--- src/powerd-object.c 2014-03-26 12:36:15 +0000
+++ src/powerd-object.c 2014-04-14 21:20:04 +0000
@@ -234,7 +234,8 @@
234}234}
235235
236void236void
237powerd_display_state_signal_emit(struct powerd_display_request *req)237powerd_display_state_signal_emit(enum powerd_display_state state,
238 guint32 flags)
238{239{
239 GError *error = NULL;240 GError *error = NULL;
240241
@@ -243,14 +244,14 @@
243 return;244 return;
244245
245 powerd_debug("Emitting signal for display state change: state=%d flags=0x%08x",246 powerd_debug("Emitting signal for display state change: state=%d flags=0x%08x",
246 req->state, req->flags);247 state, flags);
247 g_dbus_connection_emit_signal(248 g_dbus_connection_emit_signal(
248 POWERD_SOURCE_GET_PRIVATE(powerd_source)->system_bus,249 POWERD_SOURCE_GET_PRIVATE(powerd_source)->system_bus,
249 NULL, /* destination */250 NULL, /* destination */
250 "/com/canonical/powerd",251 "/com/canonical/powerd",
251 "com.canonical.powerd",252 "com.canonical.powerd",
252 "DisplayPowerStateChange",253 "DisplayPowerStateChange",
253 g_variant_new("(iu)", req->state, req->flags),254 g_variant_new("(iu)", state, flags),
254 &error);255 &error);
255 if (error) {256 if (error) {
256 powerd_warn("Unable to signal a state change update: %s", error->message);257 powerd_warn("Unable to signal a state change update: %s", error->message);

Subscribers

People subscribed via source and target branches