Re: Keyevent
- From: Bob Caryl <bob fis-cal com>
- To: José Maria Silveira Neto <silveiraneto gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Keyevent
- Date: Wed, 29 Dec 2004 11:30:30 -0600
The "button_release_event" is not a keyboard type event is it? It is
paired with "button_press_event", not "key_press_event". I would
suggest you try connecting to the "key_release_event" signal.
On Wed, 2004-12-29 at 10:45, José Maria Silveira Neto wrote:
Hi, I'm developing a game with SDL and GTK.
I having a problem because I only can use key_press_event but not
button_release_event.
I wrote a small code to show my problem:
---------------------------------------------------------------------------------------------------------------
#include<gtk/gtk.h>
gint e_keyup (GtkWidget *widget, GdkEventKey *event){
printf("%d UP \n", event->keyval);
return TRUE;
}
gint e_keydown (GtkWidget *widget, GdkEventKey *event){
printf("%d DOWN \n", event->keyval);
return TRUE;
}
int main(gint arc, gchar **argv){
GtkWidget *janela;
gtk_init(&arc, &argv);
janela = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(janela),"Key Event");
gtk_signal_connect(GTK_OBJECT(janela), "delete_event",
GTK_SIGNAL_FUNC(gtk_main_quit), 0);
g_signal_connect (G_OBJECT (janela), "destroy", G_CALLBACK
(gtk_main_quit), NULL);
gtk_signal_connect(GTK_OBJECT(janela),
"key_press_event",GTK_SIGNAL_FUNC(e_keydown), 0);
gtk_signal_connect(GTK_OBJECT(janela),
"button_release_event",GTK_SIGNAL_FUNC(e_keyup), 0);
gtk_widget_show(janela);
gtk_main();
}
---------------------------------------------------------------------------------------------------------------
Salve it as key.c and compile it:
$gcc key.c -o key `pkg-config --libs --cflags gtk+-2.0`
You'll see that only key down event are occurring.
Does anybody know how to make button_release_event works?
Thanks a lot.
Fortaleza-CE, Brazil.
Silveira Neto
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
- References:
- Keyevent
- From: =?ISO-8859-1?Q?Jos=E9_Maria_Silveira_Neto?=
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]