[mutter/meego-1.0: 10/30] _MUTTER_HINTS
- From: Tomas Frydrych <tomasf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/meego-1.0: 10/30] _MUTTER_HINTS
- Date: Fri, 14 May 2010 15:50:36 +0000 (UTC)
commit 1286388f64249f7d7c2595477cb69b33ad2351de
Author: Tomas Frydrych <tf linux intel com>
Date: Mon Jan 18 10:12:17 2010 +0000
_MUTTER_HINTS
A per-window property allowing plugins to use custom hints. This commit adds
MetaWindow::mutter-hints property, and meta_window_get_mutter_hints() accessor,
as well as the machinery for reading and updating of the hints.
src/core/window-private.h | 1 +
src/core/window-props.c | 37 +++++++++++++++++++++++++++++++++++++
src/core/window.c | 27 ++++++++++++++++++++++++++-
src/include/atomnames.h | 1 +
src/include/window.h | 1 +
5 files changed, 66 insertions(+), 1 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index a048491..b5dcb22 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -99,6 +99,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..597d31a 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -524,6 +524,42 @@ 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");
+ }
+ }
+}
+
+static void
set_icon_title (MetaWindow *window,
const char *title)
{
@@ -1529,6 +1565,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
{ display->atom__NET_WM_WINDOW_TYPE, META_PROP_VALUE_INVALID, reload_net_wm_window_type, FALSE, TRUE },
{ display->atom__NET_WM_STRUT, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE },
{ display->atom__NET_WM_STRUT_PARTIAL, META_PROP_VALUE_INVALID, reload_struts, FALSE, FALSE },
+ { display->atom__MUTTER_HINTS, META_PROP_VALUE_TEXT_PROPERTY, reload_mutter_hints, TRUE, FALSE },
{ 0 },
};
diff --git a/src/core/window.c b/src/core/window.c
index 145b467..95566f4 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -147,7 +147,8 @@ enum {
PROP_WINDOW_TYPE,
PROP_USER_TIME,
PROP_DEMANDS_ATTENTION,
- PROP_URGENT
+ PROP_URGENT,
+ PROP_MUTTER_HINTS
};
enum
@@ -229,6 +230,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->title);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -349,6 +353,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",
+ "_MUTTER_HINTS for this window",
+ NULL,
+ G_PARAM_READABLE));
window_signals[WORKSPACE_CHANGED] =
g_signal_new ("workspace-changed",
G_TYPE_FROM_CLASS (object_class),
@@ -9139,3 +9150,17 @@ meta_window_is_user_placed (MetaWindow *window)
return window->user_placed;
}
+
+/**
+ * meta_window_get_mutter_hints:
+ * @window: a #MetaWindow
+ *
+ * Returns the current value of the _MUTTER_HINTS property.
+ */
+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 bf20454..4099843 100644
--- a/src/include/window.h
+++ b/src/include/window.h
@@ -126,5 +126,6 @@ int meta_window_get_pid (MetaWindow *window);
const char *meta_window_get_client_machine (MetaWindow *window);
gboolean meta_window_is_modal (MetaWindow *window);
gboolean meta_window_is_user_placed (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]