[gtkhtml] Work around recent GTK+ deprecations.



commit 6c920a6f1207240fa5ecc2efd5396be5f93a0970
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Mar 4 22:56:17 2010 -0500

    Work around recent GTK+ deprecations.

 a11y/object.c                                |    4 ++++
 components/editor/gtkhtml-color-combo.c      |   12 ++++++++++++
 components/editor/gtkhtml-face-tool-button.c |   12 ++++++++++++
 gtkhtml/gtkhtml-embedded.c                   |    4 ++++
 gtkhtml/gtkhtml.c                            |   24 ++++++++++++++++++++++++
 gtkhtml/htmlembedded.c                       |    4 ++++
 gtkhtml/htmlengine.c                         |   20 ++++++++++++++++++++
 gtkhtml/htmlselection.c                      |    4 ++++
 8 files changed, 84 insertions(+), 0 deletions(-)
---
diff --git a/a11y/object.c b/a11y/object.c
index 41d2c8e..d312a06 100644
--- a/a11y/object.c
+++ b/a11y/object.c
@@ -77,7 +77,11 @@ do_action (AtkAction * action, gint i)
 	return FALSE;
 	}
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
+#else
 	if (!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
+#endif
 		return FALSE;
 
 	switch (i) {
diff --git a/components/editor/gtkhtml-color-combo.c b/components/editor/gtkhtml-color-combo.c
index c3af77b..462d5ff 100644
--- a/components/editor/gtkhtml-color-combo.c
+++ b/components/editor/gtkhtml-color-combo.c
@@ -162,7 +162,11 @@ color_combo_reposition_window (GtkhtmlColorCombo *combo)
 
 	gdk_window_get_origin (window, &x, &y);
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_has_window (GTK_WIDGET (combo))) {
+#else
 	if (GTK_WIDGET_NO_WINDOW (combo)) {
+#endif
 		x += GTK_WIDGET (combo)->allocation.x;
 		y += GTK_WIDGET (combo)->allocation.y;
 	}
@@ -620,7 +624,11 @@ color_combo_popup (GtkhtmlColorCombo *combo)
 	GdkGrabStatus status;
 	const gchar *label;
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_realized (GTK_WIDGET (combo)))
+#else
 	if (!GTK_WIDGET_REALIZED (combo))
+#endif
 		return;
 
 	if (combo->priv->popup_shown)
@@ -667,7 +675,11 @@ color_combo_popdown (GtkhtmlColorCombo *combo)
 {
 	GtkToggleButton *toggle_button;
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_realized (GTK_WIDGET (combo)))
+#else
 	if (!GTK_WIDGET_REALIZED (combo))
+#endif
 		return;
 
 	if (!combo->priv->popup_shown)
diff --git a/components/editor/gtkhtml-face-tool-button.c b/components/editor/gtkhtml-face-tool-button.c
index 2787081..0dbc88e 100644
--- a/components/editor/gtkhtml-face-tool-button.c
+++ b/components/editor/gtkhtml-face-tool-button.c
@@ -119,7 +119,11 @@ face_tool_button_reposition_window (GtkhtmlFaceToolButton *button)
 
 	gdk_window_get_origin (window, &x, &y);
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_has_window (GTK_WIDGET (button))) {
+#else
 	if (GTK_WIDGET_NO_WINDOW (button)) {
+#endif
 		x += GTK_WIDGET (button)->allocation.x;
 		y += GTK_WIDGET (button)->allocation.y;
 	}
@@ -324,7 +328,11 @@ face_tool_button_popup (GtkhtmlFaceToolButton *button)
 	GdkWindow *window;
 	GdkGrabStatus status;
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_realized (GTK_WIDGET (button)))
+#else
 	if (!GTK_WIDGET_REALIZED (button))
+#endif
 		return;
 
 	if (button->priv->popup_shown)
@@ -366,7 +374,11 @@ face_tool_button_popdown (GtkhtmlFaceToolButton *button)
 {
 	GtkToggleToolButton *tool_button;
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_realized (GTK_WIDGET (button)))
+#else
 	if (!GTK_WIDGET_REALIZED (button))
+#endif
 		return;
 
 	if (!button->priv->popup_shown)
diff --git a/gtkhtml/gtkhtml-embedded.c b/gtkhtml/gtkhtml-embedded.c
index dfc64b0..1acede4 100644
--- a/gtkhtml/gtkhtml-embedded.c
+++ b/gtkhtml/gtkhtml-embedded.c
@@ -238,7 +238,11 @@ gtk_html_embedded_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
 
 	child = gtk_bin_get_child (GTK_BIN (widget));
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (child && gtk_widget_get_visible (child)) {
+#else
 	if (child && GTK_WIDGET_VISIBLE (child)) {
+#endif
 		gtk_widget_size_allocate (child, allocation);
 	}
 	widget->allocation = *allocation;
diff --git a/gtkhtml/gtkhtml.c b/gtkhtml/gtkhtml.c
index f3a14e8..88a1c20 100644
--- a/gtkhtml/gtkhtml.c
+++ b/gtkhtml/gtkhtml.c
@@ -560,7 +560,11 @@ scroll_update_mouse (GtkWidget *widget)
 	GdkWindow *bin_window;
 	gint x, y;
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_realized (widget))
+#else
 	if (!GTK_WIDGET_REALIZED (widget))
+#endif
 		return;
 
 	window = gtk_widget_get_window (widget);
@@ -1438,7 +1442,11 @@ mouse_change_pos (GtkWidget *widget, GdkWindow *window, gint x, gint y, gint sta
 	HTMLType type;
 	gint offset;
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_realized (widget))
+#else
 	if (!GTK_WIDGET_REALIZED (widget))
+#endif
 		return FALSE;
 
 	html   = GTK_HTML (widget);
@@ -2399,7 +2407,11 @@ focus (GtkWidget *w, GtkDirectionType direction)
 		e->shift_selection = FALSE;
 	}
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_has_focus (w) && e->caret_mode) {
+#else
 	if (!GTK_WIDGET_HAS_FOCUS (w) && e->caret_mode) {
+#endif
 		if (goto_caret_anchor (GTK_HTML (w))) {
 			gtk_widget_grab_focus (w);
 
@@ -2410,7 +2422,11 @@ focus (GtkWidget *w, GtkDirectionType direction)
 		}
 	}
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (((e->focus_object && !(gtk_widget_has_focus (w))) || html_engine_focus (e, direction)) && e->focus_object) {
+#else
 	if (((e->focus_object && !(GTK_WIDGET_HAS_FOCUS (w))) || html_engine_focus (e, direction)) && e->focus_object) {
+#endif
 		gint offset;
 		HTMLObject *obj = html_engine_get_focus_object (e, &offset);
 		gint x1, y1, x2, y2, xo, yo;
@@ -2465,7 +2481,11 @@ focus (GtkWidget *w, GtkDirectionType direction)
 		/* printf ("engine pos: %d,%d x %d,%d\n",
 		   e->x_offset, e->y_offset, e->x_offset + e->width, e->y_offset + e->height); */
 
+#if GTK_CHECK_VERSION(2,19,7)
+		if (!gtk_widget_has_focus (w) && !html_object_is_embedded (obj))
+#else
 		if (!GTK_WIDGET_HAS_FOCUS (w) && !html_object_is_embedded (obj))
+#endif
 			gtk_widget_grab_focus (w);
 		if (e->caret_mode) {
 			html_engine_jump_to_object (e, obj, offset);
@@ -3883,7 +3903,11 @@ gtk_html_private_calc_scrollbars (GtkHTML *html, gboolean *changed_x, gboolean *
 	gint width, height;
 	gdouble value;
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (!gtk_widget_get_realized (GTK_WIDGET (html)))
+#else
 	if (!GTK_WIDGET_REALIZED (html))
+#endif
 		return;
 
 	/* printf ("calc scrollbars\n"); */
diff --git a/gtkhtml/htmlembedded.c b/gtkhtml/htmlembedded.c
index 651444c..4be7903 100644
--- a/gtkhtml/htmlembedded.c
+++ b/gtkhtml/htmlembedded.c
@@ -149,7 +149,11 @@ calc_min_width (HTMLObject *self,
 
 	widget = HTML_EMBEDDED (self)->widget;
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (widget == NULL || !gtk_widget_get_visible (widget))
+#else
 	if (widget == NULL || !GTK_WIDGET_VISIBLE (widget))
+#endif
 		return 0;
 
 	requisition.width = requisition.height = 0;
diff --git a/gtkhtml/htmlengine.c b/gtkhtml/htmlengine.c
index 1f1aa5f..256ba8e 100644
--- a/gtkhtml/htmlengine.c
+++ b/gtkhtml/htmlengine.c
@@ -5042,7 +5042,11 @@ html_engine_draw_real (HTMLEngine *e, gint x, gint y, gint width, gint height, g
 
 			vscrollbar = gtk_scrolled_window_get_vscrollbar (
 				GTK_SCROLLED_WINDOW (parent));
+#if GTK_CHECK_VERSION(2,19,7)
+			if (vscrollbar != NULL && !gtk_widget_get_visible (vscrollbar)) {
+#else
 			if (vscrollbar != NULL && !GTK_WIDGET_VISIBLE (vscrollbar)) {
+#endif
 				GtkPolicyType vscrollbar_policy;
 
 				gtk_scrolled_window_get_policy (
@@ -5061,7 +5065,11 @@ html_engine_draw_real (HTMLEngine *e, gint x, gint y, gint width, gint height, g
 
 			vscrollbar = gtk_scrolled_window_get_vscrollbar (
 				GTK_SCROLLED_WINDOW (parent));
+#if GTK_CHECK_VERSION(2,19,7)
+			if (vscrollbar != NULL && gtk_widget_get_visible (vscrollbar)) {
+#else
 			if (vscrollbar != NULL && GTK_WIDGET_VISIBLE (vscrollbar)) {
+#endif
 				GtkPolicyType vscrollbar_policy;
 
 				gtk_scrolled_window_get_policy (
@@ -5890,7 +5898,11 @@ thaw_idle (gpointer data)
 
 	if (redraw_whole) {
 		html_engine_queue_redraw_all (e);
+#if GTK_CHECK_VERSION(2,19,7)
+	} else if (gtk_widget_get_realized (GTK_WIDGET (e->widget))) {
+#else
 	} else if (GTK_WIDGET_REALIZED (e->widget)) {
+#endif
 		gint nw, nh;
 		GdkRegion *region = gdk_region_new ();
 		GdkRectangle paint;
@@ -6475,7 +6487,11 @@ html_engine_queue_redraw_all (HTMLEngine *e)
 	clear_pending_expose (e);
 	html_draw_queue_clear (e->draw_queue);
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (gtk_widget_get_realized (GTK_WIDGET (e->widget))) {
+#else
 	if (GTK_WIDGET_REALIZED (e->widget)) {
+#endif
 		gtk_widget_queue_draw (GTK_WIDGET (e->widget));
 	}
 }
@@ -6630,7 +6646,11 @@ html_engine_focus (HTMLEngine *e, GtkDirectionType dir)
 				return TRUE;
 			} else if (html_object_is_embedded (cur) && !html_object_is_frame (cur)
 				   && HTML_EMBEDDED (cur)->widget) {
+#if GTK_CHECK_VERSION(2,19,7)
+				if (!gtk_widget_is_drawable (HTML_EMBEDDED (cur)->widget)) {
+#else
 				if (!GTK_WIDGET_DRAWABLE (HTML_EMBEDDED (cur)->widget)) {
+#endif
 					gint x, y;
 
 					html_object_calc_abs_position (cur, &x, &y);
diff --git a/gtkhtml/htmlselection.c b/gtkhtml/htmlselection.c
index c7e6e0b..80e843b 100644
--- a/gtkhtml/htmlselection.c
+++ b/gtkhtml/htmlselection.c
@@ -403,7 +403,11 @@ html_engine_activate_selection (HTMLEngine *e, guint32 time)
 {
 	/* printf ("activate selection\n"); */
 
+#if GTK_CHECK_VERSION(2,19,7)
+	if (e->selection && e->block_selection == 0 && gtk_widget_get_realized (GTK_WIDGET (e->widget))) {
+#else
 	if (e->selection && e->block_selection == 0 && GTK_WIDGET_REALIZED (e->widget)) {
+#endif
 		gtk_selection_owner_set (GTK_WIDGET (e->widget), GDK_SELECTION_PRIMARY, time);
 		/* printf ("activated (%u).\n", time); */
 		clear_primary (e);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]