Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions src/vnr-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,17 @@ vnr_window_cmd_prev (GtkAction *action, gpointer user_data)
vnr_window_prev(VNR_WINDOW(user_data));
}

static void
vnr_window_resize (VnrWindow *window)
{
gint img_w = window->current_image_width; /* Width of the pixbuf */
gint img_h = window->current_image_height; /* Height of the pixbuf */

vnr_tools_fit_to_size (&img_w, &img_h, window->max_width, window->max_height);

gtk_window_resize (GTK_WINDOW (window), img_w, img_h + get_top_widgets_height(window));
}

static void
vnr_window_cmd_resize (GtkToggleAction *action, VnrWindow *window)
{
Expand All @@ -1283,18 +1294,12 @@ vnr_window_cmd_resize (GtkToggleAction *action, VnrWindow *window)
return;
}

gint img_h, img_w; /* Width and Height of the pixbuf */

img_w = window->current_image_width;
img_h = window->current_image_height;

if ( img_w == 0 || img_h == 0 )
if ( window->current_image_width == 0 || window->current_image_height == 0 )
return;

window->prefs->auto_resize = TRUE;

vnr_tools_fit_to_size (&img_w, &img_h, window->max_width, window->max_height);
gtk_window_resize (GTK_WINDOW (window), img_w, img_h + get_top_widgets_height(window));
vnr_window_resize (window);
}

static void
Expand Down Expand Up @@ -2500,14 +2505,7 @@ vnr_window_open (VnrWindow * window, gboolean fit_to_screen)

if(fit_to_screen)
{
gint img_h, img_w; /* Width and Height of the pixbuf */

img_w = window->current_image_width;
img_h = window->current_image_height;

vnr_tools_fit_to_size (&img_w, &img_h, window->max_width, window->max_height);

gtk_window_resize (GTK_WINDOW (window), img_w, img_h + get_top_widgets_height(window));
vnr_window_resize (window);
}

last_fit_mode = UNI_IMAGE_VIEW(window->view)->fitting;
Expand Down