Skip to content

Commit

Permalink
[display] Use disable-blanking-from-lockscreen setting. MER#1542
Browse files Browse the repository at this point in the history
When display and tklock modules were rewritten, all blanking timers
were moved from tklock.c to modules/display.c. However the functionality
dealing with setting for disabling timer based blanking from lockscreen
was accidentally left behind in the tklock module rendering the whole
setting useless.

Move the setting logic to display module and remove old FIXME note.
  • Loading branch information
spiiroin committed Mar 11, 2016
1 parent ba4e26d commit e463be6
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 38 deletions.
24 changes: 24 additions & 0 deletions .depend
Expand Up @@ -607,6 +607,8 @@ modules/display.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.h\

modules/display.pic.o:\
Expand All @@ -626,6 +628,8 @@ modules/display.pic.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.h\

modules/doubletap.o:\
Expand Down Expand Up @@ -961,6 +965,8 @@ tests/ut/ut_display.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand All @@ -982,6 +988,8 @@ tests/ut/ut_display.pic.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand All @@ -1004,6 +1012,8 @@ tests/ut/ut_display_blanking_inhibit.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand All @@ -1026,6 +1036,8 @@ tests/ut/ut_display_blanking_inhibit.pic.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand All @@ -1048,6 +1060,8 @@ tests/ut/ut_display_conf.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand All @@ -1070,6 +1084,8 @@ tests/ut/ut_display_conf.pic.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand All @@ -1092,6 +1108,8 @@ tests/ut/ut_display_filter.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand All @@ -1114,6 +1132,8 @@ tests/ut/ut_display_filter.pic.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand All @@ -1136,6 +1156,8 @@ tests/ut/ut_display_stm.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand All @@ -1158,6 +1180,8 @@ tests/ut/ut_display_stm.pic.o:\
mce-sensorfw.h\
mce-worker.h\
mce.h\
mce.h\
tklock.h\
modules/display.c\
modules/display.h\
tests/ut/common.h\
Expand Down
31 changes: 30 additions & 1 deletion modules/display.c
Expand Up @@ -31,6 +31,7 @@
#include "../mce-gconf.h"
#include "../mce-dbus.h"
#include "../mce-sensorfw.h"
#include "../tklock.h"
#ifdef ENABLE_HYBRIS
# include "../mce-hybris.h"
#endif
Expand Down Expand Up @@ -890,6 +891,10 @@ static gint mdy_blanking_pause_mode = DEFAULT_BLANKING_PAUSE_MODE;
/** GConf callback ID for mdy_blanking_pause_mode */
static guint mdy_blanking_pause_mode_gconf_cb_id = 0;

/** Flag: Disable automatic blanking from lockscreen */
static gint mdy_blanking_from_tklock_disabled = DEFAULT_TK_AUTO_BLANK_DISABLE;
static guint mdy_blanking_from_tklock_disabled_gconf_cb_id = 0;

/** Display blanking timeout setting */
static gint mdy_blank_timeout = DEFAULT_BLANK_TIMEOUT;

Expand Down Expand Up @@ -4315,6 +4320,9 @@ static void mdy_blanking_rethink_timers(bool force)
break;
if( mdy_blanking_inhibit_off_p() )
break;
if( tklock_mode && mdy_blanking_from_tklock_disabled )
break;

mdy_blanking_schedule_off();
break;

Expand Down Expand Up @@ -4343,7 +4351,7 @@ static void mdy_blanking_rethink_timers(bool force)
break;
}

if( tklock_mode ) {
if( tklock_mode && !mdy_blanking_from_tklock_disabled ) {
mdy_blanking_schedule_off();
break;
}
Expand Down Expand Up @@ -9015,6 +9023,16 @@ static void mdy_gconf_cb(GConfClient *const gcc, const guint id,
mdy_blanking_remove_pause_clients();
}
}
else if( id == mdy_blanking_from_tklock_disabled_gconf_cb_id ) {
gint old = mdy_blanking_from_tklock_disabled;
mdy_blanking_from_tklock_disabled = gconf_value_get_int(gcv);

if( mdy_blanking_from_tklock_disabled != old ) {
mce_log(LL_NOTICE, "blanking from lockscreen disabled: %d -> %d",
old, mdy_blanking_from_tklock_disabled);
mdy_blanking_rethink_timers(true);
}
}
else if (id == mdy_orientation_sensor_enabled_gconf_cb_id) {
mdy_orientation_sensor_enabled = gconf_value_get_bool(gcv);
mdy_orientation_sensor_rethink();
Expand Down Expand Up @@ -9392,6 +9410,14 @@ static void mdy_gconf_init(void)
DEFAULT_BLANKING_PAUSE_MODE,
mdy_gconf_cb,
&mdy_blanking_pause_mode_gconf_cb_id);

/* Config tracking for disabling automatic screen dimming/blanking
* while showing lockscreen. */
mce_gconf_track_int(MCE_GCONF_TK_AUTO_BLANK_DISABLE_PATH,
&mdy_blanking_from_tklock_disabled,
DEFAULT_TK_AUTO_BLANK_DISABLE,
mdy_gconf_cb,
&mdy_blanking_from_tklock_disabled_gconf_cb_id);
}

static void mdy_gconf_quit(void)
Expand Down Expand Up @@ -9494,6 +9520,9 @@ static void mdy_gconf_quit(void)
mce_gconf_notifier_remove(mdy_blanking_pause_mode_gconf_cb_id),
mdy_blanking_pause_mode_gconf_cb_id = 0;

mce_gconf_notifier_remove(mdy_blanking_from_tklock_disabled_gconf_cb_id),
mdy_blanking_from_tklock_disabled_gconf_cb_id = 0;

/* Free dynamic data obtained from config */

g_slist_free(mdy_possible_dim_timeouts), mdy_possible_dim_timeouts = 0;
Expand Down
37 changes: 0 additions & 37 deletions tklock.c
Expand Up @@ -469,11 +469,6 @@ static guint volkey_policy_cb_id = 0;
static gint touchscreen_gesture_enable_mode = DBLTAP_ENABLE_DEFAULT;
static guint touchscreen_gesture_enable_mode_cb_id = 0;

/** Flag: Disable automatic dim/blank from tklock */
static gint tklock_blank_disable = DEFAULT_TK_AUTO_BLANK_DISABLE;
/** GConf notifier id for tracking tklock_blank_disable changes */
static guint tklock_blank_disable_id = 0;

/** Lid sensor open actions */
static gint tklock_lid_open_actions = DEFAULT_LID_OPEN_ACTION;
/** GConf callback ID for tklock_lid_open_actions */
Expand Down Expand Up @@ -4677,27 +4672,6 @@ static void tklock_gconf_cb(GConfClient *const gcc, const guint id,
tklock_kbd_close_actions = gconf_value_get_int(gcv);
tklock_gconf_sanitize_kbd_close_actions();
}
else if( id == tklock_blank_disable_id ) {
gint old = tklock_blank_disable;

tklock_blank_disable = gconf_value_get_int(gcv);

mce_log(LL_NOTICE, "tklock_blank_disable: %d -> %d",
old, tklock_blank_disable);

#if 0 // FIXME: this needs to be handled at modules/display.c
if( tklock_blank_disable == old ) {
// no need to change the timers
}
else if( tklock_visual_blank_timeout_cb_id ) {
setup_tklock_visual_blank_timeout();
}
else if( tklock_dim_timeout_cb_id ) {
setup_tklock_dim_timeout();
}
#endif

}
else if( id == touchscreen_gesture_enable_mode_cb_id ) {
gint old = touchscreen_gesture_enable_mode;
touchscreen_gesture_enable_mode = gconf_value_get_int(gcv);
Expand Down Expand Up @@ -4801,14 +4775,6 @@ static void tklock_gconf_cb(GConfClient *const gcc, const guint id,
*/
static void tklock_gconf_init(void)
{
/* Config tracking for disabling automatic screen dimming/blanking
* while showing lockscreen. */
mce_gconf_track_int(MCE_GCONF_TK_AUTO_BLANK_DISABLE_PATH,
&tklock_blank_disable,
DEFAULT_TK_AUTO_BLANK_DISABLE,
tklock_gconf_cb,
&tklock_blank_disable_id);

/* Touchscreen/keypad autolock enabled */
mce_gconf_track_bool(MCE_GCONF_TK_AUTOLOCK_ENABLED_PATH,
&tk_autolock_enabled,
Expand Down Expand Up @@ -5056,9 +5022,6 @@ static void tklock_gconf_quit(void)
mce_gconf_notifier_remove(tklock_autolock_delay_cb_id),
tklock_autolock_delay_cb_id = 0;

mce_gconf_notifier_remove(tklock_blank_disable_id),
tklock_blank_disable_id = 0;

mce_gconf_notifier_remove(touchscreen_gesture_enable_mode_cb_id),
touchscreen_gesture_enable_mode_cb_id = 0;

Expand Down

0 comments on commit e463be6

Please sign in to comment.