2008-03-05 Tomas Frydrych <tf@o-hand.com>

* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c:
	* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.h:
	* matchbox/comp-mgr/mb-wm-comp-mgr.c:
	* matchbox/comp-mgr/mb-wm-comp-mgr.h:
	* matchbox/core/mb-wm-client.c:
	* matchbox/core/mb-wm-types.h:
	* matchbox/theme-engines/mb-wm-theme-xml.c:
	* matchbox/theme-engines/mb-wm-theme-xml.h:
	* matchbox/theme-engines/mb-wm-theme.c:
	* matchbox/theme-engines/mb-wm-theme.h:
	Simplified effect framework (effect are no longer themeable).
This commit is contained in:
Tomas Frydrych
2008-03-05 13:58:13 +00:00
parent f62c5c16be
commit 30cce735ea
11 changed files with 256 additions and 1236 deletions

View File

@@ -1,3 +1,17 @@
2008-03-05 Tomas Frydrych <tf@o-hand.com>
* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.c:
* matchbox/comp-mgr/mb-wm-comp-mgr-clutter.h:
* matchbox/comp-mgr/mb-wm-comp-mgr.c:
* matchbox/comp-mgr/mb-wm-comp-mgr.h:
* matchbox/core/mb-wm-client.c:
* matchbox/core/mb-wm-types.h:
* matchbox/theme-engines/mb-wm-theme-xml.c:
* matchbox/theme-engines/mb-wm-theme-xml.h:
* matchbox/theme-engines/mb-wm-theme.c:
* matchbox/theme-engines/mb-wm-theme.h:
Simplified effect framework (effect are no longer themeable).
2008-03-04 Tomas Frydrych <tf@o-hand.com>
* matchbox/core/mb-window-manager.c:

View File

@@ -94,13 +94,6 @@ mb_wm_comp_mgr_clutter_client_repair_real (MBWMCompMgrClient * client);
static void
mb_wm_comp_mgr_clutter_client_configure_real (MBWMCompMgrClient * client);
static MBWMCompMgrEffect *
mb_wm_comp_mgr_clutter_client_effect_new_real (MBWMCompMgrClient *client,
MBWMCompMgrEffectEvent event,
MBWMCompMgrEffectType type,
unsigned long duration,
MBWMGravity gravity);
static void
mb_wm_comp_mgr_clutter_client_class_init (MBWMObjectClass *klass)
{
@@ -110,7 +103,6 @@ mb_wm_comp_mgr_clutter_client_class_init (MBWMObjectClass *klass)
c_klass->hide = mb_wm_comp_mgr_clutter_client_hide_real;
c_klass->repair = mb_wm_comp_mgr_clutter_client_repair_real;
c_klass->configure = mb_wm_comp_mgr_clutter_client_configure_real;
c_klass->effect_new = mb_wm_comp_mgr_clutter_client_effect_new_real;
#ifdef MBWM_WANT_DEBUG
klass->klass_name = "MBWMCompMgrClutterClient";
@@ -360,12 +352,21 @@ mb_wm_comp_mgr_clutter_client_show_real (MBWMCompMgrClient * client)
clutter_actor_show_all (cclient->actor);
}
static MBWMCompMgrEffect *
mb_wm_comp_mgr_clutter_effect_new (MBWMCompMgrEffectType type,
unsigned long duration,
MBWMGravity gravity,
ClutterTimeline * timeline,
ClutterBehaviour * behaviour);
/*
* MBWMCompMgrClutterEffect
*/
typedef struct MBWMCompMgrClutterEffect
{
ClutterTimeline *timeline;
ClutterBehaviour *behaviour; /* can be either behaviour or effect */
} MBWMCompMgrClutterEffect;
struct completed_cb_data
{
gulong my_id;
MBWMCompMgrClutterClient * cclient;
MBWMCompMgrEffectEvent event;
};
/*
* Helper method to get a timeline for given event (all effects associated
@@ -390,17 +391,12 @@ mb_wm_comp_mgr_clutter_client_get_timeline (MBWMCompMgrClient *client,
return cclient->timelines[event-1];
}
/*
* Implementation of the MBWMCompMgrClient->effect_new() method.
*/
static MBWMCompMgrEffect *
mb_wm_comp_mgr_clutter_client_effect_new_real (MBWMCompMgrClient *client,
MBWMCompMgrEffectEvent event,
MBWMCompMgrEffectType type,
unsigned long duration,
MBWMGravity gravity)
static MBWMCompMgrClutterEffect *
mb_wm_comp_mgr_clutter_effect_new (MBWMCompMgrClient * client,
MBWMCompMgrEffectEvent event,
unsigned long duration)
{
MBWMCompMgrEffect * eff;
MBWMCompMgrClutterEffect * eff;
ClutterTimeline * timeline;
ClutterBehaviour * behaviour;
ClutterAlpha * alpha;
@@ -421,196 +417,29 @@ mb_wm_comp_mgr_clutter_client_effect_new_real (MBWMCompMgrClient *client,
mb_wm_client_get_coverage (wm_client, &geom);
switch (type)
switch (event)
{
case MBWMCompMgrEffectScaleUp:
behaviour =
clutter_behaviour_scale_newx (alpha, 0, 0, CFX_ONE, CFX_ONE);
break;
case MBWMCompMgrEffectScaleDown:
case MBWMCompMgrEffectEventMinimize:
behaviour =
clutter_behaviour_scale_newx (alpha, CFX_ONE, CFX_ONE, 0, 0);
break;
case MBWMCompMgrEffectSpinXCW:
behaviour = clutter_behaviour_rotate_newx (alpha,
CLUTTER_X_AXIS,
CLUTTER_ROTATE_CW,
0,
CLUTTER_INT_TO_FIXED (360));
break;
case MBWMCompMgrEffectSpinXCCW:
behaviour = clutter_behaviour_rotate_newx (alpha,
CLUTTER_X_AXIS,
CLUTTER_ROTATE_CCW,
0,
CLUTTER_INT_TO_FIXED (360));
break;
case MBWMCompMgrEffectSpinYCW:
behaviour = clutter_behaviour_rotate_newx (alpha,
CLUTTER_Y_AXIS,
CLUTTER_ROTATE_CW,
0,
CLUTTER_INT_TO_FIXED (360));
break;
case MBWMCompMgrEffectSpinYCCW:
behaviour = clutter_behaviour_rotate_newx (alpha,
CLUTTER_Y_AXIS,
CLUTTER_ROTATE_CCW,
0,
CLUTTER_INT_TO_FIXED (360));
break;
case MBWMCompMgrEffectSpinZCW:
behaviour = clutter_behaviour_rotate_newx (alpha,
CLUTTER_Z_AXIS,
CLUTTER_ROTATE_CW,
0,
CLUTTER_INT_TO_FIXED (360));
break;
case MBWMCompMgrEffectSpinZCCW:
behaviour = clutter_behaviour_rotate_newx (alpha,
CLUTTER_Z_AXIS,
CLUTTER_ROTATE_CCW,
0,
CLUTTER_INT_TO_FIXED (360));
break;
case MBWMCompMgrEffectFade:
case MBWMCompMgrEffectEventUnmap:
behaviour = clutter_behaviour_opacity_new (alpha, 0xff, 0);
break;
case MBWMCompMgrEffectUnfade:
behaviour = clutter_behaviour_opacity_new (alpha, 0, 0xff);
break;
/*
* Currently ClutterBehaviourPath does not handle negative coords,
* so anything here that needs them is broken.
*/
case MBWMCompMgrEffectSlideIn:
switch (gravity)
{
case MBWMGravityNorth:
knots[0].x = geom.x;
knots[0].y = wm->xdpy_height;
knots[1].x = geom.x;
knots[1].y = geom.y;
break;
case MBWMGravitySouth:
knots[0].x = geom.x;
knots[0].y = -geom.height;
knots[1].x = geom.x;
knots[1].y = geom.y;
break;
case MBWMGravityWest:
knots[0].x = wm->xdpy_width;
knots[0].y = geom.y;
knots[1].x = geom.x;
knots[1].y = geom.y;
break;
case MBWMGravityEast:
knots[0].x = -geom.width;
knots[0].y = geom.y;
knots[1].x = geom.x;
knots[1].y = geom.y;
break;
case MBWMGravityNorthWest:
case MBWMGravityNone:
default:
knots[0].x = wm->xdpy_width;
knots[0].y = wm->xdpy_height;
knots[1].x = geom.x;
knots[1].y = geom.y;
break;
case MBWMGravityNorthEast:
knots[0].x = -geom.width;
knots[0].y = wm->xdpy_height;
knots[1].x = geom.x;
knots[1].y = geom.y;
break;
case MBWMGravitySouthWest:
knots[0].x = wm->xdpy_width;
knots[0].y = -geom.height;
knots[1].x = geom.x;
knots[1].y = geom.y;
break;
case MBWMGravitySouthEast:
knots[0].x = -geom.width;
knots[0].y = -geom.height;
knots[1].x = geom.x;
knots[1].y = geom.y;
break;
}
case MBWMCompMgrEffectEventMap:
knots[0].x = -wm->xdpy_width;
knots[0].y = geom.y;
knots[1].x = geom.x;
knots[1].y = geom.y;
behaviour = clutter_behaviour_path_new (alpha, &knots[0], 2);
break;
case MBWMCompMgrEffectSlideOut:
switch (gravity)
{
case MBWMGravityNorth:
knots[0].x = geom.x;
knots[0].y = geom.y;
knots[1].x = geom.x;
knots[1].y = -(geom.y + geom.height);
break;
case MBWMGravitySouth:
knots[0].x = geom.x;
knots[0].y = geom.y;
knots[1].x = geom.x;
knots[1].y = wm->xdpy_height;
break;
case MBWMGravityEast:
knots[0].x = geom.x;
knots[0].y = geom.y;
knots[1].x = wm->xdpy_width;
knots[1].y = geom.y;
break;
case MBWMGravityWest:
knots[0].x = geom.x;
knots[0].y = geom.y;
knots[1].x = -(geom.x + geom.width);
knots[1].y = geom.y;
break;
case MBWMGravityNorthWest:
case MBWMGravityNone:
default:
knots[0].x = geom.x;
knots[0].y = geom.y;
knots[1].x = -(geom.x + geom.width);
knots[1].y = -(geom.y + geom.height);
break;
case MBWMGravityNorthEast:
knots[0].x = geom.x;
knots[0].y = geom.y;
knots[1].x = wm->xdpy_width;
knots[1].y = -(geom.y + geom.height);
break;
case MBWMGravitySouthWest:
knots[0].x = geom.x;
knots[0].y = geom.y;
knots[1].x = -(geom.x + geom.width);
knots[1].y = wm->xdpy_height;
break;
case MBWMGravitySouthEast:
knots[0].x = geom.x;
knots[0].y = geom.y;
knots[1].x = wm->xdpy_width;
knots[1].y = wm->xdpy_height;
break;
}
behaviour = clutter_behaviour_path_new (alpha, &knots[0], 2);
}
eff =
mb_wm_comp_mgr_clutter_effect_new (type, duration, gravity,
timeline, behaviour);
eff = mb_wm_util_malloc0 (sizeof (MBWMCompMgrClutterEffect));
eff->timeline = timeline;
eff->behaviour = behaviour;
if (eff)
{
/*
* We assume that the actor already exists -- if not, clutter will
* issue a warning here
*/
clutter_behaviour_apply (behaviour, cclient->actor);
}
clutter_behaviour_apply (behaviour, cclient->actor);
return eff;
}
@@ -672,6 +501,11 @@ mb_wm_comp_mgr_clutter_transition_real (MBWMCompMgr * mgr,
MBWindowManagerClient *c2,
Bool reverse);
static void
mb_wm_comp_mgr_clutter_effect_real (MBWMCompMgr * mgr,
MBWindowManagerClient * client,
MBWMCompMgrEffectEvent event);
static void
mb_wm_comp_mgr_clutter_restack_real (MBWMCompMgr *mgr);
@@ -698,6 +532,7 @@ mb_wm_comp_mgr_clutter_class_init (MBWMObjectClass *klass)
cm_klass->handle_events = mb_wm_comp_mgr_clutter_handle_events_real;
cm_klass->my_window = mb_wm_comp_mgr_is_my_window_real;
cm_klass->transition = mb_wm_comp_mgr_clutter_transition_real;
cm_klass->effect = mb_wm_comp_mgr_clutter_effect_real;
cm_klass->restack = mb_wm_comp_mgr_clutter_restack_real;
}
@@ -1160,25 +995,6 @@ mb_wm_comp_mgr_clutter_map_notify_real (MBWMCompMgr *mgr,
cclient->actor = actor;
cclient->texture = texture;
l =
mb_wm_theme_get_client_effects (wm->theme, c);
while (l)
{
MBWMThemeEffects * t_effects = l->data;
MBWMList * m_effects;
m_effects = mb_wm_comp_mgr_client_get_effects (client,
t_effects->event,
t_effects->type,
t_effects->duration,
t_effects->gravity);
mb_wm_comp_mgr_client_add_effects (client, t_effects->event, m_effects);
l = l->next;
}
g_object_set_data (G_OBJECT (actor), "MBWMCompMgrClutterClient", cclient);
clutter_actor_set_position (actor, geom.x, geom.y);
@@ -1206,6 +1022,9 @@ mb_wm_comp_mgr_clutter_transtion_fade_cb (ClutterTimeline * t, void * data)
d->c1->flags &= ~MBWMCompMgrClutterClientEffectRunning;
d->c2->flags &= ~MBWMCompMgrClutterClientEffectRunning;
mb_wm_object_unref (MB_WM_OBJECT (d->c1));
mb_wm_object_unref (MB_WM_OBJECT (d->c2));
g_object_unref (d->timeline);
g_object_unref (d->beh);
}
@@ -1252,8 +1071,8 @@ mb_wm_comp_mgr_clutter_transition_fade (MBWMCompMgrClutterClient *c1,
b = clutter_behaviour_opacity_new (alpha, 0xff, 0);
cb_data.c1 = c1;
cb_data.c2 = c2;
cb_data.c1 = mb_wm_object_ref (MB_WM_OBJECT (c1));
cb_data.c2 = mb_wm_object_ref (MB_WM_OBJECT (c2));
cb_data.timeline = timeline;
cb_data.beh = b;
@@ -1283,21 +1102,180 @@ mb_wm_comp_mgr_clutter_transition_real (MBWMCompMgr * mgr,
MBWMCompMgrClutterClient * cc2 =
MB_WM_COMP_MGR_CLUTTER_CLIENT (c2->cm_client);
MBWMThemeTransition * trs =
mb_wm_theme_get_client_transition (c1->wmref->theme, c1);
mb_wm_comp_mgr_clutter_transition_fade (cc1,
cc2,
100);
}
if (!trs)
/*
* Callback for ClutterTimeline::completed signal.
*
* One-off; get connected when the timeline is started, and disconnected
* again when it finishes.
*/
static void
mb_wm_comp_mgr_clutter_effect_completed_cb (ClutterTimeline * t, void * data)
{
struct completed_cb_data * d = data;
d->cclient->flags &= ~MBWMCompMgrClutterClientEffectRunning;
g_signal_handler_disconnect (t, d->my_id);
switch (d->event)
{
case MBWMCompMgrEffectEventUnmap:
case MBWMCompMgrEffectEventMinimize:
clutter_actor_hide (d->cclient->actor);
break;
default:
break;
}
/*
* Release the extra reference on the CM client that was added for the sake
* of the effect
*/
mb_wm_object_unref (MB_WM_OBJECT (d->cclient));
free (d);
}
static void
mb_wm_comp_mgr_clutter_effect_real (MBWMCompMgr * mgr,
MBWindowManagerClient * client,
MBWMCompMgrEffectEvent event)
{
static MBWMCompMgrClutterEffect * eff_map = NULL;
static MBWMCompMgrClutterEffect * eff_unmap = NULL;
static MBWMCompMgrClutterEffect * eff_minimize = NULL;
MBWMCompMgrClutterEffect * eff;
MBWMCompMgrClutterClient * cclient =
MB_WM_COMP_MGR_CLUTTER_CLIENT (client->cm_client);
if (MB_WM_CLIENT_CLIENT_TYPE (client) != MBWMClientTypeApp)
return;
switch (trs->type)
switch (event)
{
case MBWMCompMgrTransitionFade:
mb_wm_comp_mgr_clutter_transition_fade (cc1,
cc2,
trs->duration);
case MBWMCompMgrEffectEventMap:
if (!eff_map)
eff_map = mb_wm_comp_mgr_clutter_effect_new (client->cm_client,
event,
200);
eff = eff_map;
break;
case MBWMCompMgrEffectEventUnmap:
if (!eff_unmap)
eff_unmap = mb_wm_comp_mgr_clutter_effect_new (client->cm_client,
event, 200);
eff = eff_unmap;
break;
case MBWMCompMgrEffectEventMinimize:
if (!eff_minimize)
eff_minimize = mb_wm_comp_mgr_clutter_effect_new (client->cm_client,
event, 200);
eff = eff_minimize;
break;
default:
MBWM_DBG ("Unimplemented transition type %d", trs->type);
;
}
/*
* Don't attempt to start the timeline if it is already playing
*/
if (eff->timeline &&
!clutter_timeline_is_playing (eff->timeline))
{
GSList * actors;
ClutterActor *a;
Bool dont_run = False;
struct completed_cb_data * d;
d = mb_wm_util_malloc0 (sizeof (struct completed_cb_data));
d->cclient = mb_wm_object_ref (MB_WM_OBJECT (cclient));
d->event = event;
d->my_id = g_signal_connect (eff->timeline, "completed",
G_CALLBACK (mb_wm_comp_mgr_clutter_effect_completed_cb),
d);
/*
* This is bit of a pain; we know that our actor is attached to
* a single actor, but the current API only provides us with a copy
* of the actor list; ideally, we would like to be able to access
* the first actor directly.
*/
actors = clutter_behaviour_get_actors (eff->behaviour);
a = actors->data;
if (CLUTTER_IS_BEHAVIOUR_PATH (eff->behaviour) &&
!CLUTTER_ACTOR_IS_VISIBLE (a))
{
/*
* At this stage, if the actor is not yet visible, move it to
* the starting point of the path (this is mostly because of
* 'map' effects, where the clutter_actor_show () is delayed
* until this point, so that the actor can be positioned in the
* correct location without visible artefacts).
*
* FIXME -- this is very clumsy; we need clutter API to query
* the first knot of the path to avoid messing about with copies
* of the list.
*/
GSList * knots =
clutter_behaviour_path_get_knots (
CLUTTER_BEHAVIOUR_PATH (eff->behaviour));
if (knots)
{
ClutterKnot * k = knots->data;
clutter_actor_set_position (a, k->x, k->y);
g_slist_free (knots);
}
}
if (event == MBWMCompMgrEffectEventUnmap)
{
cclient->flags |= MBWMCompMgrClutterClientDontUpdate;
if (cclient->flags & MBWMCompMgrClutterClientDone)
dont_run = True;
else
cclient->flags |= MBWMCompMgrClutterClientDone;
}
else if (event == MBWMCompMgrEffectEventMinimize)
{
/*
* This is tied specifically to the unmap scale effect (the
* themable version of effects allowed to handle this is a nice
* generic fashion. :-(
*/
clutter_actor_move_anchor_point_from_gravity (a,
CLUTTER_GRAVITY_SOUTH_EAST);
}
/*
* Make sure the actor is showing (for example with 'map' effects,
* the show() is delayed until the effect had chance to
* set up the actor postion).
*/
if (!dont_run)
{
cclient->flags |= MBWMCompMgrClutterClientEffectRunning;
clutter_actor_show (a);
clutter_timeline_start (eff->timeline);
}
g_slist_free (actors);
}
}
@@ -1351,280 +1329,6 @@ mb_wm_comp_mgr_clutter_new (MBWindowManager *wm)
return MB_WM_COMP_MGR (mgr);
}
/*
* MBWMCompMgrClutterEffect
*/
struct MBWMCompMgrClutterEffect
{
MBWMCompMgrEffect parent;
ClutterTimeline *timeline;
ClutterBehaviour *behaviour; /* can be either behaviour or effect */
};
struct completed_cb_data
{
gulong my_id;
MBWMCompMgrClutterClient * cclient;
MBWMCompMgrEffectEvent event;
};
/*
* Callback for ClutterTimeline::completed signal.
*
* One-off; get connected when the timeline is started, and disconnected
* again when it finishes.
*/
static void
mb_wm_comp_mgr_clutter_effect_completed_cb (ClutterTimeline * t, void * data)
{
struct completed_cb_data * d = data;
d->cclient->flags &= ~MBWMCompMgrClutterClientEffectRunning;
g_signal_handler_disconnect (t, d->my_id);
switch (d->event)
{
case MBWMCompMgrEffectEventUnmap:
case MBWMCompMgrEffectEventMinimize:
clutter_actor_hide (d->cclient->actor);
break;
default:
break;
}
/*
* Release the extra reference on the CM client that was added for the sake
* of the effect
*/
mb_wm_object_unref (MB_WM_OBJECT (d->cclient));
free (d);
}
static void
mb_wm_comp_mgr_clutter_effect_run_real (MBWMList * effects,
MBWMCompMgrClient * cm_client,
MBWMCompMgrEffectEvent event)
{
MBWMCompMgrClutterClient *cclient =
MB_WM_COMP_MGR_CLUTTER_CLIENT (cm_client);
/*
* Since the entire effect group for a single event type shares
* a timeline, we just need to start it for one of the behaviours.
*
* TODO -- there is no need for the effect objects to carry the timeline
* pointer, so remove it.
*/
if (effects && effects->data)
{
MBWMCompMgrEffect * eff = effects->data;
MBWMCompMgrClutterEffect * ceff = MB_WM_COMP_MGR_CLUTTER_EFFECT (eff);
/*
* Don't attempt to start the timeline if it is already playing
*/
if (ceff->timeline &&
!clutter_timeline_is_playing (ceff->timeline))
{
GSList * actors;
ClutterActor *a;
Bool dont_run = False;
struct completed_cb_data * d;
d = mb_wm_util_malloc0 (sizeof (struct completed_cb_data));
d->cclient = cclient;
d->event = event;
d->my_id = g_signal_connect (ceff->timeline, "completed",
G_CALLBACK (mb_wm_comp_mgr_clutter_effect_completed_cb),
d);
/*
* This is bit of a pain; we know that our actor is attached to
* a single actor, but the current API only provides us with a copy
* of the actor list; ideally, we would like to be able to access
* the first actor directly.
*/
actors = clutter_behaviour_get_actors (ceff->behaviour);
a = actors->data;
/*
* Deal with gravity, but not for path behaviours (there the
* gravity translates into the path itself, and is already
* set up).
*/
if (eff->gravity != CLUTTER_GRAVITY_NONE &&
!CLUTTER_IS_BEHAVIOUR_PATH (ceff->behaviour))
{
clutter_actor_move_anchor_point_from_gravity (a, eff->gravity);
}
else if (CLUTTER_IS_BEHAVIOUR_PATH (ceff->behaviour) &&
!CLUTTER_ACTOR_IS_VISIBLE (a))
{
/*
* At this stage, if the actor is not yet visible, move it to
* the starting point of the path (this is mostly because of
* 'map' effects, where the clutter_actor_show () is delayed
* until this point, so that the actor can be positioned in the
* correct location without visible artefacts).
*
* FIXME -- this is very clumsy; we need clutter API to query
* the first knot of the path to avoid messing about with copies
* of the list.
*/
GSList * knots =
clutter_behaviour_path_get_knots (
CLUTTER_BEHAVIOUR_PATH (ceff->behaviour));
if (knots)
{
ClutterKnot * k = knots->data;
clutter_actor_set_position (a, k->x, k->y);
g_slist_free (knots);
}
}
if (event == MBWMCompMgrEffectEventUnmap)
{
cclient->flags |= MBWMCompMgrClutterClientDontUpdate;
if (cclient->flags & MBWMCompMgrClutterClientDone)
dont_run = True;
else
cclient->flags |= MBWMCompMgrClutterClientDone;
}
/*
* Make sure the actor is showing (for example with 'map' effects,
* the show() is delayed until the effect had chance to
* set up the actor postion).
*/
if (!dont_run)
{
cclient->flags |= MBWMCompMgrClutterClientEffectRunning;
clutter_actor_show (a);
clutter_timeline_start (ceff->timeline);
}
g_slist_free (actors);
}
}
}
static void
mb_wm_comp_mgr_clutter_effect_class_init (MBWMObjectClass *klass)
{
MBWMCompMgrEffectClass *c_klass = MB_WM_COMP_MGR_EFFECT_CLASS (klass);
c_klass->run = mb_wm_comp_mgr_clutter_effect_run_real;
#ifdef MBWM_WANT_DEBUG
klass->klass_name = "MBWMCompMgrClutterEffect";
#endif
}
static int
mb_wm_comp_mgr_clutter_effect_init (MBWMObject *obj, va_list vap)
{
MBWMObjectProp prop;
ClutterTimeline *timeline;
ClutterBehaviour *behaviour;
prop = va_arg(vap, MBWMObjectProp);
while (prop)
{
switch (prop)
{
case MBWMObjectPropCompMgrClutterEffectTimeline:
timeline = va_arg(vap, ClutterTimeline *);
break;
case MBWMObjectPropCompMgrClutterEffectBehaviour:
behaviour = va_arg(vap, ClutterBehaviour *);
break;
default:
MBWMO_PROP_EAT (vap, prop);
}
prop = va_arg(vap, MBWMObjectProp);
}
if (!timeline || !behaviour)
return 0;
MB_WM_COMP_MGR_CLUTTER_EFFECT (obj)->timeline = timeline;
MB_WM_COMP_MGR_CLUTTER_EFFECT (obj)->behaviour = behaviour;
return 1;
}
static void
mb_wm_comp_mgr_clutter_effect_destroy (MBWMObject* obj)
{
MBWMCompMgrClutterEffect * e = MB_WM_COMP_MGR_CLUTTER_EFFECT (obj);
if (!e || !e->behaviour)
return;
g_object_unref (e->behaviour);
g_object_unref (e->timeline);
}
int
mb_wm_comp_mgr_clutter_effect_class_type ()
{
static int type = 0;
if (UNLIKELY(type == 0))
{
static MBWMObjectClassInfo info = {
sizeof (MBWMCompMgrClutterEffectClass),
sizeof (MBWMCompMgrClutterEffect),
mb_wm_comp_mgr_clutter_effect_init,
mb_wm_comp_mgr_clutter_effect_destroy,
mb_wm_comp_mgr_clutter_effect_class_init
};
type =
mb_wm_object_register_class (&info, MB_WM_TYPE_COMP_MGR_EFFECT, 0);
}
return type;
}
/*
* This is private method for use by the manager, hence static.
*/
static MBWMCompMgrEffect *
mb_wm_comp_mgr_clutter_effect_new (MBWMCompMgrEffectType type,
unsigned long duration,
MBWMGravity gravity,
ClutterTimeline * timeline,
ClutterBehaviour * behaviour)
{
MBWMObject *e;
e =
mb_wm_object_new (MB_WM_TYPE_COMP_MGR_CLUTTER_EFFECT,
MBWMObjectPropCompMgrEffectType, type,
MBWMObjectPropCompMgrEffectDuration, duration,
MBWMObjectPropCompMgrEffectGravity, gravity,
MBWMObjectPropCompMgrClutterEffectTimeline, timeline,
MBWMObjectPropCompMgrClutterEffectBehaviour, behaviour,
NULL);
return MB_WM_COMP_MGR_EFFECT (e);
}
/* ------------------------------- */
/* Shadow Generation */

View File

@@ -32,11 +32,6 @@
#define MB_WM_COMP_MGR_CLUTTER_CLIENT_CLASS(c) ((MBWMCompMgrClutterClientClass*)(c))
#define MB_WM_TYPE_COMP_MGR_CLUTTER_CLIENT (mb_wm_comp_mgr_clutter_client_class_type ())
#define MB_WM_COMP_MGR_CLUTTER_EFFECT(c) ((MBWMCompMgrClutterEffect*)(c))
#define MB_WM_COMP_MGR_CLUTTER_EFFECT_CLASS(c) ((MBWMCompMgrClutterEffectClass*)(c))
#define MB_WM_TYPE_COMP_MGR_CLUTTER_EFFECT (mb_wm_comp_mgr_clutter_effect_class_type ())
struct MBWMCompMgrClutter
{
MBWMCompMgr parent;
@@ -65,12 +60,4 @@ struct MBWMCompMgrClutterClientClass
int
mb_wm_comp_mgr_clutter_client_class_type ();
struct MBWMCompMgrClutterEffectClass
{
MBWMCompMgrEffectClass parent;
};
int
mb_wm_comp_mgr_clutter_effect_class_type ();
#endif

View File

@@ -28,24 +28,6 @@
#include <X11/extensions/Xrender.h>
#include <X11/extensions/Xcomposite.h>
typedef struct _MBWMCompMgrEffectAssociation MBWMCompMgrEffectAssociation;
/*
* A helper object used to translate the event-effect association defined
* by theme into a list of effect instances.
*/
struct _MBWMCompMgrEffectAssociation
{
MBWMCompMgrEffectEvent event;
MBWMList * effects;
};
static MBWMCompMgrEffectAssociation *
mb_wm_comp_mgr_effect_association_new ();
static void
mb_wm_comp_mgr_effect_association_free (MBWMCompMgrEffectAssociation * a);
static void
mb_wm_comp_mgr_client_class_init (MBWMObjectClass *klass)
{
@@ -97,15 +79,6 @@ mb_wm_comp_mgr_client_init (MBWMObject *obj, va_list vap)
static void
mb_wm_comp_mgr_client_destroy (MBWMObject* obj)
{
MBWMList * l = MB_WM_COMP_MGR_CLIENT (obj)->effects;
while (l)
{
MBWMCompMgrEffectAssociation * a = l->data;
mb_wm_comp_mgr_effect_association_free (a);
l = l->next;
}
}
int
@@ -173,82 +146,6 @@ mb_wm_comp_mgr_client_repair (MBWMCompMgrClient * client)
klass->repair (client);
}
/*
* Method for sub-classes to add effects to the (private) list
*/
void
mb_wm_comp_mgr_client_add_effects (MBWMCompMgrClient * client,
MBWMCompMgrEffectEvent event,
MBWMList * effects)
{
MBWMCompMgr * mgr = client->wm_client->wmref->comp_mgr;
MBWMCompMgrEffectAssociation * a;
MBWM_ASSERT (mgr);
a = mb_wm_comp_mgr_effect_association_new ();
a->effects = effects;
a->event = event;
client->effects = mb_wm_util_list_prepend (client->effects, a);
}
/*
* Runs all effects associated with this client for the given events.
*
* completed_cb is a callback function that will get called when the effect
* execution is completed (can be NULL), data is user data that will be passed
* to the callback function.
*
* For exmaple of use see mb_wm_client_iconize().w
*/
void
mb_wm_comp_mgr_client_run_effect (MBWMCompMgrClient * client,
MBWMCompMgrEffectEvent event)
{
MBWMList * l = client->effects;
Bool done_effect = False;
MBWMCompMgrEffectClass * eklass;
if (!client)
return;
/*
* Take a reference to the CM client object, so that it does not disappear
* underneath us while the effect is running; it is the responsibility
* of the subclassed run() to release this reference when it is done.
*/
mb_wm_object_ref (MB_WM_OBJECT (client));
while (l)
{
MBWMCompMgrEffectAssociation * a = l->data;
if (a->event == event)
{
MBWMList * el = a->effects;
MBWMCompMgrEffect * eff = el->data;
eklass = MB_WM_COMP_MGR_EFFECT_CLASS (MB_WM_OBJECT_GET_CLASS (eff));
if (!eklass)
continue;
eklass->run (el, client, event);
done_effect = True;
}
l = l->next;
}
/*
* If there were no effects to run for this event, release the
* temporary reference on the client object.
*/
if (!done_effect)
mb_wm_object_unref (MB_WM_OBJECT (client));
}
/*
* MBWMCompMgr object
@@ -417,8 +314,7 @@ mb_wm_comp_mgr_map_notify (MBWMCompMgr *mgr, MBWindowManagerClient *c)
* (the effect will take care of showing the actor, and if not, show() gets
* called by mb_wm_comp_mgr_map_notify()).
*/
mb_wm_comp_mgr_client_run_effect (c->cm_client,
MBWMCompMgrEffectEventMap);
mb_wm_comp_mgr_do_effect (mgr, c, MBWMCompMgrEffectEventMap);
if (c->cm_client)
mb_wm_comp_mgr_client_show (c->cm_client);
@@ -434,8 +330,7 @@ mb_wm_comp_mgr_unmap_notify (MBWMCompMgr *mgr, MBWindowManagerClient *c)
klass = MB_WM_COMP_MGR_CLASS (MB_WM_OBJECT_GET_CLASS (mgr));
mb_wm_comp_mgr_client_run_effect (c->cm_client,
MBWMCompMgrEffectEventUnmap);
mb_wm_comp_mgr_do_effect (mgr, c, MBWMCompMgrEffectEventUnmap);
if (klass->unmap_notify)
klass->unmap_notify (mgr, c);
@@ -473,6 +368,25 @@ mb_wm_comp_mgr_do_transition (MBWMCompMgr * mgr,
klass->transition (mgr, c1, c2, reverse);
}
void
mb_wm_comp_mgr_do_effect (MBWMCompMgr * mgr,
MBWindowManagerClient * client,
MBWMCompMgrEffectEvent event)
{
MBWMCompMgrClass *klass;
/*
* Transitions can only be done for clients of the same type, so
* check the types here.
*/
if (!mgr || !client)
return;
klass = MB_WM_COMP_MGR_CLASS (MB_WM_OBJECT_GET_CLASS (mgr));
if (klass->effect)
klass->effect (mgr, client, event);
}
void
mb_wm_comp_mgr_turn_on (MBWMCompMgr *mgr)
@@ -525,166 +439,3 @@ mb_wm_comp_mgr_is_my_window (MBWMCompMgr * mgr, Window xwin)
return False;
}
/*
* Returns a list of MBWMCompMgrEffect objects of given type that are to be
* associated with the given client for the given event. The type parameter
* can be made up of more that one MBWMComMgrEffectType value, or-ed.
*
* This function provides a public API to translate the effects specified
* by theme into actual effect instances.
*/
MBWMList *
mb_wm_comp_mgr_client_get_effects (MBWMCompMgrClient * client,
MBWMCompMgrEffectEvent event,
MBWMCompMgrEffectType type,
unsigned long duration,
MBWMGravity gravity)
{
MBWMList *l = NULL;
MBWMCompMgrEffectType t = (MBWMCompMgrEffectType) 1;
MBWMCompMgrClientClass *klass =
MB_WM_COMP_MGR_CLIENT_CLASS (MB_WM_OBJECT_GET_CLASS (client));
if (!klass->effect_new)
return NULL;
while (t < _MBWMCompMgrEffectLast)
{
MBWMCompMgrEffect *e = NULL;
if (t & type)
e = klass->effect_new (client, event, t, duration, gravity);
if (e)
l = mb_wm_util_list_prepend (l, e);
t <<= 1;
}
return l;
}
/*
* Effect
*
* Effects are simple one-off transformations carried out on the client in
* response to some trigger event. The possible events are given by the
* MBWMCompMgrEffectEvent enum, while the nature effect is defined by
* MBWMCompMgrEffectType enum; effects are specified per window manager client
* type by the theme.
*
* Events and effect types form a one to many association (and the type
* enumeration is or-able).
*
* The base MBWMCompMgrEffect class provides some common infrastructure,
* notably the virtual run() method that needs to be implemented by
* the derrived classes.
*
* NB: the base class does not automatically associate effects with clients;
* this is the responsibility of the subclasses, mostly because the sub classes
* might want to allocate the effect objects at different times (for example,
* the MBWMCompMgrClutterEffect objects cannot be allocated until the
* the associated client has created its ClutterActor, which only happens when
* the client window maps).
*/
static MBWMCompMgrEffectAssociation *
mb_wm_comp_mgr_effect_association_new ()
{
void * a;
a = mb_wm_util_malloc0 (sizeof (MBWMCompMgrEffectAssociation));
return (MBWMCompMgrEffectAssociation*) a;
}
static void
mb_wm_comp_mgr_effect_association_free (MBWMCompMgrEffectAssociation * a)
{
MBWMList * l = a->effects;
while (l)
{
MBWMCompMgrEffect * e = l->data;
mb_wm_object_unref (MB_WM_OBJECT (e));
l = l->next;
}
free (a);
}
static void
mb_wm_comp_mgr_effect_class_init (MBWMObjectClass *klass)
{
MBWMCompMgrEffectClass *c_klass = MB_WM_COMP_MGR_EFFECT_CLASS (klass);
#ifdef MBWM_WANT_DEBUG
klass->klass_name = "MBWMCompMgrEffect";
#endif
}
static int
mb_wm_comp_mgr_effect_init (MBWMObject *obj, va_list vap)
{
MBWMObjectProp prop;
MBWMCompMgrEffectType type = 0;
unsigned long duration = 0;
MBWMGravity gravity = MBWMGravityNone;
prop = va_arg(vap, MBWMObjectProp);
while (prop)
{
switch (prop)
{
case MBWMObjectPropCompMgrEffectType:
type = va_arg(vap, MBWMCompMgrEffectType);
break;
case MBWMObjectPropCompMgrEffectDuration:
duration = va_arg(vap, unsigned long);
break;
case MBWMObjectPropCompMgrEffectGravity:
gravity = va_arg(vap, MBWMGravity);
break;
default:
MBWMO_PROP_EAT (vap, prop);
}
prop = va_arg(vap, MBWMObjectProp);
}
if (!type)
return 0;
MB_WM_COMP_MGR_EFFECT (obj)->type = type;
MB_WM_COMP_MGR_EFFECT (obj)->duration = duration;
MB_WM_COMP_MGR_EFFECT (obj)->gravity = gravity;
return 1;
}
static void
mb_wm_comp_mgr_effect_destroy (MBWMObject* obj)
{
}
int
mb_wm_comp_mgr_effect_class_type ()
{
static int type = 0;
if (UNLIKELY(type == 0))
{
static MBWMObjectClassInfo info = {
sizeof (MBWMCompMgrEffectClass),
sizeof (MBWMCompMgrEffect),
mb_wm_comp_mgr_effect_init,
mb_wm_comp_mgr_effect_destroy,
mb_wm_comp_mgr_effect_class_init
};
type = mb_wm_object_register_class (&info, MB_WM_TYPE_OBJECT, 0);
}
return type;
}

View File

@@ -31,10 +31,6 @@
#define MB_WM_COMP_MGR_CLIENT_CLASS(c) ((MBWMCompMgrClientClass*)(c))
#define MB_WM_TYPE_COMP_MGR_CLIENT (mb_wm_comp_mgr_client_class_type ())
#define MB_WM_COMP_MGR_EFFECT(c) ((MBWMCompMgrEffect*)(c))
#define MB_WM_COMP_MGR_EFFECT_CLASS(c) ((MBWMCompMgrEffectClass*)(c))
#define MB_WM_TYPE_COMP_MGR_EFFECT (mb_wm_comp_mgr_effect_class_type ())
struct MBWMCompMgr
{
MBWMObject parent;
@@ -57,6 +53,9 @@ struct MBWMCompMgrClass
void (*unmap_notify) (MBWMCompMgr * mgr, MBWindowManagerClient *c);
Bool (*handle_events) (MBWMCompMgr * mgr, XEvent *ev);
Bool (*my_window) (MBWMCompMgr * mgr, Window xwin);
void (*effect) (MBWMCompMgr * mgr,
MBWindowManagerClient *c1,
MBWMCompMgrEffectEvent event);
void (*transition) (MBWMCompMgr * mgr,
MBWindowManagerClient *c1,
MBWindowManagerClient *c2,
@@ -106,6 +105,11 @@ mb_wm_comp_mgr_do_transition (MBWMCompMgr * mgr,
MBWindowManagerClient * c2,
Bool reverse);
void
mb_wm_comp_mgr_do_effect (MBWMCompMgr * mgr,
MBWindowManagerClient * client,
MBWMCompMgrEffectEvent event);
struct MBWMCompMgrClient
{
MBWMObject parent;
@@ -113,7 +117,6 @@ struct MBWMCompMgrClient
MBWindowManagerClient * wm_client;
/* Make private ? */
MBWMList * effects; /* List of MBWMCompMgrEffectAssociation */
Bool is_argb32;
};
@@ -125,13 +128,6 @@ struct MBWMCompMgrClientClass
void (*hide) (MBWMCompMgrClient * client);
void (*repair) (MBWMCompMgrClient * client);
void (*configure) (MBWMCompMgrClient * client);
MBWMCompMgrEffect * (*effect_new) (MBWMCompMgrClient * client,
MBWMCompMgrEffectEvent event,
MBWMCompMgrEffectType type,
unsigned long duration,
MBWMGravity gravity);
};
int
@@ -149,43 +145,5 @@ mb_wm_comp_mgr_client_repair (MBWMCompMgrClient * client);
void
mb_wm_comp_mgr_client_configure (MBWMCompMgrClient * client);
void
mb_wm_comp_mgr_client_add_effects (MBWMCompMgrClient * client,
MBWMCompMgrEffectEvent event,
MBWMList * effects);
void
mb_wm_comp_mgr_client_run_effect (MBWMCompMgrClient * client,
MBWMCompMgrEffectEvent event);
MBWMList *
mb_wm_comp_mgr_client_get_effects (MBWMCompMgrClient * client,
MBWMCompMgrEffectEvent event,
MBWMCompMgrEffectType type,
unsigned long duration,
MBWMGravity gravity);
/*
* Generic effect that can applied to a client
*/
struct MBWMCompMgrEffect
{
MBWMObject parent;
MBWMCompMgrEffectType type;
unsigned long duration;
MBWMGravity gravity;
};
struct MBWMCompMgrEffectClass
{
MBWMObjectClass parent;
void (*run) (MBWMList * effects,
MBWMCompMgrClient * cm_client,
MBWMCompMgrEffectEvent event);
};
int
mb_wm_comp_mgr_effect_class_type ();
#endif

View File

@@ -969,8 +969,8 @@ mb_wm_client_iconize (MBWindowManagerClient *client)
*/
if (mb_wm_compositing_enabled (client->wmref))
{
mb_wm_comp_mgr_client_run_effect (client->cm_client,
MBWMCompMgrEffectEventMinimize);
mb_wm_comp_mgr_do_effect (client->wmref->comp_mgr, client,
MBWMCompMgrEffectEventMinimize);
}
#endif

View File

@@ -122,10 +122,6 @@ typedef struct MBWMCompMgrClutterClass MBWMCompMgrClutterClass;
typedef struct MBWMCompMgrClutterClient MBWMCompMgrClutterClient;
typedef struct MBWMCompMgrClutterClientClass MBWMCompMgrClutterClientClass;
typedef struct MBWMCompMgrClutterClentPrivate MBWMCompMgrClutterClientPrivate;
typedef struct MBWMCompMgrEffect MBWMCompMgrEffect;
typedef struct MBWMCompMgrEffectClass MBWMCompMgrEffectClass;
typedef struct MBWMCompMgrClutterEffect MBWMCompMgrClutterEffect;
typedef struct MBWMCompMgrClutterEffectClass MBWMCompMgrClutterEffectClass;
typedef enum MBWMClientType
{
@@ -151,35 +147,6 @@ typedef enum _MBWMCompMgrEffectEvent
_MBWMCompMgrEffectEventLast,
} MBWMCompMgrEffectEvent;
typedef enum _MBWMCompMgrEffectType
{
MBWMCompMgrEffectScaleUp = (1<<0), /* 0 reserved for unknown */
MBWMCompMgrEffectScaleDown = (1<<1),
MBWMCompMgrEffectSpinXCW = (1<<2),
MBWMCompMgrEffectSpinXCCW = (1<<3),
MBWMCompMgrEffectSpinYCW = (1<<4),
MBWMCompMgrEffectSpinYCCW = (1<<5),
MBWMCompMgrEffectSpinZCW = (1<<6),
MBWMCompMgrEffectSpinZCCW = (1<<7),
MBWMCompMgrEffectFade = (1<<8),
MBWMCompMgrEffectUnfade = (1<<9),
MBWMCompMgrEffectSlideIn = (1<<10),
MBWMCompMgrEffectSlideOut = (1<<11),
_MBWMCompMgrEffectLast,
} MBWMCompMgrEffectType;
typedef enum _MBWMCompMgrTransitionType
{
MBWMCompMgrTransitionFade = 1, /* 0 reserved for unknown */
MBWMCompMgrTransitionSlide,
_MBWMCompMgrTransitionLast,
} MBWMCompMgrTransitionType;
typedef void (*MBWMCompMgrEffectCallback) (void * data);
typedef enum _MBWMGravity
{
MBWMGravityNone = 0,

View File

@@ -77,14 +77,6 @@ mb_wm_xml_decor_free (MBWMXmlDecor * d)
free (d);
}
#if ENABLE_COMPOSITE
static void
mb_wm_theme_effects_free (MBWMThemeEffects *e)
{
free (e);
}
#endif
MBWMXmlClient *
mb_wm_xml_client_new ()
{
@@ -117,22 +109,6 @@ mb_wm_xml_client_free (MBWMXmlClient * c)
l = n;
}
#if ENABLE_COMPOSITE
l = c->effects;
while (l)
{
MBWMThemeEffects * e = l->data;
MBWMList * n = l->next;
mb_wm_theme_effects_free (e);
free (l);
l = n;
}
if (c->transition)
free (c->transition);
#endif
free (c);
}

View File

@@ -64,11 +64,6 @@ typedef struct Client
MBWMList *decors;
MBWMClientLayoutHints layout_hints;
#if ENABLE_COMPOSITE
MBWMList *effects;
MBWMThemeTransition *transition;
#endif
}MBWMXmlClient;
MBWMXmlButton *

View File

@@ -314,8 +314,6 @@ typedef enum
XML_CTX_DECOR,
XML_CTX_BUTTON,
XML_CTX_IMG,
XML_CTX_EFFECT,
XML_CTX_TRANSITION,
} XmlCtx;
struct stack_data
@@ -587,50 +585,6 @@ mb_wm_theme_get_client_layout_hints (MBWMTheme * theme,
return c->layout_hints;
}
#if ENABLE_COMPOSITE
const MBWMList *
mb_wm_theme_get_client_effects (MBWMTheme * theme,
MBWindowManagerClient * client)
{
MBWMXmlClient * c;
MBWMClientType c_type;
if (!client || !theme)
return NULL;
c_type = MB_WM_CLIENT_CLIENT_TYPE (client);
if (!theme->xml_clients ||
!(c = mb_wm_xml_client_find_by_type (theme->xml_clients, c_type)))
{
return NULL;
}
return c->effects;
}
MBWMThemeTransition *
mb_wm_theme_get_client_transition (MBWMTheme * theme,
MBWindowManagerClient * client)
{
MBWMXmlClient * c;
MBWMClientType c_type;
if (!client || !theme)
return NULL;
c_type = MB_WM_CLIENT_CLIENT_TYPE (client);
if (!theme->xml_clients ||
!(c = mb_wm_xml_client_find_by_type (theme->xml_clients, c_type)))
{
return NULL;
}
return c->transition;
}
#endif
/*
* Returns True if the theme prescribes at least one value for the geometry
*/
@@ -1078,248 +1032,6 @@ xml_element_start_cb (void *data, const char *tag, const char **expat_attr)
return;
}
#if ENABLE_COMPOSITE
if (!strcmp (tag, "effect"))
{
MBWMThemeEffects *eff = mb_wm_util_malloc0 (sizeof (MBWMThemeEffects));
const char **p = expat_attr;
XmlCtx ctx = xml_stack_top_ctx (exd->stack);
MBWMXmlClient *c = xml_stack_top_data (exd->stack);
xml_stack_push (&exd->stack, XML_CTX_EFFECT);
if (ctx != XML_CTX_CLIENT || !c)
{
MBWM_DBG ("Expected context client");
return;
}
while (*p)
{
if (!strcmp (*p, "event"))
{
if (!strcmp (*(p+1), "minimize"))
eff->event = MBWMCompMgrEffectEventMinimize;
else if (!strcmp (*(p+1), "map"))
eff->event = MBWMCompMgrEffectEventMap;
else if (!strcmp (*(p+1), "unmap"))
eff->event = MBWMCompMgrEffectEventUnmap;
}
else if (!strcmp (*p, "duration"))
eff->duration = atoi (*(p+1));
else if (!strcmp (*p, "gravity"))
{
const char * g = *(p+1);
if (!strncmp (g, "none", 2))
eff->gravity = MBWMGravityNone;
else if (!strncmp (g, "nw", 2))
eff->gravity = MBWMGravityNorthWest;
else if (!strncmp (g, "ne", 2))
eff->gravity = MBWMGravityNorthEast;
else if (!strncmp (g, "sw", 2))
eff->gravity = MBWMGravitySouthWest;
else if (!strncmp (g, "se", 2))
eff->gravity = MBWMGravitySouthEast;
else
{
switch (*g)
{
case 'n':
eff->gravity = MBWMGravityNorth; break;
case 's':
eff->gravity = MBWMGravitySouth; break;
case 'w':
eff->gravity = MBWMGravityWest; break;
case 'e':
eff->gravity = MBWMGravityEast; break;
default:
eff->gravity = MBWMGravityNone;
}
}
}
else if (!strcmp (*p, "type"))
{
const char *e = *(p+1);
while (e && *e)
{
char *bar;
if (!strncmp (e, "scale-up", 8))
{
eff->type |= MBWMCompMgrEffectScaleUp;
}
else if (!strncmp (e, "scale-down", 12))
{
eff->type |= MBWMCompMgrEffectScaleDown;
}
else if (!strncmp (e, "scale-down", 12))
{
eff->type |= MBWMCompMgrEffectScaleDown;
}
else if (!strncmp (e, "spin-xcw", 8))
{
eff->type |= MBWMCompMgrEffectSpinXCW;
}
else if (!strncmp (e, "spin-xccw", 9))
{
eff->type |= MBWMCompMgrEffectSpinXCCW;
}
else if (!strncmp (e, "spin-ycw", 8))
{
eff->type |= MBWMCompMgrEffectSpinYCW;
}
else if (!strncmp (e, "spin-yccw", 9))
{
eff->type |= MBWMCompMgrEffectSpinYCCW;
}
else if (!strncmp (e, "spin-zcw", 8))
{
eff->type |= MBWMCompMgrEffectSpinZCW;
}
else if (!strncmp (e, "spin-zccw", 9))
{
eff->type |= MBWMCompMgrEffectSpinZCCW;
}
else if (!strncmp (e, "fade", 4))
{
eff->type |= MBWMCompMgrEffectFade;
}
else if (!strncmp (e, "unfade", 4))
{
eff->type |= MBWMCompMgrEffectUnfade;
}
else if (!strncmp (e, "slide-in", 8))
{
eff->type |= MBWMCompMgrEffectSlideIn;
}
else if (!strncmp (e, "slide-out", 9))
{
eff->type |= MBWMCompMgrEffectSlideOut;
}
bar = strchr (e, '|');
if (bar)
e = bar + 1;
else
break;
}
}
p += 2;
}
if (!eff->event || !eff->type)
{
free (eff);
return;
}
/*
* Default to sensible value when no duration set
*/
if (!eff->duration)
eff->duration = 200;
c->effects = mb_wm_util_list_prepend (c->effects, eff);
xml_stack_top_set_data (exd->stack, eff);
return;
}
if (!strcmp (tag, "transition"))
{
MBWMThemeTransition *trs;
XmlCtx ctx = xml_stack_top_ctx (exd->stack);
MBWMXmlClient *c = xml_stack_top_data (exd->stack);
const char **p = expat_attr;
trs = mb_wm_util_malloc0 (sizeof (MBWMThemeTransition));
xml_stack_push (&exd->stack, XML_CTX_TRANSITION);
if (ctx != XML_CTX_CLIENT || !c)
{
MBWM_DBG ("Expected context client");
return;
}
while (*p)
{
if (!strcmp (*p, "type"))
{
const char *e = *(p+1);
if (!strncmp (e, "fade", 4))
{
trs->type = MBWMCompMgrTransitionFade;
}
else if (!strncmp (e, "slide", 5))
{
trs->type = MBWMCompMgrTransitionSlide;
}
else if (!strcmp (*p, "gravity"))
{
const char * g = *(p+1);
if (!strncmp (g, "none", 2))
trs->gravity = MBWMGravityNone;
else if (!strncmp (g, "nw", 2))
trs->gravity = MBWMGravityNorthWest;
else if (!strncmp (g, "ne", 2))
trs->gravity = MBWMGravityNorthEast;
else if (!strncmp (g, "sw", 2))
trs->gravity = MBWMGravitySouthWest;
else if (!strncmp (g, "se", 2))
trs->gravity = MBWMGravitySouthEast;
else
{
switch (*g)
{
case 'n':
trs->gravity = MBWMGravityNorth; break;
case 's':
trs->gravity = MBWMGravitySouth; break;
case 'w':
trs->gravity = MBWMGravityWest; break;
case 'e':
trs->gravity = MBWMGravityEast; break;
default:
trs->gravity = MBWMGravityNone;
}
}
}
}
else if (!strcmp (*p, "duration"))
trs->duration = atoi (*(p+1));
p += 2;
}
if (!trs->type)
{
free (trs);
return;
}
/*
* Default to sensible value when no duration set
*/
if (!trs->duration)
trs->duration = 200;
c->transition = trs;
xml_stack_top_set_data (exd->stack, trs);
return;
}
#endif
if (!strcmp (tag, "decor"))
{
MBWMXmlDecor * d = mb_wm_xml_decor_new ();
@@ -1548,24 +1260,6 @@ xml_element_end_cb (void *data, const char *tag)
else
MBWM_DBG ("Expected client on the top of the stack!");
}
else if (!strcmp (tag, "effect"))
{
if (ctx == XML_CTX_EFFECT)
{
xml_stack_pop (&exd->stack);
}
else
MBWM_DBG ("Expected effect on the top of the stack!");
}
else if (!strcmp (tag, "transition"))
{
if (ctx == XML_CTX_TRANSITION)
{
xml_stack_pop (&exd->stack);
}
else
MBWM_DBG ("Expected transition on the top of the stack!");
}
else if (!strcmp (tag, "decor"))
{
if (ctx == XML_CTX_DECOR)

View File

@@ -40,23 +40,6 @@
#define MB_WM_THEME_PNG_CLASS(c) ((MBWMThemePngClass*)(c))
#define MB_WM_TYPE_THEME_PNG (mb_wm_theme_png_class_type ())
#if ENABLE_COMPOSITE
typedef struct _MBWMThemeEffects
{
MBWMCompMgrEffectEvent event;
MBWMCompMgrEffectType type;
unsigned long duration;
MBWMGravity gravity;
} MBWMThemeEffects;
typedef struct _MBWMThemeTransition
{
MBWMCompMgrTransitionType type;
unsigned long duration;
MBWMGravity gravity;
} MBWMThemeTransition;
#endif
enum MBWMThemeCaps
{
MBWMThemeCapsFrameMainButtonActionAccept = (1<<0),
@@ -185,15 +168,6 @@ MBWMClientLayoutHints
mb_wm_theme_get_client_layout_hints (MBWMTheme * theme,
MBWindowManagerClient * client);
#if ENABLE_COMPOSITE
const MBWMList *
mb_wm_theme_get_client_effects (MBWMTheme * theme,
MBWindowManagerClient * client);
MBWMThemeTransition *
mb_wm_theme_get_client_transition (MBWMTheme * theme,
MBWindowManagerClient * client);
#endif
Bool
mb_wm_theme_is_client_shaped (MBWMTheme * theme,
MBWindowManagerClient * client);