Browse Source

Merge commit '71adb95' into bfgminer

Conflicts:
	miner.c
Luke Dashjr 12 years ago
parent
commit
057e6cb107
1 changed files with 26 additions and 4 deletions
  1. 26 4
      miner.c

+ 26 - 4
miner.c

@@ -2497,6 +2497,28 @@ int my_cancellable_getch(void)
 
 
 	return rv;
 	return rv;
 }
 }
+
+#ifdef PDCURSES
+static
+int bfg_wresize(WINDOW *win, int lines, int columns)
+{
+	int rv = wresize(win, lines, columns);
+	int x, y;
+	getyx(win, y, x);
+	if (unlikely(y >= lines || x >= columns))
+	{
+		if (y >= lines)
+			y = lines - 1;
+		if (x >= columns)
+			x = columns - 1;
+		wmove(win, y, x);
+	}
+	return rv;
+}
+#else
+#	define bfg_wresize wresize
+#endif
+
 #endif
 #endif
 
 
 void tailsprintf(char *buf, size_t bufsz, const char *fmt, ...)
 void tailsprintf(char *buf, size_t bufsz, const char *fmt, ...)
@@ -3306,14 +3328,14 @@ static inline void change_logwinsize(void)
 			statusy = logstart;
 			statusy = logstart;
 		logcursor = statusy;
 		logcursor = statusy;
 		mvwin(logwin, logcursor, 0);
 		mvwin(logwin, logcursor, 0);
-		wresize(statuswin, statusy, x);
+		bfg_wresize(statuswin, statusy, x);
 	}
 	}
 
 
 	y -= logcursor;
 	y -= logcursor;
 	getmaxyx(logwin, logy, logx);
 	getmaxyx(logwin, logy, logx);
 	/* Detect screen size change */
 	/* Detect screen size change */
 	if (x != logx || y != logy)
 	if (x != logx || y != logy)
-		wresize(logwin, y, x);
+		bfg_wresize(logwin, y, x);
 }
 }
 
 
 static void check_winsizes(void)
 static void check_winsizes(void)
@@ -3330,10 +3352,10 @@ static void check_winsizes(void)
 		else
 		else
 			statusy = logstart;
 			statusy = logstart;
 		logcursor = statusy;
 		logcursor = statusy;
-		wresize(statuswin, statusy, x);
+		bfg_wresize(statuswin, statusy, x);
 		getmaxyx(mainwin, y, x);
 		getmaxyx(mainwin, y, x);
 		y -= logcursor;
 		y -= logcursor;
-		wresize(logwin, y, x);
+		bfg_wresize(logwin, y, x);
 		mvwin(logwin, logcursor, 0);
 		mvwin(logwin, logcursor, 0);
 		unlock_curses();
 		unlock_curses();
 	}
 	}