summaryrefslogtreecommitdiff
path: root/eel/eel-canvas.c
diff options
context:
space:
mode:
Diffstat (limited to 'eel/eel-canvas.c')
-rw-r--r--eel/eel-canvas.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index faf1ab69..a9d98101 100644
--- a/eel/eel-canvas.c
+++ b/eel/eel-canvas.c
@@ -137,7 +137,8 @@ eel_canvas_item_get_type (void)
NULL, /* class_data */
sizeof (EelCanvasItem),
0, /* n_preallocs */
- (GInstanceInitFunc) eel_canvas_item_init
+ (GInstanceInitFunc) eel_canvas_item_init,
+ NULL /* value_table */
};
canvas_item_type = g_type_register_static (G_TYPE_INITIALLY_UNOWNED,
@@ -1255,8 +1256,8 @@ eel_canvas_group_get_type (void)
NULL, /* class_data */
sizeof (EelCanvasGroup),
0, /* n_preallocs */
- (GInstanceInitFunc) eel_canvas_group_init
-
+ (GInstanceInitFunc) eel_canvas_group_init,
+ NULL /* value_table */
};
group_type = g_type_register_static (eel_canvas_item_get_type (),
@@ -1851,7 +1852,8 @@ eel_canvas_get_type (void)
NULL, /* class_data */
sizeof (EelCanvas),
0, /* n_preallocs */
- (GInstanceInitFunc) eel_canvas_init
+ (GInstanceInitFunc) eel_canvas_init,
+ NULL /* value_table */
};
canvas_type = g_type_register_static (gtk_layout_get_type (),
@@ -2286,10 +2288,12 @@ scroll_to (EelCanvas *canvas, int cx, int cy)
int scroll_width, scroll_height;
int right_limit, bottom_limit;
int old_zoom_xofs, old_zoom_yofs;
- int changed_x = FALSE, changed_y = FALSE;
+ gboolean changed_x;
+ gboolean changed_y;
int canvas_width, canvas_height;
GtkAllocation allocation;
GtkAdjustment *vadjustment, *hadjustment;
+ gdouble adjustment_value;
guint width, height;
gtk_widget_get_allocation (GTK_WIDGET (canvas), &allocation);
@@ -2373,22 +2377,25 @@ scroll_to (EelCanvas *canvas, int cx, int cy)
hadjustment = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (canvas));
vadjustment = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (canvas));
- if (((int) gtk_adjustment_get_value (hadjustment)) != cx)
- {
- gtk_adjustment_set_value (hadjustment, cx);
- changed_x = TRUE;
- }
+ adjustment_value = gtk_adjustment_get_value (hadjustment);
+ changed_x = ((int) adjustment_value) != cx;
+ if (changed_x)
+ gtk_adjustment_set_value (hadjustment,
+ (gdouble) cx);
- if (((int) gtk_adjustment_get_value (vadjustment)) != cy)
- {
- gtk_adjustment_set_value (vadjustment, cy);
- changed_y = TRUE;
- }
+ adjustment_value = gtk_adjustment_get_value (vadjustment);
+ changed_y = ((int) adjustment_value) != cy;
+ if (changed_y)
+ gtk_adjustment_set_value (vadjustment,
+ (gdouble) cy);
gtk_layout_get_size (&canvas->layout, &width, &height);
- if ((scroll_width != (int) width )|| (scroll_height != (int) height))
+ if ((scroll_width != (int) width) ||
+ (scroll_height != (int) height))
{
- gtk_layout_set_size (GTK_LAYOUT (canvas), scroll_width, scroll_height);
+ gtk_layout_set_size (GTK_LAYOUT (canvas),
+ (guint) scroll_width,
+ (guint) scroll_height);
}
/* Signal GtkLayout that it should do a redraw. */