app: fix jumping around of newly created images

Put the center_image_on_size_allocate() code into the canvas'
size-allocate callbacck.

As a side effect we now have a flag in GimpDisplayShell which
indicates that there will be a size allocate before the next frame, so
simply skip drawing the canvas completely. This fixes new images
jumping around when they are first shown.

(cherry picked from commit c0480f502d)

(this fix is actually a side effect from fixing something else in
master)
This commit is contained in:
Michael Natterer
2018-06-28 00:52:08 +02:00
parent 7eee2614f9
commit 21f87d7d82
5 changed files with 16 additions and 67 deletions

View File

@ -779,8 +779,7 @@ gimp_display_shell_constructed (GObject *object)
* not even finished creating the display shell, we can safely
* assume we will get a size-allocate later.
*/
gimp_display_shell_scroll_center_image_on_size_allocate (shell,
TRUE, TRUE);
shell->size_allocate_center_image = TRUE;
}
else
{
@ -1505,11 +1504,6 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
gimp_display_shell_set_initial_scale (shell, scale, NULL, NULL);
gimp_display_shell_scale_update (shell);
/* center the image so subsequent stuff only moves it a little in
* the center
*/
gimp_display_shell_scroll_center_image (shell, TRUE, TRUE);
gimp_display_shell_sync_config (shell, config);
gimp_image_window_suspend_keep_pos (window);
@ -1526,7 +1520,7 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
/* A size-allocate will always occur because the scrollbars will
* become visible forcing the canvas to become smaller
*/
gimp_display_shell_scroll_center_image_on_size_allocate (shell, TRUE, TRUE);
shell->size_allocate_center_image = TRUE;
if (shell->blink_timeout_id)
{