Relayout images on screen resizes

The strategy is very simple, images are not rescaled or re-positioned in
any way.
This commit is contained in:
Kovid Goyal 2017-10-09 12:43:37 +05:30
parent f9b52249d1
commit 3cce238b2b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 11 additions and 3 deletions

View File

@ -814,6 +814,11 @@ handle_delete_command(GraphicsManager *self, const GraphicsCommand *g, Cursor *c
// }}}
void
grman_resize(GraphicsManager *self, index_type UNUSED old_lines, index_type UNUSED lines, index_type UNUSED old_columns, index_type UNUSED columns) {
self->layers_dirty = true;
}
const char*
grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_t *payload, Cursor *c, bool *is_dirty) {
Image *image;

View File

@ -88,3 +88,4 @@ void grman_clear(GraphicsManager*);
const char* grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_t *payload, Cursor *c, bool *is_dirty);
bool grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float screen_left, float screen_top, float dx, float dy, unsigned int num_cols, unsigned int num_rows);
void grman_scroll_images(GraphicsManager *self, const ScrollData*);
void grman_resize(GraphicsManager*, index_type, index_type, index_type, index_type);

View File

@ -149,14 +149,16 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) {
if (n == NULL) return false;
Py_CLEAR(self->main_linebuf); self->main_linebuf = n;
if (is_main) num_content_lines = num_content_lines_after;
grman_resize(self->main_grman, self->lines, lines, self->columns, columns);
// Resize alt linebuf
n = realloc_lb(self->alt_linebuf, lines, columns, &num_content_lines_before, &num_content_lines_after, NULL);
if (n == NULL) return false;
Py_CLEAR(self->alt_linebuf); self->alt_linebuf = n;
// Resize alt linebuf
if (!is_main) num_content_lines = num_content_lines_after;
self->linebuf = is_main ? self->main_linebuf : self->alt_linebuf;
grman_resize(self->alt_grman, self->lines, lines, self->columns, columns);
self->linebuf = is_main ? self->main_linebuf : self->alt_linebuf;
self->lines = lines; self->columns = columns;
self->margin_top = 0; self->margin_bottom = self->lines - 1;