Ensure network status panel doesn't go offscreen

This commit is contained in:
K. Lange 2018-07-20 23:53:45 +09:00
parent d6000306c7
commit 3da02638d1

View File

@ -359,7 +359,11 @@ static void show_network_status(void) {
if (!netstat->window) {
menu_show(netstat, yctx);
if (netstat->window) {
yutani_window_move(yctx, netstat->window, netstat_left, PANEL_HEIGHT);
if (netstat_left + netstat->window->width > (unsigned int)width) {
yutani_window_move(yctx, netstat->window, width - netstat->window->width, PANEL_HEIGHT);
} else {
yutani_window_move(yctx, netstat->window, netstat_left, PANEL_HEIGHT);
}
}
}
}