diff --git a/ChangeLog b/ChangeLog index 961a140e9..665fd0889 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Mar 30 16:13:52 2006 Søren Sandmann + + * composite.c: Turn wobbling back on Add new explosion effect. + 2006-03-29 Elijah Newren Fix grouping in the presence of ancestors; caught by Björn. diff --git a/src/c-screen.c b/src/c-screen.c index d827fc9db..0b104ece8 100644 --- a/src/c-screen.c +++ b/src/c-screen.c @@ -109,6 +109,9 @@ repaint (gpointer data) { MetaScreenInfo *info = data; CmState *state; +#if 0 + g_print ("repaint\n"); +#endif glViewport (0, 0, info->meta_screen->rect.width, info->meta_screen->rect.height); @@ -116,7 +119,7 @@ repaint (gpointer data) glLoadIdentity(); #if 0 - glClearColor (1.0, 1.0, 0.8, 1.0); + glClearColor (0, 0, 0, 1.0); glClear (GL_COLOR_BUFFER_BIT); #endif @@ -257,9 +260,12 @@ claim_selection (MetaScreenInfo *info) } static void -queue_paint (CmStacker *stacker, +queue_paint (CmNode *node, MetaScreenInfo *info) { +#if 0 + g_print ("queueing %s\n", G_OBJECT_TYPE_NAME (node)); +#endif 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); WsRectangle source; WsRectangle target; - WsRegion *region; + WsServerRegion *region; #if 0 g_print ("redirecting %lx\n", WS_RESOURCE_XID (root)); @@ -339,6 +345,9 @@ meta_screen_info_unredirect (MetaScreenInfo *info) void meta_screen_info_queue_paint (MetaScreenInfo *info) { +#if 0 + g_print ("queuing\n"); +#endif if (!info->idle_id) 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); } +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 + + 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 + diff --git a/src/c-screen.h b/src/c-screen.h index e0b96b7c3..5907ec8a0 100644 --- a/src/c-screen.h +++ b/src/c-screen.h @@ -42,3 +42,8 @@ void meta_screen_info_set_target_rect (MetaScreenInfo *info, Window xwindow, WsRectangle *rect); +void meta_screen_info_set_explode (MetaScreenInfo *info, + Window xwindow, + gdouble level); +void meta_screen_info_hide_window (MetaScreenInfo *info, + Window xwindow); diff --git a/src/compositor.c b/src/compositor.c index 72fe9f473..bb5f3be64 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1085,6 +1085,73 @@ run_animation_01 (gpointer data) 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 meta_compositor_minimize (MetaCompositor *compositor, MetaWindow *window, @@ -1127,6 +1194,7 @@ meta_compositor_minimize (MetaCompositor *compositor, g_idle_add (run_animation_01, info); } +#endif #endif @@ -1208,8 +1276,10 @@ wobble (gpointer data) MetaScreenInfo *minfo = info->screen->compositor_data; double t = g_timer_elapsed (info->timer, NULL); +#if 0 g_print ("info->window_destroyed: %d\n", info->window_destroyed); +#endif if ((info->finished && model_is_calm (info->model)) || info->window_destroyed) { @@ -1266,7 +1336,6 @@ meta_compositor_begin_move (MetaCompositor *compositor, MetaRectangle *initial, int grab_x, int grab_y) { -#if 0 #ifdef HAVE_COMPOSITE_EXTENSIONS MetaRectangle rect; @@ -1293,7 +1362,6 @@ meta_compositor_begin_move (MetaCompositor *compositor, g_idle_add (wobble, compositor->move_info); #endif -#endif } void @@ -1301,22 +1369,18 @@ meta_compositor_update_move (MetaCompositor *compositor, MetaWindow *window, int x, int y) { -#if 0 #ifdef HAVE_COMPOSITE_EXTENSIONS model_update_move (compositor->move_info->model, x, y); #endif -#endif } void meta_compositor_end_move (MetaCompositor *compositor, MetaWindow *window) { -#if 0 #ifdef HAVE_COMPOSITE_EXTENSIONS compositor->move_info->finished = TRUE; #endif -#endif } @@ -1324,7 +1388,6 @@ void meta_compositor_free_window (MetaCompositor *compositor, MetaWindow *window) { -#if 0 #ifdef HAVE_COMPOSITE_EXTENSIONS g_print ("freeing\n"); if (compositor->move_info) @@ -1334,5 +1397,4 @@ meta_compositor_free_window (MetaCompositor *compositor, compositor->move_info = NULL; } #endif -#endif }