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

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_util.cc

Issue 1234223005: Initial gtk3 support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Silence gtk memory leak Created 5 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
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_util.h ('k') | chrome/browser/ui/libgtk2ui/menu_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_util.h ('k') | chrome/browser/ui/libgtk2ui/menu_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698