a working makefile.am and new key event handling for q to leave fullscreen and space...
authorArik Devens <arik@gnome.org>
Thu, 6 Dec 2001 12:56:10 +0000 (12:56 +0000)
committerArik Devens <arik@gnome.org>
Thu, 6 Dec 2001 12:56:10 +0000 (12:56 +0000)
Original commit message from CVS:
a working makefile.am and new key event handling for q to leave fullscreen and space to pause/play media

gstplay/ChangeLog
gstplay/Makefile.am
gstplay/gstmediaplay.c

index 232e522..10b446a 100644 (file)
@@ -1,3 +1,11 @@
+2001-12-06  Arik Devens  <arik@gnome.org>
+
+       * 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  <arik@gnome.org>
 
        This is a minor update on a few things while i work on getting the
index 5efea22..b30d421 100644 (file)
@@ -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
index b468caa..c951871 100644 (file)
@@ -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;