Update of /cvsroot/mplayerplug-in/mplayerplug-in/Source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11912/Source
Modified Files:
plugin-ui.cpp
Log Message:
Clicking on the media progress bar (not the download percent bar)
allows the user to seek within the media.
Index: plugin-ui.cpp
===================================================================
RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-ui.cpp,v
retrieving revision 1.166
retrieving revision 1.167
diff -C2 -d -r1.166 -r1.167
*** plugin-ui.cpp 25 Oct 2005 01:27:46 -0000 1.166
--- plugin-ui.cpp 30 Oct 2005 20:19:58 -0000 1.167
***************
*** 904,907 ****
--- 904,933 ----
}
+ gboolean mediaprogress_callback(GtkWidget * widget, GdkEventButton * event,
+ nsPluginInstance * instance)
+ {
+ int width;
+ int height;
+ float percent;
+ float seektime;
+
+ gtk_widget_get_size_request(widget, &width, &height);
+
+
+ percent = event->x / width;
+ seektime = instance->mediaLength * percent;
+
+ if (DEBUG) {
+ printf("widget size: %i x %i\n",width,height);
+ printf("mouse click at %f x %f\n",event->x,event->y);
+ printf("percent = %f\nseektime = %f\n",percent,seektime);
+ }
+ if (seektime > 0)
+ instance->Seek(seektime);
+
+ return TRUE;
+ }
+
+
gboolean mousenotify_callback(GtkWidget * widget, GdkEventCrossing * event,
nsPluginInstance * instance)
***************
*** 1176,1179 ****
--- 1202,1217 ----
width * multiplier - 20 - width),
height - 4);
+ gtk_widget_set_events(GTK_WIDGET(instance->mediaprogress_bar),
+ GDK_BUTTON_PRESS_MASK);
+ #ifdef GTK2_ENABLED
+ g_signal_connect(G_OBJECT(instance->mediaprogress_bar),
+ "button_press_event",
+ G_CALLBACK(mediaprogress_callback), instance);
+ #endif
+ #ifdef GTK1_ENABLED
+ gtk_signal_connect(GTK_OBJECT(instance->mediaprogress_bar),
+ "button_press_event",
+ GTK_SIGNAL_FUNC(mediaprogress_callback), instance);
+ #endif
gtk_fixed_put(GTK_FIXED(instance->fixed_container),
GTK_WIDGET(instance->mediaprogress_bar),
|