| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser/gtk/gtk_util.h" | 5 #include "chrome/browser/gtk/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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 | 896 |
| 897 bool AddWindowAlphaChannel(GtkWidget* window) { | 897 bool AddWindowAlphaChannel(GtkWidget* window) { |
| 898 GdkScreen* screen = gtk_widget_get_screen(window); | 898 GdkScreen* screen = gtk_widget_get_screen(window); |
| 899 GdkColormap* rgba = gdk_screen_get_rgba_colormap(screen); | 899 GdkColormap* rgba = gdk_screen_get_rgba_colormap(screen); |
| 900 if (rgba) | 900 if (rgba) |
| 901 gtk_widget_set_colormap(window, rgba); | 901 gtk_widget_set_colormap(window, rgba); |
| 902 | 902 |
| 903 return rgba; | 903 return rgba; |
| 904 } | 904 } |
| 905 | 905 |
| 906 void GetTextColors(GdkColor* normal_base, |
| 907 GdkColor* selected_base, |
| 908 GdkColor* normal_text, |
| 909 GdkColor* selected_text) { |
| 910 GtkWidget* fake_entry = gtk_entry_new(); |
| 911 GtkStyle* style = gtk_rc_get_style(fake_entry); |
| 912 |
| 913 if (normal_base) |
| 914 *normal_base = style->base[GTK_STATE_NORMAL]; |
| 915 if (selected_base) |
| 916 *selected_base = style->base[GTK_STATE_SELECTED]; |
| 917 if (normal_text) |
| 918 *normal_text = style->text[GTK_STATE_NORMAL]; |
| 919 if (selected_text) |
| 920 *selected_text = style->text[GTK_STATE_SELECTED]; |
| 921 |
| 922 g_object_ref_sink(fake_entry); |
| 923 g_object_unref(fake_entry); |
| 924 } |
| 925 |
| 906 #if defined(OS_CHROMEOS) | 926 #if defined(OS_CHROMEOS) |
| 907 | 927 |
| 908 GtkWindow* GetDialogTransientParent(GtkWindow* dialog) { | 928 GtkWindow* GetDialogTransientParent(GtkWindow* dialog) { |
| 909 GtkWindow* parent = gtk_window_get_transient_for(dialog); | 929 GtkWindow* parent = gtk_window_get_transient_for(dialog); |
| 910 if (!parent) | 930 if (!parent) |
| 911 parent = chromeos::GetOptionsViewParent(); | 931 parent = chromeos::GetOptionsViewParent(); |
| 912 | 932 |
| 913 return parent; | 933 return parent; |
| 914 } | 934 } |
| 915 | 935 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 gint x = 0, y = 0, width = 1, height = 1; | 1044 gint x = 0, y = 0, width = 1, height = 1; |
| 1025 gtk_window_get_position(GTK_WINDOW(dialog), &x, &y); | 1045 gtk_window_get_position(GTK_WINDOW(dialog), &x, &y); |
| 1026 gtk_window_get_size(GTK_WINDOW(dialog), &width, &height); | 1046 gtk_window_get_size(GTK_WINDOW(dialog), &width, &height); |
| 1027 | 1047 |
| 1028 return gfx::Rect(x, y, width, height); | 1048 return gfx::Rect(x, y, width, height); |
| 1029 } | 1049 } |
| 1030 | 1050 |
| 1031 #endif | 1051 #endif |
| 1032 | 1052 |
| 1033 } // namespace gtk_util | 1053 } // namespace gtk_util |
| OLD | NEW |