summaryrefslogtreecommitdiff
path: root/src/core/window.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-01-29 17:42:23 +0100
committerraveit65 <[email protected]>2021-03-01 13:55:09 +0100
commitbc5c7f0bc2db56fbc8475eab9b651b8a77effe91 (patch)
tree9f212308a42ecb5230a409364795cd4f598d80d0 /src/core/window.c
parent5b6170f917cdb1cbd3752c963a6ad4d2a58b35d8 (diff)
downloadmarco-bc5c7f0bc2db56fbc8475eab9b651b8a77effe91.tar.bz2
marco-bc5c7f0bc2db56fbc8475eab9b651b8a77effe91.tar.xz
window: turn into a GObject
Diffstat (limited to 'src/core/window.c')
-rw-r--r--src/core/window.c70
1 files changed, 47 insertions, 23 deletions
diff --git a/src/core/window.c b/src/core/window.c
index 5f75e901..e377d7df 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -139,6 +139,8 @@ 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)
+
#ifdef WITH_VERBOSE_MODE
static const char*
wm_state_to_string (int state)
@@ -386,7 +388,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;
@@ -1209,28 +1211,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));
-
- if (window->frame_bounds)
- cairo_region_destroy (window->frame_bounds);
-
- 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->gtk_theme_variant);
- g_free (window);
+ g_object_unref (window);
}
static void
@@ -8889,3 +8870,46 @@ meta_window_get_frame_bounds (MetaWindow *window)
return window->frame_bounds;
}
+
+static void
+meta_window_finalize (GObject *object)
+{
+ MetaWindow *window;
+
+ window = META_WINDOW (object);
+
+ g_clear_object (&window->icon);
+ g_clear_object (&window->mini_icon);
+
+ g_clear_pointer (&window->frame_bounds, cairo_region_destroy);
+
+ meta_icon_cache_free (&window->icon_cache);
+
+ g_clear_pointer (&window->sm_client_id, g_free);
+ g_clear_pointer (&window->wm_client_machine, g_free);
+ g_clear_pointer (&window->startup_id, g_free);
+ g_clear_pointer (&window->role, g_free);
+ g_clear_pointer (&window->res_class, g_free);
+ g_clear_pointer (&window->res_name, g_free);
+ g_clear_pointer (&window->title, g_free);
+ g_clear_pointer (&window->icon_name, g_free);
+ g_clear_pointer (&window->desc, g_free);
+ g_clear_pointer (&window->gtk_theme_variant, g_free);
+
+ G_OBJECT_CLASS (meta_window_parent_class)->finalize (object);
+}
+
+static void
+meta_window_class_init (MetaWindowClass *window_class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (window_class);
+
+ object_class->finalize = meta_window_finalize;
+}
+
+static void
+meta_window_init (MetaWindow *window)
+{
+}