Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3518)

Unified Diff: chrome/common/gtk_util.cc

Issue 398003: linux: Use gtk-cursor-blink from GtkSettings to set the caret blink interval (Closed)
Patch Set: latest Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/render_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/gtk_util.cc
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc
index 37fb13e9165d48abcba6e316c624678e8969a172..d5e0885598fd7aba5239072efb2218c354a0770b 100644
--- a/chrome/common/gtk_util.cc
+++ b/chrome/common/gtk_util.cc
@@ -461,11 +461,19 @@ GtkWidget* IndentWidget(GtkWidget* content) {
void UpdateGtkFontSettings(RendererPreferences* prefs) {
DCHECK(prefs);
+ // From http://library.gnome.org/devel/gtk/unstable/GtkSettings.html, this is
+ // the default value for gtk-cursor-blink-time.
+ static const gint kGtkDefaultCursorBlinkTime = 1200;
+
+ gint cursor_blink_time = kGtkDefaultCursorBlinkTime;
+ gboolean cursor_blink = TRUE;
gint antialias = 0;
gint hinting = 0;
gchar* hint_style = NULL;
gchar* rgba_style = NULL;
g_object_get(gtk_settings_get_default(),
+ "gtk-cursor-blink-time", &cursor_blink_time,
+ "gtk-cursor-blink", &cursor_blink,
"gtk-xft-antialias", &antialias,
"gtk-xft-hinting", &hinting,
"gtk-xft-hintstyle", &hint_style,
@@ -478,6 +486,15 @@ void UpdateGtkFontSettings(RendererPreferences* prefs) {
prefs->subpixel_rendering =
RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT;
+ if (cursor_blink) {
+ // Dividing by 2*1000ms follows the WebKit GTK port and makes the blink
+ // frequency appear similar to the omnibox. Without this the blink is too
+ // slow.
+ prefs->caret_blink_interval = cursor_blink_time / 2000.;
+ } else {
+ prefs->caret_blink_interval = 0;
+ }
+
// g_object_get() doesn't tell us whether the properties were present or not,
// but if they aren't (because gnome-settings-daemon isn't running), we'll get
// NULL values for the strings.
« no previous file with comments | « no previous file | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698