GdkEvent and GdkEventKey not working in ekiga

Marty Jack martyj19 at comcast.net
Sun Apr 24 07:45:31 PDT 2011



On 04/24/2011 10:26 AM, David Woodfall wrote:
> I'm trying to patch ekiga to use the Return key to dial. Presently it
> only accepts mouse clicks. I first tried GdkEventKey and then GdkEvent
> but neither seem to work. Here's the code:
> 
> ///////////////////////////////////
> #define GDK_Return 0xff0d
> static gint
> on_view_event_after (GtkWidget *tree_view,
>                      GdkEventButton *event,
>                      gpointer data,
>                      GdkEvent *ev)
> {
> 
> <snip>
> 
> switch (column_type) {
> <snip>
>       case TYPE_PRESENTITY:
> 
>         if (event->type == GDK_BUTTON_PRESS && event->button == 3)
>           on_clicked_show_presentity_menu (Ekiga::HeapPtr(heap),
>                                            Ekiga::PresentityPtr(presentity),
>                                            event);
>         if (event->type == GDK_2BUTTON_PRESS || ev->key.keyval == GDK_Return)
>           on_clicked_trigger_presentity (Ekiga::PresentityPtr(presentity));
>     break;
> <snip>
> //////////////////////////
> 
> This doesn't work and the keyval always seems to be equal to 1426063360
> whether I click with mouse or press any key.
> 
> Where am I going wrong?
> 
> 
> 
> _______________________________________________
> xorg at lists.freedesktop.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: http://lists.freedesktop.org/mailman/listinfo/xorg
> Your subscription address: martyj19 at comcast.net

Leaving aside that you're asking a question that should be in the GTK mailing list ...

The Return key isn't a button, so GDK_BUTTON_PRESS is the wrong event.
GDK_BUTTON events are for mouse buttons.

You want to be using a GtkAction to capture the key event.  Read about

    gtk_action_set_accel_group
    gtk_accel_map_add_entry
    gtk_action_set_accel_path
    gtk_action_connect_accelerator

and then take any further questions to the GTK group.



More information about the xorg mailing list