diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-07 23:04:50 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-07 23:04:50 (EDT) |
commit | 28d0f5ef3b3dbc5892ad23a5bdd8934ec9ae709a (patch) | |
tree | 1eaf33c65f1896452b66c3dd64a646a52d3e9de3 | |
parent | 2d79062cc862824522ca7270e4d4e791852347cc (diff) | |
download | marquee-28d0f5ef3b3dbc5892ad23a5bdd8934ec9ae709a.zip marquee-28d0f5ef3b3dbc5892ad23a5bdd8934ec9ae709a.tar.gz marquee-28d0f5ef3b3dbc5892ad23a5bdd8934ec9ae709a.tar.bz2 |
mq_window_toggle_fullscreen(): New function
-rw-r--r-- | src/window.c | 23 | ||||
-rw-r--r-- | src/window.h | 4 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c index 463d8ad..a4807db 100644 --- a/src/window.c +++ b/src/window.c @@ -45,6 +45,16 @@ configure_event_cb(GtkWindow G_GNUC_UNUSED *window, GdkEventConfigure *event, mq_config_save(config); } +static gboolean +window_state_event_cb(GtkWidget G_GNUC_UNUSED *widget, + GdkEventWindowState *event, MqWindow *window) +{ + window->fullscreen = + event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN; + + return FALSE; +} + static void close_confirm_warn_check_button_toggled_cb(GtkToggleButton *toggle_button, MqWindow *window) @@ -192,10 +202,13 @@ mq_window_new(MqApplication *application, const gchar **uris) G_CALLBACK(is_maximized_cb), window->config); g_signal_connect(window->window, "configure-event", G_CALLBACK(configure_event_cb), window->config); + g_signal_connect(window->window, "window-state-event", + G_CALLBACK(window_state_event_cb), window); g_signal_connect(window->window, "delete-event", G_CALLBACK(delete_event_cb), window); g_signal_connect(window->window, "destroy", G_CALLBACK(destroy_cb), window); + window->fullscreen = FALSE; window->notebook = gtk_notebook_new(); gtk_notebook_set_scrollable(GTK_NOTEBOOK(window->notebook), TRUE); @@ -236,6 +249,16 @@ mq_window_get_application(MqWindow *window) } void +mq_window_toggle_fullscreen(MqWindow *window) +{ + if (!window->fullscreen) { + gtk_window_fullscreen(GTK_WINDOW(window->window)); + } else { + gtk_window_unfullscreen(GTK_WINDOW(window->window)); + } +} + +void mq_window_insert_tab(MqWindow *window, GtkWidget *tab_page, GtkWidget *tab_label, gint position) { diff --git a/src/window.h b/src/window.h index 1764b3c..94c526b 100644 --- a/src/window.h +++ b/src/window.h @@ -36,6 +36,7 @@ struct MqWindow { GtkWidget *notebook; MqTab *root_tab; guint current_tab; + gboolean fullscreen; }; MqWindow * @@ -48,6 +49,9 @@ MqApplication * mq_window_get_application(MqWindow *window); void +mq_window_toggle_fullscreen(MqWindow *window); + +void mq_window_insert_tab(MqWindow *window, GtkWidget *tab_page, GtkWidget *tab_label, gint position); |