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 737389 - gsd-device-mapper does not apply mapping when monitor setup is changed
gsd-device-mapper does not apply mapping when monitor setup is changed
Status: RESOLVED OBSOLETE
Product: gnome-settings-daemon
Classification: Core
Component: plugins
3.14.x
Other Linux
: Normal normal
: ---
Assigned To: Carlos Garnacho
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2014-09-25 21:19 UTC by Matthijs Kooijman
Modified: 2019-03-20 11:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proof of concept fix (710 bytes, patch)
2014-09-25 21:19 UTC, Matthijs Kooijman
none Details | Review
gsd --debug output showing the problem (16.75 KB, text/plain)
2014-09-25 21:20 UTC, Matthijs Kooijman
  Details
gsd --debug output showing the problem (16.74 KB, text/plain)
2014-09-26 09:50 UTC, Matthijs Kooijman
  Details

Description Matthijs Kooijman 2014-09-25 21:19:36 UTC
Created attachment 287110 [details] [review]
Proof of concept fix

I have a laptop with an external monitor connected. My wacom tablet is set up to be mapped to the external monitor. This works fine when first configure this, or when I plug my tablet in and out, but when I close and reopen my laptop lid, it does not reapply the correct mapping (stretching my tablet over both screens).

Looking at the source code, I found that the actual mapping of outputs happens in settings_get_display, which is only called from device_settings_changed_cb and input_info_new. When the display configuration changes, screen_changed_cb is called, which calls _device_mapper_update_outputs which calls mapper_recalculate_candidates, which only does stuff with guessing candidates for integrated screens and systems, but it does not actually look at the configured output for a device.

What is slightly weird is that the info->output variable somehow gets unset. I've mapped the tablet to my external monitor and then close the laptop screen, so the external monitor should always stay available and there is no reason for info->output to get unset. However, perhaps gnome_rr_screen_list_outputs returns a different value for the same screen after the change? In any case, this isn't really important - if I would map the tablet to the laptop screen, close it and reopen it, it should also still work, but I expect it doesn't with the current code.


I've attached a patch that fixes this problem, though it's probably not the best way to fix it. Right now, this lets mapper_recalculate_candidates also look at the configured display, but that doesn't reallly fit within the functions scope (looking at the name). Also, this duplicates some code from device_settings_changed_cb / input_info_new which might be better to factor out in a separate function. Since I'm not familiar with the code so much, I'm not sure what the best approach would be.


I also attached some output from gsd --debug with and without this patch applied to illustrate the problem. I'm happy to do more testing of any patches or provide more info if needed.

All this is tested on gnome 3.12, since I haven't set a complete gnome compilation environment up here (compiling gsd through a patched Debian package and pbuilder). However, looking at the commit log, I don't think any related changes have been made to gsd since 3.12.
Comment 1 Matthijs Kooijman 2014-09-25 21:20:19 UTC
Created attachment 287111 [details]
gsd --debug output showing the problem
Comment 2 Matthijs Kooijman 2014-09-26 09:50:12 UTC
Created attachment 287140 [details]
gsd --debug output showing the problem

Fixed a typo in the debug output annotation
Comment 3 Carlos Garnacho 2015-01-28 14:59:00 UTC
Thanks Matthijs for the patch and analysis. In the mean time, the code around tablet mapping has changed substantially in git master. And this should already be covered by:
https://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/common/gsd-device-mapper.c#n621

This ensures input->output is set from settings before possibly skipping this input device, which is in essence what you're doing in your patch. I'll push a patch similar to yours on the gnome-3-14 branch.
Comment 4 Matthijs Kooijman 2015-01-30 10:46:06 UTC
Hm, it's been a while since I looked at this, so can't really tell if that code would work :-)

In the meanwhile, my wacom tablet configuration seems to have broken entirely, g-c-s tells me there is no tablet attached. Haven't investigated closely yet - if I do and find anything, I'll open a new issue.
Comment 5 GNOME Infrastructure Team 2019-03-20 11:18:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/251.