[mutter] Remove MetaCompositor virtualization
- From: Owen Taylor <otaylor src gnome org>
- To: svn-commits-list gnome org
- Subject: [mutter] Remove MetaCompositor virtualization
- Date: Tue, 30 Jun 2009 13:42:07 +0000 (UTC)
commit 3aff9726ebe79722c49ee587ada1116bc2cc8764
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu Jun 25 16:17:27 2009 -0400
Remove MetaCompositor virtualization
Now that we only have one compositor, there's no reason to access the
compositor functions through a vtable. Remove the MetaCompositor virtualization
and make the clutter code implement the meta_compositor_* functions
directly.
Move the checks for the compositor being NULL from the vtable wrappers
to the calling code (most of them were already there, so just a few
needed to be added)
Note: the compositor is actually hard-coded on at the moment and the plan
is to remove the non-composited code entirely, so the checks are
added only to keep things neat: they have no practical effect.
http://bugzilla.gnome.org/show_bug.cgi?id=581813
src/Makefile.am | 2 -
src/compositor/compositor-mutter.c | 218 ++++++++++++++++----------------
src/compositor/compositor-private.h | 90 -------------
src/compositor/compositor.c | 240 -----------------------------------
src/core/stack-tracker.c | 7 +-
src/core/window.c | 58 +++++----
src/core/workspace.c | 20 ++-
7 files changed, 161 insertions(+), 474 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 1070001..bba698d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,8 +15,6 @@ mutter_SOURCES= \
core/bell.h \
core/boxes.c \
include/boxes.h \
- compositor/compositor.c \
- compositor/compositor-private.h \
compositor/compositor-mutter.c \
compositor/mutter-module.c \
compositor/mutter-module.h \
diff --git a/src/compositor/compositor-mutter.c b/src/compositor/compositor-mutter.c
index 3c937aa..08bad9b 100644
--- a/src/compositor/compositor-mutter.c
+++ b/src/compositor/compositor-mutter.c
@@ -17,7 +17,7 @@
#include "frame.h"
#include "errors.h"
#include "window.h"
-#include "compositor-private.h"
+#include "compositor.h"
#include "compositor-mutter.h"
#include "mutter-plugin-manager.h"
#include "tidy/tidy-texture-frame.h"
@@ -119,7 +119,6 @@ composite_at_least_version (MetaDisplay *display, int maj, int min)
typedef struct _Mutter
{
- MetaCompositor compositor;
MetaDisplay *display;
Atom atom_x_root_pixmap;
@@ -1138,8 +1137,8 @@ mutter_window_effect_completed (MutterWindow *cw, gulong event)
}
-static void
-clutter_cmp_destroy (MetaCompositor *compositor)
+void
+meta_compositor_destroy (MetaCompositor *compositor)
{
}
@@ -1845,9 +1844,9 @@ mutter_empty_stage_input_region (MetaScreen *screen)
mutter_set_stage_input_region (screen, region);
}
-static void
-clutter_cmp_manage_screen (MetaCompositor *compositor,
- MetaScreen *screen)
+void
+meta_compositor_manage_screen (MetaCompositor *compositor,
+ MetaScreen *screen)
{
MetaCompScreen *info;
MetaDisplay *display = meta_screen_get_display (screen);
@@ -1968,15 +1967,15 @@ clutter_cmp_manage_screen (MetaCompositor *compositor,
clutter_actor_show (info->stage);
}
-static void
-clutter_cmp_unmanage_screen (MetaCompositor *compositor,
- MetaScreen *screen)
+void
+meta_compositor_unmanage_screen (MetaCompositor *compositor,
+ MetaScreen *screen)
{
}
-static void
-clutter_cmp_add_window (MetaCompositor *compositor,
- MetaWindow *window)
+void
+meta_compositor_add_window (MetaCompositor *compositor,
+ MetaWindow *window)
{
MetaScreen *screen = meta_window_get_screen (window);
MetaDisplay *display = meta_screen_get_display (screen);
@@ -1989,9 +1988,9 @@ clutter_cmp_add_window (MetaCompositor *compositor,
meta_error_trap_pop (display, FALSE);
}
-static void
-clutter_cmp_remove_window (MetaCompositor *compositor,
- MetaWindow *window)
+void
+meta_compositor_remove_window (MetaCompositor *compositor,
+ MetaWindow *window)
{
MutterWindow *cw = NULL;
@@ -2003,17 +2002,17 @@ clutter_cmp_remove_window (MetaCompositor *compositor,
destroy_win (cw);
}
-static void
-clutter_cmp_set_updates (MetaCompositor *compositor,
- MetaWindow *window,
- gboolean update)
+void
+meta_compositor_set_updates (MetaCompositor *compositor,
+ MetaWindow *window,
+ gboolean updates)
{
}
-static gboolean
-clutter_cmp_process_event (MetaCompositor *compositor,
- XEvent *event,
- MetaWindow *window)
+gboolean
+meta_compositor_process_event (MetaCompositor *compositor,
+ XEvent *event,
+ MetaWindow *window)
{
Mutter *xrc = (Mutter *) compositor;
@@ -2099,22 +2098,47 @@ clutter_cmp_process_event (MetaCompositor *compositor,
return FALSE;
}
-static Pixmap
-clutter_cmp_get_window_pixmap (MetaCompositor *compositor,
- MetaWindow *window)
+Pixmap
+meta_compositor_get_window_pixmap (MetaCompositor *compositor,
+ MetaWindow *window)
{
return None;
}
-static void
-clutter_cmp_set_active_window (MetaCompositor *compositor,
- MetaScreen *screen,
- MetaWindow *window)
+void
+meta_compositor_set_active_window (MetaCompositor *compositor,
+ MetaScreen *screen,
+ MetaWindow *window)
{
}
-static void
-clutter_cmp_map_window (MetaCompositor *compositor, MetaWindow *window)
+/* These functions are unused at the moment */
+void
+meta_compositor_begin_move (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaRectangle *initial,
+ int grab_x,
+ int grab_y)
+{
+}
+
+void
+meta_compositor_update_move (MetaCompositor *compositor,
+ MetaWindow *window,
+ int x,
+ int y)
+{
+}
+
+void
+meta_compositor_end_move (MetaCompositor *compositor,
+ MetaWindow *window)
+{
+}
+
+void
+meta_compositor_map_window (MetaCompositor *compositor,
+ MetaWindow *window)
{
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
DEBUG_TRACE ("clutter_cmp_map_window\n");
@@ -2124,8 +2148,9 @@ clutter_cmp_map_window (MetaCompositor *compositor, MetaWindow *window)
map_win (cw);
}
-static void
-clutter_cmp_unmap_window (MetaCompositor *compositor, MetaWindow *window)
+void
+meta_compositor_unmap_window (MetaCompositor *compositor,
+ MetaWindow *window)
{
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
DEBUG_TRACE ("clutter_cmp_unmap_window\n");
@@ -2135,11 +2160,11 @@ clutter_cmp_unmap_window (MetaCompositor *compositor, MetaWindow *window)
unmap_win (cw);
}
-static void
-clutter_cmp_minimize_window (MetaCompositor *compositor,
- MetaWindow *window,
- MetaRectangle *window_rect,
- MetaRectangle *icon_rect)
+void
+meta_compositor_minimize_window (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaRectangle *window_rect,
+ MetaRectangle *icon_rect)
{
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MetaScreen *screen = meta_window_get_screen (window);
@@ -2168,11 +2193,11 @@ clutter_cmp_minimize_window (MetaCompositor *compositor,
}
}
-static void
-clutter_cmp_unminimize_window (MetaCompositor *compositor,
- MetaWindow *window,
- MetaRectangle *window_rect,
- MetaRectangle *icon_rect)
+void
+meta_compositor_unminimize_window (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaRectangle *window_rect,
+ MetaRectangle *icon_rect)
{
#if 0
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
@@ -2209,10 +2234,10 @@ clutter_cmp_unminimize_window (MetaCompositor *compositor,
}
-static void
-clutter_cmp_maximize_window (MetaCompositor *compositor,
- MetaWindow *window,
- MetaRectangle *rect)
+void
+meta_compositor_maximize_window (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaRectangle *window_rect)
{
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MetaScreen *screen = meta_window_get_screen (window);
@@ -2230,17 +2255,17 @@ clutter_cmp_maximize_window (MetaCompositor *compositor,
!mutter_plugin_manager_event_maximize (info->plugin_mgr,
cw,
MUTTER_PLUGIN_MAXIMIZE,
- rect->x, rect->y,
- rect->width, rect->height))
+ window_rect->x, window_rect->y,
+ window_rect->width, window_rect->height))
{
cw->priv->maximize_in_progress--;
}
}
-static void
-clutter_cmp_unmaximize_window (MetaCompositor *compositor,
- MetaWindow *window,
- MetaRectangle *rect)
+void
+meta_compositor_unmaximize_window (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaRectangle *window_rect)
{
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MetaScreen *screen = meta_window_get_screen (window);
@@ -2258,16 +2283,16 @@ clutter_cmp_unmaximize_window (MetaCompositor *compositor,
!mutter_plugin_manager_event_maximize (info->plugin_mgr,
cw,
MUTTER_PLUGIN_UNMAXIMIZE,
- rect->x, rect->y,
- rect->width, rect->height))
+ window_rect->x, window_rect->y,
+ window_rect->width, window_rect->height))
{
cw->priv->unmaximize_in_progress--;
}
}
-static void
-clutter_cmp_update_workspace_geometry (MetaCompositor *compositor,
- MetaWorkspace *workspace)
+void
+meta_compositor_update_workspace_geometry (MetaCompositor *compositor,
+ MetaWorkspace *workspace)
{
#if 0
/* FIXME -- should do away with this function in favour of MetaWorkspace
@@ -2288,12 +2313,12 @@ clutter_cmp_update_workspace_geometry (MetaCompositor *compositor,
#endif
}
-static void
-clutter_cmp_switch_workspace (MetaCompositor *compositor,
- MetaScreen *screen,
- MetaWorkspace *from,
- MetaWorkspace *to,
- MetaMotionDirection direction)
+void
+meta_compositor_switch_workspace (MetaCompositor *compositor,
+ MetaScreen *screen,
+ MetaWorkspace *from,
+ MetaWorkspace *to,
+ MetaMotionDirection direction)
{
MetaCompScreen *info;
gint to_indx, from_indx;
@@ -2382,10 +2407,10 @@ sync_actor_stacking (GList *windows)
}
}
-static void
-clutter_cmp_sync_stack (MetaCompositor *compositor,
- MetaScreen *screen,
- GList *stack)
+void
+meta_compositor_sync_stack (MetaCompositor *compositor,
+ MetaScreen *screen,
+ GList *stack)
{
GList *old_stack;
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
@@ -2471,11 +2496,11 @@ clutter_cmp_sync_stack (MetaCompositor *compositor,
sync_actor_stacking (info->windows);
}
-static void
-clutter_cmp_set_window_hidden (MetaCompositor *compositor,
- MetaScreen *screen,
- MetaWindow *window,
- gboolean hidden)
+void
+meta_compositor_set_window_hidden (MetaCompositor *compositor,
+ MetaScreen *screen,
+ MetaWindow *window,
+ gboolean hidden)
{
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MutterWindowPrivate *priv = cw->priv;
@@ -2509,9 +2534,9 @@ clutter_cmp_set_window_hidden (MetaCompositor *compositor,
}
}
-static void
-clutter_cmp_sync_window_geometry (MetaCompositor *compositor,
- MetaWindow *window)
+void
+meta_compositor_sync_window_geometry (MetaCompositor *compositor,
+ MetaWindow *window)
{
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MetaScreen *screen = meta_window_get_screen (window);
@@ -2526,11 +2551,11 @@ clutter_cmp_sync_window_geometry (MetaCompositor *compositor,
sync_actor_position (cw);
}
-static void
-clutter_cmp_sync_screen_size (MetaCompositor *compositor,
- MetaScreen *screen,
- guint width,
- guint height)
+void
+meta_compositor_sync_screen_size (MetaCompositor *compositor,
+ MetaScreen *screen,
+ guint width,
+ guint height)
{
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
@@ -2544,32 +2569,8 @@ clutter_cmp_sync_screen_size (MetaCompositor *compositor,
width, height);
}
-static MetaCompositor comp_info = {
- clutter_cmp_destroy,
- clutter_cmp_manage_screen,
- clutter_cmp_unmanage_screen,
- clutter_cmp_add_window,
- clutter_cmp_remove_window,
- clutter_cmp_set_updates,
- clutter_cmp_process_event,
- clutter_cmp_get_window_pixmap,
- clutter_cmp_set_active_window,
- clutter_cmp_map_window,
- clutter_cmp_unmap_window,
- clutter_cmp_minimize_window,
- clutter_cmp_unminimize_window,
- clutter_cmp_maximize_window,
- clutter_cmp_unmaximize_window,
- clutter_cmp_update_workspace_geometry,
- clutter_cmp_switch_workspace,
- clutter_cmp_sync_stack,
- clutter_cmp_set_window_hidden,
- clutter_cmp_sync_window_geometry,
- clutter_cmp_sync_screen_size
-};
-
MetaCompositor *
-mutter_new (MetaDisplay *display)
+meta_compositor_new (MetaDisplay *display)
{
char *atom_names[] = {
"_XROOTPMAP_ID",
@@ -2586,7 +2587,6 @@ mutter_new (MetaDisplay *display)
return NULL;
clc = g_new0 (Mutter, 1);
- clc->compositor = comp_info;
compositor = (MetaCompositor *) clc;
diff --git a/src/core/stack-tracker.c b/src/core/stack-tracker.c
index 1c6cdca..73f96c2 100644
--- a/src/core/stack-tracker.c
+++ b/src/core/stack-tracker.c
@@ -686,9 +686,10 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
meta_windows = g_list_prepend (meta_windows, meta_window);
}
- meta_compositor_sync_stack (tracker->screen->display->compositor,
- tracker->screen,
- meta_windows);
+ if (tracker->screen->display->compositor)
+ meta_compositor_sync_stack (tracker->screen->display->compositor,
+ tracker->screen,
+ meta_windows);
g_list_free (meta_windows);
meta_screen_restacked (tracker->screen);
diff --git a/src/core/window.c b/src/core/window.c
index b1c261e..c1e464a 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -1274,8 +1274,9 @@ meta_window_unmanage (MetaWindow *window,
if (window->display->focus_window == window)
{
window->display->focus_window = NULL;
- meta_compositor_set_active_window (window->display->compositor,
- window->screen, NULL);
+ if (window->display->compositor)
+ meta_compositor_set_active_window (window->display->compositor,
+ window->screen, NULL);
}
if (window->maximized_horizontally || window->maximized_vertically)
@@ -2550,10 +2551,11 @@ meta_window_show (MetaWindow *window)
meta_stack_freeze (window->screen->stack);
window->hidden = FALSE;
/* Inform the compositor that the window isn't hidden */
- meta_compositor_set_window_hidden (window->display->compositor,
- window->screen,
- window,
- window->hidden);
+ if (window->display->compositor)
+ meta_compositor_set_window_hidden (window->display->compositor,
+ window->screen,
+ window,
+ window->hidden);
meta_stack_thaw (window->screen->stack);
did_show = TRUE;
}
@@ -2582,8 +2584,11 @@ meta_window_show (MetaWindow *window)
NULL, NULL);
}
else
- meta_compositor_map_window (window->display->compositor,
- window);
+ {
+ if (window->display->compositor)
+ meta_compositor_map_window (window->display->compositor,
+ window);
+ }
window->was_minimized = FALSE;
}
@@ -2659,21 +2664,24 @@ meta_window_hide (MetaWindow *window)
meta_stack_freeze (window->screen->stack);
window->hidden = TRUE;
/* Tell the compositor this window is now hidden */
- meta_compositor_set_window_hidden (window->display->compositor,
- window->screen,
- window,
- window->hidden);
+ if (window->display->compositor)
+ meta_compositor_set_window_hidden (window->display->compositor,
+ window->screen,
+ window,
+ window->hidden);
meta_stack_thaw (window->screen->stack);
- meta_compositor_unmap_window (window->display->compositor,
- window);
+ if (window->display->compositor)
+ meta_compositor_unmap_window (window->display->compositor,
+ window);
did_hide = TRUE;
}
else
{
- meta_compositor_unmap_window (window->display->compositor,
- window);
+ if (window->display->compositor)
+ meta_compositor_unmap_window (window->display->compositor,
+ window);
/* Unmapping the frame is enough to make the window disappear,
* but we need to hide the window itself so the client knows
@@ -4019,8 +4027,9 @@ meta_window_move_resize_internal (MetaWindow *window,
newx, newy, window->rect.width, window->rect.height,
window->user_rect.x, window->user_rect.y,
window->user_rect.width, window->user_rect.height);
- meta_compositor_sync_window_geometry (window->display->compositor,
- window);
+ if (window->display->compositor)
+ meta_compositor_sync_window_geometry (window->display->compositor,
+ window);
}
else
{
@@ -4188,7 +4197,8 @@ meta_window_configure_notify (MetaWindow *window, XConfigureEvent *event)
if (!event->override_redirect && !event->send_event)
meta_warning ("Unhandled change of windows override redirect status\n");
- meta_compositor_sync_window_geometry (window->display->compositor, window);
+ if (window->display->compositor)
+ meta_compositor_sync_window_geometry (window->display->compositor, window);
}
void
@@ -5817,8 +5827,9 @@ meta_window_notify_focus (MetaWindow *window,
"* Focus --> %s\n", window->desc);
window->display->focus_window = window;
window->has_focus = TRUE;
- meta_compositor_set_active_window (window->display->compositor,
- window->screen, window);
+ if (window->display->compositor)
+ meta_compositor_set_active_window (window->display->compositor,
+ window->screen, window);
/* Move to the front of the focusing workspace's MRU list.
* We should only be "removing" it from the MRU list if it's
@@ -5906,8 +5917,9 @@ meta_window_notify_focus (MetaWindow *window,
if (window->frame)
meta_frame_queue_draw (window->frame);
- meta_compositor_set_active_window (window->display->compositor,
- window->screen, NULL);
+ if (window->display->compositor)
+ meta_compositor_set_active_window (window->display->compositor,
+ window->screen, NULL);
meta_error_trap_push (window->display);
XUninstallColormap (window->display->xdisplay,
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 0deaf69..d13735f 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -540,6 +540,9 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
gint num_workspaces, current_space, new_space;
MetaMotionDirection direction = 0;
+ if (!comp)
+ return;
+
current_space = meta_workspace_index (old);
new_space = meta_workspace_index (workspace);
@@ -922,14 +925,17 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
/* We're all done, YAAY! Record that everything has been validated. */
workspace->work_areas_invalid = FALSE;
- /*
- * Notify the compositor that the workspace geometry has changed.
- */
- MetaScreen *screen = workspace->screen;
- MetaDisplay *display = meta_screen_get_display (screen);
- MetaCompositor *comp = meta_display_get_compositor (display);
+ {
+ /*
+ * Notify the compositor that the workspace geometry has changed.
+ */
+ MetaScreen *screen = workspace->screen;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ MetaCompositor *comp = meta_display_get_compositor (display);
- meta_compositor_update_workspace_geometry (comp, workspace);
+ if (comp)
+ meta_compositor_update_workspace_geometry (comp, workspace);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]