Skip to content

Commit

Permalink
Support for locking the touch screen without blanking the display
Browse files Browse the repository at this point in the history
  • Loading branch information
Vesa Halttunen committed Oct 31, 2012
1 parent cd1e2bf commit 3741a15
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mce.h
Expand Up @@ -213,7 +213,9 @@ typedef enum {
/** Enable proximity lock (no UI); write only */
LOCK_ON_PROXIMITY = 5,
/** Toggle lock state; write only */
LOCK_TOGGLE = 6
LOCK_TOGGLE = 6,
/** Delayed lock; write only */
LOCK_ON_DELAYED = 7
} lock_state_t;

/** Battery status */
Expand Down
11 changes: 11 additions & 0 deletions tklock.c
Expand Up @@ -1722,6 +1722,7 @@ static void set_tklock_state(lock_state_t lock_state)
case LOCK_ON:
case LOCK_ON_DIMMED:
case LOCK_ON_PROXIMITY:
case LOCK_ON_DELAYED:
if (((submode & MCE_BOOTUP_SUBMODE) != 0) &&
(is_malf_state_enabled() == FALSE) &&
((lock_state != LOCK_ON_PROXIMITY) ||
Expand Down Expand Up @@ -1784,6 +1785,14 @@ static void set_tklock_state(lock_state_t lock_state)
setup_tklock_visual_blank_timeout();
break;

case LOCK_ON_DELAYED:
synthesise_inactivity();
enable_tklock();

saved_tklock_state = MCE_TKLOCK_LOCKED_STATE;
setup_tklock_visual_blank_timeout();
break;

case LOCK_TOGGLE:
/* Touchscreen/keypad lock */
if ((is_tklock_enabled() == FALSE) ||
Expand Down Expand Up @@ -1931,6 +1940,8 @@ static gboolean tklock_mode_change_req_dbus_cb(DBusMessage *const msg)
set_tklock_state(LOCK_ON);
} else if (!strcmp(MCE_TK_LOCKED_DIM, mode)) {
set_tklock_state(LOCK_ON_DIMMED);
} else if (!strcmp(MCE_TK_LOCKED_DELAY, mode)) {
set_tklock_state(LOCK_ON_DELAYED);
} else if (!strcmp(MCE_TK_UNLOCKED, mode)) {
set_tklock_state(LOCK_OFF);

Expand Down
3 changes: 2 additions & 1 deletion tools/mcetool.c
Expand Up @@ -221,6 +221,7 @@ static void usage(void)
" valid modes are:\n"
" ``locked'', "
"``locked-dim'',\n"
" ``locked-delay'',\n"
" and ``unlocked''\n"
" --enable-led enable LED framework\n"
" --disable-led disable LED framework\n"
Expand Down Expand Up @@ -852,7 +853,7 @@ static void mcetool_dbus_exit(void)
* Enable/disable the tklock
*
* @param mode The mode to change to; valid modes:
* "locked", "locked-dim", "unlocked"
* "locked", "locked-dim", "locked-delay", "unlocked"
* @return TRUE on success, FALSE on FAILURE
*/
static gboolean set_tklock_mode(gchar **mode)
Expand Down

0 comments on commit 3741a15

Please sign in to comment.