This is just a little example of howto make a Gtk+ application go fullscreen. This is really useful in game programming. Please rate/comment/report errors :icon_mrgreen:

1,243 Views
#include <gtk/gtk.h>

int main (int argc, char *argv[])
  {
    /*** The Widgets we'll be using ***/ 
    GtkWidget *win = NULL;
    GtkWidget *close = NULL;

    /*** Initialize GTK+ ***/
    g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
    gtk_init (&argc, &argv);
    g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);

    /*** Make that Window!!! ***/
    win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_container_set_border_width (GTK_CONTAINER (win), 10);
    gtk_widget_realize (win);
    gtk_window_fullscreen(win);

    /*** this is a button that'll help us close the window ***/
    close = gtk_button_new_with_label("Close Window");
    gtk_container_add(win, close);

    /*** Callbacks ***/
    g_signal_connect (close, "clicked", gtk_main_quit, NULL);
    g_signal_connect (win, "destroy", gtk_main_quit, NULL);

    /*** Enter the main loop ***/
    gtk_widget_show_all (win);
    gtk_main ();

    return 0;
}
About the Author

Hello everyone, my name is Mike. I'm 15 and I've been programming since June '08. I love C/C++, Gtk+, Win32, gtkmm, Linux, and just being on the computer :)

I mainly enjoy creating random projects with many of my friends. Most are never finished, but we're just kids right? It's what we do, right?

Anyways, I try my best to answer questions; I'm not a total code.guru, but I do try my very best. The reason I try to help, is because I know you'll be able to help me, that and I do know some stuff, DON'T CALL ME A NOOB!!!! jk :) I love learning tons of new things here everyday.

Please add to my rep ;)

Favorite Band:
AC/DC

Favorite Quote:
&quot;What's better than an icy cold mountain dew and a good computer?&quot; - Blake Sutton


Twitter:
[url]https://twitter.com/lespaul2412[/url]
My Blog:
[url]http://shallweprogram.blogspot.com[/url]


~ mike :)
P.S. I hate the &quot;:D&quot; smiley and prefer the &quot;:)&quot;

Soory but your code dosn't work for me. you have missed some casts I think.

#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
  /*** The Widgets we'll be using ***/
  GtkWidget *win = NULL;
  GtkWidget *close = NULL;
  /*** Initialize GTK+ ***/
  g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
  gtk_init (&argc, &argv);
  g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);
  /*** Make that Window!!! ***/
  win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_container_set_border_width (GTK_CONTAINER (win), 10);
  gtk_widget_realize (win);
  gtk_window_fullscreen((GtkWindow*)win);
  /*** this is a button that'll help us close the window ***/
  close = gtk_button_new_with_label("Close Window");
  gtk_container_add(GTK_CONTAINER(win), close);
  /*** Callbacks ***/
  g_signal_connect (close, "clicked", gtk_main_quit, NULL);
  g_signal_connect (win, "destroy", gtk_main_quit, NULL);
  /*** Enter the main loop ***/
  gtk_widget_show_all (win);
  gtk_main ();
  return 0;
}