[mutter/wip/carlosg/mode-switch-fix: 2/2] core: Be more careful around n_modes signedness
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/mode-switch-fix: 2/2] core: Be more careful around n_modes signedness
- Date: Wed, 7 Jul 2021 16:38:53 +0000 (UTC)
commit a4e79a4cc336baa5ae614b4659e427614acbf61f
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jul 7 18:33:04 2021 +0200
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.
src/core/meta-pad-action-mapper.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/core/meta-pad-action-mapper.c b/src/core/meta-pad-action-mapper.c
index e5331e1dd2..7c78c40148 100644
--- a/src/core/meta-pad-action-mapper.c
+++ b/src/core/meta-pad-action-mapper.c
@@ -517,7 +517,7 @@ meta_pad_action_mapper_handle_button (MetaPadActionMapper *mapper,
const ClutterPadButtonEvent *event)
{
GDesktopPadButtonAction action;
- int button, group, mode;
+ int button, group, mode, n_modes = 0;
gboolean is_press;
GSettings *settings;
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);
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;
PadMappingInfo *info;
#ifdef HAVE_LIBWACOM
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]