Patch for xembed

podarcis <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <1355144369.2156.13.camel@ubuntu>
Hi all,

Here is a patch to make embedding dillo into an X-window work.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff -r 9bad41ea1dde src/xembed.cc
--- a/src/xembed.cc	Wed Dec 05 13:03:04 2012 +0100
+++ b/src/xembed.cc	Sun Dec 09 10:12:36 2012 +0100
 // TODO: Implement more XEMBED support;
 
-void Xembed::show() {
+void Xembed::create() {
    createInternal(xid);
    setXembedInfo(1);
    Fl::event_dispatch(event_handler);
diff -r 9bad41ea1dde src/xembed.hh
--- a/src/xembed.hh	Wed Dec 05 13:03:04 2012 +0100
+++ b/src/xembed.hh	Sun Dec 09 10:12:36 2012 +0100
@@ -14,10 +14,11 @@
 
    public:
       Xembed(uint32_t xid, int _w, int _h) : Fl_Window(_w, _h) {
-         this->xid = xid;
+         this->xid = xid; create();
       };
-      void show();
+      void create();
       int handle(int event);
+      void resize(int x, int y, int w, int h);
 };
 
 #endif
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tested with this FLTK program:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I do not know enough of the embedding stuff, but I wonder if the static
int event_handler~~~~~~~~~~~~~~~
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/x.H>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>

using namespace std;


int main( int argc_, char *argv_[] )
{
   Fl_Window dw( 800, 600, "dillo embedded" );
   dw.resizable( &dw );
   dw.show();
   cout << "dw.xid = " << (unsigned long)fl_xid(&dw) << endl;
   ostringstream cmd;
   cmd << "dillo -f -g " <<
      dw.w() << "x" << dw.h() << " --xid " <<
      (unsigned long)fl_xid(&dw);
      if ( argc_ > 1 )
         cmd << " " << argv_[1];
      cmd << " &";
   cout << "system '" << cmd.str() << "'" << endl;
   system( cmd.str().c_str() );
   return Fl::run();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

What does NOT work is automatic resizing of the embedded dillo window,
when the size is changed. This would be nice to have.

podarcis
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.