Hi, here is an updated version making resize work. It still works with tabbed too. Note that I have had no knowledge of X or xembed at all, so all changes come from experimenting... I removed large parts of the existing code, because they did nothing in my environment. Please have a look at it. Cheers, podarcis ----- diff -r 52633c6c3fc6 src/xembed.cc --- a/src/xembed.cc Wed Dec 12 19:40:33 2012 +0000 +++ b/src/xembed.cc Sat Dec 15 11:49:23 2012 +0100 @@ -21,93 +21,49 @@ #ifdef X_PROTOCOL -typedef enum { - XEMBED_EMBEDDED_NOTIFY = 0, - XEMBED_WINDOW_ACTIVATE = 1, - XEMBED_WINDOW_DEACTIVATE = 2, - XEMBED_REQUEST_FOCUS = 3, - XEMBED_FOCUS_IN = 4, - XEMBED_FOCUS_OUT = 5, - XEMBED_FOCUS_NEXT = 6, - XEMBED_FOCUS_PREV = 7, - XEMBED_GRAB_KEY = 8, - XEMBED_UNGRAB_KEY = 9, - XEMBED_MODALITY_ON = 10, - XEMBED_MODALITY_OFF = 11, -} XEmbedMessageType; - -void -Xembed::setXembedInfo(unsigned long flags) -{ - unsigned long buffer[2]; - - Atom xembed_info_atom = XInternAtom (fl_display, "_XEMBED_INFO", false); - - buffer[0] = 1; - buffer[1] = flags; - - XChangeProperty (fl_display, - xid, - xembed_info_atom, xembed_info_atom, 32, - PropModeReplace, - (unsigned char *)buffer, 2); +void Xembed::update_size() { + XWindowAttributes winAttributes; + XGetWindowAttributes( fl_display, xid, &winAttributes ); + int width = winAttributes.width; + int height = winAttributes.height; + update_size(width, height); } -void -Xembed::sendXembedEvent(uint32_t message) { - XClientMessageEvent xclient; - - memset (&xclient, 0, sizeof (xclient)); - xclient.window = xid; - xclient.type = ClientMessage; - xclient.message_type = XInternAtom (fl_display, "_XEMBED", false); - xclient.format = 32; - xclient.data.l[0] = fl_event_time; - xclient.data.l[1] = message; - - XSendEvent(fl_display, xid, False, NoEventMask, (XEvent *)&xclient); - XSync(fl_display, False); +void Xembed::update_size(int width, int height) { + if (w() != width || h() != height) + { + resize(x(), y(), width, height); + redraw(); + } } -int -Xembed::handle(int e) { - if (e == FL_PUSH) - sendXembedEvent(XEMBED_REQUEST_FOCUS); - - return Fl_Window::handle(e); -} - +static Xembed *xembed = 0; static int event_handler(int e, Fl_Window *w) { - Atom xembed_atom = XInternAtom (fl_display, "_XEMBED", false); - - if (fl_xevent->type == ClientMessage) { - if (fl_xevent->xclient.message_type == xembed_atom) { - long message = fl_xevent->xclient.data.l[1]; - - switch (message) { - case XEMBED_WINDOW_ACTIVATE: - // Force a ConfigureNotify message so fltk can get the new - // coordinates after a move of the embedder window. - if (w) - w->resize(0,0, w->w(), w->h()); - break; - case XEMBED_WINDOW_DEACTIVATE: - break; - default: - break; - } ---- Here the simplified FLTK test 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 --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(); } ---