Turn wobbling back on Add new explosion effect.

Thu Mar 30 16:13:52 2006  Søren Sandmann  <sandmann@redhat.com>

	* composite.c: Turn wobbling back on  Add new explosion effect.
This commit is contained in:
Søren Sandmann 2006-03-30 21:14:56 +00:00 committed by Søren Sandmann Pedersen
parent 127a89886b
commit 3bf211c89f
4 changed files with 118 additions and 11 deletions

View File

@ -1,3 +1,7 @@
Thu Mar 30 16:13:52 2006 Søren Sandmann <sandmann@redhat.com>
* composite.c: Turn wobbling back on Add new explosion effect.
2006-03-29 Elijah Newren <newren gmail com> 2006-03-29 Elijah Newren <newren gmail com>
Fix grouping in the presence of ancestors; caught by Björn. Fix grouping in the presence of ancestors; caught by Björn.

View File

@ -109,6 +109,9 @@ repaint (gpointer data)
{ {
MetaScreenInfo *info = data; MetaScreenInfo *info = data;
CmState *state; CmState *state;
#if 0
g_print ("repaint\n");
#endif
glViewport (0, 0, glViewport (0, 0,
info->meta_screen->rect.width, info->meta_screen->rect.width,
info->meta_screen->rect.height); info->meta_screen->rect.height);
@ -116,7 +119,7 @@ repaint (gpointer data)
glLoadIdentity(); glLoadIdentity();
#if 0 #if 0
glClearColor (1.0, 1.0, 0.8, 1.0); glClearColor (0, 0, 0, 1.0);
glClear (GL_COLOR_BUFFER_BIT); glClear (GL_COLOR_BUFFER_BIT);
#endif #endif
@ -257,9 +260,12 @@ claim_selection (MetaScreenInfo *info)
} }
static void static void
queue_paint (CmStacker *stacker, queue_paint (CmNode *node,
MetaScreenInfo *info) MetaScreenInfo *info)
{ {
#if 0
g_print ("queueing %s\n", G_OBJECT_TYPE_NAME (node));
#endif
meta_screen_info_queue_paint (info); meta_screen_info_queue_paint (info);
} }
@ -269,7 +275,7 @@ meta_screen_info_redirect (MetaScreenInfo *info)
WsWindow *root = ws_screen_get_root_window (info->screen); WsWindow *root = ws_screen_get_root_window (info->screen);
WsRectangle source; WsRectangle source;
WsRectangle target; WsRectangle target;
WsRegion *region; WsServerRegion *region;
#if 0 #if 0
g_print ("redirecting %lx\n", WS_RESOURCE_XID (root)); g_print ("redirecting %lx\n", WS_RESOURCE_XID (root));
@ -339,6 +345,9 @@ meta_screen_info_unredirect (MetaScreenInfo *info)
void void
meta_screen_info_queue_paint (MetaScreenInfo *info) meta_screen_info_queue_paint (MetaScreenInfo *info)
{ {
#if 0
g_print ("queuing\n");
#endif
if (!info->idle_id) if (!info->idle_id)
info->idle_id = g_idle_add (repaint, info); info->idle_id = g_idle_add (repaint, info);
} }
@ -675,4 +684,31 @@ meta_screen_info_set_target_rect (MetaScreenInfo *info,
cm_drawable_node_set_scale_rect (node, rect); cm_drawable_node_set_scale_rect (node, rect);
} }
void
meta_screen_info_set_explode (MetaScreenInfo *info,
Window xwindow,
gdouble level)
{
CmDrawableNode *node = CM_DRAWABLE_NODE (find_node (info, xwindow));
if (node)
{
#if 0
g_print ("level: %f\n", level);
#endif #endif
cm_drawable_node_set_explosion_level (node, level);
}
}
void
meta_screen_info_hide_window (MetaScreenInfo *info,
Window xwindow)
{
CmDrawableNode *node = CM_DRAWABLE_NODE (find_node (info, xwindow));
cm_drawable_node_set_viewable (node, FALSE);
}
#endif

View File

@ -42,3 +42,8 @@ void meta_screen_info_set_target_rect (MetaScreenInfo *info,
Window xwindow, Window xwindow,
WsRectangle *rect); WsRectangle *rect);
void meta_screen_info_set_explode (MetaScreenInfo *info,
Window xwindow,
gdouble level);
void meta_screen_info_hide_window (MetaScreenInfo *info,
Window xwindow);

View File

@ -1085,6 +1085,73 @@ run_animation_01 (gpointer data)
return TRUE; return TRUE;
} }
#define EXPLODE_TIME 1.0
#define BASE 0.5
static double
transform (double in)
{
return (pow (BASE, in) - 1) / (BASE - 1);
}
typedef struct
{
MetaWindow * window;
gdouble level;
GTimer * timer;
MetaAnimationFinishedFunc func;
gpointer data;
MetaScreenInfo * minfo;
} ExplodeInfo;
static gboolean
update_explosion (gpointer data)
{
ExplodeInfo *info = data;
gdouble elapsed = g_timer_elapsed (info->timer, NULL);
gdouble t = elapsed / EXPLODE_TIME;
meta_screen_info_set_explode (info->minfo, get_xid (info->window), transform (t));
if (elapsed > EXPLODE_TIME)
{
if (info->func)
info->func (info->data);
meta_screen_info_hide_window (info->minfo, get_xid (info->window));
meta_screen_info_set_explode (info->minfo, get_xid (info->window), 0.0);
return FALSE;
}
else
{
return TRUE;
}
}
void
meta_compositor_minimize (MetaCompositor *compositor,
MetaWindow *window,
int x,
int y,
int width,
int height,
MetaAnimationFinishedFunc finished,
gpointer data)
{
ExplodeInfo *info = g_new0 (ExplodeInfo, 1);
info->window = window;
info->level = 0.0;
info->timer = g_timer_new ();
info->func = finished;
info->data = data;
info->minfo = meta_screen_info_get_by_xwindow (get_xid (window));
g_idle_add (update_explosion, info);
}
#if 0
void void
meta_compositor_minimize (MetaCompositor *compositor, meta_compositor_minimize (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
@ -1127,6 +1194,7 @@ meta_compositor_minimize (MetaCompositor *compositor,
g_idle_add (run_animation_01, info); g_idle_add (run_animation_01, info);
} }
#endif
#endif #endif
@ -1208,8 +1276,10 @@ wobble (gpointer data)
MetaScreenInfo *minfo = info->screen->compositor_data; MetaScreenInfo *minfo = info->screen->compositor_data;
double t = g_timer_elapsed (info->timer, NULL); double t = g_timer_elapsed (info->timer, NULL);
#if 0
g_print ("info->window_destroyed: %d\n", g_print ("info->window_destroyed: %d\n",
info->window_destroyed); info->window_destroyed);
#endif
if ((info->finished && model_is_calm (info->model)) || if ((info->finished && model_is_calm (info->model)) ||
info->window_destroyed) info->window_destroyed)
{ {
@ -1266,7 +1336,6 @@ meta_compositor_begin_move (MetaCompositor *compositor,
MetaRectangle *initial, MetaRectangle *initial,
int grab_x, int grab_y) int grab_x, int grab_y)
{ {
#if 0
#ifdef HAVE_COMPOSITE_EXTENSIONS #ifdef HAVE_COMPOSITE_EXTENSIONS
MetaRectangle rect; MetaRectangle rect;
@ -1293,7 +1362,6 @@ meta_compositor_begin_move (MetaCompositor *compositor,
g_idle_add (wobble, compositor->move_info); g_idle_add (wobble, compositor->move_info);
#endif #endif
#endif
} }
void void
@ -1301,22 +1369,18 @@ meta_compositor_update_move (MetaCompositor *compositor,
MetaWindow *window, MetaWindow *window,
int x, int y) int x, int y)
{ {
#if 0
#ifdef HAVE_COMPOSITE_EXTENSIONS #ifdef HAVE_COMPOSITE_EXTENSIONS
model_update_move (compositor->move_info->model, x, y); model_update_move (compositor->move_info->model, x, y);
#endif #endif
#endif
} }
void void
meta_compositor_end_move (MetaCompositor *compositor, meta_compositor_end_move (MetaCompositor *compositor,
MetaWindow *window) MetaWindow *window)
{ {
#if 0
#ifdef HAVE_COMPOSITE_EXTENSIONS #ifdef HAVE_COMPOSITE_EXTENSIONS
compositor->move_info->finished = TRUE; compositor->move_info->finished = TRUE;
#endif #endif
#endif
} }
@ -1324,7 +1388,6 @@ void
meta_compositor_free_window (MetaCompositor *compositor, meta_compositor_free_window (MetaCompositor *compositor,
MetaWindow *window) MetaWindow *window)
{ {
#if 0
#ifdef HAVE_COMPOSITE_EXTENSIONS #ifdef HAVE_COMPOSITE_EXTENSIONS
g_print ("freeing\n"); g_print ("freeing\n");
if (compositor->move_info) if (compositor->move_info)
@ -1334,5 +1397,4 @@ meta_compositor_free_window (MetaCompositor *compositor,
compositor->move_info = NULL; compositor->move_info = NULL;
} }
#endif #endif
#endif
} }