mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
core: Add public MetaDisplay functions to get action labels for pad buttons
This API will be used from the gnome-shell pad OSD implementation, in order to show the actions that currently apply to every button/ring/strip in the tablet.
This commit is contained in:
parent
67f5b89659
commit
185eabd3e3
@ -53,6 +53,7 @@
|
||||
#include "backends/native/meta-backend-native.h"
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/meta-stage.h"
|
||||
#include "backends/meta-input-settings-private.h"
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
|
||||
#ifdef HAVE_RANDR
|
||||
@ -75,6 +76,8 @@
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
#include "wayland/meta-xwayland-private.h"
|
||||
#include "wayland/meta-wayland-tablet-seat.h"
|
||||
#include "wayland/meta-wayland-tablet-pad.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -3070,3 +3073,50 @@ meta_display_set_alarm_filter (MetaDisplay *display,
|
||||
display->alarm_filter = filter;
|
||||
display->alarm_filter_data = data;
|
||||
}
|
||||
|
||||
gchar *
|
||||
meta_display_get_pad_action_label (MetaDisplay *display,
|
||||
ClutterInputDevice *pad,
|
||||
MetaPadActionType action_type,
|
||||
guint action_number)
|
||||
{
|
||||
gchar *label;
|
||||
|
||||
/* First, lookup the action, as imposed by settings */
|
||||
if (action_type == META_PAD_ACTION_BUTTON)
|
||||
{
|
||||
MetaInputSettings *settings;
|
||||
|
||||
settings = meta_input_settings_get ();
|
||||
label = meta_input_settings_get_pad_button_action_label (settings, pad, action_number);
|
||||
if (label)
|
||||
return label;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
/* Second, if this wayland, lookup the actions set by the clients */
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
MetaWaylandCompositor *compositor;
|
||||
MetaWaylandTabletSeat *tablet_seat;
|
||||
MetaWaylandTabletPad *tablet_pad = NULL;
|
||||
|
||||
compositor = meta_wayland_compositor_get_default ();
|
||||
tablet_seat = meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager,
|
||||
compositor->seat);
|
||||
if (tablet_seat)
|
||||
tablet_pad = meta_wayland_tablet_seat_lookup_pad (tablet_seat, pad);
|
||||
|
||||
if (tablet_pad)
|
||||
{
|
||||
label = meta_wayland_tablet_pad_get_label (tablet_pad, action_type,
|
||||
action_number);
|
||||
}
|
||||
|
||||
if (label)
|
||||
return label;
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -188,4 +188,9 @@ void meta_display_unfreeze_keyboard (MetaDisplay *display,
|
||||
gboolean meta_display_is_pointer_emulating_sequence (MetaDisplay *display,
|
||||
ClutterEventSequence *sequence);
|
||||
|
||||
gchar * meta_display_get_pad_action_label (MetaDisplay *display,
|
||||
ClutterInputDevice *pad,
|
||||
MetaPadActionType action_type,
|
||||
guint action_number);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user