GNOME Bugzilla – Bug 657423
Calibrate button doesn't do anything
Last modified: 2012-01-18 23:44:36 UTC
SSIA. It was hidden in commit 44dddf75794010be7602bb607304b7585c0dc766.
Peter, could you please let me know what the process should be here, example code, prior art?
The best I have so far is the mockup in http://live.gnome.org/Design/SystemSettings/Tablet which hints at tapping certain marked locations on the screen. http://libregraphicsworld.org/blog/entry/peter-hutterer-on-the-gnome-applet-for-wacom-tablets may also have some information.
Basic process should be to tap on a few corners of the screen and get the coordinates from the device for these corners. Easiest to grab the device for this. The actual calibration is handled by the "Wacom Tablet Area" property which takes the active area in device coordinates. So you need to map those points to what the device coordinates _should_ be and then compare them to the coordinates you get and calc the offset. Main difficulty (code-wise) is that you _also_ need to take the "Coordinate Transformation Matrix" into account since that may tie the device to a screen or an area. Should be easy enough though, you multiply x/y coming from the driver with the matrix and that gives you back whatever the device gives you. pseudo-code for first crosshair placed at 1/10 of screen width: M = coordinate transformation matrix get device coordinate range for x/y display crosshair at width * 0.1/height * 0.1 grab device get first tap coordinates real coords = tap coords * M tablet area x value: tap x coord - device-width/10 tablet area y value: tap y coord - device-height/10 and then the same with a second crosshair. Come to think of it, we're probably fine just displaying a crosshair top-right and bottom-left.
Created attachment 204970 [details] [review] Patch 1/3 - Megapatch
Created attachment 204971 [details] [review] Patch 2/3 - Wire up calibrate button to calibration utility
Created attachment 204972 [details] [review] Patch 3/3 - Show calibrate button again
Been working on this and have a set of three patches that get calibration working again. The first is a "megapatch" that brings over a trimmed down version of xinput_calibrator. The second adds glue code into the wacom panel to start up the calibration utility when the calibration button is pressed. The third makes the calibration button visible once again. Note to self: the contents of this field aren't saved when using "add an attachment"...
Committed with a bunch of fixes already. There's much more to be done, especially i18n support (which probably means not using raw cairo to print), multi-monitor support, and UI changes to match the mockups.
Created attachment 205565 [details] [review] wacom: add 'display' key to schema Adds a new 'display' key to the Wacom schema which shall be used to store EDID information about the display the tablet should be mapped to. It should contain the data [vendor, product, serial] if an output is set or ["", "", ""] otherwise.
Created attachment 205566 [details] [review] wacom: Add functions to locate tablet display Adds functions to get information about the display a tablet should be mapped to. The "display" key in gsettings is first consulted for EDID data and outputs scanned for a match. If none is found, we look for one heuristically (in this case, find a screen from vendor "WAC"). If still nothing is found, we assume whole desktop (well, whole "screen") mapping.
Created attachment 205567 [details] [review] common: Add "type" field to the PropertyHelper struct This patch adds a "type" field to the PropertyHelper struct and changes the device_set_property function to make use of this type information. While most X properties have the type XA_INTEGER, other types exist as well (notably the "FLOAT" type used by the "Coordinate Transformation Matrix" property).
Created attachment 205568 [details] [review] wacom: Initialize tablet mapping and react to gsettings changes g-s-d sets the tablet mapping when a tablet is plugged in, as well as when the 'display' key is changed.
Created attachment 205569 [details] [review] wacom: Automatically assign 'display' when heuristically found If find_output was unable to find a defined mapping, but heuristics provided a match, go ahead and store the mapping automatically.
Created attachment 205573 [details] [review] wacom: Bring over files from g-s-d
Created attachment 205574 [details] [review] wacom: Get monitor tablet has ben mapped to before calibrating More precisely, this patch cecks if the tablet *could* be mapped. gsd_wacom_device_get_display_monitor has a side-effect of automatically mapping the tablet if it is necessary and possible to ensure that it *is* mapped. If the tablet isn't and can't be mapped, calibration is pointless.
Created attachment 205575 [details] [review] wacom: Specify monitor to use when calling run_calibration Changes the signature of run_calibration to require the monitor that calibration should take place on.
Attachment 205565 [details] pushed as eb8ee18 - wacom: add 'display' key to schema Attachment 205566 [details] pushed as b5f50e4 - wacom: Add functions to locate tablet display Attachment 205567 [details] pushed as 4727bf4 - common: Add "type" field to the PropertyHelper struct Attachment 205568 [details] pushed as 02f0d54 - wacom: Initialize tablet mapping and react to gsettings changes Attachment 205569 [details] pushed as f32c8ff - wacom: Automatically assign 'display' when heuristically found
All done! Thanks for the patches.