After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674253 - device handling issue with multi input devices
device handling issue with multi input devices
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Class: GdkDevice
3.6.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Carlos Garnacho
: 727110 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-04-17 13:37 UTC by Viktoria S.
Modified: 2018-04-15 00:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Viktoria S. 2012-04-17 13:37:12 UTC
I have problem with Genius MousePen i608X driver and using it in Gimp 2.8RC1.
The problem seems to be that in this model the name the pen and the mouse are the same.
Usually if I have the mousepen plugged in during boot the first item is the pen and the second is the mouse, but if I plug the mousepen after boot the first item will be the mouse and the second will be the pen.
I have compiled Gimp 2.8RC1 for myself and I get only one Genius MousePen i608X on the list. As you can see the screenshot in this post: http://ubuntuforums.org/showpost.php?p=11690680&postcount=30.

I tried to figure out what can be the problem, since the earlier version of gimp does not have this issue (I have 2 Genius MousePen i608X there to choose from)(Nick earlier thought that the problem could be because the mouse works in absolute mode, but the absolute mouse works perfectly in earlier version of gimp so I thought probably that is not the issue.)

So I browsed the code and I have found the code which is creating the device list of the panel: it is in gimp-2.8.0-RC1/app/widgets/gimpdevicemanager.c. In line 313 there is a function gimp_device_manager_device_added. 
static void
gimp_device_manager_device_added (GdkDisplay        *gdk_display,
                                  GdkDevice         *device,
                                  GimpDeviceManager *manager)
{
  GimpDeviceManagerPrivate *private = GET_PRIVATE (manager);
  GimpDeviceInfo           *device_info;

  device_info =
    GIMP_DEVICE_INFO (gimp_container_get_child_by_name (GIMP_CONTAINER (manager),
                                                        device->name));

  /*if (device_info)
    {
      gimp_device_info_set_device (device_info, device, gdk_display);
    }
  else
    {*/
      device_info = gimp_device_info_new (private->gimp, device, gdk_display);

      gimp_container_add (GIMP_CONTAINER (manager), GIMP_OBJECT (device_info));
      g_object_unref (device_info);
    //}
}

The original code is without comments, and unfortunately it uses the name of the device as a key in a collection to identify the device. If I compile gimp with commented lines all of the devices appear on the list.
But there are issues with this:
- if I plugin the mousepen after bootup with the original gimp code only the mouse appears on the list, because, as I mentioned in that case the mouse will be the first item in xinput list not the pen. So in this scenario the pen can only be configured with the modified code.
- if I were to configure both the mouse and the pen they are going to share the same settings (according color, brush etc.) somehow, I guess because the device name used as a key (In earlier version of the gimp the whole device handling code is different, so there are no such issues. If I configure to use both the pen and the mouse they are going to have defferent brush, color etc. settings.)

I have asked Nikolai Kondrashov (the developer of the driver) if the device names in the xinput list are requred to be unique or not and he said not.

I quote his email:
"I would say that it's a bug in GIMP and it should be reported to the
developers ASAP, before the final 2.8 is released. They may have tried to
solve some problem with this approach, but it created another one.

Because, the device name is supposed to be descriptive and the only proper
device ID is the X input device ID. The one seen in the "xinput list"
output.

There are at least several other tablets and other input devices, which
create several input devices with identical name. Look for
HID_QUIRK_MULTI_INPUT in the kernel's drivers/hid/usbhid/hid-quirks.c. Then
there are always devices with multiple interfaces and I guess they will get
identical names too. While it might be good to add some identification to
their names, it shouldn't be required."

My thought to solve the problem is to use the device name and the device type as a key in the device collection.
But I am not an expert in gimp coding, I am glad that I could find where the issue is rooted.

If you need any further information plese let me know.

(I am using Ubuntu 11.10 64bit with a pathched kernel (since the driver for this particular device is new).)

Regard:
Viktoria S.
Comment 1 Michael Natterer 2012-10-07 19:05:29 UTC
We only know the device's name, th public GDK API has no concept
of ad device "ID". Distinguishing different devices with identical
names can only be done inside GDK, and somehow reported via piblic
API. Moving to GTK+.
Comment 2 bugs+gnome 2014-03-26 20:51:25 UTC
*** Bug 727110 has been marked as a duplicate of this bug. ***
Comment 3 Matthias Clasen 2018-02-10 05:04:22 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 4 Matthias Clasen 2018-04-15 00:22:42 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new