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>
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
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.
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.
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.
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.
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
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.
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
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
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.
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
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.
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.
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.
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
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
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
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
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
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
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
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>