mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 09:46:08 -05:00
Make MetaScreen and MetaWorkspace GObjects
src/core/screen.c src/core/screen-private.h src/include/screen.h: Make MetaScreen a GObject. src/core/workspace.c src/core/workspace-private.h src/include/workspace.h: Make MetaWorkspace a GObject. Rename meta_workspace_free() to meta_workspace_remove(). http://bugzilla.gnome.org/show_bug.cgi?id=561297
This commit is contained in:
parent
9a1be03205
commit
98ccfea388
@ -69,6 +69,8 @@ typedef enum
|
||||
|
||||
struct _MetaScreen
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
MetaDisplay *display;
|
||||
int number;
|
||||
char *screen_name;
|
||||
@ -139,6 +141,11 @@ struct _MetaScreen
|
||||
Window guard_window;
|
||||
};
|
||||
|
||||
struct _MetaScreenClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
MetaScreen* meta_screen_new (MetaDisplay *display,
|
||||
int number,
|
||||
guint32 timestamp);
|
||||
|
@ -69,6 +69,27 @@ static void meta_screen_sn_event (SnMonitorEvent *event,
|
||||
void *user_data);
|
||||
#endif
|
||||
|
||||
G_DEFINE_TYPE (MetaScreen, meta_screen, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
meta_screen_finalize (GObject *object)
|
||||
{
|
||||
/* Actual freeing done in meta_screen_free() for now */
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_class_init (MetaScreenClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = meta_screen_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_init (MetaScreen *screen)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
set_wm_check_hint (MetaScreen *screen)
|
||||
{
|
||||
@ -488,7 +509,7 @@ meta_screen_new (MetaDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
screen = g_new (MetaScreen, 1);
|
||||
screen = g_object_new (META_TYPE_SCREEN, NULL);
|
||||
screen->closing = 0;
|
||||
|
||||
screen->display = display;
|
||||
@ -718,7 +739,8 @@ meta_screen_free (MetaScreen *screen,
|
||||
g_free (screen->xinerama_infos);
|
||||
|
||||
g_free (screen->screen_name);
|
||||
g_free (screen);
|
||||
|
||||
g_object_unref (screen);
|
||||
|
||||
XFlush (display->xdisplay);
|
||||
meta_display_ungrab (display);
|
||||
@ -1142,7 +1164,7 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
|
||||
meta_workspace_activate (neighbour, timestamp);
|
||||
|
||||
/* This also removes the workspace from the screens list */
|
||||
meta_workspace_free (workspace);
|
||||
meta_workspace_remove (workspace);
|
||||
|
||||
set_number_of_spaces_hint (screen, g_list_length (screen->workspaces));
|
||||
|
||||
@ -1236,7 +1258,7 @@ update_num_workspaces (MetaScreen *screen,
|
||||
MetaWorkspace *w = tmp->data;
|
||||
|
||||
g_assert (w->windows == NULL);
|
||||
meta_workspace_free (w);
|
||||
meta_workspace_remove (w);
|
||||
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
struct _MetaWorkspace
|
||||
{
|
||||
GObject parent_instance;
|
||||
MetaScreen *screen;
|
||||
|
||||
GList *windows;
|
||||
@ -49,6 +50,7 @@ struct _MetaWorkspace
|
||||
MetaRectangle *work_area_xinerama;
|
||||
GList *screen_region;
|
||||
GList **xinerama_region;
|
||||
gint n_xinerama_regions;
|
||||
GList *screen_edges;
|
||||
GList *xinerama_edges;
|
||||
GSList *all_struts;
|
||||
@ -57,8 +59,13 @@ struct _MetaWorkspace
|
||||
guint showing_desktop : 1;
|
||||
};
|
||||
|
||||
struct _MetaWorkspaceClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
MetaWorkspace* meta_workspace_new (MetaScreen *screen);
|
||||
void meta_workspace_free (MetaWorkspace *workspace);
|
||||
void meta_workspace_remove (MetaWorkspace *workspace);
|
||||
void meta_workspace_add_window (MetaWorkspace *workspace,
|
||||
MetaWindow *window);
|
||||
void meta_workspace_remove_window (MetaWorkspace *workspace,
|
||||
|
@ -45,6 +45,27 @@ static void free_this (gpointer candidate,
|
||||
gpointer dummy);
|
||||
static void workspace_free_struts (MetaWorkspace *workspace);
|
||||
|
||||
G_DEFINE_TYPE (MetaWorkspace, meta_workspace, G_TYPE_OBJECT);
|
||||
|
||||
static void
|
||||
meta_workspace_finalize (GObject *object)
|
||||
{
|
||||
/* Actual freeing done in meta_workspace_remove() for now */
|
||||
}
|
||||
|
||||
static void
|
||||
meta_workspace_class_init (MetaWorkspaceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = meta_workspace_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_workspace_init (MetaWorkspace *workspace)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_add_to_list (MetaScreen *screen, MetaWindow *window, gpointer data)
|
||||
{
|
||||
@ -59,7 +80,7 @@ meta_workspace_new (MetaScreen *screen)
|
||||
{
|
||||
MetaWorkspace *workspace;
|
||||
|
||||
workspace = g_new (MetaWorkspace, 1);
|
||||
workspace = g_object_new (META_TYPE_WORKSPACE, NULL);
|
||||
|
||||
workspace->screen = screen;
|
||||
workspace->screen->workspaces =
|
||||
@ -112,7 +133,7 @@ workspace_free_struts (MetaWorkspace *workspace)
|
||||
}
|
||||
|
||||
void
|
||||
meta_workspace_free (MetaWorkspace *workspace)
|
||||
meta_workspace_remove (MetaWorkspace *workspace)
|
||||
{
|
||||
GList *tmp;
|
||||
MetaScreen *screen;
|
||||
@ -168,7 +189,7 @@ meta_workspace_free (MetaWorkspace *workspace)
|
||||
meta_rectangle_free_list_and_elements (workspace->xinerama_edges);
|
||||
}
|
||||
|
||||
g_free (workspace);
|
||||
g_object_unref (workspace);
|
||||
|
||||
/* don't bother to reset names, pagers can just ignore
|
||||
* extra ones
|
||||
|
@ -23,9 +23,20 @@
|
||||
#define META_SCREEN_H
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include "types.h"
|
||||
|
||||
#define META_TYPE_SCREEN (meta_screen_get_type ())
|
||||
#define META_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_SCREEN, MetaScreen))
|
||||
#define META_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_SCREEN, MetaScreenClass))
|
||||
#define META_IS_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_SCREEN_TYPE))
|
||||
#define META_IS_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_SCREEN))
|
||||
#define META_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_SCREEN, MetaScreenClass))
|
||||
|
||||
typedef struct _MetaScreenClass MetaScreenClass;
|
||||
|
||||
GType meta_screen_get_type (void);
|
||||
|
||||
int meta_screen_get_screen_number (MetaScreen *screen);
|
||||
MetaDisplay *meta_screen_get_display (MetaScreen *screen);
|
||||
|
||||
|
@ -53,6 +53,17 @@ typedef enum
|
||||
META_MOTION_DOWN_RIGHT = -8
|
||||
} MetaMotionDirection;
|
||||
|
||||
#define META_TYPE_WORKSPACE (meta_workspace_get_type ())
|
||||
#define META_WORKSPACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_WORKSPACE, MetaWorkspace))
|
||||
#define META_WORKSPACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_WORKSPACE, MetaWorkspaceClass))
|
||||
#define META_IS_WORKSPACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_WORKSPACE_TYPE))
|
||||
#define META_IS_WORKSPACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_WORKSPACE))
|
||||
#define META_WORKSPACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_WORKSPACE, MetaWorkspaceClass))
|
||||
|
||||
typedef struct _MetaWorkspaceClass MetaWorkspaceClass;
|
||||
|
||||
GType meta_workspace_get_type (void);
|
||||
|
||||
int meta_workspace_index (MetaWorkspace *workspace);
|
||||
MetaScreen *meta_workspace_get_screen (MetaWorkspace *workspace);
|
||||
void meta_workspace_get_work_area_all_xineramas (MetaWorkspace *workspace,
|
||||
|
Loading…
Reference in New Issue
Block a user