diff options
author | rbuj <[email protected]> | 2022-02-09 12:26:35 +0100 |
---|---|---|
committer | mbkma <[email protected]> | 2022-07-22 08:48:41 +0200 |
commit | 160d754f2228e74daea5735c9fb6655e082de906 (patch) | |
tree | a91ae7eb2fd831f4f87c36b9bf021a5df1be7848 /eel | |
parent | b90c1c21ded05281f5ed9dfbbaac764f918300f8 (diff) | |
download | caja-160d754f2228e74daea5735c9fb6655e082de906.tar.bz2 caja-160d754f2228e74daea5735c9fb6655e082de906.tar.xz |
Fix build warning -Wbad-function-cast
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-canvas-rect-ellipse.c | 7 | ||||
-rw-r--r-- | eel/eel-canvas.c | 31 |
2 files changed, 24 insertions, 14 deletions
diff --git a/eel/eel-canvas-rect-ellipse.c b/eel/eel-canvas-rect-ellipse.c index 9cb25fb5..0e4a245e 100644 --- a/eel/eel-canvas-rect-ellipse.c +++ b/eel/eel-canvas-rect-ellipse.c @@ -735,7 +735,12 @@ eel_canvas_rect_update (EelCanvasItem *item, double i2w_dx, double i2w_dy, gint if (re->width_pixels) width_pixels = (int) re->width; else - width_pixels = (int) floor (re->width * re->item.canvas->pixels_per_unit + 0.5); + { + double pixels; + + pixels = floor (re->width * re->item.canvas->pixels_per_unit + 0.5); + width_pixels = (int) pixels; + } width_lt = width_pixels / 2; width_rb = (width_pixels + 1) / 2; diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c index faf1ab69..b5d5acc2 100644 --- a/eel/eel-canvas.c +++ b/eel/eel-canvas.c @@ -2286,10 +2286,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 +2375,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. */ |