We didn't take decoration size into account before.
width = 4 * (item_width + item_padding) + item_padding;
height = 4 * (item_height + item_padding) + item_padding;
- widget_schedule_resize(dnd->widget, width, height);
+ frame_set_child_size(dnd->widget, width, height);
return dnd;
}
m = 2 * terminal->margin;
width = columns * terminal->extents.max_x_advance + m;
height = rows * terminal->extents.height + m;
- widget_schedule_resize(terminal->widget, width, height);
+
+ frame_set_child_size(terminal->widget, width, height);
}
struct color_scheme DEFAULT_COLORS = {
cairo_destroy(cr);
cairo_surface_destroy(surface);
- window_schedule_resize(terminal->window, 500, 400);
+ terminal_resize(terminal, 80, 25);
return terminal;
}
return frame->child;
}
+void
+frame_set_child_size(struct widget *widget, int child_width, int child_height)
+{
+ struct display *display = widget->window->display;
+ struct theme *t = display->theme;
+ int decoration_width, decoration_height;
+ int width, height;
+
+ if (widget->window->type != TYPE_FULLSCREEN) {
+ decoration_width = (t->width + t->margin) * 2;
+ decoration_height = t->width +
+ t->titlebar_height + t->margin * 2;
+
+ width = child_width + decoration_width;
+ height = child_height + decoration_height;
+ } else {
+ width = child_width;
+ height = child_height;
+ }
+
+ window_schedule_resize(widget->window, width, height);
+}
+
static void
frame_destroy(struct frame *frame)
{
struct widget *
frame_create(struct window *window, void *data);
+void
+frame_set_child_size(struct widget *widget, int child_width, int child_height);
void
input_set_pointer_image(struct input *input, int pointer);