Commit b89ec181 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Gtk3: Fix fuzzy breeze frame buttons when using scale factors > 1

When using scale factors > 1, it is necessary to set the scale factor on all
GtkStyleContext's so that GTK will fetch higher resolution assets.

This was only seen on the Breeze theme, because it's the only one that uses
bitmap backgrounds.

BUG=794358
R=erg@chromium.org

Change-Id: Ib2c42e4869156caba94f377b583cbac96f44ad98
Reviewed-on: https://chromium-review.googlesource.com/847683Reviewed-by: default avatarElliot Glaysher <erg@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526638}
parent 9339c8f5
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "ui/events/keycodes/keyboard_code_conversion_x.h" #include "ui/events/keycodes/keyboard_code_conversion_x.h"
#include "ui/gfx/color_utils.h" #include "ui/gfx/color_utils.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
#include "ui/views/linux_ui/linux_ui.h"
namespace { namespace {
...@@ -53,6 +54,11 @@ void CommonInitFromCommandLine(const base::CommandLine& command_line, ...@@ -53,6 +54,11 @@ void CommonInitFromCommandLine(const base::CommandLine& command_line,
} }
} }
float GetDeviceScaleFactor() {
views::LinuxUI* linux_ui = views::LinuxUI::instance();
return linux_ui ? linux_ui->GetDeviceScaleFactor() : 1;
}
} // namespace } // namespace
namespace libgtkui { namespace libgtkui {
...@@ -446,6 +452,7 @@ ScopedStyleContext AppendCssNodeToStyleContext(GtkStyleContext* context, ...@@ -446,6 +452,7 @@ ScopedStyleContext AppendCssNodeToStyleContext(GtkStyleContext* context,
} }
gtk_style_context_set_state(child_context, child_state); gtk_style_context_set_state(child_context, child_state);
} }
gtk_style_context_set_scale(child_context, std::ceil(GetDeviceScaleFactor()));
gtk_style_context_set_parent(child_context, context); gtk_style_context_set_parent(child_context, context);
gtk_widget_path_unref(path); gtk_widget_path_unref(path);
return child_context; return child_context;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment