Skip to content

Instantly share code, notes, and snippets.

@andreldm andreldm/sample.c
Created Sep 7, 2019

Embed
What would you like to do?
Non-transient dialog with minimize button (which doesn't work)
/*
* Build:
* gcc $(pkg-config --cflags gtk+-3.0) sample.c -o sample $(pkg-config --libs gtk+-3.0)
*/
#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
GtkWidget *window, *dialog;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_window_set_default_size (GTK_WINDOW (dialog), 320, 240);
gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
// gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show_all (window);
gtk_widget_show_all (dialog);
gtk_main ();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.