summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c81abf4)
raw | patch | inline | side by side (parent: c81abf4)
author | Jon A. Cruz <jon@joncruz.org> | |
Sat, 10 Apr 2010 05:21:31 +0000 (22:21 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Sat, 10 Apr 2010 05:21:31 +0000 (22:21 -0700) |
src/device-manager.cpp | patch | blob | history |
diff --git a/src/device-manager.cpp b/src/device-manager.cpp
index 29e15b05a23c4d25fc4c4b9e20cecbffa1685e44..b71cca05962e60c506b76e4d6812679ba0f9bfa7 100644 (file)
--- a/src/device-manager.cpp
+++ b/src/device-manager.cpp
@@ -403,10 +403,9 @@ 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())) {
+ if (isValidDevice((*it)->getDevice()) && ((*it)->getMode() != mode) ) {
bool success = gdk_device_set_mode((*it)->getDevice(), static_cast<GdkInputMode>(mode));
if (success) {
- //(*it)->setMode(mode);
signalDeviceChangedPriv.emit(*it);
} else {
g_warning("Unable to set mode on extended input device [%s]", (*it)->getId().c_str());
@@ -420,8 +419,14 @@ void DeviceManagerImpl::setAxisUse( Glib::ustring const & id, guint index, Gdk::
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_axis_use((*it)->getDevice(), index, static_cast<GdkAxisUse>(use));
- signalDeviceChangedPriv.emit(*it);
+ 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());
+ }
}
}
}