Signed-off-by: Xiangfu Liu <[email protected]>
---
src/Makefile | 2 +-
src/main.c | 4 +-
src/reboot.c | 52 ---------------------------------------------------
src/reboot.h | 23 ----------------------
src/shortcuts.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/shortcuts.h | 23 ++++++++++++++++++++++
6 files changed, 82 insertions(+), 78 deletions(-)
delete mode 100644 src/reboot.c
delete mode 100644 src/reboot.h
create mode 100644 src/shortcuts.c
create mode 100644 src/shortcuts.h
diff --git a/src/Makefile b/src/Makefile
index 90526e0..e1a8563 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -15,7 +15,7 @@ OBJDIR=obj
BINDIR=bin
# base
-OBJS=shellext.o sysconfig.o config.o fb.o input.o reboot.o osc.o pngload.o
flashvalid.o main.o fbgrab.o
+OBJS=shellext.o sysconfig.o config.o fb.o input.o shortcuts.o osc.o pngload.o
flashvalid.o main.o fbgrab.o
# GUI
OBJS+=messagebox.o filedialog.o resmgr.o guirender.o performance.o cp.o
keyboard.o ir.o audio.o midi.o oscsettings.o dmxspy.o dmxtable.o dmx.o
videoin.o patcheditor.o monitor.o firstpatch.o sysettings.o about.o flash.o
shutdown.o
diff --git a/src/main.c b/src/main.c
index d5b0f6c..688b148 100644
--- a/src/main.c
+++ b/src/main.c
@@ -48,7 +48,7 @@
#include "sysconfig.h"
#include "fb.h"
#include "input.h"
-#include "reboot.h"
+#include "shortcuts.h"
#include "osc.h"
#include "messagebox.h"
#include "performance.h"
@@ -80,7 +80,7 @@ static rtems_task gui_task(rtems_task_argument argument)
sysconfig_set_mtk_wallpaper();
init_input();
input_add_callback(mtk_input);
- init_reboot();
+ init_shortcuts();
init_osc();
init_messagebox();
init_performance();
diff --git a/src/reboot.c b/src/reboot.c
deleted file mode 100644
index 30fe5f5..0000000
--- a/src/reboot.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Flickernoise
- * Copyright (C) 2010 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
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <mtklib.h>
-#include <keycodes.h>
-
-#include "input.h"
-
-#include "shutdown.h"
-#include "reboot.h"
-
-static int ctrl, alt;
-
-static void callback(mtk_event *e, int count)
-{
- int i;
-
- for(i=0;i<count;i++) {
- if(e[i].type == EVENT_TYPE_PRESS) {
- if(e[i].press.code == MTK_KEY_LEFTCTRL)
- ctrl = 1;
- else if(e[i].press.code == MTK_KEY_LEFTALT)
- alt = 1;
- else if(ctrl && alt && (e[i].press.code ==
MTK_KEY_DELETE))
- clean_shutdown(0);
- } 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;
- }
- }
-}
-
-void init_reboot()
-{
- input_add_callback(callback);
-}
diff --git a/src/reboot.h b/src/reboot.h
deleted file mode 100644
index 903ba64..0000000
--- a/src/reboot.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Flickernoise
- * Copyright (C) 2010 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
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __REBOOT_H
-#define __REBOOT_H
-
-void init_reboot();
-
-#endif /* __REBOOT_H */
diff --git a/src/shortcuts.c b/src/shortcuts.c
new file mode 100644
index 0000000..c44f500
--- /dev/null
+++ b/src/shortcuts.c
@@ -0,0 +1,56 @@
+/*
+ * Flickernoise
+ * Copyright (C) 2010 Sebastien Bourdeauducq
+ * Copyright (C) 2011 Xiangfu Liu <[email protected]>
+ *
+ * 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
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <mtklib.h>
+#include <keycodes.h>
+#include <stdio.h>
+
+#include "input.h"
+#include "shutdown.h"
+#include "fbgrab.h"
+
+static int ctrl, alt;
+
+static void shortcuts_callback(mtk_event *e, int count)
+{
+ int i;
+
+ for(i=0;i<count;i++) {
+ if(e[i].type == EVENT_TYPE_PRESS) {
+ if(e[i].press.code == MTK_KEY_LEFTCTRL)
+ ctrl = 1;
+ else if(e[i].press.code == MTK_KEY_LEFTALT)
+ 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_F12))
+ fbgrab(NULL);
+ } 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;
+
+ }
+ }
+}
+
+void init_shortcuts()
+{
+ input_add_callback(shortcuts_callback);
+}
diff --git a/src/shortcuts.h b/src/shortcuts.h
new file mode 100644
index 0000000..e467ac6
--- /dev/null
+++ b/src/shortcuts.h
@@ -0,0 +1,23 @@
+/*
+ * Flickernoise
+ * Copyright (C) 2011 Xiangfu Liu <[email protected]>
+ *
+ * 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
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __SHORTCUTS_H
+#define __SHORTCUTS_H
+
+void init_shortcuts();
+
+#endif /* __SHORTCUTS_H */
--
1.7.0.4
_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode
Twitter: www.twitter.com/milkymistvj
Ideas? http://milkymist.uservoice.com