Deprecate legacy terminal size feedback
This commit is contained in:
parent
a125d2dbb9
commit
5867eec659
@ -15,6 +15,8 @@
|
||||
#include <syscall.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include "lib/list.h"
|
||||
|
||||
@ -251,9 +253,10 @@ int main (int argc, char * argv[]) {
|
||||
int term_height = DEFAULT_TERM_HEIGHT;
|
||||
|
||||
/* This is a hack to determine the terminal with in a toaru terminal */
|
||||
printf("\033[1003z");
|
||||
fflush(stdout);
|
||||
scanf("%d,%d", &term_width, &term_height);
|
||||
struct winsize w;
|
||||
ioctl(0, TIOCGWINSZ, &w);
|
||||
term_width = w.ws_col;
|
||||
term_height = w.ws_row;
|
||||
term_width -= 1; /* And this just helps clean up our math */
|
||||
|
||||
int col_ext = ent_max_len + MIN_COL_SPACING;
|
||||
|
@ -12,11 +12,11 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <stdio_ext.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#define BACKSPACE_KEY 0x7F
|
||||
#else
|
||||
#include <syscall.h>
|
||||
@ -511,17 +511,10 @@ void initialize() {
|
||||
buffers_avail = 4;
|
||||
buffers = malloc(sizeof(buffer_t *) * buffers_avail);
|
||||
|
||||
#ifdef __linux__
|
||||
struct winsize w;
|
||||
ioctl(0, TIOCGWINSZ, &w);
|
||||
term_width = w.ws_col;
|
||||
term_height = w.ws_row;
|
||||
#else
|
||||
printf("\033[1003z");
|
||||
fflush(stdout);
|
||||
scanf("%d,%d", &term_width, &term_height);
|
||||
fpurge(stdin);
|
||||
#endif
|
||||
set_unbuffered();
|
||||
|
||||
}
|
||||
|
@ -2,12 +2,11 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef __toaru__
|
||||
#include <syscall.h>
|
||||
int usleep(useconds_t time) { syscall_nanosleep(0, time / 10000); }
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#define MAX_SPEED 2
|
||||
@ -43,21 +42,10 @@ screen_t * init_screen() {
|
||||
|
||||
screen_t * screen = malloc(sizeof(screen_t));
|
||||
|
||||
#ifdef __toaru__
|
||||
if (strstr(term, "toaru")) {
|
||||
printf("\033[1003z");
|
||||
fflush(stdout);
|
||||
scanf("%d,%d", &screen->width, &screen->height);
|
||||
} else {
|
||||
screen->width = 80; /* better safe than sorry */
|
||||
screen->height = 24;
|
||||
}
|
||||
#else
|
||||
struct winsize w;
|
||||
ioctl(0, TIOCGWINSZ, &w);
|
||||
screen->width = w.ws_col;
|
||||
screen->height = w.ws_row;
|
||||
#endif
|
||||
|
||||
screen->backingstore = malloc(sizeof(char *) * screen->width * screen->height);
|
||||
|
||||
|
@ -314,13 +314,6 @@ static void _ansi_put(char c) {
|
||||
/* Local Echo On */
|
||||
state.local_echo = 1;
|
||||
break;
|
||||
case 1003:
|
||||
{
|
||||
char out[24];
|
||||
sprintf(out, "%d,%d\n", term_width, term_height);
|
||||
input_buffer_stuff(out);
|
||||
}
|
||||
break;
|
||||
case 1555:
|
||||
if (argc > 1) {
|
||||
scale_fonts = 1;
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
printf("\033[1003z");
|
||||
fflush(stdout);
|
||||
int width, height;
|
||||
scanf("%d,%d", &width, &height);
|
||||
printf("Terminal is %dx%d\n", width, height);
|
||||
struct winsize w;
|
||||
int width, height;
|
||||
ioctl(0, TIOCGWINSZ, &w);
|
||||
width = w.ws_col;
|
||||
height = w.ws_row;
|
||||
printf("Terminal is %dx%d\n", width, height);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user