* Whats the right way to add gtk components to Emacs?
@ 2011-07-02 15:53 joakim
2011-07-03 9:08 ` Jan Djärv
0 siblings, 1 reply; 3+ messages in thread
From: joakim @ 2011-07-02 15:53 UTC (permalink / raw
To: emacs-devel
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.
- 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?
--
Joakim Verona
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Whats the right way to add gtk components to Emacs?
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
0 siblings, 1 reply; 3+ messages in thread
From: Jan Djärv @ 2011-07-03 9:08 UTC (permalink / raw
To: joakim; +Cc: emacs-devel
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Whats the right way to add gtk components to Emacs?
2011-07-03 9:08 ` Jan Djärv
@ 2011-07-03 18:04 ` joakim
0 siblings, 0 replies; 3+ messages in thread
From: joakim @ 2011-07-03 18:04 UTC (permalink / raw
To: Jan Djärv; +Cc: emacs-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-03 18:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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.