totem r6261 - in trunk: . src/backend
- From: pwithnall svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r6261 - in trunk: . src/backend
- Date: Wed, 15 Apr 2009 12:15:46 +0000 (UTC)
Author: pwithnall
Date: Wed Apr 15 12:15:46 2009
New Revision: 6261
URL: http://svn.gnome.org/viewvc/totem?rev=6261&view=rev
Log:
2009-04-15 Philip Withnall <philip tecnocode co uk>
* src/backend/bacon-video-widget-gst-0.10.c
(bacon_video_widget_show), (bacon_video_widget_hide),
(bacon_video_widget_expose_event),
(bacon_video_widget_size_allocate), (bacon_video_widget_init),
(bvw_handle_application_message), (bvw_handle_element_message),
(bacon_video_widget_set_show_cursor):
* src/backend/bacon-video-widget-xine.c (load_video_out_driver),
(xine_event), (bacon_video_widget_unrealize),
(bacon_video_widget_expose), (bacon_video_widget_show),
(bacon_video_widget_hide), (bacon_video_widget_size_allocate),
(bacon_video_widget_set_show_cursor),
(bacon_video_widget_set_scale_ratio): Patches from VÃctor Manuel
JÃquez Leal <vjaquez igalia com> to use proper GtkWidget accessors
in BaconVideoWidget. (Helps: #578591)
Modified:
trunk/ChangeLog
trunk/src/backend/bacon-video-widget-gst-0.10.c
trunk/src/backend/bacon-video-widget-xine.c
Modified: trunk/src/backend/bacon-video-widget-gst-0.10.c
==============================================================================
--- trunk/src/backend/bacon-video-widget-gst-0.10.c (original)
+++ trunk/src/backend/bacon-video-widget-gst-0.10.c Wed Apr 15 12:15:46 2009
@@ -581,9 +581,11 @@
bacon_video_widget_show (GtkWidget *widget)
{
BaconVideoWidget *bvw = BACON_VIDEO_WIDGET (widget);
+ GdkWindow *window;
- if (widget->window)
- gdk_window_show (widget->window);
+ window = gtk_widget_get_window (widget);
+ if (window)
+ gdk_window_show (window);
if (bvw->priv->video_window)
gdk_window_show (bvw->priv->video_window);
@@ -595,9 +597,11 @@
bacon_video_widget_hide (GtkWidget *widget)
{
BaconVideoWidget *bvw = BACON_VIDEO_WIDGET (widget);
+ GdkWindow *window;
- if (widget->window)
- gdk_window_hide (widget->window);
+ window = gtk_widget_get_window (widget);
+ if (window)
+ gdk_window_hide (window);
if (bvw->priv->video_window)
gdk_window_hide (bvw->priv->video_window);
@@ -637,6 +641,7 @@
GstXOverlay *xoverlay;
gboolean draw_logo;
XID window;
+ GdkWindow *win;
if (event && event->count > 0)
return TRUE;
@@ -658,7 +663,8 @@
gst_x_overlay_set_xwindow_id (xoverlay, window);
/* Start with a nice black canvas */
- gdk_draw_rectangle (widget->window, widget->style->black_gc, TRUE, 0, 0,
+ win = gtk_widget_get_window (widget);
+ gdk_draw_rectangle (win, gtk_widget_get_style (widget)->black_gc, TRUE, 0, 0,
widget->allocation.width, widget->allocation.height);
/* if there's only audio and no visualisation, draw the logo as well */
@@ -679,11 +685,10 @@
rect.height = widget->allocation.height;
region = gdk_region_rectangle (&rect);
- gdk_window_begin_paint_region (widget->window,
- region);
+ gdk_window_begin_paint_region (win, region);
gdk_region_destroy (region);
- gdk_window_clear_area (widget->window,
+ gdk_window_clear_area (win,
0, 0,
widget->allocation.width,
widget->allocation.height);
@@ -705,22 +710,22 @@
if (s_width <= 1 || s_height <= 1) {
if (xoverlay != NULL)
gst_object_unref (xoverlay);
- gdk_window_end_paint (widget->window);
+ gdk_window_end_paint (win);
return TRUE;
}
logo = gdk_pixbuf_scale_simple (bvw->priv->logo_pixbuf,
s_width, s_height, GDK_INTERP_BILINEAR);
- gdk_draw_pixbuf (widget->window, widget->style->fg_gc[0], logo,
+ gdk_draw_pixbuf (win, gtk_widget_get_style (widget)->fg_gc[0], logo,
0, 0, (w_width - s_width) / 2, (w_height - s_height) / 2,
s_width, s_height, GDK_RGB_DITHER_NONE, 0, 0);
- gdk_window_end_paint (widget->window);
+ gdk_window_end_paint (win);
g_object_unref (logo);
- } else if (widget->window) {
+ } else if (win) {
/* No pixbuf, just draw a black background then */
- gdk_window_clear_area (widget->window,
+ gdk_window_clear_area (win,
0, 0,
widget->allocation.width,
widget->allocation.height);
@@ -731,7 +736,7 @@
gst_x_overlay_expose (xoverlay);
else {
/* No xoverlay to expose yet */
- gdk_window_clear_area (widget->window,
+ gdk_window_clear_area (win,
0, 0,
widget->allocation.width,
widget->allocation.height);
@@ -895,7 +900,7 @@
if (GTK_WIDGET_REALIZED (widget)) {
- gdk_window_move_resize (widget->window,
+ gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x, allocation->y,
allocation->width, allocation->height);
@@ -1073,6 +1078,8 @@
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);
@@ -1121,6 +1128,7 @@
bvw_handle_application_message (BaconVideoWidget *bvw, GstMessage *msg)
{
const gchar *msg_name;
+ GdkWindow *window;
msg_name = gst_structure_get_name (msg->structure);
g_return_if_fail (msg_name != NULL);
@@ -1149,10 +1157,11 @@
/* Uhm, so this ugly hack here makes media loading work for
* weird laptops with NVIDIA graphics cards... Dunno what the
* bug is really, but hey, it works. :). */
- if (GTK_WIDGET (bvw)->window) {
- gdk_window_hide (GTK_WIDGET (bvw)->window);
- gdk_window_show (GTK_WIDGET (bvw)->window);
-
+ window = gtk_widget_get_window (GTK_WIDGET (bvw));
+ if (window) {
+ gdk_window_hide (window);
+ gdk_window_show (window);
+
bacon_video_widget_expose_event (GTK_WIDGET (bvw), NULL);
}
}
@@ -1225,7 +1234,8 @@
bvw->priv->cursor = NULL;
}
}
- gdk_window_set_cursor (GTK_WIDGET(bvw)->window, bvw->priv->cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(bvw)),
+ bvw->priv->cursor);
break;
}
default:
@@ -3235,19 +3245,22 @@
bacon_video_widget_set_show_cursor (BaconVideoWidget * bvw,
gboolean show_cursor)
{
+ GdkWindow *window;
+
g_return_if_fail (bvw != NULL);
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
-
+
bvw->priv->cursor_shown = show_cursor;
-
- if (!GTK_WIDGET (bvw)->window) {
+ window = gtk_widget_get_window (GTK_WIDGET (bvw));
+
+ if (!window) {
return;
}
if (show_cursor == FALSE) {
- totem_gdk_window_set_invisible_cursor (GTK_WIDGET (bvw)->window);
+ totem_gdk_window_set_invisible_cursor (window);
} else {
- gdk_window_set_cursor (GTK_WIDGET (bvw)->window, bvw->priv->cursor);
+ gdk_window_set_cursor (window, bvw->priv->cursor);
}
}
Modified: trunk/src/backend/bacon-video-widget-xine.c
==============================================================================
--- trunk/src/backend/bacon-video-widget-xine.c (original)
+++ trunk/src/backend/bacon-video-widget-xine.c Wed Apr 15 12:15:46 2009
@@ -648,7 +648,7 @@
vis.display = bvw->priv->display;
vis.screen = bvw->priv->screen;
- vis.d = GDK_WINDOW_XID (GTK_WIDGET(bvw)->window);
+ vis.d = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET(bvw)));
res_h = (DisplayWidth (bvw->priv->display, bvw->priv->screen) * 1000 /
DisplayWidthMM (bvw->priv->display,
bvw->priv->screen));
@@ -1463,7 +1463,7 @@
bvw->priv->cursor = NULL;
}
}
- gdk_window_set_cursor (GTK_WIDGET(bvw)->window,
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(bvw)),
bvw->priv->cursor);
break;
case XINE_EVENT_UI_PLAYBACK_FINISHED:
@@ -1669,7 +1669,7 @@
xine_port_send_gui_data (bvw->priv->vo_driver,
XINE_GUI_SEND_WILL_DESTROY_DRAWABLE,
- (void*)widget->window);
+ (void*) gtk_widget_get_window (widget));
g_object_unref (bvw->priv->bacon_resize);
@@ -1850,23 +1850,25 @@
gfloat ratio;
GdkRegion *region;
GdkRectangle rect;
+ GdkWindow *window;
rect.x = rect.y = 0;
rect.width = widget->allocation.width;
rect.height = widget->allocation.height;
region = gdk_region_rectangle (&rect);
- gdk_window_begin_paint_region (widget->window,
- region);
+ window = gtk_widget_get_window (widget);
+
+ gdk_window_begin_paint_region (window, region);
gdk_region_destroy (region);
- gdk_window_clear_area (widget->window,
+ gdk_window_clear_area (window,
0, 0,
widget->allocation.width,
widget->allocation.height);
if (bvw->priv->logo_pixbuf == NULL) {
- gdk_window_end_paint (widget->window);
+ gdk_window_end_paint (window);
return FALSE;
}
@@ -1885,20 +1887,21 @@
s_height *= ratio;
if (s_width <= 1 || s_height <= 1) {
- gdk_window_end_paint (widget->window);
+ gdk_window_end_paint (window);
return FALSE;
}
logo = gdk_pixbuf_scale_simple (bvw->priv->logo_pixbuf,
s_width, s_height, GDK_INTERP_BILINEAR);
- gdk_draw_pixbuf (widget->window, widget->style->fg_gc[0], logo,
+ gdk_draw_pixbuf (window,
+ gtk_widget_get_style (widget)->fg_gc[0], logo,
0, 0,
(w_width - s_width) / 2,
(w_height - s_height) / 2,
s_width, s_height, GDK_RGB_DITHER_NONE, 0, 0);
- gdk_window_end_paint (widget->window);
+ gdk_window_end_paint (window);
g_object_unref (logo);
}
@@ -1945,8 +1948,11 @@
static void
bacon_video_widget_show (GtkWidget *widget)
{
- if (widget->window != NULL)
- gdk_window_show (widget->window);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (widget);
+ if (window != NULL)
+ gdk_window_show (window);
if (GTK_WIDGET_CLASS (parent_class)->show != NULL)
(* GTK_WIDGET_CLASS (parent_class)->show) (widget);
@@ -1955,8 +1961,11 @@
static void
bacon_video_widget_hide (GtkWidget *widget)
{
- if (widget->window != NULL)
- gdk_window_hide (widget->window);
+ GdkWindow *window;
+
+ window = gtk_widget_get_window (widget);
+ if (window != NULL)
+ gdk_window_hide (window);
if (GTK_WIDGET_CLASS (parent_class)->hide != NULL)
(* GTK_WIDGET_CLASS (parent_class)->hide) (widget);
@@ -1994,7 +2003,7 @@
if (GTK_WIDGET_REALIZED (widget))
{
- gdk_window_move_resize (widget->window,
+ gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x,
allocation->y,
allocation->width,
@@ -2997,15 +3006,17 @@
bacon_video_widget_set_show_cursor (BaconVideoWidget *bvw,
gboolean show_cursor)
{
+ GdkWindow *window;
+
g_return_if_fail (bvw != NULL);
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
+ window = gtk_widget_get_window (GTK_WIDGET (bvw));
if (show_cursor == FALSE)
{
- totem_gdk_window_set_invisible_cursor (GTK_WIDGET(bvw)->window);
+ totem_gdk_window_set_invisible_cursor (window);
} else {
- gdk_window_set_cursor (GTK_WIDGET(bvw)->window,
- bvw->priv->cursor);
+ gdk_window_set_cursor (window, bvw->priv->cursor);
}
bvw->priv->cursor_shown = show_cursor;
@@ -3559,6 +3570,7 @@
{
GtkWidget *toplevel, *widget;
int new_w, new_h, win_w, win_h;
+ GdkWindow *window;
g_return_if_fail (bvw != NULL);
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
@@ -3570,15 +3582,16 @@
return;
widget = GTK_WIDGET (bvw);
+ window = gtk_widget_get_window (widget);
/* Try best fit for the screen */
if (ratio == 0)
{
- if (totem_ratio_fits_screen (widget->window, bvw->priv->video_width, bvw->priv->video_height, 2) != FALSE) {
+ if (totem_ratio_fits_screen (window, bvw->priv->video_width, bvw->priv->video_height, 2) != FALSE) {
ratio = 2;
- } else if (totem_ratio_fits_screen (widget->window, bvw->priv->video_width, bvw->priv->video_height, 1) != FALSE) {
+ } else if (totem_ratio_fits_screen (window, bvw->priv->video_width, bvw->priv->video_height, 1) != FALSE) {
ratio = 1;
- } else if (totem_ratio_fits_screen (widget->window, bvw->priv->video_width, bvw->priv->video_height, 0.5) != FALSE) {
+ } else if (totem_ratio_fits_screen (window, bvw->priv->video_width, bvw->priv->video_height, 0.5) != FALSE) {
ratio = 0.5;
} else {
return;
@@ -3586,14 +3599,15 @@
} else {
/* don't scale to something bigger than the screen, and leave
* us some room */
- if (totem_ratio_fits_screen (widget->window, bvw->priv->video_width, bvw->priv->video_height, ratio) == FALSE)
+ if (totem_ratio_fits_screen (window, bvw->priv->video_width, bvw->priv->video_height, ratio) == FALSE)
return;
}
toplevel = gtk_widget_get_toplevel (widget);
+ window = gtk_widget_get_window (toplevel);
/* Get the size of the toplevel window */
- gdk_drawable_get_size (GDK_DRAWABLE (toplevel->window),
+ gdk_drawable_get_size (GDK_DRAWABLE (window),
&win_w, &win_h);
/* Calculate the new size of the window, depending on the size of the
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]