[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-cvslog
Subject:    [xine-cvs] HG: gxine: Make slider widgets for missing properties
From:       Darren Salt <linux () youmustbejoking ! demon ! co ! uk>
Date:       2008-02-25 18:13:31
Message-ID: 69d9c188603f807c3fd1.1203960365 () hg ! debian ! org
[Download RAW message or body]

# HG changeset patch
# User Darren Salt <linux@youmustbejoking.demon.co.uk>
# Date 1203960365 0
# Node ID 69d9c188603f807c3fd1477d77b27d6edd3a16d3
# Parent  45fefa12bec95edaf9bc2c65abd631947dcd8e64
Make slider widgets for missing properties insensitive (given xine-lib-1.2).

diff -r 69d9c188603f807c3fd1477d77b27d6edd3a16d3 -r \
                45fefa12bec95edaf9bc2c65abd631947dcd8e64 ChangeLog
--- a/ChangeLog	Mon Feb 25 17:26:05 2008 +0000
+++ b/ChangeLog	Sun Feb 24 18:50:29 2008 +0000
@@ -110,6 +110,12 @@ 0.5.900:2007/??/??
 	* Make sure that GnomeVFS is always initialised (if available).
 	* Initialise GNOME's authentication manager (if available).
 
+	+ The following changes are active if gxine was built against current
+	  xine-lib 1.2:
+
+	* Allow slider widgets to be disabled if the corresponding support
+	  isn't available in the video driver.
+
 0.5.11:	2007/02/01
 	[dsalt]
 	* Always connect to the "toggled" signal for post-plugin prefs buttons.
diff -r 69d9c188603f807c3fd1477d77b27d6edd3a16d3 -r \
                45fefa12bec95edaf9bc2c65abd631947dcd8e64 src/gtkvideo.c
--- a/src/gtkvideo.c	Mon Feb 25 17:26:05 2008 +0000
+++ b/src/gtkvideo.c	Sun Feb 24 18:50:29 2008 +0000
@@ -76,6 +76,8 @@
 #include <gtk/gtkmain.h>
 #include <gdk/gdkx.h>
 #include <xine.h>
+/* for get_capabilities() */
+#include <xine/video_out.h>
 
 #include "gtkvideo.h"
 #include "globals.h"
@@ -884,6 +886,12 @@ static xine_video_port_t *load_video_out
 				  (void *) &vis, (void *) &x11vis);
 }
 
+uint32_t gtk_video_get_capabilities (GtkVideo *this)
+{
+  gtk_video_private_t *priv = this->priv;
+  return priv->video_port->get_capabilities (priv->video_port);
+}
+
 static void gtv_send_xine_mouse_event (gtk_video_private_t *priv,
 				       int x, int y, int button)
 {
@@ -1429,7 +1437,7 @@ static gboolean gtv_update_resize_factor
     double new_factor_V = this->widget.allocation.height * 100
 			  / (double)priv->video_size.height
 			  / (1 + is_double);
-    if (new_factor > new_factor_V)
+    if (new_factor < new_factor_V)
       new_factor= new_factor_V;
   }
   /* tolerate rounding error when the video size has been changed... */
diff -r 69d9c188603f807c3fd1477d77b27d6edd3a16d3 -r \
                45fefa12bec95edaf9bc2c65abd631947dcd8e64 src/gtkvideo.h
--- a/src/gtkvideo.h	Mon Feb 25 17:26:05 2008 +0000
+++ b/src/gtkvideo.h	Sun Feb 24 18:50:29 2008 +0000
@@ -119,6 +119,7 @@ enum {
 
   void gtk_video_unblank_screen (GtkVideo *);
 
+  uint32_t gtk_video_get_capabilities (GtkVideo *); /* video port caps */
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff -r 69d9c188603f807c3fd1477d77b27d6edd3a16d3 -r \
                45fefa12bec95edaf9bc2c65abd631947dcd8e64 src/settings.c
--- a/src/settings.c	Mon Feb 25 17:26:05 2008 +0000
+++ b/src/settings.c	Sun Feb 24 18:50:29 2008 +0000
@@ -278,6 +278,7 @@ static void sliders_create (struct slide
       if (adj->upper > max)
 	max = adj->upper;
       w = ui_hscale_new ((GtkObject *)adj, GTK_POS_LEFT, 0);
+      ui_register_adjustment_widget (sliders[i].type, w);
       g_signal_connect (G_OBJECT(w), "format-value",
 			G_CALLBACK(slider_format_value), v);
       gtk_table_attach (GTK_TABLE(table), w,
diff -r 69d9c188603f807c3fd1477d77b27d6edd3a16d3 -r \
                45fefa12bec95edaf9bc2c65abd631947dcd8e64 src/ui.c
--- a/src/ui.c	Mon Feb 25 17:26:05 2008 +0000
+++ b/src/ui.c	Sun Feb 24 18:50:29 2008 +0000
@@ -29,6 +29,8 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <pthread.h>
+/* for VO_CAP_HUE etc. (where available) */
+#include <xine/video_out.h>
 
 #include "ui.h"
 #include "utils.h"
@@ -62,13 +64,14 @@ pthread_mutex_t status_lock = PTHREAD_MU
 
 static GSList *c_buttons[Control_Buttons] = { NULL };
 static GtkObject *c_adjustments[Control_Adjustments] = { NULL };
+static GSList *c_adj_widgets[Control_Adjustments] = { NULL };
 
 /* (Internal) Reflect play/pause/stop status in control buttons */
 
-static void ui_set_list (int index, const char *property, gboolean state)
+static void ui_set_list (GSList **list, int index, const char *property, gboolean \
state)  {
   GSList *btn;
-  foreach_glist (btn, c_buttons[index])
+  foreach_glist (btn, list[index])
     if (g_object_class_find_property (G_OBJECT_GET_CLASS (btn->data), property))
       g_object_set (G_OBJECT (btn->data), property, state, NULL);
 }
@@ -93,11 +96,11 @@ static void ui_int_set_status (ui_status
   no_recursion = TRUE;
   for (i = 0; i < Control_PlayerButtons; ++i)
   {
-    ui_set_list (i, "active", states[i]);
+    ui_set_list (c_buttons, i, "active", states[i]);
     if (i == Control_PLAY)
-      ui_set_list (i, "sensitive", !!playlist_size ());
+      ui_set_list (c_buttons, i, "sensitive", !!playlist_size ());
     else if (i == Control_PAUSE || i == Control_REWIND || i == Control_FASTFWD)
-      ui_set_list (i, "sensitive", !live);
+      ui_set_list (c_buttons, i, "sensitive", !live);
   }
   no_recursion = FALSE;
 }
@@ -160,7 +163,17 @@ typedef struct {
   gdouble start, min, max, step, page, pagesize;
   const char *setting, *jspref;
   int param;
+#ifdef VO_CAP_HUE
+  enum { CAP_NONE, CAP_AUDIO, CAP_VIDEO } type;
+  int cap;
+#endif
 } ui_adjustable_t;
+
+#ifdef VO_CAP_HUE
+# define XINE_PARAM_VO(X) XINE_PARAM_VO_##X, CAP_VIDEO, VO_CAP_##X
+#else
+# define XINE_PARAM_VO(X) XINE_PARAM_VO_##X
+#endif
 
 static const ui_adjustable_t ranges[] = {
   [Control_SEEKER]		= {     0,       0,  65535,    1,    10, 0, NULL },
@@ -170,10 +183,10 @@ static const ui_adjustable_t ranges[] = 
   [Control_AMPLIFIER]		= {   100,       0,    200,    1,    10, 0, \
"gui.ao_amplifier",		 "ao_amplifier",  XINE_PARAM_AUDIO_AMP_LEVEL },  \
[Control_AV_SYNC]		= {     0, -180000, 180000, 1000, 10000, 0, "gui.av_sync",		 \
"av_sync",	  XINE_PARAM_AV_OFFSET },  [Control_SPU_SYNC]		= {     0, -180000, 180000, \
                1000, 10000, 0, "gui.spu_sync",		 "spu_sync",	  XINE_PARAM_SPU_OFFSET \
                },
-  [Control_HUE]			= { 32768,       0,  65535,  100,  1000, 0, "gui.vo_hue",		 \
                "vo_hue",	  XINE_PARAM_VO_HUE },
-  [Control_SATURATION]		= { 32768,       0,  65535,  100,  1000, 0, \
                "gui.vo_saturation",	 "vo_saturation", XINE_PARAM_VO_SATURATION },
-  [Control_CONTRAST]		= { 32768,       0,  65535,  100,  1000, 0, \
                "gui.vo_contrast",		 "vo_contrast",   XINE_PARAM_VO_CONTRAST },
-  [Control_BRIGHTNESS]		= { 32768,       0,  65535,  100,  1000, 0, \
"gui.vo_brightness",	 "vo_brightness", XINE_PARAM_VO_BRIGHTNESS }, +  \
[Control_HUE]			= { 32768,       0,  65535,  100,  1000, 0, "gui.vo_hue",		 \
"vo_hue",	  XINE_PARAM_VO(HUE) }, +  [Control_SATURATION]		= { 32768,       0,  \
65535,  100,  1000, 0, "gui.vo_saturation",	 "vo_saturation", \
XINE_PARAM_VO(SATURATION) }, +  [Control_CONTRAST]		= { 32768,       0,  65535,  100, \
1000, 0, "gui.vo_contrast",		 "vo_contrast",   XINE_PARAM_VO(CONTRAST) }, +  \
[Control_BRIGHTNESS]		= { 32768,       0,  65535,  100,  1000, 0, \
"gui.vo_brightness",	 "vo_brightness", XINE_PARAM_VO(BRIGHTNESS) },  \
[Control_EQ_30]		= {   100,	 0,    100,    1,    10, 0, "gui.eq_30",		 "eq_30",	  \
XINE_PARAM_EQ_30HZ },  [Control_EQ_60]		= {   100,	 0,    100,    1,    10, 0, \
"gui.eq_60",		 "eq_60",	  XINE_PARAM_EQ_60HZ },  [Control_EQ_125]		= {   100,	 0,    \
100,    1,    10, 0, "gui.eq_125",		 "eq_125",	  XINE_PARAM_EQ_125HZ }, @@ -269,6 \
+282,14 @@ GtkObject *ui_register_control_adjustmen  G_CALLBACK \
(ui_seeker_value_changed_cb), NULL);  }
   return c_adjustments[item];
+}
+
+/* Register a widget for the above status functions */
+
+void ui_register_adjustment_widget (control_adjustment_t item, GtkWidget *widget)
+{
+  g_return_if_fail (item < Control_Adjustments);
+  c_adj_widgets[item] = g_slist_append (c_adj_widgets[item], widget);
 }
 
 /* Set the state of every button in a class, e.g. every play button */
@@ -1090,11 +1111,25 @@ gboolean ui_post_init (void)
 gboolean ui_post_init (void)
 {
   unsigned int i;
+  uint32_t cap = gtk_video_get_capabilities (gtv);
   gdk_threads_enter ();
   for (i = 0; i < G_N_ELEMENTS (ranges); ++i)
+  {
     if (ranges[i].param && i != Control_VOLUME)
       xine_set_param (stream, ranges[i].param, starts[i]);
+#ifdef VO_CAP_HUE
+    switch (ranges[i].type)
+    {
+    case CAP_VIDEO:
+      if (ranges[i].cap && !(cap & ranges[i].cap))
+        ui_set_list (c_adj_widgets, i, "sensitive", 0);
+      break;
+    default:;
+    }      
+#endif
+  }
   gdk_threads_leave ();
+
   gxine_init_done ();
   return FALSE;
 }
diff -r 69d9c188603f807c3fd1477d77b27d6edd3a16d3 -r \
                45fefa12bec95edaf9bc2c65abd631947dcd8e64 src/ui.h
--- a/src/ui.h	Mon Feb 25 17:26:05 2008 +0000
+++ b/src/ui.h	Sun Feb 24 18:50:29 2008 +0000
@@ -116,6 +116,8 @@ void ui_clear_control_adjustment (contro
 /* Update objects which use the given adjustment */
 void ui_xine_set_param_from_adjustment (control_adjustment_t);
 
+void ui_register_adjustment_widget (control_adjustment_t, GtkWidget *);
+
 void ui_preferences_register (xine_t *);
 
 /* Property creation */
diff -r 69d9c188603f807c3fd1477d77b27d6edd3a16d3 -r \
                45fefa12bec95edaf9bc2c65abd631947dcd8e64 src/xml_widgets.c
--- a/src/xml_widgets.c	Mon Feb 25 17:26:05 2008 +0000
+++ b/src/xml_widgets.c	Sun Feb 24 18:50:29 2008 +0000
@@ -823,6 +823,8 @@ create_stock_gxine (xml_node_t *node)
 	goto do_spin_slider_again;
       }
 
+      ui_register_adjustment_widget (stock[i].control, w);
+
       if (GTK_IS_SCALE (w))
       {
 	gtk_scale_set_digits (GTK_SCALE (w), 0);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic