[cvs-annodex] commit (/annodex): gabby/trunk/data/gabby.glade gabby/trunk/src/Makefile.am gabby/trunk/src/main.c gabby/trunk/src/player.h gabby/trunk/src/player_xine.c +gabby/trunk/src/video.c +gabby/trunk/src/video.h

conrad nobody at lists.annodex.net
Sun Feb 13 10:39:24 EST 2005


Update of /annodex (new revision 882)

Added files:
   gabby/trunk/src/video.c
   gabby/trunk/src/video.h

Modified files:
   gabby/trunk/data/gabby.glade
   gabby/trunk/src/Makefile.am
   gabby/trunk/src/main.c
   gabby/trunk/src/player.h
   gabby/trunk/src/player_xine.c

Log Message:
handle X11 resize and expose events for video resizing
(after screwing around with X11 resizing in VLC/AFE for a few days to no avail,
I realized what was really needed was a simple self-contained testbed for
resizing embedded X11 video, and this fit the task.)
Now to move on to VLC/AFE ...


Modified: gabby/trunk/data/gabby.glade
===================================================================
--- gabby/trunk/data/gabby.glade	2005-02-12 01:41:50 UTC (rev 881)
+++ gabby/trunk/data/gabby.glade	2005-02-12 23:39:21 UTC (rev 882)
@@ -21,6 +21,7 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
   <property name="enable_layout_config">True</property>
   <signal name="delete_event" handler="gtk_main_quit" last_modification_time="Sat, 04 Dec 2004 22:54:36 GMT"/>
   <signal name="destroy_event" handler="gtk_main_quit" last_modification_time="Sat, 04 Dec 2004 22:54:48 GMT"/>
@@ -540,6 +541,10 @@
 			  <property name="yalign">0.5</property>
 			  <property name="xpad">4</property>
 			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
@@ -619,6 +624,10 @@
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
 		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
 		    </widget>
 		    <packing>
 		      <property name="padding">8</property>
@@ -741,6 +750,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -816,6 +829,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -891,6 +908,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -966,6 +987,10 @@
 				  <property name="yalign">0.5</property>
 				  <property name="xpad">0</property>
 				  <property name="ypad">0</property>
+				  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				  <property name="width_chars">-1</property>
+				  <property name="single_line_mode">False</property>
+				  <property name="angle">0</property>
 				</widget>
 				<packing>
 				  <property name="padding">0</property>
@@ -999,6 +1024,7 @@
 	      <property name="visible">True</property>
 	      <property name="visible_window">True</property>
 	      <property name="above_child">False</property>
+	      <signal name="expose_event" handler="on_video_eventbox_expose_event" last_modification_time="Sat, 12 Feb 2005 20:57:50 GMT"/>
 
 	      <child>
 		<placeholder/>
@@ -1042,6 +1068,7 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
   <property name="copyright" translatable="yes">CSIRO Australia 2004</property>
   <property name="comments" translatable="yes">A browser for Annodex media</property>
   <property name="authors">Conrad Parker
@@ -1068,6 +1095,7 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
 
   <child internal-child="vbox">
     <widget class="GtkVBox" id="dialog-vbox1">
@@ -1134,6 +1162,7 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
   <signal name="delete_event" handler="gtk_widget_hide" object="source_window" last_modification_time="Wed, 08 Dec 2004 01:44:21 GMT"/>
   <signal name="destroy_event" handler="gtk_widget_hide" object="source_window" last_modification_time="Wed, 08 Dec 2004 01:44:36 GMT"/>
 
@@ -1183,6 +1212,7 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
   <signal name="delete_event" handler="gtk_widget_hide" object="cliplist_window" last_modification_time="Tue, 14 Dec 2004 01:03:05 GMT"/>
   <signal name="destroy_event" handler="gtk_widget_hide" object="cliplist_window" last_modification_time="Tue, 14 Dec 2004 01:03:20 GMT"/>
 
@@ -1208,6 +1238,9 @@
 	      <property name="rules_hint">False</property>
 	      <property name="reorderable">False</property>
 	      <property name="enable_search">True</property>
+	      <property name="fixed_height_mode">False</property>
+	      <property name="hover_selection">False</property>
+	      <property name="hover_expand">False</property>
 	    </widget>
 	  </child>
 	</widget>
@@ -1230,6 +1263,7 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
   <signal name="delete_event" handler="gtk_widget_hide" object="desc_window" last_modification_time="Tue, 14 Dec 2004 01:06:22 GMT"/>
   <signal name="destroy_event" handler="gtk_widget_hide" object="desc_window" last_modification_time="Tue, 14 Dec 2004 01:06:36 GMT"/>
 

Modified: gabby/trunk/src/Makefile.am
===================================================================
--- gabby/trunk/src/Makefile.am	2005-02-12 01:41:50 UTC (rev 881)
+++ gabby/trunk/src/Makefile.am	2005-02-12 23:39:21 UTC (rev 882)
@@ -8,7 +8,7 @@
 bin_PROGRAMS = gabby
 
 noinst_HEADERS = cliplist.h ghistory.h http.h navigate.h player.h \
-	resource.h url.h util.h
+	resource.h url.h util.h video.h
 
 gabby_SOURCES = \
 	main.c \
@@ -21,7 +21,8 @@
 	resource.c \
 	search.c \
 	url.c \
-	util.c
+	util.c \
+	video.c
 
 gabby_LDADD = @PACKAGE_LIBS@ @CURL_LIBS@ $(INTLLIBS)
 gabby_LDFLAGS = -export-dynamic

Modified: gabby/trunk/src/main.c
===================================================================
--- gabby/trunk/src/main.c	2005-02-12 01:41:50 UTC (rev 881)
+++ gabby/trunk/src/main.c	2005-02-12 23:39:21 UTC (rev 882)
@@ -9,7 +9,7 @@
 #include <gnome.h>
 #include <glade/glade.h>
 
-#include "player.h"
+#include "video.h"
 #include "cliplist.h"
 
 GtkWidget * app1 = NULL;
@@ -20,25 +20,6 @@
 static int saved_argc;
 static char ** saved_argv;
 
-static int
-video_init (GladeXML * xml)
-{
-  GtkWidget * video_eventbox;
-  Window video_parent;
-
-  video_eventbox = glade_xml_get_widget (xml, "video_eventbox");
-  if (video_eventbox) {
-    GdkWindow * gwindow;
-    gint x, y, width, height, depth;
-    gwindow = video_eventbox->window;
-    gdk_window_get_geometry (gwindow, &x, &y, &width, &height, &depth);
-    video_parent = GDK_WINDOW_XWINDOW (gwindow);
-    player_init(video_parent, width, height);
-  }
-
-  return 0;
-}
-
 static gboolean
 load_init (gpointer data)
 {

Modified: gabby/trunk/src/player.h
===================================================================
--- gabby/trunk/src/player.h	2005-02-12 01:41:50 UTC (rev 881)
+++ gabby/trunk/src/player.h	2005-02-12 23:39:21 UTC (rev 882)
@@ -1,12 +1,16 @@
 #ifndef __PLAYER_H__
 #define __PLAYER_H__
 
-#include <X11/X.h>
+#include <X11/Xlib.h>
 
 int player_init (Window parent, int width, int height);
 
 int player_close (void);
 
+int player_handle_events (void);
+
+int player_resize (int x, int y);
+
 int player_play (const char * url, double seconds);
 
 int player_clear (void);

Modified: gabby/trunk/src/player_xine.c
===================================================================
--- gabby/trunk/src/player_xine.c	2005-02-12 01:41:50 UTC (rev 881)
+++ gabby/trunk/src/player_xine.c	2005-02-12 23:39:21 UTC (rev 882)
@@ -177,6 +177,66 @@
 }
 
 int
+player_resize (int new_width, int new_height)
+{
+  width = new_width;
+  height = new_height;
+
+  XResizeWindow (display, window, new_width, new_height);
+
+  return 0;
+}
+
+int
+player_handle_events (void)
+{
+  XEvent xevent;
+  int    got_event;
+
+  XLockDisplay(display);
+  got_event = XCheckMaskEvent(display, INPUT_MOTION, &xevent);
+  XUnlockDisplay(display);
+    
+  if( !got_event ) {
+    return 0;
+  }
+
+  switch(xevent.type) {
+
+  case Expose:
+    if(xevent.xexpose.count != 0)
+      break;
+    xine_gui_send_vo_data(stream, XINE_GUI_SEND_EXPOSE_EVENT, &xevent);
+    break;
+      
+  case ConfigureNotify:
+    {
+      XConfigureEvent *cev = (XConfigureEvent *) &xevent;
+      Window           tmp_win;
+	
+      width  = cev->width;
+      height = cev->height;
+	
+      if((cev->x == 0) && (cev->y == 0)) {
+	XLockDisplay(display);
+	XTranslateCoordinates(display, cev->window,
+			      DefaultRootWindow(cev->display),
+			      0, 0, &xpos, &ypos, &tmp_win);
+	XUnlockDisplay(display);
+      }
+      else {
+	xpos = cev->x;
+	ypos = cev->y;
+      }
+    }
+    break;
+
+  }
+
+  return 0;
+}
+
+int
 player_play (const char * url, double seconds)
 {
   player_clear ();

Added: gabby/trunk/src/video.c
===================================================================
--- gabby/trunk/src/video.c	2005-02-12 01:41:50 UTC (rev 881)
+++ gabby/trunk/src/video.c	2005-02-12 23:39:21 UTC (rev 882)
@@ -0,0 +1,56 @@
+/*
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <gdk/gdkx.h>
+#include <gnome.h>
+#include <glade/glade.h>
+
+#include "player.h"
+
+int
+on_video_eventbox_expose_event (GtkWidget * widget,
+				GdkEventExpose * event)
+{
+  GdkWindow * gwindow;
+  gint x, y, width, height, depth;
+
+  gwindow = widget->window;
+  gdk_window_get_geometry (gwindow, &x, &y, &width, &height, &depth);
+
+  player_resize (width, height);
+
+  return TRUE;
+}
+
+static gboolean
+video_handle_events (gpointer data)
+{
+  player_handle_events ();
+  return TRUE;
+}
+
+int
+video_init (GladeXML * xml)
+{
+  GtkWidget * video_eventbox;
+  Window video_parent;
+
+  video_eventbox = glade_xml_get_widget (xml, "video_eventbox");
+  if (video_eventbox) {
+    GdkWindow * gwindow;
+    gint x, y, width, height, depth;
+
+    /* Embed the player window in the video window */
+    gwindow = video_eventbox->window;
+    gdk_window_get_geometry (gwindow, &x, &y, &width, &height, &depth);
+    video_parent = GDK_WINDOW_XWINDOW (gwindow);
+    player_init(video_parent, width, height);
+    gtk_idle_add (video_handle_events, NULL);
+  }
+
+  return 0;
+}

Added: gabby/trunk/src/video.h
===================================================================
--- gabby/trunk/src/video.h	2005-02-12 01:41:50 UTC (rev 881)
+++ gabby/trunk/src/video.h	2005-02-12 23:39:21 UTC (rev 882)
@@ -0,0 +1,6 @@
+#ifndef __VIDEO_H__
+#define __VIDEO_H__
+
+int video_init (GladeXML * xml);
+
+#endif /* __VIDEO_H__ */


-- 
conrad



More information about the cvs-annodex mailing list