Fix terminal resizing
Get snapping to character grid working again, avoid crashes when attempting
to resize below 1x1 character cell, only redraw when size actually changes.
Also, rename window_get_child_rectangle() to window_get_child_allocation().
diff --git a/clients/image.c b/clients/image.c
index f9bbeb2..61d8b25 100644
--- a/clients/image.c
+++ b/clients/image.c
@@ -137,18 +137,18 @@
static void
image_draw(struct image *image)
{
- struct rectangle rectangle;
+ struct rectangle allocation;
GdkPixbuf *pb;
cairo_t *cr;
cairo_surface_t *wsurface, *surface;
window_draw(image->window);
- window_get_child_rectangle(image->window, &rectangle);
+ window_get_child_allocation(image->window, &allocation);
pb = gdk_pixbuf_new_from_file_at_size(image->filename,
- rectangle.width,
- rectangle.height,
+ allocation.width,
+ allocation.height,
NULL);
if (pb == NULL)
return;
@@ -156,8 +156,8 @@
wsurface = window_get_surface(image->window);
surface = cairo_surface_create_similar(wsurface,
CAIRO_CONTENT_COLOR_ALPHA,
- rectangle.width,
- rectangle.height);
+ allocation.width,
+ allocation.height);
cairo_surface_destroy(wsurface);
cr = cairo_create(surface);
@@ -166,14 +166,14 @@
cairo_paint(cr);
set_source_pixbuf(cr, pb,
0, 0,
- rectangle.width, rectangle.height);
+ allocation.width, allocation.height);
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
cairo_paint(cr);
cairo_destroy(cr);
g_object_unref(pb);
- window_copy_surface(image->window, &rectangle, surface);
+ window_copy_surface(image->window, &allocation, surface);
window_flush(image->window);
cairo_surface_destroy(surface);
}