+static int
+frame_min_height (struct frame *frame)
+{
+ /* For height, we have to see whether the frame has a minibuffer, and
+ whether it wants a modeline. */
+ return (FRAME_MINIBUF_ONLY_P (frame) ? MIN_SAFE_WINDOW_HEIGHT - 1
+ : (! FRAME_HAS_MINIBUF_P (frame)) ? MIN_SAFE_WINDOW_HEIGHT
+ : 2 * MIN_SAFE_WINDOW_HEIGHT - 1);
+}
+
+/* Return non-zero if both frame sizes are less than or equal to
+ minimal allowed values. ROWS and COLS are in characters */
+int
+frame_size_valid_p (struct frame *frame, int rows, int cols)
+{
+ return (rows >= frame_min_height (frame)
+ && cols >= MIN_SAFE_WINDOW_WIDTH);
+}
+
+/* Return non-zero if both frame sizes are less than or equal to
+ minimal allowed values. WIDTH and HEIGHT are in pixels */
+int
+frame_pixsize_valid_p (struct frame *frame, int width, int height)
+{
+ int rows, cols;
+ pixel_to_real_char_size (frame, width, height, &cols, &rows);
+ return frame_size_valid_p (frame, rows, cols);
+}
+