changeset 1918:55af06da5523

merge in recent changes from main repo
author corvid <corvid@lavabit.com>
date Fri, 25 Feb 2011 08:37:13 +0000
parents d3689f044909 (diff) ab62ebbd29ba (current diff)
children e920355164cf a5176865375c
files configure.in dpi/downloads.cc
diffstat 58 files changed, 2340 insertions(+), 2410 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Fri Feb 11 02:40:32 2011 +0000
+++ b/configure.in	Fri Feb 25 08:37:13 2011 +0000
@@ -109,19 +109,22 @@
 
 
 dnl ----------------------
-dnl Test for FLTK2 library
+dnl Test for FLTK 1.3 library
 dnl ----------------------
 dnl
 dnl For debugging and to be user friendly
-AC_MSG_CHECKING([FLTK2])
-if sh -c "fltk2-config --version" >/dev/null 2>&1
-then AC_MSG_RESULT(yes)
-     LIBFLTK_CXXFLAGS=`fltk2-config --cxxflags`
-     LIBFLTK_CFLAGS=`fltk2-config --cflags`
-     LIBFLTK_LIBS=`fltk2-config --ldflags`
-else AC_MSG_RESULT(no)
-     AC_MSG_ERROR(FLTK2 must be installed!)
-fi
+AC_MSG_CHECKING([FLTK 1.3])
+fltk_version="`fltk-config --version 2>/dev/null`"
+case $fltk_version in
+  1.3.*) AC_MSG_RESULT(yes)
+         LIBFLTK_CXXFLAGS=`fltk-config --cxxflags`
+         LIBFLTK_CFLAGS=`fltk-config --cflags`
+         LIBFLTK_LIBS=`fltk-config --ldflags`;;
+  ?*)    AC_MSG_RESULT(no)
+         AC_ERROR(FLTK 1.3 required; version found: $fltk_version);;
+  *)     AC_MSG_RESULT(no)
+         AC_ERROR(FLTK 1.3 required; fltk-config not found)
+esac
 
 
 dnl ----------------
--- a/dpi/downloads.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dpi/downloads.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -10,7 +10,7 @@
  */
 
 /*
- * A FLTK2-based GUI for the downloads dpi (dillo plugin).
+ * A FLTK-based GUI for the downloads dpi (dillo plugin).
  */
 
 #include <stdio.h>
@@ -29,23 +29,21 @@
 #include <sys/un.h>
 #include <sys/wait.h>
 
-#include <fltk/run.h>
-#include <fltk/Window.h>
-#include <fltk/Widget.h>
-#include <fltk/damage.h>
-#include <fltk/Box.h>
-#include <fltk/draw.h>
-#include <fltk/HighlightButton.h>
-#include <fltk/PackedGroup.h>
-#include <fltk/ScrollGroup.h>
-#include <fltk/ask.h>
-#include <fltk/file_chooser.h>
+#include <FL/Fl.H>
+#include <FL/fl_draw.H>
+#include <FL/fl_ask.H>
+#include <FL/Fl_File_Chooser.H>
+#include <FL/Fl_Window.H>
+#include <FL/Fl_Widget.H>
+#include <FL/Fl_Group.H>
+#include <FL/Fl_Scroll.H>
+#include <FL/Fl_Pack.H>
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Button.H>
 
 #include "dpiutil.h"
 #include "../dpip/dpip.h"
 
-using namespace fltk;
-
 /*
  * Debugging macros
  */
@@ -69,8 +67,8 @@
 
 // ProgressBar widget --------------------------------------------------------
 
-// class FL_API ProgressBar : public Widget {
-class ProgressBar : public Widget {
+// class FL_API ProgressBar : public Fl_Widget {
+class ProgressBar : public Fl_Widget {
 protected:
    double mMin;
    double mMax;
@@ -78,7 +76,7 @@
    double mStep;
    bool mShowPct, mShowMsg;
    char mMsg[64];
-   Color mTextColor;
+   Fl_Color mTextColor;
    void draw();
 public:
    ProgressBar(int x, int y, int w, int h, const char *lbl = 0);
@@ -97,8 +95,8 @@
    void showtext(bool st)        { mShowPct = st; }
    void message(char *msg) { mShowMsg = true; strncpy(mMsg,msg,63); redraw(); }
    bool showtext()               { return mShowPct; }
-   void text_color(Color col)    { mTextColor = col; }
-   Color text_color()      { return mTextColor; }
+   void text_color(Fl_Color col) { mTextColor = col; }
+   Fl_Color text_color()   { return mTextColor; }
 };
 
 // Download-item class -------------------------------------------------------
@@ -123,10 +121,10 @@
    int WgetStatus;
 
    int gw, gh;
-   Group *group;
+   Fl_Group *group;
    ProgressBar *prBar;
-   HighlightButton *prButton;
-   Widget *prTitle, *prGot, *prSize, *prRate, *pr_Rate, *prETA, *prETAt;
+   Fl_Button *prButton;
+   Fl_Widget *prTitle, *prGot, *prSize, *prRate, *pr_Rate, *prETA, *prETAt;
 
 public:
    DLItem(const char *full_filename, const char *url, DLAction action);
@@ -142,7 +140,7 @@
    void pid(pid_t p) { mPid = p; }
    void child_finished(int status);
    void status_msg(const char *msg) { prBar->message((char*)msg); }
-   Widget *get_widget() { return group; }
+   Fl_Widget *get_widget() { return group; }
    int widget_done() { return WidgetDone; }
    void widget_done(int val) { WidgetDone = val; }
    int updates_done() { return UpdatesDone; }
@@ -177,9 +175,9 @@
 
 class DLWin {
    DLItemList *mDList;
-   Window *mWin;
-   ScrollGroup *mScroll;
-   PackedGroup *mPG;
+   Fl_Window *mWin;
+   Fl_Scroll *mScroll;
+   Fl_Pack *mPG;
 
 public:
    DLWin(int ww, int wh);
@@ -221,67 +219,60 @@
 }
 
 ProgressBar::ProgressBar(int x, int y, int w, int h, const char *lbl)
-:  Widget(x, y, w, h, lbl)
+:  Fl_Widget(x, y, w, h, lbl)
 {
    mMin = mPresent = 0;
    mMax = 100;
    mShowPct = true;
    mShowMsg = false;
-   box(DOWN_BOX);
-   selection_color(BLUE);
-   color(WHITE);
-   textcolor(RED);
+   box(FL_DOWN_BOX);
+   color(FL_WHITE);
 }
 
 void ProgressBar::draw()
 {
-   drawstyle(style(), flags());
-   if (damage() & DAMAGE_ALL)
+   struct Rectangle {
+      int x, y, w, h;
+   };
+
+   //drawstyle(style(), flags());
+   if (Fl::damage() & FL_DAMAGE_ALL)
       draw_box();
-   Rectangle r(w(), h());
-   box()->inset(r);
+   Rectangle r = {x(), y(), w(), h()};
+   //box()->inset(r);
    if (mPresent > mMax)
       mPresent = mMax;
    if (mPresent < mMin)
       mPresent = mMin;
    double pct = (mPresent - mMin) / mMax;
 
-   if (vertical()) {
-      int barHeight = int (r.h() * pct + .5);
-      r.y(r.y() + r.h() - barHeight);
-      r.h(barHeight);
-   } else {
-      r.w(int (r.w() * pct + .5));
-   }
-
-   setcolor(selection_color());
+   r.w = r.w * pct + .5;
 
    if (mShowPct) {
-      fillrect(r);
+      fl_rectf(r.x, r.y, r.w, r.h, FL_BLUE);
    } else {
-      Rectangle r2(int (r.w() * pct), 0, int (w() * .1), h());
-      push_clip(r2);
-      fillrect(r);
-      pop_clip();
+      fl_push_clip(int (r.w * pct), 0, int (w() * .1), h());
+      fl_rectf(r.x, r.y, r.w, r.h, FL_BLUE);
+      fl_pop_clip();
    }
 
    if (mShowMsg) {
-      setcolor(textcolor());
-      setfont(this->labelfont(), this->labelsize());
-      drawtext(mMsg, Rectangle(w(), h()), ALIGN_CENTER);
+      fl_color(FL_RED);
+      fl_font(this->labelfont(), this->labelsize());
+      fl_draw(mMsg, x(), y(), w(), h(), FL_ALIGN_CENTER);
    } else if (mShowPct) {
       char buffer[30];
       sprintf(buffer, "%d%%", int (pct * 100 + .5));
-      setcolor(textcolor());
-      setfont(this->labelfont(), this->labelsize());
-      drawtext(buffer, Rectangle(w(), h()), ALIGN_CENTER);
+      fl_color(FL_RED);
+      fl_font(this->labelfont(), this->labelsize());
+      fl_draw(buffer, x(), y(), w(), h(), FL_ALIGN_CENTER);
    }
 }
 
 
 // Download-item class -------------------------------------------------------
 
-static void prButton_scb(Widget *, void *cb_data)
+static void prButton_scb(Fl_Widget *, void *cb_data)
 {
    DLItem *i = (DLItem *)cb_data;
 
@@ -349,76 +340,76 @@
    WgetStatus = -1;
 
    gw = 400, gh = 70;
-   group = new Group(0,0,gw,gh);
+   group = new Fl_Group(0,0,gw,gh);
    group->begin();
-   prTitle = new Widget(24, 7, 290, 23, shortname);
-   prTitle->box(RSHADOW_BOX);
-   prTitle->align(ALIGN_LEFT|ALIGN_INSIDE|ALIGN_CLIP);
-   prTitle->set_flag (RAW_LABEL);
+   prTitle = new Fl_Box(24, 7, 290, 23, shortname);
+   prTitle->box(FL_RSHADOW_BOX);
+   prTitle->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
+   //prTitle->clear_flag (SHORTCUT_LABEL);
    // Attach this 'log_text' to the tooltip
    log_text_add("Target File: ", 13);
    log_text_add(fullname, strlen(fullname));
    log_text_add("\n\n", 2);
 
    prBar = new ProgressBar(24, 40, 92, 20);
-   prBar->box(BORDER_BOX); // ENGRAVED_BOX
+   prBar->box(FL_BORDER_BOX); // ENGRAVED_BOX
    prBar->tooltip("Progress Status");
 
    int ix = 122, iy = 36, iw = 50, ih = 14;
-   Widget *o = new Widget(ix,iy,iw,ih, "Got");
-   o->box(RFLAT_BOX);
-   o->color((Color)0xc0c0c000);
+   Fl_Widget *o = new Fl_Box(ix,iy,iw,ih, "Got");
+   o->box(FL_RFLAT_BOX);
+   o->color((Fl_Color)0xc0c0c000);
    o->tooltip("Downloaded Size");
-   prGot = new Widget(ix,iy+14,iw,ih, "0KB");
-   prGot->align(ALIGN_CENTER|ALIGN_INSIDE);
-   prGot->labelcolor((Color)0x6c6cbd00);
-   prGot->box(NO_BOX);
-
-   ix += iw;
-   o = new Widget(ix,iy,iw,ih, "Size");
-   o->box(RFLAT_BOX);
-   o->color((Color)0xc0c0c000);
-   o->tooltip("Total Size");
-   prSize = new Widget(ix,iy+14,iw,ih, "??");
-   prSize->align(ALIGN_CENTER|ALIGN_INSIDE);
-   prSize->box(NO_BOX);
+   prGot = new Fl_Box(ix,iy+14,iw,ih, "0KB");
+   prGot->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
+   prGot->labelcolor((Fl_Color)0x6c6cbd00);
+   prGot->box(FL_NO_BOX);
 
    ix += iw;
-   o = new Widget(ix,iy,iw,ih, "Rate");
-   o->box(RFLAT_BOX);
-   o->color((Color)0xc0c0c000);
-   o->tooltip("Current transfer Rate (KBytes/sec)");
-   prRate = new Widget(ix,iy+14,iw,ih, "??");
-   prRate->align(ALIGN_CENTER|ALIGN_INSIDE);
-   prRate->box(NO_BOX);
+   o = new Fl_Box(ix,iy,iw,ih, "Size");
+   o->box(FL_RFLAT_BOX);
+   o->color((Fl_Color)0xc0c0c000);
+   o->tooltip("Total Size");
+   prSize = new Fl_Box(ix,iy+14,iw,ih, "??");
+   prSize->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
+   prSize->box(FL_NO_BOX);
 
    ix += iw;
-   o = new Widget(ix,iy,iw,ih, "~Rate");
-   o->box(RFLAT_BOX);
-   o->color((Color)0xc0c0c000);
-   o->tooltip("Average transfer Rate (KBytes/sec)");
-   pr_Rate = new Widget(ix,iy+14,iw,ih, "??");
-   pr_Rate->align(ALIGN_CENTER|ALIGN_INSIDE);
-   pr_Rate->box(NO_BOX);
+   o = new Fl_Box(ix,iy,iw,ih, "Rate");
+   o->box(FL_RFLAT_BOX);
+   o->color((Fl_Color)0xc0c0c000);
+   o->tooltip("Current transfer Rate (KBytes/sec)");
+   prRate = new Fl_Box(ix,iy+14,iw,ih, "??");
+   prRate->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
+   prRate->box(FL_NO_BOX);
 
    ix += iw;
-   prETAt = o = new Widget(ix,iy,iw,ih, "ETA");
-   o->box(RFLAT_BOX);
-   o->color((Color)0xc0c0c000);
+   o = new Fl_Box(ix,iy,iw,ih, "~Rate");
+   o->box(FL_RFLAT_BOX);
+   o->color((Fl_Color)0xc0c0c000);
+   o->tooltip("Average transfer Rate (KBytes/sec)");
+   pr_Rate = new Fl_Box(ix,iy+14,iw,ih, "??");
+   pr_Rate->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
+   pr_Rate->box(FL_NO_BOX);
+
+   ix += iw;
+   prETAt = o = new Fl_Box(ix,iy,iw,ih, "ETA");
+   o->box(FL_RFLAT_BOX);
+   o->color((Fl_Color)0xc0c0c000);
    o->tooltip("Estimated Time of Arrival");
-   prETA = new Widget(ix,iy+14,iw,ih, "??");
-   prETA->align(ALIGN_CENTER|ALIGN_INSIDE);
-   prETA->box(NO_BOX);
+   prETA = new Fl_Box(ix,iy+14,iw,ih, "??");
+   prETA->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
+   prETA->box(FL_NO_BOX);
 
    //ix += 50;
-   //prButton = new HighlightButton(ix, 41, 38, 19, "Stop");
-   prButton = new HighlightButton(328, 9, 38, 19, "Stop");
+   //prButton = new Fl_Button(ix, 41, 38, 19, "Stop");
+   prButton = new Fl_Button(328, 9, 38, 19, "Stop");
    prButton->tooltip("Stop this transfer");
-   prButton->box(UP_BOX);
-   prButton->clear_tab_to_focus();
+   prButton->box(FL_UP_BOX);
+   prButton->clear_visible_focus();
    prButton->callback(prButton_scb, this);
 
-   group->box(ROUND_UP_BOX);
+   group->box(FL_ROUND_UP_BOX);
    group->end();
 }
 
@@ -443,7 +434,7 @@
 {
    if (!log_done()) {
       close(LogPipe[0]);
-      remove_fd(LogPipe[0]);
+      Fl::remove_fd(LogPipe[0]);
       log_done(1);
       // Stop wget
       if (!fork_done())
@@ -612,7 +603,7 @@
          break;
       } else if (st == 0) {
          close(fd_in);
-         remove_fd(fd_in, 1);
+         Fl::remove_fd(fd_in, 1);
          dl_item->log_done(1);
          ret = 0;
          break;
@@ -625,7 +616,7 @@
 void DLItem::father_init()
 {
    close(LogPipe[1]);
-   add_fd(LogPipe[0], 1, read_log_cb, this); // Read
+   Fl::add_fd(LogPipe[0], 1, read_log_cb, this); // Read
 
    // Start the timer after the child is running.
    // (this makes a big difference with wget)
@@ -792,7 +783,7 @@
    }
    sigprocmask(SIG_UNBLOCK, &mask_sigchld, NULL);
 
-   repeat_timeout(1.0,cleanup_cb,data);
+   Fl::repeat_timeout(1.0,cleanup_cb,data);
 }
 
 /*
@@ -819,7 +810,7 @@
    if (cb_used && list->num() == 0)
       exit(0);
 
-   repeat_timeout(1.0,update_cb,data);
+   Fl::repeat_timeout(1.0,update_cb,data);
 }
 
 
@@ -939,13 +930,13 @@
 /*
  * Callback for close window request (WM or EscapeKey press)
  */
-static void dlwin_esc_cb(Widget *, void *)
+static void dlwin_esc_cb(Fl_Widget *, void *)
 {
    const char *msg = "There are running downloads.\n"
                      "ABORT them and EXIT anyway?";
 
    if (dl_win && dl_win->num_running() > 0) {
-      int ch = fltk::choice(msg, "Yes", "*No", "Cancel");
+      int ch = fl_choice(msg, "Yes", "*No", "Cancel");
       if (ch != 0)
          return;
    }
@@ -1001,12 +992,12 @@
    dStr_sprintf(ds,
                 "The file:\n  %s (%d Bytes)\nalready exists. What do we do?",
                 *p_fullname, (int)ss.st_size);
-   ch = fltk::choice(ds->str, "Rename", "Continue", "Abort");
+   ch = fl_choice(ds->str, "Rename", "Continue", "Abort");
    dStr_free(ds, 1);
    MSG("Choice %d\n", ch);
    if (ch == 0) {
       const char *p;
-      p = fltk::file_chooser("Enter a new name:", NULL, *p_fullname);
+      p = fl_file_chooser("Enter a new name:", NULL, *p_fullname);
       if (p) {
          dFree(*p_fullname);
          *p_fullname = dStrdup(p);
@@ -1057,7 +1048,7 @@
  */
 void DLWin::listen(int req_fd)
 {
-   add_fd(req_fd, 1, read_req_cb, NULL); // Read
+   Fl::add_fd(req_fd, 1, read_req_cb, NULL); // Read
 }
 
 /*
@@ -1078,15 +1069,15 @@
    mDList = new DLItemList();
 
    // Create the empty main window
-   mWin = new Window(ww, wh, "Downloads:");
+   mWin = new Fl_Window(ww, wh, "Downloads:");
    mWin->begin();
-   mScroll = new ScrollGroup(0,0,ww,wh);
+   mScroll = new Fl_Scroll(0,0,ww,wh);
    mScroll->begin();
-   mPG = new PackedGroup(0,0,ww,wh);
+   mPG = new Fl_Pack(0,0,ww,wh);
    mPG->end();
    //mPG->spacing(10);
    mScroll->end();
-   mScroll->type(ScrollGroup::VERTICAL);
+   mScroll->type(Fl_Scroll::VERTICAL);
    mWin->end();
    mWin->resizable(mScroll);
    mWin->callback(dlwin_esc_cb, NULL);
@@ -1098,9 +1089,9 @@
    est_sigchld();
 
    // Set the cleanup timeout
-   add_timeout(1.0, cleanup_cb, mDList);
+   Fl::add_timeout(1.0, cleanup_cb, mDList);
    // Set the update timeout
-   add_timeout(1.0, update_cb, mDList);
+   Fl::add_timeout(1.0, update_cb, mDList);
 }
 
 
@@ -1113,7 +1104,7 @@
 {
    int ww = 420, wh = 85;
 
-   lock();
+   Fl::lock();
 
    // Create the download window
    dl_win = new DLWin(ww, wh);
@@ -1123,6 +1114,6 @@
 
    MSG("started...\n");
 
-   return run();
+   return Fl::run();
 }
 
--- a/dw/fltkcomplexbutton.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkcomplexbutton.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -1,7 +1,5 @@
-
-// fltkcomplexbutton.cc contains code from FLTK2's src/Button.cxx
-// that is Copyright 1998-2006 by Bill Spitzak and others.
-// (see http://svn.easysw.com/public/fltk/fltk/trunk/src/Button.cxx)
+// fltkcomplexbutton.cc contains code from FLTK 1.3's src/Fl_Button.cxx
+// that is Copyright 1998-2010 by Bill Spitzak and others.
 
 /*
  * This program is free software; you can redistribute it and/or modify
@@ -18,263 +16,169 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <fltk/events.h>
-#include <fltk/damage.h>
-#include <fltk/Group.h>
-#include <fltk/Box.h>
-#include <stdlib.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Group.H>
+#include <FL/Fl_Window.H>
 
 #include "fltkcomplexbutton.hh"
 
-using namespace fltk;
 using namespace dw::fltk::ui;
 
-/*! \class fltk::ComplexButton
-
-  ComplexButtons generate callbacks when they are clicked by the user. You
-  control exactly when and how by changing the values for when():
-  - fltk::WHEN_NEVER: The callback is not done, instead changed() is
-    turned on.
-  - fltk::WHEN_RELEASE: This is the default, the callback is done
-    after the user successfully clicks the button (i.e. they let it go
-    with the mouse still pointing at it), or when a shortcut is typed.
-  - fltk::WHEN_CHANGED : The callback is done each time the value()
-    changes (when the user pushes and releases the button, and as the
-    mouse is dragged around in and out of the button).
-
-  ComplexButtons can also generate callbacks in response to fltk::SHORTCUT
-  events. The button can either have an explicit shortcut() value or a
-  letter shortcut can be indicated in the label() with an '&'
-  character before it. For the label shortcut it does not matter if
-  Alt is held down, but if you have an input field in the same window,
-  the user will have to hold down the Alt key so that the input field
-  does not eat the event first as an fltk::KEY event.
-
-  \image html buttons.gif
-*/
-
-/*! \fn bool ComplexButton::value() const
-  The current value. True means it is pushed down, false means it is
-  not pushed down. The ToggleComplexButton subclass provides the ability for
-  the user to change this value permanently, otherwise it is just
-  temporary while the user is holding the button down.
-
-  This is the same as Widget::state().
-*/
-
-/*! \fn bool ComplexButton::value(bool)
-  Change the value(). Redraws the button and returns true if the new
-  value is different. This is the same function as Widget::state().
-  See also Widget::set(), Widget::clear(), and Widget::setonly().
-
-  If you turn it on, a normal button will draw pushed-in, until
-  the user clicks it and releases it.
-*/
-
-static bool initial_state;
-
-int ComplexButton::handle(int event) {
-  return handle(event, Rectangle(w(),h()));
+/**
+  Sets the current value of the button.
+  A non-zero value sets the button to 1 (ON), and zero sets it to 0 (OFF).
+  \param[in] v button value.
+  \see set(), clear()
+ */
+int ComplexButton::value(int v) {
+  v = v ? 1 : 0;
+  oldval = v;
+  clear_changed();
+  if (value_ != v) {
+    value_ = v;
+    if (box()) redraw();
+    else redraw_label();
+    return 1;
+  } else {
+    return 0;
+  }
 }
 
-int ComplexButton::handle(int event, const Rectangle& rectangle) {
+/**
+  Turns on this button and turns off all other radio buttons in the group
+  (calling \c value(1) or \c set() does not do this).
+ */
+void ComplexButton::setonly() { // set this radio button on, turn others off
+  value(1);
+  Fl_Group* g = parent();
+  Fl_Widget*const* a = g->array();
+  for (int i = g->children(); i--;) {
+    Fl_Widget* o = *a++;
+    if (o != this && o->type()==FL_RADIO_BUTTON) ((Fl_Button*)o)->value(0);
+  }
+}
+
+void ComplexButton::draw() {
+  if (type() == FL_HIDDEN_BUTTON) return;
+  Fl_Color col = value() ? selection_color() : color();
+  draw_box(value() ? (down_box()?down_box():fl_down(box())) : box(), col);
+  draw_backdrop();
+  if (labeltype() == FL_NORMAL_LABEL && value()) {
+    Fl_Color c = labelcolor();
+    labelcolor(fl_contrast(c, col));
+    draw_label();
+    labelcolor(c);
+  } else draw_label();
+  if (Fl::focus() == this) draw_focus();
+
+  // ComplexButton is a Group; draw its children
+  for (int i = children () - 1; i >= 0; i--)
+     draw_child (*child (i));
+}
+
+int ComplexButton::handle(int event) {
+  int newval;
   switch (event) {
-  case ENTER:
-  case LEAVE:
-    redraw_highlight();
-  case MOVE:
+  case FL_ENTER: /* FALLTHROUGH */
+  case FL_LEAVE:
+//  if ((value_?selection_color():color())==FL_GRAY) redraw();
     return 1;
-  case PUSH:
-    if (pushed()) return 1; // ignore extra pushes on currently-pushed button
-    initial_state = state();
-    clear_flag(PUSHED);
-    /* do_callback(); */
-  case DRAG: {
-    bool inside = event_inside(rectangle);
-    if (inside) {
-      if (!flag(PUSHED)) {
-        set_flag(PUSHED);
-        redraw(DAMAGE_VALUE);
-      }
-    } else {
-      if (flag(PUSHED)) {
-        clear_flag(PUSHED);
-        redraw(DAMAGE_VALUE);
+  case FL_PUSH:
+    if (Fl::visible_focus() && handle(FL_FOCUS)) Fl::focus(this);
+  case FL_DRAG:
+    if (Fl::event_inside(this)) {
+      if (type() == FL_RADIO_BUTTON) newval = 1;
+      else newval = !oldval;
+    } else
+    {
+      clear_changed();
+      newval = oldval;
+    }
+    if (newval != value_) {
+      value_ = newval;
+      set_changed();
+      redraw();
+      if (when() & FL_WHEN_CHANGED) do_callback();
+    }
+    return 1;
+  case FL_RELEASE:
+    if (value_ == oldval) {
+      if (when() & FL_WHEN_NOT_CHANGED) do_callback();
+      return 1;
+    }
+    set_changed();
+    if (type() == FL_RADIO_BUTTON) setonly();
+    else if (type() == FL_TOGGLE_BUTTON) oldval = value_;
+    else {
+      value(oldval);
+      set_changed();
+      if (when() & FL_WHEN_CHANGED) {
+	Fl_Widget_Tracker wp(this);
+        do_callback();
+        if (wp.deleted()) return 1;
       }
     }
-    if (when() & WHEN_CHANGED) { // momentary button must record state()
-      if (state(inside ? !initial_state : initial_state))
-        do_callback();
-    }
-    return 1;}
-  case RELEASE:
-    if (!flag(PUSHED)) return 1;
-    clear_flag(PUSHED);
-    redraw(DAMAGE_VALUE);
-    if (type() == RADIO)
-      setonly();
-    else if (type() == TOGGLE)
-      state(!initial_state);
-    else {
-      state(initial_state);
-      if (when() & WHEN_CHANGED) {do_callback(); return 1;}
-    }
-    if (when() & WHEN_RELEASE) do_callback(); else set_changed();
+    if (when() & FL_WHEN_RELEASE) do_callback();
     return 1;
-  case FOCUS:
-    redraw(1); // minimal redraw to just add the focus box
-    // grab initial focus if we are an ReturnComplexButton:
-    return shortcut()==ReturnKey ? 2 : 1;
-  case UNFOCUS:
-    redraw(DAMAGE_HIGHLIGHT);
-    return 1;
-  case KEY:
-    if (event_key() == ' ' || event_key() == ReturnKey
-        || event_key() == KeypadEnter) goto EXECUTE;
-    return 0;
-  case SHORTCUT:
-    if (!test_shortcut()) return 0;
-  EXECUTE:
-    if (type() == RADIO) {
-      if (!state()) {
-        setonly();
-        if (when() & WHEN_CHANGED) do_callback(); else set_changed();
+  case FL_SHORTCUT:
+    if (!(shortcut() ?
+	  Fl::test_shortcut(shortcut()) : test_shortcut())) return 0;    
+    if (Fl::visible_focus() && handle(FL_FOCUS)) Fl::focus(this);
+    goto triggered_by_keyboard;
+  case FL_FOCUS : /* FALLTHROUGH */
+  case FL_UNFOCUS :
+    if (Fl::visible_focus()) {
+      if (box() == FL_NO_BOX) {
+	// Widgets with the FL_NO_BOX boxtype need a parent to
+	// redraw, since it is responsible for redrawing the
+	// background...
+	int X = x() > 0 ? x() - 1 : 0;
+	int Y = y() > 0 ? y() - 1 : 0;
+	if (window()) window()->damage(FL_DAMAGE_ALL, X, Y, w() + 2, h() + 2);
+      } else redraw();
+      return 1;
+    } else return 0;
+  case FL_KEYBOARD :
+    if (Fl::focus() == this && Fl::event_key() == ' ' &&
+        !(Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META))) {
+      set_changed();
+    triggered_by_keyboard:
+      Fl_Widget_Tracker wp(this);
+      if (type() == FL_RADIO_BUTTON && !value_) {
+	setonly();
+	if (when() & FL_WHEN_CHANGED) do_callback();
+      } else if (type() == FL_TOGGLE_BUTTON) {
+	value(!value());
+	if (when() & FL_WHEN_CHANGED) do_callback();
       }
-    } else if (type() == TOGGLE) {
-      state(!state());
-      if (when() & WHEN_CHANGED) do_callback(); else set_changed();
+      if (wp.deleted()) return 1;
+      if (when() & FL_WHEN_RELEASE) do_callback();
+      return 1;
     }
-    if (when() & WHEN_RELEASE) do_callback();
-    return 1;
   default:
     return 0;
   }
 }
 
-////////////////////////////////////////////////////////////////
-
-#include <fltk/draw.h>
-
-extern Widget* fl_did_clipping;
-
-/*!
-  This function provides a mess of back-compatabilty and Windows
-  emulation to subclasses of ComplexButton to draw with. It will draw the
-  button according to the current state of being pushed and it's
-  state(). If non-zero is passed for \a glyph_width then the glyph()
-  is drawn in that space on the left (or on the right if negative),
-  and it assummes the glyph indicates the state(), so the box is only
-  used to indicate the pushed state.
-*/
-void ComplexButton::draw(int glyph_width) const
-{
-  // For back-compatability, setting color() or box() directly on a plain
-  // button will cause it to act like buttoncolor() or buttonbox() are
-  // set:
-  Style localstyle;
-  const Style* style = this->style();
-  if (!glyph_width) {
-    localstyle = *style;
-    if (localstyle.color_) localstyle.buttoncolor_ = localstyle.color_;
-    if (localstyle.box_) localstyle.buttonbox_ = localstyle.box_;
-    if (localstyle.labelcolor_) localstyle.textcolor_ = localstyle.labelcolor_;
-    style = &localstyle;
-  }
-
-  Box* box = style->buttonbox();
-
-  Flags box_flags = flags() | OUTPUT;
-  Flags glyph_flags = box_flags & ~(HIGHLIGHT|OUTPUT);
-  if (glyph_width) box_flags &= ~STATE;
-
-  // only draw "inside" labels:
-  Rectangle r(0,0,w(),h());
-
-  if (box == NO_BOX) {
-    Color bg;
-    if (box_flags & HIGHLIGHT && (bg = style->highlight_color())) {
-      setcolor(bg);
-      fillrect(r);
-    } else if (label() || (damage()&(DAMAGE_EXPOSE|DAMAGE_HIGHLIGHT))) {
-      // erase the background so we can redraw the label in the new color:
-      draw_background();
-    }
-    // this allows these buttons to be put into browser/menus:
-    //fg = fl_item_labelcolor(this);
-  } else {
-    if ((damage()&(DAMAGE_EXPOSE|DAMAGE_HIGHLIGHT))
-        && !box->fills_rectangle()) {
-      // Erase the area behind non-square boxes
-      draw_background();
-    }
-  }
-
-  // Draw the box:
-  drawstyle(style,box_flags);
-  // For back-compatability we use any directly-set selection_color()
-  // to color the box:
-  if (!glyph_width && state() && style->selection_color_) {
-    setbgcolor(style->selection_color_);
-    setcolor(contrast(style->selection_textcolor(),style->selection_color_));
-  }
-  box->draw(r);
-  Rectangle r1(r); box->inset(r1);
-
-  if (glyph_width) {
-    int g = abs(glyph_width);
-    Rectangle lr(r1);
-    Rectangle gr(r1, g, g);
-    if (glyph_width < 0) {
-      lr.w(lr.w()-g-3);
-      gr.x(r1.r()-g-3);
-    } else {
-      lr.set_x(g+3);
-      gr.x(r1.x()+3);
-    }
-    this->draw_label(lr, box_flags);
-    drawstyle(style,glyph_flags);
-    this->glyph()->draw(gr);
-    drawstyle(style,box_flags);
-  } else {
-    this->draw_label(r1, box_flags);
-  }
-  box->draw_symbol_overlay(r);
+/**
+  The constructor creates the button using the given position, size and label.
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+ComplexButton::ComplexButton(int X, int Y, int W, int H, const char *L)
+: Fl_Group(X,Y,W,H,L) {
+  Fl_Group::current(0);
+  box(FL_UP_BOX);
+  down_box(FL_NO_BOX);
+  value_ = oldval = 0;
+  shortcut_ = 0;
 }
 
-void ComplexButton::draw() {
-  if (type() == HIDDEN) {
-    fl_did_clipping = this;
-    return;
-  }
-  draw(0);
-
-  // ComplexButton is a Group, draw its children
-  for (int i = children () - 1; i >= 0; i--)
-     draw_child (*child (i));
+ComplexButton::~ComplexButton() {
+   /*
+    * The Fl_Group destructor clear()s the children, but layout expects
+    * the flat view to be around until it deletes if.
+    */
+   remove(0);
 }
-
-////////////////////////////////////////////////////////////////
-
-static NamedStyle style("ComplexButton", 0, &ComplexButton::default_style);
-NamedStyle* ComplexButton::default_style = &::style;
-
-ComplexButton::ComplexButton(int x,int y,int w,int h, const char *l) :
-   Group(x,y,w,h,l)
-{
-  style(default_style);
-  highlight_color(GRAY20);
-  //set_click_to_focus();
-}
-
-////////////////////////////////////////////////////////////////
-
-/*! \class fltk::ToggleComplexButton
-  This button turns the state() on and off each release of a click
-  inside of it.
-
-  You can also convert a regular button into this by doing
-  type(ComplexButton::TOGGLE) to it.
-*/
-
-//
-//
--- a/dw/fltkcomplexbutton.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkcomplexbutton.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -1,7 +1,6 @@
 
-// fltkcomplexbutton.hh contains code from FLTK2's fltk/Button.h
-// that is Copyright 2002 by Bill Spitzak and others.
-// (see http://svn.easysw.com/public/fltk/fltk/trunk/fltk/Button.h)
+// fltkcomplexbutton.hh contains code from FLTK 1.3's FL/Fl_Button.H
+// that is Copyright 1998-2010 by Bill Spitzak and others.
 
 /*
  * This program is free software; you can redistribute it and/or modify
@@ -21,35 +20,121 @@
 #ifndef __FLTK_COMPLEX_BUTTON_HH__
 #define __FLTK_COMPLEX_BUTTON_HH__
 
-#include <fltk/Group.h>
+#include <FL/Fl_Group.H>
+
+// values for type()
+#define FL_NORMAL_BUTTON	0   /**< value() will be set to 1 during the press of the button and 
+                                         reverts back to 0 when the button is released */
+#define FL_TOGGLE_BUTTON	1   ///< value() toggles between 0 and 1 at every click of the button
+#define FL_RADIO_BUTTON		(FL_RESERVED_TYPE+2) /**< is set to 1 at button press, and all other
+				         buttons in the same group with <tt>type() == FL_RADIO_BUTTON</tt>
+				         are set to zero.*/
+#define FL_HIDDEN_BUTTON	3   ///< for Forms compatibility
+
+extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*);
 
 namespace dw {
 namespace fltk {
 namespace ui {
 
-class ComplexButton: public ::fltk::Group
-{
-public:
-  enum {HIDDEN=3}; // back-comptability value to hide the button
-
-  bool  value() const { return state(); }
-  bool  value(bool v) { return state(v); }
+class FL_EXPORT ComplexButton : public Fl_Group {
 
-  int handle(int);
-  int handle(int event, const Rectangle&);
-  ComplexButton(int,int,int,int,const char * = 0);
-  ~ComplexButton() { remove_all ();};
-  static ::fltk::NamedStyle* default_style;
+  int shortcut_;
+  char value_;
+  char oldval;
+  uchar down_box_;
 
+protected:
+
+  static Fl_Widget_Tracker *key_release_tracker;
+  static void key_release_timeout(void*);
+  void simulate_key_action();
+  
   virtual void draw();
-  void draw(int glyph_width) const;
+
+public:
+
+  virtual int handle(int);
+
+  ComplexButton(int X, int Y, int W, int H, const char *L = 0);
+  ~ComplexButton();
+
+  int value(int v);
+
+  /**
+    Returns the current value of the button (0 or 1).
+   */
+  char value() const {return value_;}
+
+  /**
+    Same as \c value(1).
+    \see value(int v)
+   */
+  int set() {return value(1);}
+
+  /**
+    Same as \c value(0).
+    \see value(int v)
+   */
+  int clear() {return value(0);}
+
+  void setonly(); // this should only be called on FL_RADIO_BUTTONs
+
+  /**
+    Returns the current shortcut key for the button.
+    \retval int
+   */
+  int shortcut() const {return shortcut_;}
+
+  /**
+    Sets the shortcut key to \c s.
+    Setting this overrides the use of '\&' in the label().
+    The value is a bitwise OR of a key and a set of shift flags, for example:
+    <tt>FL_ALT | 'a'</tt>, or
+    <tt>FL_ALT | (FL_F + 10)</tt>, or just
+    <tt>'a'</tt>.
+    A value of 0 disables the shortcut.
+
+    The key can be any value returned by Fl::event_key(), but will usually be
+    an ASCII letter.  Use a lower-case letter unless you require the shift key
+    to be held down.
+
+    The shift flags can be any set of values accepted by Fl::event_state().
+    If the bit is on, that shift key must be pushed.  Meta, Alt, Ctrl, and
+    Shift must be off if they are not in the shift flags (zero for the other
+    bits indicates a "don't care" setting).
+    \param[in] s bitwise OR of key and shift flags
+   */
+  void shortcut(int s) {shortcut_ = s;}
+
+  /**
+    Returns the current down box type, which is drawn when value() is non-zero.
+    \retval Fl_Boxtype
+   */
+  Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
+
+  /**
+    Sets the down box type. The default value of 0 causes FLTK to figure out
+    the correct matching down version of box().
+    \param[in] b down box type
+   */
+  void down_box(Fl_Boxtype b) {down_box_ = b;}
+
+  /// (for backwards compatibility)
+  void shortcut(const char *s) {shortcut(fl_old_shortcut(s));}
+
+  /// (for backwards compatibility)
+  Fl_Color down_color() const {return selection_color();}
+
+  /// (for backwards compatibility)
+  void down_color(unsigned c) {selection_color(c);}
 };
 
 } // namespace ui
 } // namespace fltk
 } // namespace dw
 
-#endif // __FLTK_COMPLEX_BUTTON_HH__
+#endif
 
 //
 //
--- a/dw/fltkcore.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkcore.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -13,7 +13,7 @@
 } // namespace fltk
 } // namespace core
 
-#include <fltk/Widget.h>
+#include <FL/Fl_Widget.H>
 
 #include "core.hh"
 #include "fltkimgbuf.hh"
--- a/dw/fltkflatview.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkflatview.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -21,12 +21,8 @@
 
 #include "fltkflatview.hh"
 
-#include <fltk/draw.h>
-#include <fltk/events.h>
-
 #include <stdio.h>
 
-using namespace fltk;
 using namespace lout::container::typed;
 
 namespace dw {
@@ -82,24 +78,24 @@
 {
 }
 
-int FltkFlatView::translateViewXToCanvasX (int x)
+int FltkFlatView::translateViewXToCanvasX (int X)
 {
-   return x;
+   return X - x ();
 }
 
-int FltkFlatView::translateViewYToCanvasY (int y)
+int FltkFlatView::translateViewYToCanvasY (int Y)
 {
-   return y;
+   return Y - y ();
 }
 
-int FltkFlatView::translateCanvasXToViewX (int x)
+int FltkFlatView::translateCanvasXToViewX (int X)
 {
-   return x;
+   return X + x ();
 }
 
-int FltkFlatView::translateCanvasYToViewY (int y)
+int FltkFlatView::translateCanvasYToViewY (int Y)
 {
-   return y;
+   return Y + y ();
 }
 
 
--- a/dw/fltkflatview.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkflatview.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -1,9 +1,6 @@
 #ifndef __DW_FLTKFLATVIEW_HH__
 #define __DW_FLTKFLATVIEW_HH__
 
-#include <fltk/Group.h>
-#include <fltk/Scrollbar.h>
-
 #include "core.hh"
 #include "fltkcore.hh"
 #include "fltkviewbase.hh"
--- a/dw/fltkimgbuf.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkimgbuf.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -23,13 +23,10 @@
 #include "../lout/msg.h"
 #include "../lout/misc.hh"
 
-#include <fltk/draw.h>
-#include <fltk/Color.h>
+#include <FL/fl_draw.H>
 
 #define IMAGE_MAX_AREA (6000 * 6000)
 
-using namespace fltk;
-
 namespace dw {
 namespace fltk {
 
@@ -302,7 +299,7 @@
    return ySrc * height / root->height;
 }
 
-void FltkImgbuf::draw (::fltk::Widget *target, int xRoot, int yRoot,
+void FltkImgbuf::draw (Fl_Widget *target, int xRoot, int yRoot,
                        int x, int y, int width, int height)
 {
    // TODO: Clarify the question, whether "target" is the current widget
@@ -324,10 +321,9 @@
       height = this->height - y;
    }
 
-   // Draw
-   ::fltk::Rectangle rect (xRoot + x, yRoot + y, width, height);
-   PixelType ptype = (type == RGBA) ? ::fltk::RGBA : ::fltk::RGB;
-   drawimage(rawdata+bpp*(y*this->width + x),ptype,rect,bpp*this->width);
+   fl_draw_image(rawdata+bpp*(y*this->width + x), xRoot + x, yRoot + y, width,
+                 height, bpp, this->width * bpp);
+
 }
 
 } // namespace dw
--- a/dw/fltkimgbuf.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkimgbuf.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -55,7 +55,7 @@
    void setDeleteOnUnref (bool deleteOnUnref);
    bool isReferred ();
 
-   void draw (::fltk::Widget *target, int xRoot, int yRoot,
+   void draw (Fl_Widget *target, int xRoot, int yRoot,
               int x, int y, int width, int height);
 };
 
--- a/dw/fltkmisc.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkmisc.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -18,11 +18,10 @@
  */
 
 
-
+#include "../lout/msg.h"
 #include "fltkmisc.hh"
 
-#include <fltk/events.h>
-#include <fltk/Monitor.h>
+#include <FL/Fl.H>
 #include <stdio.h>
 
 namespace dw {
@@ -31,17 +30,17 @@
 
 int screenWidth ()
 {
-   return ::fltk::Monitor::all ().w ();
+   return Fl::w ();
 }
 
 int screenHeight ()
 {
-   return ::fltk::Monitor::all ().h ();
+   return Fl::h ();
 }
 
 void warpPointer (int x, int y)
 {
-   ::fltk::warp_mouse (x, y);
+   MSG_ERR("no warpPointer mechanism available.\n");
 }
 
 } // namespace misc
--- a/dw/fltkplatform.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkplatform.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -24,18 +24,12 @@
 #include "../lout/msg.h"
 #include "fltkcore.hh"
 
-#include <fltk/draw.h>
-#include <fltk/run.h>
-#include <fltk/events.h>
-#include <fltk/Monitor.h>
-#include <fltk/InvisibleBox.h>
-#include <fltk/Tooltip.h>
-#include <fltk/utf.h>
+#include <FL/fl_draw.H>
+#include <FL/Fl_Tooltip.H>
 
 namespace dw {
 namespace fltk {
 
-using namespace ::fltk;
 using namespace lout;
 
 /**
@@ -47,37 +41,86 @@
    new container::typed::HashTable <dw::core::style::FontAttrs,
                                     FltkFont> (false, false);
 
+container::typed::HashTable <lout::object::ConstString,
+                             FltkFont::FontFamily> *FltkFont::systemFonts = NULL;
+
+FltkFont::FontFamily FltkFont::standardFontFamily;
+
+FltkFont::FontFamily::FontFamily ()
+{
+   font[0] = FL_HELVETICA;
+   font[1] = FL_HELVETICA_BOLD;
+   font[2] = FL_HELVETICA_ITALIC;
+   font[3] = FL_HELVETICA_BOLD_ITALIC;
+}
+
+void FltkFont::FontFamily::set (Fl_Font f, int attrs)
+{
+   int idx = 0;
+   if (attrs & FL_BOLD)
+      idx += 1;
+   if (attrs & FL_ITALIC)
+      idx += 2;
+   font[idx] = f;
+}
+
+Fl_Font FltkFont::FontFamily::get (int attrs)
+{
+   int idx = 0;
+   if (attrs & FL_BOLD)
+      idx += 1;
+   if (attrs & FL_ITALIC)
+      idx += 2;
+   return font[idx];
+}
+
 FltkFont::FltkFont (core::style::FontAttrs *attrs)
 {
+   if (!systemFonts) {
+      systemFonts = new container::typed::HashTable
+         <lout::object::ConstString, FontFamily> (true, true);
+
+      int k = Fl::set_fonts ("-*");
+      for (int i = 0; i < k; i++) {
+         int t;
+         Fl::get_font_name ((Fl_Font) i, &t);
+         const char *name = Fl::get_font ((Fl_Font) i);
+         object::String *familyName = new object::String(name + 1);
+         FontFamily *family = systemFonts->get (familyName);
+
+         if (family) {
+            family->set ((Fl_Font) i, t);
+            delete familyName;
+         } else {
+            family = new FontFamily ();
+            family->set ((Fl_Font) i, t);
+            systemFonts->put (familyName, family);
+         }
+      }
+   }
+
    copyAttrs (attrs);
 
    int fa = 0;
    if (weight >= 500)
-      fa |= BOLD;
+      fa |= FL_BOLD;
    if (style != core::style::FONT_STYLE_NORMAL)
-      fa  |= ITALIC;
+      fa |= FL_ITALIC;
 
-   font = ::fltk::font(name, fa);
-   if (font == NULL) {
-      /*
-       * If using xft, fltk::HELVETICA just means sans, fltk::COURIER
-       * means mono, and fltk::TIMES means serif.
-       */
-      font = HELVETICA->plus (fa);
-   }
+   object::ConstString nameString (name);
+   FontFamily *family = systemFonts->get (&nameString);
+   if (!family)
+      family = &standardFontFamily;
 
-   setfont(font, size);
-   spaceWidth = misc::max(0, (int)getwidth(" ") + letterSpacing);
-   int xw, xh;
-   measure("x", xw, xh);
+   font = family->get (fa);
+
+   fl_font(font, size);
+   spaceWidth = misc::max(0, (int)fl_width(' ') + letterSpacing);
+   int xx, xy, xw, xh;
+   fl_text_extents("x", xx, xy, xw, xh);
    xHeight = xh;
-   ascent = (int)getascent();
-   descent = (int)getdescent();
-
-   /**
-    * \bug The code above does not seem to work, so this workaround.
-    */
-   xHeight = ascent * 3 / 5;
+   descent = fl_descent();
+   ascent = fl_height() - descent;
 }
 
 FltkFont::~FltkFont ()
@@ -86,9 +129,16 @@
 }
 
 bool
+FltkFont::fontExists (const char *name)
+{
+   object::ConstString familyName (name);
+   return systemFonts->get (&familyName) != NULL;
+}
+
+bool
 FltkPlatform::fontExists (const char *name)
 {
-   return ::fltk::font(name) != NULL;
+   return FltkFont::fontExists (name);
 }
 
 FltkFont*
@@ -114,26 +164,10 @@
 {
    this->color = color;
 
-   /*
-    * fltk/setcolor.cxx:
-    * "A Color of zero (fltk::NO_COLOR) will draw black but is
-    * ambiguous. It is returned as an error value or to indicate portions
-    * of a Style that should be inherited, and it is also used as the
-    * default label color for everything so that changing color zero can
-    * be used by the -fg switch. You should use fltk::BLACK (56) to get
-    * black."
-    *
-    * i.e., zero only works sometimes.
-    */
-
-   if (!(colors[SHADING_NORMAL] = shadeColor (color, SHADING_NORMAL) << 8))
-      colors[SHADING_NORMAL] = ::fltk::BLACK;
-   if (!(colors[SHADING_INVERSE] = shadeColor (color, SHADING_INVERSE) << 8))
-      colors[SHADING_INVERSE] = ::fltk::BLACK;
-   if (!(colors[SHADING_DARK] = shadeColor (color, SHADING_DARK) << 8))
-      colors[SHADING_DARK] = ::fltk::BLACK;
-   if (!(colors[SHADING_LIGHT] = shadeColor (color, SHADING_LIGHT) << 8))
-      colors[SHADING_LIGHT] = ::fltk::BLACK;
+   colors[SHADING_NORMAL] = shadeColor (color, SHADING_NORMAL) << 8;
+   colors[SHADING_INVERSE] = shadeColor (color, SHADING_INVERSE) << 8;
+   colors[SHADING_DARK] = shadeColor (color, SHADING_DARK) << 8;
+   colors[SHADING_LIGHT] = shadeColor (color, SHADING_LIGHT) << 8;
 }
 
 FltkColor::~FltkColor ()
@@ -157,34 +191,16 @@
 FltkTooltip::FltkTooltip (const char *text) : Tooltip(text)
 {
    shown = false;
-
-   if (!text || !strpbrk(text, "&@")) {
-      escaped_str = NULL;
-   } else {
-      /*
-       * WORKAROUND: ::fltk::Tooltip::tooltip_timeout() makes instance_
-       * if necessary, and immediately uses it. This means that we can't
-       * get our hands on it to set RAW_LABEL until after it has been shown
-       * once. So let's escape the special characters ourselves.
-       */
-      const char *src = text;
-      char *dest = escaped_str = (char *) malloc(strlen(text) * 2 + 1);
-
-      while (*src) {
-         if (*src == '&' || *src == '@')
-            *dest++ = *src;
-         *dest++ = *src++;
-      }
-      *dest = '\0';
-   }
 }
 
 FltkTooltip::~FltkTooltip ()
 {
+#if 0
+PORT1.3
+probably can remember the one from onEnter
    if (shown)
-      ::fltk::Tooltip::exit();
-   if (escaped_str)
-      free(escaped_str);
+      Fl_Tooltip::exit();
+#endif
 }
 
 FltkTooltip *FltkTooltip::create (const char *text)
@@ -194,16 +210,16 @@
 
 void FltkTooltip::onEnter()
 {
-   fltk::Widget *widget = fltk::belowmouse();
+   Fl_Widget *widget = Fl::belowmouse();
 
-   ::fltk::Tooltip::enter(widget, *((fltk::Rectangle *)widget),
-                          escaped_str ? escaped_str : str);
+   Fl_Tooltip::enter_area(widget, widget->x(), widget->y(), widget->w(),
+                          widget->h(), str);
    shown = true;
 }
 
 void FltkTooltip::onLeave()
 {
-   ::fltk::Tooltip::exit();
+   Fl_Tooltip::exit(NULL);
    shown = false;
 }
 
@@ -211,21 +227,21 @@
 {
 }
 
-void FltkView::addFltkWidget (::fltk::Widget *widget,
+void FltkView::addFltkWidget (Fl_Widget *widget,
                               core::Allocation *allocation)
 {
 }
 
-void FltkView::removeFltkWidget (::fltk::Widget *widget)
+void FltkView::removeFltkWidget (Fl_Widget *widget)
 {
 }
 
-void FltkView::allocateFltkWidget (::fltk::Widget *widget,
+void FltkView::allocateFltkWidget (Fl_Widget *widget,
                                    core::Allocation *allocation)
 {
 }
 
-void FltkView::drawFltkWidget (::fltk::Widget *widget, core::Rectangle *area)
+void FltkView::drawFltkWidget (Fl_Widget *widget, core::Rectangle *area)
 {
 }
 
@@ -310,7 +326,7 @@
 FltkPlatform::~FltkPlatform ()
 {
    if (idleFuncRunning)
-      remove_idle (generalStaticIdle, (void*)this);
+      Fl::remove_idle (generalStaticIdle, (void*)this);
    delete idleQueue;
    delete resources;
 }
@@ -363,23 +379,23 @@
       int sc_fontsize = lout::misc::roundInt(ff->size * 0.78);
       for (curr = 0; next < len; curr = next) {
          next = nextGlyph(text, curr);
-         wc = utf8decode(text + curr, text + next, &nb);
+         wc = fl_utf8decode(text + curr, text + next, &nb);
          if ((wcu = towupper(wc)) == wc) {
             /* already uppercase, just draw the character */
-            setfont(ff->font, ff->size);
+            fl_font(ff->font, ff->size);
             width += font->letterSpacing;
-            width += (int)getwidth(text + curr, next - curr);
+            width += (int)fl_width(text + curr, next - curr);
          } else {
             /* make utf8 string for converted char */
-            nb = utf8encode(wcu, chbuf);
-            setfont(ff->font, sc_fontsize);
+            nb = fl_utf8encode(wcu, chbuf);
+            fl_font(ff->font, sc_fontsize);
             width += font->letterSpacing;
-            width += (int)getwidth(chbuf, nb);
+            width += (int)fl_width(chbuf, nb);
          }
       }
    } else {
-      setfont (ff->font, ff->size);
-      width = (int) getwidth (text, len);
+      fl_font (ff->font, ff->size);
+      width = (int) fl_width (text, len);
 
       if (font->letterSpacing) {
          int curr = 0, next = 0;
@@ -397,22 +413,28 @@
 
 int FltkPlatform::nextGlyph (const char *text, int idx)
 {
-   return utf8fwd (&text[idx + 1], text, &text[strlen (text)]) - text;
+   return fl_utf8fwd (&text[idx + 1], text, &text[strlen (text)]) - text;
 }
 
 int FltkPlatform::prevGlyph (const char *text, int idx)
 {
-   return utf8back (&text[idx - 1], text, &text[strlen (text)]) - text;
+   return fl_utf8back (&text[idx - 1], text, &text[strlen (text)]) - text;
 }
 
 float FltkPlatform::dpiX ()
 {
-   return ::fltk::Monitor::all ().dpi_x ();
+   float horizontal, vertical;
+
+   Fl::screen_dpi(horizontal, vertical);
+   return horizontal;
 }
 
 float FltkPlatform::dpiY ()
 {
-   return ::fltk::Monitor::all ().dpi_y ();
+   float horizontal, vertical;
+
+   Fl::screen_dpi(horizontal, vertical);
+   return vertical;
 }
 
 void FltkPlatform::generalStaticIdle (void *data)
@@ -435,7 +457,7 @@
 
    if (idleQueue->isEmpty()) {
       idleFuncRunning = false;
-      remove_idle (generalStaticIdle, (void*)this);
+      Fl::remove_idle (generalStaticIdle, (void*)this);
    }
 }
 
@@ -449,7 +471,7 @@
     * idle function, the passed idle function is put into a queue.
     */
    if (!idleFuncRunning) {
-      add_idle (generalStaticIdle, (void*)this);
+      Fl::add_idle (generalStaticIdle, (void*)this);
       idleFuncRunning = true;
    }
 
@@ -478,7 +500,7 @@
    }
 
    if (idleFuncRunning && idleQueue->isEmpty())
-      remove_idle (generalStaticIdle, (void*)this);
+      Fl::remove_idle (generalStaticIdle, (void*)this);
 }
 
 core::style::Font *FltkPlatform::createFont (core::style::FontAttrs
@@ -500,7 +522,7 @@
 
 void FltkPlatform::copySelection(const char *text)
 {
-   fltk::copy(text, strlen(text), false);
+   Fl::copy(text, strlen(text), 0);
 }
 
 core::Imgbuf *FltkPlatform::createImgbuf (core::Imgbuf::Type type,
--- a/dw/fltkplatform.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkplatform.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -5,8 +5,6 @@
 #   error Do not include this file directly, use "fltkcore.hh" instead.
 #endif
 
-#include <fltk/Font.h>
-
 namespace dw {
 
 /**
@@ -16,6 +14,18 @@
 
 class FltkFont: public core::style::Font
 {
+   class FontFamily: public lout::object::Object {
+         Fl_Font font[4];
+      public:
+         FontFamily ();
+         void set (Fl_Font, int attrs);
+         Fl_Font get (int attrs);
+   };
+
+   static FontFamily standardFontFamily;
+
+   static lout::container::typed::HashTable <lout::object::ConstString,
+                                             FontFamily> *systemFonts;
    static lout::container::typed::HashTable <dw::core::style::FontAttrs,
                                        FltkFont> *fontsTable;
 
@@ -23,9 +33,10 @@
    ~FltkFont ();
 
 public:
-   ::fltk::Font *font;
+   Fl_Font font;
 
    static FltkFont *create (core::style::FontAttrs *attrs);
+   static bool fontExists (const char *name);
 };
 
 
@@ -49,7 +60,6 @@
    FltkTooltip (const char *text);
    ~FltkTooltip ();
    bool shown;
-   char *escaped_str; /* fltk WORKAROUND */
 public:
    static FltkTooltip *create(const char *text);
    void onEnter();
@@ -66,12 +76,12 @@
 public:
    virtual bool usesFltkWidgets () = 0;
 
-   virtual void addFltkWidget (::fltk::Widget *widget,
+   virtual void addFltkWidget (Fl_Widget *widget,
                                core::Allocation *allocation);
-   virtual void removeFltkWidget (::fltk::Widget *widget);
-   virtual void allocateFltkWidget (::fltk::Widget *widget,
+   virtual void removeFltkWidget (Fl_Widget *widget);
+   virtual void allocateFltkWidget (Fl_Widget *widget,
                                     core::Allocation *allocation);
-   virtual void drawFltkWidget (::fltk::Widget *widget, core::Rectangle *area);
+   virtual void drawFltkWidget (Fl_Widget *widget, core::Rectangle *area);
 };
 
 
--- a/dw/fltkpreview.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkpreview.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -22,15 +22,13 @@
 #include "fltkpreview.hh"
 #include "fltkmisc.hh"
 
-#include <fltk/events.h>
-#include <fltk/xbmImage.h>
-#include <fltk/draw.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Bitmap.H>
+#include <FL/fl_draw.H>
 #include <stdio.h>
 
 #include "preview.xbm"
 
-using namespace ::fltk;
-
 namespace dw {
 namespace fltk {
 
@@ -126,7 +124,7 @@
     * else that measures text).
     */
    FltkFont *ff = (FltkFont*)font;
-   setfont(ff->font, translateCanvasXToViewX (ff->size));
+   Fl::set_font(ff->font, translateCanvasXToViewX (ff->size));
 #if 0
    /**
     * \todo Normally, this should already be known, maybe it
@@ -144,9 +142,8 @@
    setcolor(((FltkColor*)color)->colors[shading]);
    fillrect (rect);
 #endif
-   setcolor(((FltkColor*)color)->colors[shading]);
-   drawtext(text, len,
-            translateCanvasXToViewX (x), translateCanvasYToViewY (y));
+   fl_color(((FltkColor*)color)->colors[shading]);
+   fl_draw(text, len, translateCanvasXToViewX (x), translateCanvasYToViewY(y));
 }
 
 void FltkPreview::drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot,
@@ -159,7 +156,7 @@
    return false;
 }
 
-void FltkPreview::drawFltkWidget (::fltk::Widget *widget,
+void FltkPreview::drawFltkWidget (Fl_Widget *widget,
                                   core::Rectangle *area)
 {
 }
@@ -167,9 +164,9 @@
 // ----------------------------------------------------------------------
 
 FltkPreviewWindow::FltkPreviewWindow (dw::core::Layout *layout):
-   MenuWindow (1, 1)
+   Fl_Menu_Window (1, 1)
 {
-   box (EMBOSSED_BOX);
+   box (FL_EMBOSSED_BOX);
 
    begin ();
    preview = new FltkPreview (BORDER_WIDTH, BORDER_WIDTH, 1, 1, layout);
@@ -205,7 +202,7 @@
       height = preview->canvasHeight * maxWidth / preview->canvasWidth;
    }
 
-   get_mouse(mx, my);
+   Fl::get_mouse(mx, my);
 
    posX = mx - preview->translateCanvasXToViewX (preview->scrollX
                                                  + preview->scrollWidth / 2);
@@ -237,13 +234,12 @@
 
    resize (posX, posY, width, height);
 
-   preview->w (w () - 2 * BORDER_WIDTH);
-   preview->h (h () - 2 * BORDER_WIDTH);
+   preview->size(w () - 2 * BORDER_WIDTH, h () - 2 * BORDER_WIDTH);
 }
 
 void FltkPreviewWindow::hideWindow ()
 {
-   Window::hide ();
+   Fl_Window::hide ();
 }
 
 void FltkPreviewWindow::scrollTo (int mouseX, int mouseY)
@@ -263,9 +259,9 @@
 FltkPreviewButton::FltkPreviewButton (int x, int y, int w, int h,
                                       dw::core::Layout *layout,
                                       const char *label):
-   Button (x, y, w, h, label)
+   Fl_Button (x, y, w, h, label)
 {
-   image (new xbmImage (preview_bits, preview_width, preview_height));
+   image (new Fl_Bitmap (preview_bits, preview_width, preview_height));
    window = new FltkPreviewWindow (layout);
 }
 
@@ -278,23 +274,23 @@
    /** \bug Some parts are missing. */
 
    switch (event) {
-   case PUSH:
+   case FL_PUSH:
       window->showWindow ();
-      return Button::handle (event);
+      return Fl_Button::handle (event);
 
-   case DRAG:
+   case FL_DRAG:
       if (window->visible ()) {
-         window->scrollTo (event_x_root (), event_y_root ());
+         window->scrollTo (Fl::event_x_root (), Fl::event_y_root ());
          return 1;
       }
-      return Button::handle (event);
+      return Fl_Button::handle (event);
 
-   case RELEASE:
+   case FL_RELEASE:
       window->hideWindow ();
-      return Button::handle (event);
+      return Fl_Button::handle (event);
 
    default:
-      return Button::handle (event);
+      return Fl_Button::handle (event);
    }
 }
 
--- a/dw/fltkpreview.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkpreview.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -1,8 +1,8 @@
 #ifndef __FlTKPREVIEW_HH__
 #define __FlTKPREVIEW_HH__
 
-#include <fltk/Button.h>
-#include <fltk/MenuWindow.h>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Menu_Window.H>
 #include "fltkviewbase.hh"
 
 namespace dw {
@@ -46,11 +46,11 @@
                    int x, int y, int width, int height);
 
    bool usesFltkWidgets ();
-   void drawFltkWidget (::fltk::Widget *widget, core::Rectangle *area);
+   void drawFltkWidget (Fl_Widget *widget, core::Rectangle *area);
 };
 
 
-class FltkPreviewWindow: public ::fltk::MenuWindow
+class FltkPreviewWindow: public Fl_Menu_Window
 {
 private:
    enum { BORDER_WIDTH = 2 };
@@ -71,7 +71,7 @@
 };
 
 
-class FltkPreviewButton: public  ::fltk::Button
+class FltkPreviewButton: public Fl_Button
 {
 private:
    FltkPreviewWindow *window;
--- a/dw/fltkui.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkui.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -25,21 +25,16 @@
 #include "../lout/msg.h"
 #include "../lout/misc.hh"
 
+#include <FL/Fl.H>
+#include <FL/fl_draw.H>
+#include <FL/Fl_Input.H>
+#include <FL/Fl_Text_Editor.H>
+#include <FL/Fl_Check_Button.H>
+#include <FL/Fl_Round_Button.H>
+#include <FL/Fl_Choice.H>
+#include <FL/Fl_Tree.H>
+
 #include <stdio.h>
-#include <fltk/Widget.h>
-#include <fltk/Group.h>
-#include <fltk/Input.h>
-#include <fltk/TextEditor.h>
-#include <fltk/RadioButton.h>
-#include <fltk/CheckButton.h>
-#include <fltk/Choice.h>
-#include <fltk/Browser.h>
-#include <fltk/Font.h>
-#include <fltk/draw.h>
-#include <fltk/Symbol.h>
-#include <fltk/Item.h>
-#include <fltk/ItemGroup.h>
-#include <fltk/events.h>
 
 namespace dw {
 namespace fltk {
@@ -139,14 +134,12 @@
    setWidgetStyle (widget, style);
 }
 
-void FltkResource::setWidgetStyle (::fltk::Widget *widget,
+void FltkResource::setWidgetStyle (Fl_Widget *widget,
                                    core::style::Style *style)
 {
    FltkFont *font = (FltkFont*)style->font;
    widget->labelsize (font->size);
    widget->labelfont (font->font);
-   widget->textsize (font->size);
-   widget->textfont (font->font);
 
    FltkColor *bg = (FltkColor*)style->backgroundColor;
    if (bg) {
@@ -155,21 +148,13 @@
       if (style->color) {
          int style_fg = ((FltkColor*)style->color)->colors
                                                    [FltkColor::SHADING_NORMAL];
-         ::fltk::Color fg = ::fltk::contrast(style_fg, normal_bg);
+         Fl_Color fg = fl_contrast(style_fg, normal_bg);
 
          widget->labelcolor(fg);
-         widget->textcolor(fg);
          widget->selection_color(fg);
       }
 
       widget->color(normal_bg);
-      widget->buttoncolor(normal_bg);
-      widget->selection_textcolor(normal_bg);
-      if (widget->type() != ::fltk::Widget::RADIO &&
-          widget->type() != ::fltk::Widget::TOGGLE) {
-         /* it looks awful to highlight the buttons */
-         widget->highlight_color(bg->colors[FltkColor::SHADING_LIGHT]);
-      }
    }
 }
 
@@ -253,16 +238,14 @@
    delete label;
 }
 
-::fltk::Widget *FltkLabelButtonResource::createNewWidget (core::Allocation
-                                                          *allocation)
+Fl_Widget *FltkLabelButtonResource::createNewWidget (core::Allocation
+                                                     *allocation)
 {
-   ::fltk::Button *button =
-        new ::fltk::Button (allocation->x, allocation->y, allocation->width,
-                            allocation->ascent + allocation->descent,
-                            label);
-   button->set_flag (::fltk::RAW_LABEL);
+   Fl_Button *button =
+        new Fl_Button (allocation->x, allocation->y, allocation->width,
+                       allocation->ascent + allocation->descent, label);
    button->callback (widgetCallback, this);
-   button->when (::fltk::WHEN_RELEASE);
+   button->when (FL_WHEN_RELEASE);
    return button;
 }
 
@@ -270,9 +253,9 @@
 {
    if (style) {
       FltkFont *font = (FltkFont*)style->font;
-      ::fltk::setfont(font->font,font->size);
+      fl_font(font->font,font->size);
       requisition->width =
-         (int)::fltk::getwidth (label, strlen (label))
+         (int)fl_width (label, strlen (label))
          + 2 * RELIEF_X_THICKNESS;
       requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
       requisition->descent = font->descent + RELIEF_Y_THICKNESS;
@@ -290,35 +273,35 @@
  */
 static core::ButtonState getDwButtonState ()
 {
-   int s1 = ::fltk::event_state ();
+   int s1 = Fl::event_state ();
    int s2 = (core::ButtonState)0;
 
-   if (s1 & ::fltk::SHIFT)   s2 |= core::SHIFT_MASK;
-   if (s1 & ::fltk::CTRL)    s2 |= core::CONTROL_MASK;
-   if (s1 & ::fltk::ALT)     s2 |= core::META_MASK;
-   if (s1 & ::fltk::BUTTON1) s2 |= core::BUTTON1_MASK;
-   if (s1 & ::fltk::BUTTON2) s2 |= core::BUTTON2_MASK;
-   if (s1 & ::fltk::BUTTON3) s2 |= core::BUTTON3_MASK;
+   if (s1 & FL_SHIFT)   s2 |= core::SHIFT_MASK;
+   if (s1 & FL_CTRL)    s2 |= core::CONTROL_MASK;
+   if (s1 & FL_ALT)     s2 |= core::META_MASK;
+   if (s1 & FL_BUTTON1) s2 |= core::BUTTON1_MASK;
+   if (s1 & FL_BUTTON2) s2 |= core::BUTTON2_MASK;
+   if (s1 & FL_BUTTON3) s2 |= core::BUTTON3_MASK;
 
    return (core::ButtonState)s2;
 }
 
 static void setButtonEvent(dw::core::EventButton *event)
 {
-   event->xCanvas = ::fltk::event_x();
-   event->yCanvas = ::fltk::event_y();
+   event->xCanvas = Fl::event_x();
+   event->yCanvas = Fl::event_y();
    event->state = getDwButtonState();
-   event->button = ::fltk::event_button();
-   event->numPressed = ::fltk::event_clicks() + 1;
+   event->button = Fl::event_button();
+   event->numPressed = Fl::event_clicks() + 1;
 }
 
-void FltkLabelButtonResource::widgetCallback (::fltk::Widget *widget,
+void FltkLabelButtonResource::widgetCallback (Fl_Widget *widget,
                                               void *data)
 {
-   if ((widget->when () & ::fltk::WHEN_RELEASE) &&
-       ((::fltk::event_key() == ::fltk::ReturnKey) ||
-        (::fltk::event_button() == ::fltk::LeftButton ||
-         ::fltk::event_button() == ::fltk::MiddleButton))) {
+   if ((widget->when () & FL_WHEN_RELEASE) &&
+       ((Fl::event_key() == FL_Enter) ||
+        (Fl::event_button() == FL_LEFT_MOUSE ||
+         Fl::event_button() == FL_MIDDLE_MOUSE))) {
       FltkLabelButtonResource *lbr = (FltkLabelButtonResource*) data;
       dw::core::EventButton event;
       setButtonEvent(&event);
@@ -358,22 +341,22 @@
 {
 }
 
-void FltkComplexButtonResource::widgetCallback (::fltk::Widget *widget,
+void FltkComplexButtonResource::widgetCallback (Fl_Widget *widget,
                                                 void *data)
 {
    FltkComplexButtonResource *res = (FltkComplexButtonResource*)data;
 
-   if (widget->when() == ::fltk::WHEN_RELEASE &&
-       ((::fltk::event_key() == ::fltk::ReturnKey) ||
-        (::fltk::event_button() == ::fltk::LeftButton ||
-         ::fltk::event_button() == ::fltk::MiddleButton))) {
-      res->click_x = ::fltk::event_x();
-      res->click_y = ::fltk::event_y();
+   if (widget->when() == FL_WHEN_RELEASE &&
+       ((Fl::event_key() == FL_Enter) ||
+        (Fl::event_button() == FL_LEFT_MOUSE ||
+         Fl::event_button() == FL_MIDDLE_MOUSE))) {
+      res->click_x = Fl::event_x();
+      res->click_y = Fl::event_y();
       dw::core::EventButton event;
       setButtonEvent(&event);
       res->emitClicked(&event);
    } else {
-      ((FltkViewBase*)res->flatView)->handle(::fltk::event());
+      ((FltkViewBase*)res->flatView)->handle(Fl::event());
    }
 }
 
@@ -423,16 +406,16 @@
 }
 
 
-::fltk::Widget *FltkComplexButtonResource::createNewWidget (core::Allocation
+Fl_Widget *FltkComplexButtonResource::createNewWidget (core::Allocation
                                                             *allocation)
 {
    ComplexButton *button =
       new ComplexButton (allocation->x, allocation->y, allocation->width,
                          allocation->ascent + allocation->descent);
    button->callback (widgetCallback, this);
-   button->when (::fltk::WHEN_RELEASE);
+   button->when (FL_WHEN_RELEASE);
    if (!relief)
-      button->box(::fltk::FLAT_BOX);
+      button->box(FL_FLAT_BOX);
 
    flatView = new FltkFlatView (allocation->x + reliefXThickness (),
                                 allocation->y + reliefYThickness (),
@@ -470,20 +453,20 @@
       delete label;
 }
 
-::fltk::Widget *FltkEntryResource::createNewWidget (core::Allocation
+Fl_Widget *FltkEntryResource::createNewWidget (core::Allocation
                                                     *allocation)
 {
-   ::fltk::Input *input =
-        new ::fltk::Input (allocation->x, allocation->y, allocation->width,
-                           allocation->ascent + allocation->descent);
+   Fl_Input *input =
+        new Fl_Input (allocation->x, allocation->y, allocation->width,
+                      allocation->ascent + allocation->descent);
    if (password)
-      input->type(::fltk::Input::SECRET);
+      input->type(FL_SECRET_INPUT);
    input->callback (widgetCallback, this);
-   input->when (::fltk::WHEN_ENTER_KEY_ALWAYS);
+   input->when (FL_WHEN_ENTER_KEY_ALWAYS);
 
    if (label) {
       input->label(label);
-      input->set_flag(::fltk::ALIGN_INSIDE_LEFT);
+      input->align(FL_ALIGN_INSIDE);
    }
    if (initText)
       input->value (initText);
@@ -491,6 +474,19 @@
    return input;
 }
 
+void FltkEntryResource::setWidgetStyle (Fl_Widget *widget,
+                                        core::style::Style *style)
+{
+   Fl_Input *in = (Fl_Input *)widget;
+
+   FltkResource::setWidgetStyle(widget, style);
+
+   in->textcolor(widget->labelcolor());
+   in->cursor_color(in->textcolor());
+   in->textsize(in->labelsize());
+   in->textfont(in->labelfont());
+}
+
 void FltkEntryResource::setDisplayed(bool displayed)
 {
    FltkResource::setDisplayed(displayed);
@@ -501,9 +497,9 @@
 {
    if (displayed() && style) {
       FltkFont *font = (FltkFont*)style->font;
-      ::fltk::setfont(font->font,font->size);
+      fl_font(font->font,font->size);
       requisition->width =
-         (int)::fltk::getwidth ("n", 1)
+         (int)fl_width ('n')
          * (maxLength == UNLIMITED_MAX_LENGTH ? 10 : maxLength)
          + 2 * RELIEF_X_THICKNESS;
       requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
@@ -515,24 +511,23 @@
    }
 }
 
-void FltkEntryResource::widgetCallback (::fltk::Widget *widget,
-                                        void *data)
+void FltkEntryResource::widgetCallback (Fl_Widget *widget, void *data)
 {
-   /* The (::fltk::event_key() == ::fltk::ReturnKey) test
+   /* The (::fltk::event_key() == FL_Enter) test
     * is necessary because WHEN_ENTER_KEY also includes
     * other events we're not interested in. For instance pressing
     * The Back or Forward, buttons, or the first click on a rendered
     * page. BUG: this must be investigated and reported to FLTK2 team
     */
    _MSG("when = %d\n", widget->when ());
-   if ((widget->when () & ::fltk::WHEN_ENTER_KEY_ALWAYS) &&
-       (::fltk::event_key() == ::fltk::ReturnKey))
+   if ((widget->when () & FL_WHEN_ENTER_KEY_ALWAYS) &&
+       (Fl::event_key() == FL_Enter))
       ((FltkEntryResource*)data)->emitActivate ();
 }
 
 const char *FltkEntryResource::getText ()
 {
-   return ((::fltk::Input*)widget)->value ();
+   return ((Fl_Input*)widget)->value ();
 }
 
 void FltkEntryResource::setText (const char *text)
@@ -541,7 +536,7 @@
       delete initText;
    initText = strdup (text);
 
-   ((::fltk::Input*)widget)->value (initText);
+   ((Fl_Input*)widget)->value (initText);
 }
 
 bool FltkEntryResource::isEditable ()
@@ -560,7 +555,7 @@
                                                       int cols, int rows):
    FltkSpecificResource <dw::core::ui::MultiLineTextResource> (platform)
 {
-   buffer = new ::fltk::TextBuffer;
+   buffer = new Fl_Text_Buffer;
    editable = false;
 
    numCols = cols;
@@ -582,29 +577,40 @@
 FltkMultiLineTextResource::~FltkMultiLineTextResource ()
 {
    /* Free memory avoiding a double-free of text buffers */
-   ((::fltk::TextEditor *) widget)->buffer (0);
+   ((Fl_Text_Editor *) widget)->buffer (0);
    delete buffer;
 }
 
-::fltk::Widget *FltkMultiLineTextResource::createNewWidget (core::Allocation
+Fl_Widget *FltkMultiLineTextResource::createNewWidget (core::Allocation
                                                             *allocation)
 {
-   ::fltk::TextEditor *text =
-      new ::fltk::TextEditor (allocation->x, allocation->y,
-                              allocation->width,
-                              allocation->ascent + allocation->descent);
+   Fl_Text_Editor *text =
+      new Fl_Text_Editor (allocation->x, allocation->y, allocation->width,
+                          allocation->ascent + allocation->descent);
    text->buffer (buffer);
    return text;
 }
 
+void FltkMultiLineTextResource::setWidgetStyle (Fl_Widget *widget,
+                                                core::style::Style *style)
+{
+   Fl_Text_Editor *ed = (Fl_Text_Editor *)widget;
+
+   FltkResource::setWidgetStyle(widget, style);
+
+   ed->textcolor(widget->labelcolor());
+   ed->cursor_color(ed->textcolor());
+   ed->textsize(ed->labelsize());
+   ed->textfont(ed->labelfont());
+}
+
 void FltkMultiLineTextResource::sizeRequest (core::Requisition *requisition)
 {
    if (style) {
       FltkFont *font = (FltkFont*)style->font;
-      ::fltk::setfont(font->font,font->size);
+      fl_font(font->font,font->size);
       requisition->width =
-         (int)::fltk::getwidth ("n", 1) * numCols +
-         2 * RELIEF_X_THICKNESS;
+         (int)fl_width ('n') * numCols + 2 * RELIEF_X_THICKNESS;
       requisition->ascent =
          RELIEF_Y_THICKNESS + font->ascent +
          (font->ascent + font->descent) * (numRows - 1);
@@ -656,14 +662,23 @@
 
 
 template <class I>
-::fltk::Widget *FltkToggleButtonResource<I>::createNewWidget (core::Allocation
+Fl_Widget *FltkToggleButtonResource<I>::createNewWidget (core::Allocation
                                                               *allocation)
 {
-   ::fltk::Button *button = createNewButton (allocation);
+   Fl_Button *button = createNewButton (allocation);
    button->value (initActivated);
    return button;
 }
 
+template <class I>
+void FltkToggleButtonResource<I>::setWidgetStyle (Fl_Widget *widget,
+                                                  core::style::Style *style)
+{
+   FltkResource::setWidgetStyle(widget, style);
+
+   widget->selection_color(FL_BLACK);
+}
+
 
 template <class I>
 void FltkToggleButtonResource<I>::sizeRequest (core::Requisition *requisition)
@@ -672,7 +687,7 @@
       (this->FltkResource::style ? this->FltkResource::style->font : NULL);
 
    if (font) {
-      ::fltk::setfont(font->font, font->size);
+      fl_font(font->font, font->size);
       requisition->width = font->ascent + font->descent + 2*RELIEF_X_THICKNESS;
       requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
       requisition->descent = font->descent + RELIEF_Y_THICKNESS;
@@ -687,7 +702,7 @@
 template <class I>
 bool FltkToggleButtonResource<I>::FltkToggleButtonResource::isActivated ()
 {
-   return ((::fltk::Button*)this->widget)->value ();
+   return ((Fl_Button*)this->widget)->value ();
 }
 
 
@@ -695,7 +710,7 @@
 void FltkToggleButtonResource<I>::setActivated (bool activated)
 {
    initActivated = activated;
-   ((::fltk::Button*)this->widget)->value (initActivated);
+   ((Fl_Button*)this->widget)->value (initActivated);
 }
 
 // ----------------------------------------------------------------------
@@ -714,13 +729,12 @@
 }
 
 
-::fltk::Button *FltkCheckButtonResource::createNewButton (core::Allocation
+Fl_Button *FltkCheckButtonResource::createNewButton (core::Allocation
                                                           *allocation)
 {
-   ::fltk::CheckButton *cb =
-      new ::fltk::CheckButton (allocation->x, allocation->y, allocation->width,
-                               allocation->ascent + allocation->descent);
-   cb->set_flag (::fltk::RAW_LABEL);
+   Fl_Check_Button *cb =
+      new Fl_Check_Button (allocation->x, allocation->y, allocation->width,
+                           allocation->ascent + allocation->descent);
    return cb;
 }
 
@@ -798,10 +812,10 @@
    return group->groupIterator ();
 }
 
-void FltkRadioButtonResource::widgetCallback (::fltk::Widget *widget,
+void FltkRadioButtonResource::widgetCallback (Fl_Widget *widget,
                                               void *data)
 {
-   if (widget->when () & ::fltk::WHEN_CHANGED)
+   if (widget->when () & FL_WHEN_CHANGED)
       ((FltkRadioButtonResource*)data)->buttonClicked ();
 }
 
@@ -814,11 +828,11 @@
    }
 }
 
-::fltk::Button *FltkRadioButtonResource::createNewButton (core::Allocation
-                                                          *allocation)
+Fl_Button *FltkRadioButtonResource::createNewButton (core::Allocation
+                                                     *allocation)
 {
    /*
-    * Groups of fltk::RadioButton must be added to one fltk::Group, which is
+    * Groups of Fl_Radio_Button must be added to one Fl_Group, which is
     * not possible in this context. For this, we do the grouping ourself,
     * based on FltkRadioButtonResource::Group.
     *
@@ -829,86 +843,18 @@
     * (instead of creating a check button, and changing the style).
     */
 
-   ::fltk::Button *button =
-      new ::fltk::RadioButton (allocation->x, allocation->y,
-                               allocation->width,
-                               allocation->ascent + allocation->descent);
-   button->set_flag (::fltk::RAW_LABEL);
-   button->when (::fltk::WHEN_CHANGED);
+   Fl_Button *button =
+      new Fl_Round_Button (allocation->x, allocation->y, allocation->width,
+                           allocation->ascent + allocation->descent);
+   button->when (FL_WHEN_CHANGED);
    button->callback (widgetCallback, this);
-   button->type (::fltk::Button::TOGGLE);
+   button->type (FL_TOGGLE_BUTTON);
 
    return button;
 }
 
 // ----------------------------------------------------------------------
 
-template <class I> FltkSelectionResource<I>::Item::Item (Type type,
-                                                         const char *name,
-                                                         bool enabled,
-                                                         bool selected)
-{
-   this->type = type;
-   this->name = name ? strdup (name) : NULL;
-   this->enabled = enabled;
-   initSelected = selected;
-}
-
-template <class I> FltkSelectionResource<I>::Item::~Item ()
-{
-   if (name)
-      delete name;
-}
-
-template <class I>
-::fltk::Item *FltkSelectionResource<I>::Item::createNewWidget (int index)
-{
-   ::fltk::Item *item = new ::fltk::Item (name);
-   item->set_flag (::fltk::RAW_LABEL);
-   item->user_data ((void *) index);
-   return item;
-}
-
-template <class I>
-::fltk::ItemGroup *
-FltkSelectionResource<I>::Item::createNewGroupWidget ()
-{
-   ::fltk::ItemGroup *itemGroup = new ::fltk::ItemGroup (name);
-   itemGroup->set_flag (::fltk::RAW_LABEL);
-   itemGroup->user_data ((void *) -1L);
-   return itemGroup;
-}
-
-
-template <class I>
-FltkSelectionResource<I>::WidgetStack::WidgetStack (::fltk::Menu *widget)
-{
-   this->widget = widget;
-   this->stack = new Stack <TypedPointer < ::fltk::Menu> > (true);
-}
-
-template <class I> FltkSelectionResource<I>::WidgetStack::~WidgetStack ()
-{
-   delete stack;
-}
-
-
-template <class I>
-FltkSelectionResource<I>::FltkSelectionResource (FltkPlatform *platform):
-   FltkSpecificResource<I> (platform)
-{
-   widgetStacks = new List <WidgetStack> (true);
-   allItems = new List <Item> (true);
-   items = new Vector <Item> (16, false);
-}
-
-template <class I> FltkSelectionResource<I>::~FltkSelectionResource ()
-{
-   delete widgetStacks;
-   delete allItems;
-   delete items;
-}
-
 template <class I> dw::core::Iterator *
 FltkSelectionResource<I>::iterator (dw::core::Content::Type mask, bool atEnd)
 {
@@ -916,188 +862,87 @@
    return new core::EmptyIterator (this->getEmbed (), mask, atEnd);
 }
 
-template <class I> ::fltk::Widget *
-FltkSelectionResource<I>::createNewWidget (core::Allocation *allocation)
-{
-   /** \todo Attributes (enabled, selected). */
-
-   ::fltk::Menu *menu = createNewMenu (allocation);
-   WidgetStack *widgetStack = new WidgetStack (menu);
-   widgetStack->stack->push (new TypedPointer < ::fltk::Menu> (menu));
-   widgetStacks->append (widgetStack);
-
-
-   ::fltk::Menu *itemGroup;
-   ::fltk::Item *itemWidget;
-
-   ::fltk::Group *currGroup = widgetStack->stack->getTop()->getTypedValue();
-
-   int index = 0;
-   for (Iterator <Item> it = allItems->iterator (); it.hasNext (); ) {
-      Item *item = it.getNext ();
-      switch (item->type) {
-      case Item::ITEM:
-         itemWidget = item->createNewWidget (index++);
-         currGroup->add (itemWidget);
-         break;
-
-      case Item::START:
-         itemGroup = item->createNewGroupWidget ();
-         currGroup->add (itemGroup);
-         widgetStack->stack->push (new TypedPointer < ::fltk::Menu> (menu));
-         currGroup = itemGroup;
-         break;
-
-      case Item::END:
-         widgetStack->stack->pop ();
-         currGroup = widgetStack->stack->getTop()->getTypedValue();
-         break;
-      }
-   }
-
-   return menu;
-}
-
-template <class I>
-typename FltkSelectionResource<I>::Item *
-FltkSelectionResource<I>::createNewItem (typename Item::Type type,
-                                         const char *name,
-                                         bool enabled,
-                                         bool selected) {
-   return new Item(type,name,enabled,selected);
-}
-
-template <class I> void FltkSelectionResource<I>::addItem (const char *str,
-                                                           bool enabled,
-                                                           bool selected)
-{
-   int index = items->size ();
-   Item *item = createNewItem (Item::ITEM, str, enabled, selected);
-   items->put (item);
-   allItems->append (item);
-
-   for (Iterator <WidgetStack> it = widgetStacks->iterator ();
-        it.hasNext(); ) {
-      WidgetStack *widgetStack = it.getNext ();
-      ::fltk::Item *itemWidget = item->createNewWidget (index);
-      widgetStack->stack->getTop()->getTypedValue()->add (itemWidget);
-
-      if (!enabled)
-         itemWidget->deactivate ();
-
-      if (selected) {
-         itemWidget->set_selected();
-         if (setSelectedItems ()) {
-            // Handle multiple item selection.
-            int *pos = new int[widgetStack->stack->size ()];
-            int i;
-            Iterator <TypedPointer < ::fltk::Menu> > it;
-            for (it = widgetStack->stack->iterator (),
-                    i = widgetStack->stack->size () - 1;
-                 it.hasNext ();
-                 i--) {
-               TypedPointer < ::fltk::Menu> * p = it.getNext ();
-               pos[i] =  p->getTypedValue()->children () - 1;
-            }
-            widgetStack->widget->set_item (pos, widgetStack->stack->size ());
-            delete [] pos;
-         }
-      }
-   }
-}
-
-template <class I> void FltkSelectionResource<I>::pushGroup (const char *name,
-                                                             bool enabled)
-{
-   Item *item = createNewItem (Item::START, name, enabled);
-   allItems->append (item);
-
-   for (Iterator <WidgetStack> it = widgetStacks->iterator ();
-        it.hasNext(); ) {
-      WidgetStack *widgetStack = it.getNext ();
-      ::fltk::ItemGroup *group = item->createNewGroupWidget ();
-      widgetStack->stack->getTop()->getTypedValue()->add (group);
-      widgetStack->stack->push (new TypedPointer < ::fltk::Menu> (group));
-      if (!enabled)
-         group->deactivate ();
-   }
-}
-
-template <class I> void FltkSelectionResource<I>::popGroup ()
-{
-   Item *item = createNewItem (Item::END);
-   allItems->append (item);
-
-   for (Iterator <WidgetStack> it = widgetStacks->iterator ();
-        it.hasNext(); ) {
-      WidgetStack *widgetStack = it.getNext ();
-      widgetStack->stack->pop ();
-   }
-}
-
-template <class I> int FltkSelectionResource<I>::getNumberOfItems ()
-{
-   return items->size ();
-}
-
-template <class I> const char *FltkSelectionResource<I>::getItem (int index)
-{
-   return items->get(index)->name;
-}
-
-template <class I> int FltkSelectionResource<I>::getMaxStringWidth ()
-{
-   int width = 0, numberOfItems = getNumberOfItems ();
-   for (int i = 0; i < numberOfItems; i++) {
-      int len = (int)::fltk::getwidth (getItem(i));
-      if (len > width) width = len;
-   }
-   return width;
-}
-
 // ----------------------------------------------------------------------
 
 FltkOptionMenuResource::FltkOptionMenuResource (FltkPlatform *platform):
-   FltkSelectionResource <dw::core::ui::OptionMenuResource> (platform),
-   selection(-1)
+   FltkSelectionResource <dw::core::ui::OptionMenuResource> (platform)
 {
+   /* Fl_Menu_ does not like multiple menu items with the same label, and
+    * insert() treats some characters specially unless escaped, so let's
+    * do our own menu handling.
+    */
+   itemsAllocated = 0x10;
+   menu = new Fl_Menu_Item[itemsAllocated];
+   memset(menu, 0, itemsAllocated * sizeof(Fl_Menu_Item));
+   itemsUsed = 1; // menu[0].text == NULL, which is an end-of-menu marker.
+
    init (platform);
 }
 
 FltkOptionMenuResource::~FltkOptionMenuResource ()
 {
+   for (int i = 0; i < itemsUsed; i++) {
+      if (menu[i].text)
+         free((char *) menu[i].text);
+   }
+   delete menu;
 }
 
+void FltkOptionMenuResource::setWidgetStyle (Fl_Widget *widget,
+                                             core::style::Style *style)
+{
+   Fl_Choice *ch = (Fl_Choice *)widget;
 
-::fltk::Menu *FltkOptionMenuResource::createNewMenu (core::Allocation
+   FltkResource::setWidgetStyle(widget, style);
+
+   ch->textcolor(widget->labelcolor());
+   ch->textfont(ch->labelfont());
+   ch->textsize(ch->labelsize());
+}
+
+Fl_Widget *FltkOptionMenuResource::createNewWidget (core::Allocation
                                                      *allocation)
 {
-   ::fltk::Menu *menu =
-      new ::fltk::Choice (allocation->x, allocation->y,
+   Fl_Choice *choice =
+      new Fl_Choice (allocation->x, allocation->y,
                           allocation->width,
                           allocation->ascent + allocation->descent);
-   menu->set_flag (::fltk::RAW_LABEL);
-   menu->callback(widgetCallback,this);
-   return menu;
+   choice->menu(menu);
+   return choice;
 }
 
-void FltkOptionMenuResource::widgetCallback (::fltk::Widget *widget,
+void FltkOptionMenuResource::widgetCallback (Fl_Widget *widget,
                                              void *data)
 {
-   ((FltkOptionMenuResource *) data)->selection =
-      (long) (((::fltk::Menu *) widget)->item()->user_data());
+}
+
+int FltkOptionMenuResource::getMaxItemWidth()
+{
+   int i, max = 0;
+
+   for (i = 0; i < itemsUsed; i++) {
+      int width = 0;
+      const char *str = menu[i].text;
+
+      if (str) {
+         width = fl_width(str);
+         if (width > max)
+            max = width;
+      }
+   }
+   return max;
 }
 
 void FltkOptionMenuResource::sizeRequest (core::Requisition *requisition)
 {
    if (style) {
       FltkFont *font = (FltkFont*)style->font;
-      ::fltk::setfont(font->font,font->size);
-      int maxStringWidth = getMaxStringWidth ();
+      fl_font(font->font, font->size);
+      int maxItemWidth = getMaxItemWidth ();
       requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
       requisition->descent = font->descent + RELIEF_Y_THICKNESS;
-      requisition->width = maxStringWidth
-         + (requisition->ascent + requisition->descent) * 4 / 5
+      requisition->width = maxItemWidth
+         + (requisition->ascent + requisition->descent)
          + 2 * RELIEF_X_THICKNESS;
    } else {
       requisition->width = 1;
@@ -1106,20 +951,82 @@
    }
 }
 
+void FltkOptionMenuResource::enlargeMenu ()
+{
+   Fl_Choice *ch = (Fl_Choice *)widget;
+   int selected = ch->value();
+   Fl_Menu_Item *newMenu;
+
+   itemsAllocated += 0x10;
+   newMenu = new Fl_Menu_Item[itemsAllocated];
+   memcpy(newMenu, menu, itemsUsed * sizeof(Fl_Menu_Item));
+   memset(newMenu + itemsUsed, 0, 0x10 * sizeof(Fl_Menu_Item));
+   delete menu;
+   menu = newMenu;
+   ch->menu(menu);
+   ch->value(selected);
+}
+
+Fl_Menu_Item *FltkOptionMenuResource::newItem()
+{
+   Fl_Menu_Item *item;
+
+   if (itemsUsed == itemsAllocated)
+      enlargeMenu();
+
+   item = menu + itemsUsed - 1;
+   itemsUsed++;
+
+   return item;
+}
+   
 void FltkOptionMenuResource::addItem (const char *str,
                                       bool enabled, bool selected)
 {
-   FltkSelectionResource<dw::core::ui::OptionMenuResource>::addItem
-      (str,enabled,selected);
+   Fl_Menu_Item *item = newItem();
+
+   item->text = strdup(str);
+
+   if (enabled == false)
+      item->flags = FL_MENU_INACTIVE;
+
+   // TODO: verify that an array index is exactly what value() wants,
+   // even when there are submenus.
    if (selected)
-      selection = (items->size ()) - 1;
+      ((Fl_Choice *)widget)->value(item);
 
    queueResize (true);
 }
 
+void FltkOptionMenuResource::pushGroup (const char *name, bool enabled)
+{
+   Fl_Menu_Item *item = newItem();
+
+   item->text = strdup(name);
+
+   if (enabled == false)
+      item->flags = FL_MENU_INACTIVE;
+
+   item->flags |= FL_SUBMENU;
+
+   queueResize (true);
+}
+
+void FltkOptionMenuResource::popGroup ()
+{
+   /* Item with NULL text field closes the submenu */
+   newItem();
+   queueResize (true);
+}
+
 bool FltkOptionMenuResource::isSelected (int index)
 {
-   return index == selection;
+   return index == ((Fl_Choice *)widget)->value();
+}
+
+int FltkOptionMenuResource::getNumberOfItems()
+{
+   return ((Fl_Choice*)widget)->size();
 }
 
 // ----------------------------------------------------------------------
@@ -1140,70 +1047,127 @@
 }
 
 
-::fltk::Menu *FltkListResource::createNewMenu (core::Allocation *allocation)
+Fl_Widget *FltkListResource::createNewWidget (core::Allocation *allocation)
 {
-   ::fltk::Menu *menu =
-      new ::fltk::Browser (allocation->x, allocation->y, allocation->width,
+   Fl_Tree *tree =
+      new Fl_Tree (allocation->x, allocation->y, allocation->width,
                            allocation->ascent + allocation->descent);
-   if (mode == SELECTION_MULTIPLE)
-      menu->type(::fltk::Browser::MULTI);
-   menu->set_flag (::fltk::RAW_LABEL);
-   menu->callback(widgetCallback,this);
-   menu->when(::fltk::WHEN_CHANGED);
-   return menu;
+
+   tree->selectmode((mode == SELECTION_MULTIPLE) ? FL_TREE_SELECT_MULTI
+                                                 : FL_TREE_SELECT_SINGLE);
+   tree->showroot(0);
+   tree->connectorstyle(FL_TREE_CONNECTOR_NONE);
+   tree->marginleft(-14);
+   tree->callback(widgetCallback,this);
+   tree->when(FL_WHEN_CHANGED);
+
+   currParent = tree->root();
+   return tree;
 }
 
-void FltkListResource::widgetCallback (::fltk::Widget *widget, void *data)
+void FltkListResource::setWidgetStyle (Fl_Widget *widget,
+                                       core::style::Style *style)
 {
-   ::fltk::Widget *fltkItem = ((::fltk::Menu *) widget)->item ();
+   Fl_Tree *t = (Fl_Tree *)widget;
+
+   FltkResource::setWidgetStyle(widget, style);
+
+   t->item_labelfont(widget->labelfont());
+   t->item_labelsize(widget->labelsize());
+   t->item_labelfgcolor(widget->labelcolor());
+   t->item_labelbgcolor(widget->color());
+}
+
+void FltkListResource::widgetCallback (Fl_Widget *widget, void *data)
+{
+   Fl_Tree_Item *fltkItem = ((Fl_Tree *) widget)->callback_item ();
    int index = -1;
    if (fltkItem)
       index = (long) (fltkItem->user_data ());
    if (index > -1) {
-      /* A MultiBrowser will trigger a callback for each item that is
-       * selected and each item that is deselected, but a "plain"
-       * Browser will only trigger the callback for the newly selected item
-       * (for which selected() is false, incidentally).
-       */
       FltkListResource *res = (FltkListResource *) data;
-      if (res->mode == SELECTION_MULTIPLE) {
-         bool selected = fltkItem->selected ();
-         res->itemsSelected.set (index, selected);
-      } else {
-         int size = res->itemsSelected.size();
-         for (int i = 0; i < size; i++)
-            res->itemsSelected.set (i, false);
-         res->itemsSelected.set (index, true);
-      }
+      bool selected = fltkItem->is_selected ();
+      res->itemsSelected.set (index, selected);
    }
 }
 
+void *FltkListResource::newItem (const char *str, bool enabled)
+{
+   Fl_Tree *tree = (Fl_Tree *) widget;
+   Fl_Tree_Item *parent = (Fl_Tree_Item *)currParent;
+   Fl_Tree_Item *item = tree->add(parent, str);
+
+   enabled &= parent->is_active();
+   item->activate(enabled);
+   itemsSelected.increase ();
+
+   return item;
+}
+
 void FltkListResource::addItem (const char *str, bool enabled, bool selected)
 {
-   FltkSelectionResource<dw::core::ui::ListResource>::addItem
-      (str,enabled,selected);
-   int index = itemsSelected.size ();
-   itemsSelected.increase ();
-   itemsSelected.set (index,selected);
+   Fl_Tree *tree = (Fl_Tree *) widget;
+   Fl_Tree_Item *item = (Fl_Tree_Item *) newItem(str, enabled);
+
+   itemsSelected.set (itemsSelected.size() - 1, selected);
+
+   if (selected) {
+      if (mode == SELECTION_MULTIPLE)
+         item->select(selected);
+      else
+         tree->select_only(item, 0);
+   }
    queueResize (true);
 }
 
+void FltkListResource::pushGroup (const char *name, bool enabled)
+{
+   currParent = (Fl_Tree_Item *) newItem(name, enabled);
+   queueResize (true);
+}
+
+void FltkListResource::popGroup ()
+{
+   Fl_Tree_Item *p = (Fl_Tree_Item *)currParent;
+
+   if (p->parent())
+      currParent = p->parent();
+}
+
+int FltkListResource::getMaxItemWidth()
+{
+   Fl_Tree *tree = (Fl_Tree *)widget;
+   int max = 0;
+
+   for (Fl_Tree_Item *i = tree->first(); i; i = tree->next(i)) {
+      int width = 0;
+
+      if (i == tree->root())
+         continue;
+
+      for (Fl_Tree_Item *p = i->parent(); p != tree->root(); p = p->parent())
+         width += tree->connectorwidth();
+
+      if (i->label())
+         width += fl_width(i->label());
+
+      if (width > max)
+         max = width;
+   }
+   return max;
+}
+
 void FltkListResource::sizeRequest (core::Requisition *requisition)
 {
    if (style) {
       FltkFont *font = (FltkFont*)style->font;
-      ::fltk::setfont(font->font,font->size);
+      fl_font(font->font,font->size);
       int rows = getNumberOfItems();
       if (showRows < rows) {
          rows = showRows;
       }
-      /*
-       * The widget sometimes shows scrollbars when they are not required.
-       * The following values try to keep any scrollbars from obscuring
-       * options, at the cost of showing too much whitespace at times.
-       */
-      requisition->width = getMaxStringWidth() + 24;
-      requisition->ascent = font->ascent + 2 +
+      requisition->width = getMaxItemWidth() + 5 + Fl::scrollbar_size();;
+      requisition->ascent = font->ascent + 5 +
                             (rows - 1) * (font->ascent + font->descent + 1);
       requisition->descent = font->descent + 3;
    } else {
--- a/dw/fltkui.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkui.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -5,11 +5,9 @@
 #   error Do not include this file directly, use "fltkcore.hh" instead.
 #endif
 
-#include <fltk/Button.h>
-#include <fltk/Menu.h>
-#include <fltk/TextBuffer.h>
-#include <fltk/Item.h>
-#include <fltk/ItemGroup.h>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Menu.H>
+#include <FL/Fl_Text_Buffer.H>
 
 namespace dw {
 namespace fltk {
@@ -179,7 +177,7 @@
 
 protected:
    FltkView *view;
-   ::fltk::Widget *widget;
+   Fl_Widget *widget;
    core::Allocation allocation;
    FltkPlatform *platform;
 
@@ -187,9 +185,9 @@
 
    FltkResource (FltkPlatform *platform);
    void init (FltkPlatform *platform);
-   virtual ::fltk::Widget *createNewWidget (core::Allocation *allocation) = 0;
+   virtual Fl_Widget *createNewWidget (core::Allocation *allocation) = 0;
 
-   void setWidgetStyle (::fltk::Widget *widget, core::style::Style *style);
+   virtual void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
    void setDisplayed (bool displayed);
    bool displayed();
 public:
@@ -229,10 +227,10 @@
 private:
    const char *label;
 
-   static void widgetCallback (::fltk::Widget *widget, void *data);
+   static void widgetCallback (Fl_Widget *widget, void *data);
 
 protected:
-   ::fltk::Widget *createNewWidget (core::Allocation *allocation);
+   Fl_Widget *createNewWidget (core::Allocation *allocation);
 
 public:
    FltkLabelButtonResource (FltkPlatform *platform, const char *label);
@@ -251,7 +249,7 @@
 private:
    bool relief;
 
-   static void widgetCallback (::fltk::Widget *widget, void *data);
+   static void widgetCallback (Fl_Widget *widget, void *data);
 
 protected:
    FltkView *topView, *flatView;
@@ -267,7 +265,7 @@
    int reliefXThickness ();
    int reliefYThickness ();
 
-   ::fltk::Widget *createNewWidget (core::Allocation *allocation);
+   Fl_Widget *createNewWidget (core::Allocation *allocation);
 
 public:
    FltkComplexButtonResource (FltkPlatform *platform, dw::core::Widget *widget,
@@ -290,11 +288,12 @@
    char *label;
    bool editable;
 
-   static void widgetCallback (::fltk::Widget *widget, void *data);
+   static void widgetCallback (Fl_Widget *widget, void *data);
    void setDisplayed (bool displayed);
 
 protected:
-   ::fltk::Widget *createNewWidget (core::Allocation *allocation);
+   Fl_Widget *createNewWidget (core::Allocation *allocation);
+   void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
 
 public:
    FltkEntryResource (FltkPlatform *platform, int maxLength, bool password,
@@ -314,12 +313,13 @@
    public FltkSpecificResource <dw::core::ui::MultiLineTextResource>
 {
 private:
-   ::fltk::TextBuffer *buffer;
+   Fl_Text_Buffer *buffer;
    bool editable;
    int numCols, numRows;
 
 protected:
-   ::fltk::Widget *createNewWidget (core::Allocation *allocation);
+   Fl_Widget *createNewWidget (core::Allocation *allocation);
+   void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
 
 public:
    FltkMultiLineTextResource (FltkPlatform *platform, int cols, int rows);
@@ -341,8 +341,9 @@
    bool initActivated;
 
 protected:
-   virtual ::fltk::Button *createNewButton (core::Allocation *allocation) = 0;
-   ::fltk::Widget *createNewWidget (core::Allocation *allocation);
+   virtual Fl_Button *createNewButton (core::Allocation *allocation) = 0;
+   Fl_Widget *createNewWidget (core::Allocation *allocation);
+   void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
 
 public:
    FltkToggleButtonResource (FltkPlatform *platform,
@@ -360,7 +361,7 @@
    public FltkToggleButtonResource <dw::core::ui::CheckButtonResource>
 {
 protected:
-   ::fltk::Button *createNewButton (core::Allocation *allocation);
+   Fl_Button *createNewButton (core::Allocation *allocation);
 
 public:
    FltkCheckButtonResource (FltkPlatform *platform,
@@ -418,11 +419,11 @@
 
    Group *group;
 
-   static void widgetCallback (::fltk::Widget *widget, void *data);
+   static void widgetCallback (Fl_Widget *widget, void *data);
    void buttonClicked ();
 
 protected:
-   ::fltk::Button *createNewButton (core::Allocation *allocation);
+   Fl_Button *createNewButton (core::Allocation *allocation);
 
 public:
    FltkRadioButtonResource (FltkPlatform *platform,
@@ -438,60 +439,14 @@
    public FltkSpecificResource <I>
 {
 protected:
-   class Item: public lout::object::Object
-   {
-   public:
-      enum Type { ITEM, START, END } type;
-
-      const char *name;
-      bool enabled, initSelected;
-
-      Item (Type type, const char *name = NULL, bool enabled = true,
-            bool selected = false);
-      ~Item ();
-
-      ::fltk::Item *createNewWidget (int index);
-      ::fltk::ItemGroup *createNewGroupWidget ();
-   };
-
-   class WidgetStack: public lout::object::Object
-   {
-   public:
-      ::fltk::Menu *widget;
-      lout::container::typed::Stack <lout::object::TypedPointer < ::fltk::Menu> > *stack;
-
-      WidgetStack (::fltk::Menu *widget);
-      ~WidgetStack ();
-   };
-
-   lout::container::typed::List <WidgetStack> *widgetStacks;
-   lout::container::typed::List <Item> *allItems;
-   lout::container::typed::Vector <Item> *items;
-
-   Item *createNewItem (typename Item::Type type,
-                        const char *name = NULL,
-                        bool enabled = true,
-                        bool selected = false);
-
-   ::fltk::Widget *createNewWidget (core::Allocation *allocation);
-   virtual ::fltk::Menu *createNewMenu (core::Allocation *allocation) = 0;
    virtual bool setSelectedItems() { return false; }
-
-   int getMaxStringWidth ();
-
+   virtual void addItem (const char *str, bool enabled, bool selected) = 0;
+   virtual void pushGroup (const char *name, bool enabled) = 0;
+   virtual void popGroup () = 0;
 public:
-   FltkSelectionResource (FltkPlatform *platform);
-   ~FltkSelectionResource ();
-
+   FltkSelectionResource (FltkPlatform *platform) :
+      FltkSpecificResource<I> (platform) {};
    dw::core::Iterator *iterator (dw::core::Content::Type mask, bool atEnd);
-
-   void addItem (const char *str, bool enabled, bool selected);
-
-   void pushGroup (const char *name, bool enabled);
-   void popGroup ();
-
-   int getNumberOfItems ();
-   const char *getItem (int index);
 };
 
 
@@ -499,18 +454,24 @@
    public FltkSelectionResource <dw::core::ui::OptionMenuResource>
 {
 protected:
-   ::fltk::Menu *createNewMenu (core::Allocation *allocation);
+   Fl_Widget *createNewWidget (core::Allocation *allocation);
    virtual bool setSelectedItems() { return true; }
-
+   void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
+   int getNumberOfItems();
+   int getMaxItemWidth ();
 private:
-   static void widgetCallback (::fltk::Widget *widget, void *data);
-   int selection;
-
+   static void widgetCallback (Fl_Widget *widget, void *data);
+   void enlargeMenu();
+   Fl_Menu_Item *newItem();
+   Fl_Menu_Item *menu;
+   int itemsAllocated, itemsUsed;
 public:
    FltkOptionMenuResource (FltkPlatform *platform);
    ~FltkOptionMenuResource ();
 
    void addItem (const char *str, bool enabled, bool selected);
+   void pushGroup (const char *name, bool enabled);
+   void popGroup ();
 
    void sizeRequest (core::Requisition *requisition);
    bool isSelected (int index);
@@ -520,10 +481,16 @@
    public FltkSelectionResource <dw::core::ui::ListResource>
 {
 protected:
-   ::fltk::Menu *createNewMenu (core::Allocation *allocation);
+   Fl_Widget *createNewWidget (core::Allocation *allocation);
+   void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
+
+   int getNumberOfItems () {return itemsSelected.size();};
+   int getMaxItemWidth ();
 
 private:
-   static void widgetCallback (::fltk::Widget *widget, void *data);
+   static void widgetCallback (Fl_Widget *widget, void *data);
+   void *newItem (const char *str, bool enabled);
+   void *currParent;
    lout::misc::SimpleVector <bool> itemsSelected;
    int showRows;
    ListResource::SelectionMode mode;
@@ -534,6 +501,8 @@
    ~FltkListResource ();
 
    void addItem (const char *str, bool enabled, bool selected);
+   void pushGroup (const char *name, bool enabled);
+   void popGroup ();
 
    void sizeRequest (core::Requisition *requisition);
    bool isSelected (int index);
--- a/dw/fltkviewbase.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkviewbase.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -21,39 +21,62 @@
 
 #include "fltkviewport.hh"
 
-#include <fltk/draw.h>
-#include <fltk/damage.h>
-#include <fltk/layout.h>
-#include <fltk/events.h>
-#include <fltk/Cursor.h>
-#include <fltk/run.h>
-#include <fltk/utf.h>
+#include <FL/Fl.H>
+#include <FL/fl_draw.H>
 
 #include <stdio.h>
 #include <wchar.h>
 #include <wctype.h>
 #include "../lout/msg.h"
 
-using namespace fltk;
+extern Fl_Widget* fl_oldfocus;
+
 using namespace lout::object;
 using namespace lout::container::typed;
 
 namespace dw {
 namespace fltk {
 
-::fltk::Image *FltkViewBase::backBuffer;
+FltkViewBase::BackBuffer::BackBuffer ()
+{
+   w = 0;
+   h = 0;
+   created = false;
+}
+
+FltkViewBase::BackBuffer::~BackBuffer ()
+{
+   if (created)
+      fl_delete_offscreen (offscreen);
+}
+
+void FltkViewBase::BackBuffer::setSize (int w, int h)
+{
+   if (!created || w > this->w || h > this->h) {
+      this->w = w;
+      this->h = h;
+      if (created)
+         fl_delete_offscreen (offscreen);
+      offscreen = fl_create_offscreen (w, h);
+      created = true;
+   }
+}
+
+FltkViewBase::BackBuffer *FltkViewBase::backBuffer;
 bool FltkViewBase::backBufferInUse;
 
 FltkViewBase::FltkViewBase (int x, int y, int w, int h, const char *label):
-   Group (x, y, w, h, label)
+   Fl_Group (x, y, w, h, label)
 {
+   Fl_Group::current(0);
    canvasWidth = 1;
    canvasHeight = 1;
-   bgColor = WHITE;
+   bgColor = FL_WHITE;
    mouse_x = mouse_y = 0;
+   focused_child = NULL;
    exposeArea = NULL;
    if (backBuffer == NULL) {
-      backBuffer = new Image ();
+      backBuffer = new BackBuffer ();
    }
 }
 
@@ -64,7 +87,7 @@
 
 void FltkViewBase::setBufferedDrawing (bool b) {
    if (b && backBuffer == NULL) {
-      backBuffer = new Image ();
+      backBuffer = new BackBuffer ();
    } else if (!b && backBuffer != NULL) {
       delete backBuffer;
       backBuffer = NULL;
@@ -75,7 +98,7 @@
 {
    int d = damage ();
 
-   if ((d & DAMAGE_VALUE) && !(d & DAMAGE_EXPOSE)) {
+   if ((d & FL_DAMAGE_USER1) && !(d & FL_DAMAGE_EXPOSE)) {
       lout::container::typed::Iterator <core::Rectangle> it;
 
       for (it = drawRegion.rectangles (); it.hasNext (); ) {
@@ -83,22 +106,22 @@
       }
 
       drawRegion.clear ();
-      d &= ~DAMAGE_VALUE;
+      d &= ~FL_DAMAGE_USER1;
    }
 
-   if (d & DAMAGE_CHILD) {
+   if (d & FL_DAMAGE_CHILD) {
       drawChildWidgets ();
-      d &= ~DAMAGE_CHILD;
+      d &= ~FL_DAMAGE_CHILD;
    }
 
    if (d) {
       dw::core::Rectangle rect (
-         translateViewXToCanvasX (0),
-         translateViewYToCanvasY (0),
+         translateViewXToCanvasX (x ()),
+         translateViewYToCanvasY (y ()),
          w (),
          h ());
 
-      if (d == DAMAGE_SCROLL) {
+      if (d == FL_DAMAGE_SCROLL) {
          // a clipping rectangle has already been set by fltk::scrollrect ()
          draw (&rect, DRAW_PLAIN);
       } else {
@@ -111,88 +134,76 @@
 void FltkViewBase::draw (const core::Rectangle *rect,
                          DrawType type)
 {
-   int offsetX = 0, offsetY = 0;
-
-   /* fltk-clipping does not use widget coordinates */
-   transform (offsetX, offsetY);
-
-   ::fltk::Rectangle viewRect (
-      translateCanvasXToViewX (rect->x) + offsetX,
-      translateCanvasYToViewY (rect->y) + offsetY,
-      rect->width, rect->height);
-
-   ::fltk::intersect_with_clip (viewRect);
-
-   viewRect.x (viewRect.x () - offsetX);
-   viewRect.y (viewRect.y () - offsetY);
-
-   if (! viewRect.empty ()) {
-      dw::core::Rectangle r (
-         translateViewXToCanvasX (viewRect.x ()),
-         translateViewYToCanvasY (viewRect.y ()),
-         viewRect.w (),
-         viewRect.h ());
-
-      exposeArea = &viewRect;
-
-      if (type == DRAW_BUFFERED && backBuffer && !backBufferInUse) {
-         backBufferInUse = true;
-         {
-            GSave gsave;
+   int X, Y, W, H;
+   
+   fl_clip_box(translateCanvasXToViewX (rect->x),
+               translateCanvasYToViewY (rect->y),
+               rect->width,
+               rect->height,
+               X, Y, W, H);
 
-            backBuffer->setsize (viewRect.w (), viewRect.h ());
-            backBuffer->make_current ();
-            translate (-viewRect.x (), -viewRect.y ());
-
-            setcolor (bgColor);
-            fillrect (viewRect);
-            theLayout->expose (this, &r);
-         }
-
-         backBuffer->draw (Rectangle (0, 0, viewRect.w (), viewRect.h ()),
-            viewRect);
+   core::Rectangle r (translateViewXToCanvasX (X),
+                      translateViewYToCanvasY (Y), W, H);
 
-         backBufferInUse = false;
-      } else if (type == DRAW_BUFFERED || type == DRAW_CLIPPED) {
-         // if type == DRAW_BUFFERED but we do not have backBuffer available
-         // we fall back to clipped drawing
-         push_clip (viewRect);
-         setcolor (bgColor);
-         fillrect (viewRect);
-         theLayout->expose (this, &r);
-         pop_clip ();
-      } else {
-         setcolor (bgColor);
-         fillrect (viewRect);
-         theLayout->expose (this, &r);
-      }
+   if (r.isEmpty ())
+      return;
 
-      exposeArea = NULL;
+   exposeArea = &r;
+
+   if (type == DRAW_BUFFERED && backBuffer && !backBufferInUse) {
+      backBufferInUse = true;
+      backBuffer->setSize (X + W, Y + H); // would be nicer to use (W, H)...
+      fl_begin_offscreen (backBuffer->offscreen);
+      fl_push_matrix ();
+      fl_color (bgColor);
+      fl_rectf (X, Y, W, H);
+      theLayout->expose (this, &r);
+      fl_pop_matrix ();
+      fl_end_offscreen ();
+      fl_copy_offscreen (X, Y, W, H, backBuffer->offscreen, X, Y);
+      backBufferInUse = false;
+   } else if (type == DRAW_BUFFERED || type == DRAW_CLIPPED) {
+      // if type == DRAW_BUFFERED but we do not have backBuffer available
+      // we fall back to clipped drawing
+      fl_push_clip (X, Y, W, H);
+      fl_color (bgColor);
+      fl_rectf (X, Y, W, H);
+      theLayout->expose (this, &r);
+      fl_pop_clip ();
+   } else {
+      fl_color (bgColor);
+      fl_rectf (X, Y, W, H);
+      theLayout->expose (this, &r);
    }
+
+   exposeArea = NULL;
 }
 
 void FltkViewBase::drawChildWidgets () {
    for (int i = children () - 1; i >= 0; i--) {
-      Widget& w = *child(i);
+      Fl_Widget& w = *child(i);
+#if 0
+PORT1.3
       if (w.damage() & DAMAGE_CHILD_LABEL) {
          draw_outside_label(w);
          w.set_damage(w.damage() & ~DAMAGE_CHILD_LABEL);
       }
+#endif
       update_child(w);
    }
 }
 
 core::ButtonState getDwButtonState ()
 {
-   int s1 = event_state ();
+   int s1 = Fl::event_state ();
    int s2 = (core::ButtonState)0;
 
-   if (s1 & SHIFT)   s2 |= core::SHIFT_MASK;
-   if (s1 & CTRL)    s2 |= core::CONTROL_MASK;
-   if (s1 & ALT)     s2 |= core::META_MASK;
-   if (s1 & BUTTON1) s2 |= core::BUTTON1_MASK;
-   if (s1 & BUTTON2) s2 |= core::BUTTON2_MASK;
-   if (s1 & BUTTON3) s2 |= core::BUTTON3_MASK;
+   if (s1 & FL_SHIFT)   s2 |= core::SHIFT_MASK;
+   if (s1 & FL_CTRL)    s2 |= core::CONTROL_MASK;
+   if (s1 & FL_ALT)     s2 |= core::META_MASK;
+   if (s1 & FL_BUTTON1) s2 |= core::BUTTON1_MASK;
+   if (s1 & FL_BUTTON2) s2 |= core::BUTTON2_MASK;
+   if (s1 & FL_BUTTON3) s2 |= core::BUTTON3_MASK;
 
    return (core::ButtonState)s2;
 }
@@ -207,60 +218,72 @@
     *    when passed a fltk::PUSH event. "
     */
    switch(event) {
-   case PUSH:
+   case FL_PUSH:
       processed =
-         theLayout->buttonPress (this, event_clicks () + 1,
-                                 translateViewXToCanvasX (event_x ()),
-                                 translateViewYToCanvasY (event_y ()),
-                                 getDwButtonState (), event_button ());
+         theLayout->buttonPress (this, Fl::event_clicks () + 1,
+                                 translateViewXToCanvasX (Fl::event_x ()),
+                                 translateViewYToCanvasY (Fl::event_y ()),
+                                 getDwButtonState (), Fl::event_button ());
       _MSG("PUSH => %s\n", processed ? "true" : "false");
       if (processed) {
          /* pressed dw content; give focus to the view */
-         ::fltk::focus(this);
+         Fl::focus(this);
       }
-      return processed ? true : Group::handle (event);
+      return processed ? true : Fl_Group::handle (event);
 
-   case RELEASE:
+   case FL_RELEASE:
       processed =
-         theLayout->buttonRelease (this, event_clicks () + 1,
-                                   translateViewXToCanvasX (event_x ()),
-                                   translateViewYToCanvasY (event_y ()),
-                                   getDwButtonState (), event_button ());
+         theLayout->buttonRelease (this, Fl::event_clicks () + 1,
+                                   translateViewXToCanvasX (Fl::event_x ()),
+                                   translateViewYToCanvasY (Fl::event_y ()),
+                                   getDwButtonState (), Fl::event_button ());
       _MSG("RELEASE => %s\n", processed ? "true" : "false");
-      return processed ? true : Group::handle (event);
+      return processed ? true : Fl_Group::handle (event);
 
-   case MOVE:
-      mouse_x = event_x();
-      mouse_y = event_y();
+   case FL_MOVE:
+      mouse_x = Fl::event_x();
+      mouse_y = Fl::event_y();
       processed =
          theLayout->motionNotify (this,
                                   translateViewXToCanvasX (mouse_x),
                                   translateViewYToCanvasY (mouse_y),
                                   getDwButtonState ());
       _MSG("MOVE => %s\n", processed ? "true" : "false");
-      return processed ? true : Group::handle (event);
+      return processed ? true : Fl_Group::handle (event);
 
-   case DRAG:
+   case FL_DRAG:
       processed =
          theLayout->motionNotify (this,
-                                  translateViewXToCanvasX (event_x ()),
-                                  translateViewYToCanvasY (event_y ()),
+                                  translateViewXToCanvasX (Fl::event_x ()),
+                                  translateViewYToCanvasY (Fl::event_y ()),
                                   getDwButtonState ());
       _MSG("DRAG => %s\n", processed ? "true" : "false");
-      return processed ? true : Group::handle (event);
+      return processed ? true : Fl_Group::handle (event);
 
-   case ENTER:
-      theLayout->enterNotify (this, translateViewXToCanvasX (event_x ()),
-                              translateViewYToCanvasY (event_y ()),
+   case FL_ENTER:
+      theLayout->enterNotify (this,
+                              translateViewXToCanvasX (Fl::event_x ()),
+                              translateViewYToCanvasY (Fl::event_y ()),
                               getDwButtonState ());
-      return Group::handle (event);
+      return Fl_Group::handle (event);
 
-   case LEAVE:
+   case FL_LEAVE:
       theLayout->leaveNotify (this, getDwButtonState ());
-      return Group::handle (event);
+      return Fl_Group::handle (event);
 
+   case FL_FOCUS:
+      if (focused_child && find(focused_child) < children()) {
+         /* strangely, find() == children() if the child is not found */
+         focused_child->take_focus();
+      }
+      return 1;
+
+   case FL_UNFOCUS:
+      focused_child = fl_oldfocus;
+      return 0;
+      
    default:
-      return Group::handle (event);
+      return Fl_Group::handle (event);
    }
 }
 
@@ -279,22 +302,22 @@
 
 void FltkViewBase::setCursor (core::style::Cursor cursor)
 {
-   static Cursor *mapDwToFltk[] = {
-      CURSOR_CROSS,
-      CURSOR_DEFAULT,
-      CURSOR_HAND,
-      CURSOR_MOVE,
-      CURSOR_WE,
-      CURSOR_NESW,
-      CURSOR_NWSE,
-      CURSOR_NS,
-      CURSOR_NWSE,
-      CURSOR_NESW,
-      CURSOR_NS,
-      CURSOR_WE,
-      CURSOR_INSERT,
-      CURSOR_WAIT,
-      CURSOR_HELP
+   static Fl_Cursor mapDwToFltk[] = {
+      FL_CURSOR_CROSS,
+      FL_CURSOR_DEFAULT,
+      FL_CURSOR_HAND,
+      FL_CURSOR_MOVE,
+      FL_CURSOR_WE,
+      FL_CURSOR_NESW,
+      FL_CURSOR_NWSE,
+      FL_CURSOR_NS,
+      FL_CURSOR_NWSE,
+      FL_CURSOR_NESW,
+      FL_CURSOR_NS,
+      FL_CURSOR_WE,
+      FL_CURSOR_INSERT,
+      FL_CURSOR_WAIT,
+      FL_CURSOR_HELP
    };
 
    /*
@@ -320,14 +343,14 @@
    */
 
    /** \bug Does not work */
-   this->cursor (mapDwToFltk[cursor]);
+   fl_cursor (mapDwToFltk[cursor]);
 }
 
 void FltkViewBase::setBgColor (core::style::Color *color)
 {
    bgColor = color ?
       ((FltkColor*)color)->colors[dw::core::style::Color::SHADING_NORMAL] :
-      WHITE;
+      FL_WHITE;
 }
 
 void FltkViewBase::startDrawing (core::Rectangle *area)
@@ -342,12 +365,12 @@
 {
    drawRegion.addRectangle (area);
    /** DAMAGE_VALUE is just an arbitrary value other than DAMAGE_EXPOSE here */
-   redraw (DAMAGE_VALUE);
+   damage (FL_DAMAGE_USER1);
 }
 
 void FltkViewBase::queueDrawTotal ()
 {
-   redraw (DAMAGE_EXPOSE);
+   damage (FL_DAMAGE_EXPOSE);
 }
 
 void FltkViewBase::cancelQueueDraw ()
@@ -364,9 +387,16 @@
                              core::style::Color::Shading shading,
                              int x1, int y1, int x2, int y2)
 {
-   setcolor(((FltkColor*)color)->colors[shading]);
-   drawline (translateCanvasXToViewX (x1), translateCanvasYToViewY (y1),
-             translateCanvasXToViewX (x2), translateCanvasYToViewY (y2));
+   fl_color(((FltkColor*)color)->colors[shading]);
+   // we clip with a large border (5000px), as clipping causes artefacts
+   // with non-solid line styles.
+   // However it's still better than no clipping at all.
+   clipPoint (&x1, &y1, 5000);
+   clipPoint (&x2, &y2, 5000);
+   fl_line (translateCanvasXToViewX (x1),
+            translateCanvasYToViewY (y1),
+            translateCanvasXToViewX (x2),
+            translateCanvasYToViewY (y2));
 }
 
 void FltkViewBase::drawTypedLine (core::style::Color *color,
@@ -385,42 +415,42 @@
       d = len % f*width;
       gap = ng ? d/ng + (w > 3 ? 2 : 0) : 0;
       dashes[0] = 1; dashes[1] = f*width-gap; dashes[2] = 0;
-      line_style(::fltk::DASH + ::fltk::CAP_ROUND, w, dashes);
+      fl_line_style(FL_DASH + FL_CAP_ROUND, w, dashes);
 
       /* These formulas also work, but ain't pretty ;)
-       * line_style(::fltk::DOT + ::fltk::CAP_ROUND, w);
+       * fl_line_style(FL_DOT + FL_CAP_ROUND, w);
        * dashes[0] = 1; dashes[1] = 3*width-2; dashes[2] = 0;
        */
    } else if (type == core::style::LINE_DASHED) {
-      line_style(::fltk::DASH + ::fltk::CAP_ROUND, w);
+      fl_line_style(FL_DASH + FL_CAP_ROUND, w);
    }
 
-   setcolor(((FltkColor*)color)->colors[shading]);
+   fl_color(((FltkColor*)color)->colors[shading]);
    drawLine (color, shading, x1, y1, x2, y2);
 
    if (type != core::style::LINE_NORMAL)
-      line_style(::fltk::SOLID);
+      fl_line_style(FL_SOLID);
 }
 
 void FltkViewBase::drawRectangle (core::style::Color *color,
                                   core::style::Color::Shading shading,
                                   bool filled,
-                                  int x, int y, int width, int height)
+                                  int X, int Y, int width, int height)
 {
-   setcolor(((FltkColor*)color)->colors[shading]);
+   fl_color(((FltkColor*)color)->colors[shading]);
    if (width < 0) {
-      x += width;
+      X += width;
       width = -width;
    }
    if (height < 0) {
-      y += height;
+      Y += height;
       height = -height;
    }
 
-   int x1 = translateCanvasXToViewX (x);
-   int y1 = translateCanvasYToViewY (y);
-   int x2 = translateCanvasXToViewX (x + width);
-   int y2 = translateCanvasYToViewY (y + height);
+   int x1 = X;
+   int y1 = Y;
+   int x2 = X + width;
+   int y2 = Y + height;
 
    // We only support rectangles with line width 1px, so we clip with
    // a rectangle 1px wider and higher than what we actually expose.
@@ -428,11 +458,15 @@
    clipPoint (&x1, &y1, 1);
    clipPoint (&x2, &y2, 1);
 
-   ::fltk::Rectangle rect (x1, y1, x2 - x1, y2 - y1);
+   x1 = translateCanvasXToViewX (x1);
+   y1 = translateCanvasYToViewY (y1);
+   x2 = translateCanvasXToViewX (x2);
+   y2 = translateCanvasYToViewY (y2);
+
    if (filled)
-      fillrect (rect);
+      fl_rectf (x1, y1, x2 - x1, y2 - y1);
    else
-      strokerect (rect);
+      fl_rect (x1, y1, x2 - x1, y2 - y1);
 }
 
 void FltkViewBase::drawArc (core::style::Color *color,
@@ -440,47 +474,55 @@
                             int centerX, int centerY, int width, int height,
                             int angle1, int angle2)
 {
-   setcolor(((FltkColor*)color)->colors[shading]);
+   fl_color(((FltkColor*)color)->colors[shading]);
    int x = translateCanvasXToViewX (centerX) - width / 2;
    int y = translateCanvasYToViewY (centerY) - height / 2;
-   ::fltk::Rectangle rect (x, y, width, height);
-   addchord(rect, angle1, angle2);
-   closepath();
+
+   fl_arc(x, y, width, height, 0.0, 360.0);
    if (filled)
-      fillpath();
-   else
-      strokepath();
+      fl_pie(x, y, width, height, 0.0, 360.0);
 }
 
 void FltkViewBase::drawPolygon (core::style::Color *color,
                                 core::style::Color::Shading shading,
-                                bool filled, int points[][2], int npoints)
+                                bool filled, bool convex, int points[][2],
+                                int npoints)
 {
    if (npoints > 0) {
+      fl_color(((FltkColor*)color)->colors[shading]);
+
+      if (filled) {
+         if (convex)
+            fl_begin_polygon();
+         else
+            fl_begin_complex_polygon();
+      } else
+         fl_begin_loop();
+
       for (int i = 0; i < npoints; i++) {
-         points[i][0] = translateCanvasXToViewX(points[i][0]);
-         points[i][1] = translateCanvasYToViewY(points[i][1]);
+         fl_vertex(translateCanvasXToViewX(points[i][0]),
+                   translateCanvasYToViewY(points[i][1]));
       }
-      setcolor(((FltkColor*)color)->colors[shading]);
-      addvertices(npoints, points);
-      closepath();
-      if (filled)
-         fillpath();
-      else
-         strokepath();
+      if (filled) {
+         if (convex)
+            fl_end_polygon();
+         else
+            fl_end_complex_polygon();
+      } else
+         fl_end_loop();
    }
 }
 
 core::View *FltkViewBase::getClippingView (int x, int y, int width, int height)
 {
-   push_clip (translateCanvasXToViewX (x), translateCanvasYToViewY (y),
-              width, height);
+   fl_push_clip (translateCanvasXToViewX (x), translateCanvasYToViewY (y),
+                 width, height);
    return this;
 }
 
 void FltkViewBase::mergeClippingView (core::View *clippingView)
 {
-   pop_clip ();
+   fl_pop_clip ();
 }
 
 // ----------------------------------------------------------------------
@@ -496,36 +538,39 @@
 }
 
 void FltkWidgetView::layout () {
+#if 0
+PORT1.3
    /**
     * pass layout to child widgets. This is needed for complex fltk
     * widgets as TextEditor.
     * We can't use Group::layout() as that would rearrange the widgets.
     */
    for (int i = children () - 1; i >= 0; i--) {
-      ::fltk::Widget *widget = child (i);
+      Fl_Widget *widget = child (i);
 
       if (widget->layout_damage ()) {
          widget->layout ();
       }
    }
+#endif
 }
 
 void FltkWidgetView::drawText (core::style::Font *font,
                              core::style::Color *color,
                              core::style::Color::Shading shading,
-                             int x, int y, const char *text, int len)
+                             int X, int Y, const char *text, int len)
 {
    FltkFont *ff = (FltkFont*)font;
-   setfont(ff->font, ff->size);
-   setcolor(((FltkColor*)color)->colors[shading]);
+   fl_font(ff->font, ff->size);
+   fl_color(((FltkColor*)color)->colors[shading]);
 
    if (!font->letterSpacing && !font->fontVariant) {
-      drawtext(text, len,
-               translateCanvasXToViewX (x), translateCanvasYToViewY (y));
+      fl_draw(text, len,
+              translateCanvasXToViewX (X), translateCanvasYToViewY (Y));
    } else {
       /* Nonzero letter spacing adjustment, draw each glyph individually */
-      int viewX = translateCanvasXToViewX (x),
-          viewY = translateCanvasYToViewY (y);
+      int viewX = translateCanvasXToViewX (X),
+          viewY = translateCanvasYToViewY (Y);
       int curr = 0, next = 0, nb;
       char chbuf[4];
       wchar_t wc, wcu;
@@ -534,28 +579,28 @@
          int sc_fontsize = lout::misc::roundInt(ff->size * 0.78);
          for (curr = 0; next < len; curr = next) {
             next = theLayout->nextGlyph(text, curr);
-            wc = utf8decode(text + curr, text + next, &nb);
+            wc = fl_utf8decode(text + curr, text + next, &nb);
             if ((wcu = towupper(wc)) == wc) {
                /* already uppercase, just draw the character */
-               setfont(ff->font, ff->size);
-               drawtext(text + curr, next - curr, viewX, viewY);
+               fl_font(ff->font, ff->size);
+               fl_draw(text + curr, next - curr, viewX, viewY);
                viewX += font->letterSpacing;
-               viewX += (int)getwidth(text + curr, next - curr);
+               viewX += (int)fl_width(text + curr, next - curr);
             } else {
                /* make utf8 string for converted char */
-               nb = utf8encode(wcu, chbuf);
-               setfont(ff->font, sc_fontsize);
-               drawtext(chbuf, nb, viewX, viewY);
+               nb = fl_utf8encode(wcu, chbuf);
+               fl_font(ff->font, sc_fontsize);
+               fl_draw(chbuf, nb, viewX, viewY);
                viewX += font->letterSpacing;
-               viewX += (int)getwidth(chbuf, nb);
+               viewX += (int)fl_width(chbuf, nb);
             }
          }
       } else {
          while (next < len) {
             next = theLayout->nextGlyph(text, curr);
-            drawtext(text + curr, next - curr, viewX, viewY);
+            fl_draw(text + curr, next - curr, viewX, viewY);
             viewX += font->letterSpacing +
-                     (int)getwidth(text + curr,next - curr);
+                     (int)fl_width(text + curr,next - curr);
             curr = next;
          }
       }
@@ -563,12 +608,12 @@
 }
 
 void FltkWidgetView::drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot,
-                              int x, int y, int width, int height)
+                              int X, int Y, int width, int height)
 {
    ((FltkImgbuf*)imgbuf)->draw (this,
                                 translateCanvasXToViewX (xRoot),
                                 translateCanvasYToViewY (yRoot),
-                                x, y, width, height);
+                                X, Y, width, height);
 }
 
 bool FltkWidgetView::usesFltkWidgets ()
@@ -576,33 +621,36 @@
    return true;
 }
 
-void FltkWidgetView::addFltkWidget (::fltk::Widget *widget,
-                                  core::Allocation *allocation)
+void FltkWidgetView::addFltkWidget (Fl_Widget *widget,
+                                    core::Allocation *allocation)
 {
    allocateFltkWidget (widget, allocation);
    add (widget);
 }
 
-void FltkWidgetView::removeFltkWidget (::fltk::Widget *widget)
+void FltkWidgetView::removeFltkWidget (Fl_Widget *widget)
 {
    remove (widget);
 }
 
-void FltkWidgetView::allocateFltkWidget (::fltk::Widget *widget,
+void FltkWidgetView::allocateFltkWidget (Fl_Widget *widget,
                                        core::Allocation *allocation)
 {
-   widget->x (translateCanvasXToViewX (allocation->x));
-   widget->y (translateCanvasYToViewY (allocation->y));
-   widget->w (allocation->width);
-   widget->h (allocation->ascent + allocation->descent);
+   widget->resize (translateCanvasXToViewX (allocation->x),
+      translateCanvasYToViewY (allocation->y),
+      allocation->width,
+      allocation->ascent + allocation->descent);
 
+#if 0
+PORT1.3
    /* widgets created tiny and later resized need this flag to display */
    uchar damage = widget->layout_damage ();
    damage |= LAYOUT_XYWH;
    widget->layout_damage (damage);
+#endif
 }
 
-void FltkWidgetView::drawFltkWidget (::fltk::Widget *widget,
+void FltkWidgetView::drawFltkWidget (Fl_Widget *widget,
                                    core::Rectangle *area)
 {
    draw_child (*widget);
--- a/dw/fltkviewbase.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkviewbase.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -4,45 +4,59 @@
 #include <time.h>         // for time_t
 #include <sys/time.h>     // for time_t in FreeBSD
 
-#include <fltk/Group.h>
-#include <fltk/Image.h>
-#include <fltk/Scrollbar.h>
+#include <FL/Fl_Group.H>
+#include <FL/x.H>
+#include <FL/Fl_Scrollbar.H>
 
 #include "fltkcore.hh"
 
 namespace dw {
 namespace fltk {
 
-class FltkViewBase: public FltkView, public ::fltk::Group
+class FltkViewBase: public FltkView, public Fl_Group
 {
 private:
+   class BackBuffer {
+      private:
+         int w;
+         int h;
+         bool created;
+
+      public:
+         Fl_Offscreen offscreen;
+      
+         BackBuffer ();
+         ~BackBuffer ();
+         void setSize(int w, int h);
+   };
+
    typedef enum { DRAW_PLAIN, DRAW_CLIPPED, DRAW_BUFFERED } DrawType;
 
    int bgColor;
    core::Region drawRegion;
-   ::fltk::Rectangle *exposeArea;
-   static ::fltk::Image *backBuffer;
+   core::Rectangle *exposeArea;
+   static BackBuffer *backBuffer;
    static bool backBufferInUse;
 
    void draw (const core::Rectangle *rect, DrawType type);
    void drawChildWidgets ();
    inline void clipPoint (int *x, int *y, int border) {
       if (exposeArea) {
-         if (*x < exposeArea->x () - border)
-            *x = exposeArea->x () - border;
-         if (*x > exposeArea->r () + border)
-            *x = exposeArea->r () + border;
-         if (*y < exposeArea->y () - border)
-            *y = exposeArea->y () - border;
-         if (*y > exposeArea->b () + border)
-            *y = exposeArea->b () + border;
+         if (*x < exposeArea->x - border)
+            *x = exposeArea->x - border;
+         if (*x > exposeArea->x + exposeArea->width + border)
+            *x = exposeArea->x + exposeArea->width + border;
+         if (*y < exposeArea->y - border)
+            *y = exposeArea->y - border;
+         if (*y > exposeArea->y + exposeArea->height + border)
+            *y = exposeArea->y + exposeArea->height + border;
       }
    }
-
 protected:
    core::Layout *theLayout;
    int canvasWidth, canvasHeight;
    int mouse_x, mouse_y;
+   Fl_Widget *focused_child;
 
    virtual int translateViewXToCanvasX (int x) = 0;
    virtual int translateViewYToCanvasY (int y) = 0;
@@ -85,7 +99,7 @@
                  int angle1, int angle2);
     void drawPolygon (core::style::Color *color,
                       core::style::Color::Shading shading,
-                      bool filled, int points[][2], int npoints);
+                      bool filled, bool convex, int points[][2], int npoints);
 
    core::View *getClippingView (int x, int y, int width, int height);
    void mergeClippingView (core::View *clippingView);
@@ -109,11 +123,11 @@
                    int x, int y, int width, int height);
 
    bool usesFltkWidgets ();
-   void addFltkWidget (::fltk::Widget *widget, core::Allocation *allocation);
-   void removeFltkWidget (::fltk::Widget *widget);
-   void allocateFltkWidget (::fltk::Widget *widget,
+   void addFltkWidget (Fl_Widget *widget, core::Allocation *allocation);
+   void removeFltkWidget (Fl_Widget *widget);
+   void allocateFltkWidget (Fl_Widget *widget,
                             core::Allocation *allocation);
-   void drawFltkWidget (::fltk::Widget *widget, core::Rectangle *area);
+   void drawFltkWidget (Fl_Widget *widget, core::Rectangle *area);
 };
 
 } // namespace fltk
--- a/dw/fltkviewport.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkviewport.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -21,14 +21,12 @@
 
 #include "fltkviewport.hh"
 
-#include <fltk/draw.h>
-#include <fltk/damage.h>
-#include <fltk/events.h>
+#include <FL/Fl.H>
+#include <FL/fl_draw.H>
 
 #include <stdio.h>
 #include "../lout/msg.h"
 
-using namespace fltk;
 using namespace lout;
 using namespace lout::object;
 using namespace lout::container::typed;
@@ -36,16 +34,16 @@
 namespace dw {
 namespace fltk {
 
-FltkViewport::FltkViewport (int x, int y, int w, int h, const char *label):
-   FltkWidgetView (x, y, w, h, label)
+FltkViewport::FltkViewport (int X, int Y, int W, int H, const char *label):
+   FltkWidgetView (X, Y, W, H, label)
 {
-   hscrollbar = new Scrollbar (0, 0, 1, 1);
-   hscrollbar->set_horizontal();
+   hscrollbar = new Fl_Scrollbar (x (), y (), 1, 1);
+   hscrollbar->type(FL_HORIZONTAL);
    hscrollbar->callback (hscrollbarCallback, this);
    add (hscrollbar);
 
-   vscrollbar = new Scrollbar (0, 0, 1, 1);
-   vscrollbar->set_vertical();
+   vscrollbar = new Fl_Scrollbar (x (), y(), 1, 1);
+   vscrollbar->type(FL_VERTICAL);
    vscrollbar->callback (vscrollbarCallback, this);
    add (vscrollbar);
 
@@ -58,7 +56,7 @@
    gadgetOrientation[3] = GADGET_HORIZONTAL;
 
    gadgets =
-      new container::typed::List <object::TypedPointer < ::fltk::Widget> >
+      new container::typed::List <object::TypedPointer < Fl_Widget> >
       (true);
 }
 
@@ -94,32 +92,25 @@
       vdiff = hscrollbar->visible () ? SCROLLBAR_THICKNESS : 0;
    }
 
-   hscrollbar->x (0);
-   hscrollbar->y (0 + h () - SCROLLBAR_THICKNESS);
-   hscrollbar->w (w () - hdiff);
-   hscrollbar->h (SCROLLBAR_THICKNESS);
+   hscrollbar->resize(x (), y () + h () - SCROLLBAR_THICKNESS,
+                      w () - hdiff, SCROLLBAR_THICKNESS);
+   vscrollbar->resize(x () + w () - SCROLLBAR_THICKNESS, y (),
+                      SCROLLBAR_THICKNESS, h () - vdiff);
 
-   vscrollbar->x (0 + w () - SCROLLBAR_THICKNESS);
-   vscrollbar->y (0);
-   vscrollbar->h (h () - vdiff);
-   vscrollbar->w (SCROLLBAR_THICKNESS);
-
-   int x = w () - SCROLLBAR_THICKNESS, y = h () - SCROLLBAR_THICKNESS;
-   for (Iterator <TypedPointer < ::fltk::Widget> > it = gadgets->iterator ();
+   int X = x () + w () - SCROLLBAR_THICKNESS;
+   int Y = y () + h () - SCROLLBAR_THICKNESS;
+   for (Iterator <TypedPointer < Fl_Widget> > it = gadgets->iterator ();
         it.hasNext (); ) {
-      ::fltk::Widget *widget = it.getNext()->getTypedValue ();
-      widget->x (0);
-      widget->y (0);
-      widget->w (SCROLLBAR_THICKNESS);
-      widget->h (SCROLLBAR_THICKNESS);
+      Fl_Widget *widget = it.getNext()->getTypedValue ();
+      widget->resize(x (), y (), SCROLLBAR_THICKNESS, SCROLLBAR_THICKNESS);
 
       switch (gadgetOrientation [visibility]) {
       case GADGET_VERTICAL:
-         y -= SCROLLBAR_THICKNESS;
+         Y -= SCROLLBAR_THICKNESS;
          break;
 
       case GADGET_HORIZONTAL:
-         x -= SCROLLBAR_THICKNESS;
+         X -= SCROLLBAR_THICKNESS;
          break;
       }
    }
@@ -141,40 +132,43 @@
    scroll (0, vscrollbar->value () - scrollY);
 }
 
-void FltkViewport::vscrollbarCallback (Widget *vscrollbar, void *viewportPtr)
+void FltkViewport::vscrollbarCallback (Fl_Widget *vscrollbar,void *viewportPtr)
 {
    ((FltkViewport*)viewportPtr)->vscrollbarChanged ();
 }
 
-void FltkViewport::hscrollbarCallback (Widget *hscrollbar, void *viewportPtr)
+void FltkViewport::hscrollbarCallback (Fl_Widget *hscrollbar,void *viewportPtr)
 {
    ((FltkViewport*)viewportPtr)->hscrollbarChanged ();
 }
 
 // ----------------------------------------------------------------------
 
-void FltkViewport::layout ()
+void FltkViewport::resize(int X, int Y, int W, int H) 
 {
-   theLayout->viewportSizeChanged (this, w(), h());
-   adjustScrollbarsAndGadgetsAllocation ();
+   bool dimension_changed = W != w() || H != h();
 
-   FltkWidgetView::layout ();
+   Fl_Group::resize(X, Y, W, H);
+   if (dimension_changed) {
+      theLayout->viewportSizeChanged (this, W, H);
+      adjustScrollbarsAndGadgetsAllocation ();
+   }
 }
 
-void FltkViewport::draw_area (void *data, const Rectangle& cr )
+void FltkViewport::draw_area (void *data, int x, int y, int w, int h)
 {
   FltkViewport *vp = (FltkViewport*) data;
-  push_clip(cr);
+  fl_push_clip(x, y, w, h);
 
   vp->FltkWidgetView::draw ();
 
-  for (Iterator <TypedPointer < ::fltk::Widget> > it = vp->gadgets->iterator();
+  for (Iterator <TypedPointer < Fl_Widget> > it = vp->gadgets->iterator();
        it.hasNext (); ) {
-     ::fltk::Widget *widget = it.getNext()->getTypedValue ();
+     Fl_Widget *widget = it.getNext()->getTypedValue ();
      vp->draw_child (*widget);
   }
 
-  pop_clip();
+  fl_pop_clip();
 
 }
 
@@ -182,20 +176,18 @@
 {
    int hdiff = vscrollbar->visible () ? SCROLLBAR_THICKNESS : 0;
    int vdiff = hscrollbar->visible () ? SCROLLBAR_THICKNESS : 0;
-   Rectangle cr (0, 0, w () - hdiff, h () - vdiff);
    int d = damage();
 
-   if (d & DAMAGE_SCROLL) {
-      set_damage (DAMAGE_SCROLL);
-      scrollrect(cr, -scrollDX, -scrollDY, draw_area, this);
-      d &= ~DAMAGE_SCROLL;
-      set_damage (d);
+   if (d & FL_DAMAGE_SCROLL) {
+      clear_damage (FL_DAMAGE_SCROLL);
+      fl_scroll(x(), y(), w () - hdiff, h () - vdiff, -scrollDX, -scrollDY, draw_area, this);
+      clear_damage (d & ~FL_DAMAGE_SCROLL);
    }
 
    if (d) {
-      draw_area(this, cr);
+      draw_area(this, x(), y(), w () - hdiff, h () - vdiff);
 
-      if (d == DAMAGE_CHILD) {
+      if (d == FL_DAMAGE_CHILD) {
          if (hscrollbar->damage ())
             draw_child (*hscrollbar);
          if (vscrollbar->damage ())
@@ -214,87 +206,71 @@
 {
    _MSG("FltkViewport::handle %d\n", event);
 
-   if (hscrollbar->Rectangle::contains (event_x (), event_y ()) &&
-       !(event_state() & (SHIFT | CTRL | ALT)) &&
-       hscrollbar->send (event)) {
-      return 1;
-   }
-
-   if (vscrollbar->Rectangle::contains (event_x (), event_y ()) &&
-      vscrollbar->send (event)) {
-      return 1;
-   }
+   if (!dragScrolling &&
+       (Fl::event_inside(vscrollbar) ||
+        (Fl::event_inside(hscrollbar) &&
+         !(Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT)))))
+      return Fl_Group::handle(event);
 
    switch(event) {
-   case ::fltk::KEY:
-      /* Tell fltk we want to receive KEY events as SHORTCUT.
+   case FL_KEYBOARD:
+      /* Tell fltk we want to receive KEYBOARD events as SHORTCUT.
        * As we don't know the exact keybindings set by the user, we ask
-       * for all of them (except TabKey to keep form navigation). */
-      if (::fltk::event_key() != TabKey)
+       * for all of them (except Tab to keep form navigation). */
+      if (Fl::event_key() != FL_Tab)
          return 0;
       break;
 
-   case ::fltk::FOCUS:
+   case FL_FOCUS:
       /** \bug Draw focus box. */
-
-      /* If the user clicks with the left button we take focus
-       * and thereby unfocus any form widgets.
-       * Otherwise we let fltk do the focus handling.
-       */
-      if (::fltk::event_button() == ::fltk::LeftButton || focus_index() < 0) {
-         focus_index(-1);
-         return 1;
-      }
       break;
 
-   case ::fltk::UNFOCUS:
+   case FL_UNFOCUS:
       /** \bug Undraw focus box. */
       break;
 
-   case ::fltk::PUSH:
-      take_focus();
-      if (::fltk::event_button() == ::fltk::MiddleButton) {
+   case FL_PUSH:
+      if (FltkWidgetView::handle (event) == 0 &&
+          Fl::event_button() == FL_MIDDLE_MOUSE) {
          /* pass event so that middle click can open link in new window */
-         if (FltkWidgetView::handle (event) == 0) {
-            dragScrolling = 1;
-            dragX = ::fltk::event_x();
-            dragY = ::fltk::event_y();
-            setCursor (core::style::CURSOR_MOVE);
-         }
-         return 1;
+         dragScrolling = 1;
+         dragX = Fl::event_x();
+         dragY = Fl::event_y();
+         setCursor (core::style::CURSOR_MOVE);
       }
+      return 1;
       break;
 
-   case ::fltk::DRAG:
-      if (::fltk::event_button() == ::fltk::MiddleButton) {
+   case FL_DRAG:
+      if (Fl::event_button() == FL_MIDDLE_MOUSE) {
          if (dragScrolling) {
-            scroll(dragX - ::fltk::event_x(), dragY - ::fltk::event_y());
-            dragX = ::fltk::event_x();
-            dragY = ::fltk::event_y();
+            scroll(dragX - Fl::event_x(), dragY - Fl::event_y());
+            dragX = Fl::event_x();
+            dragY = Fl::event_y();
             return 1;
          }
       }
       break;
 
-   case ::fltk:: MOUSEWHEEL:
-      return (event_dx() ? hscrollbar : vscrollbar)->handle(event);
+   case FL_MOUSEWHEEL:
+      return (Fl::event_dx() ? hscrollbar : vscrollbar)->handle(event);
       break;
 
-   case ::fltk::RELEASE:
-      if (::fltk::event_button() == ::fltk::MiddleButton) {
+   case FL_RELEASE:
+      if (Fl::event_button() == FL_MIDDLE_MOUSE) {
          dragScrolling = 0;
          setCursor (core::style::CURSOR_DEFAULT);
       }
       break;
 
-   case ::fltk::ENTER:
+   case FL_ENTER:
       /* could be the result of, e.g., closing another window. */
-      mouse_x = ::fltk::event_x();
-      mouse_y = ::fltk::event_y();
+      mouse_x = Fl::event_x();
+      mouse_y = Fl::event_y();
       positionChanged();
       break;
 
-   case ::fltk::LEAVE:
+   case FL_LEAVE:
       mouse_x = mouse_y = -1;
       break;
    }
@@ -373,7 +349,7 @@
    scrollY = y;
 
    adjustScrollbarValues ();
-   redraw (DAMAGE_SCROLL);
+   damage(FL_DAMAGE_SCROLL);
    theLayout->scrollPosChanged (this, scrollX, scrollY);
    positionChanged();
 }
@@ -386,9 +362,9 @@
 void FltkViewport::scroll (core::ScrollCommand cmd)
 {
    if (cmd == core::SCREEN_UP_CMD) {
-      scroll (0, -vscrollbar->pagesize ());
+      scroll (0, -h () + vscrollbar->linesize ());
    } else if (cmd == core::SCREEN_DOWN_CMD) {
-      scroll (0, vscrollbar->pagesize ());
+      scroll (0, h () - vscrollbar->linesize ());
    } else if (cmd == core::LINE_UP_CMD) {
       scroll (0, (int) -vscrollbar->linesize ());
    } else if (cmd == core::LINE_DOWN_CMD) {
@@ -426,34 +402,33 @@
 {
    // scroll all child widgets except scroll bars
    for (int i = children () - 1; i > 0; i--) {
-      ::fltk::Widget *widget = child (i);
+      Fl_Widget *widget = child (i);
 
       if (widget == hscrollbar || widget == vscrollbar)
          continue;
 
-      widget->x (widget->x () - dx);
-      widget->y (widget->y () - dy);
+      widget->position(widget->x () - dx, widget->y () - dy);
    }
 }
 
-int FltkViewport::translateViewXToCanvasX (int x)
+int FltkViewport::translateViewXToCanvasX (int X)
 {
-   return x + scrollX;
+   return X - x () + scrollX;
 }
 
-int FltkViewport::translateViewYToCanvasY (int y)
+int FltkViewport::translateViewYToCanvasY (int Y)
 {
-   return y + scrollY;
+   return Y - y () + scrollY;
 }
 
-int FltkViewport::translateCanvasXToViewX (int x)
+int FltkViewport::translateCanvasXToViewX (int X)
 {
-   return x - scrollX;
+   return X + x () - scrollX;
 }
 
-int FltkViewport::translateCanvasYToViewY (int y)
+int FltkViewport::translateCanvasYToViewY (int Y)
 {
-   return y - scrollY;
+   return Y + y () - scrollY;
 }
 
 // ----------------------------------------------------------------------
@@ -468,11 +443,11 @@
    adjustScrollbarsAndGadgetsAllocation ();
 }
 
-void FltkViewport::addGadget (::fltk::Widget *gadget)
+void FltkViewport::addGadget (Fl_Widget *gadget)
 {
    /** \bug Reparent? */
 
-   gadgets->append (new TypedPointer < ::fltk::Widget> (gadget));
+   gadgets->append (new TypedPointer < Fl_Widget> (gadget));
    adjustScrollbarsAndGadgetsAllocation ();
 }
 
--- a/dw/fltkviewport.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/fltkviewport.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -1,8 +1,8 @@
 #ifndef __DW_FLTKVIEWPORT_HH__
 #define __DW_FLTKVIEWPORT_HH__
 
-#include <fltk/Group.h>
-#include <fltk/Scrollbar.h>
+#include <FL/Fl_Group.H>
+#include <FL/Fl_Scrollbar.H>
 
 #include "core.hh"
 #include "fltkcore.hh"
@@ -23,10 +23,10 @@
    int scrollDX, scrollDY;
    int dragScrolling, dragX, dragY;
 
-   ::fltk::Scrollbar *vscrollbar, *hscrollbar;
+   Fl_Scrollbar *vscrollbar, *hscrollbar;
 
    GadgetOrientation gadgetOrientation[4];
-   lout::container::typed::List <lout::object::TypedPointer < ::fltk::Widget> >
+   lout::container::typed::List <lout::object::TypedPointer < Fl_Widget> >
       *gadgets;
 
    void adjustScrollbarsAndGadgetsAllocation ();
@@ -35,11 +35,11 @@
    void vscrollbarChanged ();
    void positionChanged ();
 
-   static void hscrollbarCallback (Widget *hscrollbar, void *viewportPtr);
-   static void vscrollbarCallback (Widget *vscrollbar, void *viewportPtr);
+   static void hscrollbarCallback (Fl_Widget *hscrollbar, void *viewportPtr);
+   static void vscrollbarCallback (Fl_Widget *vscrollbar, void *viewportPtr);
 
    void updateCanvasWidgets (int oldScrollX, int oldScrollY);
-   static void draw_area (void *data, const Rectangle& cr);
+   static void draw_area (void *data, int x, int y, int w, int h);
 
 protected:
    int translateViewXToCanvasX (int x);
@@ -51,7 +51,7 @@
    FltkViewport (int x, int y, int w, int h, const char *label = 0);
    ~FltkViewport ();
 
-   void layout();
+   void resize(int x, int y, int w, int h);
    void draw ();
    int handle (int event);
 
@@ -69,7 +69,7 @@
 
    void setGadgetOrientation (bool hscrollbarVisible, bool vscrollbarVisible,
                               GadgetOrientation gadgetOrientation);
-   void addGadget (::fltk::Widget *gadget);
+   void addGadget (Fl_Widget *gadget);
 };
 
 } // namespace fltk
--- a/dw/layout.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/layout.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -219,14 +219,19 @@
 
 Layout::~Layout ()
 {
+   widgetAtPoint = NULL;
+
    if (scrollIdleId != -1)
       platform->removeIdle (scrollIdleId);
    if (resizeIdleId != -1)
       platform->removeIdle (resizeIdleId);
    if (bgColor)
       bgColor->unref ();
-   if (topLevel)
-      delete topLevel;
+   if (topLevel) {
+      Widget *w = topLevel;
+      topLevel = NULL;
+      delete w;
+   }
    delete platform;
    delete view;
    delete anchorsTable;
@@ -278,9 +283,12 @@
 
 void Layout::setWidget (Widget *widget)
 {
-   if (topLevel)
-      delete topLevel;
    widgetAtPoint = NULL;
+   if (topLevel) {
+      Widget *w = topLevel;
+      topLevel = NULL;
+      delete w;
+   }
    textZone->zoneFree ();
    addWidget (widget);
 
--- a/dw/style.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/style.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -424,6 +424,7 @@
 
 {
    int points[4][2], d, w;
+   const bool filled = true, convex = true;
    bool ridge = false, inset = false, dotted = false;
    Color::Shading shading = Color::SHADING_NORMAL;
 
@@ -458,7 +459,8 @@
          points[2][0] = points[1][0] - style->borderWidth.right;
          points[3][0] = x1 + style->borderWidth.left;
          points[2][1] = points[3][1] = points[0][1] + style->borderWidth.top;
-         view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+         view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                            points, 4);
       }
       break;
    case BORDER_RIDGE:
@@ -472,7 +474,8 @@
       points[3][0] = x1 + style->borderWidth.left / 2;
       points[2][1] = points[3][1] = y1 + style->borderWidth.top / 2 + d;
       shading = (ridge) ? Color::SHADING_LIGHT : Color::SHADING_DARK;
-      view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                         points, 4);
       points[0][0] = x1 + style->borderWidth.left / 2 + d;
       points[1][0] = x2 - style->borderWidth.right / 2 + 1 - d;
       points[0][1] = points[1][1] = y1 + style->borderWidth.top / 2 + d;
@@ -480,7 +483,8 @@
       points[3][0] = x1 + style->borderWidth.left;
       points[2][1] = points[3][1] = y1 + style->borderWidth.top;
       shading = (ridge) ? Color::SHADING_DARK : Color::SHADING_LIGHT;
-      view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                         points, 4);
       break;
    case BORDER_DOUBLE:
       w = (int) rint(style->borderWidth.top / 3.0);
@@ -497,14 +501,16 @@
       points[2][0] = points[1][0] - w_r;
       points[3][0] = points[0][0] + w_l;
       points[2][1] = points[3][1] = points[0][1] + w;
-      view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                         points, 4);
       points[0][0] = x1 + style->borderWidth.left - w_l;
       points[1][0] = x2 + 1 - style->borderWidth.right + w_r;
       points[0][1] = points[1][1] = y1 + w + d;
       points[2][0] = x2 + 1 - style->borderWidth.right;
       points[3][0] = x1 + style->borderWidth.left;
       points[2][1] = points[3][1] = y1 + style->borderWidth.top;
-      view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                         points, 4);
       break;
    }
 }
@@ -514,6 +520,7 @@
 
 {
    int points[4][2], d, w;
+   const bool filled = true, convex = true;
    bool ridge = false, inset = false, dotted = false;
    Color::Shading shading = Color::SHADING_NORMAL;
 
@@ -548,7 +555,8 @@
          points[2][0] = points[1][0] - style->borderWidth.right;
          points[3][0] = points[0][0] + style->borderWidth.left;
          points[2][1] = points[3][1] = points[0][1]-style->borderWidth.bottom;
-         view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+         view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                            points, 4);
       }
       break;
    case BORDER_RIDGE:
@@ -563,7 +571,8 @@
       points[3][0] = points[0][0] + style->borderWidth.left / 2 + d;
       points[2][1] = points[3][1] = points[0][1] - w/2 - d;
       shading = (ridge) ? Color::SHADING_DARK : Color::SHADING_LIGHT;
-      view->drawPolygon (style->borderColor.bottom, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.bottom, shading, filled, convex,
+                         points, 4);
       // clockwise
       points[0][0] = x1 + style->borderWidth.left - 1;
       points[1][0] = x2 + 1 - style->borderWidth.right + 1;
@@ -572,7 +581,8 @@
       points[3][0] = points[0][0] - style->borderWidth.left / 2;
       points[2][1] = points[3][1] = points[0][1] + w/2;
       shading = (ridge) ? Color::SHADING_LIGHT : Color::SHADING_DARK;
-      view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                         points, 4);
       break;
    case BORDER_DOUBLE:
       w = (int) rint(style->borderWidth.bottom / 3.0);
@@ -589,14 +599,16 @@
       points[2][0] = points[1][0] + w_l;
       points[3][0] = points[0][0] - w_r;
       points[2][1] = points[3][1] = points[0][1] - w;
-      view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                         points, 4);
       points[0][0] = x2 + 2 - style->borderWidth.right + w_r;
       points[1][0] = x1 - 1 + style->borderWidth.left - w_l;
       points[0][1] = points[1][1] = y1 + 1 - w - d;
       points[2][0] = x1 - 1 + style->borderWidth.left;
       points[3][0] = x2 + 2 - style->borderWidth.right;
       points[2][1] = points[3][1] = y1 + 1 - style->borderWidth.bottom;
-      view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                         points, 4);
       break;
    }
 }
@@ -606,6 +618,7 @@
 
 {
    int points[4][2], d, w;
+   bool filled = true, convex = true;
    bool ridge = false, inset = false, dotted = false;
    Color::Shading shading = Color::SHADING_NORMAL;
 
@@ -639,7 +652,8 @@
          points[2][0] = points[3][0] = points[0][0] + style->borderWidth.left;
          points[2][1] = points[1][1] - style->borderWidth.bottom;
          points[3][1] = points[0][1] + style->borderWidth.top;
-         view->drawPolygon (style->borderColor.left, shading, true, points, 4);
+         view->drawPolygon (style->borderColor.left, shading, filled, convex,
+                            points, 4);
       }
       break;
    case BORDER_RIDGE:
@@ -654,7 +668,8 @@
       points[2][1] = y2 - style->borderWidth.bottom / 2;
       points[3][1] = y1 + style->borderWidth.top / 2;
       shading = (ridge) ? Color::SHADING_LIGHT : Color::SHADING_DARK;
-      view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                         points, 4);
       points[0][0] = points[1][0] = x1 + w / 2 + d;
       points[0][1] = y1 + style->borderWidth.top / 2;
       points[1][1] = y2 - style->borderWidth.bottom / 2;
@@ -662,7 +677,8 @@
       points[2][1] = y2 - style->borderWidth.bottom;
       points[3][1] = y1 + style->borderWidth.top;
       shading = (ridge) ? Color::SHADING_DARK : Color::SHADING_LIGHT;
-      view->drawPolygon (style->borderColor.top, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.top, shading, filled, convex,
+                         points, 4);
       break;
    case BORDER_DOUBLE:
       w = (int) rint(style->borderWidth.left / 3.0);
@@ -679,14 +695,16 @@
       points[2][0] = points[3][0] = points[0][0] + w;
       points[2][1] = points[1][1] - w_b;
       points[3][1] = points[0][1] + w_t;
-      view->drawPolygon (style->borderColor.left, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.left, shading, filled, convex,
+                         points, 4);
       points[0][0] = points[1][0] = x1 + w + d;
       points[0][1] = y1 - 1 + style->borderWidth.top - w_t;
       points[1][1] = y2 + 1 - style->borderWidth.bottom + w_b;
       points[2][0] = points[3][0] = points[0][0] + w;
       points[2][1] = y2 + 1 - style->borderWidth.bottom;
       points[3][1] = y1 - 1 + style->borderWidth.top;
-      view->drawPolygon (style->borderColor.left, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.left, shading, filled, convex,
+                         points, 4);
       break;
    }
 }
@@ -696,6 +714,7 @@
 
 {
    int points[4][2], d, w;
+   const bool filled = true, convex = true;
    bool ridge = false, inset = false, dotted = false;
    Color::Shading shading = Color::SHADING_NORMAL;
 
@@ -729,7 +748,8 @@
          points[2][0] = points[3][0] = points[0][0]-style->borderWidth.right;
          points[2][1] = points[1][1] - style->borderWidth.bottom;
          points[3][1] = points[0][1] + style->borderWidth.top;
-         view->drawPolygon (style->borderColor.right, shading, true,points,4);
+         view->drawPolygon (style->borderColor.right, shading, filled, convex,
+                            points,4);
       }
       break;
    case BORDER_RIDGE:
@@ -744,7 +764,8 @@
       points[2][1] = y2 - style->borderWidth.bottom / 2;
       points[3][1] = points[0][1] + style->borderWidth.top / 2;
       shading = (ridge) ? Color::SHADING_DARK : Color::SHADING_LIGHT;
-      view->drawPolygon (style->borderColor.right, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.right, shading, filled, convex,
+                         points, 4);
       points[0][0] = points[1][0] = x1 + 1 - w / 2 - d;
       points[0][1] = y1 + style->borderWidth.top / 2;
       points[1][1] = y2 - style->borderWidth.bottom / 2;
@@ -752,7 +773,8 @@
       points[2][1] = y2 - style->borderWidth.bottom;
       points[3][1] = y1 + style->borderWidth.top;
       shading = (ridge) ? Color::SHADING_LIGHT: Color::SHADING_DARK;
-      view->drawPolygon (style->borderColor.right, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.right, shading, filled, convex,
+                         points, 4);
       break;
    case BORDER_DOUBLE:
       w = (int) rint(style->borderWidth.right / 3.0);
@@ -769,14 +791,16 @@
       points[2][0] = points[3][0] = points[0][0] - w;
       points[2][1] = points[1][1] - w_b;
       points[3][1] = points[0][1] + w_t;
-      view->drawPolygon (style->borderColor.right, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.right, shading, filled, convex,
+                         points, 4);
       points[0][0] = points[1][0] = x1 + 1 - w - d;
       points[0][1] = y1 - 1 + style->borderWidth.top - w_t;
       points[1][1] = y2 + 1 - style->borderWidth.bottom + w_b;
       points[2][0] = points[3][0] = points[0][0] - w;
       points[2][1] = y2 + 1 - style->borderWidth.bottom;
       points[3][1] = y1 - 1 + style->borderWidth.top;
-      view->drawPolygon (style->borderColor.right, shading, true, points, 4);
+      view->drawPolygon (style->borderColor.right, shading, filled, convex,
+                         points, 4);
       break;
    }
 }
--- a/dw/types.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/types.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -140,7 +140,7 @@
 {
    if (points->size()) {
       int i;
-      const bool filled = false;
+      const bool filled = false, convex = false;
       int (*pointArray)[2] =
                      (int (*)[2]) malloc(points->size() * sizeof(*pointArray));
 
@@ -149,7 +149,7 @@
          pointArray[i][1] = y + points->getRef(i)->y;
       }
       view->drawPolygon(style->color, core::style::Color::SHADING_NORMAL,
-                        filled, pointArray, i);
+                        filled, convex, pointArray, i);
       free(pointArray);
    }
 }
--- a/dw/ui.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/ui.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -421,12 +421,10 @@
 {
 public:
    virtual void addItem (const char *str, bool enabled, bool selected) = 0;
-
    virtual void pushGroup (const char *name, bool enabled) = 0;
    virtual void popGroup () = 0;
 
    virtual int getNumberOfItems () = 0;
-   virtual const char *getItem (int index) = 0;
    virtual bool isSelected (int index) = 0;
 };
 
--- a/dw/view.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/dw/view.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -179,7 +179,8 @@
                                int angle1, int angle2) = 0;
    virtual void drawPolygon    (style::Color *color,
                                 style::Color::Shading shading,
-                                bool filled, int points[][2], int npoints) = 0;
+                                bool filled, bool convex, int points[][2],
+                                int npoints) = 0;
    virtual void drawText       (style::Font *font,
                                 style::Color *color,
                                 style::Color::Shading shading,
--- a/src/IO/iowatch.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/IO/iowatch.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -11,19 +11,17 @@
 
 // Simple ADT for watching file descriptor activity
 
-#include <fltk/run.h>
+#include <FL/Fl.H>
 #include "iowatch.hh"
 
-using namespace fltk;
-
-
 //
 // Hook a Callback for a certain activities in a FD
 //
-void a_IOwatch_add_fd(int fd, int when, FileHandler Callback, void *usr_data=0)
+void a_IOwatch_add_fd(int fd, int when, Fl_FD_Handler Callback,
+                      void *usr_data = 0)
 {
    if (fd >= 0)
-      add_fd(fd, when, Callback, usr_data);
+      Fl::add_fd(fd, when, Callback, usr_data);
 }
 
 //
@@ -32,6 +30,6 @@
 void a_IOwatch_remove_fd(int fd, int when)
 {
    if (fd >= 0)
-      remove_fd(fd, when);
+      Fl::remove_fd(fd, when);
 }
 
--- a/src/Makefile.am	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/Makefile.am	Fri Feb 25 08:37:13 2011 +0000
@@ -18,7 +18,8 @@
 	$(top_builddir)/dw/libDw-fltk.a \
 	$(top_builddir)/dw/libDw-core.a \
 	$(top_builddir)/lout/liblout.a \
-	@LIBJPEG_LIBS@ @LIBPNG_LIBS@ @LIBFLTK_LIBS@ @LIBZ_LIBS@ @LIBICONV_LIBS@
+	@LIBJPEG_LIBS@ @LIBPNG_LIBS@ @LIBFLTK_LIBS@ @LIBZ_LIBS@ \
+	@LIBICONV_LIBS@ @LIBPTHREAD_LIBS@
 
 dillo_SOURCES = \
 	dillo.cc \
--- a/src/dialog.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/dialog.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -13,50 +13,38 @@
 
 #include <math.h> // for rint()
 
-#include <fltk/Window.h>
-#include <fltk/ask.h>
-#include <fltk/file_chooser.h>
-#include <fltk/TextBuffer.h>
-#include <fltk/ReturnButton.h>
-#include <fltk/TextDisplay.h>
-#include <fltk/HighlightButton.h>
-#include <fltk/WordwrapOutput.h>
-#include <fltk/Input.h>
-#include <fltk/SecretInput.h>
+#include <FL/Fl_Window.H>
+#include <FL/fl_ask.H>
+#include <FL/Fl_File_Chooser.H>
+#include <FL/Fl_Return_Button.H>
+#include <FL/Fl_Text_Display.H>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Output.H>
+#include <FL/Fl_Input.H>
+#include <FL/Fl_Secret_Input.H>
 
 #include "msg.h"
 #include "dialog.hh"
 #include "misc.h"
 #include "prefs.h"
 
-using namespace fltk;
-
-/*
- * Close dialog window.
- */
-static void window_close_cb(Widget *, void *vwin)
-{
-   delete (Window*)vwin;
-}
-
 /*
  * Display a message in a popup window.
  */
 void a_Dialog_msg(const char *msg)
 {
-   message("%s", msg);
+   fl_message("%s", msg);
 }
 
 /*
  * Offer a three choice dialog.
- * The option string that begins with "*" is the default.
  *
- * Return: 0, 1 or 2 (esc = 2, window close = 2)
+ * Return: 0, 1 or 2 (esc = 0, window close = 0, enter = 1)
  */
 int a_Dialog_choice3(const char *msg,
                      const char *b0, const char *b1, const char *b2)
 {
-   return choice(msg, b0, b1, b2);
+   return fl_choice(msg, b0, b1, b2);
 }
 
 /*
@@ -64,7 +52,7 @@
  */
 const char *a_Dialog_input(const char *msg)
 {
-   return input("%s", "", msg);
+   return fl_input("%s", "", msg);
 }
 
 /*
@@ -72,7 +60,7 @@
  */
 const char *a_Dialog_passwd(const char *msg)
 {
-   return password("%s", "", msg);
+   return fl_password("%s", "", msg);
 }
 
 /*
@@ -83,7 +71,7 @@
 const char *a_Dialog_save_file(const char *msg,
                                const char *pattern, const char *fname)
 {
-   return file_chooser(msg, pattern, fname);
+   return fl_file_chooser(msg, pattern, fname);
 }
 
 /*
@@ -111,13 +99,21 @@
                          const char *pattern, const char *fname)
 {
    const char *fc_name;
+
+   fc_name = fl_file_chooser(msg, pattern, fname);
+   return (fc_name) ? a_Misc_escape_chars(fc_name, "% ") : NULL;
+}
+
 /*
-   static int icons_loaded = 0;
-   if (!icons_loaded)
-      FileIcon::load_system_icons();
-*/
-   fc_name = file_chooser(msg, pattern, fname);
-   return (fc_name) ? a_Misc_escape_chars(fc_name, "% ") : NULL;
+ * Close text window.
+ */
+static void text_window_close_cb(Fl_Widget *, void *vtd)
+{
+   Fl_Text_Display *td = (Fl_Text_Display *)vtd;
+   Fl_Text_Buffer *buf = td->buffer();
+
+   delete (Fl_Window*)td->window();
+   delete buf;
 }
 
 /*
@@ -125,52 +121,54 @@
  */
 void a_Dialog_text_window(const char *txt, const char *title)
 {
-   //int wh = 600, ww = 650, bh = 30;
    int wh = prefs.height, ww = prefs.width, bh = 30;
-   int lines, line_num_width;
-   Font *textfont = font(prefs.font_monospace, 0);
+// Font *textfont = font(prefs.font_monospace, 0);
 
-   Window *window = new Window(ww, wh, title ? title : "Untitled");
-   window->callback(window_close_cb, window);
-   window->begin();
+   Fl_Window *window = new Fl_Window(ww, wh, title ? title : "Dillo text");
+   Fl_Group::current(0);
 
-    TextDisplay *td = new TextDisplay(0,0,ww, wh-bh);
-    td->buffer()->text(txt);
 
+    Fl_Text_Buffer *buf = new Fl_Text_Buffer();
+    buf->text(txt);
+    Fl_Text_Display *td = new Fl_Text_Display(0,0,ww, wh-bh);
+    td->buffer(buf);
+
+#if 0
+PORT1.3
     if (textfont)
        td->textfont(textfont);
     td->textsize((int) rint(13.0 * prefs.font_factor));
     fltk::setfont(td->textfont(), td->textsize());
-
-    lines = td->total_lines();
-    line_num_width = 2;
-    while (lines /= 10)
-       ++line_num_width;
-    line_num_width = (int)(line_num_width * fltk::getwidth("0"));
-    td->linenumber_width(line_num_width);
+#else
+    td->textfont(FL_COURIER);
+    td->textsize((int) rint(13.0 * prefs.font_factor));
+#endif
 
     /* enable wrapping lines; text uses entire width of window */
     td->wrap_mode(true, false);
-    /* WORKAROUND: FLTK may not display all the lines without this */
-    td->resize(ww+1,wh-bh);
+   window->add(td);
 
-    ReturnButton *b = new ReturnButton (0, wh-bh, ww, bh, "Close");
-    b->callback(window_close_cb, window);
+    Fl_Return_Button *b = new Fl_Return_Button (0, wh-bh, ww, bh, "Close");
+    b->callback(text_window_close_cb, td);
+   window->add(b);
 
+   window->callback(text_window_close_cb, td);
    window->resizable(td);
-   window->end();
    window->show();
 }
 
 /*--------------------------------------------------------------------------*/
 static int choice5_answer;
 
-static void choice5_cb(Widget *button, void *number)
+#if 0
+PORT1.3
+static void choice5_cb(Fl_Widget *button, void *number)
 {
   choice5_answer = VOIDP2INT(number);
   _MSG("choice5_cb: %d\n", choice5_answer);
   button->window()->make_exec_return(true);
 }
+#endif
 
 /*
  * Make a question-dialog with a question and some alternatives.
@@ -180,6 +178,8 @@
                      const char *alt1, const char *alt2, const char *alt3,
                      const char *alt4, const char *alt5)
 {
+#if 0
+PORT1.3
    choice5_answer = 0;
 
    int ww = 440, wh = 150, bw = 50, bh = 45, nb = 0;
@@ -190,25 +190,25 @@
    txt[4] = alt4; txt[5] = alt5;
    for (int i=1; txt[i]; ++i, ++nb) ;
 
-   Window *window = new Window(ww,wh,"Choice5");
+   Fl_Window *window = new Fl_Window(ww,wh,"Choice5");
    window->begin();
-    Group* ib = new Group(0,0,window->w(),window->h());
+    Fl_Group* ib = new Fl_Group(0,0,window->w(),window->h());
     ib->begin();
     window->resizable(ib);
 
-    Widget *box = new Widget(0,0,ww,wh-bh, QuestionTxt);
-    box->box(DOWN_BOX);
-    box->labelfont(HELVETICA_BOLD_ITALIC);
+    Fl_Box *box = new Fl_Box(0,0,ww,wh-bh, QuestionTxt);
+    box->box(FL_DOWN_BOX);
+    box->labelfont(FL_HELVETICA_BOLD_ITALIC);
     box->labelsize(14);
 
-    HighlightButton *b;
+    Fl_Button *b;
     int xpos = 0, gap = 8;
     bw = (ww - gap)/nb - gap;
     xpos += gap;
     for (int i=1; i <= nb; ++i) {
-       b = new HighlightButton(xpos, wh-bh, bw, bh, txt[i]);
-       b->align(ALIGN_WRAP|ALIGN_CLIP);
-       b->box(UP_BOX);
+       b = new Fl_Button(xpos, wh-bh, bw, bh, txt[i]);
+       b->align(FL_ALIGN_WRAP|FL_ALIGN_CLIP);
+       b->box(FL_UP_BOX);
        b->callback(choice5_cb, INT2VOIDP(i));
        xpos += bw + gap;
     }
@@ -220,6 +220,9 @@
    _MSG("Choice5 answer = %d\n", choice5_answer);
 
    return choice5_answer;
+#else
+return 1 + fl_choice(QuestionTxt, alt1, alt2, alt3);
+#endif
 }
 
 
@@ -227,11 +230,14 @@
 /*
  * ret: 0 = Cancel, 1 = OK
  */
-static void Dialog_user_password_cb(Widget *button, void *vIntPtr)
+static void Dialog_user_password_cb(Fl_Widget *button, void *vIntPtr)
 {
+#if 0
+PORT1.3
    int ret = VOIDP2INT(vIntPtr);
   _MSG("Dialog_user_password_cb: %d\n", ret);
   button->window()->make_exec_return(ret);
+#endif
 }
 
 /*
@@ -241,43 +247,45 @@
  */
 int a_Dialog_user_password(const char *message, UserPasswordCB cb, void *vp)
 {
-   int ok,
+   int ok = 0,
       window_w = 300, window_h = 280,
       input_x = 80, input_w = 200, input_h = 30,
       button_y = 230, button_h = 30;
 
-   Window *window =
-      new Window(window_w,window_h,"User/Password");
+   Fl_Window *window =
+      new Fl_Window(window_w,window_h,"User/Password");
    window->begin();
 
    /* message */
-   WordwrapOutput *message_output =
-      new WordwrapOutput(20,20,window_w-40,100);
-   message_output->box(DOWN_BOX);
-   message_output->text(message);
-   message_output->textfont(HELVETICA_BOLD_ITALIC);
+   Fl_Output *message_output =
+      new Fl_Output(20,20,window_w-40,100);
+   /* BUG type() not tested */
+   message_output->type(FL_NORMAL_OUTPUT | FL_INPUT_WRAP);
+   message_output->box(FL_DOWN_BOX);
+   message_output->value(message);
+   message_output->textfont(FL_HELVETICA_BOLD_ITALIC);
    message_output->textsize(14);
 
    /* inputs */
-   Input *user_input =
-      new Input(input_x,140,input_w,input_h,"User");
+   Fl_Input *user_input =
+      new Fl_Input(input_x,140,input_w,input_h,"User");
    user_input->labelsize(14);
    user_input->textsize(14);
-   SecretInput *password_input =
-      new SecretInput(input_x,180,input_w,input_h,"Password");
+   Fl_Secret_Input *password_input =
+      new Fl_Secret_Input(input_x,180,input_w,input_h,"Password");
    password_input->labelsize(14);
    password_input->textsize(14);
 
    /* "OK" button */
-   Button *ok_button =
-      new Button(200,button_y,50,button_h,"OK");
+   Fl_Button *ok_button =
+      new Fl_Button(200,button_y,50,button_h,"OK");
    ok_button->labelsize(14);
    ok_button->callback(Dialog_user_password_cb);
    ok_button->user_data(INT2VOIDP(1));
 
    /* "Cancel" button */
-   Button *cancel_button =
-      new Button(50,button_y,100,button_h,"Cancel");
+   Fl_Button *cancel_button =
+      new Fl_Button(50,button_y,100,button_h,"Cancel");
    cancel_button->labelsize(14);
    cancel_button->callback(Dialog_user_password_cb);
    cancel_button->user_data(INT2VOIDP(0));
@@ -285,7 +293,8 @@
    window->end();
    window->size_range(window_w,window_h,window_w,window_h);
    window->resizable(window);
-
+#if 0
+PORT1.3
    if ((ok = window->exec())) {
       /* call the callback */
       const char *user, *password;
@@ -294,7 +303,7 @@
       _MSG("a_Dialog_user_passwd: ok = %d\n", ok);
       (*cb)(user, password, vp);
    }
-
+#endif
    delete window;
 
    return ok;
--- a/src/dillo.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/dillo.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -24,10 +24,9 @@
 #include <signal.h>
 #include <locale.h>
 
-#include <fltk/Window.h>
-#include <fltk/TabGroup.h>
-#include <fltk/Font.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+#include <FL/fl_draw.H>
 
 #include "msg.h"
 #include "paths.hh"
@@ -170,6 +169,26 @@
    return opt_id;
 }
 
+static void custLabelDraw(const Fl_Label* o, int X, int Y, int W, int H,
+                          Fl_Align align)
+{
+   const int interpret_symbols = 0;
+
+   fl_font(o->font, o->size);
+   fl_color((Fl_Color)o->color);
+   fl_draw(o->value, X, Y, W, H, align, o->image, interpret_symbols);
+}
+
+static void custLabelMeasure(const Fl_Label* o, int& W, int& H)
+{
+   const int interpret_symbols = 0;
+
+   fl_font(o->font, o->size);
+   fl_measure(o->value, W, H, interpret_symbols);
+}
+
+#if 0
+PORT1.3
 /*
  * Tell the user if default/pref fonts can't be found.
  */
@@ -187,7 +206,7 @@
    checkFont(prefs.font_cursive, "cursive");
    checkFont(prefs.font_fantasy, "fantasy");
 }
-
+#endif
 /*
  * Given a command line argument, build a DilloUrl for it.
  */
@@ -318,11 +337,13 @@
    }
 
    // Sets WM_CLASS hint on X11
-   fltk::Window::xclass("dillo");
+   Fl_Window::default_xclass("dillo");
 
-   // WORKAROUND: sometimes the default pager triggers redraw storms
-   fltk::TabGroup::default_pager(fltk::PAGER_SHRINK);
+   // Disable '@' interpretation in labels
+   Fl::set_labeltype(FL_NORMAL_LABEL, custLabelDraw, custLabelMeasure);
 
+#if 0
+PORT1.3
    checkPreferredFonts();
    /* use preferred font for UI */
    fltk::Font *dfont = fltk::font(prefs.font_sans_serif, 0);
@@ -330,10 +351,16 @@
       fltk::Widget::default_style->textfont(dfont);
       fltk::Widget::default_style->labelfont(dfont);
    }
-
+#endif
    // Create a new UI/bw pair
    BrowserWindow *bw = a_UIcmd_browser_window_new(0, 0, xid, NULL);
 
+   /* We need this so that fl_text_extents() in dw/fltkplatform.cc can
+    * work when FLTK is configured without XFT and Dillo is opening
+    * immediately-available URLs from the cmdline (e.g. about:splash).
+    */
+   ((Fl_Widget *)bw->ui)->window()->make_current();
+
    /* Proxy authentication */
    if (prefs.http_proxyuser && !a_Http_proxy_auth()) {
       const char *passwd = a_UIcmd_get_passwd(prefs.http_proxyuser);
@@ -369,7 +396,7 @@
       }
    }
 
-   fltk::run();
+   Fl::run();
 
    /*
     * Memory deallocating routines
--- a/src/dns.h	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/dns.h	Fri Feb 25 08:37:13 2011 +0000
@@ -8,7 +8,7 @@
 #endif /* __cplusplus */
 
 
-typedef void (*DnsCallback_t)(int Status, Dlist *addr_list, void *data);
+typedef void (*DnsCallback_t)(int status, Dlist *addr_list, void *data);
 
 void a_Dns_init (void);
 void a_Dns_freeall(void);
--- a/src/findbar.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/findbar.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -9,8 +9,8 @@
  * (at your option) any later version.
  */
 
-#include <fltk/events.h>
-#include <fltk/Window.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 #include "findbar.hh"
 
 #include "msg.h"
@@ -18,49 +18,47 @@
 #include "uicmd.hh"
 #include "bw.h"
 
-using namespace fltk;
-
 /*
  * Local sub class
  * (Used to handle escape in the findbar, may also avoid some shortcuts).
  */
-class MyInput : public Input {
+class MyInput : public Fl_Input {
 public:
    MyInput (int x, int y, int w, int h, const char* l=0) :
-      Input(x,y,w,h,l) {};
+      Fl_Input(x,y,w,h,l) {};
    int handle(int e);
 };
 
 int MyInput::handle(int e)
 {
    _MSG("findbar MyInput::handle()\n");
-   int ret = 1, k = event_key();
-   unsigned modifier = event_state() & (SHIFT | CTRL | ALT | META);
+   int ret = 1, k = Fl::event_key();
+   unsigned modifier = Fl::event_state() & (FL_SHIFT| FL_CTRL| FL_ALT|FL_META);
 
-   if (e == KEY) {
-      if (k == LeftKey || k == RightKey) {
-         if (modifier == SHIFT) {
+   if (e == FL_KEYBOARD) {
+      if (k == FL_Left || k == FL_Right) {
+         if (modifier == FL_SHIFT) {
             a_UIcmd_send_event_to_tabs_by_wid(e, this);
             return 1;
          }
-      } else if (k == EscapeKey && modifier == 0) {
+      } else if (k == FL_Escape && modifier == 0) {
          // Avoid clearing the text with Esc, just hide the findbar.
          return 0;
       }
    }
 
    if (ret)
-      ret = Input::handle(e);
+      ret = Fl_Input::handle(e);
    return ret;
 };
 
 /*
  * Find next occurrence of input key
  */
-void Findbar::search_cb(Widget *, void *vfb)
+void Findbar::search_cb(Fl_Widget *, void *vfb)
 {
    Findbar *fb = (Findbar *)vfb;
-   const char *key = fb->i->text();
+   const char *key = fb->i->value();
    bool case_sens = fb->check_btn->value();
 
    if (key[0] != '\0')
@@ -71,10 +69,10 @@
 /*
  * Find previous occurrence of input key
  */
-void Findbar::searchBackwards_cb(Widget *, void *vfb)
+void Findbar::searchBackwards_cb(Fl_Widget *, void *vfb)
 {
    Findbar *fb = (Findbar *)vfb;
-   const char *key = fb->i->text();
+   const char *key = fb->i->value();
    bool case_sens = fb->check_btn->value();
 
    if (key[0] != '\0') {
@@ -84,22 +82,9 @@
 }
 
 /*
- * Find next occurrence of input key
- */
-void Findbar::search_cb2(Widget *widget, void *vfb)
-{
-   /*
-    * Somehow fltk even regards the first loss of focus for the
-    * window as a WHEN_ENTER_KEY_ALWAYS event.
-    */
-   if (event_key() == ReturnKey)
-      search_cb(widget, vfb);
-}
-
-/*
  * Hide the search bar
  */
-void Findbar::hide_cb(Widget *, void *vfb)
+void Findbar::hide_cb(Fl_Widget *, void *vfb)
 {
    ((Findbar *)vfb)->hide();
 }
@@ -108,54 +93,55 @@
  * Construct text search bar
  */
 Findbar::Findbar(int width, int height) :
-   Group(0, 0, width, height)
+   Fl_Group(0, 0, width, height)
 {
    int button_width = 70;
    int gap = 2;
    int border = 2;
    int input_width = width - (2 * border + 4 * (button_width + gap));
    int x = border;
+
+   Fl_Group::current(0);
+
    height -= 2 * border;
 
-   box(PLASTIC_UP_BOX);
-   Group::hide();
+   box(FL_PLASTIC_UP_BOX);
+   Fl_Group::hide();
 
-   begin();
-    hide_btn = new HighlightButton(x, border, 16, height, 0);
-    hideImg = new xpmImage(new_s_xpm);
+    hide_btn = new Fl_Button(x, border, 16, height, 0);
+    hideImg = new Fl_Pixmap(new_s_xpm);
     hide_btn->image(hideImg);
     x += 16 + gap;
     hide_btn->callback(hide_cb, this);
-    hide_btn->clear_tab_to_focus();
+    hide_btn->clear_visible_focus();
+   add(hide_btn);
 
     i = new MyInput(x, border, input_width, height);
     x += input_width + gap;
     resizable(i);
     i->color(206);
-    i->when(WHEN_ENTER_KEY_ALWAYS);
-    i->callback(search_cb2, this);
-    i->clear_tab_to_focus();
-    i->set_click_to_focus();
-
-    next_btn = new HighlightButton(x, border, button_width, height, "Next");
-    x += button_width + gap;
-    next_btn->add_shortcut(ReturnKey);
-    next_btn->add_shortcut(KeypadEnter);
-    next_btn->callback(search_cb, this);
-    next_btn->clear_tab_to_focus();
+    i->when(FL_WHEN_NEVER);
+   add(i);
 
-    prev_btn= new HighlightButton(x, border, button_width, height, "Previous");
-    prev_btn->add_shortcut(SHIFT+ReturnKey);
-    prev_btn->callback(searchBackwards_cb, this);
-    prev_btn->clear_tab_to_focus();
+    next_btn = new Fl_Button(x, border, button_width, height, "Next");
     x += button_width + gap;
+    next_btn->shortcut(FL_Enter);
+    next_btn->callback(search_cb, this);
+    next_btn->clear_visible_focus();
+   add(next_btn);
 
-    check_btn = new CheckButton(x, border, 2*button_width, height,
+    prev_btn= new Fl_Button(x, border, button_width, height, "Previous");
+    x += button_width + gap;
+    prev_btn->shortcut(FL_SHIFT+FL_Enter);
+    prev_btn->callback(searchBackwards_cb, this);
+    prev_btn->clear_visible_focus();
+   add(prev_btn);
+
+    check_btn = new Fl_Check_Button(x, border, 2*button_width, height,
                               "Case-sensitive");
-    check_btn->clear_tab_to_focus();
     x += 2 * button_width + gap;
-
-   end();
+    check_btn->clear_visible_focus();
+   add(check_btn);
 
    if (prefs.show_tooltip) {
       hide_btn->tooltip("Hide");
@@ -172,21 +158,21 @@
 }
 
 /*
- * Handle events. Used to catch EscapeKey events.
+ * Handle events. Used to catch FL_Escape events.
  */
 int Findbar::handle(int event)
 {
    int ret = 0;
-   int k = event_key();
-   unsigned modifier = event_state() & (SHIFT | CTRL | ALT | META);
+   int k = Fl::event_key();
+   unsigned modifier = Fl::event_state() & (FL_SHIFT| FL_CTRL| FL_ALT|FL_META);
 
-   if (event == KEY && modifier == 0 && k == EscapeKey) {
+   if (event == FL_KEYBOARD && modifier == 0 && k == FL_Escape) {
       hide();
       ret = 1;
    }
 
    if (ret == 0)
-      ret = Group::handle(event);
+      ret = Fl_Group::handle(event);
 
    return ret;
 }
@@ -196,7 +182,7 @@
  */
 void Findbar::show()
 {
-   Group::show();
+   Fl_Group::show();
    /* select text even if already focused */
    i->take_focus();
    i->position(i->size(), 0);
@@ -209,7 +195,7 @@
 {
    BrowserWindow *bw;
 
-   Group::hide();
+   Fl_Group::hide();
    if ((bw = a_UIcmd_get_bw_by_widget(this)))
       a_UIcmd_findtext_reset(bw);
    a_UIcmd_focus_main_area(bw);
--- a/src/findbar.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/findbar.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -1,28 +1,26 @@
 #ifndef __FINDBAR_HH__
 #define __FINDBAR_HH__
 
-#include <fltk/xpmImage.h>
-#include <fltk/Widget.h>
-#include <fltk/HighlightButton.h>
-#include <fltk/Button.h>
-#include <fltk/Input.h>
-#include <fltk/Group.h>
-#include <fltk/CheckButton.h>
+#include <FL/Fl_Pixmap.H>
+#include <FL/Fl_Widget.H>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Input.H>
+#include <FL/Fl_Group.H>
+#include <FL/Fl_Check_Button.H>
 
 /*
  * Searchbar to find text in page.
  */
-class Findbar : public fltk::Group {
-   fltk::Button *clrb;
-   fltk::HighlightButton *hide_btn, *next_btn, *prev_btn;
-   fltk::CheckButton *check_btn;
-   fltk::xpmImage *hideImg;
-   fltk::Input *i;
+class Findbar : public Fl_Group {
+   Fl_Button *clrb;
+   Fl_Button *hide_btn, *next_btn, *prev_btn;
+   Fl_Check_Button *check_btn;
+   Fl_Pixmap *hideImg;
+   Fl_Input *i;
 
-   static void search_cb (fltk::Widget *, void *);
-   static void searchBackwards_cb (fltk::Widget *, void *);
-   static void search_cb2 (fltk::Widget *, void *);
-   static void hide_cb (fltk::Widget *, void *);
+   static void search_cb (Fl_Widget *, void *);
+   static void searchBackwards_cb (Fl_Widget *, void *);
+   static void hide_cb (Fl_Widget *, void *);
 
 public:
    Findbar(int width, int height);
--- a/src/keys.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/keys.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -9,7 +9,7 @@
  * (at your option) any later version.
  */
 
-#include <fltk/events.h>
+#include <FL/Fl.H>
 #include <stdio.h>
 #include <stdlib.h>        /* strtol */
 #include <string.h>
@@ -38,80 +38,80 @@
  *  Local data
  */
 static const Mapping_t keyNames[] = {
-   { "Backspace",   fltk::BackSpaceKey },
-   { "Delete",      fltk::DeleteKey    },
-   { "Down",        fltk::DownKey      },
-   { "End",         fltk::EndKey       },
-   { "Esc",         fltk::EscapeKey    },
-   { "F1",          fltk::F1Key        },
-   { "F2",          fltk::F2Key        },
-   { "F3",          fltk::F3Key        },
-   { "F4",          fltk::F4Key        },
-   { "F5",          fltk::F5Key        },
-   { "F6",          fltk::F6Key        },
-   { "F7",          fltk::F7Key        },
-   { "F8",          fltk::F8Key        },
-   { "F9",          fltk::F9Key        },
-   { "F10",         fltk::F10Key       },
-   { "F11",         fltk::F11Key       },
-   { "F12",         fltk::F12Key       },
-   { "Home",        fltk::HomeKey      },
-   { "Insert",      fltk::InsertKey    },
-   { "Left",        fltk::LeftKey      },
-   { "PageDown",    fltk::PageDownKey  },
-   { "PageUp",      fltk::PageUpKey    },
-   { "Print",       fltk::PrintKey     },
-   { "Return",      fltk::ReturnKey    },
-   { "Right",       fltk::RightKey     },
-   { "Space",       fltk::SpaceKey     },
-   { "Tab",         fltk::TabKey       },
-   { "Up",          fltk::UpKey        }
+   { "Backspace",   FL_BackSpace },
+   { "Delete",      FL_Delete    },
+   { "Down",        FL_Down      },
+   { "End",         FL_End       },
+   { "Esc",         FL_Escape    },
+   { "F1",          FL_F + 1     },
+   { "F2",          FL_F + 2     },
+   { "F3",          FL_F + 3     },
+   { "F4",          FL_F + 4     },
+   { "F5",          FL_F + 5     },
+   { "F6",          FL_F + 6     },
+   { "F7",          FL_F + 7     },
+   { "F8",          FL_F + 8     },
+   { "F9",          FL_F + 9     },
+   { "F10",         FL_F + 10    },
+   { "F11",         FL_F + 11    },
+   { "F12",         FL_F + 12    },
+   { "Home",        FL_Home      },
+   { "Insert",      FL_Insert    },
+   { "Left",        FL_Left      },
+   { "PageDown",    FL_Page_Down },
+   { "PageUp",      FL_Page_Up   },
+   { "Print",       FL_Print     },
+   { "Return",      FL_Enter     },
+   { "Right",       FL_Right     },
+   { "Space",       ' '          },
+   { "Tab",         FL_Tab       },
+   { "Up",          FL_Up        }
 };
 
 static const Mapping_t modifierNames[] = {
-   { "Shift",   fltk::SHIFT   },
-   { "Ctrl",    fltk::CTRL    },
-   { "Alt",     fltk::ALT     },
-   { "Meta",    fltk::META    },
-   { "Button1", fltk::BUTTON1 },
-   { "Button2", fltk::BUTTON2 },
-   { "Button3", fltk::BUTTON3 }
+   { "Shift",   FL_SHIFT   },
+   { "Ctrl",    FL_CTRL    },
+   { "Alt",     FL_ALT     },
+   { "Meta",    FL_META    },
+   { "Button1", FL_BUTTON1 },
+   { "Button2", FL_BUTTON2 },
+   { "Button3", FL_BUTTON3 }
 };
 
 static const KeyBinding_t default_keys[] = {
-   { "nop"          , KEYS_NOP          , 0            , 0                  },
-   { "open"         , KEYS_OPEN         , fltk::CTRL   , 'o'                },
-   { "new-window"   , KEYS_NEW_WINDOW   , fltk::CTRL   , 'n'                },
-   { "new-tab"      , KEYS_NEW_TAB      , fltk::CTRL   , 't'                },
-   { "left-tab"     , KEYS_LEFT_TAB     , fltk::SHIFT  , fltk::TabKey       },
-   { "right-tab"    , KEYS_RIGHT_TAB    , fltk::CTRL   , fltk::TabKey       },
-   { "close-tab"    , KEYS_CLOSE_TAB    , fltk::CTRL   , 'q'                },
-   { "find"         , KEYS_FIND         , fltk::CTRL   , 'f'                },
-   { "websearch"    , KEYS_WEBSEARCH    , fltk::CTRL   , 's'                },
-   { "bookmarks"    , KEYS_BOOKMARKS    , fltk::CTRL   , 'b'                },
-   { "fullscreen"   , KEYS_FULLSCREEN   , fltk::CTRL   , fltk::SpaceKey     },
-   { "reload"       , KEYS_RELOAD       , fltk::CTRL   , 'r'                },
-   { "stop"         , KEYS_STOP         , 0            , 0                  },
-   { "save"         , KEYS_SAVE         , 0            , 0                  },
-   { "hide-panels"  , KEYS_HIDE_PANELS  , 0            , fltk::EscapeKey    },
-   { "file-menu"    , KEYS_FILE_MENU    , fltk::ALT    , 'f'                },
-   { "close-all"    , KEYS_CLOSE_ALL    , fltk::ALT    , 'q'                },
-   { "back"         , KEYS_BACK         , 0            , fltk::BackSpaceKey },
-   { "back"         , KEYS_BACK         , 0            , ','                },
-   { "forward"      , KEYS_FORWARD      , fltk::SHIFT  , fltk::BackSpaceKey },
-   { "forward"      , KEYS_FORWARD      , 0            , '.'                },
-   { "goto"         , KEYS_GOTO         , fltk::CTRL   , 'l'                },
-   { "home"         , KEYS_HOME         , fltk::CTRL   , 'h'                },
-   { "screen-up"    , KEYS_SCREEN_UP    , 0            , fltk::PageUpKey    },
-   { "screen-up"    , KEYS_SCREEN_UP    , 0            , 'b'                },
-   { "screen-down"  , KEYS_SCREEN_DOWN  , 0            , fltk::PageDownKey  },
-   { "screen-down"  , KEYS_SCREEN_DOWN  , 0            , fltk::SpaceKey     },
-   { "line-up"      , KEYS_LINE_UP      , 0            , fltk::UpKey        },
-   { "line-down"    , KEYS_LINE_DOWN    , 0            , fltk::DownKey      },
-   { "left"         , KEYS_LEFT         , 0            , fltk::LeftKey      },
-   { "right"        , KEYS_RIGHT        , 0            , fltk::RightKey     },
-   { "top"          , KEYS_TOP          , 0            , fltk::HomeKey      },
-   { "bottom"       , KEYS_BOTTOM       , 0            , fltk::EndKey       },
+   { "nop"          , KEYS_NOP          , 0         , 0               },
+   { "open"         , KEYS_OPEN         , FL_CTRL   , 'o'             },
+   { "new-window"   , KEYS_NEW_WINDOW   , FL_CTRL   , 'n'             },
+   { "new-tab"      , KEYS_NEW_TAB      , FL_CTRL   , 't'             },
+   { "left-tab"     , KEYS_LEFT_TAB     , FL_SHIFT  , FL_Tab          },
+   { "right-tab"    , KEYS_RIGHT_TAB    , FL_CTRL   , FL_Tab          },
+   { "close-tab"    , KEYS_CLOSE_TAB    , FL_CTRL   , 'q'             },
+   { "find"         , KEYS_FIND         , FL_CTRL   , 'f'             },
+   { "websearch"    , KEYS_WEBSEARCH    , FL_CTRL   , 's'             },
+   { "bookmarks"    , KEYS_BOOKMARKS    , FL_CTRL   , 'b'             },
+   { "fullscreen"   , KEYS_FULLSCREEN   , FL_CTRL   , ' '             },
+   { "reload"       , KEYS_RELOAD       , FL_CTRL   , 'r'             },
+   { "stop"         , KEYS_STOP         , 0         , 0               },
+   { "save"         , KEYS_SAVE         , 0         , 0               },
+   { "hide-panels"  , KEYS_HIDE_PANELS  , 0         , FL_Escape       },
+   { "file-menu"    , KEYS_FILE_MENU    , FL_ALT    , 'f'             },
+   { "close-all"    , KEYS_CLOSE_ALL    , FL_ALT    , 'q'             },
+   { "back"         , KEYS_BACK         , 0         , FL_BackSpace    },
+   { "back"         , KEYS_BACK         , 0         , ','             },
+   { "forward"      , KEYS_FORWARD      , FL_SHIFT  , FL_BackSpace    },
+   { "forward"      , KEYS_FORWARD      , 0         , '.'             },
+   { "goto"         , KEYS_GOTO         , FL_CTRL   , 'l'             },
+   { "home"         , KEYS_HOME         , FL_CTRL   , 'h'             },
+   { "screen-up"    , KEYS_SCREEN_UP    , 0         , FL_Page_Up      },
+   { "screen-up"    , KEYS_SCREEN_UP    , 0         , 'b'             },
+   { "screen-down"  , KEYS_SCREEN_DOWN  , 0         , FL_Page_Down    },
+   { "screen-down"  , KEYS_SCREEN_DOWN  , 0         , ' '             },
+   { "line-up"      , KEYS_LINE_UP      , 0         , FL_Up           },
+   { "line-down"    , KEYS_LINE_DOWN    , 0         , FL_Down         },
+   { "left"         , KEYS_LEFT         , 0         , FL_Left         },
+   { "right"        , KEYS_RIGHT        , 0         , FL_Right        },
+   { "top"          , KEYS_TOP          , 0         , FL_Home         },
+   { "bottom"       , KEYS_BOTTOM       , 0         , FL_End          },
 };
 
 static Dlist *bindings;
@@ -173,16 +173,16 @@
    KeysCommand_t ret = KEYS_NOP;
    KeyBinding_t keyNode;
    // We're only interested in some flags
-   keyNode.modifier = fltk::event_state() &
-     (fltk::SHIFT | fltk::CTRL | fltk::ALT | fltk::META);
+   keyNode.modifier = Fl::event_state() &
+     (FL_SHIFT | FL_CTRL | FL_ALT | FL_META);
 
-   if (keyNode.modifier == fltk::SHIFT &&
-       ispunct(fltk::event_text()[0])) {
+   if (keyNode.modifier == FL_SHIFT &&
+       ispunct(Fl::event_text()[0])) {
       // Get key code for a shifted character
-      keyNode.key = fltk::event_text()[0];
+      keyNode.key = Fl::event_text()[0];
       keyNode.modifier = 0;
    } else {
-      keyNode.key = fltk::event_key();
+      keyNode.key = Fl::event_key();
    }
 
    _MSG("getKeyCmd: key=%d, mod=%d\n", keyNode.key, keyNode.modifier);
--- a/src/menu.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/menu.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -11,11 +11,8 @@
 
 // Functions/Methods for menus
 
-#include <fltk/events.h>
-#include <fltk/PopupMenu.h>
-#include <fltk/Item.h>
-#include <fltk/ToggleItem.h>
-#include <fltk/Divider.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Menu_Item.H>
 
 #include "lout/misc.hh"    /* SimpleVector */
 #include "msg.h"
@@ -27,8 +24,6 @@
 #include "keys.hh"
 #include "timeout.hh"
 
-using namespace fltk;
-
 /*
  * Local data
  */
@@ -38,6 +33,7 @@
 static DilloUrl *popup_url = NULL;
 // Weak reference to the popup's bw
 static BrowserWindow *popup_bw = NULL;
+static void *popup_form = NULL;
 // Where to place the filemenu popup
 static int popup_x, popup_y;
 // History popup direction (-1 = back, 1 = forward).
@@ -45,19 +41,23 @@
 // History popup, list of URL-indexes.
 static int *history_list = NULL;
 
+#if 0
+My guess is that a modified copy of Fl_Menu_ that handles something similar
+to Fl_Menu_Item may be necessary. I sure hope not, though.
+
 /*
  * Local sub class.
  * Used to add the hint for history popup menus, and to remember
  * the mouse button pressed over a menu item.
  */
-class CustItem : public Item {
+class CustItem : public Fl_Menu_Item {
    int EventButton;
 public:
    CustItem (const char* label) : Item(label) { EventButton = 0; };
    int button () { return EventButton; };
    void draw();
    int handle(int e) {
-      EventButton = event_button();
+      EventButton = Fl::event_button();
       return Item::handle(e);
    }
 };
@@ -75,13 +75,13 @@
    }
    Item::draw();
 }
-
+#endif
 
 //--------------------------------------------------------------------------
 /*
  * Static function for File menu callbacks.
  */
-static void filemenu_cb(Widget *wid, void *data)
+static void filemenu_cb(Fl_Widget *wid, void *data)
 {
    if (strcmp((char*)data, "nw") == 0) {
       UI *ui = (UI*)popup_bw->ui;
@@ -100,13 +100,13 @@
 }
 
 
-static void Menu_copy_urlstr_cb(Widget *)
+static void Menu_copy_urlstr_cb(Fl_Widget*, void*)
 {
    if (popup_url)
       a_UIcmd_copy_urlstr(popup_bw, URL_STR(popup_url));
 }
 
-static void Menu_link_cb(Widget*, void *user_data)
+static void Menu_link_cb(Fl_Widget*, void *user_data)
 {
    DilloUrl *url = (DilloUrl *) user_data ;
    _MSG("Menu_link_cb: click! :-)\n");
@@ -118,7 +118,7 @@
 /*
  * Open URL
  */
-static void Menu_open_url_cb(Widget* )
+static void Menu_open_url_cb(Fl_Widget*, void* )
 {
    _MSG("Open URL cb: click! :-)\n");
    a_UIcmd_open_url(popup_bw, popup_url);
@@ -127,7 +127,7 @@
 /*
  * Open URL in new window
  */
-static void Menu_open_url_nw_cb(Widget* )
+static void Menu_open_url_nw_cb(Fl_Widget*, void* )
 {
    _MSG("Open URL in new window cb: click! :-)\n");
    a_UIcmd_open_url_nw(popup_bw, popup_url);
@@ -136,17 +136,17 @@
 /*
  * Open URL in new Tab
  */
-static void Menu_open_url_nt_cb(Widget* )
+static void Menu_open_url_nt_cb(Fl_Widget*, void* )
 {
    int focus = prefs.focus_new_tab ? 1 : 0;
-   if (event_state(SHIFT)) focus = !focus;
+   if (Fl::event_state(FL_SHIFT)) focus = !focus;
    a_UIcmd_open_url_nt(popup_bw, popup_url, focus);
 }
 
 /*
  * Add bookmark
  */
-static void Menu_add_bookmark_cb(Widget* )
+static void Menu_add_bookmark_cb(Fl_Widget*, void* )
 {
    a_UIcmd_add_bookmark(popup_bw, popup_url);
 }
@@ -154,7 +154,7 @@
 /*
  * Find text
  */
-static void Menu_find_text_cb(Widget* )
+static void Menu_find_text_cb(Fl_Widget*, void* )
 {
    ((UI *)popup_bw->ui)->set_findbar_visibility(1);
 }
@@ -162,7 +162,7 @@
 /*
  * Save link
  */
-static void Menu_save_link_cb(Widget* )
+static void Menu_save_link_cb(Fl_Widget*, void* )
 {
    a_UIcmd_save_link(popup_bw, popup_url);
 }
@@ -170,7 +170,7 @@
 /*
  * Save current page
  */
-static void Menu_save_page_cb(Widget* )
+static void Menu_save_page_cb(Fl_Widget*, void* )
 {
    a_UIcmd_save(popup_bw);
 }
@@ -178,7 +178,7 @@
 /*
  * View current page source
  */
-static void Menu_view_page_source_cb(Widget* )
+static void Menu_view_page_source_cb(Fl_Widget*, void* )
 {
    a_UIcmd_view_page_source(popup_bw, popup_url);
 }
@@ -186,7 +186,7 @@
 /*
  * View current page's bugs
  */
-static void Menu_view_page_bugs_cb(Widget* )
+static void Menu_view_page_bugs_cb(Fl_Widget*, void* )
 {
    a_UIcmd_view_page_bugs(popup_bw);
 }
@@ -194,7 +194,7 @@
 /*
  * Load images on current page that match URL pattern
  */
-static void Menu_load_images_cb(Widget*, void *user_data)
+static void Menu_load_images_cb(Fl_Widget*, void *user_data)
 {
    DilloUrl *page_url = (DilloUrl *) user_data;
    void *doc = a_Bw_get_url_doc(popup_bw, page_url);
@@ -206,39 +206,38 @@
 /*
  * Submit form
  */
-static void Menu_form_submit_cb(Widget*, void *v_form)
+static void Menu_form_submit_cb(Fl_Widget*, void *)
 {
    void *doc = a_Bw_get_url_doc(popup_bw, popup_url);
 
    if (doc)
-      a_Html_form_submit(doc, v_form);
+      a_Html_form_submit(doc, popup_form);
 }
 
 /*
  * Reset form
  */
-static void Menu_form_reset_cb(Widget*, void *v_form)
+static void Menu_form_reset_cb(Fl_Widget*, void *)
 {
    void *doc = a_Bw_get_url_doc(popup_bw, popup_url);
 
    if (doc)
-      a_Html_form_reset(doc, v_form);
+      a_Html_form_reset(doc, popup_form);
 }
 
 /*
  * Toggle display of 'hidden' form controls.
  */
-static void Menu_form_hiddens_cb(Widget *w, void *user_data)
+static void Menu_form_hiddens_cb(Fl_Widget *w, void *user_data)
 {
-   void *v_form = w->parent()->user_data();
    bool visible = *((bool *) user_data);
    void *doc = a_Bw_get_url_doc(popup_bw, popup_url);
 
    if (doc)
-      a_Html_form_display_hiddens(doc, v_form, !visible);
+      a_Html_form_display_hiddens(doc, popup_form, !visible);
 }
 
-static void Menu_stylesheet_cb(Widget *w, void *vUrl)
+static void Menu_stylesheet_cb(Fl_Widget *w, void *vUrl)
 {
    const DilloUrl *url = (const DilloUrl *) vUrl;
    a_UIcmd_open_url(popup_bw, url);
@@ -247,7 +246,7 @@
 /*
  * Validate URL with the W3C
  */
-static void Menu_bugmeter_validate_w3c_cb(Widget* )
+static void Menu_bugmeter_validate_w3c_cb(Fl_Widget*, void* )
 {
    Dstr *dstr = dStr_sized_new(128);
 
@@ -260,7 +259,7 @@
 /*
  * Validate URL with the WDG
  */
-static void Menu_bugmeter_validate_wdg_cb(Widget* )
+static void Menu_bugmeter_validate_wdg_cb(Fl_Widget*, void* )
 {
    Dstr *dstr = dStr_sized_new(128);
 
@@ -274,7 +273,7 @@
 /*
  * Show info page for the bug meter
  */
-static void Menu_bugmeter_about_cb(Widget* )
+static void Menu_bugmeter_about_cb(Fl_Widget*, void* )
 {
    a_UIcmd_open_urlstr(popup_bw, "http://www.dillo.org/help/bug_meter.html");
 }
@@ -283,24 +282,30 @@
  * Navigation History callback.
  * Go to selected URL.
  */
-static void Menu_history_cb(Widget *wid, void *data)
+static void Menu_history_cb(Fl_Widget *wid, void *data)
 {
+#if 0
    int mb = ((CustItem*)wid)->button();
+#endif
    int offset = history_direction * VOIDP2INT(data);
+#if 0
    const DilloUrl *url = a_History_get_url(history_list[VOIDP2INT(data)-1]);
 
    if (mb == 2) {
       // Middle button, open in a new window/tab
       if (prefs.middle_click_opens_new_tab) {
          int focus = prefs.focus_new_tab ? 1 : 0;
-         if (event_state(SHIFT)) focus = !focus;
+         if (Fl::event_state(FL_SHIFT)) focus = !focus;
          a_UIcmd_open_url_nt(popup_bw, url, focus);
       } else {
          a_UIcmd_open_url_nw(popup_bw, url);
       }
    } else {
+#endif
       a_UIcmd_nav_jump(popup_bw, offset, 0);
+#if 0
    }
+#endif
 }
 
 /*
@@ -311,18 +316,10 @@
  */
 static void Menu_popup_cb(void *data)
 {
-   ((PopupMenu *)data)->popup();
-   a_Timeout_remove();
-}
+   const Fl_Menu_Item *m = ((Fl_Menu_Item *)data)->popup(popup_x, popup_y);
 
-/*
- * Same as above but with coordinates.
- */
-static void Menu_popup_cb2(void *data)
-{
-   Menu *m = (Menu *)data;
-   m->value(-1);
-   m->popup(Rectangle(popup_x,popup_y,m->w(),m->h()), m->label());
+   if (m)
+      ((Fl_Widget *)m)->do_callback();
    a_Timeout_remove();
 }
 
@@ -334,65 +331,48 @@
 {
    lout::misc::SimpleVector <DilloUrl*> *cssUrls =
                             (lout::misc::SimpleVector <DilloUrl*> *) v_cssUrls;
-   Item *i;
-   int j;
-   // One menu for every browser window
-   static PopupMenu *pm = 0;
-   // Active/inactive control.
-   static Item *view_page_bugs_item = 0, *view_source_item = 0;
-   static ItemGroup *stylesheets = 0;
+   int j = 0;
 
+   static Fl_Menu_Item *stylesheets = NULL;
+   static Fl_Menu_Item pm[] = {
+      {"View page source", 0, Menu_view_page_source_cb,0,0,0,0,0,0},
+      {"View page bugs", 0, Menu_view_page_bugs_cb,0,0,0,0,0,0},
+      {"View stylesheets", 0, 0, 0,FL_SUBMENU_POINTER|FL_MENU_DIVIDER,0,0,0,0},
+      {"Bookmark this page", 0,Menu_add_bookmark_cb,0,FL_MENU_DIVIDER,0,0,0,0},
+      {"Find text", 0, Menu_find_text_cb,0,0,0,0,0,0},
+      {"Save page as...", 0, Menu_save_page_cb,0,0,0,0,0,0},
+      {0,0,0,0,0,0,0,0,0}
+   };
+
+   popup_x = Fl::event_x();
+   popup_y = Fl::event_y();
    popup_bw = bw;
    a_Url_free(popup_url);
    popup_url = a_Url_dup(url);
 
-   if (!pm) {
-      pm = new PopupMenu(0,0,0,0,"&PAGE OPTIONS");
-      pm->begin();
-       i = view_source_item = new Item("View page Source");
-       i->callback(Menu_view_page_source_cb);
-       i = view_page_bugs_item = new Item("View page Bugs");
-       i->callback(Menu_view_page_bugs_cb);
-       stylesheets = new ItemGroup("View Stylesheets");
-       new Divider();
-       i = new Item("Bookmark this page");
-       i->callback(Menu_add_bookmark_cb);
-       new Divider();
-       i = new Item("Find Text");
-       i->callback(Menu_find_text_cb);
-       //i->shortcut(CTRL+'f');
-       i = new Item("Jump to...");
-       i->deactivate();
-       new Divider();
-       i = new Item("Save page As...");
-       i->callback(Menu_save_page_cb);
-
-      pm->type(PopupMenu::POPUP123);
-      pm->end();
-   }
-
-   if (has_bugs == TRUE)
-      view_page_bugs_item->activate();
-   else
-      view_page_bugs_item->deactivate();
+   has_bugs == TRUE ? pm[1].activate() : pm[1].deactivate();
 
    if (strncmp(URL_STR(url), "dpi:/vsource/", 13) == 0)
-      view_source_item->deactivate();
+      pm[0].deactivate();
    else
-      view_source_item->activate();
+      pm[0].activate();
 
-   int n = stylesheets->children();
-   for (j = 0; j < n; j++) {
-      /* get rid of the old ones */
-      Widget *child = stylesheets->child(0);
-      dFree((char *)child->label());
-      a_Url_free((DilloUrl *)child->user_data());
-      delete child;
+   if (stylesheets) {
+      while (stylesheets[j].text) {
+         dFree((char *) stylesheets[j].label());
+         a_Url_free((DilloUrl *) stylesheets[j].user_data());
+         j++;
+      }
+      delete [] stylesheets;
+      stylesheets = NULL;
    }
 
    if (cssUrls && cssUrls->size () > 0) {
-      stylesheets->activate();
+      stylesheets = new Fl_Menu_Item[cssUrls->size() + 1];
+      memset(stylesheets, '\0', sizeof(Fl_Menu_Item[cssUrls->size() + 1]));
+
       for (j = 0; j < cssUrls->size(); j++) {
+
          /* may want ability to Load individual unloaded stylesheets as well */
          const char *action = "View ";
          DilloUrl *url = cssUrls->get(j);
@@ -411,14 +391,14 @@
             label = dStrconcat(action, url_str, NULL);
          }
 
-         i = new Item(label);
-         i->set_flag(RAW_LABEL);
-         i->user_data(a_Url_dup(url));
-         i->callback(Menu_stylesheet_cb);
-         stylesheets->add(i);
+         stylesheets[j].label(FL_NORMAL_LABEL, label);
+         stylesheets[j].callback(Menu_stylesheet_cb, a_Url_dup(url));
       }
+
+      pm[2].user_data(stylesheets);
+      pm[2].activate();
    } else {
-      stylesheets->deactivate();
+      pm[2].deactivate();
    }
 
    a_Timeout_add(0.0, Menu_popup_cb, (void *)pm);
@@ -429,33 +409,20 @@
  */
 void a_Menu_link_popup(BrowserWindow *bw, const DilloUrl *url)
 {
-   // One menu for every browser window
-   static PopupMenu *pm = 0;
+   static Fl_Menu_Item pm[] = {
+      {"Open link in new window", 0, Menu_open_url_nw_cb,0,0,0,0,0,0},
+      {"Open link in new tab",0,Menu_open_url_nt_cb,0,FL_MENU_DIVIDER,0,0,0,0},
+      {"Bookmark this link", 0, Menu_add_bookmark_cb,0,0,0,0,0,0},
+      {"Copy link location", 0, Menu_copy_urlstr_cb,0,FL_MENU_DIVIDER,0,0,0,0},
+      {"Save link as...", 0, Menu_save_link_cb,0,0,0,0,0,0},
+      {0,0,0,0,0,0,0,0,0}
+   };
 
+   popup_x = Fl::event_x();
+   popup_y = Fl::event_y();
    popup_bw = bw;
    a_Url_free(popup_url);
    popup_url = a_Url_dup(url);
-   if (!pm) {
-      Item *i;
-      pm = new PopupMenu(0,0,0,0,"&LINK OPTIONS");
-      //pm->callback(Menu_link_cb, url);
-      pm->begin();
-       i = new Item("Open Link in New Window");
-       i->callback(Menu_open_url_nw_cb);
-       i = new Item("Open Link in New Tab");
-       i->callback(Menu_open_url_nt_cb);
-       new Divider();
-       i = new Item("Bookmark this Link");
-       i->callback(Menu_add_bookmark_cb);
-       i = new Item("Copy Link location");
-       i->callback(Menu_copy_urlstr_cb);
-       new Divider();
-       i = new Item("Save Link As...");
-       i->callback(Menu_save_link_cb);
-
-      pm->type(PopupMenu::POPUP123);
-      pm->end();
-   }
 
    a_Timeout_add(0.0, Menu_popup_cb, (void *)pm);
 }
@@ -467,14 +434,23 @@
                         bool_t loaded_img, DilloUrl *page_url,
                         DilloUrl *link_url)
 {
-   // One menu for every browser window
-   static PopupMenu *pm = 0;
-   // Active/inactive control.
-   static Item *link_menuitem = 0;
-   static Item *load_img_menuitem = 0;
    static DilloUrl *popup_page_url = NULL;
    static DilloUrl *popup_link_url = NULL;
+   static Fl_Menu_Item pm[] = {
+      {"Isolate image", 0, Menu_open_url_cb,0,0,0,0,0,0},
+      {"Open image in new window", 0, Menu_open_url_nw_cb,0,0,0,0,0,0},
+      {"Open image in new tab", 0, Menu_open_url_nt_cb, 0, FL_MENU_DIVIDER,
+       0,0,0,0},
+      {"Load image", 0, Menu_load_images_cb,0,0,0,0,0,0},
+      {"Bookmark this image", 0, Menu_add_bookmark_cb,0,0,0,0,0,0},
+      {"Copy image location", 0,Menu_copy_urlstr_cb,0,FL_MENU_DIVIDER,0,0,0,0},
+      {"Save image as...", 0, Menu_save_link_cb, 0, FL_MENU_DIVIDER,0,0,0,0},
+      {"Link menu", 0, Menu_link_cb,0,0,0,0,0,0},
+      {0,0,0,0,0,0,0,0,0}
+   };
 
+   popup_x = Fl::event_x();
+   popup_y = Fl::event_y();
    popup_bw = bw;
    a_Url_free(popup_url);
    popup_url = a_Url_dup(url);
@@ -483,46 +459,19 @@
    a_Url_free(popup_link_url);
    popup_link_url = a_Url_dup(link_url);
 
-   if (!pm) {
-      Item *i;
-      pm = new PopupMenu(0,0,0,0,"&IMAGE OPTIONS");
-      pm->begin();
-       i = new Item("Isolate Image");
-       i->callback(Menu_open_url_cb);
-       i = new Item("Open Image in New Window");
-       i->callback(Menu_open_url_nw_cb);
-       i = new Item("Open Image in New Tab");
-       i->callback(Menu_open_url_nt_cb);
-       new Divider();
-       i = load_img_menuitem = new Item("Load image");
-       i->callback(Menu_load_images_cb);
-       i = new Item("Bookmark this Image");
-       i->callback(Menu_add_bookmark_cb);
-       i = new Item("Copy Image location");
-       i->callback(Menu_copy_urlstr_cb);
-       new Divider();
-       i = new Item("Save Image As...");
-       i->callback(Menu_save_link_cb);
-       new Divider();
-       i = link_menuitem = new Item("Link menu");
-       i->callback(Menu_link_cb);
-
-      pm->type(PopupMenu::POPUP123);
-      pm->end();
-   }
 
    if (loaded_img) {
-      load_img_menuitem->deactivate();
+      pm[3].deactivate();
    } else {
-      load_img_menuitem->activate();
-      load_img_menuitem->user_data(popup_page_url);
+      pm[3].activate();
+      pm[3].user_data(popup_page_url);
    }
 
    if (link_url) {
-      link_menuitem->user_data(popup_link_url);
-      link_menuitem->activate();
+      pm[7].activate();
+      pm[7].user_data(popup_link_url);
    } else {
-      link_menuitem->deactivate();
+      pm[7].deactivate();
    }
 
    a_Timeout_add(0.0, Menu_popup_cb, (void *)pm);
@@ -534,29 +483,23 @@
 void a_Menu_form_popup(BrowserWindow *bw, const DilloUrl *page_url,
                        void *formptr, bool_t hidvis)
 {
-   static PopupMenu *pm = 0;
-   static Item *hiddens_item = 0;
    static bool hiddens_visible;
+   static Fl_Menu_Item pm[] = {
+      {"Submit form", 0, Menu_form_submit_cb,0,0,0,0,0,0},
+      {"Reset form", 0, Menu_form_reset_cb,0,0,0,0,0,0},
+      {0, 0, Menu_form_hiddens_cb, &hiddens_visible, 0,0,0,0,0},
+      {0,0,0,0,0,0,0,0,0}
+   };
 
+   popup_x = Fl::event_x();
+   popup_y = Fl::event_y();
    popup_bw = bw;
    a_Url_free(popup_url);
    popup_url = a_Url_dup(page_url);
-   if (!pm) {
-     Item *i;
-      pm = new PopupMenu(0,0,0,0,"FORM OPTIONS");
-      pm->add(i = new Item("Submit form"));
-      i->callback(Menu_form_submit_cb);
-      pm->add(i = new Item("Reset form"));
-      i->callback(Menu_form_reset_cb);
-      pm->add(hiddens_item = new Item(""));
-      hiddens_item->callback(Menu_form_hiddens_cb);
-      hiddens_item->user_data(&hiddens_visible);
-      pm->type(PopupMenu::POPUP123);
-   }
-   pm->user_data(formptr);
+   popup_form = formptr;
 
    hiddens_visible = hidvis;
-   hiddens_item->label(hiddens_visible ? "Hide hiddens": "Show hiddens");
+   pm[2].label(hiddens_visible ? "Hide hiddens": "Show hiddens");
 
    a_Timeout_add(0.0, Menu_popup_cb, (void *)pm);
 }
@@ -566,44 +509,32 @@
  */
 void a_Menu_file_popup(BrowserWindow *bw, void *v_wid)
 {
-   UI *ui = (UI *)bw->ui;
-   Widget *wid = (Widget*)v_wid;
-   // One menu for every browser window
-   static PopupMenu *pm = 0;
+   Fl_Widget *wid = (Fl_Widget*)v_wid;
+
+   static Fl_Menu_Item pm[] = {
+      {"New window", Keys::getShortcut(KEYS_NEW_WINDOW), filemenu_cb,
+       (void*)"nw",0,0,0,0,0},
+      {"New tab", Keys::getShortcut(KEYS_NEW_TAB), filemenu_cb,
+       (void*)"nt", FL_MENU_DIVIDER,0,0,0,0},
+      {"Open file...", Keys::getShortcut(KEYS_OPEN), filemenu_cb,
+       (void*)"of",0,0,0,0,0},
+      {"Open URL...", Keys::getShortcut(KEYS_GOTO), filemenu_cb,
+       (void*)"ou",0,0,0,0,0},
+      {"Close", Keys::getShortcut(KEYS_CLOSE_TAB), filemenu_cb,
+       (void*)"cw", FL_MENU_DIVIDER,0,0,0,0},
+      {"Exit Dillo", Keys::getShortcut(KEYS_CLOSE_ALL), filemenu_cb,
+       (void*)"ed",0,0,0,0,0},
+      {0,0,0,0,0,0,0,0,0}
+   };
 
    popup_bw = bw;
    popup_x = wid->x();
-   popup_y = wid->y() + wid->h() +
-             // WORKAROUND: ?? wid->y() doesn't count tabs ??
-             (((Group*)ui->tabs())->children() > 1 ? 20 : 0);
+   popup_y = wid->y() + wid->h();
    a_Url_free(popup_url);
    popup_url = NULL;
 
-   if (!pm) {
-      int shortcut;
-      Item *i;
-      pm = new PopupMenu(0,0,0,0,"File");
-      pm->begin();
-       shortcut = Keys::getShortcut(KEYS_NEW_WINDOW);
-       i = new Item("New Window", shortcut, filemenu_cb, (void*)"nw");
-       shortcut = Keys::getShortcut(KEYS_NEW_TAB);
-       i = new Item("New Tab", shortcut, filemenu_cb, (void*)"nt");
-       new Divider();
-       shortcut = Keys::getShortcut(KEYS_OPEN);
-       i = new Item("Open File...", shortcut, filemenu_cb, (void*)"of");
-       shortcut = Keys::getShortcut(KEYS_GOTO);
-       i = new Item("Open URL...", shortcut, filemenu_cb, (void*)"ou");
-       shortcut = Keys::getShortcut(KEYS_CLOSE_TAB);
-       i = new Item("Close", shortcut, filemenu_cb, (void*)"cw");
-       new Divider();
-       shortcut = Keys::getShortcut(KEYS_CLOSE_ALL);
-       i = new Item("Exit Dillo", shortcut, filemenu_cb, (void*)"ed");
-      pm->type(PopupMenu::POPUP123);
-      pm->end();
-   }
-
-   pm->label(wid->visible() ? NULL : "File");
-   a_Timeout_add(0.0, Menu_popup_cb2, (void *)pm);
+   //pm->label(wid->visible() ? NULL : "File");
+   a_Timeout_add(0.0, Menu_popup_cb, (void *)pm);
 }
 
 /*
@@ -611,28 +542,21 @@
  */
 void a_Menu_bugmeter_popup(BrowserWindow *bw, const DilloUrl *url)
 {
-   // One menu for every browser window
-   static PopupMenu *pm = 0;
+   static Fl_Menu_Item pm[] = {
+      {"Validate URL with W3C", 0, Menu_bugmeter_validate_w3c_cb,0,0,0,0,0,0},
+      {"Validate URL with WDG", 0, Menu_bugmeter_validate_wdg_cb, 0,
+       FL_MENU_DIVIDER,0,0,0,0},
+      {"About bug meter", 0, Menu_bugmeter_about_cb,0,0,0,0,0,0},
+      {0,0,0,0,0,0,0,0,0}     
+   };      
 
+   popup_x = Fl::event_x();
+   popup_y = Fl::event_y();
    popup_bw = bw;
    a_Url_free(popup_url);
    popup_url = a_Url_dup(url);
-   if (!pm) {
-      Item *i;
-      pm = new PopupMenu(0,0,0,0,"&BUG METER OPTIONS");
-      pm->begin();
-       i = new Item("Validate URL with W3C");
-       i->callback(Menu_bugmeter_validate_w3c_cb);
-       i = new Item("Validate URL with WDG");
-       i->callback(Menu_bugmeter_validate_wdg_cb);
-       new Divider();
-       i = new Item("About Bug Meter...");
-       i->callback(Menu_bugmeter_about_cb);
-      pm->type(PopupMenu::POPUP123);
-      pm->end();
-   }
 
-   pm->popup();
+   a_Timeout_add(0.0, Menu_popup_cb, (void *)pm);
 }
 
 /*
@@ -642,65 +566,70 @@
  */
 void a_Menu_history_popup(BrowserWindow *bw, int direction)
 {
-   static PopupMenu *pm = 0;
-   Item *it;
-   int i;
+   static Fl_Menu_Item *pm = 0;
+   int i, n;
 
    popup_bw = bw;
+   popup_x = Fl::event_x();
+   popup_y = Fl::event_y();
    history_direction = direction;
 
    // TODO: hook popdown event with delete or similar.
    if (pm)
-      delete(pm);
+      delete [] pm;
    if (history_list)
       dFree(history_list);
 
-   if (direction == -1) {
-      pm = new PopupMenu(0,0,0,0, "&PREVIOUS PAGES");
-   } else {
-      pm = new PopupMenu(0,0,0,0, "&FOLLOWING PAGES");
-   }
-
    // Get a list of URLs for this popup
    history_list = a_UIcmd_get_history(bw, direction);
 
-   pm->begin();
-    for (i = 0; history_list[i] != -1; i += 1) {
-       // TODO: restrict title size
-       it = new CustItem(a_History_get_title(history_list[i], 1));
-       it->callback(Menu_history_cb, INT2VOIDP(i+1));
-    }
-   pm->type(PopupMenu::POPUP123);
-   pm->end();
+   for (n = 0; history_list[n] != -1; n++)
+      ;
 
-   pm->popup();
+   pm = new Fl_Menu_Item[n + 1];
+   memset(pm, '\0', sizeof(Fl_Menu_Item[n + 1]));
+
+   for (i = 0; i < n; i++) {
+      pm[i].label(FL_NORMAL_LABEL, a_History_get_title(history_list[i], 1));
+      pm[i].callback(Menu_history_cb, INT2VOIDP(i+1));
+   }
+   a_Timeout_add(0.0, Menu_popup_cb, (void *)pm);
 }
 
 /*
  * Toggle use of remote stylesheets
  */
-static void Menu_remote_css_cb(Widget *wid)
+static void Menu_remote_css_cb(Fl_Widget *wid, void*)
 {
-   _MSG("Menu_remote_css_cb\n");
-   prefs.load_stylesheets = wid->state() ? 1 : 0;
+   Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
+
+   item->flags ^= FL_MENU_VALUE;
+   prefs.load_stylesheets = item->flags & FL_MENU_VALUE ? 1 : 0;
    a_UIcmd_repush(popup_bw);
 }
 
 /*
  * Toggle use of embedded CSS style
  */
-static void Menu_embedded_css_cb(Widget *wid)
+static void Menu_embedded_css_cb(Fl_Widget *wid, void*)
 {
-   prefs.parse_embedded_css = wid->state() ? 1 : 0;
+   Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
+
+   item->flags ^= FL_MENU_VALUE;
+   prefs.parse_embedded_css = item->flags & FL_MENU_VALUE ? 1 : 0;
    a_UIcmd_repush(popup_bw);
 }
 
 /*
  * Toggle loading of images -- and load them if enabling.
  */
-static void Menu_imgload_toggle_cb(Widget *wid)
+static void Menu_imgload_toggle_cb(Fl_Widget *wid, void*)
 {
-   if ((prefs.load_images = wid->state() ? 1 : 0)) {
+   Fl_Menu_Item *item = (Fl_Menu_Item*) wid;
+
+   item->flags ^= FL_MENU_VALUE;
+
+   if ((prefs.load_images = item->flags & FL_MENU_VALUE ? 1 : 0)) {
       void *doc = a_Bw_get_current_doc(popup_bw);
 
       if (doc) {
@@ -715,31 +644,28 @@
  */
 void a_Menu_tools_popup(BrowserWindow *bw, void *v_wid)
 {
-   // One menu shared by every browser window
-   static PopupMenu *pm = NULL;
-   Widget *wid = (Widget*)v_wid;
-   Item *it;
+   const Fl_Menu_Item *item;
+   Fl_Widget *wid = (Fl_Widget*)v_wid;
+
+   static Fl_Menu_Item pm[] = {
+      {"Use remote CSS", 0, Menu_remote_css_cb, 0, FL_MENU_TOGGLE,0,0,0,0},
+      {"Use embedded CSS", 0, Menu_embedded_css_cb, 0,
+       FL_MENU_TOGGLE|FL_MENU_DIVIDER,0,0,0,0},
+      {"Load images", 0, Menu_imgload_toggle_cb, 0, FL_MENU_TOGGLE,0,0,0,0},
+      {0,0,0,0,0,0,0,0,0}
+   };
 
    popup_bw = bw;
 
-   if (!pm) {
-      pm = new PopupMenu(0,0,0,0, "TOOLS");
-      pm->begin();
-       it = new ToggleItem("Use remote CSS");
-       it->callback(Menu_remote_css_cb);
-       it->state(prefs.load_stylesheets);
-       it = new ToggleItem("Use embedded CSS");
-       it->callback(Menu_embedded_css_cb);
-       it->state(prefs.parse_embedded_css);
-       new Divider();
-       it = new ToggleItem("Load images");
-       it->callback(Menu_imgload_toggle_cb);
-       it->state(prefs.load_images);
-       pm->type(PopupMenu::POPUP13);
-      pm->end();
-   }
-   //pm->popup();
-   pm->value(-1);
-   ((Menu*)pm)->popup(Rectangle(0,wid->h(),pm->w(),pm->h()));
+   if (prefs.load_stylesheets)
+      pm[0].set();
+   if (prefs.parse_embedded_css)
+      pm[1].set();
+   if (prefs.load_images)
+      pm[2].set();
+
+   item = pm->popup(wid->x(), wid->y() + wid->h());
+   if (item)
+      ((Fl_Widget *)item)->do_callback();
 }
 
--- a/src/nav.c	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/nav.c	Fri Feb 25 08:37:13 2011 +0000
@@ -489,8 +489,8 @@
       } else if (URL_FLAGS(h_url) & URL_Post) {
          /* Attempt to repost data, let's confirm... */
          choice = a_Dialog_choice3("Repost form data?",
-                                   "Yes", "*No", "Cancel");
-         confirmed = (choice == 0);  /* "Yes" */
+                                   "No", "Yes", "Cancel");
+         confirmed = (choice == 1);  /* "Yes" */
       }
 
       if (confirmed) {
--- a/src/timeout.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/timeout.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -11,12 +11,9 @@
 
 // Simple ADT for timeout functions
 
-#include <fltk/run.h>
+#include <FL/Fl.H>
 #include "timeout.hh"
 
-using namespace fltk;
-
-
 // C++ functions with C linkage ----------------------------------------------
 
 /*
@@ -25,7 +22,7 @@
  */
 void a_Timeout_add(float t, TimeoutCb_t cb, void *cbdata)
 {
-   add_timeout(t, cb, cbdata);
+   Fl::add_timeout(t, cb, cbdata);
 }
 
 /*
@@ -33,7 +30,7 @@
  */
 void a_Timeout_repeat(float t, TimeoutCb_t cb, void *cbdata)
 {
-   add_timeout(t, cb, cbdata);
+   Fl::add_timeout(t, cb, cbdata);
 }
 
 /*
--- a/src/ui.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/ui.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -14,73 +14,63 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include <fltk/HighlightButton.h>
-#include <fltk/run.h>
-#include <fltk/damage.h>
-#include <fltk/xpmImage.h>
-#include <fltk/events.h>        // for mouse buttons and keys
-#include <fltk/Font.h>          // UI label font for tabs
-#include <fltk/InvisibleBox.h>
-#include <fltk/PopupMenu.h>
-#include <fltk/Item.h>
-#include <fltk/Divider.h>
-
 #include "keys.hh"
 #include "ui.hh"
 #include "msg.h"
 #include "timeout.hh"
 #include "utf8.hh"
 
-using namespace fltk;
-
+#include <FL/Fl.H>
+#include <FL/Fl_Pixmap.H>
+#include <FL/Fl_Box.H>
 
 // Include image data
 #include "pixmaps.h"
 #include "uicmd.hh"
 
 struct iconset {
-   Image *ImgMeterOK, *ImgMeterBug,
-         *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools,
-         *ImgClear,*ImgSearch, *ImgHelp;
-   MultiImage *ImgLeftMulti, *ImgRightMulti, *ImgStopMulti;
+   Fl_Image *ImgMeterOK, *ImgMeterBug,
+            *ImgHome, *ImgReload, *ImgSave, *ImgBook, *ImgTools,
+            *ImgClear,*ImgSearch, *ImgHelp, *ImgLeft, *ImgLeftIn,
+            *ImgRight, *ImgRightIn, *ImgStop, *ImgStopIn;
 };
 
 static struct iconset standard_icons = {
-   new xpmImage(mini_ok_xpm),
-   new xpmImage(mini_bug_xpm),
-   new xpmImage(home_xpm),
-   new xpmImage(reload_xpm),
-   new xpmImage(save_xpm),
-   new xpmImage(bm_xpm),
-   new xpmImage(tools_xpm),
-   new xpmImage(new_s_xpm),
-   new xpmImage(search_xpm),
-   new xpmImage(help_xpm),
-   new MultiImage(*new xpmImage(left_xpm), INACTIVE_R,
-                  *new xpmImage(left_i_xpm)),
-   new MultiImage(*new xpmImage(right_xpm), INACTIVE_R,
-                  *new xpmImage(right_i_xpm)),
-   new MultiImage(*new xpmImage(stop_xpm), INACTIVE_R,
-                  *new xpmImage(stop_i_xpm)),
+   new Fl_Pixmap(mini_ok_xpm),
+   new Fl_Pixmap(mini_bug_xpm),
+   new Fl_Pixmap(home_xpm),
+   new Fl_Pixmap(reload_xpm),
+   new Fl_Pixmap(save_xpm),
+   new Fl_Pixmap(bm_xpm),
+   new Fl_Pixmap(tools_xpm),
+   new Fl_Pixmap(new_s_xpm),
+   new Fl_Pixmap(search_xpm),
+   new Fl_Pixmap(help_xpm),
+   new Fl_Pixmap(left_xpm),
+   new Fl_Pixmap(left_i_xpm),
+   new Fl_Pixmap(right_xpm),
+   new Fl_Pixmap(right_i_xpm),
+   new Fl_Pixmap(stop_xpm),
+   new Fl_Pixmap(stop_i_xpm),
 };
 
 static struct iconset small_icons = {
    standard_icons.ImgMeterOK,
    standard_icons.ImgMeterBug,
-   new xpmImage(home_s_xpm),
-   new xpmImage(reload_s_xpm),
-   new xpmImage(save_s_xpm),
-   new xpmImage(bm_s_xpm),
-   new xpmImage(tools_s_xpm),
-   new xpmImage(new_s_xpm),
+   new Fl_Pixmap(home_s_xpm),
+   new Fl_Pixmap(reload_s_xpm),
+   new Fl_Pixmap(save_s_xpm),
+   new Fl_Pixmap(bm_s_xpm),
+   new Fl_Pixmap(tools_s_xpm),
+   new Fl_Pixmap(new_s_xpm),
    standard_icons.ImgSearch,
    standard_icons.ImgHelp,
-   new MultiImage(*new xpmImage(left_s_xpm), INACTIVE_R,
-                  *new xpmImage(left_si_xpm)),
-   new MultiImage(*new xpmImage(right_s_xpm), INACTIVE_R,
-                  *new xpmImage(right_si_xpm)),
-   new MultiImage(*new xpmImage(stop_s_xpm), INACTIVE_R,
-                  *new xpmImage(stop_si_xpm)),
+   new Fl_Pixmap(left_s_xpm),
+   new Fl_Pixmap(left_si_xpm),
+   new Fl_Pixmap(right_i_xpm),
+   new Fl_Pixmap(right_si_xpm),
+   new Fl_Pixmap(stop_s_xpm),
+   new Fl_Pixmap(stop_si_xpm),
 };
 
 
@@ -95,41 +85,41 @@
 /*
  * (Used to avoid certain shortcuts in the location bar)
  */
-class CustInput : public Input {
+class CustInput : public Fl_Input {
 public:
    CustInput (int x, int y, int w, int h, const char* l=0) :
-      Input(x,y,w,h,l) {};
+      Fl_Input(x,y,w,h,l) {};
    int handle(int e);
 };
 
 /*
- * Disable: UpKey, DownKey, PageUpKey, PageDownKey and
- * CTRL+{o,r,HomeKey,EndKey}
+ * Disable keys: Up, Down, Page_Up, Page_Down and
+ * CTRL+{o,r,Home,End}
  */
 int CustInput::handle(int e)
 {
-   int k = event_key();
+   int k = Fl::event_key();
 
    _MSG("CustInput::handle event=%d\n", e);
 
    // We're only interested in some flags
-   unsigned modifier = event_state() & (SHIFT | CTRL | ALT);
+   unsigned modifier = Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
 
    // Don't focus with arrow keys
-   if (e == FOCUS &&
-       (k == UpKey || k == DownKey || k == LeftKey || k == RightKey)) {
+   if (e == FL_FOCUS &&
+       (k == FL_Up || k == FL_Down || k == FL_Left || k == FL_Right)) {
       return 0;
-   } else if (e == KEY) {
-      if (modifier == CTRL) {
+   } else if (e == FL_KEYBOARD) {
+      if (modifier == FL_CTRL) {
          if (k == 'l') {
             // Make text selected when already focused.
             position(size(), 0);
             return 1;
-         } else if (k == 'o' || k == 'r' || k == HomeKey || k == EndKey)
+         } else if (k == 'o' || k == 'r' || k == FL_Home || k == FL_End)
             return 0;
-      } else if (modifier == SHIFT) {
-         if (k == LeftKey || k == RightKey) {
-            _MSG(" CustInput::handle > SHIFT+RightKey\n");
+      } else if (modifier == FL_SHIFT) {
+         if (k == FL_Left || k == FL_Right) {
+            _MSG(" CustInput::handle > FL_SHIFT+FL_Right\n");
             a_UIcmd_send_event_to_tabs_by_wid(e, this);
             return 1;
          }
@@ -137,7 +127,7 @@
    }
    _MSG("\n");
 
-   return Input::handle(e);
+   return Fl_Input::handle(e);
 }
 
 //----------------------------------------------------------------------------
@@ -145,24 +135,24 @@
 /*
  * Used to handle "paste" within the toolbar's Clear button.
  */
-class CustHighlightButton : public HighlightButton {
+class CustButton : public Fl_Button {
 public:
-   CustHighlightButton(int x, int y, int w, int h, const char *l=0) :
-      HighlightButton(x,y,w,h,l) {};
+   CustButton(int x, int y, int w, int h, const char *l=0) :
+      Fl_Button(x,y,w,h,l) {};
    int handle(int e);
 };
 
-int CustHighlightButton::handle(int e)
+int CustButton::handle(int e)
 {
-   if (e == PASTE) {
-      const char* t = event_text();
+   if (e == FL_PASTE) {
+      const char* t = Fl::event_text();
       if (t && *t) {
          a_UIcmd_set_location_text(a_UIcmd_get_bw_by_widget(this), t);
          a_UIcmd_open_urlstr(a_UIcmd_get_bw_by_widget(this), t);
          return 1;
       }
    }
-   return HighlightButton::handle(e);
+   return Fl_Button::handle(e);
 }
 
 //----------------------------------------------------------------------------
@@ -170,11 +160,11 @@
 /*
  * Used to resize the progress boxes automatically.
  */
-class CustProgressBox : public InvisibleBox {
+class CustProgressBox : public Fl_Box {
    int padding;
 public:
    CustProgressBox(int x, int y, int w, int h, const char *l=0) :
-      InvisibleBox(x,y,w,h,l) { padding = 0; };
+      Fl_Box(x,y,w,h,l) { padding = 0; };
    void update_label(const char *lbl) {
       int w,h;
       if (!padding) {
@@ -184,7 +174,7 @@
       }
       copy_label(lbl);
       measure_label(w,h);
-      resize(w+padding,h);
+      size(w+padding,h);
       redraw_label();
    }
 };
@@ -205,15 +195,15 @@
 /*
  * Callback for the search button.
  */
-static void search_cb(Widget *wid, void *data)
+static void search_cb(Fl_Widget *wid, void *data)
 {
-   int k = event_key();
+   int b = Fl::event_button();
 
-   if (k == 1) {
+   if (b == FL_LEFT_MOUSE) {
       a_UIcmd_search_dialog(a_UIcmd_get_bw_by_widget(wid));
-   } else if (k == 2) {
+   } else if (b == FL_MIDDLE_MOUSE) {
       ((UI*)data)->color_change_cb_i();
-   } else if (k == 3) {
+   } else if (b == FL_RIGHT_MOUSE) {
       ((UI*)data)->panel_cb_i();
    }
 }
@@ -221,7 +211,7 @@
 /*
  * Callback for the help button.
  */
-static void help_cb(Widget *w, void *)
+static void help_cb(Fl_Widget *w, void *)
 {
    char *path = dStrconcat(DILLO_DOCDIR, "user_help.html", NULL);
    BrowserWindow *bw = a_UIcmd_get_bw_by_widget(w);
@@ -241,10 +231,10 @@
 /*
  * Callback for the File menu button.
  */
-static void filemenu_cb(Widget *wid, void *)
+static void filemenu_cb(Fl_Widget *wid, void *)
 {
-   int k = event_key();
-   if (k == 1 || k == 3) {
+   int b = Fl::event_button();
+   if (b == FL_LEFT_MOUSE || b == FL_RIGHT_MOUSE) {
       a_UIcmd_file_popup(a_UIcmd_get_bw_by_widget(wid), wid);
    }
 }
@@ -252,15 +242,15 @@
 /*
  * Callback for the location's clear-button.
  */
-static void clear_cb(Widget *w, void *data)
+static void clear_cb(Fl_Widget *w, void *data)
 {
    UI *ui = (UI*)data;
 
-   int k = event_key();
-   if (k == 1) {
+   int b = Fl::event_button();
+   if (b == FL_LEFT_MOUSE) {
       ui->set_location("");
       ui->focus_location();
-   } if (k == 2) {
+   } if (b == FL_MIDDLE_MOUSE) {
       ui->paste_url();
    }
 }
@@ -268,7 +258,7 @@
 /*
  * Change the color of the location bar.
  *
-static void color_change_cb(Widget *wid, void *data)
+static void color_change_cb(Fl_Widget *wid, void *data)
 {
    ((UI*)data)->color_change_cb_i();
 }
@@ -278,9 +268,9 @@
 /*
  * Send the browser to the new URL in the location.
  */
-static void location_cb(Widget *wid, void *data)
+static void location_cb(Fl_Widget *wid, void *data)
 {
-   Input *i = (Input*)wid;
+   Fl_Input *i = (Fl_Input*)wid;
    UI *ui = (UI*)data;
 
    _MSG("location_cb()\n");
@@ -288,7 +278,7 @@
     * other events we're not interested in. For instance pressing
     * The Back or Forward, buttons, or the first click on a rendered
     * page. BUG: this must be investigated and reported to FLTK2 team */
-   if (event_key() == ReturnKey) {
+   if (Fl::event_key() == FL_Enter) {
       a_UIcmd_open_urlstr(a_UIcmd_get_bw_by_widget(i), i->value());
    }
    if (ui->get_panelmode() == UI_TEMPORARILY_SHOW_PANELS) {
@@ -300,56 +290,56 @@
 /*
  * Callback handler for button press on the panel
  */
-static void b1_cb(Widget *wid, void *cb_data)
+static void b1_cb(Fl_Widget *wid, void *cb_data)
 {
    int bn = VOIDP2INT(cb_data);
-   int k = event_key();
-   if (k && k <= 7) {
-      _MSG("[%s], mouse button %d was pressed\n", button_names[bn], k);
-      _MSG("mouse button %d was pressed\n", k);
+   int b = Fl::event_button();
+   if (b >= FL_LEFT_MOUSE && b <= FL_RIGHT_MOUSE) {
+      _MSG("[%s], mouse button %d was pressed\n", button_names[bn], b);
+      _MSG("mouse button %d was pressed\n", b);
    }
    switch (bn) {
    case UI_BACK:
-      if (k == 1) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_back(a_UIcmd_get_bw_by_widget(wid));
-      } else if (k == 3) {
+      } else if (b == FL_RIGHT_MOUSE) {
          a_UIcmd_back_popup(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_FORW:
-      if (k == 1) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_forw(a_UIcmd_get_bw_by_widget(wid));
-      } else if (k == 3) {
+      } else if (b == FL_RIGHT_MOUSE) {
          a_UIcmd_forw_popup(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_HOME:
-      if (k == 1) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_home(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_RELOAD:
-      if (k == 1) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_reload(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_SAVE:
-      if (k == 1) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_save(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_STOP:
-      if (k == 1) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_stop(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_BOOK:
-      if (k == 1) {
+      if (b == FL_LEFT_MOUSE) {
          a_UIcmd_book(a_UIcmd_get_bw_by_widget(wid));
       }
       break;
    case UI_TOOLS:
-      if (k == 1 || k == 3) {
+      if (b == FL_LEFT_MOUSE || b == FL_RIGHT_MOUSE) {
          a_UIcmd_tools(a_UIcmd_get_bw_by_widget(wid), wid);
       }
       break;
@@ -361,7 +351,7 @@
 /*
  * Callback handler for fullscreen button press
  */
-//static void fullscreen_cb(Widget *wid, void *data)
+//static void fullscreen_cb(Fl_Widget *wid, void *data)
 //{
 //   /* TODO: do we want to toggle fullscreen or panelmode?
 //            maybe we need to add another button?*/
@@ -371,12 +361,12 @@
 /*
  * Callback for the bug meter button.
  */
-static void bugmeter_cb(Widget *wid, void *data)
+static void bugmeter_cb(Fl_Widget *wid, void *data)
 {
-   int k = event_key();
-   if (k == 1) {
+   int b = Fl::event_button();
+   if (b == FL_LEFT_MOUSE) {
       a_UIcmd_view_page_bugs(a_UIcmd_get_bw_by_widget(wid));
-   } else if (k == 3) {
+   } else if (b == FL_RIGHT_MOUSE) {
       a_UIcmd_bugmeter_popup(a_UIcmd_get_bw_by_widget(wid));
    }
 }
@@ -392,53 +382,55 @@
 /*
  * Create the archetipic browser buttons
  */
-PackedGroup *UI::make_toolbar(int tw, int th)
+Fl_Pack *UI::make_toolbar(int tw, int th)
 {
-   HighlightButton *b;
-   PackedGroup *p1=new PackedGroup(0,0,tw,th);
+   Fl_Button *b;
+   Fl_Pack *p1=new Fl_Pack(0,0,tw,th);
    p1->begin();
-    Back = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Back" : 0);
-    b->image(icons->ImgLeftMulti);
+    Back = b = new Fl_Button(xpos, 0, bw, bh, (lbl) ? "Back" : 0);
+    b->image(icons->ImgLeft);
+    b->deimage(icons->ImgLeftIn);
     b->callback(b1_cb, (void *)UI_BACK);
-    b->clear_tab_to_focus();
-    HighlightButton::default_style->highlight_color(CuteColor);
+    b->clear_visible_focus();
 
-    Forw = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Forw" : 0);
-    b->image(icons->ImgRightMulti);
+    Forw = b = new Fl_Button(xpos, 0, bw, bh, (lbl) ? "Forw" : 0);
+    b->image(icons->ImgRight);
+    b->deimage(icons->ImgRightIn);
     b->callback(b1_cb, (void *)UI_FORW);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-    Home = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Home" : 0);
+    Home = b = new Fl_Button(xpos, 0, bw, bh, (lbl) ? "Home" : 0);
     b->image(icons->ImgHome);
     b->callback(b1_cb, (void *)UI_HOME);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-    Reload = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Reload" : 0);
+    Reload = b = new Fl_Button(xpos, 0, bw, bh, (lbl) ? "Reload" : 0);
     b->image(icons->ImgReload);
     b->callback(b1_cb, (void *)UI_RELOAD);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-    Save = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Save" : 0);
+    Save = b = new Fl_Button(xpos, 0, bw, bh, (lbl) ? "Save" : 0);
     b->image(icons->ImgSave);
     b->callback(b1_cb, (void *)UI_SAVE);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-    Stop = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Stop" : 0);
-    b->image(icons->ImgStopMulti);
+    Stop = b = new Fl_Button(xpos, 0, bw, bh, (lbl) ? "Stop" : 0);
+    b->image(icons->ImgStop);
+    b->deimage(icons->ImgStopIn);
     b->callback(b1_cb, (void *)UI_STOP);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-    Bookmarks = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Book" : 0);
+    Bookmarks = b = new Fl_Button(xpos, 0, bw, bh, (lbl) ? "Book" : 0);
     b->image(icons->ImgBook);
     b->callback(b1_cb, (void *)UI_BOOK);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-    Tools = b = new HighlightButton(xpos, 0, bw, bh, (lbl) ? "Tools" : 0);
+    Tools = b = new Fl_Button(xpos, 0, bw, bh, (lbl) ? "Tools" : 0);
     b->image(icons->ImgTools);
     b->callback(b1_cb, (void *)UI_TOOLS);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-   p1->type(PackedGroup::ALL_CHILDREN_VERTICAL);
+   p1->type(Fl_Pack::HORIZONTAL);
    p1->end();
 
    if (prefs.show_tooltip) {
@@ -457,33 +449,32 @@
 /*
  * Create the location box (Clear/Input/Search)
  */
-PackedGroup *UI::make_location()
+Fl_Pack *UI::make_location()
 {
-   Button *b;
-   PackedGroup *pg = new PackedGroup(0,0,0,0);
+   Fl_Button *b;
+   Fl_Pack *pg = new Fl_Pack(0,0,0,0);
    pg->begin();
-    Clear = b = new CustHighlightButton(2,2,16,22,0);
+    Clear = b = new CustButton(2,2,16,22,0);
     b->image(icons->ImgClear);
     b->callback(clear_cb, this);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-    Input *i = Location = new CustInput(0,0,0,0,0);
+    Fl_Input *i = Location = new CustInput(0,0,0,0,0);
     i->color(CuteColor);
-    i->when(WHEN_ENTER_KEY);
+    i->when(FL_WHEN_ENTER_KEY);
     i->callback(location_cb, this);
-    i->set_click_to_focus();
 
-    Search = b = new HighlightButton(0,0,16,22,0);
+    Search = b = new Fl_Button(0,0,16,22,0);
     b->image(icons->ImgSearch);
     b->callback(search_cb, this);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-    Help = b = new HighlightButton(0,0,16,22,0);
+    Help = b = new Fl_Button(0,0,16,22,0);
     b->image(icons->ImgHelp);
     b->callback(help_cb, this);
-    b->clear_tab_to_focus();
+    b->clear_visible_focus();
 
-   pg->type(PackedGroup::ALL_CHILDREN_VERTICAL);
+   pg->type(Fl_Pack::HORIZONTAL);
    pg->resizable(i);
    pg->end();
 
@@ -499,21 +490,21 @@
 /*
  * Create the progress bars
  */
-PackedGroup *UI::make_progress_bars(int wide, int thin_up)
+Fl_Pack *UI::make_progress_bars(int wide, int thin_up)
 {
-   ProgBox = new PackedGroup(0,0,0,0);
+   ProgBox = new Fl_Pack(0,0,0,0);
    ProgBox->begin();
     // Images
     IProg = new CustProgressBox(0,0,0,0);
-    IProg->box(thin_up ? THIN_UP_BOX : EMBOSSED_BOX);
-    IProg->labelcolor(GRAY10);
+    IProg->box(thin_up ? FL_THIN_UP_BOX : FL_EMBOSSED_BOX);
+    IProg->labelcolor(FL_GRAY_RAMP + 2);
     IProg->update_label(wide ? "Images\n0 of 0" : "0 of 0");
     // Page
     PProg = new CustProgressBox(0,0,0,0);
-    PProg->box(thin_up ? THIN_UP_BOX : EMBOSSED_BOX);
-    PProg->labelcolor(GRAY10);
+    PProg->box(thin_up ? FL_THIN_UP_BOX : FL_EMBOSSED_BOX);
+    PProg->labelcolor(FL_GRAY_RAMP + 2);
     PProg->update_label(wide ? "Page\n0.0KB" : "0.0KB");
-   ProgBox->type(PackedGroup::ALL_CHILDREN_VERTICAL);
+   ProgBox->type(Fl_Pack::HORIZONTAL);
    ProgBox->end();
 
    return ProgBox;
@@ -523,25 +514,25 @@
  * Create the "File" menu
  * Static function for File menu callbacks.
  */
-Widget *UI::make_filemenu_button()
+Fl_Widget *UI::make_filemenu_button()
 {
-   HighlightButton *btn;
+   Fl_Button *btn;
    int w,h, padding;
 
-   FileButton = btn = new HighlightButton(0,0,0,0,"W");
+   FileButton = btn = new Fl_Button(0,0,0,0,"W");
    btn->measure_label(w, h);
    padding = w;
    btn->copy_label(PanelSize == P_tiny ? "&F" : "&File");
    btn->measure_label(w,h);
    if (PanelSize == P_large)
       h = fh;
-   btn->resize(w+padding,h);
+   btn->size(w+padding,h);
    _MSG("UI::make_filemenu_button w=%d h=%d padding=%d\n", w, h, padding);
-   btn->box(PanelSize == P_large ? FLAT_BOX : THIN_UP_BOX);
+   btn->box(PanelSize == P_large ? FL_FLAT_BOX : FL_THIN_UP_BOX);
    btn->callback(filemenu_cb, this);
    if (prefs.show_tooltip)
       btn->tooltip("File menu");
-   btn->clear_tab_to_focus();
+   btn->clear_visible_focus();
    if (!prefs.show_filemenu && PanelSize != P_large)
       btn->hide();
    return btn;
@@ -551,11 +542,11 @@
 /*
  * Create the control panel
  */
-Group *UI::make_panel(int ww)
+Fl_Group *UI::make_panel(int ww)
 {
-   Widget *w;
-   Group *g1, *g2, *g3;
-   PackedGroup *pg;
+   Fl_Widget *w;
+   Fl_Group *g1, *g2, *g3;
+   Fl_Pack *pg;
 
    if (PanelSize > P_large) {
       PanelSize = P_tiny;
@@ -590,10 +581,10 @@
    }
 
    if (PanelSize == P_tiny) {
-      g1 = new Group(0,0,ww,bh);
+      g1 = new Fl_Group(0,0,ww,bh);
        // Toolbar
        pg = make_toolbar(ww,bh);
-       pg->box(EMBOSSED_BOX);
+       pg->box(FL_EMBOSSED_BOX);
        g1->add(pg);
        w = make_filemenu_button();
        pg->add(w);
@@ -606,23 +597,23 @@
       g1->resizable(pg);
 
    } else {
-      g1 = new Group(0,0,ww,fh+lh+bh);
+      g1 = new Fl_Group(0,0,ww,fh+lh+bh);
       g1->begin();
         // File menu
         if (PanelSize == P_large) {
-           g3 = new Group(0,0,ww,lh);
-           g3->box(FLAT_BOX);
-           Widget *bn = make_filemenu_button();
+           g3 = new Fl_Group(0,0,ww,lh);
+           g3->box(FL_FLAT_BOX);
+           Fl_Widget *bn = make_filemenu_button();
            g3->add(bn);
-           g3->add_resizable(*new InvisibleBox(bn->w(),0,ww - bn->w(),lh));
+           g3->add_resizable(*new Fl_Box(bn->w(),0,ww - bn->w(),lh));
 
-           g2 = new Group(0,fh,ww,lh);
+           g2 = new Fl_Group(0,fh,ww,lh);
            g2->begin();
            pg = make_location();
-           pg->resize(ww,lh);
+           pg->size(ww,lh);
         } else {
-           g2 = new PackedGroup(0,fh,ww,lh);
-           g2->type(PackedGroup::ALL_CHILDREN_VERTICAL);
+           g2 = new Fl_Pack(0,fh,ww,lh);
+           g2->type(Fl_Pack::HORIZONTAL);
            g2->begin();
            make_filemenu_button();
            pg = make_location();
@@ -632,11 +623,11 @@
        g2->end();
 
        // Toolbar
-       g3 = new Group(0,fh+lh,ww,bh);
+       g3 = new Fl_Group(0,fh+lh,ww,bh);
        g3->begin();
         pg = make_toolbar(ww,bh);
-        //w = new InvisibleBox(0,0,0,0,"i n v i s i b l e");
-        w = new InvisibleBox(0,0,0,0,0);
+        //w = new Fl_Box(0,0,0,0,"i n v i s i b l e");
+        w = new Fl_Box(0,0,0,0,0);
         pg->add(w);
         pg->resizable(w);
 
@@ -648,8 +639,8 @@
         pg->add(w);
 
        g3->resizable(pg); // Better than 'w3' and it also works
-       pg->box(BORDER_FRAME);
-       //g3->box(EMBOSSED_BOX);
+       pg->box(FL_BORDER_FRAME);
+       //g3->box(FL_EMBOSSED_BOX);
        g3->end();
 
       g1->resizable(g3);
@@ -662,33 +653,32 @@
 /*
  * Create the status panel
  */
-Group *UI::make_status_panel(int ww)
+Fl_Group *UI::make_status_panel(int ww)
 {
    const int s_h = 20, bm_w = 16;
-   Group *g = new Group(0, 0, ww, s_h, 0);
+   Fl_Group *g = new Fl_Group(0, 0, ww, s_h, 0);
 
    // Status box
-   Status = new Output(0, 0, ww-bm_w, s_h, 0);
-   Status->value("");
-   Status->box(THIN_DOWN_BOX);
-   Status->clear_click_to_focus();
-   Status->clear_tab_to_focus();
-   Status->color(GRAY80);
-   g->add(Status);
-   //Status->throw_focus();
+   StatusOutput = new Fl_Output(0, 0, ww-bm_w, s_h, 0);
+   StatusOutput->value("");
+   StatusOutput->box(FL_THIN_DOWN_BOX);
+   StatusOutput->clear_visible_focus();
+   StatusOutput->color(FL_GRAY_RAMP + 18);
+   g->add(StatusOutput);
+   //StatusOutput->throw_focus();
 
    // Bug Meter
-   BugMeter = new HighlightButton(ww-bm_w,0,bm_w,s_h,0);
+   BugMeter = new Fl_Button(ww-bm_w,0,bm_w,s_h,0);
    BugMeter->image(icons->ImgMeterOK);
-   BugMeter->box(THIN_DOWN_BOX);
-   BugMeter->align(ALIGN_INSIDE|ALIGN_CLIP|ALIGN_LEFT);
+   BugMeter->box(FL_THIN_DOWN_BOX);
+   BugMeter->align(FL_ALIGN_INSIDE|FL_ALIGN_CLIP|FL_ALIGN_LEFT);
    if (prefs.show_tooltip)
       BugMeter->tooltip("Show HTML bugs\n(right-click for menu)");
    BugMeter->callback(bugmeter_cb, this);
-   BugMeter->clear_tab_to_focus();
+   BugMeter->clear_visible_focus();
    g->add(BugMeter);
 
-   g->resizable(Status);
+   g->resizable(StatusOutput);
    return g;
 }
 
@@ -696,16 +686,16 @@
  * User Interface constructor
  */
 UI::UI(int x, int y, int ww, int wh, const char* label, const UI *cur_ui) :
-  Group(x, y, ww, wh, label)
+  Fl_Group(x, y, ww, wh, label)
 {
    PointerOnLink = FALSE;
 
    Tabs = NULL;
    TabTooltip = NULL;
-   TopGroup = new PackedGroup(0, 0, ww, wh);
+   TopGroup = new Fl_Pack(0, 0, ww, wh);
    add(TopGroup);
    resizable(TopGroup);
-   set_flag(RAW_LABEL);
+   clear_flag(SHORTCUT_LABEL);
 
    if (cur_ui) {
       PanelSize = cur_ui->PanelSize;
@@ -730,13 +720,13 @@
    TopGroup->add(Panel);
 
    // Render area
-   Main = new Widget(0,0,1,1,"Welcome...");
-   Main->box(FLAT_BOX);
-   Main->color(GRAY15);
-   Main->labelfont(HELVETICA_BOLD_ITALIC);
+   Main = new Fl_Group(0,0,1,1,"Welcome...");
+   Main->box(FL_FLAT_BOX);
+   Main->color(FL_GRAY_RAMP + 3);
+   Main->labelfont(FL_HELVETICA_BOLD_ITALIC);
    Main->labelsize(36);
-   Main->labeltype(SHADOW_LABEL);
-   Main->labelcolor(WHITE);
+   Main->labeltype(FL_SHADOW_LABEL);
+   Main->labelcolor(FL_WHITE);
    TopGroup->add(Main);
    TopGroup->resizable(Main);
    MainIdx = TopGroup->find(Main);
@@ -751,7 +741,7 @@
 
    // Make the full screen button (to be attached to the viewport later)
    // TODO: attach to the viewport
-   //FullScreen = new HighlightButton(0,0,15,15);
+   //FullScreen = new Fl_Button(0,0,15,15);
    //FullScreen->image(ImgFullScreenOn);
    //FullScreen->tooltip("Hide Controls");
    //FullScreen->callback(fullscreen_cb, this);
@@ -778,14 +768,14 @@
  */
 int UI::handle(int event)
 {
-   _MSG("UI::handle event=%d (%d,%d)\n", event, event_x(), event_y());
+   _MSG("UI::handle event=%d (%d,%d)\n", event, Fl::event_x(), Fl::event_y());
    _MSG("Panel->h()=%d Main->h()=%d\n", Panel->h() , Main->h());
 
    int ret = 0;
 
-   if (event == KEY) {
+   if (event == FL_KEYBOARD) {
       return 0; // Receive as shortcut
-   } else if (event == SHORTCUT) {
+   } else if (event == FL_SHORTCUT) {
       KeysCommand_t cmd = Keys::getKeyCmd();
       if (cmd == KEYS_NOP) {
          // Do nothing
@@ -851,19 +841,14 @@
          a_Timeout_add(0.0, a_UIcmd_close_all_bw, NULL);
          ret = 1;
       }
-   } else if (event == PUSH) {
+   } else if (event == FL_PUSH) {
       if (prefs.middle_click_drags_page == 0 &&
-          event_button() == MiddleButton &&
+          Fl::event_button() == FL_MIDDLE_MOUSE &&
           !a_UIcmd_pointer_on_link(a_UIcmd_get_bw_by_widget(this))) {
-         if (Main->Rectangle::contains (event_x (), event_y ())) {
+         if (Main->contains(Fl::belowmouse())) {
             /* Offer the event to Main's children (form widgets) */
-            int save_x = e_x, save_y = e_y;
-
-            e_x -= Main->x();
-            e_y -= Main->y();
-            ret = ((Group *)Main)->Group::handle(event);
-            e_x = save_x;
-            e_y = save_y;
+            /* TODO: Try just offering it to Fl::belowmouse() */
+            ret = ((Fl_Group *)Main)->Fl_Group::handle(event);
          }
          if (!ret) {
             /* middle click was not on a link or a form widget */
@@ -874,7 +859,7 @@
    }
 
    if (!ret) {
-      ret = Group::handle(event);
+      ret = Fl_Group::handle(event);
    }
 
    return ret;
@@ -901,7 +886,7 @@
    if (!str) str = "";
    // This text() call clears fl_pending_callback, avoiding
    // an extra location_cb() call.
-   Location->text(str);
+   Location->value(str);
    Location->position(strlen(str));
 }
 
@@ -932,7 +917,7 @@
  */
 void UI::set_status(const char *str)
 {
-   Status->value(str);
+   StatusOutput->value(str);
 }
 
 /*
@@ -998,7 +983,7 @@
       BugMeter->redraw_label();
       new_w = strlen(str)*8 + 20;
    }
-   Status->resize(0,0,StatusPanel->w()-new_w,Status->h());
+   StatusOutput->resize(0,0,StatusPanel->w()-new_w,StatusOutput->h());
    BugMeter->resize(StatusPanel->w()-new_w, 0, new_w, BugMeter->h());
    StatusPanel->init_sizes();
 }
@@ -1043,13 +1028,14 @@
  */
 void UI::panel_cb_i()
 {
-   Group *NewPanel;
+   Fl_Group *NewPanel;
 
    // Create a new Panel
    ++PanelSize;
    NewPanel = make_panel(TopGroup->w());
-   TopGroup->replace(*Panel, *NewPanel);
+   TopGroup->remove(Panel);
    delete(Panel);
+   TopGroup->add(NewPanel);
    Panel = NewPanel;
    customize(0);
 
@@ -1069,7 +1055,6 @@
    MSG("Location color %d\n", CuteColor);
    Location->color(CuteColor);
    Location->redraw();
-   HighlightButton::default_style->highlight_color(CuteColor);
 }
 
 /*
@@ -1107,18 +1092,19 @@
 /*
  * Set 'nw' as the main render area widget
  */
-void UI::set_render_layout(Widget &nw)
+void UI::set_render_layout(Fl_Group &nw)
 {
    // BUG: replace() is not working as it should.
    // In our case, replacing the rendering area leaves the vertical
    // scrollbar without events.
    //
    // We'll use a workaround in a_UIcmd_browser_window_new() instead.
-   TopGroup->replace(MainIdx, nw);
+   TopGroup->remove(MainIdx);
    delete(Main);
+   TopGroup->add(nw);
    Main = &nw;
-   //TopGroup->box(DOWN_BOX);
-   //TopGroup->box(BORDER_FRAME);
+   //TopGroup->box(FL_DOWN_BOX);
+   //TopGroup->box(FL_BORDER_FRAME);
    TopGroup->resizable(TopGroup->child(MainIdx));
 }
 
@@ -1161,15 +1147,15 @@
    switch (btn) {
    case UI_BACK:
       (sens) ? Back->activate() : Back->deactivate();
-      Back->redraw(DAMAGE_HIGHLIGHT);
+//    Back->redraw(DAMAGE_HIGHLIGHT);
       break;
    case UI_FORW:
       (sens) ? Forw->activate() : Forw->deactivate();
-      Forw->redraw(DAMAGE_HIGHLIGHT);
+//    Forw->redraw(DAMAGE_HIGHLIGHT);
       break;
    case UI_STOP:
       (sens) ? Stop->activate() : Stop->deactivate();
-      Stop->redraw(DAMAGE_HIGHLIGHT);
+//    Stop->redraw(DAMAGE_HIGHLIGHT);
       break;
    default:
       break;
@@ -1181,7 +1167,7 @@
  */
 void UI::paste_url()
 {
-   paste(*Clear, false);
+   Fl::paste(*Clear, false);
 }
 
 /*
--- a/src/ui.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/ui.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -3,16 +3,14 @@
 
 // UI for dillo --------------------------------------------------------------
 
-#include <fltk/Window.h>
-#include <fltk/Widget.h>
-#include <fltk/Button.h>
-#include <fltk/Input.h>
-#include <fltk/PackedGroup.h>
-#include <fltk/Output.h>
-#include <fltk/Image.h>
-#include <fltk/MultiImage.h>
-#include <fltk/MenuBuild.h>
-#include <fltk/TabGroup.h>
+#include <FL/Fl_Window.H>
+#include <FL/Fl_Widget.H>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Input.H>
+#include <FL/Fl_Pack.H>
+#include <FL/Fl_Output.H>
+#include <FL/Fl_Image.H>
+#include <FL/Fl_Tabs.H>
 
 #include "findbar.hh"
 
@@ -42,19 +40,18 @@
 //
 // UI class definition -------------------------------------------------------
 //
-class UI : public fltk::Group {
+class UI : public Fl_Group {
    CustTabGroup *Tabs;
    char *TabTooltip;
 
-   fltk::Group *TopGroup;
-   fltk::Button *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks, *Tools,
+   Fl_Group *TopGroup;
+   Fl_Button *Back, *Forw, *Home, *Reload, *Save, *Stop, *Bookmarks, *Tools,
           *Clear, *Search, *Help, *FullScreen, *BugMeter, *FileButton;
-   fltk::Input  *Location;
-   fltk::PackedGroup *ProgBox;
+   Fl_Input  *Location;
+   Fl_Pack *ProgBox;
    CustProgressBox *PProg, *IProg;
-   fltk::Group *Panel, *StatusPanel;
-   fltk::Widget *Main;
-   fltk::Output *Status;
+   Fl_Group *Panel, *Main, *StatusPanel;
+   Fl_Output *StatusOutput;
 
    int MainIdx;
    // Panel customization variables
@@ -65,13 +62,13 @@
    Findbar *findbar;
    int PointerOnLink;
 
-   fltk::PackedGroup *make_toolbar(int tw, int th);
-   fltk::PackedGroup *make_location();
-   fltk::PackedGroup *make_progress_bars(int wide, int thin_up);
+   Fl_Pack *make_toolbar(int tw, int th);
+   Fl_Pack *make_location();
+   Fl_Pack *make_progress_bars(int wide, int thin_up);
    void make_menubar(int x, int y, int w, int h);
-   fltk::Widget *make_filemenu_button();
-   fltk::Group *make_panel(int ww);
-   fltk::Group *make_status_panel(int ww);
+   Fl_Widget *make_filemenu_button();
+   Fl_Group *make_panel(int ww);
+   Fl_Group *make_status_panel(int ww);
 
 public:
 
@@ -89,7 +86,7 @@
    void set_page_prog(size_t nbytes, int cmd);
    void set_img_prog(int n_img, int t_img, int cmd);
    void set_bug_prog(int n_bug);
-   void set_render_layout(Widget &nw);
+   void set_render_layout(Fl_Group &nw);
    void set_tab_title(const char *label);
    void customize(int flags);
    void button_set_sens(UIButton btn, int sens);
@@ -97,7 +94,7 @@
    void set_panelmode(UIPanelmode mode);
    UIPanelmode get_panelmode();
    void set_findbar_visibility(bool visible);
-   Widget *fullscreen_button() { return FullScreen; }
+   Fl_Widget *fullscreen_button() { return FullScreen; }
    void fullscreen_toggle() { FullScreen->do_callback(); }
 
    CustTabGroup *tabs() { return Tabs; }
--- a/src/uicmd.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/uicmd.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -16,11 +16,10 @@
 #include <stdarg.h>
 #include <math.h>       /* for rint */
 
-#include <fltk/draw.h>
-#include <fltk/damage.h>
-#include <fltk/Widget.h>
-#include <fltk/TabGroup.h>
-#include <fltk/Tooltip.h>
+#include <FL/Fl_Widget.H>
+#include <FL/Fl_Double_Window.H>
+#include <FL/Fl_Tabs.H>
+#include <FL/Fl_Tooltip.H>
 
 #include "paths.hh"
 #include "keys.hh"
@@ -56,10 +55,10 @@
  */
 static char *save_dir = NULL;
 
-using namespace fltk;
-
 
 //----------------------------------------------------------------------------
+#if 0
+
 #define BTN_W 25
 #define BTN_H 20
 
@@ -89,7 +88,7 @@
          setcolor(btn_hl ? 206 : GRAY75);
          fillrect(r);
          if (btn_hl) {
-            setcolor(WHITE);
+            setcolor(FL_WHITE);
             strokerect(r);
          }
          setcolor(GRAY10);
@@ -220,24 +219,26 @@
 TabGroupPager* CustShrinkTabPager::clone() const {
    return new CustShrinkTabPager(*this);
 }
-
+#endif /* custom pager */
 //----------------------------------------------------------------------------
 
 /*
  * For custom handling of keyboard
  */
-class CustTabGroup : public fltk::TabGroup {
-  Tooltip *toolTip;
+class CustTabGroup : public Fl_Tabs {
+  Fl_Tooltip *toolTip;
   bool tooltipEnabled;
   bool buttonPushed;
 public:
    CustTabGroup (int x, int y, int ww, int wh, const char *lbl=0) :
-      TabGroup(x,y,ww,wh,lbl) {
+      Fl_Tabs(x,y,ww,wh,lbl) {
+         Fl_Group::current(0);
+         box(FL_NO_BOX);
          // The parameter pager is cloned, so free it.
-         CustShrinkTabPager *cp = new CustShrinkTabPager();
-         this->pager(cp);
-         delete cp;
-         toolTip = new Tooltip;
+//       CustShrinkTabPager *cp = new CustShrinkTabPager();
+//       this->pager(cp);
+//       delete cp;
+         toolTip = new Fl_Tooltip;
          tooltipEnabled = false;
          buttonPushed = false;
       };
@@ -245,32 +246,40 @@
    int handle(int e) {
       // Don't focus with arrow keys
       _MSG("CustTabGroup::handle %d\n", e);
-      fltk::Rectangle r(btn_x,0,BTN_W,BTN_H);
-      if (e == KEY) {
-         int k = event_key();
+//    fltk::Rectangle r(btn_x,0,BTN_W,BTN_H);
+      if (e == FL_KEYBOARD) {
+         int k = Fl::event_key();
          // We're only interested in some flags
-         unsigned modifier = event_state() & (SHIFT | CTRL | ALT);
-         if (k == UpKey || k == DownKey || k == TabKey) {
+         unsigned modifier = Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
+         if (k == FL_Up || k == FL_Down || k == FL_Tab) {
             return 0;
-         } else if (k == LeftKey || k == RightKey) {
-            if (modifier == SHIFT) {
-               int i = value();
-               if (k == LeftKey) {i = i ? i-1 : children()-1;}
+         } else if (k == FL_Left || k == FL_Right) {
+            if (modifier == FL_SHIFT) {
+               int i = find(value());
+               if (k == FL_Left) {i = i ? i-1 : children()-1;}
                else {i++; if (i >= children()) i = 0;}
-               selected_child(child(i));
+               value(child(i));
                return 1;
             }
             // Avoid focus change.
             return 0;
          }
-      } else if (e == FOCUS_CHANGE) {
-         // Update the window title
-         BrowserWindow *bw = a_UIcmd_get_bw_by_widget(selected_child());
-         const char *title = a_History_get_title(NAV_TOP_UIDX(bw), 1);
-         a_UIcmd_set_page_title(bw, title ? title : "");
-      } else if (e == MOVE) {
+      } else if (e == FL_RELEASE) {
+         Fl_Widget *new_focus = which(Fl::event_x(), Fl::event_y());
+
+         if (new_focus && new_focus != value()) {
+            // Update the window title
+            BrowserWindow *bw = a_UIcmd_get_bw_by_widget(new_focus);
+            const char *title = a_History_get_title(NAV_TOP_UIDX(bw), 1);
+
+            value(new_focus);
+            a_UIcmd_set_page_title(bw, title ? title : "");
+      }
+// custom pager
+#if 0
+      } else if (e == FL_MOVE) {
          CustShrinkTabPager *cstp = (CustShrinkTabPager *) pager();
-         if (event_inside(r) && children() > 1) {
+         if (Fl::event_inside(r) && children() > 1) {
             /* We're inside the button area */
             cstp->btn_highlight(true);
             if (prefs.show_tooltip) {
@@ -295,26 +304,27 @@
                }
             }
          }
-      } else if (e == PUSH && event_inside(r) &&
-                 event_button() == 1 && children() > 1) {
+      } else if (e == FL_PUSH && Fl::event_inside(r) &&
+                 Fl::event_button() == 1 && children() > 1) {
          buttonPushed = true;
          return 1;                 /* non-zero */
-      } else if (e == RELEASE) {
-         if (event_inside(r) && event_button() == 1 &&
+      } else if (e == FL_RELEASE) {
+         if (Fl::event_inside(r) && Fl::event_button() == 1 &&
              children() > 1 && buttonPushed) {
-            a_UIcmd_close_bw(a_UIcmd_get_bw_by_widget(selected_child()));
+            a_UIcmd_close_bw(a_UIcmd_get_bw_by_widget(value()));
          } else {
             CustShrinkTabPager *cstp = (CustShrinkTabPager *) pager();
             cstp->btn_highlight(false);
          }
          buttonPushed = false;
-      } else if (e == DRAG) {
+#endif
+      } else if (e == FL_DRAG) {
          /* Ignore this event */
          return 1;
       }
-      int ret = TabGroup::handle(e);
+      int ret = Fl_Tabs::handle(e);
 
-      if (e == PUSH) {
+      if (e == FL_PUSH) {
          /* WORKAROUND: FLTK raises the window on unhandled clicks,
           * which we do not want.
           */
@@ -323,8 +333,8 @@
       return ret;
    }
 
-   void remove (Widget *w) {
-      TabGroup::remove (w);
+   void remove (Fl_Widget *w) {
+      Fl_Tabs::remove (w);
       /* fixup resizable in case we just removed it */
       if (resizable () == w) {
          if (children () > 0)
@@ -333,14 +343,18 @@
             resizable (NULL);
       }
 
-      if (children () < 2)
+      if (children () < 2) {
+         box(FL_NO_BOX);
          hideLabels ();
+      }
    }
 
-   void add (Widget *w) {
-      TabGroup::add (w);
-      if (children () > 1)
+   void add (Fl_Widget *w) {
+      Fl_Tabs::add (w);
+      if (children () > 1) {
+         box(FL_THIN_UP_BOX);
          showLabels ();
+      }
    }
 
    void hideLabels() {
@@ -356,14 +370,14 @@
 
 //----------------------------------------------------------------------------
 
-static void win_cb (fltk::Widget *w, void *cb_data) {
+static void win_cb (Fl_Widget *w, void *cb_data) {
    int choice = 0;
    CustTabGroup *tabs = (CustTabGroup*) cb_data;
 
    if (tabs->children () > 1)
       choice = a_Dialog_choice3 ("Window contains more than one tab.",
-                                 "Close all tabs", "Cancel", NULL);
-   if (choice == 0)
+                                 "Cancel", "Close all tabs", NULL);
+   if (choice == 1)
       while (tabs->children())
          a_UIcmd_close_bw(a_UIcmd_get_bw_by_widget(tabs->child(0)));
 }
@@ -376,14 +390,14 @@
    BrowserWindow *bw;
    for (int i = 0; i < a_Bw_num(); ++i) {
       bw = a_Bw_get(i);
-      if (((fltk::Widget*)bw->ui)->contains((fltk::Widget*)v_wid))
+      if (((Fl_Widget*)bw->ui)->contains((Fl_Widget*)v_wid))
          return bw;
    }
    return NULL;
 }
 
 /*
- * FLTK regards SHIFT + {LeftKey, Right} as navigation keys.
+ * FLTK regards SHIFT + {Left, Right} as navigation keys.
  * Special handling is required to override it. Here we route
  * these events directly to the recipient.
  * TODO: focus is not remembered correctly.
@@ -405,7 +419,7 @@
 {
    BrowserWindow *old_bw = (BrowserWindow*)vbw;
    BrowserWindow *new_bw = NULL;
-   Window *win;
+   Fl_Window *win;
 
    if (ww <= 0 || wh <= 0) {
       // Set default geometry from dillorc.
@@ -415,15 +429,15 @@
 
    if (xid)
       win = new Xembed(xid, ww, wh);
+   else if (prefs.buffered_drawing != 2)
+      win = new Fl_Window(ww, wh);
    else
-      win = new Window(ww, wh);
+      win = new Fl_Double_Window(ww, wh);
 
-   win->shortcut(0); // Ignore Escape
-   if (prefs.buffered_drawing != 2)
-      win->clear_double_buffer();
-   win->set_flag(RAW_LABEL);
+   Fl_Group::current(0);
+//may need a handler for this
+// win->shortcut(0); // Ignore Escape
    CustTabGroup *DilloTabs = new CustTabGroup(0, 0, ww, wh);
-   DilloTabs->clear_tab_to_focus();
    DilloTabs->selection_color(156);
    win->add(DilloTabs);
 
@@ -440,10 +454,7 @@
 
    if (old_bw == NULL && prefs.xpos >= 0 && prefs.ypos >= 0) {
       // position the first window according to preferences
-      fltk::Rectangle r;
-      new_ui->window()->borders(&r);
-      // borders() gives x and y border sizes as negative values
-      new_ui->window()->position(prefs.xpos - r.x(), prefs.ypos - r.y());
+      new_ui->window()->position(prefs.xpos, prefs.ypos);
    }
 
    // Now create the Dw render layout and viewport
@@ -541,15 +552,14 @@
 
    MSG("a_UIcmd_close_bw\n");
    a_Bw_stop_clients(bw, BW_Root + BW_Img + BW_Force);
-   delete(layout);
    if (ui->tabs()) {
       ui->tabs()->remove(ui);
-      ui->tabs()->value(ui->tabs()->children() - 1);
-      if (ui->tabs()->value() != -1)
-         ui->tabs()->selected_child()->take_focus();
+      if (ui->tabs()->value())
+         ui->tabs()->value()->take_focus();
       else
          ui->tabs()->window()->hide();
    }
+   delete(layout);
    delete(ui);
 
    a_Bw_free(bw);
@@ -564,9 +574,9 @@
    int choice = 0;
 
    if (a_Bw_num() > 1)
-      choice = a_Dialog_choice3 ("More than one open tab or Window.",
-         "Close all tabs and windows", "Cancel", NULL);
-   if (choice == 0)
+      choice = a_Dialog_choice3 ("More than one open tab or window.",
+         "Cancel", "Close all tabs and windows", NULL);
+   if (choice == 1)
       while ((bw = a_Bw_get(0)))
          a_UIcmd_close_bw((void*)bw);
 }
@@ -657,7 +667,7 @@
    BrowserWindow *new_bw = UIcmd_tab_new(vbw);
 
    if (focus)
-      BW2UI(new_bw)->tabs()->selected_child(BW2UI(new_bw));
+      BW2UI(new_bw)->tabs()->value(BW2UI(new_bw));
 
    UIcmd_open_url_nbw(new_bw, url);
 }
@@ -1225,7 +1235,7 @@
    const int size = 128;
    char title[size];
 
-   if (a_UIcmd_get_bw_by_widget(BW2UI(bw)->tabs()->selected_child()) == bw) {
+   if (a_UIcmd_get_bw_by_widget(BW2UI(bw)->tabs()->value()) == bw) {
       // This is the focused bw, set window title
       if (snprintf(title, size, "Dillo: %s", label) >= size) {
          uint_t i = MIN(size - 4, 1 + a_Utf8_end_of_char(title, size - 8));
--- a/src/utf8.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/utf8.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -9,7 +9,7 @@
  * (at your option) any later version.
  */
 
-#include <fltk/utf.h>
+#include <FL/fl_utf8.h>
 
 #include "../dlib/dlib.h"    /* TRUE/FALSE */
 #include "utf8.hh"
@@ -45,7 +45,7 @@
  */
 uint_t a_Utf8_decode(const char* str, const char* end, int* len)
 {
-   return utf8decode(str, end, len);
+   return fl_utf8decode(str, end, len);
 }
 
 /*
@@ -53,7 +53,7 @@
  */
 int a_Utf8_encode(unsigned int ucs, char *buf)
 {
-   return utf8encode(ucs, buf);
+   return fl_utf8encode(ucs, buf);
 }
 
 /*
@@ -63,7 +63,7 @@
  */
 int a_Utf8_test(const char* src, unsigned int srclen)
 {
-   return utf8test(src, srclen);
+   return fl_utf8test(src, srclen);
 }
 
 /*
--- a/src/xembed.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/xembed.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -12,14 +12,14 @@
 #include <string.h>
 #include <ctype.h>
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
-#include <fltk/events.h>
-#include <fltk/x.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,
@@ -41,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,
@@ -60,35 +60,38 @@
    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
 Xembed::handle(int e) {
-   if (e == fltk::PUSH)
+   if (e == FL_PUSH)
       sendXembedEvent(XEMBED_REQUEST_FOCUS);
 
-   return Window::handle(e);
+   return Fl_Window::handle(e);
 }
 
-static int event_handler(int e, fltk::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;
@@ -106,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) {
-   fltk::Window *window = this;
-   Colormap colormap = fltk::xcolormap;
+   Fl_Window *window = this;
+   Colormap colormap = fl_colormap;
 
    XSetWindowAttributes attr;
    attr.border_pixel = 0;
@@ -133,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) {};
@@ -154,12 +157,15 @@
 
 int
 Xembed::handle(int e) {
-   return Window::handle(e);
+   return Fl_Window::handle(e);
 }
 
 void
 Xembed::create() {
-   Window::create();
+#if 0
+PORT1.3
+   Fl_Window::create();
+#endif
 }
 
 #endif
--- a/src/xembed.hh	Fri Feb 11 02:40:32 2011 +0000
+++ b/src/xembed.hh	Fri Feb 25 08:37:13 2011 +0000
@@ -1,11 +1,11 @@
 #ifndef __XEMBED_HH__
 #define __XEMBED_HH__
 
-#include <fltk/Window.h>
+#include <FL/Fl_Window.H>
 
 #include "d_size.h"
 
-class Xembed : public fltk::Window {
+class Xembed : public Fl_Window {
    private:
       uint32_t xid;
       void createInternal(uint32_t parent);
@@ -13,7 +13,7 @@
       void sendXembedEvent(uint32_t message);
 
    public:
-      Xembed(uint32_t xid, int _w, int _h) : fltk::Window(_w, _h) {
+      Xembed(uint32_t xid, int _w, int _h) : Fl_Window(_w, _h) {
          this->xid = xid;
       };
       void create();
--- a/test/dw_anchors_test.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_anchors_test.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -20,8 +20,8 @@
 
 
 #include <ctype.h>
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl_Window.H>
+#include <FL/Fl.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -36,7 +36,7 @@
 
 static FltkPlatform *platform;
 static Layout *layout;
-static ::fltk::Window *window;
+static Fl_Window *window;
 static FltkViewport *viewport;
 static Style *topWidgetStyle, *widgetStyle, *wordStyle, *headingStyle;
 static Textblock *topTextblock = NULL;
@@ -47,7 +47,7 @@
    "six", "seven", "eight", "nine", "ten"
 };
 
-static void anchorCallback (::fltk::Widget *widget, void *data)
+static void anchorCallback (Fl_Widget *widget, void *data)
 {
    layout->setAnchor (numbers[(long)data]);
 }
@@ -87,7 +87,7 @@
 
    textblockNo++;
    if (textblockNo < 10)
-      ::fltk::repeat_timeout (1, textTimeout, NULL);
+      Fl::repeat_timeout (1, textTimeout, NULL);
 
 }
 
@@ -98,7 +98,7 @@
    platform = new FltkPlatform ();
    layout = new Layout (platform);
 
-   window = new ::fltk::Window(250, 200, "Dw Anchors Test");
+   window = new Fl_Window(250, 200, "Dw Anchors Test");
    window->begin();
 
    viewport = new FltkViewport (50, 0, 200, 200);
@@ -109,10 +109,9 @@
       strcpy (buf, numbers[i]);
       buf[0] = toupper (buf[0]);
       buttonLabel[i] = strdup(buf);
-      ::fltk::Button *button =
-           new ::fltk::Button(0, 20 * i, 50, 20, buttonLabel[i]);
+      Fl_Button *button = new Fl_Button(0, 20 * i, 50, 20, buttonLabel[i]);
       button->callback (anchorCallback, (void*)i);
-      button->when (::fltk::WHEN_RELEASE);
+      button->when (FL_WHEN_RELEASE);
    }
 
    FontAttrs fontAttrs;
@@ -124,7 +123,7 @@
 
    StyleAttrs styleAttrs;
    styleAttrs.initValues ();
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
    styleAttrs.margin.setVal (5);
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -140,15 +139,15 @@
 
    fontAttrs.size = 28;
    fontAttrs.weight = 700;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
    headingStyle = Style::create (layout, &styleAttrs);
 
-   ::fltk::add_timeout (0, textTimeout, NULL);
+   Fl::add_timeout (0, textTimeout, NULL);
 
    window->resizable(viewport);
    window->show();
 
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    topWidgetStyle->unref ();
    widgetStyle->unref ();
--- a/test/dw_border_test.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_border_test.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl_Window.H>
+#include <FL/Fl.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -38,7 +38,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(200, 300, "Dw Border Test");
+   Fl_Window *window = new Fl_Window(200, 300, "Dw Border Test");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 200, 300);
@@ -58,7 +58,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -115,7 +115,7 @@
 
    window->resizable(viewport);
    window->show();
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    widgetStyle2->unref();
    wordStyle->unref();
--- a/test/dw_example.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_example.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl_Window.H>
+#include <FL/Fl.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -33,7 +33,7 @@
    dw::fltk::FltkPlatform *platform = new dw::fltk::FltkPlatform ();
    dw::core::Layout *layout = new dw::core::Layout (platform);
 
-   fltk::Window *window = new fltk::Window(200, 300, "Dw Example");
+   Fl_Window *window = new Fl_Window(200, 300, "Dw Example");
    window->begin();
 
    dw::fltk::FltkViewport *viewport =
@@ -95,7 +95,7 @@
 
    window->resizable(viewport);
    window->show();
-   int errorCode = fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_find_test.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_find_test.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,9 +19,9 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
-
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+#include <FL/Fl_Box.H>
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
 #include "../dw/fltkviewport.hh"
@@ -35,12 +35,12 @@
 
 static FltkPlatform *platform;
 static Layout *layout;
-static ::fltk::Window *window;
+static Fl_Window *window;
 static FltkViewport *viewport;
-static ::fltk::Button *findButton, *resetButton;
-static ::fltk::Widget *resultLabel;
+static Fl_Button *findButton, *resetButton;
+static Fl_Widget *resultLabel;
 
-static void findCallback (::fltk::Widget *widget, void *data)
+static void findCallback (Fl_Widget *widget, void *data)
 {
    //switch(layout->search ("worm", true)) {
    switch(layout->search ("WORM", false, false)) {
@@ -60,7 +60,7 @@
    resultLabel->redraw ();
 }
 
-static void resetCallback (::fltk::Widget *widget, void *data)
+static void resetCallback (Fl_Widget *widget, void *data)
 {
    layout->resetSearch ();
    resultLabel->label("---");
@@ -72,21 +72,21 @@
    platform = new FltkPlatform ();
    layout = new Layout (platform);
 
-   window = new ::fltk::Window(200, 300, "Dw Find Test");
+   window = new Fl_Window(200, 300, "Dw Find Test");
    window->begin();
 
    viewport = new FltkViewport (0, 0, 200, 280);
    layout->attachView (viewport);
 
-   findButton = new ::fltk::Button(0, 280, 50, 20, "Find");
+   findButton = new Fl_Button(0, 280, 50, 20, "Find");
    findButton->callback (findCallback, NULL);
-   findButton->when (::fltk::WHEN_RELEASE);
+   findButton->when (FL_WHEN_RELEASE);
 
-   resetButton = new ::fltk::Button(50, 280, 50, 20, "Reset");
+   resetButton = new Fl_Button(50, 280, 50, 20, "Reset");
    resetButton->callback (resetCallback, NULL);
-   resetButton->when (::fltk::WHEN_RELEASE);
+   resetButton->when (FL_WHEN_RELEASE);
 
-   resultLabel = new ::fltk::Widget(100, 280, 100, 20, "---");
+   resultLabel = new Fl_Box(100, 280, 100, 20, "---");
 
    FontAttrs fontAttrs;
    fontAttrs.name = "Bitstream Charter";
@@ -97,7 +97,7 @@
 
    StyleAttrs styleAttrs;
    styleAttrs.initValues ();
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
    styleAttrs.margin.setVal (10);
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -143,7 +143,7 @@
 
    window->resizable(viewport);
    window->show();
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_images_scaled.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_images_scaled.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -87,7 +87,7 @@
    }
 
    if(imgRow < 200)
-      ::fltk::repeat_timeout (0.5, imageDrawTimeout, NULL);
+      Fl::repeat_timeout (0.5, imageDrawTimeout, NULL);
 }
 
 int main(int argc, char **argv)
@@ -95,7 +95,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(410, 210, "Dw Scaled Image");
+   Fl_Window *window = new Fl_Window(410, 210, "Dw Scaled Image");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 410, 210);
@@ -113,7 +113,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -142,10 +142,10 @@
    window->resizable(viewport);
    window->show();
 
-   ::fltk::add_timeout (2.0, imageInitTimeout, NULL);
-   ::fltk::add_timeout (0.1, imageDrawTimeout, NULL);
+   Fl::add_timeout (2.0, imageInitTimeout, NULL);
+   Fl::add_timeout (0.1, imageDrawTimeout, NULL);
 
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_images_scaled2.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_images_scaled2.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -64,7 +64,7 @@
    }
 
    if(imgRow < 200)
-      ::fltk::repeat_timeout (0.5, imageDrawTimeout, NULL);
+      Fl::repeat_timeout (0.5, imageDrawTimeout, NULL);
 }
 
 int main(int argc, char **argv)
@@ -72,7 +72,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(410, 210, "Dw Scaled Image 2");
+   Fl_Window *window = new Fl_Window(410, 210, "Dw Scaled Image 2");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 410, 210);
@@ -88,7 +88,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -137,10 +137,10 @@
    window->resizable(viewport);
    window->show();
 
-   ::fltk::add_timeout (3.0, imageInitTimeout, NULL);
-   ::fltk::add_timeout (0.1, imageDrawTimeout, NULL);
+   Fl::add_timeout (3.0, imageInitTimeout, NULL);
+   Fl::add_timeout (0.1, imageDrawTimeout, NULL);
 
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_images_simple.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_images_simple.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -66,7 +66,7 @@
    }
 
    if(imgRow < 200)
-      ::fltk::repeat_timeout (0.5, imageDrawTimeout, NULL);
+      Fl::repeat_timeout (0.5, imageDrawTimeout, NULL);
 }
 */
 
@@ -88,7 +88,7 @@
    }
 
    if(imgRow < 200)
-      ::fltk::repeat_timeout (0.5, imageDrawTimeout, NULL);
+      Fl::repeat_timeout (0.5, imageDrawTimeout, NULL);
 }
 
 int main(int argc, char **argv)
@@ -96,7 +96,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(410, 210, "Dw Simple Image");
+   Fl_Window *window = new Fl_Window(410, 210, "Dw Simple Image");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 410, 210);
@@ -112,7 +112,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -141,10 +141,10 @@
    window->resizable(viewport);
    window->show();
 
-   ::fltk::add_timeout (2.0, imageInitTimeout, NULL);
-   ::fltk::add_timeout (0.1, imageDrawTimeout, NULL);
+   Fl::add_timeout (2.0, imageInitTimeout, NULL);
+   Fl::add_timeout (0.1, imageDrawTimeout, NULL);
 
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_imgbuf_mem_test.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_imgbuf_mem_test.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -17,11 +17,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
-
-#include <fltk/Window.h>
-#include <fltk/run.h>
-
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
 
--- a/test/dw_links.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_links.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -76,7 +76,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(200, 300, "Dw Links");
+   Fl_Window *window = new Fl_Window(200, 300, "Dw Links");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 200, 300);
@@ -92,7 +92,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -153,7 +153,7 @@
 
    window->resizable(viewport);
    window->show();
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_links2.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_links2.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,9 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
+#include <FL/Fl_Box.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -78,22 +79,20 @@
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(200, 300, "Dw Links2");
+   Fl_Window *window = new Fl_Window(200, 300, "Dw Links2");
    window->begin();
-    ::fltk::Widget *Panel = new ::fltk::Widget(0, 0, ww, lh, "CONTROL PANEL");
+    Fl_Widget *Panel = new Fl_Box(0, 0, ww, lh, "CONTROL PANEL");
 
-    Panel->color(::fltk::GRAY15);
-    Panel->labelcolor(::fltk::WHITE);
-    ::fltk::Widget *Main =
-       new ::fltk::Widget(0, lh, ww, wh - 2*lh, "MAIN RENDERING AREA");
-    Main->color(::fltk::GRAY20);
-    Main->labelcolor(::fltk::WHITE);
+    Panel->color(FL_GRAY_RAMP + 3);
+    Panel->labelcolor(FL_WHITE);
+    Fl_Widget *Main = new Fl_Box(0, lh, ww, wh - 2*lh, "MAIN RENDERING AREA");
+    Main->color(FL_GRAY_RAMP + 4);
+    Main->labelcolor(FL_WHITE);
     MainIdx = window->find(Main);
     /* status bar */
-    ::fltk::Widget *Bar =
-       new ::fltk::Widget(0, wh - lh, 200, lh, "STATUS BAR...");
-    Bar->color(::fltk::GRAY15);
-    Bar->labelcolor(::fltk::WHITE);
+    Fl_Widget *Bar = new Fl_Box(0, wh - lh, 200, lh, "STATUS BAR...");
+    Bar->color(FL_GRAY_RAMP + 3);
+    Bar->labelcolor(FL_WHITE);
 
     window->resizable(Main);
    window->end();
@@ -120,7 +119,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -181,7 +180,7 @@
 
    window->resizable(viewport);
    window->show();
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_lists.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_lists.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -38,7 +38,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(200, 300, "Dw Lists");
+   Fl_Window *window = new Fl_Window(200, 300, "Dw Lists");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 200, 300);
@@ -54,7 +54,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -126,7 +126,7 @@
 
    window->resizable(viewport);
    window->show();
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_resource_test.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_resource_test.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -39,7 +39,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(410, 210, "Dw Resource test");
+   Fl_Window *window = new Fl_Window(410, 210, "Dw Resource test");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 410, 210);
@@ -55,7 +55,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xffffff);
@@ -90,7 +90,7 @@
    window->resizable(viewport);
    window->show();
 
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_table.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_table.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -38,7 +38,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(300, 300, "Dw Table");
+   Fl_Window *window = new Fl_Window(300, 300, "Dw Table");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 300, 300);
@@ -62,7 +62,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    Style *tableStyle = Style::create (layout, &styleAttrs);
 
@@ -107,7 +107,7 @@
 
    window->resizable(viewport);
    window->show();
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_table_aligned.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_table_aligned.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -38,7 +38,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(200, 300, "Dw Table Aligned");
+   Fl_Window *window = new Fl_Window(200, 300, "Dw Table Aligned");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 200, 300);
@@ -57,7 +57,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    styleAttrs.color = Color::create (layout, 0x000000);
    styleAttrs.backgroundColor = Color::create (layout, 0xa0a0a0);
@@ -111,7 +111,7 @@
 
    window->resizable(viewport);
    window->show();
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete layout;
 
--- a/test/dw_ui_test.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/dw_ui_test.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,8 +19,8 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/run.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
 
 #include "../dw/core.hh"
 #include "../dw/fltkcore.hh"
@@ -43,7 +43,7 @@
    FltkPlatform *platform = new FltkPlatform ();
    Layout *layout = new Layout (platform);
 
-   ::fltk::Window *window = new ::fltk::Window(400, 400, "Dw UI Test");
+   Fl_Window *window = new Fl_Window(400, 400, "Dw UI Test");
    window->begin();
 
    FltkViewport *viewport = new FltkViewport (0, 0, 400, 400);
@@ -61,7 +61,7 @@
    fontAttrs.weight = 400;
    fontAttrs.style = FONT_STYLE_NORMAL;
    fontAttrs.letterSpacing = 0;
-   styleAttrs.font = Font::create (layout, &fontAttrs);
+   styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs);
 
    Style *tableStyle = Style::create (layout, &styleAttrs);
 
@@ -232,7 +232,7 @@
 
    window->resizable(viewport);
    window->show();
-   int errorCode = ::fltk::run();
+   int errorCode = Fl::run();
 
    delete form;
    delete layout;
--- a/test/fltk_browser.cc	Fri Feb 11 02:40:32 2011 +0000
+++ b/test/fltk_browser.cc	Fri Feb 25 08:37:13 2011 +0000
@@ -19,28 +19,24 @@
 
 
 
-#include <fltk/Window.h>
-#include <fltk/Browser.h>
-#include <fltk/MultiBrowser.h>
-#include <fltk/Item.h>
-#include <fltk/run.h>
-
-using namespace fltk;
+#include <FL/Fl_Window.H>
+#include <FL/Fl_Browser.H>
+#include <FL/Fl.H>
 
 int main (int argc, char *argv[])
 {
-   Window *window = new Window (300, 300, "FLTK Browser");
+   Fl_Window *window = new Fl_Window (300, 300, "FLTK Browser");
    window->begin ();
-   Browser *browser = new MultiBrowser (0, 0, 300, 300);
+   Fl_Browser *browser = new Fl_Browser (0, 0, 300, 300);
    browser->begin ();
 
    for (int i = 0; i < 10; i++) {
-      new Item ("first");
-      new Item ("second");
-      new Item ("third");
+      browser->add("first");
+      browser->add("second");
+      browser->add("third");
    }
 
    window->resizable(browser);
    window->show();
-   return run();
+   return Fl::run();
 }