+/* load and scale icon */
+static Imlib_Image
+loadicon(const char *file, int size)
+{
+ Imlib_Image icon;
+ int width;
+ int height;
+ int imgsize;
+
+ icon = imlib_load_image(file);
+ if (icon == NULL)
+ errx(1, "cannot load icon %s", file);
+
+ imlib_context_set_image(icon);
+
+ width = imlib_image_get_width();
+ height = imlib_image_get_height();
+ imgsize = MIN(width, height);
+
+ icon = imlib_create_cropped_scaled_image(0, 0, imgsize, imgsize, size, size);
+
+ return icon;
+}
+
+/* setup the size of a menu and the position of its items */