Move duplicated window field outside the union

Thu May 25 15:56:43 2006  Søren Sandmann  <sandmann@redhat.com>

        * src/effects.h (struct MetaEffect): Move duplicated window field
        outside the union

        * src/compositor.c: delete duplicated code to get at the window.
This commit is contained in:
Søren Sandmann 2006-05-25 19:59:20 +00:00 committed by Søren Sandmann Pedersen
parent ed37bcc258
commit a1324af018
5 changed files with 43 additions and 66 deletions

View File

@ -1,3 +1,10 @@
Thu May 25 15:56:43 2006 Søren Sandmann <sandmann@redhat.com>
* src/effects.h (struct MetaEffect): Move duplicated window field
outside the union
* src/compositor.c: delete duplicated code to get at the window.
Thu May 25 15:17:29 2006 Søren Sandmann <sandmann@redhat.com>
* src/c-window.c: Fix compilation in non-compositor case, by

View File

@ -1055,6 +1055,11 @@ meta_comp_window_bounce (MetaCompWindow *comp_window,
g_idle_add (update_bounce, info);
}
#endif
#if 0
#endif
void
meta_comp_window_freeze_stack (MetaCompWindow *comp_window)
{
@ -1073,6 +1078,3 @@ meta_comp_window_stack_frozen (MetaCompWindow *comp_window)
return comp_window->stack_freeze_count > 0;
}
#endif

View File

@ -111,81 +111,43 @@ static void
do_effect (MetaEffect *effect,
gpointer data)
{
/* XXX screen and window should be easier to get than this... */
MetaCompScreen *screen;
MetaCompWindow *window;
screen = meta_comp_screen_get_by_xwindow (get_xid (effect->window));
window = meta_comp_screen_lookup_window (screen, get_xid (effect->window));
switch (effect->type)
{
case META_EFFECT_MINIMIZE:
{
MetaCompScreen *screen = meta_comp_screen_get_by_xwindow (
get_xid (effect->u.minimize.window));
MetaCompWindow *window;
if (!effect->u.minimize.window->frame)
if (!effect->window->frame)
{
meta_effect_end (effect);
return;
}
window =
meta_comp_screen_lookup_window (screen, effect->u.minimize.window->frame->xwindow);
/* FIXME: a hack to make sure the window starts on top of the panel */
meta_comp_screen_raise_window (screen, effect->u.minimize.window->frame->xwindow);
meta_comp_screen_raise_window (screen, effect->window->frame->xwindow);
meta_comp_window_run_minimize (window, effect);
#if 0
meta_comp_window_explode (window, effect);
#endif
break;
}
#if 0
case META_EFFECT_RESTORE:
{
MetaCompScreen *screen = meta_comp_screen_get_by_xwindow (
get_xid (effect->u.restore.window));
MetaCompWindow *window = meta_comp_screen_lookup_window (
screen, effect->u.restore.window->frame->xwindow);
meta_comp_window_unshrink (window, effect);
break;
}
#endif
case META_EFFECT_FOCUS:
{
MetaCompScreen *screen = meta_comp_screen_get_by_xwindow (
get_xid (effect->u.focus.window));
MetaCompWindow *window = meta_comp_screen_lookup_window (
screen, effect->u.focus.window->frame->xwindow);
meta_comp_window_bounce (window, effect);
break;
}
case META_EFFECT_CLOSE:
{
MetaCompScreen *screen = meta_comp_screen_get_by_xwindow (
get_xid (effect->u.minimize.window));
MetaCompWindow *window;
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_set_updates (window, FALSE);
meta_comp_window_explode (window, effect);
break;
}
default:
{
g_assert_not_reached();
break;
}
}
}
#endif /* HAVE_COMPOSITE_EXTENSIONS */

View File

@ -101,13 +101,15 @@ meta_pop_effect_handler (void)
}
static MetaEffect *
create_effect (MetaEffectType type,
MetaEffectFinished finished,
gpointer finished_data)
create_effect (MetaEffectType type,
MetaWindow *window,
MetaEffectFinished finished,
gpointer finished_data)
{
MetaEffect *effect = g_new (MetaEffect, 1);
effect->type = type;
effect->window = window;
effect->priv = g_new (MetaEffectPriv, 1);
effect->priv->finished = finished;
effect->priv->finished_data = finished_data;
@ -134,8 +136,7 @@ meta_effect_run_focus (MetaWindow *window,
g_return_if_fail (window != NULL);
effect = create_effect (META_EFFECT_FOCUS, finished, data);
effect->u.focus.window = window;
effect = create_effect (META_EFFECT_FOCUS, window, finished, data);
run_handler (effect);
}
@ -152,9 +153,8 @@ meta_effect_run_minimize (MetaWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (icon_rect != NULL);
effect = create_effect (META_EFFECT_MINIMIZE, finished, data);
effect = create_effect (META_EFFECT_MINIMIZE, window, finished, data);
effect->u.minimize.window = window;
effect->u.minimize.window_rect = *window_rect;
effect->u.minimize.icon_rect = *icon_rect;
@ -173,9 +173,8 @@ meta_effect_run_restore (MetaWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (icon_rect != NULL);
effect = create_effect (META_EFFECT_RESTORE, finished, data);
effect = create_effect (META_EFFECT_RESTORE, window, finished, data);
effect->u.restore.window = window;
effect->u.restore.window_rect = *window_rect;
effect->u.restore.icon_rect = *icon_rect;
@ -191,11 +190,9 @@ meta_effect_run_close (MetaWindow *window,
g_return_if_fail (window != NULL);
effect = create_effect (META_EFFECT_CLOSE,
effect = create_effect (META_EFFECT_CLOSE, window,
finished, data);
effect->u.close.window = window;
run_handler (effect);
}
@ -760,7 +757,7 @@ run_default_effect_handler (MetaEffect *effect)
switch (effect->type)
{
case META_EFFECT_MINIMIZE:
meta_effects_draw_box_animation (effect->u.minimize.window->screen,
meta_effects_draw_box_animation (effect->window->screen,
&(effect->u.minimize.window_rect),
&(effect->u.minimize.icon_rect),
META_MINIMIZE_ANIMATION_LENGTH,

View File

@ -63,18 +63,22 @@ typedef void (* MetaEffectFinished) (const MetaEffect *effect,
typedef struct
{
MetaWindow *window;
MetaRectangle window_rect;
MetaRectangle icon_rect;
} MetaMinimizeEffect, MetaRestoreEffect;
typedef struct
{
MetaWindow *window;
} MetaCloseEffect, MetaFocusEffect;
} MetaCloseEffect;
typedef struct
{
} MetaFocusEffect;
struct MetaEffect
{
MetaWindow *window;
MetaEffectType type;
gpointer info; /* effect handler can hang data here */
@ -98,6 +102,11 @@ void meta_effect_run_minimize (MetaWindow *window,
MetaRectangle *target,
MetaEffectFinished finished,
gpointer data);
void meta_effect_run_restore (MetaWindow *window,
MetaRectangle *window_rect,
MetaRectangle *icon_rect,
MetaEffectFinished finished,
gpointer data);
void meta_effect_run_close (MetaWindow *window,
MetaEffectFinished finished,
gpointer data);