[mutter] _MUTTER_HINTS
- From: Tomas Frydrych <tomasf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] _MUTTER_HINTS
- Date: Fri, 14 May 2010 11:22:46 +0000 (UTC)
commit 28767c4d344ff61215a1b415e005cbfd20aee98c
Author: Tomas Frydrych <tf linux intel com>
Date: Mon Jan 18 10:12:17 2010 +0000
_MUTTER_HINTS
A per-window _MUTTER_HINTS property allowing plugins to use custom hints. The
property holds a colon separated list of key=value pairs; plugin-specific keys
must be suitably namespaced, while 'mutter-' prefix is reserved for internal
Mutter use only.
This commit adds MetaWindow::mutter-hints property, and
meta_window_get_mutter_hints() accessor, as well as the internal machinery for
reading and updating of the hints.
https://bugzilla.gnome.org/show_bug.cgi?id=613123
src/core/window-private.h | 1 +
src/core/window-props.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
src/core/window.c | 39 ++++++++++++++++++++++++++++++++++++++-
src/include/atomnames.h | 1 +
src/include/window.h | 1 +
5 files changed, 85 insertions(+), 1 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 986a33e..5520fd8 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -96,6 +96,7 @@ struct _MetaWindow
char *sm_client_id;
char *wm_client_machine;
char *startup_id;
+ char *mutter_hints;
int net_wm_pid;
diff --git a/src/core/window-props.c b/src/core/window-props.c
index cfd9663..e601215 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -524,6 +524,49 @@ reload_wm_name (MetaWindow *window,
}
static void
+reload_mutter_hints (MetaWindow *window,
+ MetaPropValue *value,
+ gboolean initial)
+{
+ if (value->type != META_PROP_VALUE_INVALID)
+ {
+ char *new_hints = value->v.str;
+ char *old_hints = window->mutter_hints;
+ gboolean changed = FALSE;
+
+ if (new_hints)
+ {
+ if (!old_hints || strcmp (new_hints, old_hints))
+ changed = TRUE;
+ }
+ else
+ {
+ if (old_hints)
+ changed = TRUE;
+ }
+
+ if (changed)
+ {
+ g_free (old_hints);
+
+ if (new_hints)
+ window->mutter_hints = g_strdup (new_hints);
+ else
+ window->mutter_hints = NULL;
+
+ g_object_notify (G_OBJECT (window), "mutter-hints");
+ }
+ }
+ else if (window->mutter_hints)
+ {
+ g_free (window->mutter_hints);
+ window->mutter_hints = NULL;
+
+ g_object_notify (G_OBJECT (window), "mutter-hints");
+ }
+}
+
+static void
set_icon_title (MetaWindow *window,
const char *title)
{
@@ -1506,6 +1549,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
{ XA_WM_CLASS, META_PROP_VALUE_CLASS_HINT, reload_wm_class, TRUE, TRUE },
{ display->atom__NET_WM_PID, META_PROP_VALUE_CARDINAL, reload_net_wm_pid, TRUE, TRUE },
{ XA_WM_NAME, META_PROP_VALUE_TEXT_PROPERTY, reload_wm_name, TRUE, TRUE },
+ { display->atom__MUTTER_HINTS, META_PROP_VALUE_TEXT_PROPERTY, reload_mutter_hints, TRUE, TRUE },
{ display->atom__NET_WM_ICON_NAME, META_PROP_VALUE_UTF8, reload_net_wm_icon_name, TRUE, FALSE },
{ XA_WM_ICON_NAME, META_PROP_VALUE_TEXT_PROPERTY, reload_wm_icon_name, TRUE, FALSE },
{ display->atom__NET_WM_DESKTOP, META_PROP_VALUE_CARDINAL, reload_net_wm_desktop, TRUE, FALSE },
diff --git a/src/core/window.c b/src/core/window.c
index 217aca9..cf022e4 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -146,7 +146,8 @@ enum {
PROP_WINDOW_TYPE,
PROP_USER_TIME,
PROP_DEMANDS_ATTENTION,
- PROP_URGENT
+ PROP_URGENT,
+ PROP_MUTTER_HINTS
};
enum
@@ -228,6 +229,9 @@ meta_window_get_property(GObject *object,
case PROP_URGENT:
g_value_set_boolean (value, win->wm_hints_urgent);
break;
+ case PROP_MUTTER_HINTS:
+ g_value_set_string (value, win->mutter_hints);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -348,6 +352,13 @@ meta_window_class_init (MetaWindowClass *klass)
FALSE,
G_PARAM_READABLE));
+ g_object_class_install_property (object_class,
+ PROP_MUTTER_HINTS,
+ g_param_spec_string ("mutter-hints",
+ "_MUTTER_HINTS",
+ "Contents of the _MUTTER_HINTS property of this window",
+ NULL,
+ G_PARAM_READABLE));
window_signals[WORKSPACE_CHANGED] =
g_signal_new ("workspace-changed",
G_TYPE_FROM_CLASS (object_class),
@@ -9120,3 +9131,29 @@ meta_window_is_modal (MetaWindow *window)
return window->wm_state_modal;
}
+
+/**
+ * meta_window_get_mutter_hints:
+ * @window: a #MetaWindow
+ *
+ * Gets the current value of the _MUTTER_HINTS property.
+ *
+ * The purpose of the hints is to allow fine-tuning of the Window Manager and
+ * Compositor behaviour on per-window basis, and is intended primarily for
+ * hints that are plugin-specific.
+ *
+ * The property is a list of colon-separated key=value pairs. The key names for
+ * any plugin-specific hints must be suitably namespaced to allow for shared
+ * use; 'mutter-' key prefix is reserved for internal use, and must not be used
+ * by plugins.
+ *
+ * Return value: (transfer none): the _MUTTER_HINTS string, or %NULL if no hints
+ * are set.
+ */
+const char *
+meta_window_get_mutter_hints (MetaWindow *window)
+{
+ g_return_val_if_fail (META_IS_WINDOW (window), NULL);
+
+ return window->mutter_hints;
+}
diff --git a/src/include/atomnames.h b/src/include/atomnames.h
index b5fbfb9..01e099e 100644
--- a/src/include/atomnames.h
+++ b/src/include/atomnames.h
@@ -58,6 +58,7 @@ item(_MUTTER_RESTART_MESSAGE)
item(_MUTTER_RELOAD_THEME_MESSAGE)
item(_MUTTER_SET_KEYBINDINGS_MESSAGE)
item(_MUTTER_TOGGLE_VERBOSE)
+item(_MUTTER_HINTS)
item(_GNOME_WM_KEYBINDINGS)
item(_GNOME_PANEL_ACTION)
item(_GNOME_PANEL_ACTION_MAIN_MENU)
diff --git a/src/include/window.h b/src/include/window.h
index 2f3cd14..367f2e2 100644
--- a/src/include/window.h
+++ b/src/include/window.h
@@ -141,4 +141,5 @@ guint32 meta_window_get_user_time (MetaWindow *window);
int meta_window_get_pid (MetaWindow *window);
const char *meta_window_get_client_machine (MetaWindow *window);
gboolean meta_window_is_modal (MetaWindow *window);
+const char *meta_window_get_mutter_hints (MetaWindow *window);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]