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

Side by Side Diff: chrome/common/gtk_util.cc

Issue 173642: Set the focus ring color to match the Gtk theme focus color. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: connect to notification Created 11 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/gtk_util.h" 5 #include "chrome/common/gtk_util.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 9
10 #include <cstdarg> 10 #include <cstdarg>
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 prefs->subpixel_rendering = RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB; 398 prefs->subpixel_rendering = RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB;
399 } else if (strcmp(rgba_style, "bgr") == 0) { 399 } else if (strcmp(rgba_style, "bgr") == 0) {
400 prefs->subpixel_rendering = RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR; 400 prefs->subpixel_rendering = RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR;
401 } else if (strcmp(rgba_style, "vrgb") == 0) { 401 } else if (strcmp(rgba_style, "vrgb") == 0) {
402 prefs->subpixel_rendering = RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB; 402 prefs->subpixel_rendering = RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB;
403 } else if (strcmp(rgba_style, "vbgr") == 0) { 403 } else if (strcmp(rgba_style, "vbgr") == 0) {
404 prefs->subpixel_rendering = RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR; 404 prefs->subpixel_rendering = RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR;
405 } 405 }
406 } 406 }
407 407
408 static GtkWidget* fixed = gtk_fixed_new();
409 GtkStyle* style = gtk_rc_get_style(fixed);
410 // base[SELECTED] seems more appropriate but in practice it is often too light
411 // to be easily visible.
412 GdkColor color = style->bg[GTK_STATE_SELECTED];
413 prefs->focus_ring_color_r = color.red / 257;
414 prefs->focus_ring_color_g = color.green / 257;
415 prefs->focus_ring_color_b = color.blue / 257;
416
408 if (hint_style) 417 if (hint_style)
409 g_free(hint_style); 418 g_free(hint_style);
410 if (rgba_style) 419 if (rgba_style)
411 g_free(rgba_style); 420 g_free(rgba_style);
412 } 421 }
413 422
414 gfx::Point ScreenPoint(GtkWidget* widget) { 423 gfx::Point ScreenPoint(GtkWidget* widget) {
415 int x, y; 424 int x, y;
416 gdk_display_get_pointer(gtk_widget_get_display(widget), NULL, &x, &y, 425 gdk_display_get_pointer(gtk_widget_get_display(widget), NULL, &x, &y,
417 NULL); 426 NULL);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 GdkColor AverageColors(GdkColor color_one, GdkColor color_two) { 473 GdkColor AverageColors(GdkColor color_one, GdkColor color_two) {
465 GdkColor average_color; 474 GdkColor average_color;
466 average_color.pixel = 0; 475 average_color.pixel = 0;
467 average_color.red = (color_one.red + color_two.red) / 2; 476 average_color.red = (color_one.red + color_two.red) / 2;
468 average_color.green = (color_one.green + color_two.green) / 2; 477 average_color.green = (color_one.green + color_two.green) / 2;
469 average_color.blue = (color_one.blue + color_two.blue) / 2; 478 average_color.blue = (color_one.blue + color_two.blue) / 2;
470 return average_color; 479 return average_color;
471 } 480 }
472 481
473 } // namespace gtk_util 482 } // namespace gtk_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698