[mutter] core: Add MetaDisplay::show-osd signal
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] core: Add MetaDisplay::show-osd signal
- Date: Fri, 10 Feb 2017 22:51:51 +0000 (UTC)
commit 07ce981cb082947e10e454fdb4c48fe88ce7606a
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Dec 28 12:03:29 2016 +0100
core: Add MetaDisplay::show-osd signal
And add specific private methods to notify about tablet mapping and mode
switches. The signal allows the mutter side to trigger OSDs in a generic
way.
https://bugzilla.gnome.org/show_bug.cgi?id=771098
src/core/display-private.h | 11 +++++++++
src/core/display.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 0 deletions(-)
---
diff --git a/src/core/display-private.h b/src/core/display-private.h
index fa5fff4..9e4518b 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -496,4 +496,15 @@ void meta_display_set_alarm_filter (MetaDisplay *display,
MetaAlarmFilter filter,
gpointer data);
+void meta_display_show_tablet_mapping_notification (MetaDisplay *display,
+ ClutterInputDevice *pad,
+ const gchar *pretty_name);
+
+void meta_display_notify_pad_group_switch (MetaDisplay *display,
+ ClutterInputDevice *pad,
+ const gchar *pretty_name,
+ guint n_group,
+ guint n_mode,
+ guint n_modes);
+
#endif
diff --git a/src/core/display.c b/src/core/display.c
index a71be59..372457f 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -131,6 +131,7 @@ enum
SHOW_RESIZE_POPUP,
GL_VIDEO_MEMORY_PURGED,
SHOW_PAD_OSD,
+ SHOW_OSD,
LAST_SIGNAL
};
@@ -377,6 +378,13 @@ meta_display_class_init (MetaDisplayClass *klass)
CLUTTER_TYPE_ACTOR, 5, CLUTTER_TYPE_INPUT_DEVICE,
G_TYPE_SETTINGS, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT);
+ display_signals[SHOW_OSD] =
+ g_signal_new ("show-osd",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING);
+
g_object_class_install_property (object_class,
PROP_FOCUS_WINDOW,
g_param_spec_object ("focus-window",
@@ -3181,3 +3189,47 @@ meta_display_get_pad_action_label (MetaDisplay *display,
return NULL;
}
+
+static void
+meta_display_show_osd (MetaDisplay *display,
+ gint monitor_idx,
+ const gchar *icon_name,
+ const gchar *message)
+{
+ g_signal_emit (display, display_signals[SHOW_OSD], 0,
+ monitor_idx, icon_name, message);
+}
+
+static gint
+lookup_tablet_monitor (MetaDisplay *display,
+ ClutterInputDevice *device)
+{
+ MetaInputSettings *input_settings;
+ MetaLogicalMonitor *monitor;
+ gint monitor_idx = -1;
+
+ input_settings = meta_backend_get_input_settings (meta_get_backend ());
+ if (!input_settings)
+ return -1;
+
+ monitor = meta_input_settings_get_tablet_logical_monitor (input_settings, device);
+
+ if (monitor)
+ {
+ monitor_idx = meta_screen_get_monitor_index_for_rect (display->screen,
+ &monitor->rect);
+ }
+
+ return monitor_idx;
+}
+
+void
+meta_display_show_tablet_mapping_notification (MetaDisplay *display,
+ ClutterInputDevice *pad,
+ const gchar *pretty_name)
+{
+ if (!pretty_name)
+ pretty_name = clutter_input_device_get_device_name (pad);
+ meta_display_show_osd (display, lookup_tablet_monitor (display, pad),
+ "input-tablet-symbolic", pretty_name);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]