From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joakim@verona.se Newsgroups: gmane.emacs.devel Subject: Re: how to make a hook function and call from C? Date: Fri, 09 May 2008 17:56:57 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210349173 5313 80.91.229.12 (9 May 2008 16:06:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 May 2008 16:06:13 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 09 18:06:49 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JuV6w-00067h-VV for ged-emacs-devel@m.gmane.org; Fri, 09 May 2008 18:06:19 +0200 Original-Received: from localhost ([127.0.0.1]:60019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuV6E-0004jm-M0 for ged-emacs-devel@m.gmane.org; Fri, 09 May 2008 12:05:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JuV20-0002n7-Lx for emacs-devel@gnu.org; Fri, 09 May 2008 12:01:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JuV1y-0002mG-Jo for emacs-devel@gnu.org; Fri, 09 May 2008 12:01:11 -0400 Original-Received: from [199.232.76.173] (port=56625 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuV1y-0002m9-5N for emacs-devel@gnu.org; Fri, 09 May 2008 12:01:10 -0400 Original-Received: from iwfs.imcode.com ([82.115.149.64]:49063 helo=gate.verona.se) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JuV1x-0002cq-Eg for emacs-devel@gnu.org; Fri, 09 May 2008 12:01:09 -0400 Original-Received: from chopper (IDENT:1005@localhost [127.0.0.1]) by gate.verona.se (8.13.4/8.11.4) with ESMTP id m49G12pX019539; Fri, 9 May 2008 18:01:04 +0200 In-Reply-To: (Stefan Monnier's message of "Thu, 08 May 2008 21:25:55 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:96896 Archived-At: Stefan Monnier 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