core: Be more careful around n_modes signedness
This is returned as an integer, which we deal with as an unsigned integer. Deal with it as an integer all along, and skip safely negative values. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1920>
This commit is contained in:
parent
841ee0a227
commit
44af2c0d37
@ -517,7 +517,7 @@ meta_pad_action_mapper_handle_button (MetaPadActionMapper *mapper,
|
|||||||
const ClutterPadButtonEvent *event)
|
const ClutterPadButtonEvent *event)
|
||||||
{
|
{
|
||||||
GDesktopPadButtonAction action;
|
GDesktopPadButtonAction action;
|
||||||
int button, group, mode;
|
int button, group, mode, n_modes = 0;
|
||||||
gboolean is_press;
|
gboolean is_press;
|
||||||
GSettings *settings;
|
GSettings *settings;
|
||||||
char *accel;
|
char *accel;
|
||||||
@ -531,9 +531,11 @@ meta_pad_action_mapper_handle_button (MetaPadActionMapper *mapper,
|
|||||||
group = clutter_input_device_get_mode_switch_button_group (pad, button);
|
group = clutter_input_device_get_mode_switch_button_group (pad, button);
|
||||||
is_press = event->type == CLUTTER_PAD_BUTTON_PRESS;
|
is_press = event->type == CLUTTER_PAD_BUTTON_PRESS;
|
||||||
|
|
||||||
if (is_press && group >= 0)
|
if (group >= 0)
|
||||||
|
n_modes = clutter_input_device_get_group_n_modes (pad, group);
|
||||||
|
|
||||||
|
if (is_press && n_modes > 0)
|
||||||
{
|
{
|
||||||
guint n_modes = clutter_input_device_get_group_n_modes (pad, group);
|
|
||||||
const char *pretty_name = NULL;
|
const char *pretty_name = NULL;
|
||||||
PadMappingInfo *info;
|
PadMappingInfo *info;
|
||||||
#ifdef HAVE_LIBWACOM
|
#ifdef HAVE_LIBWACOM
|
||||||
|
Loading…
Reference in New Issue
Block a user