Commit 71366576 authored by Philip Withnall's avatar Philip Withnall Committed by Philip Withnall

Remainders of the patches below to use GtkWidget accessors in

2009-04-15  Philip Withnall  <philip@tecnocode.co.uk>

	* src/backend/bacon-video-widget-gst-0.10.c
	(bacon_video_widget_realize), (bacon_video_widget_init):
	* src/backend/bacon-video-widget-xine.c
	(bacon_video_widget_realize): Remainders of the patches below to
	use GtkWidget accessors in BaconVideoWidget, which changes how Bvw's
	GdkWindows are created. (Closes: #578591)


svn path=/trunk/; revision=6262
parent a726a941
2009-04-15 Philip Withnall <philip@tecnocode.co.uk>
* src/backend/bacon-video-widget-gst-0.10.c
(bacon_video_widget_realize), (bacon_video_widget_init):
* src/backend/bacon-video-widget-xine.c
(bacon_video_widget_realize): Remainders of the patches below to
use GtkWidget accessors in BaconVideoWidget, which changes how Bvw's
GdkWindows are created. (Closes: #578591)
2009-04-15 Philip Withnall <philip@tecnocode.co.uk>
* src/backend/bacon-video-widget-gst-0.10.c
......
......@@ -500,26 +500,17 @@ bacon_video_widget_realize (GtkWidget * widget)
GdkWindowAttr attributes;
gint attributes_mask, w, h;
GdkColor colour;
GdkWindow *window;
GdkEventMask event_mask;
/* Creating our widget's window */
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |= GDK_EXPOSURE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_KEY_PRESS_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
event_mask = gtk_widget_get_events (widget)
| GDK_POINTER_MOTION_MASK
| GDK_KEY_PRESS_MASK;
gtk_widget_set_events (widget, event_mask);
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
GTK_WIDGET_CLASS (parent_class)->realize (widget);
window = gtk_widget_get_window (widget);
/* Creating our video window */
attributes.window_type = GDK_WINDOW_CHILD;
......@@ -535,18 +526,19 @@ bacon_video_widget_realize (GtkWidget * widget)
GDK_KEY_PRESS_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y;
bvw->priv->video_window = gdk_window_new (widget->window,
bvw->priv->video_window = gdk_window_new (window,
&attributes, attributes_mask);
gdk_window_set_user_data (bvw->priv->video_window, widget);
gdk_color_parse ("black", &colour);
gdk_colormap_alloc_color (gtk_widget_get_colormap (widget),
&colour, TRUE, TRUE);
gdk_window_set_background (widget->window, &colour);
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (window, &colour);
gtk_widget_set_style (widget,
gtk_style_attach (gtk_widget_get_style (widget), window));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
/* Connect to configure event on the top level window */
g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)),
"configure-event", G_CALLBACK (bacon_video_widget_configure_event), bvw);
......@@ -1078,8 +1070,6 @@ bacon_video_widget_init (BaconVideoWidget * bvw)
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (bvw), GTK_CAN_FOCUS);
GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (bvw), GTK_DOUBLE_BUFFERED);
gtk_event_box_set_visible_window (GTK_EVENT_BOX (bvw), TRUE);
bvw->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (bvw, BACON_TYPE_VIDEO_WIDGET, BaconVideoWidgetPrivate);
bvw->com = g_new0 (BaconVideoWidgetCommon, 1);
......
......@@ -1159,9 +1159,10 @@ size_changed_cb (GdkScreen *screen, BaconVideoWidget *bvw)
static void
bacon_video_widget_realize (GtkWidget *widget)
{
GdkWindowAttr attr;
GdkColor black;
BaconVideoWidget *bvw;
GdkWindow *window;
GdkEventMask event_mask;
bvw = BACON_VIDEO_WIDGET (widget);
if (bvw->priv->type != BVW_USE_TYPE_VIDEO)
......@@ -1170,32 +1171,26 @@ bacon_video_widget_realize (GtkWidget *widget)
return;
}
/* set realized flag */
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
/* Create the widget's window */
attr.x = widget->allocation.x;
attr.y = widget->allocation.y;
attr.width = widget->allocation.width;
attr.height = widget->allocation.height;
attr.window_type = GDK_WINDOW_CHILD;
attr.wclass = GDK_INPUT_OUTPUT;
attr.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK
event_mask = gtk_widget_get_events (widget)
| GDK_POINTER_MOTION_MASK
| GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attr, GDK_WA_X | GDK_WA_Y);
gdk_window_show (widget->window);
| GDK_KEY_PRESS_MASK;
gtk_widget_set_events (widget, event_mask);
GTK_WIDGET_CLASS (parent_class)->realize (widget);
/* Flush, so that the window is really shown */
gdk_flush ();
gdk_window_set_user_data (widget->window, bvw);
window = gtk_widget_get_window (widget);
gdk_color_parse ("Black", &black);
gdk_colormap_alloc_color (gtk_widget_get_colormap (widget),
&black, TRUE, TRUE);
gdk_window_set_background (widget->window, &black);
widget->style = gtk_style_attach (widget->style, widget->window);
gdk_window_set_background (window, &black);
gtk_widget_set_style
(widget,
gtk_style_attach (gtk_widget_get_style (widget), window));
/* track configure events of toplevel window */
g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment