mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 01:36:10 -05:00
compositor: Kill off MetaCompScreen
Compositors haven't been able to manage more than one screen for quite a while. Merge MetaCompScreen into MetaCompositor, and update the API to match. We still keep MetaScreen in the public compositor API for compatibility purposes.
This commit is contained in:
parent
47aa583625
commit
cd905a34fb
@ -11,8 +11,6 @@
|
||||
#include "meta-window-actor-private.h"
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
typedef struct _MetaCompScreen MetaCompScreen;
|
||||
|
||||
struct _MetaCompositor
|
||||
{
|
||||
MetaDisplay *display;
|
||||
@ -24,11 +22,6 @@ struct _MetaCompositor
|
||||
|
||||
guint server_time_is_monotonic_time : 1;
|
||||
guint no_mipmaps : 1;
|
||||
};
|
||||
|
||||
struct _MetaCompScreen
|
||||
{
|
||||
MetaScreen *screen;
|
||||
|
||||
ClutterActor *stage, *window_group, *top_window_group;
|
||||
ClutterActor *background_actor;
|
||||
@ -50,13 +43,13 @@ struct _MetaCompScreen
|
||||
/* Wait 2ms after vblank before starting to draw next frame */
|
||||
#define META_SYNC_DELAY 2
|
||||
|
||||
void meta_switch_workspace_completed (MetaScreen *screen);
|
||||
void meta_switch_workspace_completed (MetaCompositor *compositor);
|
||||
|
||||
gboolean meta_begin_modal_for_plugin (MetaScreen *screen,
|
||||
gboolean meta_begin_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp);
|
||||
void meta_end_modal_for_plugin (MetaScreen *screen,
|
||||
void meta_end_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
guint32 timestamp);
|
||||
|
||||
|
@ -99,36 +99,34 @@ composite_at_least_version (MetaDisplay *display, int maj, int min)
|
||||
return (major > maj || (major == maj && minor >= min));
|
||||
}
|
||||
|
||||
static void sync_actor_stacking (MetaCompScreen *info);
|
||||
static void sync_actor_stacking (MetaCompositor *compositor);
|
||||
|
||||
static void
|
||||
meta_finish_workspace_switch (MetaCompScreen *info)
|
||||
meta_finish_workspace_switch (MetaCompositor *compositor)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
/* Finish hiding and showing actors for the new workspace */
|
||||
for (l = info->windows; l; l = l->next)
|
||||
for (l = compositor->windows; l; l = l->next)
|
||||
meta_window_actor_sync_visibility (l->data);
|
||||
|
||||
/* Fix up stacking order. */
|
||||
sync_actor_stacking (info);
|
||||
sync_actor_stacking (compositor);
|
||||
}
|
||||
|
||||
void
|
||||
meta_switch_workspace_completed (MetaScreen *screen)
|
||||
meta_switch_workspace_completed (MetaCompositor *compositor)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
/* FIXME -- must redo stacking order */
|
||||
info->switch_workspace_in_progress--;
|
||||
if (info->switch_workspace_in_progress < 0)
|
||||
compositor->switch_workspace_in_progress--;
|
||||
if (compositor->switch_workspace_in_progress < 0)
|
||||
{
|
||||
g_warning ("Error in workspace_switch accounting!");
|
||||
info->switch_workspace_in_progress = 0;
|
||||
compositor->switch_workspace_in_progress = 0;
|
||||
}
|
||||
|
||||
if (!info->switch_workspace_in_progress)
|
||||
meta_finish_workspace_switch (info);
|
||||
if (!compositor->switch_workspace_in_progress)
|
||||
meta_finish_workspace_switch (compositor);
|
||||
}
|
||||
|
||||
void
|
||||
@ -147,17 +145,17 @@ process_damage (MetaCompositor *compositor,
|
||||
}
|
||||
|
||||
static Window
|
||||
get_output_window (MetaScreen *screen)
|
||||
get_output_window (MetaCompositor *compositor)
|
||||
{
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
Window output, xroot;
|
||||
MetaDisplay *display = compositor->display;
|
||||
Display *xdisplay = display->xdisplay;
|
||||
Window output, xroot;
|
||||
XWindowAttributes attr;
|
||||
long event_mask;
|
||||
long event_mask;
|
||||
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
|
||||
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
|
||||
|
||||
xroot = meta_screen_get_xroot (screen);
|
||||
xroot = display->screen->xroot;
|
||||
output = XCompositeGetOverlayWindow (xdisplay, xroot);
|
||||
|
||||
meta_core_add_old_event_mask (xdisplay, output, &mask);
|
||||
@ -182,6 +180,13 @@ get_output_window (MetaScreen *screen)
|
||||
return output;
|
||||
}
|
||||
|
||||
/* compat helper */
|
||||
static MetaCompositor *
|
||||
get_compositor_for_screen (MetaScreen *screen)
|
||||
{
|
||||
return screen->display->compositor;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_get_stage_for_screen:
|
||||
* @screen: a #MetaScreen
|
||||
@ -191,12 +196,8 @@ get_output_window (MetaScreen *screen)
|
||||
ClutterActor *
|
||||
meta_get_stage_for_screen (MetaScreen *screen)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (!info)
|
||||
return NULL;
|
||||
|
||||
return info->stage;
|
||||
MetaCompositor *compositor = get_compositor_for_screen (screen);
|
||||
return compositor->stage;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,12 +209,8 @@ meta_get_stage_for_screen (MetaScreen *screen)
|
||||
ClutterActor *
|
||||
meta_get_window_group_for_screen (MetaScreen *screen)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (!info)
|
||||
return NULL;
|
||||
|
||||
return info->window_group;
|
||||
MetaCompositor *compositor = get_compositor_for_screen (screen);
|
||||
return compositor->window_group;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -225,12 +222,8 @@ meta_get_window_group_for_screen (MetaScreen *screen)
|
||||
ClutterActor *
|
||||
meta_get_top_window_group_for_screen (MetaScreen *screen)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (!info)
|
||||
return NULL;
|
||||
|
||||
return info->top_window_group;
|
||||
MetaCompositor *compositor = get_compositor_for_screen (screen);
|
||||
return compositor->top_window_group;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -242,12 +235,8 @@ meta_get_top_window_group_for_screen (MetaScreen *screen)
|
||||
GList *
|
||||
meta_get_window_actors (MetaScreen *screen)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (!info)
|
||||
return NULL;
|
||||
|
||||
return info->windows;
|
||||
MetaCompositor *compositor = get_compositor_for_screen (screen);
|
||||
return compositor->windows;
|
||||
}
|
||||
|
||||
void
|
||||
@ -261,10 +250,10 @@ meta_set_stage_input_region (MetaScreen *screen,
|
||||
*/
|
||||
if (!meta_is_wayland_compositor ())
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
Display *xdpy = meta_display_get_xdisplay (display);
|
||||
Window xstage = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
|
||||
MetaDisplay *display = screen->display;
|
||||
MetaCompositor *compositor = display->compositor;
|
||||
Display *xdpy = meta_display_get_xdisplay (display);
|
||||
Window xstage = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
|
||||
|
||||
XFixesSetWindowShapeRegion (xdpy, xstage, ShapeInput, 0, 0, region);
|
||||
|
||||
@ -273,7 +262,7 @@ meta_set_stage_input_region (MetaScreen *screen,
|
||||
* it's not the user doing something, it's the environment changing under the user.
|
||||
*/
|
||||
meta_display_add_ignored_crossing_serial (display, XNextRequest (xdpy));
|
||||
XFixesSetWindowShapeRegion (xdpy, info->output, ShapeInput, 0, 0, region);
|
||||
XFixesSetWindowShapeRegion (xdpy, compositor->output, ShapeInput, 0, 0, region);
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,15 +327,14 @@ meta_stage_is_focused (MetaScreen *screen)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
begin_modal_x11 (MetaScreen *screen,
|
||||
begin_modal_x11 (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaDisplay *display = compositor->display;
|
||||
Display *xdpy = meta_display_get_xdisplay (display);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
Window grab_window = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
|
||||
Window grab_window = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
|
||||
int result;
|
||||
gboolean pointer_grabbed = FALSE;
|
||||
gboolean keyboard_grabbed = FALSE;
|
||||
@ -411,7 +399,7 @@ begin_modal_x11 (MetaScreen *screen,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_begin_modal_for_plugin (MetaScreen *screen,
|
||||
meta_begin_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
@ -420,13 +408,13 @@ meta_begin_modal_for_plugin (MetaScreen *screen,
|
||||
* are significant differences in how we handle grabs that make it difficult to
|
||||
* merge the two.
|
||||
*/
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaDisplay *display = compositor->display;
|
||||
|
||||
if (is_modal (display) || display->grab_op != META_GRAB_OP_NONE)
|
||||
return FALSE;
|
||||
|
||||
if (!meta_is_wayland_compositor ())
|
||||
if (!begin_modal_x11 (screen, plugin, options, timestamp))
|
||||
if (!begin_modal_x11 (compositor, plugin, options, timestamp))
|
||||
return FALSE;
|
||||
|
||||
display->grab_op = META_GRAB_OP_COMPOSITOR;
|
||||
@ -441,11 +429,11 @@ meta_begin_modal_for_plugin (MetaScreen *screen,
|
||||
}
|
||||
|
||||
void
|
||||
meta_end_modal_for_plugin (MetaScreen *screen,
|
||||
meta_end_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaDisplay *display = compositor->display;
|
||||
Display *xdpy = meta_display_get_xdisplay (display);
|
||||
|
||||
g_return_if_fail (is_modal (display));
|
||||
@ -470,10 +458,10 @@ static void
|
||||
after_stage_paint (ClutterStage *stage,
|
||||
gpointer data)
|
||||
{
|
||||
MetaCompScreen *info = (MetaCompScreen*) data;
|
||||
MetaCompositor *compositor = data;
|
||||
GList *l;
|
||||
|
||||
for (l = info->windows; l; l = l->next)
|
||||
for (l = compositor->windows; l; l = l->next)
|
||||
meta_window_actor_post_paint (l->data);
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
@ -481,8 +469,7 @@ after_stage_paint (ClutterStage *stage,
|
||||
}
|
||||
|
||||
static void
|
||||
redirect_windows (MetaCompositor *compositor,
|
||||
MetaScreen *screen)
|
||||
redirect_windows (MetaScreen *screen)
|
||||
{
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
@ -525,48 +512,35 @@ redirect_windows (MetaCompositor *compositor,
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_manage_screen (MetaCompositor *compositor,
|
||||
MetaScreen *screen)
|
||||
meta_compositor_manage (MetaCompositor *compositor)
|
||||
{
|
||||
MetaCompScreen *info;
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
Window xwin = None;
|
||||
gint width, height;
|
||||
MetaDisplay *display = compositor->display;
|
||||
Display *xdisplay = display->xdisplay;
|
||||
MetaScreen *screen = display->screen;
|
||||
Window xwin;
|
||||
gint width, height;
|
||||
MetaWaylandCompositor *wayland_compositor;
|
||||
|
||||
/* Check if the screen is already managed */
|
||||
if (meta_screen_get_compositor_data (screen))
|
||||
return;
|
||||
|
||||
info = g_new0 (MetaCompScreen, 1);
|
||||
info->screen = screen;
|
||||
|
||||
meta_screen_set_compositor_data (screen, info);
|
||||
|
||||
info->output = None;
|
||||
info->windows = NULL;
|
||||
|
||||
meta_screen_set_cm_selection (screen);
|
||||
meta_screen_set_cm_selection (display->screen);
|
||||
|
||||
/* We will have already created a stage if running as a wayland
|
||||
* compositor... */
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
wayland_compositor = meta_wayland_compositor_get_default ();
|
||||
info->stage = wayland_compositor->stage;
|
||||
compositor->stage = wayland_compositor->stage;
|
||||
|
||||
meta_screen_get_size (screen, &width, &height);
|
||||
clutter_actor_set_size (info->stage, width, height);
|
||||
clutter_actor_set_size (compositor->stage, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
info->stage = clutter_stage_new ();
|
||||
compositor->stage = clutter_stage_new ();
|
||||
|
||||
meta_screen_get_size (screen, &width, &height);
|
||||
clutter_actor_realize (info->stage);
|
||||
clutter_actor_realize (compositor->stage);
|
||||
|
||||
xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
|
||||
xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
|
||||
|
||||
XResizeWindow (xdisplay, xwin, width, height);
|
||||
|
||||
@ -600,30 +574,30 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
|
||||
}
|
||||
}
|
||||
|
||||
clutter_stage_set_paint_callback (CLUTTER_STAGE (info->stage),
|
||||
clutter_stage_set_paint_callback (CLUTTER_STAGE (compositor->stage),
|
||||
after_stage_paint,
|
||||
info,
|
||||
compositor,
|
||||
NULL);
|
||||
|
||||
clutter_stage_set_sync_delay (CLUTTER_STAGE (info->stage), META_SYNC_DELAY);
|
||||
clutter_stage_set_sync_delay (CLUTTER_STAGE (compositor->stage), META_SYNC_DELAY);
|
||||
|
||||
info->window_group = meta_window_group_new (screen);
|
||||
info->top_window_group = meta_window_group_new (screen);
|
||||
compositor->window_group = meta_window_group_new (screen);
|
||||
compositor->top_window_group = meta_window_group_new (screen);
|
||||
|
||||
clutter_actor_add_child (info->stage, info->window_group);
|
||||
clutter_actor_add_child (info->stage, info->top_window_group);
|
||||
clutter_actor_add_child (compositor->stage, compositor->window_group);
|
||||
clutter_actor_add_child (compositor->stage, compositor->top_window_group);
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
/* NB: When running as a wayland compositor we don't need an X
|
||||
* composite overlay window, and we don't need to play any input
|
||||
* region tricks to redirect events into clutter. */
|
||||
info->output = None;
|
||||
compositor->output = None;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->output = get_output_window (screen);
|
||||
XReparentWindow (xdisplay, xwin, info->output, 0, 0);
|
||||
compositor->output = get_output_window (compositor);
|
||||
XReparentWindow (xdisplay, xwin, compositor->output, 0, 0);
|
||||
|
||||
meta_empty_stage_input_region (screen);
|
||||
|
||||
@ -635,28 +609,27 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
|
||||
* because the X server will destroy the overlay window
|
||||
* when the last client using it exits.
|
||||
*/
|
||||
XFixesSetWindowShapeRegion (xdisplay, info->output, ShapeBounding, 0, 0, None);
|
||||
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, None);
|
||||
|
||||
/* Map overlay window before redirecting windows offscreen so we catch their
|
||||
* contents until we show the stage.
|
||||
*/
|
||||
XMapWindow (xdisplay, info->output);
|
||||
XMapWindow (xdisplay, compositor->output);
|
||||
}
|
||||
|
||||
redirect_windows (compositor, screen);
|
||||
redirect_windows (display->screen);
|
||||
|
||||
info->plugin_mgr = meta_plugin_manager_new (screen);
|
||||
compositor->plugin_mgr = meta_plugin_manager_new (compositor);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_unmanage_screen (MetaCompositor *compositor,
|
||||
MetaScreen *screen)
|
||||
meta_compositor_unmanage (MetaCompositor *compositor)
|
||||
{
|
||||
if (!meta_is_wayland_compositor ())
|
||||
{
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
Window xroot = meta_screen_get_xroot (screen);
|
||||
MetaDisplay *display = compositor->display;
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
Window xroot = display->screen->xroot;
|
||||
|
||||
/* This is the most important part of cleanup - we have to do this
|
||||
* before giving up the window manager selection or the next
|
||||
@ -667,7 +640,7 @@ meta_compositor_unmanage_screen (MetaCompositor *compositor,
|
||||
|
||||
/**
|
||||
* meta_shape_cow_for_window:
|
||||
* @screen: A #MetaScreen
|
||||
* @compositor: A #MetaCompositor
|
||||
* @window: (allow-none): A #MetaWindow to shape the COW for
|
||||
*
|
||||
* Sets an bounding shape on the COW so that the given window
|
||||
@ -677,14 +650,14 @@ meta_compositor_unmanage_screen (MetaCompositor *compositor,
|
||||
* of the COW, letting the raw window be seen through below.
|
||||
*/
|
||||
static void
|
||||
meta_shape_cow_for_window (MetaScreen *screen,
|
||||
meta_shape_cow_for_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
Display *xdisplay = meta_display_get_xdisplay (meta_screen_get_display (screen));
|
||||
MetaDisplay *display = compositor->display;
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
|
||||
if (window == NULL)
|
||||
XFixesSetWindowShapeRegion (xdisplay, info->output, ShapeBounding, 0, 0, None);
|
||||
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, None);
|
||||
else
|
||||
{
|
||||
XserverRegion output_region;
|
||||
@ -699,7 +672,7 @@ meta_shape_cow_for_window (MetaScreen *screen,
|
||||
window_bounds.width = rect.width;
|
||||
window_bounds.height = rect.height;
|
||||
|
||||
meta_screen_get_size (screen, &width, &height);
|
||||
meta_screen_get_size (display->screen, &width, &height);
|
||||
screen_rect.x = 0;
|
||||
screen_rect.y = 0;
|
||||
screen_rect.width = width;
|
||||
@ -708,47 +681,45 @@ meta_shape_cow_for_window (MetaScreen *screen,
|
||||
output_region = XFixesCreateRegion (xdisplay, &window_bounds, 1);
|
||||
|
||||
XFixesInvertRegion (xdisplay, output_region, &screen_rect, output_region);
|
||||
XFixesSetWindowShapeRegion (xdisplay, info->output, ShapeBounding, 0, 0, output_region);
|
||||
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, output_region);
|
||||
XFixesDestroyRegion (xdisplay, output_region);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_unredirected_window (MetaCompScreen *info,
|
||||
set_unredirected_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
if (info->unredirected_window == window)
|
||||
if (compositor->unredirected_window == window)
|
||||
return;
|
||||
|
||||
if (info->unredirected_window != NULL)
|
||||
if (compositor->unredirected_window != NULL)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (info->unredirected_window));
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
|
||||
meta_window_actor_set_unredirected (window_actor, FALSE);
|
||||
}
|
||||
|
||||
info->unredirected_window = window;
|
||||
compositor->unredirected_window = window;
|
||||
|
||||
if (info->unredirected_window != NULL)
|
||||
if (compositor->unredirected_window != NULL)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (info->unredirected_window));
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
|
||||
meta_window_actor_set_unredirected (window_actor, TRUE);
|
||||
}
|
||||
|
||||
meta_shape_cow_for_window (info->screen, info->unredirected_window);
|
||||
meta_shape_cow_for_window (compositor, compositor->unredirected_window);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_add_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaScreen *screen = meta_window_get_screen (window);
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
MetaDisplay *display = compositor->display;
|
||||
|
||||
meta_error_trap_push (display);
|
||||
|
||||
meta_window_actor_new (window);
|
||||
sync_actor_stacking (info);
|
||||
sync_actor_stacking (compositor);
|
||||
|
||||
meta_error_trap_pop (display);
|
||||
}
|
||||
@ -758,11 +729,9 @@ meta_compositor_remove_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
||||
MetaScreen *screen = meta_window_get_screen (window);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (info->unredirected_window == window)
|
||||
set_unredirected_window (info, NULL);
|
||||
if (compositor->unredirected_window == window)
|
||||
set_unredirected_window (compositor, NULL);
|
||||
|
||||
meta_window_actor_destroy (window_actor);
|
||||
}
|
||||
@ -879,11 +848,11 @@ event_is_passive_button_grab (MetaDisplay *display,
|
||||
* these events by pretending we got an event on the stage window.
|
||||
*/
|
||||
static void
|
||||
maybe_spoof_event_as_stage_event (MetaCompScreen *info,
|
||||
maybe_spoof_event_as_stage_event (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
XEvent *event)
|
||||
{
|
||||
MetaDisplay *display = meta_screen_get_display (info->screen);
|
||||
MetaDisplay *display = compositor->display;
|
||||
|
||||
if (event->type == GenericEvent &&
|
||||
event->xcookie.extension == display->xinput_opcode)
|
||||
@ -907,10 +876,10 @@ maybe_spoof_event_as_stage_event (MetaCompScreen *info,
|
||||
case XI_KeyRelease:
|
||||
/* If this is a GTK+ widget, like a window menu, let GTK+ handle
|
||||
* it as-is without mangling. */
|
||||
if (meta_ui_window_is_widget (info->screen->ui, device_event->event))
|
||||
if (meta_ui_window_is_widget (display->screen->ui, device_event->event))
|
||||
break;
|
||||
|
||||
device_event->event = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
|
||||
device_event->event = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
|
||||
device_event->event_x = device_event->root_x;
|
||||
device_event->event_y = device_event->root_y;
|
||||
break;
|
||||
@ -933,11 +902,10 @@ meta_compositor_process_event (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaDisplay *display = compositor->display;
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (display->screen);
|
||||
|
||||
if (is_modal (display) && is_grabbed_event (compositor->display, event))
|
||||
if (is_modal (display) && is_grabbed_event (display, event))
|
||||
{
|
||||
meta_plugin_manager_xevent_filter (info->plugin_mgr, event);
|
||||
meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event);
|
||||
|
||||
/* We always consume events even if the plugin says it didn't handle them;
|
||||
* exclusive is exclusive */
|
||||
@ -945,9 +913,9 @@ meta_compositor_process_event (MetaCompositor *compositor,
|
||||
}
|
||||
|
||||
if (!meta_is_wayland_compositor ())
|
||||
maybe_spoof_event_as_stage_event (info, window, event);
|
||||
maybe_spoof_event_as_stage_event (compositor, window, event);
|
||||
|
||||
if (meta_plugin_manager_xevent_filter (info->plugin_mgr, event))
|
||||
if (meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event))
|
||||
return TRUE;
|
||||
|
||||
if (!meta_is_wayland_compositor () &&
|
||||
@ -979,11 +947,9 @@ meta_compositor_process_event (MetaCompositor *compositor,
|
||||
|
||||
gboolean
|
||||
meta_compositor_filter_keybinding (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
MetaKeyBinding *binding)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
return meta_plugin_manager_filter_keybinding (info->plugin_mgr, binding);
|
||||
return meta_plugin_manager_filter_keybinding (compositor->plugin_mgr, binding);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1026,40 +992,35 @@ meta_compositor_unmaximize_window (MetaCompositor *compositor,
|
||||
|
||||
void
|
||||
meta_compositor_switch_workspace (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
MetaWorkspace *from,
|
||||
MetaWorkspace *to,
|
||||
MetaMotionDirection direction)
|
||||
{
|
||||
MetaCompScreen *info;
|
||||
gint to_indx, from_indx;
|
||||
gint to_indx, from_indx;
|
||||
|
||||
info = meta_screen_get_compositor_data (screen);
|
||||
to_indx = meta_workspace_index (to);
|
||||
from_indx = meta_workspace_index (from);
|
||||
|
||||
if (!info) /* During startup before manage_screen() */
|
||||
return;
|
||||
compositor->switch_workspace_in_progress++;
|
||||
|
||||
info->switch_workspace_in_progress++;
|
||||
|
||||
if (!meta_plugin_manager_switch_workspace (info->plugin_mgr,
|
||||
from_indx, to_indx,
|
||||
if (!meta_plugin_manager_switch_workspace (compositor->plugin_mgr,
|
||||
from_indx,
|
||||
to_indx,
|
||||
direction))
|
||||
{
|
||||
info->switch_workspace_in_progress--;
|
||||
compositor->switch_workspace_in_progress--;
|
||||
|
||||
/* We have to explicitely call this to fix up stacking order of the
|
||||
* actors; this is because the abs stacking position of actors does not
|
||||
* necessarily change during the window hiding/unhiding, only their
|
||||
* relative position toward the destkop window.
|
||||
*/
|
||||
meta_finish_workspace_switch (info);
|
||||
meta_finish_workspace_switch (compositor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sync_actor_stacking (MetaCompScreen *info)
|
||||
sync_actor_stacking (MetaCompositor *compositor)
|
||||
{
|
||||
GList *children;
|
||||
GList *expected_window_node;
|
||||
@ -1075,7 +1036,7 @@ sync_actor_stacking (MetaCompScreen *info)
|
||||
* little effort to make sure we actually need to restack before
|
||||
* we go ahead and do it */
|
||||
|
||||
children = clutter_actor_get_children (info->window_group);
|
||||
children = clutter_actor_get_children (compositor->window_group);
|
||||
has_windows = FALSE;
|
||||
reordered = FALSE;
|
||||
|
||||
@ -1087,7 +1048,7 @@ sync_actor_stacking (MetaCompScreen *info)
|
||||
/* First we collect a list of all backgrounds, and check if they're at the
|
||||
* bottom. Then we check if the window actors are in the correct sequence */
|
||||
backgrounds = NULL;
|
||||
expected_window_node = info->windows;
|
||||
expected_window_node = compositor->windows;
|
||||
for (old = children; old != NULL; old = old->next)
|
||||
{
|
||||
ClutterActor *actor = old->data;
|
||||
@ -1125,7 +1086,7 @@ sync_actor_stacking (MetaCompScreen *info)
|
||||
* We reorder the actors even if they're not parented to the window group,
|
||||
* to allow stacking to work with intermediate actors (eg during effects)
|
||||
*/
|
||||
for (tmp = g_list_last (info->windows); tmp != NULL; tmp = tmp->prev)
|
||||
for (tmp = g_list_last (compositor->windows); tmp != NULL; tmp = tmp->prev)
|
||||
{
|
||||
ClutterActor *actor = tmp->data, *parent;
|
||||
|
||||
@ -1148,11 +1109,9 @@ sync_actor_stacking (MetaCompScreen *info)
|
||||
|
||||
void
|
||||
meta_compositor_sync_stack (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
GList *stack)
|
||||
{
|
||||
GList *old_stack;
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
/* This is painful because hidden windows that we are in the process
|
||||
* of animating out of existence. They'll be at the bottom of the
|
||||
@ -1162,8 +1121,8 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
|
||||
|
||||
/* Sources: first window is the highest */
|
||||
stack = g_list_copy (stack); /* The new stack of MetaWindow */
|
||||
old_stack = g_list_reverse (info->windows); /* The old stack of MetaWindowActor */
|
||||
info->windows = NULL;
|
||||
old_stack = g_list_reverse (compositor->windows); /* The old stack of MetaWindowActor */
|
||||
compositor->windows = NULL;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
@ -1227,13 +1186,13 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
|
||||
* be at the front of at least one, hopefully it will be
|
||||
* near the front of the other.)
|
||||
*/
|
||||
info->windows = g_list_prepend (info->windows, actor);
|
||||
compositor->windows = g_list_prepend (compositor->windows, actor);
|
||||
|
||||
stack = g_list_remove (stack, window);
|
||||
old_stack = g_list_remove (old_stack, actor);
|
||||
}
|
||||
|
||||
sync_actor_stacking (info);
|
||||
sync_actor_stacking (compositor);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1247,12 +1206,10 @@ meta_compositor_sync_window_geometry (MetaCompositor *compositor,
|
||||
|
||||
void
|
||||
meta_compositor_sync_screen_size (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
guint width,
|
||||
guint height)
|
||||
{
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
MetaDisplay *display = compositor->display;
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
@ -1266,23 +1223,21 @@ meta_compositor_sync_screen_size (MetaCompositor *compositor,
|
||||
show the right portions on the right screens.
|
||||
*/
|
||||
|
||||
clutter_actor_set_size (info->stage, width, height);
|
||||
clutter_actor_set_size (compositor->stage, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
Display *xdisplay;
|
||||
Window xwin;
|
||||
|
||||
g_return_if_fail (info);
|
||||
|
||||
xdisplay = meta_display_get_xdisplay (display);
|
||||
xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
|
||||
xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
|
||||
|
||||
XResizeWindow (xdisplay, xwin, width, height);
|
||||
}
|
||||
|
||||
meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
|
||||
meta_screen_get_screen_number (screen),
|
||||
meta_screen_get_screen_number (display->screen),
|
||||
width, height);
|
||||
}
|
||||
|
||||
@ -1292,7 +1247,7 @@ frame_callback (CoglOnscreen *onscreen,
|
||||
CoglFrameInfo *frame_info,
|
||||
void *user_data)
|
||||
{
|
||||
MetaCompScreen *info = user_data;
|
||||
MetaCompositor *compositor = user_data;
|
||||
GList *l;
|
||||
|
||||
if (event == COGL_FRAME_EVENT_COMPLETE)
|
||||
@ -1323,38 +1278,38 @@ frame_callback (CoglOnscreen *onscreen,
|
||||
presentation_time = 0;
|
||||
}
|
||||
|
||||
for (l = info->windows; l; l = l->next)
|
||||
for (l = compositor->windows; l; l = l->next)
|
||||
meta_window_actor_frame_complete (l->data, frame_info, presentation_time);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pre_paint_windows (MetaCompScreen *info)
|
||||
pre_paint_windows (MetaCompositor *compositor)
|
||||
{
|
||||
GList *l;
|
||||
MetaWindowActor *top_window;
|
||||
|
||||
if (info->onscreen == NULL)
|
||||
if (compositor->onscreen == NULL)
|
||||
{
|
||||
info->onscreen = COGL_ONSCREEN (cogl_get_draw_framebuffer ());
|
||||
info->frame_closure = cogl_onscreen_add_frame_callback (info->onscreen,
|
||||
frame_callback,
|
||||
info,
|
||||
NULL);
|
||||
compositor->onscreen = COGL_ONSCREEN (cogl_get_draw_framebuffer ());
|
||||
compositor->frame_closure = cogl_onscreen_add_frame_callback (compositor->onscreen,
|
||||
frame_callback,
|
||||
compositor,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (info->windows == NULL)
|
||||
if (compositor->windows == NULL)
|
||||
return;
|
||||
|
||||
top_window = g_list_last (info->windows)->data;
|
||||
top_window = g_list_last (compositor->windows)->data;
|
||||
|
||||
if (meta_window_actor_should_unredirect (top_window) &&
|
||||
info->disable_unredirect_count == 0)
|
||||
set_unredirected_window (info, meta_window_actor_get_meta_window (top_window));
|
||||
compositor->disable_unredirect_count == 0)
|
||||
set_unredirected_window (compositor, meta_window_actor_get_meta_window (top_window));
|
||||
else
|
||||
set_unredirected_window (info, NULL);
|
||||
set_unredirected_window (compositor, NULL);
|
||||
|
||||
for (l = info->windows; l; l = l->next)
|
||||
for (l = compositor->windows; l; l = l->next)
|
||||
meta_window_actor_pre_paint (l->data);
|
||||
}
|
||||
|
||||
@ -1362,9 +1317,7 @@ static gboolean
|
||||
meta_repaint_func (gpointer data)
|
||||
{
|
||||
MetaCompositor *compositor = data;
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (compositor->display->screen);
|
||||
pre_paint_windows (info);
|
||||
|
||||
pre_paint_windows (compositor);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1372,10 +1325,9 @@ static void
|
||||
on_shadow_factory_changed (MetaShadowFactory *factory,
|
||||
MetaCompositor *compositor)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (compositor->display->screen);
|
||||
GList *l;
|
||||
|
||||
for (l = info->windows; l; l = l->next)
|
||||
for (l = compositor->windows; l; l = l->next)
|
||||
meta_window_actor_invalidate_shadow (l->data);
|
||||
}
|
||||
|
||||
@ -1419,9 +1371,8 @@ meta_compositor_new (MetaDisplay *display)
|
||||
Window
|
||||
meta_get_overlay_window (MetaScreen *screen)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
return info->output;
|
||||
MetaCompositor *compositor = get_compositor_for_screen (screen);
|
||||
return compositor->output;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1435,9 +1386,8 @@ meta_get_overlay_window (MetaScreen *screen)
|
||||
void
|
||||
meta_disable_unredirect_for_screen (MetaScreen *screen)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
if (info != NULL)
|
||||
info->disable_unredirect_count = info->disable_unredirect_count + 1;
|
||||
MetaCompositor *compositor = get_compositor_for_screen (screen);
|
||||
compositor->disable_unredirect_count++;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1450,11 +1400,11 @@ meta_disable_unredirect_for_screen (MetaScreen *screen)
|
||||
void
|
||||
meta_enable_unredirect_for_screen (MetaScreen *screen)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
if (info != NULL && info->disable_unredirect_count == 0)
|
||||
MetaCompositor *compositor = get_compositor_for_screen (screen);
|
||||
if (compositor->disable_unredirect_count == 0)
|
||||
g_warning ("Called enable_unredirect_for_screen while unredirection is enabled.");
|
||||
if (info != NULL && info->disable_unredirect_count > 0)
|
||||
info->disable_unredirect_count = info->disable_unredirect_count - 1;
|
||||
if (compositor->disable_unredirect_count > 0)
|
||||
compositor->disable_unredirect_count--;
|
||||
}
|
||||
|
||||
#define FLASH_TIME_MS 50
|
||||
@ -1551,20 +1501,16 @@ meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
|
||||
|
||||
void
|
||||
meta_compositor_show_tile_preview (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
MetaWindow *window,
|
||||
MetaRectangle *tile_rect,
|
||||
int tile_monitor_number)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
meta_plugin_manager_show_tile_preview (info->plugin_mgr,
|
||||
meta_plugin_manager_show_tile_preview (compositor->plugin_mgr,
|
||||
window, tile_rect, tile_monitor_number);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_hide_tile_preview (MetaCompositor *compositor,
|
||||
MetaScreen *screen)
|
||||
meta_compositor_hide_tile_preview (MetaCompositor *compositor)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
meta_plugin_manager_hide_tile_preview (info->plugin_mgr);
|
||||
meta_plugin_manager_hide_tile_preview (compositor->plugin_mgr);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ static GType plugin_type = G_TYPE_NONE;
|
||||
|
||||
struct MetaPluginManager
|
||||
{
|
||||
MetaScreen *screen;
|
||||
MetaCompositor *compositor;
|
||||
MetaPlugin *plugin;
|
||||
};
|
||||
|
||||
@ -91,7 +91,7 @@ on_confirm_display_change (MetaMonitorManager *monitors,
|
||||
}
|
||||
|
||||
MetaPluginManager *
|
||||
meta_plugin_manager_new (MetaScreen *screen)
|
||||
meta_plugin_manager_new (MetaCompositor *compositor)
|
||||
{
|
||||
MetaPluginManager *plugin_mgr;
|
||||
MetaPluginClass *klass;
|
||||
@ -99,10 +99,10 @@ meta_plugin_manager_new (MetaScreen *screen)
|
||||
MetaMonitorManager *monitors;
|
||||
|
||||
plugin_mgr = g_new0 (MetaPluginManager, 1);
|
||||
plugin_mgr->screen = screen;
|
||||
plugin_mgr->compositor = compositor;
|
||||
plugin_mgr->plugin = plugin = g_object_new (plugin_type, NULL);
|
||||
|
||||
_meta_plugin_set_screen (plugin, screen);
|
||||
_meta_plugin_set_compositor (plugin, compositor);
|
||||
|
||||
klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
|
||||
@ -153,7 +153,7 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
if (display->display_opening)
|
||||
@ -213,7 +213,7 @@ meta_plugin_manager_event_maximize (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
if (display->display_opening)
|
||||
@ -266,7 +266,7 @@ meta_plugin_manager_switch_workspace (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
if (display->display_opening)
|
||||
@ -324,7 +324,7 @@ meta_plugin_manager_show_tile_preview (MetaPluginManager *plugin_mgr,
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
|
||||
if (display->display_opening)
|
||||
return FALSE;
|
||||
@ -343,7 +343,7 @@ meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr)
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
|
||||
MetaDisplay *display = plugin_mgr->compositor->display;
|
||||
|
||||
if (display->display_opening)
|
||||
return FALSE;
|
||||
|
@ -44,7 +44,7 @@
|
||||
*/
|
||||
typedef struct MetaPluginManager MetaPluginManager;
|
||||
|
||||
MetaPluginManager * meta_plugin_manager_new (MetaScreen *screen);
|
||||
MetaPluginManager * meta_plugin_manager_new (MetaCompositor *compositor);
|
||||
|
||||
void meta_plugin_manager_load (const gchar *plugin_name);
|
||||
|
||||
|
@ -49,7 +49,7 @@ G_DEFINE_ABSTRACT_TYPE (MetaPlugin, meta_plugin, G_TYPE_OBJECT);
|
||||
|
||||
struct _MetaPluginPrivate
|
||||
{
|
||||
MetaScreen *screen;
|
||||
MetaCompositor *compositor;
|
||||
};
|
||||
|
||||
static void
|
||||
@ -101,9 +101,8 @@ void
|
||||
meta_plugin_switch_workspace_completed (MetaPlugin *plugin)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
MetaScreen *screen = priv->screen;
|
||||
|
||||
meta_switch_workspace_completed (screen);
|
||||
meta_switch_workspace_completed (priv->compositor);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -177,7 +176,7 @@ meta_plugin_begin_modal (MetaPlugin *plugin,
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
|
||||
return meta_begin_modal_for_plugin (priv->screen, plugin,
|
||||
return meta_begin_modal_for_plugin (priv->compositor, plugin,
|
||||
options, timestamp);
|
||||
}
|
||||
|
||||
@ -198,7 +197,7 @@ meta_plugin_end_modal (MetaPlugin *plugin,
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
|
||||
meta_end_modal_for_plugin (priv->screen, plugin, timestamp);
|
||||
meta_end_modal_for_plugin (priv->compositor, plugin, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -214,16 +213,15 @@ meta_plugin_get_screen (MetaPlugin *plugin)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
|
||||
return priv->screen;
|
||||
return priv->compositor->display->screen;
|
||||
}
|
||||
|
||||
void
|
||||
_meta_plugin_set_screen (MetaPlugin *plugin,
|
||||
MetaScreen *screen)
|
||||
_meta_plugin_set_compositor (MetaPlugin *plugin, MetaCompositor *compositor)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
|
||||
priv->screen = screen;
|
||||
priv->compositor = compositor;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -37,8 +37,8 @@
|
||||
|
||||
struct _MetaWindowActorPrivate
|
||||
{
|
||||
MetaWindow *window;
|
||||
MetaScreen *screen;
|
||||
MetaWindow *window;
|
||||
MetaCompositor *compositor;
|
||||
|
||||
MetaSurfaceActor *surface;
|
||||
|
||||
@ -371,11 +371,11 @@ meta_window_actor_update_surface (MetaWindowActor *self)
|
||||
static void
|
||||
meta_window_actor_constructed (GObject *object)
|
||||
{
|
||||
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaWindow *window = priv->window;
|
||||
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaWindow *window = priv->window;
|
||||
|
||||
priv->screen = window->screen;
|
||||
priv->compositor = window->display->compositor;
|
||||
|
||||
meta_window_actor_update_surface (self);
|
||||
|
||||
@ -389,19 +389,15 @@ meta_window_actor_constructed (GObject *object)
|
||||
static void
|
||||
meta_window_actor_dispose (GObject *object)
|
||||
{
|
||||
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
||||
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaScreen *screen;
|
||||
MetaCompScreen *info;
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
|
||||
if (priv->disposed)
|
||||
return;
|
||||
|
||||
priv->disposed = TRUE;
|
||||
|
||||
screen = priv->screen;
|
||||
info = meta_screen_get_compositor_data (screen);
|
||||
|
||||
if (priv->send_frame_messages_timer != 0)
|
||||
{
|
||||
g_source_remove (priv->send_frame_messages_timer);
|
||||
@ -416,7 +412,7 @@ meta_window_actor_dispose (GObject *object)
|
||||
g_clear_pointer (&priv->unfocused_shadow, meta_shadow_unref);
|
||||
g_clear_pointer (&priv->shadow_shape, meta_window_shape_unref);
|
||||
|
||||
info->windows = g_list_remove (info->windows, (gconstpointer) self);
|
||||
compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
|
||||
|
||||
g_clear_object (&priv->window);
|
||||
|
||||
@ -851,8 +847,7 @@ static void
|
||||
queue_send_frame_messages_timeout (MetaWindowActor *self)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaScreen *screen = priv->screen;
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaDisplay *display = meta_window_get_display (priv->window);
|
||||
gint64 current_time = meta_compositor_monotonic_time_to_server_time (display, g_get_monotonic_time ());
|
||||
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
||||
MetaWindow *window = priv->window;
|
||||
@ -964,7 +959,7 @@ start_simple_effect (MetaWindowActor *self,
|
||||
gulong event)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (priv->screen);
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
gint *counter = NULL;
|
||||
gboolean use_freeze_thaw = FALSE;
|
||||
|
||||
@ -995,9 +990,7 @@ start_simple_effect (MetaWindowActor *self,
|
||||
|
||||
(*counter)++;
|
||||
|
||||
if (!meta_plugin_manager_event_simple (info->plugin_mgr,
|
||||
self,
|
||||
event))
|
||||
if (!meta_plugin_manager_event_simple (compositor->plugin_mgr, self, event))
|
||||
{
|
||||
(*counter)--;
|
||||
if (use_freeze_thaw)
|
||||
@ -1118,15 +1111,11 @@ meta_window_actor_set_unredirected (MetaWindowActor *self,
|
||||
void
|
||||
meta_window_actor_destroy (MetaWindowActor *self)
|
||||
{
|
||||
MetaWindow *window;
|
||||
MetaCompScreen *info;
|
||||
MetaWindowActorPrivate *priv;
|
||||
MetaWindowType window_type;
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaWindow *window = priv->window;
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
MetaWindowType window_type = meta_window_get_window_type (window);
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
window = priv->window;
|
||||
window_type = meta_window_get_window_type (window);
|
||||
meta_window_set_compositor_private (window, NULL);
|
||||
|
||||
if (priv->send_frame_messages_timer != 0)
|
||||
@ -1139,8 +1128,7 @@ meta_window_actor_destroy (MetaWindowActor *self)
|
||||
* We remove the window from internal lookup hashes and thus any other
|
||||
* unmap events etc fail
|
||||
*/
|
||||
info = meta_screen_get_compositor_data (priv->screen);
|
||||
info->windows = g_list_remove (info->windows, (gconstpointer) self);
|
||||
compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
|
||||
|
||||
if (window_type == META_WINDOW_DROPDOWN_MENU ||
|
||||
window_type == META_WINDOW_POPUP_MENU ||
|
||||
@ -1201,18 +1189,14 @@ void
|
||||
meta_window_actor_show (MetaWindowActor *self,
|
||||
MetaCompEffect effect)
|
||||
{
|
||||
MetaWindowActorPrivate *priv;
|
||||
MetaCompScreen *info;
|
||||
gulong event;
|
||||
|
||||
priv = self->priv;
|
||||
info = meta_screen_get_compositor_data (priv->screen);
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
gulong event = 0;
|
||||
|
||||
g_return_if_fail (!priv->visible);
|
||||
|
||||
self->priv->visible = TRUE;
|
||||
|
||||
event = 0;
|
||||
switch (effect)
|
||||
{
|
||||
case META_COMP_EFFECT_CREATE:
|
||||
@ -1229,7 +1213,7 @@ meta_window_actor_show (MetaWindowActor *self,
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
if (info->switch_workspace_in_progress ||
|
||||
if (compositor->switch_workspace_in_progress ||
|
||||
event == 0 ||
|
||||
!start_simple_effect (self, event))
|
||||
{
|
||||
@ -1241,12 +1225,9 @@ void
|
||||
meta_window_actor_hide (MetaWindowActor *self,
|
||||
MetaCompEffect effect)
|
||||
{
|
||||
MetaWindowActorPrivate *priv;
|
||||
MetaCompScreen *info;
|
||||
gulong event;
|
||||
|
||||
priv = self->priv;
|
||||
info = meta_screen_get_compositor_data (priv->screen);
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
gulong event = 0;
|
||||
|
||||
g_return_if_fail (priv->visible);
|
||||
|
||||
@ -1256,10 +1237,9 @@ meta_window_actor_hide (MetaWindowActor *self,
|
||||
* hold off on hiding the window, and do it after the workspace
|
||||
* switch completes
|
||||
*/
|
||||
if (info->switch_workspace_in_progress)
|
||||
if (compositor->switch_workspace_in_progress)
|
||||
return;
|
||||
|
||||
event = 0;
|
||||
switch (effect)
|
||||
{
|
||||
case META_COMP_EFFECT_DESTROY:
|
||||
@ -1285,7 +1265,8 @@ meta_window_actor_maximize (MetaWindowActor *self,
|
||||
MetaRectangle *old_rect,
|
||||
MetaRectangle *new_rect)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (self->priv->screen);
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
|
||||
/* The window has already been resized (in order to compute new_rect),
|
||||
* which by side effect caused the actor to be resized. Restore it to the
|
||||
@ -1296,7 +1277,7 @@ meta_window_actor_maximize (MetaWindowActor *self,
|
||||
self->priv->maximize_in_progress++;
|
||||
meta_window_actor_freeze (self);
|
||||
|
||||
if (!meta_plugin_manager_event_maximize (info->plugin_mgr,
|
||||
if (!meta_plugin_manager_event_maximize (compositor->plugin_mgr,
|
||||
self,
|
||||
META_PLUGIN_MAXIMIZE,
|
||||
new_rect->x, new_rect->y,
|
||||
@ -1313,7 +1294,8 @@ meta_window_actor_unmaximize (MetaWindowActor *self,
|
||||
MetaRectangle *old_rect,
|
||||
MetaRectangle *new_rect)
|
||||
{
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (self->priv->screen);
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
|
||||
/* The window has already been resized (in order to compute new_rect),
|
||||
* which by side effect caused the actor to be resized. Restore it to the
|
||||
@ -1324,7 +1306,7 @@ meta_window_actor_unmaximize (MetaWindowActor *self,
|
||||
self->priv->unmaximize_in_progress++;
|
||||
meta_window_actor_freeze (self);
|
||||
|
||||
if (!meta_plugin_manager_event_maximize (info->plugin_mgr,
|
||||
if (!meta_plugin_manager_event_maximize (compositor->plugin_mgr,
|
||||
self,
|
||||
META_PLUGIN_UNMAXIMIZE,
|
||||
new_rect->x, new_rect->y,
|
||||
@ -1338,8 +1320,8 @@ meta_window_actor_unmaximize (MetaWindowActor *self,
|
||||
MetaWindowActor *
|
||||
meta_window_actor_new (MetaWindow *window)
|
||||
{
|
||||
MetaScreen *screen = meta_window_get_screen (window);
|
||||
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaCompositor *compositor = display->compositor;
|
||||
MetaWindowActor *self;
|
||||
MetaWindowActorPrivate *priv;
|
||||
ClutterActor *window_group;
|
||||
@ -1364,9 +1346,9 @@ meta_window_actor_new (MetaWindow *window)
|
||||
meta_window_set_compositor_private (window, G_OBJECT (self));
|
||||
|
||||
if (window->layer == META_LAYER_OVERRIDE_REDIRECT)
|
||||
window_group = info->top_window_group;
|
||||
window_group = compositor->top_window_group;
|
||||
else
|
||||
window_group = info->window_group;
|
||||
window_group = compositor->window_group;
|
||||
|
||||
clutter_actor_add_child (window_group, CLUTTER_ACTOR (self));
|
||||
|
||||
@ -1375,7 +1357,7 @@ meta_window_actor_new (MetaWindow *window)
|
||||
/* Initial position in the stack is arbitrary; stacking will be synced
|
||||
* before we first paint.
|
||||
*/
|
||||
info->windows = g_list_append (info->windows, self);
|
||||
compositor->windows = g_list_append (compositor->windows, self);
|
||||
|
||||
return self;
|
||||
}
|
||||
@ -1912,8 +1894,7 @@ static void
|
||||
do_send_frame_drawn (MetaWindowActor *self, FrameData *frame)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaScreen *screen = priv->screen;
|
||||
MetaDisplay *display = meta_screen_get_display (screen);
|
||||
MetaDisplay *display = meta_window_get_display (priv->window);
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
|
||||
XClientMessageEvent ev = { 0, };
|
||||
@ -1965,7 +1946,7 @@ do_send_frame_timings (MetaWindowActor *self,
|
||||
gint64 presentation_time)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaDisplay *display = meta_screen_get_display (priv->screen);
|
||||
MetaDisplay *display = meta_window_get_display (priv->window);
|
||||
Display *xdisplay = meta_display_get_xdisplay (display);
|
||||
|
||||
XClientMessageEvent ev = { 0, };
|
||||
|
@ -378,7 +378,7 @@ enable_compositor (MetaDisplay *display)
|
||||
if (!display->compositor)
|
||||
return;
|
||||
|
||||
meta_compositor_manage_screen (display->compositor, display->screen);
|
||||
meta_compositor_manage (display->compositor);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1660,7 +1660,7 @@ process_event (MetaDisplay *display,
|
||||
/* If the compositor filtered out the keybindings, that
|
||||
* means they don't want the binding to trigger, so we do
|
||||
* the same thing as if the binding didn't exist. */
|
||||
if (meta_compositor_filter_keybinding (display->compositor, screen, binding))
|
||||
if (meta_compositor_filter_keybinding (display->compositor, binding))
|
||||
goto not_found;
|
||||
|
||||
if (binding->handler == NULL)
|
||||
@ -1745,7 +1745,7 @@ process_overlay_key (MetaDisplay *display,
|
||||
display->overlay_key_combo.keycode,
|
||||
display->grab_mask);
|
||||
if (binding &&
|
||||
meta_compositor_filter_keybinding (display->compositor, screen, binding))
|
||||
meta_compositor_filter_keybinding (display->compositor, binding))
|
||||
return TRUE;
|
||||
meta_display_overlay_key_activate (display);
|
||||
}
|
||||
|
@ -116,9 +116,6 @@ struct _MetaScreen
|
||||
guint all_keys_grabbed : 1;
|
||||
|
||||
int closing;
|
||||
|
||||
/* Managed by compositor.c */
|
||||
gpointer compositor_data;
|
||||
|
||||
/* Instead of unmapping withdrawn windows we can leave them mapped
|
||||
* and restack them below a guard window. When using a compositor
|
||||
|
@ -707,7 +707,6 @@ meta_screen_new (MetaDisplay *display,
|
||||
screen->columns_of_workspaces = -1;
|
||||
screen->vertical_workspaces = FALSE;
|
||||
screen->starting_corner = META_SCREEN_TOPLEFT;
|
||||
screen->compositor_data = NULL;
|
||||
screen->guard_window = None;
|
||||
|
||||
reload_monitor_infos (screen);
|
||||
@ -808,8 +807,7 @@ meta_screen_free (MetaScreen *screen,
|
||||
|
||||
meta_display_grab (display);
|
||||
|
||||
meta_compositor_unmanage_screen (screen->display->compositor,
|
||||
screen);
|
||||
meta_compositor_unmanage (screen->display->compositor);
|
||||
|
||||
meta_display_unmanage_windows_for_screen (display, screen, timestamp);
|
||||
|
||||
@ -1439,11 +1437,10 @@ meta_screen_update_tile_preview_timeout (gpointer data)
|
||||
monitor = meta_window_get_current_tile_monitor_number (window);
|
||||
meta_window_get_current_tile_area (window, &tile_rect);
|
||||
meta_compositor_show_tile_preview (screen->display->compositor,
|
||||
screen, window, &tile_rect, monitor);
|
||||
window, &tile_rect, monitor);
|
||||
}
|
||||
else
|
||||
meta_compositor_hide_tile_preview (screen->display->compositor,
|
||||
screen);
|
||||
meta_compositor_hide_tile_preview (screen->display->compositor);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -1479,8 +1476,7 @@ meta_screen_hide_tile_preview (MetaScreen *screen)
|
||||
if (screen->tile_preview_timeout_id > 0)
|
||||
g_source_remove (screen->tile_preview_timeout_id);
|
||||
|
||||
meta_compositor_hide_tile_preview (screen->display->compositor,
|
||||
screen);
|
||||
meta_compositor_hide_tile_preview (screen->display->compositor);
|
||||
}
|
||||
|
||||
MetaWindow*
|
||||
@ -2498,7 +2494,6 @@ on_monitors_changed (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
meta_compositor_sync_screen_size (screen->display->compositor,
|
||||
screen,
|
||||
screen->rect.width, screen->rect.height);
|
||||
|
||||
/* Queue a resize on all the windows */
|
||||
@ -3039,24 +3034,6 @@ meta_screen_get_size (MetaScreen *screen,
|
||||
*height = screen->rect.height;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_screen_get_compositor_data: (skip)
|
||||
* @screen: A #MetaScreen
|
||||
*
|
||||
*/
|
||||
gpointer
|
||||
meta_screen_get_compositor_data (MetaScreen *screen)
|
||||
{
|
||||
return screen->compositor_data;
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_set_compositor_data (MetaScreen *screen,
|
||||
gpointer compositor)
|
||||
{
|
||||
screen->compositor_data = compositor;
|
||||
}
|
||||
|
||||
void
|
||||
meta_screen_set_cm_selection (MetaScreen *screen)
|
||||
{
|
||||
|
@ -1246,7 +1246,6 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
|
||||
}
|
||||
|
||||
meta_compositor_sync_stack (tracker->screen->display->compositor,
|
||||
tracker->screen,
|
||||
meta_windows);
|
||||
g_list_free (meta_windows);
|
||||
|
||||
|
@ -665,7 +665,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
|
||||
meta_screen_free_workspace_layout (&layout1);
|
||||
meta_screen_free_workspace_layout (&layout2);
|
||||
|
||||
meta_compositor_switch_workspace (comp, screen, old, workspace, direction);
|
||||
meta_compositor_switch_workspace (comp, old, workspace, direction);
|
||||
|
||||
/* This needs to be done after telling the compositor we are switching
|
||||
* workspaces since focusing a window will cause it to be immediately
|
||||
|
@ -57,10 +57,8 @@ typedef enum
|
||||
MetaCompositor *meta_compositor_new (MetaDisplay *display);
|
||||
void meta_compositor_destroy (MetaCompositor *compositor);
|
||||
|
||||
void meta_compositor_manage_screen (MetaCompositor *compositor,
|
||||
MetaScreen *screen);
|
||||
void meta_compositor_unmanage_screen (MetaCompositor *compositor,
|
||||
MetaScreen *screen);
|
||||
void meta_compositor_manage (MetaCompositor *compositor);
|
||||
void meta_compositor_unmanage (MetaCompositor *compositor);
|
||||
|
||||
void meta_compositor_window_shape_changed (MetaCompositor *compositor,
|
||||
MetaWindow *window);
|
||||
@ -74,7 +72,6 @@ gboolean meta_compositor_process_event (MetaCompositor *compositor,
|
||||
MetaWindow *window);
|
||||
|
||||
gboolean meta_compositor_filter_keybinding (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
MetaKeyBinding *binding);
|
||||
|
||||
void meta_compositor_add_window (MetaCompositor *compositor,
|
||||
@ -88,7 +85,6 @@ void meta_compositor_hide_window (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaCompEffect effect);
|
||||
void meta_compositor_switch_workspace (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
MetaWorkspace *from,
|
||||
MetaWorkspace *to,
|
||||
MetaMotionDirection direction);
|
||||
@ -113,10 +109,8 @@ void meta_compositor_queue_frame_drawn (MetaCompositor *compositor,
|
||||
gboolean no_delay_frame);
|
||||
|
||||
void meta_compositor_sync_stack (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
GList *stack);
|
||||
void meta_compositor_sync_screen_size (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
@ -124,11 +118,9 @@ void meta_compositor_flash_screen (MetaCompositor *compositor,
|
||||
MetaScreen *screen);
|
||||
|
||||
void meta_compositor_show_tile_preview (MetaCompositor *compositor,
|
||||
MetaScreen *screen,
|
||||
MetaWindow *window,
|
||||
MetaRectangle *tile_rect,
|
||||
int tile_monitor_number);
|
||||
void meta_compositor_hide_tile_preview (MetaCompositor *compositor,
|
||||
MetaScreen *screen);
|
||||
void meta_compositor_hide_tile_preview (MetaCompositor *compositor);
|
||||
|
||||
#endif /* META_COMPOSITOR_H */
|
||||
|
@ -405,7 +405,7 @@ meta_plugin_end_modal (MetaPlugin *plugin,
|
||||
|
||||
MetaScreen *meta_plugin_get_screen (MetaPlugin *plugin);
|
||||
|
||||
void _meta_plugin_set_screen (MetaPlugin *plugin, MetaScreen *screen);
|
||||
void _meta_plugin_set_compositor (MetaPlugin *plugin, MetaCompositor *compositor);
|
||||
|
||||
/* XXX: Putting this in here so it's in the public header. */
|
||||
void meta_plugin_manager_set_plugin_type (GType gtype);
|
||||
|
@ -44,10 +44,6 @@ void meta_screen_get_size (MetaScreen *screen,
|
||||
int *width,
|
||||
int *height);
|
||||
|
||||
gpointer meta_screen_get_compositor_data (MetaScreen *screen);
|
||||
void meta_screen_set_compositor_data (MetaScreen *screen,
|
||||
gpointer info);
|
||||
|
||||
void meta_screen_set_cm_selection (MetaScreen *screen);
|
||||
void meta_screen_unset_cm_selection (MetaScreen *screen);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user