diff options
author | Filippo Argiolas <filippo.argiolas@gmail.com> | 2009-04-05 19:05:23 +0200 |
---|---|---|
committer | Filippo Argiolas <filippo.argiolas@gmail.com> | 2009-04-05 19:58:52 +0200 |
commit | 43f2e50bbc0f9bee8372c9f23f452b706f7fe32b (patch) | |
tree | fca3351a264e919fc9863f26458512b4ddbe59ff | |
parent | a5c2798e02dd487c6441e18f266faaa69dcb7a02 (diff) |
First try with ClutterAnimations
Try to add a simple on-mouse-over with clutter_actor_animate
Position video windows offscreen so that they don't steal input to the
stage. Probably not the proper way to do it.
-rw-r--r-- | src/cheese-stage.c | 30 | ||||
-rw-r--r-- | src/cheese-texture.c | 14 |
2 files changed, 35 insertions, 9 deletions
diff --git a/src/cheese-stage.c b/src/cheese-stage.c index 089290d..005118a 100644 --- a/src/cheese-stage.c +++ b/src/cheese-stage.c @@ -68,6 +68,26 @@ create_window (GstBus * bus, GstMessage * message, gpointer data) return GST_BUS_DROP; } +static gboolean +on_enter_animate (ClutterActor *actor, ClutterEvent *event, gpointer data) +{ + clutter_actor_animate (actor, CLUTTER_LINEAR, 200, + "scale-x", 1.0, + "scale-y", 1.0, + NULL); + return TRUE; +} + +static gboolean +on_leave_animate (ClutterActor *actor, ClutterEvent *event, gpointer data) +{ + clutter_actor_animate (actor, CLUTTER_LINEAR, 200, + "scale-x", 0.95, + "scale-y", 0.95, + NULL); + return TRUE; +} + int main (int argc, char *argv[]) { @@ -118,6 +138,9 @@ main (int argc, char *argv[]) CLUTTER_GRAVITY_CENTER); clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor[i]); clutter_actor_set_position (actor[i], xpos, ypos); + clutter_actor_set_reactive (actor[i], TRUE); + g_signal_connect (actor[i], "enter-event", G_CALLBACK (on_enter_animate), NULL); + g_signal_connect (actor[i], "leave-event", G_CALLBACK (on_leave_animate), NULL); if (xpos > (COLS - 1) * W) { xpos = 0; ypos += H + 1; @@ -125,8 +148,8 @@ main (int argc, char *argv[]) xpos += W + 1; clutter_actor_show (actor[i]); } - -/* desc = g_strdup_printf ("v4l2src ! " +/* + desc = g_strdup_printf ("v4l2src ! " "video/x-raw-yuv, width=640, height=480, framerate=30/1 ! " "videoscale ! videorate ! " "video/x-raw-yuv, width=%d, height=%d, framerate=15/1 ! " @@ -134,8 +157,7 @@ main (int argc, char *argv[]) */ desc = g_strdup_printf ("videotestsrc ! " - "video/x-raw-rgb, width=%d, height=%d, framerate=10/1 ! ffmpegcolorspace ! identity", - W, H); + "video/x-raw-rgb, width=%d, height=%d, framerate=10/1 ! ffmpegcolorspace ! identity", W, H); pipeline = GST_PIPELINE (gst_pipeline_new (NULL)); srcbin = gst_parse_bin_from_description (desc, TRUE, NULL); diff --git a/src/cheese-texture.c b/src/cheese-texture.c index 1c4754f..bb546f7 100644 --- a/src/cheese-texture.c +++ b/src/cheese-texture.c @@ -60,11 +60,11 @@ on_x_event_filter (XEvent * xev, ClutterEvent * cev, gpointer data) switch (xev->type) { case MapNotify: - g_message ("stage mapped %d", xev->xmap.window); + g_message ("stage mapped %ld", xev->xmap.window); XMapWindow (xev->xmap.display, window); break; case UnmapNotify: - g_message ("stage unmapped %d", xev->xmap.window); + g_message ("stage unmapped %ld", xev->xmap.window); XUnmapWindow (xev->xmap.display, window); break; default: @@ -118,14 +118,18 @@ cheese_texture_init (CheeseTexture * self) stage_win = clutter_x11_get_stage_window (CLUTTER_STAGE (stage)); attr.background_pixel = BlackPixel (disp, DefaultScreen (disp)); - attr.override_redirect = True; attr.event_mask = SubstructureNotifyMask | StructureNotifyMask; - mask = CWEventMask | CWBackPixel | CWOverrideRedirect; + mask = CWEventMask | CWBackPixel; +/* win = XCreateSimpleWindow (disp, stage_win, + 0, 0, DEFAULT_W, DEFAULT_H, 0, 0, BlackPixel (disp, DefaultScreen (disp))); +*/ +/* FIXME: Find a way to not steal parent's input */ win = XCreateWindow (disp, stage_win, - 0, 0, DEFAULT_W, DEFAULT_H, 0, + -20000, -20000, DEFAULT_W, DEFAULT_H, 0, CopyFromParent, InputOutput, CopyFromParent, mask, &attr); + priv->parent = stage_win; XCompositeRedirectWindow (disp, win, CompositeRedirectManual); |