terminal: Use window_get_fullscreen() instead of tracking that state manually
diff --git a/clients/terminal.c b/clients/terminal.c
index f97882d..a0d6db3 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -48,7 +48,7 @@
static struct wl_list terminal_list;
static struct terminal *
-terminal_create(struct display *display, int fullscreen);
+terminal_create(struct display *display);
static void
terminal_destroy(struct terminal *terminal);
static int
@@ -404,7 +404,6 @@
int escape_flags;
struct utf8_state_machine state_machine;
int margin;
- int fullscreen;
struct color_scheme *color_scheme;
struct terminal_color color_table[256];
cairo_font_extents_t extents;
@@ -764,7 +763,7 @@
columns = (width - m) / (int32_t) terminal->extents.max_x_advance;
rows = (height - m) / (int32_t) terminal->extents.height;
- if (!terminal->fullscreen) {
+ if (window_is_fullscreen(terminal->window)) {
width = columns * terminal->extents.max_x_advance + m;
height = rows * terminal->extents.height + m;
widget_set_size(terminal->widget, width, height);
@@ -778,7 +777,7 @@
{
int32_t width, height, m;
- if (terminal->fullscreen)
+ if (window_is_fullscreen(terminal->window))
return;
m = 2 * terminal->margin;
@@ -2065,8 +2064,7 @@
{
struct terminal *terminal = data;
- terminal->fullscreen ^= 1;
- window_set_fullscreen(window, terminal->fullscreen);
+ window_set_fullscreen(window, !window_is_fullscreen(terminal->window));
}
static int
@@ -2097,8 +2095,7 @@
return 1;
case XKB_KEY_N:
- new_terminal =
- terminal_create(terminal->display, option_fullscreen);
+ new_terminal = terminal_create(terminal->display);
if (terminal_run(new_terminal, option_shell))
terminal_destroy(new_terminal);
@@ -2448,7 +2445,7 @@
}
static struct terminal *
-terminal_create(struct display *display, int fullscreen)
+terminal_create(struct display *display)
{
struct terminal *terminal;
cairo_surface_t *surface;
@@ -2459,7 +2456,6 @@
return terminal;
memset(terminal, 0, sizeof *terminal);
- terminal->fullscreen = fullscreen;
terminal->color_scheme = &DEFAULT_COLORS;
terminal_init(terminal);
terminal->margin_top = 0;
@@ -2571,8 +2567,8 @@
display_watch_fd(terminal->display, terminal->master,
EPOLLIN | EPOLLHUP, &terminal->io_task);
- window_set_fullscreen(terminal->window, terminal->fullscreen);
- if (!terminal->fullscreen)
+ window_set_fullscreen(terminal->window, option_fullscreen);
+ if (!window_is_fullscreen(terminal->window))
terminal_resize(terminal, 80, 24);
return 0;
@@ -2621,7 +2617,7 @@
}
wl_list_init(&terminal_list);
- terminal = terminal_create(d, option_fullscreen);
+ terminal = terminal_create(d);
if (terminal_run(terminal, option_shell))
exit(EXIT_FAILURE);