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

@ -15,8 +15,6 @@ mutter_SOURCES= \
core/bell.h \ core/bell.h \
core/boxes.c \ core/boxes.c \
include/boxes.h \ include/boxes.h \
compositor/compositor.c \
compositor/compositor-private.h \
compositor/compositor-mutter.c \ compositor/compositor-mutter.c \
compositor/mutter-module.c \ compositor/mutter-module.c \
compositor/mutter-module.h \ compositor/mutter-module.h \

View File

@ -17,7 +17,7 @@
#include "frame.h" #include "frame.h"
#include "errors.h" #include "errors.h"
#include "window.h" #include "window.h"
#include "compositor-private.h" #include "compositor.h"
#include "compositor-mutter.h" #include "compositor-mutter.h"
#include "mutter-plugin-manager.h" #include "mutter-plugin-manager.h"
#include "tidy/tidy-texture-frame.h" #include "tidy/tidy-texture-frame.h"
@ -119,7 +119,6 @@ composite_at_least_version (MetaDisplay *display, int maj, int min)
typedef struct _Mutter typedef struct _Mutter
{ {
MetaCompositor compositor;
MetaDisplay *display; MetaDisplay *display;
Atom atom_x_root_pixmap; Atom atom_x_root_pixmap;
@ -1138,8 +1137,8 @@ mutter_window_effect_completed (MutterWindow *cw, gulong event)
} }
static void void
clutter_cmp_destroy (MetaCompositor *compositor) meta_compositor_destroy (MetaCompositor *compositor)
{ {
} }
@ -1845,9 +1844,9 @@ mutter_empty_stage_input_region (MetaScreen *screen)
mutter_set_stage_input_region (screen, region); mutter_set_stage_input_region (screen, region);
} }
static void void
clutter_cmp_manage_screen (MetaCompositor *compositor, meta_compositor_manage_screen (MetaCompositor *compositor,
MetaScreen *screen) MetaScreen *screen)
{ {
MetaCompScreen *info; MetaCompScreen *info;
MetaDisplay *display = meta_screen_get_display (screen); MetaDisplay *display = meta_screen_get_display (screen);
@ -1968,15 +1967,15 @@ clutter_cmp_manage_screen (MetaCompositor *compositor,
clutter_actor_show (info->stage); clutter_actor_show (info->stage);
} }
static void void
clutter_cmp_unmanage_screen (MetaCompositor *compositor, meta_compositor_unmanage_screen (MetaCompositor *compositor,
MetaScreen *screen) MetaScreen *screen)
{ {
} }
static void void
clutter_cmp_add_window (MetaCompositor *compositor, meta_compositor_add_window (MetaCompositor *compositor,
MetaWindow *window) MetaWindow *window)
{ {
MetaScreen *screen = meta_window_get_screen (window); MetaScreen *screen = meta_window_get_screen (window);
MetaDisplay *display = meta_screen_get_display (screen); MetaDisplay *display = meta_screen_get_display (screen);
@ -1989,9 +1988,9 @@ clutter_cmp_add_window (MetaCompositor *compositor,
meta_error_trap_pop (display, FALSE); meta_error_trap_pop (display, FALSE);
} }
static void void
clutter_cmp_remove_window (MetaCompositor *compositor, meta_compositor_remove_window (MetaCompositor *compositor,
MetaWindow *window) MetaWindow *window)
{ {
MutterWindow *cw = NULL; MutterWindow *cw = NULL;
@ -2003,17 +2002,17 @@ clutter_cmp_remove_window (MetaCompositor *compositor,
destroy_win (cw); destroy_win (cw);
} }
static void void
clutter_cmp_set_updates (MetaCompositor *compositor, meta_compositor_set_updates (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
gboolean update) gboolean updates)
{ {
} }
static gboolean gboolean
clutter_cmp_process_event (MetaCompositor *compositor, meta_compositor_process_event (MetaCompositor *compositor,
XEvent *event, XEvent *event,
MetaWindow *window) MetaWindow *window)
{ {
Mutter *xrc = (Mutter *) compositor; Mutter *xrc = (Mutter *) compositor;
@ -2099,22 +2098,47 @@ clutter_cmp_process_event (MetaCompositor *compositor,
return FALSE; return FALSE;
} }
static Pixmap Pixmap
clutter_cmp_get_window_pixmap (MetaCompositor *compositor, meta_compositor_get_window_pixmap (MetaCompositor *compositor,
MetaWindow *window) MetaWindow *window)
{ {
return None; return None;
} }
static void void
clutter_cmp_set_active_window (MetaCompositor *compositor, meta_compositor_set_active_window (MetaCompositor *compositor,
MetaScreen *screen, MetaScreen *screen,
MetaWindow *window) MetaWindow *window)
{ {
} }
static void /* These functions are unused at the moment */
clutter_cmp_map_window (MetaCompositor *compositor, MetaWindow *window) 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)); MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
DEBUG_TRACE ("clutter_cmp_map_window\n"); DEBUG_TRACE ("clutter_cmp_map_window\n");
@ -2124,8 +2148,9 @@ clutter_cmp_map_window (MetaCompositor *compositor, MetaWindow *window)
map_win (cw); map_win (cw);
} }
static void void
clutter_cmp_unmap_window (MetaCompositor *compositor, MetaWindow *window) meta_compositor_unmap_window (MetaCompositor *compositor,
MetaWindow *window)
{ {
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window)); MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
DEBUG_TRACE ("clutter_cmp_unmap_window\n"); DEBUG_TRACE ("clutter_cmp_unmap_window\n");
@ -2135,11 +2160,11 @@ clutter_cmp_unmap_window (MetaCompositor *compositor, MetaWindow *window)
unmap_win (cw); unmap_win (cw);
} }
static void void
clutter_cmp_minimize_window (MetaCompositor *compositor, meta_compositor_minimize_window (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
MetaRectangle *window_rect, MetaRectangle *window_rect,
MetaRectangle *icon_rect) MetaRectangle *icon_rect)
{ {
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window)); MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MetaScreen *screen = meta_window_get_screen (window); MetaScreen *screen = meta_window_get_screen (window);
@ -2168,11 +2193,11 @@ clutter_cmp_minimize_window (MetaCompositor *compositor,
} }
} }
static void void
clutter_cmp_unminimize_window (MetaCompositor *compositor, meta_compositor_unminimize_window (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
MetaRectangle *window_rect, MetaRectangle *window_rect,
MetaRectangle *icon_rect) MetaRectangle *icon_rect)
{ {
#if 0 #if 0
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window)); MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
@ -2209,10 +2234,10 @@ clutter_cmp_unminimize_window (MetaCompositor *compositor,
} }
static void void
clutter_cmp_maximize_window (MetaCompositor *compositor, meta_compositor_maximize_window (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
MetaRectangle *rect) MetaRectangle *window_rect)
{ {
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window)); MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MetaScreen *screen = meta_window_get_screen (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, !mutter_plugin_manager_event_maximize (info->plugin_mgr,
cw, cw,
MUTTER_PLUGIN_MAXIMIZE, MUTTER_PLUGIN_MAXIMIZE,
rect->x, rect->y, window_rect->x, window_rect->y,
rect->width, rect->height)) window_rect->width, window_rect->height))
{ {
cw->priv->maximize_in_progress--; cw->priv->maximize_in_progress--;
} }
} }
static void void
clutter_cmp_unmaximize_window (MetaCompositor *compositor, meta_compositor_unmaximize_window (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
MetaRectangle *rect) MetaRectangle *window_rect)
{ {
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window)); MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MetaScreen *screen = meta_window_get_screen (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, !mutter_plugin_manager_event_maximize (info->plugin_mgr,
cw, cw,
MUTTER_PLUGIN_UNMAXIMIZE, MUTTER_PLUGIN_UNMAXIMIZE,
rect->x, rect->y, window_rect->x, window_rect->y,
rect->width, rect->height)) window_rect->width, window_rect->height))
{ {
cw->priv->unmaximize_in_progress--; cw->priv->unmaximize_in_progress--;
} }
} }
static void void
clutter_cmp_update_workspace_geometry (MetaCompositor *compositor, meta_compositor_update_workspace_geometry (MetaCompositor *compositor,
MetaWorkspace *workspace) MetaWorkspace *workspace)
{ {
#if 0 #if 0
/* FIXME -- should do away with this function in favour of MetaWorkspace /* FIXME -- should do away with this function in favour of MetaWorkspace
@ -2288,12 +2313,12 @@ clutter_cmp_update_workspace_geometry (MetaCompositor *compositor,
#endif #endif
} }
static void void
clutter_cmp_switch_workspace (MetaCompositor *compositor, meta_compositor_switch_workspace (MetaCompositor *compositor,
MetaScreen *screen, MetaScreen *screen,
MetaWorkspace *from, MetaWorkspace *from,
MetaWorkspace *to, MetaWorkspace *to,
MetaMotionDirection direction) MetaMotionDirection direction)
{ {
MetaCompScreen *info; MetaCompScreen *info;
gint to_indx, from_indx; gint to_indx, from_indx;
@ -2382,10 +2407,10 @@ sync_actor_stacking (GList *windows)
} }
} }
static void void
clutter_cmp_sync_stack (MetaCompositor *compositor, meta_compositor_sync_stack (MetaCompositor *compositor,
MetaScreen *screen, MetaScreen *screen,
GList *stack) GList *stack)
{ {
GList *old_stack; GList *old_stack;
MetaCompScreen *info = meta_screen_get_compositor_data (screen); MetaCompScreen *info = meta_screen_get_compositor_data (screen);
@ -2471,11 +2496,11 @@ clutter_cmp_sync_stack (MetaCompositor *compositor,
sync_actor_stacking (info->windows); sync_actor_stacking (info->windows);
} }
static void void
clutter_cmp_set_window_hidden (MetaCompositor *compositor, meta_compositor_set_window_hidden (MetaCompositor *compositor,
MetaScreen *screen, MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
gboolean hidden) gboolean hidden)
{ {
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window)); MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MutterWindowPrivate *priv = cw->priv; MutterWindowPrivate *priv = cw->priv;
@ -2509,9 +2534,9 @@ clutter_cmp_set_window_hidden (MetaCompositor *compositor,
} }
} }
static void void
clutter_cmp_sync_window_geometry (MetaCompositor *compositor, meta_compositor_sync_window_geometry (MetaCompositor *compositor,
MetaWindow *window) MetaWindow *window)
{ {
MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window)); MutterWindow *cw = MUTTER_WINDOW (meta_window_get_compositor_private (window));
MetaScreen *screen = meta_window_get_screen (window); MetaScreen *screen = meta_window_get_screen (window);
@ -2526,11 +2551,11 @@ clutter_cmp_sync_window_geometry (MetaCompositor *compositor,
sync_actor_position (cw); sync_actor_position (cw);
} }
static void void
clutter_cmp_sync_screen_size (MetaCompositor *compositor, meta_compositor_sync_screen_size (MetaCompositor *compositor,
MetaScreen *screen, MetaScreen *screen,
guint width, guint width,
guint height) guint height)
{ {
MetaCompScreen *info = meta_screen_get_compositor_data (screen); MetaCompScreen *info = meta_screen_get_compositor_data (screen);
@ -2544,32 +2569,8 @@ clutter_cmp_sync_screen_size (MetaCompositor *compositor,
width, height); 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 * MetaCompositor *
mutter_new (MetaDisplay *display) meta_compositor_new (MetaDisplay *display)
{ {
char *atom_names[] = { char *atom_names[] = {
"_XROOTPMAP_ID", "_XROOTPMAP_ID",
@ -2586,7 +2587,6 @@ mutter_new (MetaDisplay *display)
return NULL; return NULL;
clc = g_new0 (Mutter, 1); clc = g_new0 (Mutter, 1);
clc->compositor = comp_info;
compositor = (MetaCompositor *) clc; compositor = (MetaCompositor *) clc;

View File

@ -1,90 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2008 Iain Holmes
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_COMPOSITOR_PRIVATE_H
#define META_COMPOSITOR_PRIVATE_H
#include "compositor.h"
struct _MetaCompositor
{
void (* destroy) (MetaCompositor *compositor);
void (*manage_screen) (MetaCompositor *compositor,
MetaScreen *screen);
void (*unmanage_screen) (MetaCompositor *compositor,
MetaScreen *screen);
void (*add_window) (MetaCompositor *compositor,
MetaWindow *window);
void (*remove_window) (MetaCompositor *compositor,
MetaWindow *window);
void (*set_updates) (MetaCompositor *compositor,
MetaWindow *window,
gboolean update);
gboolean (*process_event) (MetaCompositor *compositor,
XEvent *event,
MetaWindow *window);
Pixmap (*get_window_pixmap) (MetaCompositor *compositor,
MetaWindow *window);
void (*set_active_window) (MetaCompositor *compositor,
MetaScreen *screen,
MetaWindow *window);
void (*map_window) (MetaCompositor *compositor,
MetaWindow *window);
void (*unmap_window) (MetaCompositor *compositor,
MetaWindow *window);
void (*minimize_window) (MetaCompositor *compositor,
MetaWindow *window,
MetaRectangle *window_rect,
MetaRectangle *icon_rect);
void (*unminimize_window) (MetaCompositor *compositor,
MetaWindow *window,
MetaRectangle *window_rect,
MetaRectangle *icon_rect);
void (*maximize_window) (MetaCompositor *compositor,
MetaWindow *window,
MetaRectangle *window_rect);
void (*unmaximize_window) (MetaCompositor *compositor,
MetaWindow *window,
MetaRectangle *window_rect);
void (*update_workspace_geometry) (MetaCompositor *compositor,
MetaWorkspace *workspace);
void (*switch_workspace) (MetaCompositor *compositor,
MetaScreen *screen,
MetaWorkspace *from,
MetaWorkspace *to,
MetaMotionDirection direction);
void (*sync_stack) (MetaCompositor *compositor,
MetaScreen *screen,
GList *stack);
void (*set_window_hidden) (MetaCompositor *compositor,
MetaScreen *screen,
MetaWindow *window,
gboolean hidden);
void (*sync_window_geometry) (MetaCompositor *compositor,
MetaWindow *window);
void (*sync_screen_size) (MetaCompositor *compositor,
MetaScreen *screen,
guint width,
guint height);
};
#endif

View File

@ -1,240 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2008 Iain Holmes
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include <config.h>
#include "compositor-private.h"
#include "compositor-mutter.h"
#include "prefs.h"
MetaCompositor *
meta_compositor_new (MetaDisplay *display)
{
return mutter_new (display);
}
void
meta_compositor_destroy (MetaCompositor *compositor)
{
if (compositor && compositor->destroy)
compositor->destroy (compositor);
}
void
meta_compositor_add_window (MetaCompositor *compositor,
MetaWindow *window)
{
if (compositor && compositor->add_window)
compositor->add_window (compositor, window);
}
void
meta_compositor_remove_window (MetaCompositor *compositor,
MetaWindow *window)
{
if (compositor && compositor->remove_window)
compositor->remove_window (compositor, window);
}
void
meta_compositor_manage_screen (MetaCompositor *compositor,
MetaScreen *screen)
{
if (compositor && compositor->manage_screen)
compositor->manage_screen (compositor, screen);
}
void
meta_compositor_unmanage_screen (MetaCompositor *compositor,
MetaScreen *screen)
{
if (compositor && compositor->unmanage_screen)
compositor->unmanage_screen (compositor, screen);
}
void
meta_compositor_set_updates (MetaCompositor *compositor,
MetaWindow *window,
gboolean updates)
{
if (compositor && compositor->set_updates)
compositor->set_updates (compositor, window, updates);
}
gboolean
meta_compositor_process_event (MetaCompositor *compositor,
XEvent *event,
MetaWindow *window)
{
if (compositor && compositor->process_event)
return compositor->process_event (compositor, event, window);
else
return FALSE;
}
Pixmap
meta_compositor_get_window_pixmap (MetaCompositor *compositor,
MetaWindow *window)
{
if (compositor && compositor->get_window_pixmap)
return compositor->get_window_pixmap (compositor, window);
else
return None;
}
void
meta_compositor_set_active_window (MetaCompositor *compositor,
MetaScreen *screen,
MetaWindow *window)
{
if (compositor && compositor->set_active_window)
compositor->set_active_window (compositor, screen, 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)
{
if (compositor && compositor->map_window)
compositor->map_window (compositor, window);
}
void
meta_compositor_unmap_window (MetaCompositor *compositor,
MetaWindow *window)
{
if (compositor && compositor->unmap_window)
compositor->unmap_window (compositor, window);
}
void
meta_compositor_minimize_window (MetaCompositor *compositor,
MetaWindow *window,
MetaRectangle *window_rect,
MetaRectangle *icon_rect)
{
if (compositor && compositor->minimize_window)
compositor->minimize_window (compositor, window, window_rect, icon_rect);
}
void
meta_compositor_unminimize_window (MetaCompositor *compositor,
MetaWindow *window,
MetaRectangle *window_rect,
MetaRectangle *icon_rect)
{
if (compositor && compositor->unminimize_window)
compositor->unminimize_window (compositor, window, window_rect, icon_rect);
}
void
meta_compositor_maximize_window (MetaCompositor *compositor,
MetaWindow *window,
MetaRectangle *window_rect)
{
if (compositor && compositor->maximize_window)
compositor->maximize_window (compositor, window, window_rect);
}
void
meta_compositor_unmaximize_window (MetaCompositor *compositor,
MetaWindow *window,
MetaRectangle *window_rect)
{
if (compositor && compositor->unmaximize_window)
compositor->unmaximize_window (compositor, window, window_rect);
}
void
meta_compositor_update_workspace_geometry (MetaCompositor *compositor,
MetaWorkspace *workspace)
{
if (compositor && compositor->update_workspace_geometry)
compositor->update_workspace_geometry (compositor, workspace);
}
void
meta_compositor_switch_workspace (MetaCompositor *compositor,
MetaScreen *screen,
MetaWorkspace *from,
MetaWorkspace *to,
MetaMotionDirection direction)
{
if (compositor && compositor->switch_workspace)
compositor->switch_workspace (compositor, screen, from, to, direction);
}
void
meta_compositor_sync_stack (MetaCompositor *compositor,
MetaScreen *screen,
GList *stack)
{
if (compositor && compositor->sync_stack)
compositor->sync_stack (compositor, screen, stack);
}
void
meta_compositor_set_window_hidden (MetaCompositor *compositor,
MetaScreen *screen,
MetaWindow *window,
gboolean hidden)
{
if (compositor && compositor->set_window_hidden)
compositor->set_window_hidden (compositor, screen, window, hidden);
}
void
meta_compositor_sync_window_geometry (MetaCompositor *compositor,
MetaWindow *window)
{
if (compositor && compositor->sync_window_geometry)
compositor->sync_window_geometry (compositor, window);
}
void
meta_compositor_sync_screen_size (MetaCompositor *compositor,
MetaScreen *screen,
guint width,
guint height)
{
if (compositor && compositor->sync_screen_size)
compositor->sync_screen_size (compositor, screen, width, height);
}

View File

@ -686,9 +686,10 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
meta_windows = g_list_prepend (meta_windows, meta_window); meta_windows = g_list_prepend (meta_windows, meta_window);
} }
meta_compositor_sync_stack (tracker->screen->display->compositor, if (tracker->screen->display->compositor)
tracker->screen, meta_compositor_sync_stack (tracker->screen->display->compositor,
meta_windows); tracker->screen,
meta_windows);
g_list_free (meta_windows); g_list_free (meta_windows);
meta_screen_restacked (tracker->screen); meta_screen_restacked (tracker->screen);

View File

@ -1274,8 +1274,9 @@ meta_window_unmanage (MetaWindow *window,
if (window->display->focus_window == window) if (window->display->focus_window == window)
{ {
window->display->focus_window = NULL; window->display->focus_window = NULL;
meta_compositor_set_active_window (window->display->compositor, if (window->display->compositor)
window->screen, NULL); meta_compositor_set_active_window (window->display->compositor,
window->screen, NULL);
} }
if (window->maximized_horizontally || window->maximized_vertically) if (window->maximized_horizontally || window->maximized_vertically)
@ -2550,10 +2551,11 @@ meta_window_show (MetaWindow *window)
meta_stack_freeze (window->screen->stack); meta_stack_freeze (window->screen->stack);
window->hidden = FALSE; window->hidden = FALSE;
/* Inform the compositor that the window isn't hidden */ /* Inform the compositor that the window isn't hidden */
meta_compositor_set_window_hidden (window->display->compositor, if (window->display->compositor)
window->screen, meta_compositor_set_window_hidden (window->display->compositor,
window, window->screen,
window->hidden); window,
window->hidden);
meta_stack_thaw (window->screen->stack); meta_stack_thaw (window->screen->stack);
did_show = TRUE; did_show = TRUE;
} }
@ -2582,8 +2584,11 @@ meta_window_show (MetaWindow *window)
NULL, NULL); NULL, NULL);
} }
else 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; window->was_minimized = FALSE;
} }
@ -2659,21 +2664,24 @@ meta_window_hide (MetaWindow *window)
meta_stack_freeze (window->screen->stack); meta_stack_freeze (window->screen->stack);
window->hidden = TRUE; window->hidden = TRUE;
/* Tell the compositor this window is now hidden */ /* Tell the compositor this window is now hidden */
meta_compositor_set_window_hidden (window->display->compositor, if (window->display->compositor)
window->screen, meta_compositor_set_window_hidden (window->display->compositor,
window, window->screen,
window->hidden); window,
window->hidden);
meta_stack_thaw (window->screen->stack); meta_stack_thaw (window->screen->stack);
meta_compositor_unmap_window (window->display->compositor, if (window->display->compositor)
window); meta_compositor_unmap_window (window->display->compositor,
window);
did_hide = TRUE; did_hide = TRUE;
} }
else else
{ {
meta_compositor_unmap_window (window->display->compositor, if (window->display->compositor)
window); meta_compositor_unmap_window (window->display->compositor,
window);
/* Unmapping the frame is enough to make the window disappear, /* Unmapping the frame is enough to make the window disappear,
* but we need to hide the window itself so the client knows * 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, newx, newy, window->rect.width, window->rect.height,
window->user_rect.x, window->user_rect.y, window->user_rect.x, window->user_rect.y,
window->user_rect.width, window->user_rect.height); window->user_rect.width, window->user_rect.height);
meta_compositor_sync_window_geometry (window->display->compositor, if (window->display->compositor)
window); meta_compositor_sync_window_geometry (window->display->compositor,
window);
} }
else else
{ {
@ -4188,7 +4197,8 @@ meta_window_configure_notify (MetaWindow *window, XConfigureEvent *event)
if (!event->override_redirect && !event->send_event) if (!event->override_redirect && !event->send_event)
meta_warning ("Unhandled change of windows override redirect status\n"); 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 void
@ -5817,8 +5827,9 @@ meta_window_notify_focus (MetaWindow *window,
"* Focus --> %s\n", window->desc); "* Focus --> %s\n", window->desc);
window->display->focus_window = window; window->display->focus_window = window;
window->has_focus = TRUE; window->has_focus = TRUE;
meta_compositor_set_active_window (window->display->compositor, if (window->display->compositor)
window->screen, window); meta_compositor_set_active_window (window->display->compositor,
window->screen, window);
/* Move to the front of the focusing workspace's MRU list. /* Move to the front of the focusing workspace's MRU list.
* We should only be "removing" it from the MRU list if it's * 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) if (window->frame)
meta_frame_queue_draw (window->frame); meta_frame_queue_draw (window->frame);
meta_compositor_set_active_window (window->display->compositor, if (window->display->compositor)
window->screen, NULL); meta_compositor_set_active_window (window->display->compositor,
window->screen, NULL);
meta_error_trap_push (window->display); meta_error_trap_push (window->display);
XUninstallColormap (window->display->xdisplay, XUninstallColormap (window->display->xdisplay,

View File

@ -540,6 +540,9 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
gint num_workspaces, current_space, new_space; gint num_workspaces, current_space, new_space;
MetaMotionDirection direction = 0; MetaMotionDirection direction = 0;
if (!comp)
return;
current_space = meta_workspace_index (old); current_space = meta_workspace_index (old);
new_space = meta_workspace_index (workspace); 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. */ /* We're all done, YAAY! Record that everything has been validated. */
workspace->work_areas_invalid = FALSE; workspace->work_areas_invalid = FALSE;
/* {
* Notify the compositor that the workspace geometry has changed. /*
*/ * Notify the compositor that the workspace geometry has changed.
MetaScreen *screen = workspace->screen; */
MetaDisplay *display = meta_screen_get_display (screen); MetaScreen *screen = workspace->screen;
MetaCompositor *comp = meta_display_get_compositor (display); 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);
}
} }
/** /**