Skip to content

Commit

Permalink
sidebar: Respect sidebar dimensions on HiDPI
Browse files Browse the repository at this point in the history
  • Loading branch information
vkareh authored and raveit65 committed Apr 5, 2018
1 parent dade92d commit ce14bef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/caja-navigation-window.c
Expand Up @@ -362,9 +362,12 @@ side_pane_size_allocate_callback (GtkWidget *widget,
gpointer user_data) gpointer user_data)
{ {
CajaNavigationWindow *window; CajaNavigationWindow *window;
gint scale;


window = CAJA_NAVIGATION_WINDOW (user_data); window = CAJA_NAVIGATION_WINDOW (user_data);
scale = gtk_widget_get_scale_factor (widget);


allocation->width = allocation->width / scale;
if (allocation->width != window->details->side_pane_width) if (allocation->width != window->details->side_pane_width)
{ {
window->details->side_pane_width = allocation->width; window->details->side_pane_width = allocation->width;
Expand All @@ -377,11 +380,14 @@ side_pane_size_allocate_callback (GtkWidget *widget,
static void static void
setup_side_pane_width (CajaNavigationWindow *window) setup_side_pane_width (CajaNavigationWindow *window)
{ {
gint scale;

g_return_if_fail (window->sidebar != NULL); g_return_if_fail (window->sidebar != NULL);


scale = gtk_widget_get_scale_factor (GTK_WIDGET (window->sidebar));
window->details->side_pane_width = window->details->side_pane_width =
g_settings_get_int (caja_window_state, g_settings_get_int (caja_window_state,
CAJA_WINDOW_STATE_SIDEBAR_WIDTH); CAJA_WINDOW_STATE_SIDEBAR_WIDTH) * scale;


gtk_paned_set_position (GTK_PANED (window->details->content_paned), gtk_paned_set_position (GTK_PANED (window->details->content_paned),
window->details->side_pane_width); window->details->side_pane_width);
Expand Down
4 changes: 3 additions & 1 deletion src/caja-sidebar-title.c
Expand Up @@ -731,9 +731,11 @@ caja_sidebar_title_size_allocate (GtkWidget *widget,
CajaSidebarTitle *sidebar_title; CajaSidebarTitle *sidebar_title;
guint16 old_width; guint16 old_width;
guint best_icon_size; guint best_icon_size;
gint scale;
GtkAllocation old_allocation, new_allocation; GtkAllocation old_allocation, new_allocation;


sidebar_title = CAJA_SIDEBAR_TITLE (widget); sidebar_title = CAJA_SIDEBAR_TITLE (widget);
scale = gtk_widget_get_scale_factor (widget);


gtk_widget_get_allocation (widget, &old_allocation); gtk_widget_get_allocation (widget, &old_allocation);
old_width = old_allocation.width; old_width = old_allocation.width;
Expand All @@ -744,7 +746,7 @@ caja_sidebar_title_size_allocate (GtkWidget *widget,


if (old_width != new_allocation.width) if (old_width != new_allocation.width)
{ {
best_icon_size = get_best_icon_size (sidebar_title); best_icon_size = get_best_icon_size (sidebar_title) / scale;
if (best_icon_size != sidebar_title->details->best_icon_size) if (best_icon_size != sidebar_title->details->best_icon_size)
{ {
sidebar_title->details->best_icon_size = best_icon_size; sidebar_title->details->best_icon_size = best_icon_size;
Expand Down

0 comments on commit ce14bef

Please sign in to comment.