[mutter] Add "window-created" signal to MetaDisplay, "unmanaged" signal for MetaWindow
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [mutter] Add "window-created" signal to MetaDisplay, "unmanaged" signal for MetaWindow
- Date: Wed, 14 Oct 2009 18:39:17 +0000 (UTC)
commit 9311addca3229867ee57ab3da24f89d78e8ae6b7
Author: Colin Walters <walters verbum org>
Date: Tue Oct 13 10:34:34 2009 -0400
Add "window-created" signal to MetaDisplay, "unmanaged" signal for MetaWindow
For some consumers it's significantly more convenient to be able
to directly connect to a signal on the Window to know when
Mutter is done with it, rather than having to connect to each
Workspace object (and handle workspace additions, etc.).
Similarly, add window-created which acts globally.
https://bugzilla.gnome.org/show_bug.cgi?id=598289
src/core/display-private.h | 3 +++
src/core/display.c | 18 ++++++++++++++++++
src/core/window-private.h | 1 +
src/core/window.c | 14 ++++++++++++++
4 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 2858c19..6dc0872 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -358,6 +358,9 @@ void meta_display_register_x_window (MetaDisplay *display,
void meta_display_unregister_x_window (MetaDisplay *display,
Window xwindow);
+void meta_display_notify_window_created (MetaDisplay *display,
+ MetaWindow *window);
+
GSList* meta_display_list_windows (MetaDisplay *display,
MetaListWindowsFlags flags);
diff --git a/src/core/display.c b/src/core/display.c
index f21e563..2001faa 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -129,6 +129,7 @@ enum
{
OVERLAY_KEY,
FOCUS_WINDOW,
+ WINDOW_CREATED,
LAST_SIGNAL
};
@@ -226,6 +227,16 @@ meta_display_class_init (MetaDisplayClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ display_signals[WINDOW_CREATED] =
+ g_signal_new ("window-created",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, META_TYPE_WINDOW);
+
+
g_object_class_install_property (object_class,
PROP_FOCUS_WINDOW,
g_param_spec_object ("focus-window",
@@ -3210,6 +3221,13 @@ meta_display_unregister_x_window (MetaDisplay *display,
remove_pending_pings_for_window (display, xwindow);
}
+void
+meta_display_notify_window_created (MetaDisplay *display,
+ MetaWindow *window)
+{
+ g_signal_emit (display, display_signals[WINDOW_CREATED], 0, window);
+}
+
/**
* meta_display_xwindow_is_a_no_focus_window:
* @display: A #MetaDisplay
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 9bc8089..c088806 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -380,6 +380,7 @@ struct _MetaWindowClass
void (*workspace_changed) (MetaWindow *window, int old_workspace);
void (*focus) (MetaWindow *window);
void (*raised) (MetaWindow *window);
+ void (*unmanaged) (MetaWindow *window);
};
/* These differ from window->has_foo_func in that they consider
diff --git a/src/core/window.c b/src/core/window.c
index 5f02b13..5e63489 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -146,6 +146,7 @@ enum
WORKSPACE_CHANGED,
FOCUS,
RAISED,
+ UNMANAGED,
LAST_SIGNAL
};
@@ -322,6 +323,15 @@ meta_window_class_init (MetaWindowClass *klass)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+
+ window_signals[UNMANAGED] =
+ g_signal_new ("unmanaged",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (MetaWindowClass, unmanaged),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
@@ -1081,6 +1091,8 @@ meta_window_new_with_attrs (MetaDisplay *display,
window->constructing = FALSE;
+ meta_display_notify_window_created (display, window);
+
return window;
}
@@ -1453,6 +1465,8 @@ meta_window_unmanage (MetaWindow *window,
meta_error_trap_pop (window->display, FALSE);
+ g_signal_emit (window, window_signals[UNMANAGED], 0);
+
g_object_unref (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]