/*
 * Demonstrate the difference in stacking between X11 and Wayland.
 *
 * Build with:
 * $ gcc -o cycling-transient cycling-transient.c `pkg-config --libs --cflags gtk+-3.0`
 *
 */

#include <gtk/gtk.h>

int
main (int argc, char *argv[])
{
  GtkWidget *window1;
  GtkWidget *window2;

  gtk_init (NULL, NULL);

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window1), 600, 400);
  gtk_window_set_title (GTK_WINDOW (window1), "Window A transient for Window B");
  g_signal_connect (window1, "destroy", gtk_main_quit, NULL);

  window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window2), 600, 400);
  gtk_window_set_title (GTK_WINDOW (window1), "Window B transient for Window A");
  g_signal_connect (window2, "destroy", gtk_main_quit, NULL);

  /* Yeah I'm a nasty boy, I know ... */
  gtk_window_set_transient_for (GTK_WINDOW(window1), GTK_WINDOW(window2));
  gtk_window_set_transient_for (GTK_WINDOW(window2), GTK_WINDOW(window1));

  gtk_widget_show (window1);
  gtk_widget_show (window2);

  gtk_main ();
}
