diff --git a/src/device-manager.cpp b/src/device-manager.cpp
index dcf86edb706f53a0d3290ac6d3886b4b5ff055c5..2b44a8d5166722d7ca02ea099ddededc530edc87 100644 (file)
--- a/src/device-manager.cpp
+++ b/src/device-manager.cpp
/*
* Inkscape::DeviceManager - a view of input devices available.
*
- * Copyright 2006 Jon A. Cruz <jon@joncruz.org>
+ * Copyright 2010 Jon A. Cruz <jon@joncruz.org>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib.h>
#include <map>
+#include <set>
+#include <gtk/gtkaccelgroup.h>
#include "device-manager.h"
+#include "preferences.h"
+#define noDEBUG_VERBOSE 1
static void createFakeList();
GdkDevice fakeout[5];
static GList* fakeList = 0;
+static bool isValidDevice(GdkDevice *device)
+{
+ bool valid = true;
+ for (size_t i = 0; (i < G_N_ELEMENTS(fakeout)) && valid; i++) {
+ valid = (device != &fakeout[i]);
+ }
+ return valid;
+}
namespace Inkscape {
static std::map<gint, gint> bitVals(vals, &vals[G_N_ELEMENTS(vals)]);
+static const int RUNAWAY_MAX = 1000;
+
+static Glib::ustring getBaseDeviceName(Gdk::InputSource source)
+{
+ Glib::ustring name;
+ switch (source) {
+ case GDK_SOURCE_MOUSE:
+ name ="pointer";
+ break;
+ case GDK_SOURCE_PEN:
+ name ="pen";
+ break;
+ case GDK_SOURCE_ERASER:
+ name ="eraser";
+ break;
+ case GDK_SOURCE_CURSOR:
+ name ="cursor";
+ break;
+ default:
+ name = "tablet";
+ }
+ return name;
+}
+
+static std::map<Glib::ustring, Gdk::AxisUse> &getStringToAxis()
+{
+ static bool init = false;
+ static std::map<Glib::ustring, Gdk::AxisUse> mapping;
+ if (!init) {
+ init = true;
+ mapping["ignore"] = Gdk::AXIS_IGNORE;
+ mapping["x"] = Gdk::AXIS_X;
+ mapping["y"] = Gdk::AXIS_Y;
+ mapping["pressure"] = Gdk::AXIS_PRESSURE;
+ mapping["xtilt"] = Gdk::AXIS_XTILT;
+ mapping["ytilt"] = Gdk::AXIS_YTILT;
+ mapping["wheel"] = Gdk::AXIS_WHEEL;
+ }
+ return mapping;
+}
+
+std::map<Gdk::AxisUse, Glib::ustring> &getAxisToString()
+{
+ static bool init = false;
+ static std::map<Gdk::AxisUse, Glib::ustring> mapping;
+ if (!init) {
+ init = true;
+ for (std::map<Glib::ustring, Gdk::AxisUse>::iterator it = getStringToAxis().begin(); it != getStringToAxis().end(); ++it) {
+ mapping.insert(std::make_pair(it->second, it->first));
+ }
+ }
+ return mapping;
+}
+
+static std::map<Glib::ustring, Gdk::InputMode> &getStringToMode()
+{
+ static bool init = false;
+ static std::map<Glib::ustring, Gdk::InputMode> mapping;
+ if (!init) {
+ init = true;
+ mapping["disabled"] = Gdk::MODE_DISABLED;
+ mapping["screen"] = Gdk::MODE_SCREEN;
+ mapping["window"] = Gdk::MODE_WINDOW;
+ }
+ return mapping;
+}
+
+std::map<Gdk::InputMode, Glib::ustring> &getModeToString()
+{
+ static bool init = false;
+ static std::map<Gdk::InputMode, Glib::ustring> mapping;
+ if (!init) {
+ init = true;
+ for (std::map<Glib::ustring, Gdk::InputMode>::iterator it = getStringToMode().begin(); it != getStringToMode().end(); ++it) {
+ mapping.insert(std::make_pair(it->second, it->first));
+ }
+ }
+ return mapping;
+}
+
+
+
InputDevice::InputDevice()
: Glib::Object()
{}
class InputDeviceImpl : public InputDevice {
public:
+ InputDeviceImpl(GdkDevice* device, std::set<Glib::ustring> &knownIDs);
+ virtual ~InputDeviceImpl() {}
+
virtual Glib::ustring getId() const {return id;}
virtual Glib::ustring getName() const {return name;}
virtual Gdk::InputSource getSource() const {return source;}
virtual gint getLiveButtons() const {return liveButtons;}
virtual void setLiveButtons(gint buttons) {liveButtons = buttons;}
-
- InputDeviceImpl(GdkDevice* device);
- virtual ~InputDeviceImpl() {}
+ // internal methods not on public superclass:
+ virtual GdkDevice *getDevice() { return device; }
private:
InputDeviceImpl(InputDeviceImpl const &); // no copy
void operator=(InputDeviceImpl const &); // no assign
+ static Glib::ustring createId(Glib::ustring const &id, Gdk::InputSource source, std::set<Glib::ustring> &knownIDs);
+
GdkDevice* device;
Glib::ustring id;
Glib::ustring name;
guint liveButtons;
};
-class IdMatcher : public std::unary_function<InputDeviceImpl*, bool> {
+class IdMatcher : public std::unary_function<Glib::RefPtr<InputDeviceImpl>&, bool> {
public:
IdMatcher(Glib::ustring const& target):target(target) {}
- bool operator ()(InputDeviceImpl* dev) {return dev && (target == dev->getId());}
+ bool operator ()(Glib::RefPtr<InputDeviceImpl>& dev) {return dev && (target == dev->getId());}
private:
Glib::ustring const& target;
};
-class LinkMatcher : public std::unary_function<InputDeviceImpl*, bool> {
+class LinkMatcher : public std::unary_function<Glib::RefPtr<InputDeviceImpl>&, bool> {
public:
LinkMatcher(Glib::ustring const& target):target(target) {}
- bool operator ()(InputDeviceImpl* dev) {return dev && (target == dev->getLink());}
+ bool operator ()(Glib::RefPtr<InputDeviceImpl>& dev) {return dev && (target == dev->getLink());}
private:
Glib::ustring const& target;
};
-InputDeviceImpl::InputDeviceImpl(GdkDevice* device)
+InputDeviceImpl::InputDeviceImpl(GdkDevice* device, std::set<Glib::ustring> &knownIDs)
: InputDevice(),
device(device),
id(),
liveAxes(0),
liveButtons(0)
{
+ id = createId(name, source, knownIDs);
+}
+
+
+Glib::ustring InputDeviceImpl::createId(Glib::ustring const &id,
+ Gdk::InputSource source,
+ std::set<Glib::ustring> &knownIDs)
+{
+ // Start with only allowing printable ASCII. Check later for more refinements.
+ bool badName = id.empty() || !id.is_ascii();
+ for (Glib::ustring::const_iterator it = id.begin(); (it != id.end()) && !badName; ++it) {
+ badName = *it < 0x20;
+ }
+
+ Glib::ustring base;
switch ( source ) {
case Gdk::SOURCE_MOUSE:
- id = "M:";
+ base = "M:";
break;
case Gdk::SOURCE_CURSOR:
- id = "C:";
+ base = "C:";
break;
case Gdk::SOURCE_PEN:
- id = "P:";
+ base = "P:";
break;
case Gdk::SOURCE_ERASER:
- id = "E:";
+ base = "E:";
break;
default:
- id = "?:";
+ base = "?:";
}
- id += name;
-}
+ if (badName) {
+ base += getBaseDeviceName(source);
+ } else {
+ base += id;
+ }
+ // now ensure that all IDs become unique in a session.
+ int num = 1;
+ Glib::ustring result = base;
+ while ((knownIDs.find(result) != knownIDs.end()) && (num < RUNAWAY_MAX)) {
+ result = Glib::ustring::compose("%1%2", base, ++num);
+ }
+ knownIDs.insert(result);
+ return result;
+}
class DeviceManagerImpl : public DeviceManager {
public:
DeviceManagerImpl();
- virtual std::list<InputDevice const *> getDevices();
- virtual sigc::signal<void, const Glib::RefPtr<InputDevice>& > signalDeviceChanged();
- virtual sigc::signal<void, const Glib::RefPtr<InputDevice>& > signalAxesChanged();
- virtual sigc::signal<void, const Glib::RefPtr<InputDevice>& > signalButtonsChanged();
- virtual sigc::signal<void, const Glib::RefPtr<InputDevice>& > signalLinkChanged();
+
+ virtual void loadConfig();
+ virtual void saveConfig();
+
+ virtual std::list<Glib::RefPtr<InputDevice const> > getDevices();
+
+ virtual sigc::signal<void, Glib::RefPtr<InputDevice const> > signalDeviceChanged();
+ virtual sigc::signal<void, Glib::RefPtr<InputDevice const> > signalAxesChanged();
+ virtual sigc::signal<void, Glib::RefPtr<InputDevice const> > signalButtonsChanged();
+ virtual sigc::signal<void, Glib::RefPtr<InputDevice const> > signalLinkChanged();
virtual void addAxis(Glib::ustring const & id, gint axis);
virtual void addButton(Glib::ustring const & id, gint button);
virtual void setLinkedTo(Glib::ustring const & id, Glib::ustring const& link);
+ virtual void setMode( Glib::ustring const & id, Gdk::InputMode mode );
+ virtual void setAxisUse( Glib::ustring const & id, guint index, Gdk::AxisUse use );
+ virtual void setKey( Glib::ustring const & id, guint index, guint keyval, Gdk::ModifierType mods );
+
protected:
- std::list<InputDeviceImpl*> devices;
- sigc::signal<void, const Glib::RefPtr<InputDevice>& > signalDeviceChangedPriv;
- sigc::signal<void, const Glib::RefPtr<InputDevice>& > signalAxesChangedPriv;
- sigc::signal<void, const Glib::RefPtr<InputDevice>& > signalButtonsChangedPriv;
- sigc::signal<void, const Glib::RefPtr<InputDevice>& > signalLinkChangedPriv;
+ std::list<Glib::RefPtr<InputDeviceImpl> > devices;
+
+ sigc::signal<void, Glib::RefPtr<InputDevice const> > signalDeviceChangedPriv;
+ sigc::signal<void, Glib::RefPtr<InputDevice const> > signalAxesChangedPriv;
+ sigc::signal<void, Glib::RefPtr<InputDevice const> > signalButtonsChangedPriv;
+ sigc::signal<void, Glib::RefPtr<InputDevice const> > signalLinkChangedPriv;
};
if ( !fakeList ) {
createFakeList();
}
-// devList = fakeList;
+ //devList = fakeList;
+
+ std::set<Glib::ustring> knownIDs;
for ( GList* curr = devList; curr; curr = g_list_next(curr) ) {
GdkDevice* dev = reinterpret_cast<GdkDevice*>(curr->data);
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);
+#if DEBUG_VERBOSE
+ 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);
+#endif
+
+ InputDeviceImpl* device = new InputDeviceImpl(dev, knownIDs);
+ device->reference();
+ devices.push_back(Glib::RefPtr<InputDeviceImpl>(device));
+ }
+ }
+}
- InputDeviceImpl* device = new InputDeviceImpl(dev);
- devices.push_back(device);
+void DeviceManagerImpl::loadConfig()
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
+ for (std::list<Glib::RefPtr<InputDeviceImpl> >::iterator it = devices.begin(); it != devices.end(); ++it) {
+ if ((*it)->getSource() != Gdk::SOURCE_MOUSE) {
+ Glib::ustring path = "/devices/" + (*it)->getId();
+
+ Gdk::InputMode mode = Gdk::MODE_DISABLED;
+ Glib::ustring val = prefs->getString(path + "/mode");
+ if (getStringToMode().find(val) != getStringToMode().end()) {
+ mode = getStringToMode()[val];
+ }
+ if ((*it)->getMode() != mode) {
+ setMode( (*it)->getId(), mode );
+ }
+
+ //
+
+ val = prefs->getString(path + "/axes");
+ if (!val.empty()) {
+ std::vector<Glib::ustring> parts = Glib::Regex::split_simple(";", val);
+ for (size_t i = 0; i < parts.size(); ++i) {
+ Glib::ustring name = parts[i];
+ if (getStringToAxis().find(name) != getStringToAxis().end()) {
+ Gdk::AxisUse use = getStringToAxis()[name];
+ setAxisUse( (*it)->getId(), i, use );
+ }
+ }
+ }
+
+ val = prefs->getString(path + "/keys");
+ if (!val.empty()) {
+ std::vector<Glib::ustring> parts = Glib::Regex::split_simple(";", val);
+ for (size_t i = 0; i < parts.size(); ++i) {
+ Glib::ustring keyStr = parts[i];
+ if (!keyStr.empty()) {
+ guint key = 0;
+ GdkModifierType mods = static_cast<GdkModifierType>(0);
+ gtk_accelerator_parse( keyStr.c_str(), &key, &mods );
+ setKey( (*it)->getId(), i, key, static_cast<Gdk::ModifierType>(mods) );
+ }
+ }
+ }
}
}
}
-std::list<InputDevice const *> DeviceManagerImpl::getDevices()
+void DeviceManagerImpl::saveConfig()
{
- std::list<InputDevice const *> tmp;
- for ( std::list<InputDeviceImpl*>::const_iterator it = devices.begin(); it != devices.end(); ++it ) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
+ for (std::list<Glib::RefPtr<InputDeviceImpl> >::iterator it = devices.begin(); it != devices.end(); ++it) {
+ if ((*it)->getSource() != Gdk::SOURCE_MOUSE) {
+ Glib::ustring path = "/devices/" + (*it)->getId();
+
+ prefs->setString( path + "/mode", getModeToString()[(*it)->getMode()].c_str() );
+
+ Glib::ustring tmp;
+ for (gint i = 0; i < (*it)->getNumAxes(); ++i) {
+ if (i > 0) {
+ tmp += ";";
+ }
+ tmp += getAxisToString()[static_cast<Gdk::AxisUse>((*it)->getDevice()->axes[i].use)];
+ }
+ prefs->setString( path + "/axes", tmp );
+
+ tmp = "";
+ for (gint i = 0; i < (*it)->getNumKeys(); ++i) {
+ if (i > 0) {
+ tmp += ";";
+ }
+ tmp += gtk_accelerator_name((*it)->getDevice()->keys[i].keyval, (*it)->getDevice()->keys[i].modifiers);
+ }
+ prefs->setString( path + "/keys", tmp );
+ }
+ }
+}
+
+std::list<Glib::RefPtr<InputDevice const> > DeviceManagerImpl::getDevices()
+{
+ std::list<Glib::RefPtr<InputDevice const> > tmp;
+ for ( std::list<Glib::RefPtr<InputDeviceImpl> >::const_iterator it = devices.begin(); it != devices.end(); ++it ) {
tmp.push_back(*it);
}
return tmp;
}
+void DeviceManagerImpl::setMode( Glib::ustring const & id, Gdk::InputMode mode )
+{
+ std::list<Glib::RefPtr<InputDeviceImpl> >::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id));
+ if ( it != devices.end() ) {
+ if (isValidDevice((*it)->getDevice()) && ((*it)->getMode() != mode) ) {
+ bool success = gdk_device_set_mode((*it)->getDevice(), static_cast<GdkInputMode>(mode));
+ if (success) {
+ signalDeviceChangedPriv.emit(*it);
+ } else {
+ g_warning("Unable to set mode on extended input device [%s]", (*it)->getId().c_str());
+ }
+ }
+ }
+}
+
+void DeviceManagerImpl::setAxisUse( Glib::ustring const & id, guint index, Gdk::AxisUse use )
+{
+ std::list<Glib::RefPtr<InputDeviceImpl> >::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id));
+ if ( it != devices.end() ) {
+ if (isValidDevice((*it)->getDevice())) {
+ if (static_cast<gint>(index) <= (*it)->getNumAxes()) {
+ if ((*it)->getDevice()->axes[index].use != static_cast<GdkAxisUse>(use)) {
+ gdk_device_set_axis_use((*it)->getDevice(), index, static_cast<GdkAxisUse>(use));
+ signalDeviceChangedPriv.emit(*it);
+ }
+ } else {
+ g_warning("Invalid device axis number %d on extended input device [%s]", index, (*it)->getId().c_str());
+ }
+ }
+ }
+}
-sigc::signal<void, const Glib::RefPtr<InputDevice>& > DeviceManagerImpl::signalDeviceChanged()
+void DeviceManagerImpl::setKey( Glib::ustring const & id, guint index, guint keyval, Gdk::ModifierType mods )
+{
+ //static void setDeviceKey( GdkDevice* device, guint index, guint keyval, GdkModifierType modifiers )
+ //
+
+ std::list<Glib::RefPtr<InputDeviceImpl> >::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id));
+ if ( it != devices.end() ) {
+ if (isValidDevice((*it)->getDevice())) {
+ gdk_device_set_key((*it)->getDevice(), index, keyval, static_cast<GdkModifierType>(mods));
+ signalDeviceChangedPriv.emit(*it);
+ }
+ }
+}
+
+sigc::signal<void, Glib::RefPtr<InputDevice const> > DeviceManagerImpl::signalDeviceChanged()
{
return signalDeviceChangedPriv;
}
-sigc::signal<void, const Glib::RefPtr<InputDevice>& > DeviceManagerImpl::signalAxesChanged()
+sigc::signal<void, Glib::RefPtr<InputDevice const> > DeviceManagerImpl::signalAxesChanged()
{
return signalAxesChangedPriv;
}
-sigc::signal<void, const Glib::RefPtr<InputDevice>& > DeviceManagerImpl::signalButtonsChanged()
+sigc::signal<void, Glib::RefPtr<InputDevice const> > DeviceManagerImpl::signalButtonsChanged()
{
return signalButtonsChangedPriv;
}
-sigc::signal<void, const Glib::RefPtr<InputDevice>& > DeviceManagerImpl::signalLinkChanged()
+sigc::signal<void, Glib::RefPtr<InputDevice const> > DeviceManagerImpl::signalLinkChanged()
{
return signalLinkChangedPriv;
}
@@ -204,7 +468,7 @@ sigc::signal<void, const Glib::RefPtr<InputDevice>& > DeviceManagerImpl::signalL
void DeviceManagerImpl::addAxis(Glib::ustring const & id, gint axis)
{
if ( axis >= 0 && axis < static_cast<gint>(bitVals.size()) ) {
- std::list<InputDeviceImpl*>::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id));
+ std::list<Glib::RefPtr<InputDeviceImpl> >::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id));
if ( it != devices.end() ) {
gint mask = bitVals[axis];
if ( (mask & (*it)->getLiveAxes()) == 0 ) {
// Only signal if a new axis was added
(*it)->reference();
- signalAxesChangedPriv.emit(Glib::RefPtr<InputDevice>(*it));
+ signalAxesChangedPriv.emit(*it);
}
}
}
void DeviceManagerImpl::addButton(Glib::ustring const & id, gint button)
{
if ( button >= 0 && button < static_cast<gint>(bitVals.size()) ) {
- std::list<InputDeviceImpl*>::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id));
+ std::list<Glib::RefPtr<InputDeviceImpl> >::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id));
if ( it != devices.end() ) {
gint mask = bitVals[button];
if ( (mask & (*it)->getLiveButtons()) == 0 ) {
// Only signal if a new button was added
(*it)->reference();
- signalButtonsChangedPriv.emit(Glib::RefPtr<InputDevice>(*it));
+ signalButtonsChangedPriv.emit(*it);
}
}
}
void DeviceManagerImpl::setLinkedTo(Glib::ustring const & id, Glib::ustring const& link)
{
- std::list<InputDeviceImpl*>::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id));
+ std::list<Glib::RefPtr<InputDeviceImpl> >::iterator it = std::find_if(devices.begin(), devices.end(), IdMatcher(id));
if ( it != devices.end() ) {
- InputDeviceImpl* dev = *it;
- // Need to be sure the target of the link exists
- it = std::find_if(devices.begin(), devices.end(), IdMatcher(link));
- if ( it != devices.end() ) {
- InputDeviceImpl* targetDev = *it;
- if ( (dev->getLink() != link) || (targetDev->getLink() != id) ) {
- // only muck about if they aren't already linked
- std::list<InputDeviceImpl*> changedItems;
+ Glib::RefPtr<InputDeviceImpl> dev = *it;
+
+ Glib::RefPtr<InputDeviceImpl> targetDev;
+ if ( !link.empty() ) {
+ // Need to be sure the target of the link exists
+ it = std::find_if(devices.begin(), devices.end(), IdMatcher(link));
+ if ( it != devices.end() ) {
+ targetDev = *it;
+ }
+ }
- // Is something else already using that link?
+
+ if ( (link.empty() && !dev->getLink().empty())
+ || (targetDev && (targetDev->getLink() != id)) ) {
+ // only muck about if they aren't already linked
+ std::list<Glib::RefPtr<InputDeviceImpl> > changedItems;
+
+ if ( targetDev ) {
+ // Is something else already using that link?
it = std::find_if(devices.begin(), devices.end(), LinkMatcher(link));
if ( it != devices.end() ) {
(*it)->setLink("");
changedItems.push_back(*it);
}
- it = std::find_if(devices.begin(), devices.end(), LinkMatcher(id));
- if ( it != devices.end() ) {
- (*it)->setLink("");
- changedItems.push_back(*it);
- }
- dev->setLink(link);
+ }
+ it = std::find_if(devices.begin(), devices.end(), LinkMatcher(id));
+ if ( it != devices.end() ) {
+ (*it)->setLink("");
+ changedItems.push_back(*it);
+ }
+ if ( targetDev ) {
targetDev->setLink(id);
changedItems.push_back(targetDev);
- changedItems.push_back(dev);
+ }
+ dev->setLink(link);
+ changedItems.push_back(dev);
- for ( std::list<InputDeviceImpl*>::const_iterator iter = changedItems.begin(); iter != changedItems.end(); ++iter ) {
- (*iter)->reference();
- signalLinkChangedPriv.emit(Glib::RefPtr<InputDevice>(*iter));
- }
+ for ( std::list<Glib::RefPtr<InputDeviceImpl> >::const_iterator iter = changedItems.begin(); iter != changedItems.end(); ++iter ) {
+ (*iter)->reference();
+ signalLinkChangedPriv.emit(*iter);
}
}
}
static void createFakeList() {
if ( !fakeList ) {
- fakeout[0].name = "pad";
+ fakeout[0].name = g_strdup("pad");
fakeout[0].source = GDK_SOURCE_PEN;
fakeout[0].mode = GDK_MODE_SCREEN;
fakeout[0].has_cursor = TRUE;
fakeout[0].num_keys = 8;
fakeout[0].keys = padKeys;
- fakeout[1].name = "eraser";
+ fakeout[1].name = g_strdup("eraser");
fakeout[1].source = GDK_SOURCE_ERASER;
fakeout[1].mode = GDK_MODE_SCREEN;
fakeout[1].has_cursor = TRUE;
fakeout[1].num_keys = 7;
fakeout[1].keys = eraserKeys;
- fakeout[2].name = "cursor";
+ fakeout[2].name = g_strdup("cursor");
fakeout[2].source = GDK_SOURCE_CURSOR;
fakeout[2].mode = GDK_MODE_SCREEN;
fakeout[2].has_cursor = TRUE;
fakeout[2].num_keys = 7;
fakeout[2].keys = cursorKeys;
- fakeout[3].name = "stylus";
+ fakeout[3].name = g_strdup("stylus");
fakeout[3].source = GDK_SOURCE_PEN;
fakeout[3].mode = GDK_MODE_SCREEN;
fakeout[3].has_cursor = TRUE;
if ( devList && devList->data ) {
fakeout[4] = *((GdkDevice*)devList->data);
} else {
- fakeout[4].name = "Core Pointer";
+ fakeout[4].name = g_strdup("Core Pointer");
fakeout[4].source = GDK_SOURCE_MOUSE;
fakeout[4].mode = GDK_MODE_SCREEN;
fakeout[4].has_cursor = TRUE;
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :