Shrink the window instead of explode it.

Wed May 24 21:17:59 2006  Søren Sandmann  <sandmann@redhat.com>

        * src/compositor.c (do_effect): Shrink the window instead of
        explode it.

        * src/compositor.c (do_effect): don't read the frame if it is
        NULL.

        * src/c-window.c (meta_comp_window_run_minimize): Resurrect the
        shrinking minimize animation.

        * src/c-window.c (meta_comp_window_fade_in): Make dialogs 90%
        translucent.

        * src/c-window.c (update_fade): End at end_fade, not 1.0.
This commit is contained in:
Søren Sandmann 2006-05-25 01:19:03 +00:00 committed by Søren Sandmann Pedersen
parent 0ca0bca0d0
commit ab1adf6c06
4 changed files with 82 additions and 57 deletions

View File

@ -1,3 +1,19 @@
Wed May 24 21:17:59 2006 Søren Sandmann <sandmann@redhat.com>
* src/compositor.c (do_effect): Shrink the window instead of
explode it.
* src/compositor.c (do_effect): don't read the frame if it is
NULL.
* src/c-window.c (meta_comp_window_run_minimize): Resurrect the
shrinking minimize animation.
* src/c-window.c (meta_comp_window_fade_in): Make dialogs 90%
translucent.
* src/c-window.c (update_fade): End at end_fade, not 1.0.
Wed May 24 19:15:45 2006 Søren Sandmann <sandmann@redhat.com> Wed May 24 19:15:45 2006 Søren Sandmann <sandmann@redhat.com>
* src/c-window.c (cancel_fade): Add a fade-in animation when * src/c-window.c (cancel_fade): Add a fade-in animation when

View File

@ -465,7 +465,7 @@ update_fade (gpointer data)
if (elapsed >= FADE_TIME) if (elapsed >= FADE_TIME)
{ {
comp_window_set_target_rect (info->window, &info->to); comp_window_set_target_rect (info->window, &info->to);
cm_drawable_node_set_alpha (info->window->node, 1.0); cm_drawable_node_set_alpha (info->window->node, info->end_alpha);
cm_drawable_node_unset_patch (info->window->node); cm_drawable_node_unset_patch (info->window->node);
comp_window_unref (info->window); comp_window_unref (info->window);
return FALSE; return FALSE;
@ -525,7 +525,7 @@ meta_comp_window_fade_in (MetaCompWindow *comp_window)
} }
else if (has_type (window, "_NET_WM_WINDOW_TYPE_DIALOG")) else if (has_type (window, "_NET_WM_WINDOW_TYPE_DIALOG"))
{ {
info->end_alpha = 0.7; info->end_alpha = 0.9;
} }
else else
{ {
@ -755,12 +755,16 @@ meta_comp_window_explode (MetaCompWindow *comp_window,
if (!cm_drawable_node_get_viewable (comp_window->node)) if (!cm_drawable_node_get_viewable (comp_window->node))
{ {
#if 0
g_print ("%p wasn't even viewable to begin with\n", comp_window->node); g_print ("%p wasn't even viewable to begin with\n", comp_window->node);
#endif
return; return;
} }
else else
{ {
#if 0
g_print ("%p is viewable\n", comp_window->node); g_print ("%p is viewable\n", comp_window->node);
#endif
} }
comp_window->animation_in_progress = TRUE; comp_window->animation_in_progress = TRUE;
@ -809,39 +813,28 @@ update_shrink (gpointer data)
} }
} }
void
meta_comp_window_shrink (MetaCompWindow *comp_window,
MetaEffect *effect)
{
ShrinkInfo *info = g_new0 (ShrinkInfo, 1);
info->window = comp_window;
info->effect = effect;
info->timer = g_timer_new ();
g_idle_add (update_shrink, info);
}
#endif
#if 0
/* old shrinkydink minimize effect */ /* old shrinkydink minimize effect */
#ifdef HAVE_COMPOSITE_EXTENSIONS
#endif
typedef struct typedef struct
{ {
#if 0
MetaWindow *window; MetaWindow *window;
#endif
GTimer *timer; GTimer *timer;
#if 0
MetaCompositor *compositor; MetaCompositor *compositor;
#endif
#if 0
MetaCompScreen *scr_info; MetaCompScreen *scr_info;
#endif
MetaCompWindow *comp_window;
#if 0
MetaAnimationFinishedFunc finished_func; MetaAnimationFinishedFunc finished_func;
gpointer finished_data; gpointer finished_data;
#endif
MetaEffect *effect;
gdouble aspect_ratio; gdouble aspect_ratio;
@ -870,13 +863,14 @@ set_geometry (MiniInfo *info, gdouble elapsed)
interpolate_rectangle (elapsed, &info->current_geometry, &info->target_geometry, &rect); interpolate_rectangle (elapsed, &info->current_geometry, &info->target_geometry, &rect);
#if 0
g_print ("y: %d %d (%f => %d)\n", info->current_geometry.y, info->target_geometry.y, g_print ("y: %d %d (%f => %d)\n", info->current_geometry.y, info->target_geometry.y,
elapsed, rect.y); elapsed, rect.y);
g_print ("setting: %d %d %d %d\n", rect.x, rect.y, rect.width, rect.height); g_print ("setting: %d %d %d %d\n", rect.x, rect.y, rect.width, rect.height);
#endif
meta_comp_screen_set_target_rect (info->scr_info, comp_window_set_target_rect (info->comp_window, &rect);
get_xid (info->window), &rect);
} }
static int static int
@ -895,7 +889,7 @@ run_phase_1 (MiniInfo *info, gdouble elapsed)
#endif #endif
info->phase_1_started = TRUE; info->phase_1_started = TRUE;
meta_comp_screen_get_real_size (info->scr_info, get_xid (info->window), comp_window_get_real_size (info->comp_window,
&info->current_geometry); &info->current_geometry);
#if 0 #if 0
@ -923,7 +917,9 @@ run_phase_2 (MiniInfo *info, gdouble elapsed)
{ {
WsRectangle cur = info->target_geometry; WsRectangle cur = info->target_geometry;
#if 0
g_print ("starting phase 2\n"); g_print ("starting phase 2\n");
#endif
info->phase_2_started = TRUE; info->phase_2_started = TRUE;
@ -946,10 +942,11 @@ run_phase_3 (MiniInfo *info, gdouble elapsed)
WsRectangle cur = info->target_geometry; WsRectangle cur = info->target_geometry;
WsRectangle real; WsRectangle real;
meta_comp_screen_get_real_size (info->scr_info, get_xid (info->window), comp_window_get_real_size (info->comp_window, &real);
&real);
#if 0
g_print ("starting phase 3\n"); g_print ("starting phase 3\n");
#endif
info->phase_3_started = TRUE; info->phase_3_started = TRUE;
info->current_geometry = cur; info->current_geometry = cur;
@ -970,7 +967,9 @@ run_phase_4 (MiniInfo *info, gdouble elapsed)
{ {
WsRectangle cur = info->target_geometry; WsRectangle cur = info->target_geometry;
#if 0
g_print ("starting phase 4\n"); g_print ("starting phase 4\n");
#endif
info->phase_4_started = TRUE; info->phase_4_started = TRUE;
info->current_geometry = cur; info->current_geometry = cur;
@ -978,7 +977,10 @@ run_phase_4 (MiniInfo *info, gdouble elapsed)
info->target_geometry.height = info->button_height; info->target_geometry.height = info->button_height;
info->target_geometry.width = info->button_height * info->aspect_ratio; info->target_geometry.width = info->button_height * info->aspect_ratio;
info->target_geometry.x = cur.x; info->target_geometry.x = cur.x;
#if 0
g_print ("button y: %d\n", info->button_y); g_print ("button y: %d\n", info->button_y);
#endif
info->target_geometry.y = info->button_y; info->target_geometry.y = info->button_y;
} }
@ -992,7 +994,9 @@ run_phase_5 (MiniInfo *info, gdouble elapsed)
{ {
WsRectangle cur = info->target_geometry; WsRectangle cur = info->target_geometry;
#if 0
g_print ("starting phase 5\n"); g_print ("starting phase 5\n");
#endif
info->phase_5_started = TRUE; info->phase_5_started = TRUE;
info->current_geometry = cur; info->current_geometry = cur;
@ -1004,8 +1008,7 @@ run_phase_5 (MiniInfo *info, gdouble elapsed)
set_geometry (info, elapsed); set_geometry (info, elapsed);
meta_comp_screen_set_alpha (info->scr_info, cm_drawable_node_set_alpha (info->comp_window->node, 1 - elapsed);
get_xid (info->window), 1 - elapsed);
} }
static gboolean static gboolean
@ -1050,8 +1053,7 @@ run_animation_01 (gpointer data)
} }
else else
{ {
if (info->finished_func) meta_effect_end (info->effect);
info->finished_func (info->finished_data);
return FALSE; return FALSE;
} }
@ -1060,24 +1062,16 @@ run_animation_01 (gpointer data)
} }
void void
meta_compositor_minimize (MetaCompositor *compositor, meta_comp_window_run_minimize (MetaWindow *window,
MetaWindow *window, MetaEffect *effect)
int x,
int y,
int width,
int height,
MetaAnimationFinishedFunc finished,
gpointer data)
{ {
MiniInfo *info = g_new (MiniInfo, 1); MiniInfo *info = g_new (MiniInfo, 1);
WsRectangle start;
MetaScreen *screen = window->screen;
info->window = window;
info->timer = g_timer_new (); info->timer = g_timer_new ();
info->finished_func = finished; info->comp_window = window;
info->finished_data = data;
info->effect = effect;
info->phase_1_started = FALSE; info->phase_1_started = FALSE;
info->phase_2_started = FALSE; info->phase_2_started = FALSE;
@ -1085,13 +1079,10 @@ meta_compositor_minimize (MetaCompositor *compositor,
info->phase_4_started = FALSE; info->phase_4_started = FALSE;
info->phase_5_started = FALSE; info->phase_5_started = FALSE;
info->button_x = x; info->button_x = effect->u.minimize.icon_rect.x;
info->button_y = y; info->button_y = effect->u.minimize.icon_rect.y;
info->button_width = width; info->button_width = effect->u.minimize.icon_rect.width;
info->button_height = height; info->button_height = effect->u.minimize.icon_rect.height;
info->compositor = compositor;
info->scr_info = screen->compositor_data;
#if 0 #if 0
cm_drawable_node_set_deformation_func (node, minimize_deformation, info); cm_drawable_node_set_deformation_func (node, minimize_deformation, info);
@ -1101,6 +1092,10 @@ meta_compositor_minimize (MetaCompositor *compositor,
g_idle_add (run_animation_01, info); g_idle_add (run_animation_01, info);
} }
#endif
#if 0
#endif #endif
void void

View File

@ -50,6 +50,8 @@ void meta_comp_window_restack (MetaCompWindow *comp_window,
void meta_comp_window_freeze_stack (MetaCompWindow *comp_window); void meta_comp_window_freeze_stack (MetaCompWindow *comp_window);
void meta_comp_window_thaw_stack (MetaCompWindow *comp_window); void meta_comp_window_thaw_stack (MetaCompWindow *comp_window);
gboolean meta_comp_window_stack_frozen (MetaCompWindow *comp_window); gboolean meta_comp_window_stack_frozen (MetaCompWindow *comp_window);
void meta_comp_window_run_minimize (MetaWindow *window,
MetaEffect *effect);
#if 0 #if 0
void meta_comp_window_set_explode (MetaCompWindow *comp_window, void meta_comp_window_set_explode (MetaCompWindow *comp_window,

View File

@ -121,8 +121,10 @@ do_effect (MetaEffect *effect,
MetaCompWindow *window = MetaCompWindow *window =
meta_comp_screen_lookup_window (screen, effect->u.minimize.window->frame->xwindow); meta_comp_screen_lookup_window (screen, effect->u.minimize.window->frame->xwindow);
/* meta_comp_window_shrink (window, effect); */ meta_comp_window_run_minimize (window, effect);
#if 0
meta_comp_window_explode (window, effect); meta_comp_window_explode (window, effect);
#endif
break; break;
} }
#if 0 #if 0
@ -140,8 +142,18 @@ do_effect (MetaEffect *effect,
{ {
MetaCompScreen *screen = meta_comp_screen_get_by_xwindow ( MetaCompScreen *screen = meta_comp_screen_get_by_xwindow (
get_xid (effect->u.minimize.window)); get_xid (effect->u.minimize.window));
MetaCompWindow *window = MetaCompWindow *window;
meta_comp_screen_lookup_window (screen, effect->u.minimize.window->frame->xwindow);
if (effect->u.close.window->frame)
{
window = meta_comp_screen_lookup_window (
screen, effect->u.close.window->frame->xwindow);
}
else
{
window = meta_comp_screen_lookup_window (
screen, effect->u.close.window->xwindow);
}
meta_comp_window_freeze_stack (window); meta_comp_window_freeze_stack (window);
meta_comp_window_set_updates (window, FALSE); meta_comp_window_set_updates (window, FALSE);