core: Separate MetaPadActionMapper pad button labeling

This will be handled separately in future commits.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3005>
This commit is contained in:
Carlos Garnacho 2023-05-16 15:40:35 +02:00 committed by Marge Bot
parent 85ac3a2d1a
commit b6a6e9f187
3 changed files with 33 additions and 18 deletions

View File

@ -2739,12 +2739,21 @@ meta_display_get_pad_action_label (MetaDisplay *display,
MetaPadFeatureType feature,
guint action_number)
{
gchar *label;
char *label;
/* First, lookup the action, as imposed by settings */
label = meta_pad_action_mapper_get_action_label (display->pad_action_mapper,
pad, feature,
action_number);
if (feature == META_PAD_FEATURE_BUTTON)
{
label = meta_pad_action_mapper_get_button_label (display->pad_action_mapper,
pad, action_number);
}
else
{
label = meta_pad_action_mapper_get_feature_label (display->pad_action_mapper,
pad, feature,
action_number);
}
if (label)
return label;

View File

@ -838,10 +838,10 @@ meta_pad_action_mapper_get_strip_label (MetaPadActionMapper *mapper,
return label;
}
static char *
char *
meta_pad_action_mapper_get_button_label (MetaPadActionMapper *mapper,
ClutterInputDevice *pad,
guint button)
ClutterInputDevice *pad,
int button)
{
GDesktopPadButtonAction action;
int group;
@ -916,23 +916,24 @@ get_current_pad_mode (MetaPadActionMapper *mapper,
}
char *
meta_pad_action_mapper_get_action_label (MetaPadActionMapper *mapper,
ClutterInputDevice *pad,
MetaPadFeatureType feature,
guint number)
meta_pad_action_mapper_get_feature_label (MetaPadActionMapper *mapper,
ClutterInputDevice *pad,
MetaPadFeatureType feature,
int number)
{
guint mode;
unsigned int mode;
switch (feature)
{
case META_PAD_FEATURE_BUTTON:
return meta_pad_action_mapper_get_button_label (mapper, pad, number);
case META_PAD_FEATURE_RING:
mode = get_current_pad_mode (mapper, pad, feature, number);
return meta_pad_action_mapper_get_ring_label (mapper, pad, number, mode);
case META_PAD_FEATURE_STRIP:
mode = get_current_pad_mode (mapper, pad, feature, number);
return meta_pad_action_mapper_get_strip_label (mapper, pad, number, mode);
default:
g_assert_not_reached ();
break;
}
return NULL;

View File

@ -38,9 +38,14 @@ gboolean meta_pad_action_mapper_is_button_grabbed (MetaPadActionMapper *mapper,
guint button);
gboolean meta_pad_action_mapper_handle_event (MetaPadActionMapper *mapper,
const ClutterEvent *event);
gchar * meta_pad_action_mapper_get_action_label (MetaPadActionMapper *mapper,
ClutterInputDevice *pad,
MetaPadFeatureType feature,
guint number);
char * meta_pad_action_mapper_get_button_label (MetaPadActionMapper *mapper,
ClutterInputDevice *pad,
int button);
char * meta_pad_action_mapper_get_feature_label (MetaPadActionMapper *mapper,
ClutterInputDevice *pad,
MetaPadFeatureType feature,
int number);
#endif /* META_PAD_ACTION_MAPPER_H */