Browse Source

tty: kernel should send SIGWINCH, not terminal

K. Lange 3 years ago
parent
commit
0995d14106
3 changed files with 12 additions and 17 deletions
  1. 3 3
      apps/terminal-vga.c
  2. 8 13
      apps/terminal.c
  3. 1 1
      kernel/fs/tty.c

+ 3 - 3
apps/terminal-vga.c

@@ -64,7 +64,7 @@ char * selection_text = NULL;
 
 term_state_t * ansi_state = NULL;
 
-void reinit(); /* Defined way further down */
+void reinit(void); /* Defined way further down */
 void term_redraw_cursor();
 
 void term_clear();
@@ -1046,7 +1046,7 @@ term_callbacks_t term_callbacks = {
 	NULL,
 };
 
-void reinit(int send_sig) {
+void reinit(void) {
 	if (term_buffer) {
 		/* Do nothing */
 	} else {
@@ -1205,7 +1205,7 @@ int main(int argc, char ** argv) {
 	w.ws_ypixel = 0;
 	ioctl(fd_master, TIOCSWINSZ, &w);
 
-	reinit(0);
+	reinit();
 
 	fflush(stdin);
 

+ 8 - 13
apps/terminal.c

@@ -155,7 +155,7 @@ static struct MenuList * menu_right_click = NULL;
 
 static void render_decors(void);
 static void term_clear();
-static void reinit();
+static void reinit(void);
 static void term_redraw_cursor();
 
 static int decor_left_width = 0;
@@ -1714,7 +1714,7 @@ static void key_event(int ret, key_event_t * event) {
 					_no_frame = !_no_frame;
 					window_width = window->width - decor_width * (!_no_frame);
 					window_height = window->height - (decor_height + menu_bar_height) * (!_no_frame);
-					reinit(1);
+					reinit();
 				}
 				break;
 			case KEY_ARROW_UP:
@@ -1866,7 +1866,7 @@ static term_cell_t * copy_terminal(int old_width, int old_height, term_cell_t *
 }
 
 /* Reinitialize the terminal after a resize. */
-static void reinit(int send_sig) {
+static void reinit(void) {
 
 	/* Figure out character sizes if fonts have changed. */
 	if (_use_aa && !_have_freetype) {
@@ -1943,11 +1943,6 @@ static void reinit(int send_sig) {
 	w.ws_xpixel = term_width * char_width;
 	w.ws_ypixel = term_height * char_height;
 	ioctl(fd_master, TIOCSWINSZ, &w);
-
-	/* If requested, send a signal to the application. */
-	if (send_sig) {
-		kill(child_pid, SIGWINCH);
-	}
 }
 
 static void update_bounds(void) {
@@ -2009,7 +2004,7 @@ static void resize_finish(int width, int height) {
 	reinit_graphics_yutani(ctx, window);
 
 	/* Reinitialize the terminal buffer and ANSI library */
-	reinit(1);
+	reinit();
 
 	/* We are done resizing. */
 	yutani_window_resize_done(yctx, window);
@@ -2254,13 +2249,13 @@ static void _menu_action_hide_borders(struct MenuEntry * self) {
 	window_height = window->height - (decor_height + menu_bar_height) * (!_no_frame);
 	menu_update_title(_menu_toggle_borders_context, _no_frame ? "Show borders" : "Hide borders");
 	menu_update_title(_menu_toggle_borders_bar, _no_frame ? "Show borders" : "Hide borders");
-	reinit(1);
+	reinit();
 }
 
 static void _menu_action_toggle_sdf(struct MenuEntry * self) {
 	_use_aa = !(_use_aa);
 	menu_update_title(self, _use_aa ? "Bitmap font" : "Anti-aliased font");
-	reinit(1);
+	reinit();
 }
 
 static void _menu_action_show_about(struct MenuEntry * self) {
@@ -2295,7 +2290,7 @@ static void _menu_action_set_scale(struct MenuEntry * self) {
 		scale_fonts  = 1;
 		font_scaling = atof(_self->action);
 	}
-	reinit(1);
+	reinit();
 }
 
 int main(int argc, char ** argv) {
@@ -2474,7 +2469,7 @@ int main(int argc, char ** argv) {
 	terminal = fdopen(fd_slave, "w");
 
 	/* Initialize the terminal buffer and ANSI library for the first time. */
-	reinit(0);
+	reinit();
 
 	/* Make sure we're not passing anything to stdin on the child */
 	fflush(stdin);

+ 1 - 1
kernel/fs/tty.c

@@ -273,7 +273,7 @@ int pty_ioctl(pty_t * pty, int request, void * argp) {
 			if (!argp) return -EINVAL;
 			validate(argp);
 			memcpy(&pty->size, argp, sizeof(struct winsize));
-			/* TODO send sigwinch to fg_prog */
+			group_send_signal(pty->fg_proc, SIGWINCH, 1);
 			return 0;
 		case TIOCGWINSZ:
 			if (!argp) return -EINVAL;