Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Middle pushbutton to power down

  • Loading branch information...
commit 22d1a10ed02872857c322cd1b42355a049820c4d 1 parent 91dcf3a
@sbourdeauducq sbourdeauducq authored
Showing with 19 additions and 6 deletions.
  1. +1 −1  src/input.c
  2. +18 −5 src/shortcuts.c
View
2  src/input.c
@@ -1,6 +1,6 @@
/*
* Flickernoise
- * Copyright (C) 2010 Sebastien Bourdeauducq
+ * Copyright (C) 2010, 2011 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
View
23 src/shortcuts.c
@@ -16,9 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <mtklib.h>
-#include <keycodes.h>
+#include <rtems.h>
#include <stdio.h>
+#include <keycodes.h>
+#include <mtklib.h>
#include "input.h"
#include "shutdown.h"
@@ -27,6 +28,8 @@
#include "fb.h"
static int ctrl, alt;
+static int f10_pressed;
+static rtems_interval f10_press_time;
static void switch_resolution()
{
@@ -47,6 +50,11 @@ static void shortcuts_callback(mtk_event *e, int count)
{
int i;
+ /* Handle long press on F10/middle pushbutton */
+ if(f10_pressed
+ && ((rtems_clock_get_ticks_since_boot() - f10_press_time) > 200))
+ clean_shutdown(1);
+
for(i=0;i<count;i++) {
if(e[i].type == EVENT_TYPE_PRESS) {
if(e[i].press.code == MTK_KEY_LEFTCTRL)
@@ -55,16 +63,21 @@ static void shortcuts_callback(mtk_event *e, int count)
alt = 1;
else if(ctrl && alt && (e[i].press.code == MTK_KEY_DELETE))
clean_shutdown(0);
- else if(ctrl && (e[i].press.code == MTK_KEY_F2))
- fbgrab(NULL);
else if(ctrl && (e[i].press.code == MTK_KEY_F1))
switch_resolution();
+ else if(ctrl && (e[i].press.code == MTK_KEY_F2))
+ fbgrab(NULL);
+ else if(e[i].press.code == MTK_KEY_F10) {
+ f10_pressed = 1;
+ f10_press_time = rtems_clock_get_ticks_since_boot();
+ }
} else if (e[i].type == EVENT_TYPE_RELEASE) {
if(e[i].release.code == MTK_KEY_LEFTCTRL)
ctrl = 0;
else if(e[i].release.code == MTK_KEY_LEFTALT)
alt = 0;
-
+ else if(e[i].release.code == MTK_KEY_F10)
+ f10_pressed = 0;
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.