[cairo-commit] cairo/doc/tutorial/src/include cairo-tutorial-gtk.h, 1.1, 1.2

Carl Worth commit at pdx.freedesktop.org
Wed Jan 25 15:34:32 PST 2006


Committed by: cworth

Update of /cvs/cairo/cairo/doc/tutorial/src/include
In directory gabe:/tmp/cvs-serv13477/doc/tutorial/src/include

Modified Files:
	cairo-tutorial-gtk.h 
Log Message:

2006-01-26  Carl Worth  <cworth at cworth.org>

        * doc/tutorial/src/include/cairo-tutorial-gtk.h: Add a CONTROL-Q
        keybinding to quit.


Index: cairo-tutorial-gtk.h
===================================================================
RCS file: /cvs/cairo/cairo/doc/tutorial/src/include/cairo-tutorial-gtk.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo-tutorial-gtk.h	25 Jan 2006 18:22:34 -0000	1.1
+++ cairo-tutorial-gtk.h	25 Jan 2006 23:34:30 -0000	1.2
@@ -17,6 +17,8 @@
  */
 
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
 #include <cairo.h>
 
 #ifndef WIDTH
@@ -87,6 +89,18 @@
     return FALSE;
 }
 
+static gboolean
+handle_key_press (GtkWidget *widget,
+		  GdkEventKey *event,
+		  gpointer data)
+{
+    if ((event->keyval == GDK_Q ||
+	 event->keyval == GDK_q) && (event->state & GDK_CONTROL_MASK))
+	gtk_main_quit ();
+
+    return FALSE;
+}
+
 int 
 main (int argc, char **argv)
 {
@@ -108,6 +122,9 @@
     g_signal_connect (drawing_area, "expose-event",
 		      G_CALLBACK (handle_expose), NULL);
 
+    g_signal_connect (window, "key-press-event",
+		      G_CALLBACK (handle_key_press), NULL);
+
     gtk_widget_show_all (window);
 
     gtk_main ();



More information about the cairo-commit mailing list