[Xfce4-commits] <parole:bluesabre/gtk3> Support displaying the controls over gst video
Sean Davis
noreply at xfce.org
Sat Aug 31 19:04:01 CEST 2013
Updating branch refs/heads/bluesabre/gtk3
to 161fa1438b8d027c7b7d6ce80fc9a948cd7a1dd1 (commit)
from 0e427f3519fa6c047c652e083fee68a1fac357c0 (commit)
commit 161fa1438b8d027c7b7d6ce80fc9a948cd7a1dd1
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sat Aug 31 13:02:41 2013 -0400
Support displaying the controls over gst video
src/gst/parole-gst.c | 37 +++++++++++++++++++++++++++++++++++++
src/parole-player.c | 4 ++++
2 files changed, 41 insertions(+)
diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index 6997385..e9e6989 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <math.h>
#include <glib.h>
@@ -466,6 +467,12 @@ static void
parole_gst_set_video_overlay (ParoleGst *gst)
{
GstElement *video_sink;
+ GtkWidget *label;
+ //GtkStyleContext *context;
+ //GdkRGBA *rgba;
+ //gchar *converting_value, *hex_value;
+ //gint hex_int;
+ //char *endptr;
g_object_get (G_OBJECT (gst->priv->playbin),
"video-sink", &video_sink,
@@ -481,6 +488,36 @@ parole_gst_set_video_overlay (ParoleGst *gst)
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (video_sink),
GDK_WINDOW_XID ( gtk_widget_get_window(GTK_WIDGET (gst)) ));
#endif
+ /* The below code is an attempt to dynamically support theming on the controls.
+ label = GTK_WIDGET(gtk_label_new(""));
+ context = gtk_widget_get_style_context(GTK_WIDGET(label));
+ gtk_style_context_add_class (context, "osd");
+ gtk_style_context_get(context, GTK_STATE_FLAG_NORMAL,
+ GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &rgba, NULL);
+
+ hex_value = g_strdup("");
+ converting_value = g_strdup_printf("%X", (int)(rgba->red * 255.0));
+ if ((int)strlen(converting_value) == 1)
+ hex_value = g_strjoin("", hex_value, "0", NULL);
+ hex_value = g_strjoin("", hex_value, converting_value, NULL);
+
+ converting_value = g_strdup_printf("%X", (int)(rgba->green * 255.0));
+ if ((int)strlen(converting_value) == 1)
+ hex_value = g_strjoin("", hex_value, "0", NULL);
+ hex_value = g_strjoin("", hex_value, converting_value, NULL);
+
+ converting_value = g_strdup_printf("%X", (int)(rgba->blue * 255.0));
+ if ((int)strlen(converting_value) == 1)
+ hex_value = g_strjoin("", hex_value, "0", NULL);
+ hex_value = g_strjoin("", hex_value, converting_value, NULL);
+
+ hex_int = (int)strtol(hex_value, &endptr, 16);
+
+ g_object_set(video_sink, "autopaint-colorkey", FALSE,
+ "colorkey", hex_int, NULL);
+ */
+ g_object_set(video_sink, "autopaint-colorkey", FALSE,
+ "colorkey", 0x080810, NULL);
gst_object_unref (video_sink);
}
diff --git a/src/parole-player.c b/src/parole-player.c
index 402880a..a2dcabd 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -3222,7 +3222,11 @@ parole_player_init (ParolePlayer *player)
gtk_widget_set_margin_top(tmp_box, 10);
gtk_widget_set_valign(tmp_box, GTK_ALIGN_END);
controls_style = gtk_widget_get_style_context(GTK_WIDGET(tmp_box));
+ //gtk_style_context_add_class (controls_style, "osd");
+ gdk_color_parse("#080810", &background);
gtk_style_context_add_class (controls_style, "osd");
+ //gtk_widget_modify_bg(GTK_WIDGET(tmp_box), GTK_STATE_NORMAL, &background);
+ gtk_widget_modify_bg(GTK_WIDGET(controls_overlay), GTK_STATE_NORMAL, &background);
gtk_widget_reparent(GTK_WIDGET(player->priv->control), tmp_box);
gtk_overlay_add_overlay(GTK_OVERLAY(controls_overlay), tmp_box);
gtk_box_set_child_packing( GTK_BOX(player->priv->control), GTK_WIDGET(player->priv->play_box), TRUE, TRUE, 2, GTK_PACK_START );
More information about the Xfce4-commits
mailing list