[mutter/wip/tablet-protocol-v2: 69/70] backends: Implement the "Show OSD" action.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/tablet-protocol-v2: 69/70] backends: Implement the "Show OSD" action.
- Date: Wed, 22 Jun 2016 17:39:09 +0000 (UTC)
commit 07e4aa294112cd3bade2f95fd7d75b5e6ec82b41
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Jun 22 19:16:18 2016 +0200
backends: Implement the "Show OSD" action.
This goes through the MetaDisplay:show-pad-osd signal.
src/backends/meta-input-settings-private.h | 3 ++
src/backends/meta-input-settings.c | 52 +++++++++++++++++++++++++++-
2 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/src/backends/meta-input-settings-private.h b/src/backends/meta-input-settings-private.h
index 40c681c..61e2441 100644
--- a/src/backends/meta-input-settings-private.h
+++ b/src/backends/meta-input-settings-private.h
@@ -126,6 +126,9 @@ gboolean meta_input_settings_handle_pad_button (MetaIn
gchar * meta_input_settings_get_pad_button_action_label (MetaInputSettings
*input_settings,
ClutterInputDevice *pad,
guint button);
+void meta_input_settings_show_pad_osd (MetaInputSettings
*input_settings,
+ ClutterInputDevice *pad,
+ gboolean
edition_mode);
#ifdef HAVE_LIBWACOM
WacomDevice * meta_input_settings_get_tablet_wacom_device (MetaInputSettings *settings,
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
index c23c0f4..e9bde14 100644
--- a/src/backends/meta-input-settings.c
+++ b/src/backends/meta-input-settings.c
@@ -72,6 +72,9 @@ struct _MetaInputSettingsPrivate
#ifdef HAVE_LIBWACOM
WacomDeviceDatabase *wacom_db;
#endif
+
+ ClutterActor *osd;
+ ClutterInputDevice *osd_pad;
};
typedef void (*ConfigBoolFunc) (MetaInputSettings *input_settings,
@@ -1085,6 +1088,9 @@ meta_input_settings_device_removed (ClutterDeviceManager *device_manager,
priv = meta_input_settings_get_instance_private (input_settings);
g_hash_table_remove (priv->mappable_devices, device);
+
+ if (device == priv->osd_pad)
+ clutter_actor_destroy (priv->osd);
}
static void
@@ -1445,6 +1451,18 @@ meta_input_settings_is_pad_button_grabbed (MetaInputSettings *input_settings,
G_DESKTOP_PAD_BUTTON_ACTION_NONE);
}
+static void
+osd_weak_ref_notify (gpointer user_data,
+ GObject *destroyed_object)
+{
+ MetaInputSettings *input_settings = user_data;
+ MetaInputSettingsPrivate *priv;
+
+ priv = meta_input_settings_get_instance_private (input_settings);
+ priv->osd_pad = NULL;
+ priv->osd = NULL;
+}
+
gboolean
meta_input_settings_handle_pad_button (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
@@ -1461,6 +1479,9 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
+ if (priv->osd)
+ return FALSE;
+
action = meta_input_settings_get_pad_button_action (input_settings, pad, button);
switch (action)
@@ -1469,8 +1490,11 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settings,
if (is_press)
meta_input_settings_cycle_tablet_output (input_settings, pad);
return TRUE;
- case G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING:
case G_DESKTOP_PAD_BUTTON_ACTION_HELP:
+ if (is_press)
+ meta_input_settings_show_pad_osd (input_settings, pad, FALSE);
+ return TRUE;
+ case G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING:
case G_DESKTOP_PAD_BUTTON_ACTION_NONE:
default:
return FALSE;
@@ -1513,3 +1537,29 @@ meta_input_settings_get_pad_button_action_label (MetaInputSettings *input_settin
return NULL;
}
}
+
+void
+meta_input_settings_show_pad_osd (MetaInputSettings *input_settings,
+ ClutterInputDevice *pad,
+ gboolean edition_mode)
+{
+ MetaInputSettingsPrivate *priv;
+ DeviceMappingInfo *info;
+ ClutterActor *osd;
+
+ priv = meta_input_settings_get_instance_private (input_settings);
+
+ if (priv->osd)
+ clutter_actor_destroy (priv->osd);
+
+ info = g_hash_table_lookup (priv->mappable_devices, pad);
+ g_signal_emit_by_name (meta_get_display (), "show-pad-osd",
+ pad, info->settings, edition_mode, &osd);
+
+ if (osd)
+ {
+ g_object_weak_ref (G_OBJECT (osd), osd_weak_ref_notify, input_settings);
+ priv->osd_pad = pad;
+ priv->osd = osd;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]