patch for #2997 from carl, fix handling stat of large files
[ardour2.git] / gtk2_ardour / evtest.cc
blobb986e030cc92fdac10a5d5cfbb71110939c6fedb
1 #include <gtkmm.h>
2 #include <iostream>
4 using namespace std;
6 bool
7 print_event (GdkEvent* event)
9 const gchar* kstr;
11 cerr << hex;
12 cerr << "Event: type = " << event->type << ' ';
14 switch (event->type) {
15 case GDK_2BUTTON_PRESS:
16 cerr << "2-Button press, button = "
17 << event->button.button
18 << " state "
19 << event->button.state
20 << endl;
21 break;
23 case GDK_BUTTON_PRESS:
24 cerr << "Button press, button = "
25 << event->button.button
26 << " state "
27 << event->button.state
28 << endl;
29 break;
31 case GDK_BUTTON_RELEASE:
32 cerr << "Button release, button = "
33 << event->button.button
34 << " state "
35 << event->button.state
36 << endl;
37 break;
39 case GDK_SCROLL:
40 cerr << "Scroll: direction = "
41 << event->scroll.direction
42 << " state = "
43 << event->scroll.state
44 << endl;
45 break;
47 case GDK_KEY_PRESS:
48 cerr << "Key press, keycode = "
49 << event->key.keyval
50 << " name "
51 << ((kstr = gdk_keyval_name (event->key.keyval)) ? kstr : "UNKNOWN KEY")
52 << " state = "
53 << event->key.state
54 << " hw keycode = "
55 << event->key.hardware_keycode
56 << " string = "
57 << (event->key.string ? event->key.string : "not defined")
58 << endl;
59 break;
61 case GDK_KEY_RELEASE:
62 cerr << "Key release, keycode = "
63 << event->key.keyval
64 << " name "
65 << ((kstr = gdk_keyval_name (event->key.keyval)) ? kstr : "UNKNOWN KEY")
66 << " state = "
67 << event->key.state
68 << " hw keycode = "
69 << event->key.hardware_keycode
70 << " string = "
71 << (event->key.string ? event->key.string : "not defined")
72 << endl;
73 break;
75 default:
76 cerr << endl;
77 break;
79 cerr << dec;
81 return false;
84 int
85 main (int argc, char* argv[])
87 Gtk::Main app (&argc, &argv);
88 Gtk::Window window;
89 Gtk::EventBox eventbox;
91 window.add (eventbox);
92 window.set_size_request (250, 250);
94 eventbox.signal_event().connect (sigc::ptr_fun (print_event));
95 eventbox.add_events (Gdk::SCROLL_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
96 eventbox.set_flags (Gtk::CAN_FOCUS);
98 eventbox.show ();
99 window.show ();
100 app.run();