Commit graph

428 commits

Author SHA1 Message Date
Philip Withnall
e522e5e732 wacom: Fix a critical warning if loading a cursor fails
It’s possible for `gdk_cursor_new_for_display()` to return `NULL`. It’s
OK to pass `NULL` to `gdk_window_set_cursor()`, but not OK to then unref
it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-11-02 21:41:03 +00: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
7c85d5a871 wacom: Pick libwacom's Generic Pen stylus if tool ID is 0
We generally use tool ID 0 if the ID is actually unknown, libwacom however
assigns 0xfffff to such device. Make it sure we find the "Generic Pen"
stylus description in that case.
2020-02-13 22:15:00 +00:00
Robert Ancell
93b14a4339 panel: Move shared GCancellable code into panel class
Make the panel class provide a cancellable that will be cancelled when the panel
is destroyed. Panel implementations can use this and not have to mangage the
cancellable themselves. Consolidate cases where panels had multiple cancellables
that were all being used for this behaviour.
2020-02-03 09:36:24 +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
Robert Ancell
34cb560009 wacom: Replace ifdefs with #pragma once 2019-11-27 21:56:10 +00:00
Carlos Garnacho
c9ef4fee0f wacom: Snap tip/eraser pressure feel to the allowed values
And add markers for those. We only allow a total of 7 fixed pressure curve
values, so make the UI clear about it.

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/483
2019-09-09 22:52:44 +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
Georges Basile Stavracas Neto
75f150d5a2 shell: Add position to cc_shell_embed_widget_in_header()
So we can control where the widget should be added to. The
main window only supports left and right positions.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/528
2019-05-21 12:59:36 -03:00
Carlos Garnacho
8f825c5cc0 wacom: Dispose custom style provider with calibrator
Each CalibArea created adds a style provider that is never removed,
remove it on calib_area_free() to avoid the leak.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/504
2019-05-01 16:10:06 +02:00
Carlos Garnacho
dbd78496e1 wacom: Ensure calibrator UI CSS only applies to its UI
Set a name on the fullscreen window, and require it in all selectors
in the custom CSS. Fixes style leaking to other g-c-c bits.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/504
2019-05-01 16:09:58 +02:00
Carlos Garnacho
4860f3637c wacom: Update "Test your settings" button sensitivity on device availability
The button/popover are meaningless if there's no device to test with. Set
it inactive (so the popover hides if visible) and set insensitive if no
devices are found.
2019-02-12 00:40:14 +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
Carlos Garnacho
a4cc9d35b9 wacom: Always try to add the stylus page UI on proximity
This used to be done only if the stylus was "brand new", because pages for
previously known styli are added when the tablet is detected/plugged. There
are however situations where this may break: eg. the stylus was previously
known through a tablet that is not plugged ATM. The tool is however "not
new" so no UI is added for it.

We should try to add the stylus invariably on proximity, add_stylus_page()
ensures there is only one page per tool anyway.

Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/315
2019-01-05 12:36:59 +00:00
Peter Hutterer
def41bc0fe wacom: ignore the wacom driver's touch tool type
When the wacom driver handles the touch device, we get a tool id of 0x3. Let's
ignore that because we don't need a tool for the touch node.

Ideally we should be able to rely on the GDK tool type but that one is always
GDK_DEVICE_TOOL_TYPE_UNKNOWN see
https://gitlab.gnome.org/GNOME/gtk/merge_requests/453

A GTK bug (also fixed in that MR) prevents the tool id from updating.
Until that GTK bug is fixed the pen will only be detected if it is the first
event from this physical device. If the touch node sends an event before the
pen, the pen won't be detected.
2018-12-18 20:46:02 +00:00
Peter Hutterer
a82b975367 wacom: Only write a generic pen to the keyfile when it's previously unseen
When we bring a generic pen (serial 0) into proximity, the tool is initialized
as "generic" and mapped to the current tablet. This is then written out into
the keyfile, so we end up with something like:

[056a:00d1]
Styli=generic;

On the next g-c-c start the generic pen is pre-loaded from the keyfile but not
yet associated with the tablet. When the pen gets into proximity the
association was handled like a completely new pen, thus triggering a key file
entry again. Eventually, our styli list looked like this:

[056a:00d1]
Styli=generic;generic;generic;generic;generic;generic;

Fix this by remembering whether we freshly initialized the tool or whether it
was already known. Since we can only have one generic tool per tablet (because
we wouldn't notice the difference between two physical tools) we just skip the
write of the keyfile.

Fixes #313
2018-12-18 20:46:02 +00:00
Peter Hutterer
d925ea3c6c wacom: Map wacom-driver-specific generic IDs to 0
The xf86-input-wacom driver doesn't use 0 for tools that do not have an id or
serials. Serials default to 1, and the tool id is either 0x2 for stylus or 0xa
for eraser, see xf86WacomDefs.h, the defines for STYLUS_DEVICE_ID and
ERASER_DEVICE_ID.

libwacom uses 0xfffff and 0xffffe for the generic pens and all the lookup code
we have in the panel is designed for a serial/tool id of 0. So let's just map
the wacom driver IDs to 0 at the only transition point between Gdk and our
panel.

No devices with serials 0 or hw ids 2/10 exist, so this shouldn't have side
effects. This only affects X + xf86-input-wacom.
2018-12-18 20:46:02 +00:00
Carlos Garnacho
07410fb2f8 wacom: Update to newer "output" setting
The semantics are pretty much the same for opaque tablets, not
much else to do here.
2018-12-06 14:45:40 +00:00
Carlos Garnacho
d51336c2c2 wacom: Port calibrator UI to GTK+
Same dog, different collar. The UI has been ported 1:1 to GTK+, using
GtkBuilder, CSS and event controllers fairly reduced the amount of code
needed for this.

It also allows us to stop initializing clutter-gtk across the several
executables.
2018-11-07 23:02:10 +00:00
Robert Ancell
ead164b6da wacom: Remove unused tabs in UI
There were some tabs that were not visible and not used. They also
had translatable text that was not used.
2018-08-27 02:55:21 +00:00
Robert Ancell
b51af0fc58 wacom: Replace ifdefs with #pragma once 2018-08-02 21:48:03 +00:00
Robert Ancell
aeca65c729 wacom: Replace GObject boilerplate with G_DECLARE_TYPE 2018-08-02 21:48:02 +00:00
Sam Hewitt
e66ee02953 wacom: use dim-label class on icons instead of opacity for consistency 2018-07-10 17:53:56 -04:00
Sam Hewitt
24174173be common: update pixel_size values to base 16 for icon clarity 2018-07-10 17:52:08 -04:00
Bastien Nocera
0e2a4aa2d6 wacom: Hide Wacom panel when there are no tablets
Use GsdDeviceManager to monitor libwacom-supported tablets coming and
going. Hide the Wacom panel from the list when there's no supported
tablets plugged in.
2018-06-20 12:53:11 +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
c3b34e6798 wacom: Use GdkSeat grabs in g-c-c's pad button action mapper UI
Replaces usage of deprecated API.
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
Georges Basile Stavracas Neto
af0186aaf9 project: Update meson files
I probably have OCD. Seeing these files
with this poor alignment gives me physical
pain.
2018-05-03 00:45:29 -03:00
Piotr Drąg
7265bd53a0 Add translator comments to .desktop files
Icons are confusing translators, and gettext
is unlikely to get fixed any time soon.
2018-02-23 18:49:35 +01:00
Jason Gerecke
f57a192564 wacom: Support the WSTYLUS_3D stylus type
Wacom's new "Pro Pen 3D" stylus is declared as a new stylus type within
libwacom: WSTYLUS_3D. Now that the Wacom panel supports arbitrary three-
button styli, we can add specific support for this new stylus type to
suppress the warning message that is generated.

https://bugzilla.gnome.org/show_bug.cgi?id=790028
2018-01-30 21:23:24 +01:00
Jason Gerecke
039f30a535 wacom: Add support for three-button styli
Wacom has introduced its new "Pro Pen 3D" stylus which includes a third
button. This commit adds support for arbitrary three-button styli.

https://bugzilla.gnome.org/show_bug.cgi?id=790028
2018-01-30 21:23:24 +01:00
Jason Gerecke
69e94483b7 wacom: Make remove_buttons dynamic
Both 'remove_buttons' and 'remove_button' perform the same general task and
can be unified into a single function. This makes supporting an arbitrary
number of stylus buttons more straightforward.

https://bugzilla.gnome.org/show_bug.cgi?id=790028
2018-01-30 21:23:24 +01:00
Jason Gerecke
0c65e04b2e wacom: Set combo-topbutton to current value for styli with > 2 buttons
Although the Wacom panel doesn't have explicit support for styli with more
than two buttons, it tries to at least allow configuration of the upper and
lower buttons. This commit fixes an incorrect conditional which prevents
the panel from setting the combo box for the upper switch to the current
setting.

https://bugzilla.gnome.org/show_bug.cgi?id=790028
2018-01-30 21:23:24 +01:00
Iñigo Martínez
0dd386f405 build: Migrate from Intltool to Gettext
Recent versions of Gettext are able to translate several formats
that are used in GNOME applications. This patch migrates from
Intltool to Gettext by using meson's i18n features.

https://bugzilla.gnome.org/show_bug.cgi?id=787588
2018-01-23 10:49:31 +01:00
Iñigo Martínez
dc0988d47c build: Remove autotools
To avoid the burden of maintaining multiple build systems, this
patch removes autotools support.

https://bugzilla.gnome.org/show_bug.cgi?id=785414
2018-01-18 12:20:08 +01:00
Piotr Drąg
b65e31323a panels: Remove soft hyphens from .desktop files
With the old shell gone, there is no need to work around cut off panel
names (bug #647087). As it stands now, it only confuses translators
(invisible characters are hard to, well, see).

https://bugzilla.gnome.org/show_bug.cgi?id=792629
2018-01-18 00:12:04 -02:00
Iñigo Martínez
32edd6789e build: Port to meson build system
Meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.

https://bugzilla.gnome.org/show_bug.cgi?id=785414
2018-01-17 20:09:35 -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
Bastien Nocera
60ad6a35b4 wacom: Fix compile-time warning
expected ‘GtkWidget * {aka struct _GtkWidget *}’ but argument is of type ‘CcWacomNavButton * {aka struct _CcWacomNavButton *}’
2017-06-07 18:17:33 +02:00
Bastien Nocera
3f0510cac8 build: Better libm checks
Use AC_CHECK_LIBM instead of AC_CHECK_LIB(m,...
and use $(LIBM) instead of hardcoding "-lm" in Makefiles.
2017-02-08 19:21:53 +01:00
Bastien Nocera
aaf037d9a7 wacom: Fix format errors
format ‘%d’ expects argument of type ‘int’, but argument 2 has type
‘gdouble {aka const double}’
2016-11-16 17:03:49 +01:00