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
This commit is contained in:
Owen W. Taylor
2009-06-25 16:17:27 -04:00
parent 0b8a57bcba
commit 3aff9726eb
7 changed files with 161 additions and 474 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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);
}
}
/**