summaryrefslogtreecommitdiffstats
path: root/src/desktop-events.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2012-01-10 03:27:58 +0000
committerJon A. Cruz <jon@joncruz.org>2012-01-10 03:27:58 +0000
commit334adaadda19ab8e8fa5dcde08272e4011eafae7 (patch)
tree09be813a284a0914433b1f48450b45b0e5c89cfa /src/desktop-events.cpp
parentTranslations. Translatable files list and translation template update. (diff)
downloadinkscape-334adaadda19ab8e8fa5dcde08272e4011eafae7.tar.gz
inkscape-334adaadda19ab8e8fa5dcde08272e4011eafae7.zip
Reduce GTK compatibility ifdef complexity.
(bzr r10868)
Diffstat (limited to 'src/desktop-events.cpp')
-rw-r--r--src/desktop-events.cpp71
1 files changed, 28 insertions, 43 deletions
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 85ba08547..068e4aa9a 100644
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -526,49 +526,34 @@ static void init_extended()
if ( devices ) {
for ( GList* curr = devices; curr; curr = g_list_next(curr) ) {
GdkDevice* dev = reinterpret_cast<GdkDevice*>(curr->data);
-#if GTK_CHECK_VERSION (2, 22, 0)
- if ( gdk_device_get_name (dev)
- && (avoidName != gdk_device_get_name (dev))
- && (gdk_device_get_source (dev) != GDK_SOURCE_MOUSE) ) {
-// g_message("Adding '%s' as [%d]", dev->name, dev->source);
-
- // Set the initial tool for the device
- switch ( gdk_device_get_source (dev)) {
+#if GTK_CHECK_VERSION(2, 22, 0)
+ gchar const *devName = gdk_device_get_name(dev);
+ GdkInputSource devSrc = gdk_device_get_source(dev);
#else
- if ( dev->name
- && (avoidName != dev->name)
- && (dev->source != GDK_SOURCE_MOUSE) ) {
-// g_message("Adding '%s' as [%d]", dev->name, dev->source);
+ gchar const *devName = dev->name;
+ GdkInputSource devSrc = dev->source;
+#endif
+ if ( devName
+ && (avoidName != devName)
+ && (devSrc != GDK_SOURCE_MOUSE) ) {
+// g_message("Adding '%s' as [%d]", devName, devSrc);
// Set the initial tool for the device
- switch ( dev->source) {
-#endif
+ switch ( devSrc ) {
case GDK_SOURCE_PEN:
-#if GTK_CHECK_VERSION (2, 22, 0)
- toolToUse[gdk_device_get_name (dev)] = TOOLS_CALLIGRAPHIC;
-#else
- toolToUse[dev->name] = TOOLS_CALLIGRAPHIC;
-#endif
+ toolToUse[devName] = TOOLS_CALLIGRAPHIC;
break;
case GDK_SOURCE_ERASER:
-#if GTK_CHECK_VERSION (2, 22, 0)
- toolToUse[gdk_device_get_name (dev)] = TOOLS_ERASER;
-#else
- toolToUse[dev->name] = TOOLS_ERASER;
-#endif
+ toolToUse[devName] = TOOLS_ERASER;
break;
case GDK_SOURCE_CURSOR:
-#if GTK_CHECK_VERSION (2, 22, 0)
- toolToUse[gdk_device_get_name (dev)] = TOOLS_SELECT;
-#else
- toolToUse[dev->name] = TOOLS_SELECT;
-#endif
+ toolToUse[devName] = TOOLS_SELECT;
break;
default:
; // do not add
}
-// } else if (dev->name) {
-// g_message("Skippn '%s' as [%s]", dev->name, dev->source);
+// } else if (devName) {
+// g_message("Skippn '%s' as [%d]", devName, devSrc);
}
}
}
@@ -585,9 +570,9 @@ void snoop_extended(GdkEvent* event, SPDesktop *desktop)
{
GdkEventMotion* event2 = reinterpret_cast<GdkEventMotion*>(event);
if ( event2->device ) {
-#if GTK_CHECK_VERSION (2, 22, 0)
- source = gdk_device_get_source (event2->device);
- name = gdk_device_get_name (event2->device);
+#if GTK_CHECK_VERSION(2, 22, 0)
+ source = gdk_device_get_source(event2->device);
+ name = gdk_device_get_name(event2->device);
#else
source = event2->device->source;
name = event2->device->name;
@@ -603,9 +588,9 @@ void snoop_extended(GdkEvent* event, SPDesktop *desktop)
{
GdkEventButton* event2 = reinterpret_cast<GdkEventButton*>(event);
if ( event2->device ) {
-#if GTK_CHECK_VERSION (2, 22, 0)
- source = gdk_device_get_source (event2->device);
- name = gdk_device_get_name (event2->device);
+#if GTK_CHECK_VERSION(2, 22, 0)
+ source = gdk_device_get_source(event2->device);
+ name = gdk_device_get_name(event2->device);
#else
source = event2->device->source;
name = event2->device->name;
@@ -618,9 +603,9 @@ void snoop_extended(GdkEvent* event, SPDesktop *desktop)
{
GdkEventScroll* event2 = reinterpret_cast<GdkEventScroll*>(event);
if ( event2->device ) {
-#if GTK_CHECK_VERSION (2, 22, 0)
- source = gdk_device_get_source (event2->device);
- name = gdk_device_get_name (event2->device);
+#if GTK_CHECK_VERSION(2, 22, 0)
+ source = gdk_device_get_source(event2->device);
+ name = gdk_device_get_name(event2->device);
#else
source = event2->device->source;
name = event2->device->name;
@@ -634,9 +619,9 @@ void snoop_extended(GdkEvent* event, SPDesktop *desktop)
{
GdkEventProximity* event2 = reinterpret_cast<GdkEventProximity*>(event);
if ( event2->device ) {
-#if GTK_CHECK_VERSION (2, 22, 0)
- source = gdk_device_get_source (event2->device);
- name = gdk_device_get_name (event2->device);
+#if GTK_CHECK_VERSION(2, 22, 0)
+ source = gdk_device_get_source(event2->device);
+ name = gdk_device_get_name(event2->device);
#else
source = event2->device->source;
name = event2->device->source;