OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/libgtk2ui/gtk2_util.h" | 5 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Allow $CHROME_DESKTOP to override the built-in value, so that development | 64 // Allow $CHROME_DESKTOP to override the built-in value, so that development |
65 // versions can set themselves as the default without interfering with | 65 // versions can set themselves as the default without interfering with |
66 // non-official, packaged versions using the built-in value. | 66 // non-official, packaged versions using the built-in value. |
67 std::string name; | 67 std::string name; |
68 if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty()) | 68 if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty()) |
69 return name; | 69 return name; |
70 return "chromium-browser.desktop"; | 70 return "chromium-browser.desktop"; |
71 #endif | 71 #endif |
72 } | 72 } |
73 | 73 |
74 void SetAlwaysShowImage(GtkWidget* image_menu_item) { | |
75 gtk_image_menu_item_set_always_show_image( | |
76 GTK_IMAGE_MENU_ITEM(image_menu_item), TRUE); | |
77 } | |
78 | |
79 guint GetGdkKeyCodeForAccelerator(const ui::Accelerator& accelerator) { | 74 guint GetGdkKeyCodeForAccelerator(const ui::Accelerator& accelerator) { |
80 // The second parameter is false because accelerator keys are expressed in | 75 // The second parameter is false because accelerator keys are expressed in |
81 // terms of the non-shift-modified key. | 76 // terms of the non-shift-modified key. |
82 return XKeysymForWindowsKeyCode(accelerator.key_code(), false); | 77 return XKeysymForWindowsKeyCode(accelerator.key_code(), false); |
83 } | 78 } |
84 | 79 |
85 GdkModifierType GetGdkModifierForAccelerator( | 80 GdkModifierType GetGdkModifierForAccelerator( |
86 const ui::Accelerator& accelerator) { | 81 const ui::Accelerator& accelerator) { |
87 int event_flag = accelerator.modifiers(); | 82 int event_flag = accelerator.modifiers(); |
88 int modifier = 0; | 83 int modifier = 0; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 123 |
129 aura::Window* GetAuraTransientParent(GtkWidget* dialog) { | 124 aura::Window* GetAuraTransientParent(GtkWidget* dialog) { |
130 return reinterpret_cast<aura::Window*>( | 125 return reinterpret_cast<aura::Window*>( |
131 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent)); | 126 g_object_get_data(G_OBJECT(dialog), kAuraTransientParent)); |
132 } | 127 } |
133 | 128 |
134 void ClearAuraTransientParent(GtkWidget* dialog) { | 129 void ClearAuraTransientParent(GtkWidget* dialog) { |
135 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL); | 130 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL); |
136 } | 131 } |
137 | 132 |
138 GtkStateType GetGtkState(ui::NativeTheme::State state) { | |
139 switch (state) { | |
140 case ui::NativeTheme::kDisabled: return GTK_STATE_INSENSITIVE; | |
141 case ui::NativeTheme::kHovered: return GTK_STATE_PRELIGHT; | |
142 case ui::NativeTheme::kNormal: return GTK_STATE_NORMAL; | |
143 case ui::NativeTheme::kPressed: return GTK_STATE_ACTIVE; | |
144 case ui::NativeTheme::kNumStates: NOTREACHED(); | |
145 } | |
146 return GTK_STATE_NORMAL; | |
147 } | |
148 | |
149 } // namespace libgtk2ui | 133 } // namespace libgtk2ui |
OLD | NEW |