From 28544bc443a39b5878cb360b8a4dd3bf02edc6fe Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 9 Apr 2010 22:21:31 -0700 Subject: [PATCH] Do not emit signals when setting values to their existing state. --- src/device-manager.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/device-manager.cpp b/src/device-manager.cpp index 29e15b05a..b71cca059 100644 --- 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 >::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(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 >::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(use)); - signalDeviceChangedPriv.emit(*it); + if (static_cast(index) <= (*it)->getNumAxes()) { + if ((*it)->getDevice()->axes[index].use != static_cast(use)) { + gdk_device_set_axis_use((*it)->getDevice(), index, static_cast(use)); + signalDeviceChangedPriv.emit(*it); + } + } else { + g_warning("Invalid device axis number %d on extended input device [%s]", index, (*it)->getId().c_str()); + } } } } -- 2.30.2