/*
 * Build with:
 * $ gcc -o cycling-transient-mutter -g cycling-transient-mutter.c `pkg-config --libs --cflags gtk+-3.0`
 */

#include <gtk/gtk.h>

int
main (int argc, char *argv[])
{
  GtkWidget *win[6];
  char title[] = "A";
  int i;

  gtk_init (NULL, NULL);

  for (i = 0; i < 6; i++)
    {
      win[i] = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_window_set_title (GTK_WINDOW (win[i]), title);
      g_signal_connect (win[i], "destroy", gtk_main_quit, NULL);
      title[0]++;
    }

  for (i = 0; i < 2; i++)
    gtk_window_set_transient_for (GTK_WINDOW(win[i + 1]), GTK_WINDOW(win[i]));

  for (i = 3; i < 5; i++)
    gtk_window_set_transient_for (GTK_WINDOW(win[i + 1]), GTK_WINDOW(win[i]));

  for (i = 0; i < 6; i++)
    gtk_widget_show (win[i]);

  /* Naughty ...
     WARNING, do not do that at home if your running gnome-wayland as your session */
  gtk_window_set_transient_for (GTK_WINDOW(win[5]), GTK_WINDOW(win[0]));
  gtk_window_set_transient_for (GTK_WINDOW(win[0]), GTK_WINDOW(win[5]));

  gtk_main ();
}
