[cairo-commit] cairo-demo/path_paint ChangeLog, 1.1, 1.2 README.txt, 1.1, 1.2 path_paint.c, 1.1, 1.2

OEyvind Kolaas commit at pdx.freedesktop.org
Sat May 29 09:39:06 PDT 2004


Committed by: pippin

Update of /cvs/cairo/cairo-demo/path_paint
In directory pdx:/tmp/cvs-serv11747

Modified Files:
	ChangeLog README.txt path_paint.c 
Log Message:
added X binding to switch color


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/path_paint/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/ChangeLog	27 May 2004 19:54:25 -0000	1.1
--- b/ChangeLog	29 May 2004 16:39:03 -0000	1.2
***************
*** 1,2 ****
--- 1,6 ----
+ 2004-05-28 OEyvind Kolaas <pippin at freedesktop.org> 
+ 	*path_paint.c: added X keybinding for toggling between black/white
+ 	               color
+ 
  2004-05-27 OEyvind Kolaas <pippin at freedesktop.org> 
  

Index: README.txt
===================================================================
RCS file: /cvs/cairo/cairo-demo/path_paint/README.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/README.txt	27 May 2004 19:54:25 -0000	1.1
--- b/README.txt	29 May 2004 16:39:03 -0000	1.2
***************
*** 10,13 ****
--- 10,16 ----
  and pixel based programs.
  
+ When painting, X can be used to switch between black and white stroke
+ color.
+ 
  Build instructions |
  -------------------'

Index: path_paint.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/path_paint/path_paint.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/path_paint.c	27 May 2004 19:54:25 -0000	1.1
--- b/path_paint.c	29 May 2004 16:39:03 -0000	1.2
***************
*** 2,5 ****
--- 2,6 ----
  #include <math.h>
  #include <gtkcairo.h>
+ #include <gdk/gdkkeysyms.h>
  
  #define WIDTH  800
***************
*** 190,193 ****
--- 191,212 ----
  }
  
+ static gboolean
+ event_keypress (GtkWidget   *widget,
+                 GdkEventKey *kev,
+                 gpointer     user_data)
+ {
+         switch (kev->keyval) {
+                 case GDK_x:
+                 case GDK_X:
+                         if (pen_color_is_black)
+                             pen_color_is_black=0;
+                         else
+                             pen_color_is_black=1;
+                 default:
+                         break;
+         }
+         return TRUE;
+ }
+ 
  int main (int    argc,
            char **argv)
***************
*** 207,211 ****
  #endif
                             GDK_BUTTON1_MOTION_MASK |
!                            GDK_BUTTON_PRESS_MASK |
                             GDK_BUTTON_RELEASE_MASK);
     gtk_widget_set_size_request (gtkcairo, WIDTH, HEIGHT);
--- 226,231 ----
  #endif
                             GDK_BUTTON1_MOTION_MASK |
!                            GDK_BUTTON_PRESS_MASK   |
!                            GDK_KEY_PRESS_MASK      |
                             GDK_BUTTON_RELEASE_MASK);
     gtk_widget_set_size_request (gtkcairo, WIDTH, HEIGHT);
***************
*** 219,222 ****
--- 239,245 ----
     g_signal_connect (G_OBJECT (gtkcairo), "button_release_event",
                       G_CALLBACK (event_release), NULL);
+    g_signal_connect (G_OBJECT (gtkcairo), "key_press_event",
+                      G_CALLBACK (event_keypress), NULL);
+    g_object_set (G_OBJECT (gtkcairo), "can_focus", 1, NULL);
  
     gtk_container_add (GTK_CONTAINER (mainwin), gtkcairo);





More information about the cairo-commit mailing list