emacs-devel
[Top][All Lists]
Advanced

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

Re: how to make a hook function and call from C?


From: joakim
Subject: Re: how to make a hook function and call from C?
Date: Fri, 09 May 2008 17:56:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Stefan Monnier <address@hidden> writes:


> If it is not safe, you can either create a new event, which will then be
> handled by the usual event-handling (i.e. like a key press) via keymaps.
> Or you can also add it to pending_funcalls.

I will admit I'm not too familiar with emacs event code.

This is my current try:

the signal handler for the gtk widget:

static void hello( GtkWidget *widget,
                   gpointer   data )
{
  struct xwidget* xw=(  struct xwidget*)data;
  Lisp_Object  frame;
  printf ("button clicked xw:%d id:%d\n",xw,xw->id);
    
  struct input_event event;
  EVENT_INIT (event);
  event.kind = XWIDGET_EVENT;
  
  FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (xw->widget), 
XG_FRAME_DATA);
  XSETFRAME (frame, f);
  
  event.frame_or_window = Qnil;//frame; //how to get the frame here?
  event.arg = Qnil;       //add some data describing the xwidget
  
  kbd_buffer_store_event (&event);


}


in make_lispy_event()
...
    case XWIDGET_EVENT:
      printf("cool, an xwidget event arrived in make_lispy_event!\n");
      return event->arg;
...

then in my elisp test code after all widgets are setup:
...
(message "event:%s"(read-key-sequence "wait for event"))

The XWIDGET_EVENT arrives in make_lispy_event(), but then my
elisp doesnt trigger.

Any hints of where in the sources to look for example code?


>
>
>         Stefan
-- 
Joakim Verona




reply via email to

[Prev in Thread] Current Thread [Next in Thread]