diff --git a/gstplay/ChangeLog b/gstplay/ChangeLog index 232e5227d5..10b446a084 100644 --- a/gstplay/ChangeLog +++ b/gstplay/ChangeLog @@ -1,3 +1,11 @@ +2001-12-06 Arik Devens + + * gstmediaplay.c (fullscreen_key_press_event): Added a case for + the q key to switch out of fullscreen. + (gst_media_play_init): Added signal connect for catching key + events. + (window_key_press_event): On space pause / play the media. + 2001-12-04 Arik Devens This is a minor update on a few things while i work on getting the diff --git a/gstplay/Makefile.am b/gstplay/Makefile.am index 5efea227c0..b30d421cab 100644 --- a/gstplay/Makefile.am +++ b/gstplay/Makefile.am @@ -2,6 +2,8 @@ # FIXME FIXME +LIBADD += $(GNOME_LIBS) $(GST_LIBS) +CFLAGS += $(GNOME_CFLAGS) $(LIBGLADE_GNOME_CFLAGS) $(GST_CFLAGS) -DDATADIR=\""$(gladedir)/"\" bin_PROGRAMS = gstmediaplay @@ -34,6 +36,6 @@ noinst_HEADERS = \ gstplayprivate.h libgstmediaplay_la_LDFLAGS = -rdynamic -libgstmediaplay_la_CFLAGS = $(GNOME_CFLAGS) $(LIBGLADE_GNOME_CFLAGS) $(GST_CFLAGS) -DDATADIR=\""$(gladedir)/"\" -gstmediaplay_CFLAGS = $(LIBGLADE_GNOME_CFLAGS) $(GNOME_CFLAGS) $(LIBGLADE_GNOME_CFLAGS) $(GST_CFLAGS) -DDATADIR=\""$(gladedir)/"\" + +gstmediaplay_CFLAGS = $(LIBGLADE_GNOME_CFLAGS) gstmediaplay_LDADD = $(GST_LIBS) $(LIBGLADE_GNOME_LIBS) libgstmediaplay.la diff --git a/gstplay/gstmediaplay.c b/gstplay/gstmediaplay.c index b468caae92..c951871162 100644 --- a/gstplay/gstmediaplay.c +++ b/gstplay/gstmediaplay.c @@ -10,6 +10,8 @@ static void gst_media_play_class_init (GstMediaPlayClass *klass); static void gst_media_play_init (GstMediaPlay *play); +static int window_key_press_event (GtkWidget *widget, GdkEventKey *event, GstMediaPlay *mplay); + static void gst_media_play_set_arg (GtkObject *object, GtkArg *arg, guint id); static void gst_media_play_get_arg (GtkObject *object, GtkArg *arg, guint id); @@ -160,6 +162,9 @@ gst_media_play_init (GstMediaPlay *mplay) mplay->window = glade_xml_get_widget (mplay->xml, "gstplay"); g_assert (mplay->window != NULL); + gtk_signal_connect (GTK_OBJECT (mplay->window), "key_press_event", + (GtkSignalFunc) window_key_press_event, mplay); + gtk_drag_dest_set (mplay->window, GTK_DEST_DEFAULT_ALL, target_table, 1, @@ -201,6 +206,33 @@ gst_media_play_init (GstMediaPlay *mplay) mplay->last_time = 0; } +static int +window_key_press_event (GtkWidget *widget, + GdkEventKey *event, + GstMediaPlay *mplay) +{ + switch (event->keyval) { + case GDK_space: + if (mplay->play->state == GST_PLAY_PLAYING) + { + gdk_threads_leave (); + gst_play_pause (mplay->play); + gdk_threads_enter (); + update_buttons (mplay, GST_PLAY_STATE(mplay->play)); + } + else if (mplay->play->state == GST_PLAY_PAUSED) + { + gdk_threads_leave (); + gst_play_play (mplay->play); + gdk_threads_enter (); + update_buttons (mplay, GST_PLAY_STATE(mplay->play)); + } + break; + } + + return TRUE; +} + GstMediaPlay * gst_media_play_new () { @@ -493,6 +525,9 @@ fullscreen_key_press_event (GtkWidget *widget, case GDK_Escape: gst_media_play_set_fullscreen (mplay); break; + case GDK_q: + gst_media_play_set_fullscreen (mplay); + break; } return TRUE;