I am trying to make gtk application which when launched will go full screen. The UI is made in glade and it contains a MainWindow, frame and a label. I need to display some information on label so it has to be full screen. I have a monitor of size 1366x768
. I have set the width & height of the MainWindow, frame and label to 1366x768
. Below is the code:
int main(int argc, char *argv[])
{
GtkBuilder *builder;
GtkWidget *window;
GError *error = NULL;
gtk_init(&argc, &argv);
builder = gtk_builder_new();
if( ! gtk_builder_add_from_file( builder, "UI.glade", &error ) )
{
g_warning( "%s", error->message );
g_free( error );
return( 1 );
}
window = GTK_WIDGET(gtk_builder_get_object(builder, "MainWindow"));
frame1 = GTK_WIDGET(gtk_builder_get_object(builder, "frame1"));
gtk_builder_connect_signals(builder, NULL);
g_signal_connect (window, "delete_event", G_CALLBACK (on_MainWindow_destroy_event), NULL);
label1 = GTK_WIDGET(gtk_builder_get_object(builder, "label1"));
g_object_unref(builder);
GdkColor black = {0, 0x0000, 0x0000, 0x0000};
GdkColor white = {0, 0xFFFF, 0xFFFF, 0xFFFF};
gtk_widget_modify_bg(frame1, GTK_STATE_NORMAL, &black);
gtk_widget_modify_fg(frame1, GTK_STATE_NORMAL, &white);
gtk_widget_show(window);
gtk_main();
return 0;
}
When launched it looked like below:
As you can see the the window is not fullscreen because the side left toolbar and the top title bar is still showing. I then read the documentation and found out that I need to include gtk_window_fullscreen. But still its not coming in fullscreen mode. Can anyone please tell me how can I make this window fullscreen. Please help. Thanks.