Skip to content
Browse files

Allow user to specify how fast they'd like to repeat-scroll :) saves

preference to sdcard.
  • Loading branch information...
1 parent f3beee8 commit cf59f908408a03d4fe390156b45d35b7d8b1b5f0 @raidzero committed Dec 10, 2011
Showing with 103 additions and 6 deletions.
  1. +74 −3 extras_menu.c
  2. +1 −0 extras_menu.h
  3. +23 −3 minui/events.c
  4. +5 −0 recovery.c
View
77 extras_menu.c
@@ -179,6 +179,72 @@ int set_backuppath(const char* sdpath)
return 0;
}
+void set_repeat_scroll_delay(char *delay)
+{
+ __system("rm /cache/scroll");
+ FILE *fp = fopen("/cache/scroll", "w");
+ fprintf(fp, "%s\0", delay);
+ fclose(fp);
+}
+
+void show_repeat_scroll_menu()
+{
+ static char *headers[] = { "Repeat Scroll Delay",
+ "In millseconds. Lower is faster",
+ "",
+ NULL
+ };
+
+ static char *items[] = { "255",
+ "245",
+ "235",
+ "225",
+ "215",
+ "205",
+ "195",
+ "185",
+ "175",
+ "165",
+ "155",
+ "145",
+ "135",
+ "125",
+ "115",
+ "105",
+ NULL
+ };
+
+#define SPD_255 0
+#define SPD_245 1
+#define SPD_235 3
+#define SPD_225 4
+#define SPD_215 5
+#define SPD_205 6
+#define SPD_195 7
+#define SPD_185 8
+#define SPD_175 9
+#define SPD_165 10
+#define SPD_155 11
+#define SPD_145 12
+#define SPD_135 13
+#define SPD_125 14
+#define SPD_115 15
+#define SPD_105 16
+
+ char *delay;
+ int chosen_item = -1;
+ while (chosen_item != ITEM_BACK)
+ {
+ chosen_item = get_menu_selection(headers, items, 1, chosen_item < 0 ? 0: chosen_item);
+ delay = items[chosen_item];
+
+ set_repeat_scroll_delay(delay);
+ ui_print("Scroll delay is %s milliseconds.\n", delay);
+ return;
+ }
+ return;
+}
+
void show_options_menu()
{
static char *headers[] = { "Options",
@@ -190,12 +256,14 @@ void show_options_menu()
"Custom Colors",
"Recovery Overclocking",
"Nandroid Location",
+ "Repeat-scroll Delay",
NULL
};
#define OPT_COLORS 0
#define OPT_OVRCLCK 1
#define OPT_NANDLOC 2
+#define OPT_RPTSCRL 3
int chosen_item = -1;
while (chosen_item != ITEM_BACK)
@@ -213,9 +281,12 @@ void show_options_menu()
case OPT_OVRCLCK:
show_overclock_menu ();
break;
- case OPT_NANDLOC:
- show_nandroid_dir_menu();
- break;
+ case OPT_NANDLOC:
+ show_nandroid_dir_menu();
+ break;
+ case OPT_RPTSCRL:
+ show_repeat_scroll_menu();
+ break;
}
}
}
View
1 extras_menu.h
@@ -1,3 +1,4 @@
void show_extras_menu ();
void show_options_menu ();
char* return_nandroid_path(char* sdpath);
+int get_repeat_scroll_delay();
View
26 minui/events.c
@@ -37,8 +37,25 @@
#define ABS_MT_TOUCH_MAJOR 0x30
#define SYN_MT_REPORT 2
+int keyhold_delay;
+
// The amount of time in ms to delay before duplicating a held down key.
-#define KEYHOLD_DELAY 185
+void get_keyhold_delay()
+{
+ if (access("/cache/scroll",F_OK) != -1)
+ {
+ FILE *fp = fopen("/cache/scroll" ,"r");
+ char* delay = calloc(5, sizeof(char));
+
+ fgets(delay, 5, fp);
+ keyhold_delay = atoi(delay);
+ printf("keyhold_delay: %i\n", keyhold_delay);
+ }
+ else
+ {
+ keyhold_delay = 185;
+ }
+}
enum {
DOWN_NOT,
@@ -374,8 +391,11 @@ int ev_get(struct input_event *ev, unsigned dont_wait, unsigned keyheld)
do {
// When keyheld is true, that means the previous event
- // was an up/down keypress so wait KEYHOLD_DELAY.
- r = poll(ev_fds, ev_count, dont_wait ? 0 : keyheld ? KEYHOLD_DELAY : -1);
+ // was an up/down keypress so wait keyhold_delay.
+
+ //int keyhold_delay = 185;
+ get_keyhold_delay();
+ r = poll(ev_fds, ev_count, dont_wait ? 0 : keyheld ? keyhold_delay : -1);
if(r > 0) {
for(n = 0; n < ev_count; n++) {
View
5 recovery.c
@@ -297,6 +297,11 @@ write_files ()
__system("cp /cache/nandloc /sdcard/RZR/nandloc");
printf("Nandroid location file saved to sdcard.\n");
}
+ if (access("/cache/scroll", F_OK) != -1)
+ {
+ __system("cp /cache/scroll /sdcard/RZR/scroll");
+ printf("Scroll speed saved to sdcard.\n");
+ }
if (access ("/cache/rgb", F_OK) != -1)
{
__system("cp /cache/rgb /sdcard/RZR/rgb");

0 comments on commit cf59f90

Please sign in to comment.
Something went wrong with that request. Please try again.