Commit 3bbd5e32 authored by Matthew Allum's avatar Matthew Allum

Fix configure events generating too many updates

Split stage into window and overlay groups
Add an event hook to plugins
parent 2d4a0c9c
This diff is collapsed.
......@@ -32,11 +32,11 @@
#include <gmodule.h>
#include <string.h>
#define DESTROY_TIMEOUT 600
#define MINIMIZE_TIMEOUT 600
#define MAXIMIZE_TIMEOUT 600
#define MAP_TIMEOUT 600
#define SWITCH_TIMEOUT 1000
#define DESTROY_TIMEOUT 250
#define MINIMIZE_TIMEOUT 250
#define MAXIMIZE_TIMEOUT 250
#define MAP_TIMEOUT 250
#define SWITCH_TIMEOUT 500
#define ACTOR_DATA_KEY "MCCP-Simple-actor-data"
......
......@@ -642,3 +642,33 @@ meta_compositor_clutter_plugin_manager_switch_workspace (MetaCompositorClutterPl
return retval;
}
/*
* The public method that the compositor hooks into for desktop switching.
*
* Returns TRUE if at least one of the plugins handled the event type (i.e.,
* if the return value is FALSE, there will be no subsequent call to the
* manager completed() callback, and the compositor must ensure that any
* appropriate post-effect cleanup is carried out.
*/
gboolean
meta_compositor_clutter_plugin_manager_xevent_filter
(MetaCompositorClutterPluginManager *mgr, XEvent *xev)
{
GList *l = mgr->plugins;
while (l)
{
MetaCompositorClutterPlugin *plg = l->data;
if (plg->xevent_filter)
{
if (plg->xevent_filter (xev) == TRUE)
return TRUE;
}
l = l->next;
}
return FALSE;
}
......@@ -55,4 +55,6 @@ gboolean meta_compositor_clutter_plugin_manager_switch_workspace (MetaCompositor
gint from,
gint to);
gboolean meta_compositor_clutter_plugin_manager_xevent_filter (MetaCompositorClutterPluginManager *mgr,
XEvent *xev);
#endif
......@@ -130,7 +130,7 @@ typedef struct _MetaCompScreen
{
MetaScreen *screen;
ClutterActor *stage;
ClutterActor *stage, *window_group, *overlay_group;
GList *windows;
GHashTable *windows_by_xid;
MetaWindow *focus_window;
......@@ -980,10 +980,13 @@ resize_win (MetaCompWindow *cw,
{
MetaCompWindowPrivate *priv = cw->priv;
if (priv->attrs.width != width || priv->attrs.height != height)
meta_comp_window_detach (cw);
priv->attrs.width = width;
priv->attrs.height = height;
priv->attrs.x = x;
priv->attrs.y = y;
priv->attrs.width = width;
priv->attrs.height = height;
priv->attrs.border_width = border_width;
priv->attrs.override_redirect = override_redirect;
......@@ -992,7 +995,6 @@ resize_win (MetaCompWindow *cw,
priv->map_in_progress)
return;
meta_comp_window_detach (cw);
clutter_actor_set_position (CLUTTER_ACTOR (cw), x, y);
}
......@@ -1139,7 +1141,7 @@ add_win (MetaScreen *screen, MetaWindow *window, Window xwindow)
clutter_actor_set_position (CLUTTER_ACTOR (cw),
priv->attrs.x, priv->attrs.y);
clutter_container_add_actor (CLUTTER_CONTAINER (info->stage),
clutter_container_add_actor (CLUTTER_CONTAINER (info->window_group),
CLUTTER_ACTOR (cw));
clutter_actor_hide (CLUTTER_ACTOR (cw));
......@@ -1712,10 +1714,29 @@ clutter_cmp_manage_screen (MetaCompositor *compositor,
XReparentWindow (xdisplay, xwin, info->output, 0, 0);
info->window_group = clutter_group_new ();
info->overlay_group = clutter_group_new ();
{
ClutterActor *foo;
foo = clutter_label_new_with_text ("Sans Bold 148", "OVERLAY");
clutter_actor_set_opacity (foo, 100);
clutter_container_add_actor (CLUTTER_CONTAINER (info->overlay_group),
foo);
}
clutter_container_add (CLUTTER_CONTAINER (info->stage),
info->window_group,
info->overlay_group,
NULL);
info->plugin_mgr =
meta_compositor_clutter_plugin_manager_new (screen, info->stage);
clutter_actor_show_all (info->stage);
clutter_actor_show_all (info->overlay_group);
/* Now we're up and running we can show the output if needed */
show_overlay_window (screen, info->output);
......@@ -1773,12 +1794,28 @@ clutter_cmp_process_event (MetaCompositor *compositor,
{
#ifdef HAVE_COMPOSITE_EXTENSIONS
MetaCompositorClutter *xrc = (MetaCompositorClutter *) compositor;
if (window)
{
MetaCompScreen *info;
MetaScreen *screen;
screen = meta_window_get_screen (window);
info = meta_screen_get_compositor_data (screen);
if (meta_compositor_clutter_plugin_manager_xevent_filter
(info->plugin_mgr,
event) == TRUE)
return;
}
/*
* This trap is so that none of the compositor functions cause
* X errors. This is really a hack, but I'm afraid I don't understand
* enough about Metacity/X to know how else you are supposed to do it
*/
meta_error_trap_push (xrc->display);
switch (event->type)
{
......
......@@ -189,6 +189,12 @@ struct MetaCompositorClutterPlugin
*/
gboolean (*reload) (void);
/* General XEvent filter. This is fired *before* metacity itself handles
* an event. Return TRUE to block any further processing.
*/
gboolean (*xevent_filter) (XEvent *event);
#ifdef META_COMPOSITOR_CLUTTER_BUILDING_PLUGIN
const
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment