Skip to content

Instantly share code, notes, and snippets.

@yeled
Last active May 15, 2017 14:46
Show Gist options
  • Save yeled/a5ddefbfd3f4123bb81f4cccf1a4cc8d to your computer and use it in GitHub Desktop.
Save yeled/a5ddefbfd3f4123bb81f4cccf1a4cc8d to your computer and use it in GitHub Desktop.
find what gdk code is pressed
#include <gtk/gtk.h>
static gboolean
key_event(GtkWidget *widget,
GdkEventKey *event)
{
g_printerr("%s\n",
gdk_keyval_name (event->keyval));
return FALSE;
}
int main( int argc,
char *argv[] )
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect(window, "key-release-event", G_CALLBACK(key_event), NULL);
gtk_widget_show (window);
gtk_main ();
return 0;
}
@yeled
Copy link
Author

yeled commented May 15, 2017

~/src/astroid[[email protected]] % cc -D_REENTRANT -I/usr/local/Cellar/gtk+/2.24.31_1/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.31_1/lib/gtk-2.0/include -I/usr/local/Cellar/pango/1.40.5/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/1.4.6/include/harfbuzz -I/usr/local/Cellar/pango/1.40.5/include/pa
ngo-1.0 -I/usr/local/Cellar/atk/2.24.0/include/atk-1.0 -I/usr/local/Cellar/cairo/1.14.8/include/cairo -I/usr/local/Cellar/pixman/0.34.0/include/pixman-1 -I/usr/local/Cellar/fontconfig/2.12.1_2/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libpng/1.6.29/include/libpng16 -I/usr/local/Cellar/
gdk-pixbuf/2.36.6/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.29/include/libpng16 -I/usr/local/Cellar/glib/2.52.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.52.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.40/include -L/usr/local/Cellar/gtk+/2.24.31_1/lib -L/usr/local
/Cellar/pango/1.40.5/lib -L/usr/local/Cellar/atk/2.24.0/lib -L/usr/local/Cellar/cairo/1.14.8/lib -L/usr/local/Cellar/gdk-pixbuf/2.36.6/lib -L/usr/local/Cellar/glib/2.52.2/lib -L/usr/local/opt/gettext/lib -lgtk-quartz-2.0 -lgdk-quartz-2.0 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgo
bject-2.0 -lglib-2.0 -lintl -Wl,-framework -Wl,CoreFoundation -I/usr/local/Cellar/glib/2.52.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.52.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.40/include -L/usr/local/Cellar/glib/2.52.2/lib -L/usr/local/opt/gettext/lib -lglib-2.0 -lint
l -Wl,-framework -Wl,CoreFoundation which_key.c
~/src/astroid[[email protected]] % ./a.out

the code is from http://stackoverflow.com/questions/10134956/in-simple-gtk-key-press-event-example-gdk-shift-mask-seems-to-be-ignored

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment