Code

family name field on svgfonts dialog now properly saves attribute. Should do the...
[inkscape.git] / src / ui / dialog / input.cpp
index 9b2681b62a9d910149421953f66eff0615e41bf7..25f1237977508568ed7a9d355067334ac627960f 100644 (file)
@@ -1,7 +1,31 @@
 
 
 /* XPM */
-static char *eraser[] = {
+static char const * core_xpm[] = {
+"16 16 4 1",
+"      c None",
+".     c #808080",
+"+     c #000000",
+"@     c #FFFFFF",
+"                ",
+"                ",
+"                ",
+"    .++++++.    ",
+"    +@+@@+@+    ",
+"    +@+@@+@+    ",
+"    +.+..+.+    ",
+"    +@@@@@@+    ",
+"    +@@@@@@+    ",
+"    +@@@@@@+    ",
+"    +@@@@@@+    ",
+"    +@@@@@@+    ",
+"    .++++++.    ",
+"                ",
+"                ",
+"                "};
+
+/* XPM */
+static char const *eraser[] = {
 /* columns rows colors chars-per-pixel */
 "16 16 5 1",
 "  c black",
@@ -29,7 +53,7 @@ static char *eraser[] = {
 };
 
 /* XPM */
-static char *mouse[] = {
+static char const *mouse[] = {
 /* columns rows colors chars-per-pixel */
 "16 16 3 1",
 "  c black",
@@ -55,7 +79,7 @@ static char *mouse[] = {
 };
 
 /* XPM */
-static char *pen[] = {
+static char const *pen[] = {
 /* columns rows colors chars-per-pixel */
 "16 16 3 1",
 "  c black",
@@ -81,7 +105,7 @@ static char *pen[] = {
 };
 
 /* XPM */
-static char *sidebuttons[] = {
+static char const *sidebuttons[] = {
 /* columns rows colors chars-per-pixel */
 "16 16 4 1",
 "  c black",
@@ -108,7 +132,7 @@ static char *sidebuttons[] = {
 };
 
 /* XPM */
-static char *tablet[] = {
+static char const *tablet[] = {
 /* columns rows colors chars-per-pixel */
 "16 16 3 1",
 "  c black",
@@ -134,7 +158,7 @@ static char *tablet[] = {
 };
 
 /* XPM */
-static char *tip[] = {
+static char const *tip[] = {
 /* columns rows colors chars-per-pixel */
 "16 16 5 1",
 "  c black",
@@ -157,10 +181,106 @@ static char *tip[] = {
 "OOO . OOOOOOOOOO",
 "OO . OOOOOOOOOOO",
 "OO  OOOOOOOOOOOO",
-"OOOOOOOOOOOOOOOO",
-"OOOOOOOOOOOOOOOO"
+"OOOOXXXXXOOOOOOO",
+"OOOOOOOOOXXXXXOO"
+};
+
+/* XPM */
+static char const *button_none[] = {
+/* columns rows colors chars-per-pixel */
+"8 8 3 1",
+"  c black",
+". c #808080",
+"X c None",
+/* pixels */
+"XXXXXXXX",
+"XX .. XX",
+"X .XX. X",
+"X.XX X.X",
+"X.X XX.X",
+"X .XX. X",
+"XX .. XX",
+"XXXXXXXX"
+};
+/* XPM */
+static char const *button_off[] = {
+/* columns rows colors chars-per-pixel */
+"8 8 4 1",
+"  c black",
+". c #808080",
+"X c gray100",
+"o c None",
+/* pixels */
+"oooooooo",
+"oo.  .oo",
+"o. XX .o",
+"o XXXX o",
+"o XXXX o",
+"o. XX .o",
+"oo.  .oo",
+"oooooooo"
+};
+/* XPM */
+static char const *button_on[] = {
+/* columns rows colors chars-per-pixel */
+"8 8 3 1",
+"  c black",
+". c green",
+"X c None",
+/* pixels */
+"XXXXXXXX",
+"XX    XX",
+"X  ..  X",
+"X .... X",
+"X .... X",
+"X  ..  X",
+"XX    XX",
+"XXXXXXXX"
 };
 
+/* XPM */
+static char const * axis_none_xpm[] = {
+"24 8 3 1",
+"      c None",
+".     c #000000",
+"+     c #808080",
+"                        ",
+"  .++++++++++++++++++.  ",
+" .+               . .+. ",
+" +          . . .     + ",
+" +     . . .          + ",
+" .+. .               +. ",
+"  .++++++++++++++++++.  ",
+"                        "};
+/* XPM */
+static char const * axis_off_xpm[] = {
+"24 8 4 1",
+"      c None",
+".     c #808080",
+"+     c #000000",
+"@     c #FFFFFF",
+"                        ",
+"  .++++++++++++++++++.  ",
+" .+@@@@@@@@@@@@@@@@@@+. ",
+" +@@@@@@@@@@@@@@@@@@@@+ ",
+" +@@@@@@@@@@@@@@@@@@@@+ ",
+" .+@@@@@@@@@@@@@@@@@@+. ",
+"  .++++++++++++++++++.  ",
+"                        "};
+/* XPM */
+static char const * axis_on_xpm[] = {
+"24 8 3 1",
+"      c None",
+".     c #000000",
+"+     c #00FF00",
+"                        ",
+"  ....................  ",
+" ..++++++++++++++++++.. ",
+" .++++++++++++++++++++. ",
+" .++++++++++++++++++++. ",
+" ..++++++++++++++++++.. ",
+"  ....................  ",
+"                        "};
 
 
 
@@ -172,31 +292,31 @@ static char *tip[] = {
 #include <glibmm/i18n.h>
 #include <gtkmm/comboboxtext.h>
 #include <gtkmm/enums.h>
+#include <gtkmm/eventbox.h>
 #include <gtkmm/frame.h>
 #include <gtkmm/image.h>
 #include <gtkmm/menubar.h>
 #include <gtkmm/notebook.h>
 #include <gtkmm/paned.h>
+#include <gtkmm/progressbar.h>
 #include <gtkmm/scrolledwindow.h>
 #include <gtkmm/table.h>
-#include <gtkmm/eventbox.h>
 #include <gtkmm/treemodel.h>
 #include <gtkmm/treemodelcolumn.h>
 #include <gtkmm/treestore.h>
 #include <gtkmm/treeview.h>
 
 #include "ui/widget/panel.h"
+#include "device-manager.h"
 
 #include "input.h"
 
+using Inkscape::InputDevice;
+
 namespace Inkscape {
 namespace UI {
 namespace Dialog {
 
-static void createFakeList();
-GdkDevice fakeout[5];
-static GList* fakeList = 0;
-
 
 
 class MyModelColumns : public Gtk::TreeModel::ColumnRecord
@@ -205,7 +325,7 @@ public:
     Gtk::TreeModelColumn<Glib::ustring>                filename;
     Gtk::TreeModelColumn<Glib::ustring>                description;
     Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> >  thumbnail;
-    Gtk::TreeModelColumn<GdkDevice*>                   device;
+    Gtk::TreeModelColumn<InputDevice const *>          device;
 
     MyModelColumns() { add(filename); add(description); add(thumbnail); add(device); }
 };
@@ -216,6 +336,7 @@ public:
     virtual ~InputDialogImpl() {}
 
 private:
+    Glib::RefPtr<Gdk::Pixbuf> corePix;
     Glib::RefPtr<Gdk::Pixbuf> penPix;
     Glib::RefPtr<Gdk::Pixbuf> mousePix;
     Glib::RefPtr<Gdk::Pixbuf> tipPix;
@@ -223,13 +344,23 @@ private:
     Glib::RefPtr<Gdk::Pixbuf> eraserPix;
     Glib::RefPtr<Gdk::Pixbuf> sidebuttonsPix;
 
+    Glib::RefPtr<Gdk::Pixbuf> buttonsNonePix;
+    Glib::RefPtr<Gdk::Pixbuf> buttonsOnPix;
+    Glib::RefPtr<Gdk::Pixbuf> buttonsOffPix;
+
+    Glib::RefPtr<Gdk::Pixbuf> axisNonePix;
+    Glib::RefPtr<Gdk::Pixbuf> axisOnPix;
+    Glib::RefPtr<Gdk::Pixbuf> axisOffPix;
+
     std::map<Glib::ustring, std::set<guint> > buttonMap;
+    std::map<Glib::ustring, std::map<guint, std::pair<guint, gdouble> > > axesMap;
 
     GdkInputSource lastSourceSeen;
     Glib::ustring lastDevnameSeen;
 
     MyModelColumns cols;
     Glib::RefPtr<Gtk::TreeStore> store;
+    Gtk::TreeIter tabletIter;
     Gtk::TreeView tree;
     Gtk::Frame frame2;
     Gtk::Frame testFrame;
@@ -241,19 +372,40 @@ private:
     Gtk::Label devKeyCount;
     Gtk::Label devAxesCount;
     Gtk::ComboBoxText axesCombo;
+    Gtk::ProgressBar axesValues[6];
     Gtk::ComboBoxText buttonCombo;
-    Gtk::ComboBoxText modeCombo;
+    Gtk::ComboBoxText linkCombo;
+    sigc::connection linkConnection;
     Gtk::Label keyVal;
     Gtk::Entry keyEntry;
     Gtk::Table devDetails;
     Gtk::HPaned confSplitter;
     Gtk::Notebook topHolder;
     Gtk::Image testThumb;
+    Gtk::Image testButtons[24];
+    Gtk::Image testAxes[8];
+    Gtk::Table imageTable;
     Gtk::EventBox testDetector;
 
     void setupValueAndCombo( gint reported, gint actual, Gtk::Label& label, Gtk::ComboBoxText& combo );
+    void updateTestButtons( Glib::ustring const& key, gint hotButton );
+    void updateTestAxes( Glib::ustring const& key, GdkDevice* dev );
+    void mapAxesValues( Glib::ustring const& key, guint numAxes, gdouble const * axes, GdkDevice* dev);
+    Glib::ustring getKeyFor( GdkDevice* device );
     bool eventSnoop(GdkEvent* event);
-    void foo();
+    void linkComboChanged();
+    void resyncToSelection();
+    void handleDeviceChange(const Glib::RefPtr<InputDevice>& device);
+    void updateDeviceAxes(const Glib::RefPtr<InputDevice>& device);
+    void updateDeviceButtons(const Glib::RefPtr<InputDevice>& device);
+    void updateDeviceLinks(const Glib::RefPtr<InputDevice>& device);
+
+    bool findDevice(const Gtk::TreeModel::iterator& iter,
+                    Glib::ustring id,
+                    Gtk::TreeModel::iterator* result);
+    bool findDeviceByLink(const Gtk::TreeModel::iterator& iter,
+                          Glib::ustring link,
+                          Gtk::TreeModel::iterator* result);
 };
 
 
@@ -268,6 +420,7 @@ InputDialog &InputDialog::getInstance()
 InputDialogImpl::InputDialogImpl() :
     InputDialog(),
 
+    corePix(Gdk::Pixbuf::create_from_xpm_data(core_xpm)),
     penPix(Gdk::Pixbuf::create_from_xpm_data(pen)),
     mousePix(Gdk::Pixbuf::create_from_xpm_data(mouse)),
     tipPix(Gdk::Pixbuf::create_from_xpm_data(tip)),
@@ -275,6 +428,14 @@ InputDialogImpl::InputDialogImpl() :
     eraserPix(Gdk::Pixbuf::create_from_xpm_data(eraser)),
     sidebuttonsPix(Gdk::Pixbuf::create_from_xpm_data(sidebuttons)),
 
+    buttonsNonePix(Gdk::Pixbuf::create_from_xpm_data(button_none)),
+    buttonsOnPix(Gdk::Pixbuf::create_from_xpm_data(button_on)),
+    buttonsOffPix(Gdk::Pixbuf::create_from_xpm_data(button_off)),
+
+    axisNonePix(Gdk::Pixbuf::create_from_xpm_data(axis_none_xpm)),
+    axisOnPix(Gdk::Pixbuf::create_from_xpm_data(axis_on_xpm)),
+    axisOffPix(Gdk::Pixbuf::create_from_xpm_data(axis_off_xpm)),
+
     lastSourceSeen((GdkInputSource)-1),
     lastDevnameSeen(""),
     cols(),
@@ -286,10 +447,11 @@ InputDialogImpl::InputDialogImpl() :
     detailScroller(),
     splitter(),
     split2(),
-    modeCombo(),
-    devDetails(6, 2),
+    linkCombo(),
+    devDetails(12, 2),
     confSplitter(),
-    topHolder()
+    topHolder(),
+    imageTable(8, 7)
 {
     Gtk::Box *contents = _getContents();
 
@@ -301,10 +463,36 @@ InputDialogImpl::InputDialogImpl() :
     splitter.pack1(treeScroller);
     splitter.pack2(split2);
 
-    testDetector.add(testThumb);
+    testDetector.add(imageTable);
     testFrame.add(testDetector);
     testThumb.set(tabletPix);
     testThumb.set_padding(24, 24);
+    imageTable.attach(testThumb, 0, 8, 0, 1, ::Gtk::EXPAND, ::Gtk::EXPAND);
+    {
+        guint col = 0;
+        guint row = 1;
+        for ( guint num = 0; num < G_N_ELEMENTS(testButtons); num++ ) {
+            testButtons[num].set(buttonsNonePix);
+            imageTable.attach(testButtons[num], col, col + 1, row, row + 1, ::Gtk::FILL, ::Gtk::FILL);
+            col++;
+            if (col > 7) {
+                col = 0;
+                row++;
+            }
+        }
+
+        col = 0;
+        for ( guint num = 0; num < G_N_ELEMENTS(testAxes); num++ ) {
+            testAxes[num].set(axisNonePix);
+            imageTable.attach(testAxes[num], col * 2, (col + 1) * 2, row, row + 1, ::Gtk::FILL, ::Gtk::FILL);
+            col++;
+            if (col > 3) {
+                col = 0;
+                row++;
+            }
+        }
+    }
+
 
     topHolder.append_page(confSplitter, "Configuration");
     topHolder.append_page(splitter, "Hardware");
@@ -327,23 +515,22 @@ InputDialogImpl::InputDialogImpl() :
 
     rowNum++;
 
-    lbl = Gtk::manage(new Gtk::Label("Mode:"));
+    lbl = Gtk::manage(new Gtk::Label("Link:"));
     devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
                       ::Gtk::FILL,
                       ::Gtk::SHRINK);
 
-    modeCombo.append_text("Disabled");
-    modeCombo.append_text("Screen");
-    modeCombo.append_text("Window");
-    modeCombo.set_active_text("Disabled");
-    modeCombo.set_sensitive(false);
+    linkCombo.append_text("None");
+    linkCombo.set_active_text("None");
+    linkCombo.set_sensitive(false);
+    linkConnection = linkCombo.signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::linkComboChanged));
 
-    devDetails.attach(modeCombo, 1, 2, rowNum, rowNum + 1,
+    devDetails.attach(linkCombo, 1, 2, rowNum, rowNum + 1,
                       ::Gtk::FILL,
                       ::Gtk::SHRINK);
     rowNum++;
 
-    lbl = Gtk::manage(new Gtk::Label("Reported axes count:"));
+    lbl = Gtk::manage(new Gtk::Label("Axes count:"));
     devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
                       ::Gtk::FILL,
                       ::Gtk::SHRINK);
@@ -353,6 +540,7 @@ InputDialogImpl::InputDialogImpl() :
 
     rowNum++;
 
+/*
     lbl = Gtk::manage(new Gtk::Label("Actual axes count:"));
     devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
                       ::Gtk::FILL,
@@ -362,8 +550,22 @@ InputDialogImpl::InputDialogImpl() :
                       ::Gtk::SHRINK);
 
     rowNum++;
+*/
 
-    lbl = Gtk::manage(new Gtk::Label("Reported button count:"));
+    for ( guint barNum = 0; barNum < static_cast<guint>(G_N_ELEMENTS(axesValues)); barNum++ ) {
+        lbl = Gtk::manage(new Gtk::Label("axis:"));
+        devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
+                          ::Gtk::FILL,
+                          ::Gtk::SHRINK);
+        devDetails.attach(axesValues[barNum], 1, 2, rowNum, rowNum + 1,
+                          ::Gtk::EXPAND,
+                          ::Gtk::SHRINK);
+        axesValues[barNum].set_sensitive(false);
+
+        rowNum++;
+    }
+
+    lbl = Gtk::manage(new Gtk::Label("Button count:"));
     devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
                       ::Gtk::FILL,
                       ::Gtk::SHRINK);
@@ -373,6 +575,7 @@ InputDialogImpl::InputDialogImpl() :
 
     rowNum++;
 
+/*
     lbl = Gtk::manage(new Gtk::Label("Actual button count:"));
     devDetails.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
                       ::Gtk::FILL,
@@ -382,6 +585,7 @@ InputDialogImpl::InputDialogImpl() :
                       ::Gtk::SHRINK);
 
     rowNum++;
+*/
 
     devDetails.attach(keyVal, 0, 2, rowNum, rowNum + 1,
                       ::Gtk::FILL,
@@ -428,44 +632,35 @@ InputDialogImpl::InputDialogImpl() :
 
     tree.set_enable_tree_lines();
     tree.set_headers_visible(false);
-    tree.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::foo));
-
+    tree.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::resyncToSelection));
 
-    GList* devList = gdk_devices_list();
-    if ( !fakeList ) {
-        createFakeList();
-    }
-//     devList = fakeList;
-    if ( devList ) {
-        g_message("Found some");
 
-        {
-            GdkModifierType  defaultModMask = static_cast<GdkModifierType>(gtk_accelerator_get_default_mod_mask());
-            gchar* name = gtk_accelerator_name(GDK_a, defaultModMask);
-            gchar* label = gtk_accelerator_get_label(GDK_a, defaultModMask);
-            g_message("Name: [%s]  label:[%s]", name, label);
-            g_free(name);
-            g_free(label);
-        }
 
+    std::list<InputDevice const *> devList = Inkscape::DeviceManager::getManager().getDevices();
+    if ( !devList.empty() ) {
         row = *(store->append());
         row[cols.description] = "Hardware";
 
-        childrow = *(store->append(row.children()));
+        tabletIter = store->append(row.children());
+        childrow = *tabletIter;
         childrow[cols.description] = "Tablet";
         childrow[cols.thumbnail] = tabletPix;
 
-        for ( GList* curr = devList; curr; curr = g_list_next(curr) ) {
-            GdkDevice* dev = reinterpret_cast<GdkDevice*>(curr->data);
+        for ( std::list<InputDevice const *>::iterator it = devList.begin(); it != devList.end(); ++it ) {
+            InputDevice const* dev = *it;
             if ( dev ) {
-                g_message("device: name[%s] source[0x%x] mode[0x%x] cursor[%s] axis count[%d] key count[%d]", dev->name, dev->source, dev->mode,
-                          dev->has_cursor?"Yes":"no", dev->num_axes, dev->num_keys);
+//                 g_message("device: name[%s] source[0x%x] mode[0x%x] cursor[%s] axis count[%d] key count[%d]", dev->getName().c_str(), dev->getSource(), dev->getMode(),
+//                           dev->hasCursor() ? "Yes":"no", dev->getNumAxes(), dev->getNumKeys());
 
-                if ( dev->source != GDK_SOURCE_MOUSE ) {
+//                 if ( dev->getSource() != Gdk::SOURCE_MOUSE ) {
+                if ( dev ) {
                     deviceRow = *(store->append(childrow.children()));
-                    deviceRow[cols.description] = dev->name;
+                    deviceRow[cols.description] = dev->getName();
                     deviceRow[cols.device] = dev;
-                    switch ( dev->source ) {
+                    switch ( dev->getSource() ) {
+                        case GDK_SOURCE_MOUSE:
+                            deviceRow[cols.thumbnail] = corePix;
+                            break;
                         case GDK_SOURCE_PEN:
                             if (deviceRow[cols.description] == "pad") {
                                 deviceRow[cols.thumbnail] = sidebuttonsPix;
@@ -488,42 +683,230 @@ InputDialogImpl::InputDialogImpl() :
             }
         }
     } else {
-        g_message("NO DEVICES FOUND");
+        g_warning("No devices found");
     }
-
+    Inkscape::DeviceManager::getManager().signalDeviceChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::handleDeviceChange));
+    Inkscape::DeviceManager::getManager().signalAxesChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceAxes));
+    Inkscape::DeviceManager::getManager().signalButtonsChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceButtons));
+    Inkscape::DeviceManager::getManager().signalLinkChanged().connect(sigc::mem_fun(*this, &InputDialogImpl::updateDeviceLinks));
 
     tree.expand_all();
     show_all_children();
 }
 
-void InputDialogImpl::foo() {
+void InputDialogImpl::handleDeviceChange(const Glib::RefPtr<InputDevice>& /*device*/)
+{
+//     g_message("OUCH!!!! for %p  hits %s", &device, device->getId().c_str());
+}
+
+void InputDialogImpl::updateDeviceAxes(const Glib::RefPtr<InputDevice>& device)
+{
+    gint live = device->getLiveAxes();
+
+    std::map<guint, std::pair<guint, gdouble> > existing = axesMap[device->getId()];
+    gint mask = 0x1;
+    for ( gint num = 0; num < 32; num++, mask <<= 1) {
+        if ( (mask & live) != 0 ) {
+            if ( (existing.find(num) == existing.end()) || (existing[num].first < 2) ) {
+                axesMap[device->getId()][num].first = 2;
+                axesMap[device->getId()][num].second = 0.0;
+            }
+        }
+    }
+    updateTestAxes( device->getId(), 0 );
+}
+
+void InputDialogImpl::updateDeviceButtons(const Glib::RefPtr<InputDevice>& device)
+{
+    gint live = device->getLiveButtons();
+    std::set<guint> existing = buttonMap[device->getId()];
+    gint mask = 0x1;
+    for ( gint num = 0; num < 32; num++, mask <<= 1) {
+        if ( (mask & live) != 0 ) {
+            if ( existing.find(num) == existing.end() ) {
+                buttonMap[device->getId()].insert(num);
+            }
+        }
+    }
+    updateTestButtons(device->getId(), -1);
+}
+
+
+bool InputDialogImpl::findDevice(const Gtk::TreeModel::iterator& iter,
+                                 Glib::ustring id,
+                                 Gtk::TreeModel::iterator* result)
+{
+    bool stop = false;
+    const InputDevice* dev = (*iter)[cols.device];
+    if ( dev && (dev->getId() == id) ) {
+        if ( result ) {
+            *result = iter;
+        }
+        stop = true;
+    }
+    return stop;
+}
+
+bool InputDialogImpl::findDeviceByLink(const Gtk::TreeModel::iterator& iter,
+                                       Glib::ustring link,
+                                       Gtk::TreeModel::iterator* result)
+{
+    bool stop = false;
+    const InputDevice* dev = (*iter)[cols.device];
+    if ( dev && (dev->getLink() == link) ) {
+        if ( result ) {
+            *result = iter;
+        }
+        stop = true;
+    }
+    return stop;
+}
+
+void InputDialogImpl::updateDeviceLinks(const Glib::RefPtr<InputDevice>& device)
+{
+//     g_message("Links!!!! for %p  hits [%s]  with link of [%s]", &device, device->getId().c_str(), device->getLink().c_str());
+    Gtk::TreeModel::iterator deviceIter;
+    store->foreach_iter( sigc::bind<Glib::ustring, Gtk::TreeModel::iterator*>(
+                             sigc::mem_fun(*this, &InputDialogImpl::findDevice),
+                             device->getId(),
+                             &deviceIter) );
+
+    if ( deviceIter ) {
+        // Found the device concerned. Can proceed.
+
+        if ( device->getLink().empty() ) {
+            // is now unlinked
+//             g_message("Item %s is unlinked", device->getId().c_str());
+            if ( deviceIter->parent() != tabletIter ) {
+                // Not the child of the tablet. move on up
+                
+                InputDevice const *dev = (*deviceIter)[cols.device];
+                Glib::ustring descr = (*deviceIter)[cols.description];
+                Glib::RefPtr<Gdk::Pixbuf> thumb = (*deviceIter)[cols.thumbnail];
+
+                Gtk::TreeModel::Row deviceRow = *store->append(tabletIter->children());
+                deviceRow[cols.description] = descr;
+                deviceRow[cols.thumbnail] = thumb;
+                deviceRow[cols.device] = dev;
+
+                Gtk::TreeModel::iterator oldParent = deviceIter->parent();
+                store->erase(deviceIter);
+                if ( oldParent->children().empty() ) {
+                    store->erase(oldParent);
+                }
+            }
+        } else {
+            // is linking
+            if ( deviceIter->parent() == tabletIter ) {
+                // Simple case. Not already linked
+
+                Gtk::TreeIter newGroup = store->append(tabletIter->children());
+                (*newGroup)[cols.description] = "Pen";
+                (*newGroup)[cols.thumbnail] = penPix;
+
+                InputDevice const *dev = (*deviceIter)[cols.device];
+                Glib::ustring descr = (*deviceIter)[cols.description];
+                Glib::RefPtr<Gdk::Pixbuf> thumb = (*deviceIter)[cols.thumbnail];
+
+                Gtk::TreeModel::Row deviceRow = *store->append(newGroup->children());
+                deviceRow[cols.description] = descr;
+                deviceRow[cols.thumbnail] = thumb;
+                deviceRow[cols.device] = dev;
+
+                
+                Gtk::TreeModel::iterator linkIter;
+                store->foreach_iter( sigc::bind<Glib::ustring, Gtk::TreeModel::iterator*>(
+                                         sigc::mem_fun(*this, &InputDialogImpl::findDeviceByLink),
+                                         device->getId(),
+                                         &linkIter) );
+                if ( linkIter ) {
+                    dev = (*linkIter)[cols.device];
+                    descr = (*linkIter)[cols.description];
+                    thumb = (*linkIter)[cols.thumbnail];
+
+                    deviceRow = *store->append(newGroup->children());
+                    deviceRow[cols.description] = descr;
+                    deviceRow[cols.thumbnail] = thumb;
+                    deviceRow[cols.device] = dev;
+                    Gtk::TreeModel::iterator oldParent = linkIter->parent();
+                    store->erase(linkIter);
+                    if ( oldParent->children().empty() ) {
+                        store->erase(oldParent);
+                    }
+                }
+
+                Gtk::TreeModel::iterator oldParent = deviceIter->parent();
+                store->erase(deviceIter);
+                if ( oldParent->children().empty() ) {
+                    store->erase(oldParent);
+                }
+                tree.expand_row(Gtk::TreePath(newGroup), true);
+            }
+        }
+    }
+}
+
+void InputDialogImpl::linkComboChanged() {
+    Glib::RefPtr<Gtk::TreeSelection> treeSel = tree.get_selection();
+    Gtk::TreeModel::iterator iter = treeSel->get_selected();
+    if (iter) {
+        Gtk::TreeModel::Row row = *iter;
+        Glib::ustring val = row[cols.description];
+        InputDevice const * dev = row[cols.device];
+        if ( dev ) {
+            if ( linkCombo.get_active_row_number() == 0 ) {
+                // It is the "None" entry
+                DeviceManager::getManager().setLinkedTo(dev->getId(), "");
+            } else {
+                Glib::ustring linkName = linkCombo.get_active_text();
+                std::list<InputDevice const *> devList = Inkscape::DeviceManager::getManager().getDevices();
+                for ( std::list<InputDevice const *>::const_iterator it = devList.begin(); it != devList.end(); ++it ) {
+                    if ( linkName == (*it)->getName() ) {
+                        DeviceManager::getManager().setLinkedTo(dev->getId(), (*it)->getId());
+                        break;
+                    }
+                }
+            }
+        }
+    }
+}
+
+void InputDialogImpl::resyncToSelection() {
     bool clear = true;
     Glib::RefPtr<Gtk::TreeSelection> treeSel = tree.get_selection();
     Gtk::TreeModel::iterator iter = treeSel->get_selected();
     if (iter) {
         Gtk::TreeModel::Row row = *iter;
         Glib::ustring val = row[cols.description];
-        GdkDevice* dev = row[cols.device];
+        InputDevice const * dev = row[cols.device];
         if ( dev ) {
             devDetails.set_sensitive(true);
-            modeCombo.set_sensitive(true);
-            switch( dev->mode ) {
-                case GDK_MODE_DISABLED:
-                    modeCombo.set_active(0);
-                    break;
-                case GDK_MODE_SCREEN:
-                    modeCombo.set_active(1);
-                    break;
-                case GDK_MODE_WINDOW:
-                    modeCombo.set_active(2);
-                    break;
-                default:
-                    ;
+
+            linkConnection.block();
+            linkCombo.clear_items();
+            linkCombo.append_text("None");
+            linkCombo.set_active(0);
+            if ( dev->getSource() != Gdk::SOURCE_MOUSE ) {
+                Glib::ustring linked = dev->getLink();
+                std::list<InputDevice const *> devList = Inkscape::DeviceManager::getManager().getDevices();
+                for ( std::list<InputDevice const *>::const_iterator it = devList.begin(); it != devList.end(); ++it ) {
+                    if ( ((*it)->getSource() != Gdk::SOURCE_MOUSE) && ((*it) != dev) ) {
+                        linkCombo.append_text((*it)->getName().c_str());
+                        if ( (linked.length() > 0) && (linked == (*it)->getId()) ) {
+                            linkCombo.set_active_text((*it)->getName().c_str());
+                        }
+                    }
+                }
+                linkCombo.set_sensitive(true);
+            } else {
+                linkCombo.set_sensitive(false);
             }
+            linkConnection.unblock();
+
             clear = false;
             devName.set_label(row[cols.description]);
-            setupValueAndCombo( dev->num_axes, dev->num_axes, devAxesCount, axesCombo);
-            setupValueAndCombo( dev->num_keys, dev->num_keys, devKeyCount, buttonCombo);
+            setupValueAndCombo( dev->getNumAxes(), dev->getNumAxes(), devAxesCount, axesCombo);
+            setupValueAndCombo( dev->getNumKeys(), dev->getNumKeys(), devKeyCount, buttonCombo);
         }
     }
 
@@ -553,12 +936,169 @@ void InputDialogImpl::setupValueAndCombo( gint reported, gint actual, Gtk::Label
     }
 }
 
+void InputDialogImpl::updateTestButtons( Glib::ustring const& key, gint hotButton )
+{
+    for ( gint i = 0; i < static_cast<gint>(G_N_ELEMENTS(testButtons)); i++ ) {
+        if ( buttonMap[key].find(i) != buttonMap[key].end() ) {
+            if ( i == hotButton ) {
+                testButtons[i].set(buttonsOnPix);
+            } else {
+                testButtons[i].set(buttonsOffPix);
+            }
+        } else {
+            testButtons[i].set(buttonsNonePix);
+        }
+    }
+}
+
+void InputDialogImpl::updateTestAxes( Glib::ustring const& key, GdkDevice* dev )
+{
+    static gdouble epsilon = 0.0001;
+    {
+        Glib::RefPtr<Gtk::TreeSelection> treeSel = tree.get_selection();
+        Gtk::TreeModel::iterator iter = treeSel->get_selected();
+        if (iter) {
+            Gtk::TreeModel::Row row = *iter;
+            Glib::ustring val = row[cols.description];
+            InputDevice const * idev = row[cols.device];
+            if ( !idev || (idev->getId() != key) ) {
+                dev = 0;
+            }
+        }
+    }
+
+
+    for ( gint i = 0; i < static_cast<gint>(G_N_ELEMENTS(testAxes)); i++ ) {
+        if ( axesMap[key].find(i) != axesMap[key].end() ) {
+            switch ( axesMap[key][i].first ) {
+                case 0:
+                case 1:
+                    testAxes[i].set(axisNonePix);
+                    if ( dev && (i < static_cast<gint>(G_N_ELEMENTS(axesValues)) ) ) {
+                        axesValues[i].set_sensitive(false);
+                    }
+                    break;
+                case 2:
+                    testAxes[i].set(axisOffPix);
+                    axesValues[i].set_sensitive(true);
+                    if ( dev && (i < static_cast<gint>(G_N_ELEMENTS(axesValues)) ) ) {
+                        if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) {
+                            axesValues[i].set_sensitive(true);
+                            axesValues[i].set_fraction( (axesMap[key][i].second- dev->axes[i].min) / (dev->axes[i].max - dev->axes[i].min) );
+                        }
+                        gchar* str = g_strdup_printf("%f", axesMap[key][i].second);
+                        axesValues[i].set_text(str);
+                        g_free(str);
+                    }
+                    break;
+                case 3:
+                    testAxes[i].set(axisOnPix);
+                    axesValues[i].set_sensitive(true);
+                    if ( dev && (i < static_cast<gint>(G_N_ELEMENTS(axesValues)) ) ) {
+                        if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) {
+                            axesValues[i].set_sensitive(true);
+                            axesValues[i].set_fraction( (axesMap[key][i].second- dev->axes[i].min) / (dev->axes[i].max - dev->axes[i].min) );
+                        }
+                        gchar* str = g_strdup_printf("%f", axesMap[key][i].second);
+                        axesValues[i].set_text(str);
+                        g_free(str);
+                    }
+            }
+
+        } else {
+            testAxes[i].set(axisNonePix);
+        }
+    }
+    if ( !dev ) {
+        for ( gint i = 0; i < static_cast<gint>(G_N_ELEMENTS(axesValues)); i++ ) {
+            axesValues[i].set_fraction(0.0);
+            axesValues[i].set_text("");
+            axesValues[i].set_sensitive(false);
+        }
+    }
+}
+
+void InputDialogImpl::mapAxesValues( Glib::ustring const& key, guint numAxes, gdouble const * axes, GdkDevice* dev )
+{
+    static gdouble epsilon = 0.0001;
+    if ( (numAxes > 0) && axes) {
+        for ( guint axisNum = 0; axisNum < numAxes; axisNum++ ) {
+            // 0 == new, 1 == set value, 2 == changed value, 3 == active
+            gdouble diff = axesMap[key][axisNum].second - axes[axisNum];
+            switch(axesMap[key][axisNum].first) {
+                case 0:
+                {
+                    axesMap[key][axisNum].first = 1;
+                    axesMap[key][axisNum].second = axes[axisNum];
+                }
+                break;
+                case 1:
+                {
+                    if ( (diff > epsilon) || (diff < -epsilon) ) {
+//                         g_message("Axis %d changed on %s]", axisNum, key.c_str());
+                        axesMap[key][axisNum].first = 3;
+                        axesMap[key][axisNum].second = axes[axisNum];
+                        updateTestAxes(key, dev);
+                        DeviceManager::getManager().addAxis(key, axisNum);
+                    }
+                }
+                break;
+                case 2:
+                {
+                    if ( (diff > epsilon) || (diff < -epsilon) ) {
+                        axesMap[key][axisNum].first = 3;
+                        axesMap[key][axisNum].second = axes[axisNum];
+                        updateTestAxes(key, dev);
+                    }
+                }
+                break;
+                case 3:
+                {
+                    if ( (diff > epsilon) || (diff < -epsilon) ) {
+                        axesMap[key][axisNum].second = axes[axisNum];
+                    } else {
+                        axesMap[key][axisNum].first = 2;
+                        updateTestAxes(key, dev);
+                    }
+                }
+            }
+        }
+    }
+    // std::map<Glib::ustring, std::map<guint, std::pair<guint, gdouble> > > axesMap;
+}
+
+Glib::ustring InputDialogImpl::getKeyFor( GdkDevice* device )
+{
+    Glib::ustring key;
+    switch ( device->source ) {
+        case GDK_SOURCE_MOUSE:
+            key = "M:";
+            break;
+        case GDK_SOURCE_CURSOR:
+            key = "C:";
+            break;
+        case GDK_SOURCE_PEN:
+            key = "P:";
+            break;
+        case GDK_SOURCE_ERASER:
+            key = "E:";
+            break;
+        default:
+            key = "?:";
+    }
+    key += device->name;
+
+    return key;
+}
+
 bool InputDialogImpl::eventSnoop(GdkEvent* event)
 {
     int modmod = 0;
 
     GdkInputSource source = lastSourceSeen;
     Glib::ustring devName = lastDevnameSeen;
+    Glib::ustring key;
+    gint hotButton = -1;
 
     switch ( event->type ) {
         case GDK_KEY_PRESS:
@@ -567,7 +1107,7 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
             GdkEventKey* keyEvt = reinterpret_cast<GdkEventKey*>(event);
             gchar* name = gtk_accelerator_name(keyEvt->keyval, static_cast<GdkModifierType>(keyEvt->state));
             keyVal.set_label(name);
-            g_message("%d KEY    state:0x%08x  0x%04x [%s]", keyEvt->type, keyEvt->state, keyEvt->keyval, name);
+//             g_message("%d KEY    state:0x%08x  0x%04x [%s]", keyEvt->type, keyEvt->state, keyEvt->keyval, name);
             g_free(name);
         }
         break;
@@ -577,42 +1117,29 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
         case GDK_BUTTON_RELEASE:
         {
             GdkEventButton* btnEvt = reinterpret_cast<GdkEventButton*>(event);
-            Glib::ustring key;
             if ( btnEvt->device ) {
+                key = getKeyFor(btnEvt->device);
                 source = btnEvt->device->source;
                 devName = btnEvt->device->name;
-                switch ( btnEvt->device->source ) {
-                    case GDK_SOURCE_MOUSE:
-                        key = "M:";
-                        break;
-                    case GDK_SOURCE_CURSOR:
-                        key = "C:";
-                        break;
-                    case GDK_SOURCE_PEN:
-                        key = "P:";
-                        break;
-                    case GDK_SOURCE_ERASER:
-                        key = "E:";
-                        break;
-                    default:
-                        key = "?:";
-                }
-                key += devName;
 
+                mapAxesValues(key, btnEvt->device->num_axes, btnEvt->axes, btnEvt->device);
                 if ( buttonMap[key].find(btnEvt->button) == buttonMap[key].end() ) {
-                    g_message("New button found for %s = %d", key.c_str(), btnEvt->button);
+//                     g_message("New button found for %s = %d", key.c_str(), btnEvt->button);
                     buttonMap[key].insert(btnEvt->button);
+                    DeviceManager::getManager().addButton(key, btnEvt->button);
                 }
+                hotButton = modmod ? btnEvt->button : -1;
+                updateTestButtons(key, hotButton);
             }
             gchar* name = gtk_accelerator_name(0, static_cast<GdkModifierType>(btnEvt->state));
             keyVal.set_label(name);
-            g_message("%d BTN    state:0x%08x %c  %4d [%s] dev:%p [%s]  ",
-                      btnEvt->type, btnEvt->state,
-                      (modmod ? '+':'-'),
-                      btnEvt->button, name, btnEvt->device,
-                      (btnEvt->device ? btnEvt->device->name : "null")
+//             g_message("%d BTN    state:0x%08x %c  %4d [%s] dev:%p [%s]  ",
+//                       btnEvt->type, btnEvt->state,
+//                       (modmod ? '+':'-'),
+//                       btnEvt->button, name, btnEvt->device,
+//                       (btnEvt->device ? btnEvt->device->name : "null")
 
-                );
+//                 );
             g_free(name);
         }
         break;
@@ -620,21 +1147,23 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
         {
             GdkEventMotion* btnMtn = reinterpret_cast<GdkEventMotion*>(event);
             if ( btnMtn->device ) {
+                key = getKeyFor(btnMtn->device);
                 source = btnMtn->device->source;
                 devName = btnMtn->device->name;
+                mapAxesValues(key, btnMtn->device->num_axes, btnMtn->axes, btnMtn->device);
             }
             gchar* name = gtk_accelerator_name(0, static_cast<GdkModifierType>(btnMtn->state));
             keyVal.set_label(name);
-            g_message("%d MOV    state:0x%08x         [%s] dev:%p [%s] %3.2f %3.2f %3.2f %3.2f %3.2f %3.2f", btnMtn->type, btnMtn->state,
-                      name, btnMtn->device,
-                      (btnMtn->device ? btnMtn->device->name : "null"),
-                      ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 0)) ? btnMtn->axes[0]:0),
-                      ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 1)) ? btnMtn->axes[1]:0),
-                      ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 2)) ? btnMtn->axes[2]:0),
-                      ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 3)) ? btnMtn->axes[3]:0),
-                      ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 4)) ? btnMtn->axes[4]:0),
-                      ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 5)) ? btnMtn->axes[5]:0)
-                );
+//             g_message("%d MOV    state:0x%08x         [%s] dev:%p [%s] %3.2f %3.2f %3.2f %3.2f %3.2f %3.2f", btnMtn->type, btnMtn->state,
+//                       name, btnMtn->device,
+//                       (btnMtn->device ? btnMtn->device->name : "null"),
+//                       ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 0)) ? btnMtn->axes[0]:0),
+//                       ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 1)) ? btnMtn->axes[1]:0),
+//                       ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 2)) ? btnMtn->axes[2]:0),
+//                       ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 3)) ? btnMtn->axes[3]:0),
+//                       ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 4)) ? btnMtn->axes[4]:0),
+//                       ((btnMtn->device && btnMtn->axes && (btnMtn->device->num_axes > 5)) ? btnMtn->axes[5]:0)
+//                 );
             g_free(name);
         }
         break;
@@ -644,39 +1173,39 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
 
 
     if ( (lastSourceSeen != source) || (lastDevnameSeen != devName) ) {
-        g_message("FLIPPIES  %d => %d", lastSourceSeen, source);
         switch (source) {
             case GDK_SOURCE_MOUSE:
             {
-                testThumb.set(mousePix);
+                testThumb.set(corePix);
             }
             break;
             case GDK_SOURCE_CURSOR:
             {
-                g_message("flip to cursor");
+//                 g_message("flip to cursor");
                 testThumb.set(mousePix);
             }
             break;
             case GDK_SOURCE_PEN:
             {
                 if (devName == "pad") {
-                    g_message("flip to pad");
+//                     g_message("flip to pad");
                     testThumb.set(sidebuttonsPix);
                 } else {
-                    g_message("flip to pen");
+//                     g_message("flip to pen");
                     testThumb.set(tipPix);
                 }
             }
             break;
             case GDK_SOURCE_ERASER:
             {
-                g_message("flip to eraser");
+//                 g_message("flip to eraser");
                 testThumb.set(eraserPix);
             }
             break;
-            default:
-                g_message("gurgle");
+//             default:
+//                 g_message("gurgle");
         }
+        updateTestButtons(key, hotButton);
         lastSourceSeen = source;
         lastDevnameSeen = devName;
     }
@@ -685,105 +1214,6 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
 }
 
 
-
-
-
-GdkDeviceAxis padAxes[] = {{GDK_AXIS_X, 0.0, 0.0},
-                           {GDK_AXIS_Y, 0.0, 0.0},
-                           {GDK_AXIS_PRESSURE, 0.0, 1.0},
-                           {GDK_AXIS_XTILT, -1.0, 1.0},
-                           {GDK_AXIS_YTILT, -1.0, 1.0},
-                           {GDK_AXIS_WHEEL, 0.0, 1.0}};
-GdkDeviceKey padKeys[] = {{0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0},
-                          {0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0}};
-
-GdkDeviceAxis eraserAxes[] = {{GDK_AXIS_X, 0.0, 0.0},
-                              {GDK_AXIS_Y, 0.0, 0.0},
-                              {GDK_AXIS_PRESSURE, 0.0, 1.0},
-                              {GDK_AXIS_XTILT, -1.0, 1.0},
-                              {GDK_AXIS_YTILT, -1.0, 1.0},
-                              {GDK_AXIS_WHEEL, 0.0, 1.0}};
-GdkDeviceKey eraserKeys[] = {{0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0},
-                             {0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0}};
-
-GdkDeviceAxis cursorAxes[] = {{GDK_AXIS_X, 0.0, 0.0},
-                              {GDK_AXIS_Y, 0.0, 0.0},
-                              {GDK_AXIS_PRESSURE, 0.0, 1.0},
-                              {GDK_AXIS_XTILT, -1.0, 1.0},
-                              {GDK_AXIS_YTILT, -1.0, 1.0},
-                              {GDK_AXIS_WHEEL, 0.0, 1.0}};
-GdkDeviceKey cursorKeys[] = {{0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0},
-                             {0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0}};
-
-GdkDeviceAxis stylusAxes[] = {{GDK_AXIS_X, 0.0, 0.0},
-                              {GDK_AXIS_Y, 0.0, 0.0},
-                              {GDK_AXIS_PRESSURE, 0.0, 1.0},
-                              {GDK_AXIS_XTILT, -1.0, 1.0},
-                              {GDK_AXIS_YTILT, -1.0, 1.0},
-                              {GDK_AXIS_WHEEL, 0.0, 1.0}};
-GdkDeviceKey stylusKeys[] = {{0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0},
-                             {0, (GdkModifierType)0}, {0, (GdkModifierType)0}, {0, (GdkModifierType)0}};
-
-
-GdkDeviceAxis coreAxes[] = {{GDK_AXIS_X, 0.0, 0.0},
-                            {GDK_AXIS_Y, 0.0, 0.0}};
-
-
-static void createFakeList() {
-    if ( !fakeList ) {
-        fakeout[0].name = "pad";
-        fakeout[0].source = GDK_SOURCE_PEN;
-        fakeout[0].mode = GDK_MODE_SCREEN;
-        fakeout[0].has_cursor = TRUE;
-        fakeout[0].num_axes = 6;
-        fakeout[0].axes = padAxes;
-        fakeout[0].num_keys = 8;
-        fakeout[0].keys = padKeys;
-
-        fakeout[1].name = "eraser";
-        fakeout[1].source = GDK_SOURCE_ERASER;
-        fakeout[1].mode = GDK_MODE_SCREEN;
-        fakeout[1].has_cursor = TRUE;
-        fakeout[1].num_axes = 6;
-        fakeout[1].axes = eraserAxes;
-        fakeout[1].num_keys = 7;
-        fakeout[1].keys = eraserKeys;
-
-        fakeout[2].name = "cursor";
-        fakeout[2].source = GDK_SOURCE_CURSOR;
-        fakeout[2].mode = GDK_MODE_SCREEN;
-        fakeout[2].has_cursor = TRUE;
-        fakeout[2].num_axes = 6;
-        fakeout[2].axes = cursorAxes;
-        fakeout[2].num_keys = 7;
-        fakeout[2].keys = cursorKeys;
-
-        fakeout[3].name = "stylus";
-        fakeout[3].source = GDK_SOURCE_PEN;
-        fakeout[3].mode = GDK_MODE_SCREEN;
-        fakeout[3].has_cursor = TRUE;
-        fakeout[3].num_axes = 6;
-        fakeout[3].axes = stylusAxes;
-        fakeout[3].num_keys = 7;
-        fakeout[3].keys = stylusKeys;
-
-        fakeout[4].name = "Core Pointer";
-        fakeout[4].source = GDK_SOURCE_MOUSE;
-        fakeout[4].mode = GDK_MODE_SCREEN;
-        fakeout[4].has_cursor = TRUE;
-        fakeout[4].num_axes = 2;
-        fakeout[4].axes = coreAxes;
-        fakeout[4].num_keys = 0;
-        fakeout[4].keys = NULL;
-
-        for ( guint pos = 0; pos < G_N_ELEMENTS(fakeout); pos++) {
-            fakeList = g_list_append(fakeList, &(fakeout[pos]));
-        }
-    }
-}
-
-
-
 } // end namespace Inkscape
 } // end namespace UI
 } // end namespace Dialog