Commit graph

132 commits

Author SHA1 Message Date
Carlos Garnacho
75ce02e202 wacom: Provide connector name for disambiguation
Provide the connector name as the fourth value in the
tablet's output setting. With recent Mutter, this will
allow disambiguating the mapped output if there happens
to be multiple outputs with the same EDID data.
2024-02-06 09:20:01 +00:00
Carlos Garnacho
dac9065dc3 wacom: Drop list to handle pads
This has effectively become a group of one. We can
keep the pad device pointer as well.
2024-02-05 09:49:21 +00:00
Carlos Garnacho
d4d0c60fc7 wacom: Pair only builtin pads with tablets
Pad and tablet grouping has become more irrelevant to the
Settings UI since commit 39402f21ba, as the EKR is the only
known case of an additional pad with distinct vendor/product
that is tied to another device.

But we preserved the grouping of pads (for the tablet EKRs
get paired with), thus possibly still requesting the pad OSD
to be shown on one of these arbitrarily.

In order to ensure that each "Map Buttons..." button in the
UI goes to the right pad being mapped, drop this grouping of
tablets, and make a CcWacomPage only observe a stylus/pad
pair in the same group (i.e. belonging to the same device, if
multiple similar ones are plugged) and with the same vendor+product
(i.e. coming from the same device).

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2876
2024-02-05 09:49:21 +00:00
Hari Rana
d0bcdc9645 wacom: Port to AdwSwitchRow 2024-01-22 09:08:43 +00:00
Robert Ancell
543f24a754 wacom: Do signal handlers in swapped form 2023-05-30 08:36:22 +00:00
Chris Mayo
bd6c61ab06 wacom: Fix WacomPage crash due to unknown type in UI description
Error building template class 'CcWacomPage' for an instance of type 'CcWacomPage': .:0:0 Invalid object type 'CcListRow'
2023-04-17 12:14:58 +00:00
Maksym Hazevych
08c2e69851 Resolving suggestions 2023-03-29 14:26:55 +13:00
Maksym Hazevych
d831e5cb48 Replace all occurrences of 'gtk_widget_show'
Replace all occurrences of 'gtk_widget_show(smth)' with
'gtk_widget_set_visible(smth, TRUE)'.
2023-03-29 14:26:55 +13:00
Carlos Garnacho
92b784f561 wacom: Use Mutter's input mapping interface to show calibration UI
When the "Automatic" mapping is chosen for a display-attached tablet device,
Mutter is in charge of applying the heuristics to map the tablet device to
its most likely attached display.

When that happens, the Wacom panel does not know better (or anything)
to show the calibration UI than picking a GdkMonitor and hoping for the
best.

To improve this situation, Mutter has been added a D-Bus interface so it
is possible to query it for the output that a tablet device is mapped to.
This commit adds the support for this interface, so that the Wacom panel
does know to pick the right GdkMonitor to fullscreen the calibration UI on.
2022-09-01 23:14:07 +02:00
Carlos Garnacho
3f12a7d2cb wacom: Allow NULL monitors in calibration
Unfortunately, this may be the case, it is better to show wonky UI
than no UI at all.
2022-02-12 16:03:37 +00:00
Carlos Garnacho
6c6499e23e wacom: Pass GdkMonitor directly to calibrator object
Instead of figuring out a monitor number from a GdkMonitor, and
look the GdkMonitor back up, pass the GdkMonitor directly.
2022-02-12 16:03:37 +00:00
Carlos Garnacho
fce8b631cc wacom: Rename calibrator API
Add "Cc" prefix so it's more consistent with the rest of the project.
2022-02-12 16:03:37 +00:00
Carlos Garnacho
3d4d785588 wacom: Drop unused API
This function was only used for logging purposes, we can do
without it.
2022-02-12 16:03:37 +00:00
Carlos Garnacho
a9127145d3 wacom: Move tablet/stylus sections to AdwPreferencesGroup
There is now the header-suffix property that makes it possible to add
tablet/stylus icons besides the title/description, so we can simply
use this widget.
2022-02-01 14:18:53 +00:00
Carlos Garnacho
653d66b7a7 wacom: Add description subtitles to tablet devices 2022-02-01 14:18:53 +00:00
Carlos Garnacho
7806b88460 wacom: Refresh UI
Use libadwaita widgets, and follow recent mockups for this panel.
2022-02-01 14:18:53 +00:00
Georges Basile Stavracas Neto
816e6203e3 wacom: Port to GTK4
Many part of this commit were made by Carlos
Garnacho <carlosg@gnome.org>

WIP wacom: Port to GTK4

Lots of stuff missing and probably broken.

wacom: Port CcDrawingArea input to gestures

We have a handy GtkGestureStylus to use here, which avoids direct
handling of GdkEvents.

wacom: Update current stylus tracking to GtkGestureStylus

Use the ::proximity signal to notice when we are being hovered with
a tablet stylus, and look up the tool from there.
2021-12-14 22:34:21 -03:00
Carlos Garnacho
297906685e wacom: Group pad/stylus devices together with the group name
This will cover the regular case of pads attached to a tablet, but
also the EKR case where the pad is a separate device logically
grouped with a tablet.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/415
2020-09-04 21:46:19 +00:00
Carlos Garnacho
eb14c5a64f wacom: Cater for multiple pads in the CcWacomPage
We don't need to track them much specifically, as we delegate pad
button mapping UI on GNOME Shell. It is however possible to have
tablets with 0 to N pads (upper bound within sanity = 2), so we
must at least reflect that in the "Map Buttons..." button visibility.

This distinction is most important for the combination of EKR plus
Cintiq 27QHD, as this is a pad-less tablet, for which we wouldn't
usually show the "Map buttons..." action.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/415
2020-09-04 21:46:19 +00:00
Carlos Garnacho
e50f27a96b wacom: Let CcWacomPage track pad devices
This puts stylus/pad tracking on 2 separate levels. The CcWacomPanel
will look for styli, and treat them as "device leaders", adding a
CcWacomPage for them.

The CcWacomPage will then track the related pad, and update the
"Map buttons..." action visibility according to it.

This simplifies tablet page creation (eg. have it completed in one
step), and decouples the device grouping logic from CcWacomPanel,
which will be useful in future commits.
2020-09-04 21:46:19 +00:00
Yuri Chornoivan
e7050ab6f4 Fix minor typos 2020-07-20 10:38:09 +03:00
Robert Ancell
e6128c9ffd wacom: Connect signals with g_signal_connect_object in swapped form 2020-03-30 16:18:50 +13:00
Carlos Garnacho
edd7f97422 wacom: Avoid poking disposed object
A little above in the function, we update the page UI, maybe destroying
the bits that allow decoupling display-attached tablets from their display.
Later on, we unconditionally update its GtkSwitch.

This can't bode well on tablets where the widget was already destroyed.
2019-12-18 00:24:22 +00:00
Carlos Garnacho
a209fed611 wacom: Allow decoupling screen tablets from their respective output
This is useful for 2 cases:
- Tablet-input-driven setups where it makes sense to be able to quickly
  reach other monitors with the tablet.
- (Hopefully a minority) Cases where our display mapping heuristics go
  wrong and tablet gets assigned to a wrong monitor.

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/239
2019-09-10 10:47:17 +12:00
Robert Ancell
dab5f5301f wacom: Use g_auto for variables 2019-09-09 22:08:26 +00:00
Carlos Garnacho
67c8ef42d7 wacom: Align buttons/links to the left side
Looks more natural this way. All buttons and links have been moved
into the main grid so this is possible. The links additionally had
to be removed all the padding so they actually align visually.

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/238
2019-01-07 21:24:15 +00:00
Robert Ancell
aeca65c729 wacom: Replace GObject boilerplate with G_DECLARE_TYPE 2018-08-02 21:48:02 +00:00
Carlos Garnacho
35adc02d42 wacom: Use GdkMonitor API on calibrator UI
Replaces usage of deprecated GdkScreen API. We still have to pass
monitor numbers around for gdk_window_fullscreen_on_monitor(), such
is life.
2018-05-26 10:09:28 +02:00
Carlos Garnacho
2503832046 wacom: Use GdkSeat API to list slave stylus devices
Replaces usage of deprecated API.
2018-05-26 10:09:28 +02:00
Jason Gerecke
978ccdc9af wacom: Correct order of area calibration values
Commit cf408c27b0 changed how the values stored in the "area" key were
calculated in order be compatible with its updated schema. Unfortunately,
it overlooked the fact that updated schema also changed the order of the
values from "left, top, right, bottom" to "left, right, top, bottom".
Because of this, corrections intended to be applied to the top and right
screen edges were swapped. This can cause a noticible cursor offset to
occur after finishing calibration.

https://bugzilla.gnome.org/show_bug.cgi?id=784009
2017-07-05 23:46:22 +02:00
Jason Gerecke
50b39dc570 wacom: Drop old_axes from calibration API
The calibration utility was modified in cf408c27b0 to return unitless
padding measurements instead of axis values for storage in gsettings.
Unfortunately, the code still assumes in some places that it is working
with axes rather than paddings. This causes subtle math errors that
result in undesired cursor offsets after the calibration is applied.

Fortunately, this can be simplified, since tablet area is always reset
to the default state before starting calibration, we are sure that the
value will remain constant. Since both axes are in the same 0..1 scale,
calibration code doesn't need to swap X/Y back and forth to calculate
each axis scale.

Additionally, the code to get the calibrated axis values has been moved
into its own function along with a new function that returns padding
values suitable for consumption by g-c-c. All calculations are performed
internally in the 0..1 range.

https://bugzilla.gnome.org/show_bug.cgi?id=784009

Co-Authored-By: Carlos Garnacho <carlosg@gnome.org>
2017-07-05 23:46:22 +02:00
Carlos Garnacho
42489e2509 wacom: Map the GsdDevice to a GdkDevice when spawning the calibrator
This makes the calibrator only reactive to the tablet being calibrated
again.

https://bugzilla.gnome.org/show_bug.cgi?id=782040
2017-06-30 21:11:54 +02:00
Carlos Garnacho
b26d6acb5f wacom: Make calibrator use GDK for button events
This way we can cut down the last step in the mapping across
GUdevDevice->GsdDevice->GdkDevice->ClutterInputDevice.

https://bugzilla.gnome.org/show_bug.cgi?id=782040
2017-06-30 21:11:54 +02:00
Carlos Garnacho
7dfb7d2e5e wacom: Use updated ui files 2016-11-04 23:27:12 +01:00
Carlos Garnacho
cf408c27b0 wacom: Instaurate calibration
The "area" setting has a different treatment in the gsettings-desktop-schemas
tablet schema, the 4 double values express the padding (in unitless 0..1
range) on each of the sides of the tablet. It's been done so we don't rely
on input/output units, which we might have not the luxury to access.

Besides that, the dependency on GsdWacomDevice has been cleared.
2016-11-04 23:26:42 +01:00
Carlos Garnacho
dbff3d9284 wacom: Remove unused struct definition
It seems this was never used.
2016-11-04 23:26:42 +01:00
Carlos Garnacho
b5de120e3f wacom: Poke the org.gnome.Shell D-Bus call to show the pad OSD
This feature now belongs in gnome-shell, not g-s-d. The D-Bus API
changed correspondingly.
2016-11-04 23:26:42 +01:00
Carlos Garnacho
143b7ac849 wacom: Populate button mapping dialog
We now use the CcWacomDevice API for this.
2016-11-04 23:26:41 +01:00
Carlos Garnacho
4743770832 wacom: Update to the new data model
There's much going on under the hood here:
- Styli and tablets are now in split views, as per the mockups.
- CcWacomDevice and CcWacomTool are now in use, with the subsequent
  API use changes. Moreover, using these objects means using the
  newer schemas in gsettings-desktop-schemas, so there had to be
  changes in the settings we store too.
- We now use CcTabletToolMap, plus listen to tool proximity events,
  populating the "Stylus" sub-pane with those.
2016-11-04 23:26:41 +01:00
Carlos Garnacho
adb82f0d00 wacom: Drop usage of last-calibration-resolution
This is gone from the g-s-d schema, so just stop setting it.

https://bugzilla.gnome.org/show_bug.cgi?id=748660
2015-04-29 19:35:34 +02:00
Carlos Garnacho
6365dafd92 wacom: Sync gsd-wacom-device.[ch] with g-s-d
And use the GdkDevice getter where it applies.
2015-04-13 14:38:24 +02:00
Benjamin Tissoires
66cb45bdad wacom: do not bail out if the tablet doesn't have an eraser
Tablets have not always an eraser (most of the generic tablets like Huion,
UC-Logic, etc... don't). We should not reject such tablets.

Commit 54849a9 (wacom: Only the stylus and eraser tools need to exist)
mentioned that we were not sure about eraser, and I think we should not
assume one either.

To do so, we simply ignore the eraser xinput node and rely on
libwacom to actually provide the eraser information.

If the stylus does not have the eraser tip, we may fall in the
LAYOUT_OTHER case. We have a picture of a generic Wacom pen with an
eraser, and the leaders linking the widget to the picture are scrambled.

To prevent that, gray out the eraser pressure slider so that we do not
break the layout.

https://bugzilla.gnome.org/show_bug.cgi?id=746117
2015-04-01 11:15:29 +02:00
Daniel Mustieles
2c5951819d Updated FSF's address 2014-01-29 11:27:38 +01:00
Yosef Or Boczko
ae36409c5f wacom: Use margin-start/end instead of margin-left/right
https://bugzilla.gnome.org/show_bug.cgi?id=712661
2013-11-19 22:34:39 +02:00
Bastien Nocera
297eb6cfbb wacom: Fix use after free
Causing random values in the calibration data.
2013-10-08 18:59:22 +02:00
Bastien Nocera
6aa409ffdb wacom: Reset the calibration before starting a new one
We shouldn't be using the old calibration values to create the
new ones, so reset the "area" settings before starting a new
calibration, and re-apply the saved calibration if the calibration
is cancelled or fails.

https://bugzilla.gnome.org/show_bug.cgi?id=707784
2013-10-08 18:02:43 +02:00
Bastien Nocera
387e3f98f7 wacom: Print debug when calibration is finished 2013-10-04 11:16:45 +02:00
Joaquim Rocha
d83e0ff5c1 wacom: Call the OSD window for assigning the tablets' buttons
It falls back to the listbox view in case the OSD cannot be shown.

https://bugzilla.gnome.org/show_bug.cgi?id=704798
2013-07-26 20:04:35 +02:00
Joaquim Rocha
df161dba18 wacom: Use a GtkListBox for the buttons' mapping instead of a GtkTreeView
https://bugzilla.gnome.org/show_bug.cgi?id=703148
2013-07-24 11:18:24 +02:00
Yosef Or Boczko
cf81bc227f wacom: drop GtkStock
https://bugzilla.gnome.org/show_bug.cgi?id=704178
2013-07-19 15:59:26 +03:00