#include <gtk/gtk.h>

static gboolean timeout (gpointer user_data)
{
  static shift_released = TRUE; /* Set the value in an inconsistent state for the first run */
  GdkModifierType state;
  gdk_window_get_pointer (NULL, NULL, NULL, &state);
  if (state & GDK_SHIFT_MASK)
    {
      g_print ("The SHIFT is pressed\n");
      shift_released = FALSE;
    }
  else
    {
      if (shift_released == FALSE)
        {
          g_print ("The SHIFT is released\n");
          shift_released = TRUE;
        }
    }
  return TRUE;
}

int main (int argc, char *argv[])
{
  gtk_init (&argc, &argv);
  g_timeout_add_seconds (1, (GSourceFunc)timeout, NULL);
  gtk_main ();
  return 0;
}


