Make MetaWindow a GObject

Make MetaWindow into a GObject so that it is accessible to
gobject-introspection (also allows for signals to be added.)

Renames:

 meta_window_free() => meta_window_unmanage()
 meta_window_get_type() => meta_window_get_window_type()
 meta_window_get_type_atom() => meta_window_get_window_type_atom()
This commit is contained in:
Owen W. Taylor
2008-11-07 04:57:00 -05:00
parent 026008a700
commit 9a1be03205
5 changed files with 81 additions and 40 deletions

View File

@ -903,7 +903,7 @@ meta_display_close (MetaDisplay *display,
}
#endif
/* Must be after all calls to meta_window_free() since they
/* Must be after all calls to meta_window_unmanage() since they
* unregister windows
*/
g_hash_table_destroy (display->window_ids);
@ -1992,7 +1992,7 @@ event_callback (XEvent *event,
else
{
/* Unmanage destroyed window */
meta_window_free (window, timestamp);
meta_window_unmanage (window, timestamp);
window = NULL;
}
}
@ -2024,7 +2024,7 @@ event_callback (XEvent *event,
/* Unmanage withdrawn window */
window->withdrawn = TRUE;
meta_window_free (window, timestamp);
meta_window_unmanage (window, timestamp);
window = NULL;
}
else
@ -4814,7 +4814,7 @@ meta_display_unmanage_windows_for_screen (MetaDisplay *display,
tmp = winlist;
while (tmp != NULL)
{
meta_window_free (tmp->data, timestamp);
meta_window_unmanage (tmp->data, timestamp);
tmp = tmp->next;
}

View File

@ -66,6 +66,8 @@ typedef enum {
struct _MetaWindow
{
GObject parent_instance;
MetaDisplay *display;
MetaScreen *screen;
MetaWorkspace *workspace;
@ -233,7 +235,7 @@ struct _MetaWindow
/* Has this window not ever been shown yet? */
guint showing_for_first_time : 1;
/* Are we in meta_window_free()? */
/* Are we in meta_window_unmanage()? */
guint unmanaging : 1;
/* Are we in meta_window_new()? */
@ -354,6 +356,11 @@ struct _MetaWindow
#endif
};
struct _MetaWindowClass
{
GObjectClass parent_class;
};
/* These differ from window->has_foo_func in that they consider
* the dynamic window state such as "maximized", not just the
* window's type
@ -377,7 +384,7 @@ MetaWindow* meta_window_new_with_attrs (MetaDisplay *display,
Window xwindow,
gboolean must_be_viewable,
XWindowAttributes *attrs);
void meta_window_free (MetaWindow *window,
void meta_window_unmanage (MetaWindow *window,
guint32 timestamp);
void meta_window_calc_showing (MetaWindow *window);
void meta_window_queue (MetaWindow *window,

View File

@ -128,6 +128,45 @@ static gboolean idle_calc_showing (gpointer data);
static gboolean idle_move_resize (gpointer data);
static gboolean idle_update_icon (gpointer data);
G_DEFINE_TYPE (MetaWindow, meta_window, G_TYPE_OBJECT);
static void
meta_window_finalize (GObject *object)
{
MetaWindow *window = META_WINDOW (object);
if (window->icon)
g_object_unref (G_OBJECT (window->icon));
if (window->mini_icon)
g_object_unref (G_OBJECT (window->mini_icon));
meta_icon_cache_free (&window->icon_cache);
g_free (window->sm_client_id);
g_free (window->wm_client_machine);
g_free (window->startup_id);
g_free (window->role);
g_free (window->res_class);
g_free (window->res_name);
g_free (window->title);
g_free (window->icon_name);
g_free (window->desc);
}
static void
meta_window_class_init (MetaWindowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_window_finalize;
}
static void
meta_window_init (MetaWindow *self)
{
}
#ifdef WITH_VERBOSE_MODE
static const char*
wm_state_to_string (int state)
@ -386,7 +425,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
g_assert (!attrs->override_redirect);
window = g_new (MetaWindow, 1);
window = g_object_new (META_TYPE_WINDOW, NULL);
window->constructing = TRUE;
@ -980,8 +1019,8 @@ meta_window_apply_session_info (MetaWindow *window,
}
void
meta_window_free (MetaWindow *window,
guint32 timestamp)
meta_window_unmanage (MetaWindow *window,
guint32 timestamp)
{
GList *tmp;
@ -1194,24 +1233,7 @@ meta_window_free (MetaWindow *window,
meta_error_trap_pop (window->display, FALSE);
if (window->icon)
g_object_unref (G_OBJECT (window->icon));
if (window->mini_icon)
g_object_unref (G_OBJECT (window->mini_icon));
meta_icon_cache_free (&window->icon_cache);
g_free (window->sm_client_id);
g_free (window->wm_client_machine);
g_free (window->startup_id);
g_free (window->role);
g_free (window->res_class);
g_free (window->res_name);
g_free (window->title);
g_free (window->icon_name);
g_free (window->desc);
g_free (window);
g_object_unref (window);
}
static void
@ -8300,13 +8322,13 @@ meta_window_get_xwindow (MetaWindow *window)
}
MetaWindowType
meta_window_get_type (MetaWindow *window)
meta_window_get_window_type (MetaWindow *window)
{
return window->type;
}
Atom
meta_window_get_type_atom (MetaWindow *window)
meta_window_get_window_type_atom (MetaWindow *window)
{
return window->type_atom;
}