Code

Debugging messages in event-context for mouse and keyboard interaction
authorcilix42 <cilix42@users.sourceforge.net>
Mon, 18 Aug 2008 00:40:39 +0000 (00:40 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Mon, 18 Aug 2008 00:40:39 +0000 (00:40 +0000)
src/event-context.cpp
src/event-context.h

index b1c4f87efafa33779c1a3e772dec219335efde7d..63f5b0f5d45ce330feefa1639f6a9333e5a6e248 100644 (file)
@@ -1083,6 +1083,49 @@ ec_shape_event_attr_changed(Inkscape::XML::Node */*shape_repr*/, gchar const *na
 }
 
 
+void
+event_context_print_event_info(GdkEvent *event, bool print_return) {
+    switch (event->type) {
+        case GDK_BUTTON_PRESS:
+            g_print ("GDK_BUTTON_PRESS");
+            break;
+        case GDK_2BUTTON_PRESS:
+            g_print ("GDK_2BUTTON_PRESS");
+            break;
+        case GDK_3BUTTON_PRESS:
+            g_print ("GDK_3BUTTON_PRESS");
+            break;
+
+        case GDK_MOTION_NOTIFY:
+            g_print ("GDK_MOTION_NOTIFY");
+            break;
+        case GDK_ENTER_NOTIFY:
+            g_print ("GDK_ENTER_NOTIFY");
+            break;
+
+        case GDK_LEAVE_NOTIFY:
+            g_print ("GDK_LEAVE_NOTIFY");
+            break;
+        case GDK_BUTTON_RELEASE:
+            g_print ("GDK_BUTTON_RELEASE");
+            break;
+
+        case GDK_KEY_PRESS:
+            g_print ("GDK_KEY_PRESS: %d", get_group0_keyval(&event->key));
+            break;
+        case GDK_KEY_RELEASE:
+            g_print ("GDK_KEY_RELEASE: %d", get_group0_keyval(&event->key));
+            break;
+        default:
+            //g_print ("even type not recognized");
+            break;
+    }
+
+    if (print_return) {
+        g_print ("\n");
+    }
+}
+
 /*
   Local Variables:
   mode:c++
index 6284b6e2c15e04d6ee3b4d863dd29bbe544f1a4b..1e95305e5ece5b8daeb91803d3fdfe95ae85f976 100644 (file)
@@ -125,6 +125,8 @@ void ec_shape_event_attr_changed(Inkscape::XML::Node *shape_repr,
                                      gchar const *name, gchar const *old_value, gchar const *new_value,
                                  bool const is_interactive, gpointer const data);
 
+void event_context_print_event_info(GdkEvent *event, bool print_return = true);
+
 #endif