terminal: Fix unused return value warnings
This commit is contained in:
+15
-8
@@ -1005,6 +1005,13 @@ terminal_draw_contents(struct terminal *terminal)
|
|||||||
cairo_surface_destroy(surface);
|
cairo_surface_destroy(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
terminal_write(struct terminal *terminal, const char *data, size_t length)
|
||||||
|
{
|
||||||
|
if (write(terminal->master, data, length) < 0)
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
resize_handler(struct window *window,
|
resize_handler(struct window *window,
|
||||||
int32_t pixel_width, int32_t pixel_height, void *data)
|
int32_t pixel_width, int32_t pixel_height, void *data)
|
||||||
@@ -1403,7 +1410,7 @@ handle_escape(struct terminal *terminal)
|
|||||||
terminal->last_char.byte[0] = 0;
|
terminal->last_char.byte[0] = 0;
|
||||||
break;
|
break;
|
||||||
case 'c': /* Primary DA */
|
case 'c': /* Primary DA */
|
||||||
write(terminal->master, "\e[?6c", 5);
|
terminal_write(terminal, "\e[?6c", 5);
|
||||||
break;
|
break;
|
||||||
case 'd': /* VPA */
|
case 'd': /* VPA */
|
||||||
x = set[0] ? args[0] : 1;
|
x = set[0] ? args[0] : 1;
|
||||||
@@ -1454,13 +1461,13 @@ handle_escape(struct terminal *terminal)
|
|||||||
case 'n': /* DSR */
|
case 'n': /* DSR */
|
||||||
i = set[0] ? args[0] : 0;
|
i = set[0] ? args[0] : 0;
|
||||||
if (i == 0 || i == 5) {
|
if (i == 0 || i == 5) {
|
||||||
write(terminal->master, "\e[0n", 4);
|
terminal_write(terminal, "\e[0n", 4);
|
||||||
} else if (i == 6) {
|
} else if (i == 6) {
|
||||||
snprintf(response, MAX_RESPONSE, "\e[%d;%dR",
|
snprintf(response, MAX_RESPONSE, "\e[%d;%dR",
|
||||||
terminal->origin_mode ?
|
terminal->origin_mode ?
|
||||||
terminal->row+terminal->margin_top : terminal->row+1,
|
terminal->row+terminal->margin_top : terminal->row+1,
|
||||||
terminal->column+1);
|
terminal->column+1);
|
||||||
write(terminal->master, response, strlen(response));
|
terminal_write(terminal, response, strlen(response));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
@@ -1514,23 +1521,23 @@ handle_escape(struct terminal *terminal)
|
|||||||
window_get_child_allocation(terminal->window, &allocation);
|
window_get_child_allocation(terminal->window, &allocation);
|
||||||
snprintf(response, MAX_RESPONSE, "\e[3;%d;%dt",
|
snprintf(response, MAX_RESPONSE, "\e[3;%d;%dt",
|
||||||
allocation.x, allocation.y);
|
allocation.x, allocation.y);
|
||||||
write(terminal->master, response, strlen(response));
|
terminal_write(terminal, response, strlen(response));
|
||||||
break;
|
break;
|
||||||
case 14: /* report px */
|
case 14: /* report px */
|
||||||
window_get_child_allocation(terminal->window, &allocation);
|
window_get_child_allocation(terminal->window, &allocation);
|
||||||
snprintf(response, MAX_RESPONSE, "\e[4;%d;%dt",
|
snprintf(response, MAX_RESPONSE, "\e[4;%d;%dt",
|
||||||
allocation.height, allocation.width);
|
allocation.height, allocation.width);
|
||||||
write(terminal->master, response, strlen(response));
|
terminal_write(terminal, response, strlen(response));
|
||||||
break;
|
break;
|
||||||
case 18: /* report ch */
|
case 18: /* report ch */
|
||||||
snprintf(response, MAX_RESPONSE, "\e[9;%d;%dt",
|
snprintf(response, MAX_RESPONSE, "\e[9;%d;%dt",
|
||||||
terminal->height, terminal->width);
|
terminal->height, terminal->width);
|
||||||
write(terminal->master, response, strlen(response));
|
terminal_write(terminal, response, strlen(response));
|
||||||
break;
|
break;
|
||||||
case 21: /* report title */
|
case 21: /* report title */
|
||||||
snprintf(response, MAX_RESPONSE, "\e]l%s\e\\",
|
snprintf(response, MAX_RESPONSE, "\e]l%s\e\\",
|
||||||
window_get_title(terminal->window));
|
window_get_title(terminal->window));
|
||||||
write(terminal->master, response, strlen(response));
|
terminal_write(terminal, response, strlen(response));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (args[0] >= 24)
|
if (args[0] >= 24)
|
||||||
@@ -2204,7 +2211,7 @@ key_handler(struct window *window, struct input *input, uint32_t time,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state && len > 0)
|
if (state && len > 0)
|
||||||
write(terminal->master, ch, len);
|
terminal_write(terminal, ch, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user