Browse Source

Scroll the device list with up/down arrow keys, if it is overflowed

Luke Dashjr 13 years ago
parent
commit
5944783cfe
1 changed files with 26 additions and 1 deletions
  1. 26 1
      cgminer.c

+ 26 - 1
cgminer.c

@@ -1260,6 +1260,7 @@ static char statusline[256];
 static int devcursor, logstart, logcursor;
 static int devcursor, logstart, logcursor;
 /* statusy is where the status window goes up to in cases where it won't fit at startup */
 /* statusy is where the status window goes up to in cases where it won't fit at startup */
 static int statusy;
 static int statusy;
+static int devsummaryYOffset;
 struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
 struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
 struct cgpu_info *cpus;
 struct cgpu_info *cpus;
 
 
@@ -1375,7 +1376,11 @@ static void curses_print_devstatus(int thr_id)
 	cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60;
 	cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60;
 
 
 	/* Check this isn't out of the window size */
 	/* Check this isn't out of the window size */
-	ypos = devcursor + cgpu->cgminer_id;
+	ypos = cgpu->cgminer_id;
+	ypos += devsummaryYOffset;
+	if (ypos < 0)
+		return;
+	ypos += devcursor;
 	if (ypos >= statusy - 1)
 	if (ypos >= statusy - 1)
 		return;
 		return;
 	if (wmove(statuswin, ypos, 0) == ERR)
 	if (wmove(statuswin, ypos, 0) == ERR)
@@ -3126,6 +3131,25 @@ static void *input_thread(void __maybe_unused *userdata)
 			if (have_opencl)
 			if (have_opencl)
 				manage_gpu();
 				manage_gpu();
 			break;
 			break;
+#ifdef HAVE_CURSES
+		case KEY_DOWN:
+			if (devsummaryYOffset < -(total_devices + devcursor - statusy))
+				break;
+			devsummaryYOffset -= 2;
+		case KEY_UP:
+			if (devsummaryYOffset == 0)
+				break;
+			++devsummaryYOffset;
+			if (curses_active_locked()) {
+				int i;
+				for (i = 0; i < mining_threads; i++)
+					curses_print_devstatus(i);
+				touchwin(statuswin);
+				wrefresh(statuswin);
+				unlock_curses();
+			}
+			break;
+#endif
 		}
 		}
 		if (opt_realquiet) {
 		if (opt_realquiet) {
 			disable_curses();
 			disable_curses();
@@ -4593,6 +4617,7 @@ void enable_curses(void) {
 	}
 	}
 
 
 	mainwin = initscr();
 	mainwin = initscr();
+	keypad(mainwin, true);
 	getmaxyx(mainwin, y, x);
 	getmaxyx(mainwin, y, x);
 	statuswin = newwin(logstart, x, 0, 0);
 	statuswin = newwin(logstart, x, 0, 0);
 	leaveok(statuswin, true);
 	leaveok(statuswin, true);