From: Darren S. <ds...@us...> - 2006-03-01 18:43:29
|
Update of /cvsroot/xine/gnome-xine/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20877/src Modified Files: player.c Log Message: Video resize fix. Should prevent wrongly-sized video widget when resizing under load. Index: player.c =================================================================== RCS file: /cvsroot/xine/gnome-xine/src/player.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- player.c 28 Feb 2006 18:13:53 -0000 1.72 +++ player.c 1 Mar 2006 18:43:25 -0000 1.73 @@ -557,18 +557,26 @@ #endif /* WITH_DEPRECATED */ -static gboolean set_video_size_cb (const int *zoom) +static int zoomcb, zoomcb_id = 0; + +static gboolean video_rescale_cb (gpointer unused) +{ + gtk_video_rescale ((GtkVideo *) gtv, zoomcb); + zoomcb_id = 0; + return FALSE; +} + +static gboolean set_video_size_cb (gpointer unused) { gdk_threads_enter (); /* find & activate an action item which corresponds to the requested scale */ - GtkAction *action = find_video_size_action (*zoom); + GtkAction *action = find_video_size_action (zoomcb); if (action) gtk_action_activate (action); else { - scale_changed_cb (NULL, *zoom, NULL); - do_pending_events (); - gtk_video_rescale ((GtkVideo *) gtv, *zoom); + scale_changed_cb (NULL, zoomcb, NULL); + zoomcb_id = g_idle_add ((GSourceFunc) video_rescale_cb, NULL); } gdk_threads_leave (); return FALSE; @@ -577,20 +585,22 @@ static JSBool js_set_video_size (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { - int32 *zoom = malloc (sizeof (int)); - se_log_fncall ("set_video_size"); se_argc_check (1, "set_video_size"); se_arg_is_int (0, "set_video_size"); - JS_ValueToInt32 (cx, argv[0], zoom); - - if (*zoom < GXINE_VO_ZOOM_MIN) - *zoom = GXINE_VO_ZOOM_MIN; - else if (*zoom > XINE_VO_ZOOM_MAX) - *zoom = XINE_VO_ZOOM_MAX; + int32 zoom; + JS_ValueToInt32 (cx, argv[0], &zoom); - g_idle_add ((GSourceFunc) set_video_size_cb, zoom); + if (zoom < GXINE_VO_ZOOM_MIN) + zoom = GXINE_VO_ZOOM_MIN; + else if (zoom > XINE_VO_ZOOM_MAX) + zoom = XINE_VO_ZOOM_MAX; + + zoomcb = zoom; + if (zoomcb_id) + g_source_remove (zoomcb_id); + zoomcb_id = g_idle_add ((GSourceFunc) set_video_size_cb, NULL); return JS_TRUE; } |