all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
To: joakim@verona.se
Cc: emacs-devel@gnu.org
Subject: Re: Whats the right way to add gtk components to Emacs?
Date: Sun, 03 Jul 2011 11:08:32 +0200	[thread overview]
Message-ID: <4E103190.7000301@swipnet.se> (raw)
In-Reply-To: <m3aacwisr6.fsf@verona.se>



joakim@verona.se skrev 2011-07-02 17.53:
> I the Xwidget branch I add gtk components to the buffer. It works mostly
> well. Some cases dont work too well:
>
> - If I create a new toplevel window and add a component to it, Emacs
>    crashes.

Interesting.  I guess the assumtion is that Gtk top level windows are frames.
Tooltips are a special case.

> - If I make an offscreen buffer and try to catch damage events, many
>    events seemingly get lost.
>
> Emacs does some kind of trickery with X events which I suspect is the
> root cause. How does this work? How do I make my more complicated
> components work in this scheme?

Hard to tell, since "this scheme" is not very detailed.  But here is the big 
picture.

In x_term_init, we first make sure no extended input events are used:

         /* Emacs can only handle core input events, so make sure
            Gtk doesn't use Xinput or Xinput2 extensions.  */
         {
           static char fix_events[] = "GDK_CORE_DEVICE_EVENTS=1";
           putenv (fix_events);
         }

Then we install an event filter:
         /* NULL window -> events for all windows go to our function */
         gdk_window_add_filter (NULL, event_handler_gdk, NULL);

All events go to that function.  It in turn calls handle_one_xevent which is 
the big event switch.  handle_one_xevent may deside that it is inappropriate 
to forward some events to Gtk+, so it sets flags that event_handler_gdk 
inspects.  Some events go to Gtk+, some are dropped.  The reason for dropping 
events is that they conflict with what Emacs does (i.e. clears/redraws 
windows, takes actions on property notify, and more).

All this complication is because it was desided that the big event switch 
should be used for Gtk+ also, i.e. keep code duplication to a minimum.

	Jan D.




  reply	other threads:[~2011-07-03  9:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-02 15:53 Whats the right way to add gtk components to Emacs? joakim
2011-07-03  9:08 ` Jan Djärv [this message]
2011-07-03 18:04   ` joakim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E103190.7000301@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=emacs-devel@gnu.org \
    --cc=joakim@verona.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.