emacs part and QXEmbed

Marcus Gruendler runner at tamalin.de
Tue Sep 18 21:10:40 UTC 2001

On Sunday, 16. September 2001 11:34, you wrote:
> On Sat, 15 Sep 2001, Marcus Gruendler wrote:
> > Whenever a document is opened, emacs starts up and when it gets embedded
> > into the qxembed widget it disappears and no emacs is visible anymore.
> > Why?
> As you not saying what you did, that's hard to tell...

Sorry for that :-/

> One way to use it is to run emacs with a specific caption and listen
> for a window with that caption to appear on the screen. Then you can
> find out its window id and embed that. In order to avoid flicker, you

This is basically what I did. I started emacs, waited some seconds until its 
window has been created and queried its WId. I used this WId to tell the 
QXEmbed widget to embed the window ( I did not derive from QXEmbed, but used 
it directly ). Although your code is much nicer, since you use KWin and a 
signal/slot to know when the window appears on the screen, it's similar to 
what I have done.

My problem is not embedding emacs into QXEmbed, but telling kdevelop to use 
the qxembed widget as editor. Here is the code of the constructor of the 
class DocumentImpl:

DocumentImpl::DocumentImpl(Editor *parent, QWidget *parentWidget)
  : Document(parent), _widget(0)
  system ( "emacs -f gnuserv-start -title emacs_kdevelop_embed &" );    
  sleep ( 9 ); // Not nice, I know.   

  _widget = new QXEmbed( parentWidget );
  if ( _widget ) {
    Window w = findWindow(qt_xdisplay(),qt_xrootwin(),"emacs_kdevelop_embed");
    _widget->embed( (WId)w );

  // This works!
  //  _widget = new QMultiLineEdit(parentWidget);
  //  _widget->setFont(QFont("courier", 12));

  new CursorIfaceImpl(this, parent);
  setXMLFile("emacs_part.rc", true);

After emacs has been embedded into the qxembed widget it disappears and 
KDevelop doesn't have an editor widget anymore. If _widget is a 
QMultiLineEdit widget, everything is okay.

Is it possible that KDevelop changes the name of the widget to the name of 
the opened file, which confuses QXEmbed?

> You won't be happy with this though, because focus doesn't work.
> QXEmbed use a protocol based on X client messages in order to
> guarantee that focus changes inside the composite application
> only happen on mouse press events, not already when you move the
> mouse cursor. Of course, this protocol (XEMBED) requires the cooperation
> of the embedded program. AFAIK, Gtk 2.0 implements it for the plug
> and socket classes. So maybe once XEmacs is ported to Gtk2, you
> have more luck :-)

Okay that's another problem, but that's step two ;-)

> BTW, William Perry, the author of the Gtk XEmacs port, is also a Qt
> programmer, so maybe you could ask him for help.

That's another possibility, but I just wanted to know if I haven't done a 
stupid beginner's mistake.

Bye, Marcus

to unsubscribe from this list send an email to kdevelop-devel-request at kdevelop.org with the following body:
unsubscribe »your-email-address«

More information about the KDevelop-devel mailing list