[gtkhtml] Fix most GSEAL issues.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkhtml] Fix most GSEAL issues.
- Date: Sat, 17 Apr 2010 22:52:12 +0000 (UTC)
commit 8d7db0b2135d039ebb969b67bbe05594705844ce
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Apr 17 16:54:11 2010 -0400
Fix most GSEAL issues.
components/editor/gtkhtml-color-combo.c | 21 +++-----
components/editor/gtkhtml-color-swatch.c | 2 +-
components/editor/gtkhtml-face-tool-button.c | 19 +++-----
configure.ac | 2 +-
gtkhtml/gtkhtml-embedded.c | 9 ++-
gtkhtml/gtkhtml.c | 68 +++++++++++++-------------
gtkhtml/htmlengine-search.c | 9 +++-
gtkhtml/htmlengine.c | 22 +++++----
gtkhtml/htmlselection.c | 4 --
9 files changed, 76 insertions(+), 80 deletions(-)
---
diff --git a/components/editor/gtkhtml-color-combo.c b/components/editor/gtkhtml-color-combo.c
index a37432f..9c074b2 100644
--- a/components/editor/gtkhtml-color-combo.c
+++ b/components/editor/gtkhtml-color-combo.c
@@ -152,6 +152,7 @@ color_combo_reposition_window (GtkhtmlColorCombo *combo)
GdkScreen *screen;
GdkWindow *window;
GdkRectangle monitor;
+ GtkAllocation allocation;
gint monitor_num;
gint x, y, width, height;
@@ -163,12 +164,14 @@ color_combo_reposition_window (GtkhtmlColorCombo *combo)
gdk_window_get_origin (window, &x, &y);
if (!gtk_widget_get_has_window (GTK_WIDGET (combo))) {
- x += GTK_WIDGET (combo)->allocation.x;
- y += GTK_WIDGET (combo)->allocation.y;
+ gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation);
+ x += allocation.x;
+ y += allocation.y;
}
- width = combo->priv->window->allocation.width;
- height = combo->priv->window->allocation.height;
+ gtk_widget_get_allocation (combo->priv->window, &allocation);
+ width = allocation.width;
+ height = allocation.height;
x = CLAMP (x, monitor.x, monitor.x + monitor.width - width);
y = CLAMP (y, monitor.y, monitor.y + monitor.height - height);
@@ -615,7 +618,7 @@ color_combo_size_allocate (GtkWidget *widget,
priv = GTKHTML_COLOR_COMBO_GET_PRIVATE (widget);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
gtk_widget_size_allocate (priv->toggle_button, allocation);
}
@@ -628,11 +631,7 @@ 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)
@@ -679,11 +678,7 @@ 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-color-swatch.c b/components/editor/gtkhtml-color-swatch.c
index 5ff8ec2..aeb74a6 100644
--- a/components/editor/gtkhtml-color-swatch.c
+++ b/components/editor/gtkhtml-color-swatch.c
@@ -152,7 +152,7 @@ color_swatch_size_allocate (GtkWidget *widget,
priv = GTKHTML_COLOR_SWATCH_GET_PRIVATE (widget);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
gtk_widget_size_allocate (priv->frame, allocation);
}
diff --git a/components/editor/gtkhtml-face-tool-button.c b/components/editor/gtkhtml-face-tool-button.c
index ba03914..bd2d2fe 100644
--- a/components/editor/gtkhtml-face-tool-button.c
+++ b/components/editor/gtkhtml-face-tool-button.c
@@ -109,6 +109,7 @@ face_tool_button_reposition_window (GtkhtmlFaceToolButton *button)
GdkScreen *screen;
GdkWindow *window;
GdkRectangle monitor;
+ GtkAllocation allocation;
gint monitor_num;
gint x, y, width, height;
@@ -120,12 +121,14 @@ face_tool_button_reposition_window (GtkhtmlFaceToolButton *button)
gdk_window_get_origin (window, &x, &y);
if (!gtk_widget_get_has_window (GTK_WIDGET (button))) {
- x += GTK_WIDGET (button)->allocation.x;
- y += GTK_WIDGET (button)->allocation.y;
+ gtk_widget_get_allocation (GTK_WIDGET (button), &allocation);
+ x += allocation.x;
+ y += allocation.y;
}
- width = button->priv->window->allocation.width;
- height = button->priv->window->allocation.height;
+ gtk_widget_get_allocation (button->priv->window, &allocation);
+ width = allocation.width;
+ height = allocation.height;
x = CLAMP (x, monitor.x, monitor.x + monitor.width - width);
y = CLAMP (y, monitor.y, monitor.y + monitor.height - height);
@@ -328,11 +331,7 @@ 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)
@@ -374,11 +373,7 @@ 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/configure.ac b/configure.ac
index 9cdecf5..609a122 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ AC_CONFIG_SRCDIR(README)
PACKAGE=gtkhtml
dnl Required Package Versions
-m4_define([gtk_minimum_version], [2.18.0])
+m4_define([gtk_minimum_version], [2.20.0])
m4_define([gail_minimum_version], [1.1.0])
m4_define([enchant_minimum_version], [1.1.7])
m4_define([gnome_icon_theme_minimum_version], [2.22.0])
diff --git a/gtkhtml/gtkhtml-embedded.c b/gtkhtml/gtkhtml-embedded.c
index 4ef4b4c..f14740b 100644
--- a/gtkhtml/gtkhtml-embedded.c
+++ b/gtkhtml/gtkhtml-embedded.c
@@ -223,8 +223,11 @@ gtk_html_embedded_size_request (GtkWidget *widget, GtkRequisition *requisition)
if (child) {
gtk_widget_size_request (child, requisition);
} else {
- requisition->width = widget->requisition.width;
- requisition->height = widget->requisition.height;
+ GtkRequisition self_requisition;
+
+ gtk_widget_get_requisition (widget, &self_requisition);
+ requisition->width = self_requisition.width;
+ requisition->height = self_requisition.height;
}
}
@@ -241,7 +244,7 @@ gtk_html_embedded_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
if (child && gtk_widget_get_visible (child)) {
gtk_widget_size_allocate (child, allocation);
}
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
}
static void
diff --git a/gtkhtml/gtkhtml.c b/gtkhtml/gtkhtml.c
index 7a4af0b..1a85841 100644
--- a/gtkhtml/gtkhtml.c
+++ b/gtkhtml/gtkhtml.c
@@ -560,11 +560,7 @@ 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);
@@ -677,7 +673,7 @@ scroll_timeout_cb (gpointer data)
GdkWindow *window;
GtkHTML *html;
HTMLEngine *engine;
-
+ GtkAllocation allocation;
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
gint x_scroll, y_scroll;
@@ -692,13 +688,15 @@ scroll_timeout_cb (gpointer data)
window = gtk_widget_get_window (widget);
gdk_window_get_pointer (window, &x, &y, NULL);
+ gtk_widget_get_allocation (widget, &allocation);
+
if (x < 0) {
x_scroll = x;
if (x + engine->x_offset >= 0)
x = 0;
- } else if (x >= widget->allocation.width) {
- x_scroll = x - widget->allocation.width + 1;
- x = widget->allocation.width;
+ } else if (x >= allocation.width) {
+ x_scroll = x - allocation.width + 1;
+ x = allocation.width;
} else {
x_scroll = 0;
}
@@ -708,9 +706,9 @@ scroll_timeout_cb (gpointer data)
y_scroll = y;
if (y + engine->y_offset >= 0)
y = 0;
- } else if (y >= widget->allocation.height) {
- y_scroll = y - widget->allocation.height + 1;
- y = widget->allocation.height;
+ } else if (y >= allocation.height) {
+ y_scroll = y - allocation.height + 1;
+ y = allocation.height;
} else {
y_scroll = 0;
}
@@ -724,9 +722,9 @@ scroll_timeout_cb (gpointer data)
vadjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (widget));
inc_adjustment (hadjustment, html_engine_get_doc_width (html->engine),
- widget->allocation.width, x_scroll);
+ allocation.width, x_scroll);
inc_adjustment (vadjustment, html_engine_get_doc_height (html->engine),
- widget->allocation.height, y_scroll);
+ allocation.height, y_scroll);
GDK_THREADS_LEAVE ();
@@ -1442,11 +1440,7 @@ 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);
@@ -1454,8 +1448,11 @@ mouse_change_pos (GtkWidget *widget, GdkWindow *window, gint x, gint y, gint sta
obj = html_engine_get_object_at (engine, x, y, (guint *) &offset, FALSE);
if ((html->in_selection || html->in_selection_drag) && html->allow_selection) {
+ GtkAllocation allocation;
gboolean need_scroll;
+ gtk_widget_get_allocation (widget, &allocation);
+
if (obj) {
type = HTML_OBJECT_TYPE (obj);
@@ -1484,13 +1481,13 @@ mouse_change_pos (GtkWidget *widget, GdkWindow *window, gint x, gint y, gint sta
if (x < html->engine->x_offset) {
need_scroll = TRUE;
- } else if (x >= widget->allocation.width) {
+ } else if (x >= allocation.width) {
need_scroll = TRUE;
}
if (y < html->engine->y_offset) {
need_scroll = TRUE;
- } else if (y >= widget->allocation.height) {
+ } else if (y >= allocation.height) {
need_scroll = TRUE;
}
@@ -1746,10 +1743,14 @@ static GtkWidget *
shift_to_iframe_parent (GtkWidget *widget, gint *x, gint *y)
{
while (GTK_HTML (widget)->iframe_parent) {
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
if (x)
- *x += widget->allocation.x - GTK_HTML (widget)->engine->x_offset;
+ *x += allocation.x - GTK_HTML (widget)->engine->x_offset;
if (y)
- *y += widget->allocation.y - GTK_HTML (widget)->engine->y_offset;
+ *y += allocation.y - GTK_HTML (widget)->engine->y_offset;
widget = GTK_HTML (widget)->iframe_parent;
@@ -2154,7 +2155,6 @@ focus_in_event (GtkWidget *widget,
/* printf ("focus in\n"); */
if (!html->iframe_parent) {
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
if (html->engine->cursor && html->engine->cursor->position == 0 && html->engine->caret_mode)
goto_caret_anchor (html);
html_engine_set_focus (html->engine, TRUE);
@@ -2185,7 +2185,6 @@ focus_out_event (GtkWidget *widget,
html_engine_redraw_selection (html->engine);
/* printf ("focus out\n"); */
if (!html->iframe_parent) {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
html_engine_set_focus (html->engine, FALSE);
}
@@ -3414,8 +3413,8 @@ gtk_html_im_delete_surrounding_cb (GtkIMContext *slave, gint offset, gint n_char
static void
gtk_html_init (GtkHTML* html)
{
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (html), GTK_CAN_FOCUS);
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (html), GTK_APP_PAINTABLE);
+ gtk_widget_set_can_focus (GTK_WIDGET (html), TRUE);
+ gtk_widget_set_app_paintable (GTK_WIDGET (html), TRUE);
html->editor_api = NULL;
html->debug = FALSE;
@@ -3891,11 +3890,7 @@ 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"); */
@@ -4899,22 +4894,24 @@ cursor_move (GtkHTML *html, GtkDirectionType dir_type, GtkHTMLCursorSkipType ski
}
break;
case GTK_HTML_CURSOR_SKIP_PAGE: {
+ GtkAllocation allocation;
gint line_height;
- line_height = GTK_WIDGET (html)->allocation.height > (3 * get_line_height (html))
+ gtk_widget_get_allocation (GTK_WIDGET (html), &allocation);
+ line_height = allocation.height > (3 * get_line_height (html))
? get_line_height (html) : 0;
switch (dir_type) {
case GTK_DIR_UP:
case GTK_DIR_LEFT:
if ((amount = html_engine_scroll_up (html->engine,
- GTK_WIDGET (html)->allocation.height - line_height)) > 0)
+ allocation.height - line_height)) > 0)
scroll_by_amount (html, - amount);
break;
case GTK_DIR_DOWN:
case GTK_DIR_RIGHT:
if ((amount = html_engine_scroll_down (html->engine,
- GTK_WIDGET (html)->allocation.height - line_height)) > 0)
+ allocation.height - line_height)) > 0)
scroll_by_amount (html, amount);
break;
default:
@@ -4955,12 +4952,15 @@ cursor_move (GtkHTML *html, GtkDirectionType dir_type, GtkHTMLCursorSkipType ski
static gboolean
move_selection (GtkHTML *html, GtkHTMLCommandType com_type)
{
+ GtkAllocation allocation;
gboolean rv;
gint amount;
if (!html_engine_get_editable (html->engine) && !html->engine->caret_mode)
return FALSE;
+ gtk_widget_get_allocation (GTK_WIDGET (html), &allocation);
+
html->priv->cursor_moved = TRUE;
html->engine->shift_selection = TRUE;
if (!html->engine->mark)
@@ -4999,14 +4999,14 @@ move_selection (GtkHTML *html, GtkHTMLCommandType com_type)
rv = html_engine_forward_word (html->engine);
break;
case GTK_HTML_COMMAND_MODIFY_SELECTION_PAGEUP:
- if ((amount = html_engine_scroll_up (html->engine, GTK_WIDGET (html)->allocation.height)) > 0) {
+ if ((amount = html_engine_scroll_up (html->engine, allocation.height)) > 0) {
scroll_by_amount (html, - amount);
rv = TRUE;
} else
rv = FALSE;
break;
case GTK_HTML_COMMAND_MODIFY_SELECTION_PAGEDOWN:
- if ((amount = html_engine_scroll_down (html->engine, GTK_WIDGET (html)->allocation.height)) > 0) {
+ if ((amount = html_engine_scroll_down (html->engine, allocation.height)) > 0) {
scroll_by_amount (html, amount);
rv = TRUE;
} else
diff --git a/gtkhtml/htmlengine-search.c b/gtkhtml/htmlengine-search.c
index 440d0a4..ed9421b 100644
--- a/gtkhtml/htmlengine-search.c
+++ b/gtkhtml/htmlengine-search.c
@@ -44,8 +44,13 @@ add_iframe_off (HTMLEngine *e, gint *x, gint *y)
g_assert (e->widget);
if (e->widget->iframe_parent) {
- *x += e->widget->iframe_parent->allocation.x;
- *y += e->widget->iframe_parent->allocation.y;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (
+ e->widget->iframe_parent, &allocation);
+
+ *x += allocation.x;
+ *y += allocation.y;
}
}
diff --git a/gtkhtml/htmlengine.c b/gtkhtml/htmlengine.c
index 059dcb9..39391fd 100644
--- a/gtkhtml/htmlengine.c
+++ b/gtkhtml/htmlengine.c
@@ -5897,11 +5897,7 @@ 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;
@@ -6281,19 +6277,29 @@ html_engine_set_painter (HTMLEngine *e, HTMLPainter *painter)
gint
html_engine_get_view_width (HTMLEngine *e)
{
+ GtkAllocation allocation;
+
g_return_val_if_fail (HTML_IS_ENGINE (e), 0);
+
+ gtk_widget_get_allocation (GTK_WIDGET (e->widget), &allocation);
+
return MAX (0, (e->widget->iframe_parent
? html_engine_get_view_width (GTK_HTML (e->widget->iframe_parent)->engine)
- : GTK_WIDGET (e->widget)->allocation.width) - (html_engine_get_left_border (e) + html_engine_get_right_border (e)));
+ : allocation.width) - (html_engine_get_left_border (e) + html_engine_get_right_border (e)));
}
gint
html_engine_get_view_height (HTMLEngine *e)
{
+ GtkAllocation allocation;
+
g_return_val_if_fail (HTML_IS_ENGINE (e), 0);
+
+ gtk_widget_get_allocation (GTK_WIDGET (e->widget), &allocation);
+
return MAX (0, (e->widget->iframe_parent
? html_engine_get_view_height (GTK_HTML (e->widget->iframe_parent)->engine)
- : GTK_WIDGET (e->widget)->allocation.height) - (html_engine_get_top_border (e) + html_engine_get_bottom_border (e)));
+ : allocation.height) - (html_engine_get_top_border (e) + html_engine_get_bottom_border (e)));
}
/* beginnings of ID support */
@@ -6486,11 +6492,7 @@ 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));
}
}
diff --git a/gtkhtml/htmlselection.c b/gtkhtml/htmlselection.c
index 80e843b..73cc370 100644
--- a/gtkhtml/htmlselection.c
+++ b/gtkhtml/htmlselection.c
@@ -403,11 +403,7 @@ 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]