2 * Copyright (C) 2013 Red Hat
3 * Author: Olivier Fourdan <ofourdan@redhat.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
23 set_fullscreen_monitor_cb (GtkWidget *widget, gpointer user_data)
25 GdkFullscreenMode mode = (GdkFullscreenMode) GPOINTER_TO_INT (user_data);
28 window = gtk_widget_get_parent_window (widget);
29 gdk_window_set_fullscreen_mode (window, mode);
30 gdk_window_fullscreen (window);
34 remove_fullscreen_cb (GtkWidget *widget, gpointer user_data)
38 window = gtk_widget_get_parent_window (widget);
39 gdk_window_unfullscreen (window);
43 main (int argc, char *argv[])
45 GtkWidget *window, *vbox, *button;
47 gtk_init (&argc, &argv);
49 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
51 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
52 gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
53 gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
54 gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE);
55 gtk_container_add (GTK_CONTAINER (window), vbox);
57 button = gtk_button_new_with_label ("Fullscreen on current monitor");
58 g_signal_connect (button, "clicked", G_CALLBACK (set_fullscreen_monitor_cb), GINT_TO_POINTER (GDK_FULLSCREEN_ON_CURRENT_MONITOR));
59 gtk_container_add (GTK_CONTAINER (vbox), button);
61 button = gtk_button_new_with_label ("Fullscreen on all monitors");
62 g_signal_connect (button, "clicked", G_CALLBACK (set_fullscreen_monitor_cb), GINT_TO_POINTER (GDK_FULLSCREEN_ON_ALL_MONITORS));
63 gtk_container_add (GTK_CONTAINER (vbox), button);
65 button = gtk_button_new_with_label ("Un-fullscreen");
66 g_signal_connect (button, "clicked", G_CALLBACK (remove_fullscreen_cb), NULL);
67 gtk_container_add (GTK_CONTAINER (vbox), button);
69 gtk_widget_show_all (window);