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

Jan Djärv <jan.h.d@swipnet.se> writes:

> 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.

Sorry, this turned out to be brain damage on my side.

>
>> - 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.

Thanks for all this information!

I've implemented event forwarding now in the xwidget branch to an
offscreen webkit instance. It works supiciously well so far. I can
split a webkit view in several emacs windows, forward mouseclicks and
motion events, and damage events are received to the onscreen webkit
views. So far so good...

> 	Jan D.

-- 
Joakim Verona



      reply	other threads:[~2011-07-03 18:04 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
2011-07-03 18:04   ` joakim [this message]

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=m3hb73qlyv.fsf@verona.se \
    --to=joakim@verona.se \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.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.