/*
gcc -o s s.c -Wall -g $(pkg-config --cflags --libs gtk+-3.0)
*/
#include <gtk/gtk.h>
#include <stdlib.h>
static gboolean draw (GtkWidget *da, cairo_t   *cr, gpointer   data) {
  cairo_set_line_width (cr, 5);
  const int lines=10;
  int line;
  for (line=0;line<lines;++line) {
    int y=gtk_widget_get_allocated_height(da)*line/lines;
    cairo_move_to (cr, 5,y);
    cairo_line_to (cr, gtk_widget_get_allocated_width(da)-5,y);
    cairo_stroke (cr);
  }
  return TRUE;
}
int main(int argc,char **argv) {
  gtk_init (&argc, &argv);
  GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
  GtkWidget *scrolledwin = gtk_scrolled_window_new (NULL, NULL);
  gtk_container_add (GTK_CONTAINER (window), scrolledwin);
  GtkWidget *viewport = gtk_viewport_new (gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolledwin)),
                                          gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolledwin)));
  gtk_container_add (GTK_CONTAINER (scrolledwin), viewport);
  GtkWidget *da = gtk_drawing_area_new ();
  gtk_container_add (GTK_CONTAINER (viewport), da);
  g_signal_connect (da, "draw", G_CALLBACK (draw), NULL);
  gtk_widget_show_all (window);
  gtk_widget_set_size_request(da, -1,argv[1]?atoi(argv[1]):-1);
  gtk_main ();
  return 0;
}
