emacs-devel
[Top][All Lists]
Advanced

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

Re: embedding gtk widgets in a buffer


From: joakim
Subject: Re: embedding gtk widgets in a buffer
Date: Sat, 10 May 2008 23:07:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

I can now xembed emacs within emacs.

The embedded emacs, however, can't receive keyboard focus. It's
possible, though, to click in the embedded emacs with the mouse to
acivate menus and move the emacs cursor.

Heres the code I'm trying:

DEFUN("xwidget-set-keyboard-grab", 
Fxwidget_set_keyboard_grab,Sxwidget_set_keyboard_grab,
      2,2,0,
      doc: /* set unset kbd grab for xwidget.*/)
     (xwidget_id,kbd_grab)
     Lisp_Object xwidget_id, kbd_grab;      
{
  struct xwidget *xw;
  int xid=XFASTINT(xwidget_id);
  xw=&xwidgets[xid];
  int kbd_flag=XFASTINT(kbd_grab);
  printf("kbd grab: %d %d\n",xid,kbd_flag);
  if (kbd_flag)
    {
      //      int rv=gtk_widget_activate(xw->widget); //ok, but how deactivate?
      //printf("activation:%d\n",rv);
      //      gtk_window_present(GTK_WINDOW(xw->widget));
      gtk_widget_grab_focus(xw->widget);
    }
      /*
    gdk_keyboard_grab(xw->widget,TRUE,GDK_CURRENT_TIME);
  else
    gdk_keyboard_ungrab(GDK_CURRENT_TIME);
  */
  return Qnil;
}

As you can see I've tried several aproaches to get the gtk socket to get
keyboard events, but none work.

Any hints? I'm going also to try to send a plain XEMBED_WINDOW_ACTIVATE
X message to the widget, but I dont really see why that would work and
the aproaches above wouldnt.



-- 
Joakim Verona




reply via email to

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