podarcis
2012-12-10 13:12:34 UTC
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:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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.
I do not know enough of the embedding stuff, but I wonder if the static
int event_handler() ever gets called with type ClientMessage - at least
I could not make it get there..
podarcis
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:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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.
I do not know enough of the embedding stuff, but I wonder if the static
int event_handler() ever gets called with type ClientMessage - at least
I could not make it get there..
podarcis