changeset 1873:edcc3394e016

xembed
author corvid <corvid@lavabit.com>
date Sun, 23 Jan 2011 16:58:23 +0000
parents 3435e4b15d72
children 4fe10b101393
files src/xembed.cc
diffstat 1 files changed, 23 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/xembed.cc	Sun Jan 23 02:45:29 2011 +0000
+++ b/src/xembed.cc	Sun Jan 23 16:58:23 2011 +0000
@@ -12,13 +12,14 @@
 #include <string.h>
 #include <ctype.h>
 
+#define FL_INTERNALS
 #include <FL/Fl_Window.H>
 #include <FL/Fl.H>
 #include <FL/x.H>
 
 #include "xembed.hh"
 
-#if USE_X11
+#ifdef X_PROTOCOL
 
 typedef enum {
   XEMBED_EMBEDDED_NOTIFY        = 0,
@@ -40,12 +41,12 @@
 {
   unsigned long buffer[2];
 
-  Atom xembed_info_atom = XInternAtom (fltk::xdisplay, "_XEMBED_INFO", false);
+  Atom xembed_info_atom = XInternAtom (fl_display, "_XEMBED_INFO", false);
 
   buffer[0] = 1;
   buffer[1] = flags;
 
-  XChangeProperty (fltk::xdisplay,
+  XChangeProperty (fl_display,
      xid,
      xembed_info_atom, xembed_info_atom, 32,
      PropModeReplace,
@@ -59,13 +60,13 @@
    memset (&xclient, 0, sizeof (xclient));
    xclient.window = xid;
    xclient.type = ClientMessage;
-   xclient.message_type = XInternAtom (fltk::xdisplay, "_XEMBED", false);
+   xclient.message_type = XInternAtom (fl_display, "_XEMBED", false);
    xclient.format = 32;
-   xclient.data.l[0] = fltk::event_time;
+   xclient.data.l[0] = fl_event_time;
    xclient.data.l[1] = message;
 
-   XSendEvent(fltk::xdisplay, xid, False, NoEventMask, (XEvent *)&xclient);
-   XSync(fltk::xdisplay, False);
+   XSendEvent(fl_display, xid, False, NoEventMask, (XEvent *)&xclient);
+   XSync(fl_display, False);
 }
 
 int
@@ -76,18 +77,21 @@
    return Fl_Window::handle(e);
 }
 
-static int event_handler(int e, Fl_Window *w) {
-   Atom xembed_atom = XInternAtom (fltk::xdisplay, "_XEMBED", false);
+static int event_handler(int e) {
+   Atom xembed_atom = XInternAtom (fl_display, "_XEMBED", false);
 
-   if (fltk::xevent.type == ClientMessage) {
-      if (fltk::xevent.xclient.message_type == xembed_atom) {
-         long message = fltk::xevent.xclient.data.l[1];
+   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 0
+PORT1.3
                w->resize(0, 0, w->w(), w->h());
+#endif
                break;
             case XEMBED_WINDOW_DEACTIVATE:
                break;
@@ -105,12 +109,12 @@
 void Xembed::create() {
    createInternal(xid);
    setXembedInfo(1);
-   fltk::add_event_handler(event_handler);
+   Fl::add_handler(event_handler);
 }
 
 void Xembed::createInternal(uint32_t parent) {
    Fl_Window *window = this;
-   Colormap colormap = fltk::xcolormap;
+   Colormap colormap = fl_colormap;
 
    XSetWindowAttributes attr;
    attr.border_pixel = 0;
@@ -132,18 +136,18 @@
       | EnterWindowMask | LeaveWindowMask
       | PointerMotionMask;
 
-   fltk::CreatedWindow::set_xid(window,
-      XCreateWindow(fltk::xdisplay,
+   Fl_X::set_xid(window,
+      XCreateWindow(fl_display,
          parent,
          X, Y, W, H,
          0, // borderwidth
-         fltk::xvisual->depth,
+         fl_visual->depth,
          InputOutput,
-         fltk::xvisual->visual,
+         fl_visual->visual,
          mask, &attr));
 }
 
-#else  // USE_X11
+#else  // X_PROTOCOL
 
 void
 Xembed::setXembedInfo(unsigned long flags) {};