Re: Re: Re: GdkEventKey and GdkEvent problems



On (08:18 26/04/11), Paul Davis <paul linuxaudiosystems com> put forth the proposition:
On Tue, Apr 26, 2011 at 8:12 AM, David Woodfall <dave dawoodfall net> wrote:
On (06:57 26/04/11), Paul Davis <paul linuxaudiosystems com> put forth the
proposition:

On Tue, Apr 26, 2011 at 2:45 AM, David Woodfall <dave dawoodfall net>
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:

not enough code. you didn't say which event signal you're connecting this
too.

I'm not really sure what I'm looking for since I'm totally new to gtk.
This is the calling line:

g_signal_connect (G_OBJECT (self->priv->tree_view), "event-after",
                   G_CALLBACK (on_view_event_after), self);

What else am I looking for?

well, your code is a bit confused. If its expecting GdkEvent, then
references to event members would be of the form:

   ev->TYPE.MEMBER

if its expecting Gdk<TYPE>Event, then they would be of the form

  ev->MEMBER

you've got both in there.

I've changed it to only use GdkEvent. Still not getting any key
related output:

static gint
on_view_event_after (GtkWidget *tree_view,
                     GdkEvent *event,
                     gpointer data)
{ RosterViewGtk *self = NULL;
  GtkTreeModel *model = NULL;
  GtkTreePath *path = NULL;
  GtkTreeIter iter;
GdkEventType type;
  type = event->type;
  GdkEventButton button;
  button = event->button;
if (type != GDK_BUTTON_PRESS && type != GDK_2BUTTON_PRESS && type != GDK_KEY_PRESS)
    return FALSE;
printf("%s\n", "Input");
  self = ROSTER_VIEW_GTK (data);
  model = gtk_tree_view_get_model (self->priv->tree_view);
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view),
                                     (gint) button.x, (gint) button.y,
                                     &path, NULL, NULL, NULL)) {
if (gtk_tree_model_get_iter (model, &iter, path)) { gint column_type;
      gchar *name = NULL;
      Ekiga::Heap *heap = NULL;
      Ekiga::Presentity *presentity = NULL;
      gtk_tree_model_get (model, &iter,
                          COLUMN_NAME, &name,
                          COLUMN_TYPE, &column_type,
                          COLUMN_HEAP, &heap,
                          COLUMN_PRESENTITY, &presentity,
                          -1);
printf ("%s %s \n","column name",name);
printf ("%s %d \n","column type",column_type);
printf ("%s %d \n","column heap",heap);
printf ("%s %d \n","column pres",presentity);
      switch (column_type) {
case TYPE_HEAP: if (type == GDK_BUTTON_PRESS && button.button == 1 && name)
          on_clicked_fold (self, path, name);
        if (type == GDK_BUTTON_PRESS && button.button == 3)
          on_clicked_show_heap_menu (Ekiga::HeapPtr(heap), event);
        break;
      case TYPE_GROUP:
if (type == GDK_BUTTON_PRESS && button.button == 1 && name)
          on_clicked_fold (self, path, name);
        if (type == GDK_BUTTON_PRESS && button.button == 3)
          on_clicked_show_heap_group_menu (Ekiga::HeapPtr(heap),
                                           name, event);
        break;
      case TYPE_PRESENTITY:
if (type == GDK_BUTTON_PRESS && button.button == 3)
          on_clicked_show_presentity_menu (Ekiga::HeapPtr(heap),
                                           Ekiga::PresentityPtr(presentity),
                                           event);
        if (type == GDK_2BUTTON_PRESS || event->key.keyval == GDK_Return)
          on_clicked_trigger_presentity (Ekiga::PresentityPtr(presentity));
        break;
      default:
g_assert_not_reached ();
        break; // shouldn't happen
      }
      g_free (name);
    }
    gtk_tree_path_free (path);
  }
return TRUE;
}

Thanks for your help.

--
Don't look back, the lemmings are gaining on you.

Attachment: pgphF7IYDhAY0.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]