| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/libgtkui/native_theme_gtk3.h" | 5 #include "chrome/browser/ui/libgtkui/native_theme_gtk3.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" | 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" |
| 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" | 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 switch (color_id) { | 87 switch (color_id) { |
| 88 // Windows | 88 // Windows |
| 89 case ui::NativeTheme::kColorId_WindowBackground: | 89 case ui::NativeTheme::kColorId_WindowBackground: |
| 90 // Dialogs | 90 // Dialogs |
| 91 case ui::NativeTheme::kColorId_DialogBackground: | 91 case ui::NativeTheme::kColorId_DialogBackground: |
| 92 case ui::NativeTheme::kColorId_BubbleBackground: | 92 case ui::NativeTheme::kColorId_BubbleBackground: |
| 93 return GetBgColor(""); | 93 return GetBgColor(""); |
| 94 | 94 |
| 95 // FocusableBorder | 95 // FocusableBorder |
| 96 case ui::NativeTheme::kColorId_FocusedBorderColor: | 96 case ui::NativeTheme::kColorId_FocusedBorderColor: |
| 97 return GetBorderColor("GtkEntry#entry:focus"); | 97 // GetBorderColor("GtkEntry#entry:focus") is correct here. The focus ring |
| 98 // around widgets is usually a lighter version of the "canonical theme |
| 99 // color" - orange on Ambiance, blue on Adwaita, etc. However, Chrome |
| 100 // lightens the color we give it, so it would look wrong if we give it an |
| 101 // already-lightened color. This workaround returns the theme color |
| 102 // directly, taken from a selected table row. This has matched the theme |
| 103 // color on every theme that I've tested. |
| 104 return GetBgColor( |
| 105 "GtkTreeView#treeview.view " |
| 106 "GtkTreeView#treeview.view.cell:selected:focus"); |
| 98 case ui::NativeTheme::kColorId_UnfocusedBorderColor: | 107 case ui::NativeTheme::kColorId_UnfocusedBorderColor: |
| 99 return GetBorderColor("GtkEntry#entry"); | 108 return GetBorderColor("GtkEntry#entry"); |
| 100 | 109 |
| 101 // Menu | 110 // Menu |
| 102 case ui::NativeTheme::kColorId_MenuBackgroundColor: | 111 case ui::NativeTheme::kColorId_MenuBackgroundColor: |
| 103 return GetBgColor("GtkMenu#menu"); | 112 return GetBgColor("GtkMenu#menu"); |
| 104 case ui::NativeTheme::kColorId_MenuBorderColor: | 113 case ui::NativeTheme::kColorId_MenuBorderColor: |
| 105 return GetBorderColor("GtkMenu#menu"); | 114 return GetBorderColor("GtkMenu#menu"); |
| 106 case ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor: | 115 case ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor: |
| 107 return GetBgColor("GtkMenu#menu GtkMenuItem#menuitem:hover"); | 116 return GetBgColor("GtkMenu#menu GtkMenuItem#menuitem:hover"); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Button | 185 // Button |
| 177 case ui::NativeTheme::kColorId_ButtonEnabledColor: | 186 case ui::NativeTheme::kColorId_ButtonEnabledColor: |
| 178 return GetFgColor("GtkButton#button.text-button GtkLabel"); | 187 return GetFgColor("GtkButton#button.text-button GtkLabel"); |
| 179 case ui::NativeTheme::kColorId_ButtonDisabledColor: | 188 case ui::NativeTheme::kColorId_ButtonDisabledColor: |
| 180 return GetFgColor("GtkButton#button.text-button:disabled GtkLabel"); | 189 return GetFgColor("GtkButton#button.text-button:disabled GtkLabel"); |
| 181 case ui::NativeTheme::kColorId_ButtonHoverColor: | 190 case ui::NativeTheme::kColorId_ButtonHoverColor: |
| 182 return GetFgColor("GtkButton#button.text-button:hover GtkLabel"); | 191 return GetFgColor("GtkButton#button.text-button:hover GtkLabel"); |
| 183 case ui::NativeTheme::kColorId_ButtonPressedShade: | 192 case ui::NativeTheme::kColorId_ButtonPressedShade: |
| 184 return SK_ColorTRANSPARENT; | 193 return SK_ColorTRANSPARENT; |
| 185 | 194 |
| 195 // BlueButton |
| 186 case ui::NativeTheme::kColorId_BlueButtonEnabledColor: | 196 case ui::NativeTheme::kColorId_BlueButtonEnabledColor: |
| 187 return GetFgColor( | 197 return GetFgColor( |
| 188 "GtkButton#button.text-button.suggested-action GtkLabel"); | 198 "GtkButton#button.text-button.default.suggested-action GtkLabel"); |
| 189 case ui::NativeTheme::kColorId_BlueButtonDisabledColor: | 199 case ui::NativeTheme::kColorId_BlueButtonDisabledColor: |
| 190 return GetFgColor( | 200 return GetFgColor( |
| 191 "GtkButton#button.text-button.suggested-action:disabled " | 201 "GtkButton#button.text-button.default.suggested-action:disabled " |
| 192 "GtkLabel"); | 202 "GtkLabel"); |
| 193 case ui::NativeTheme::kColorId_BlueButtonHoverColor: | 203 case ui::NativeTheme::kColorId_BlueButtonHoverColor: |
| 194 return GetFgColor( | 204 return GetFgColor( |
| 195 "GtkButton#button.text-button.suggested-action:hover GtkLabel"); | 205 "GtkButton#button.text-button.default.suggested-action:hover " |
| 206 "GtkLabel"); |
| 196 case ui::NativeTheme::kColorId_BlueButtonPressedColor: | 207 case ui::NativeTheme::kColorId_BlueButtonPressedColor: |
| 197 return GetFgColor( | 208 return GetFgColor( |
| 198 "GtkButton#button.text-button.suggested-action:hover:active " | 209 "GtkButton#button.text-button.default.suggested-action:hover:active " |
| 199 "GtkLabel"); | 210 "GtkLabel"); |
| 200 case ui::NativeTheme::kColorId_BlueButtonShadowColor: | 211 case ui::NativeTheme::kColorId_BlueButtonShadowColor: |
| 201 return SK_ColorTRANSPARENT; | 212 return SK_ColorTRANSPARENT; |
| 202 | 213 |
| 214 // ProminentButton |
| 203 case ui::NativeTheme::kColorId_ProminentButtonColor: | 215 case ui::NativeTheme::kColorId_ProminentButtonColor: |
| 204 return GetBgColor("GtkButton#button.text-button.destructive-action"); | 216 return GetBgColor( |
| 217 "GtkTreeView#treeview.view " |
| 218 "GtkTreeView#treeview.view.cell:selected:focus"); |
| 205 case ui::NativeTheme::kColorId_TextOnProminentButtonColor: | 219 case ui::NativeTheme::kColorId_TextOnProminentButtonColor: |
| 206 return GetFgColor( | 220 return GetFgColor( |
| 207 "GtkButton#button.text-button.destructive-action GtkLabel"); | 221 "GtkTreeView#treeview.view " |
| 222 "GtkTreeview#treeview.view.cell:selected:focus GtkLabel"); |
| 208 | 223 |
| 209 // Textfield | 224 // Textfield |
| 210 case ui::NativeTheme::kColorId_TextfieldDefaultColor: | 225 case ui::NativeTheme::kColorId_TextfieldDefaultColor: |
| 211 return GetFgColor("GtkEntry#entry"); | 226 return GetFgColor("GtkTextView#textview.view"); |
| 212 case ui::NativeTheme::kColorId_TextfieldDefaultBackground: | 227 case ui::NativeTheme::kColorId_TextfieldDefaultBackground: |
| 213 return GetBgColor("GtkEntry#entry"); | 228 return GetBgColor("GtkTextView#textview.view"); |
| 214 case ui::NativeTheme::kColorId_TextfieldReadOnlyColor: | 229 case ui::NativeTheme::kColorId_TextfieldReadOnlyColor: |
| 215 return GetFgColor("GtkEntry#entry:disabled"); | 230 return GetFgColor("GtkTextView#textview.view:disabled"); |
| 216 case ui::NativeTheme::kColorId_TextfieldReadOnlyBackground: | 231 case ui::NativeTheme::kColorId_TextfieldReadOnlyBackground: |
| 217 return GetBgColor("GtkEntry#entry:disabled"); | 232 return GetBgColor("GtkTextView#textview.view:disabled"); |
| 218 case ui::NativeTheme::kColorId_TextfieldSelectionColor: | 233 case ui::NativeTheme::kColorId_TextfieldSelectionColor: |
| 219 return GetSelectedTextColor("GtkEntry#entry"); | 234 return GetSelectedTextColor("GtkTextView#textview.view"); |
| 220 case ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused: | 235 case ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused: |
| 221 return GetSelectedBgColor("GtkEntry#entry"); | 236 return GetSelectedBgColor("GtkTextView#textview.view"); |
| 222 | 237 |
| 223 // Tooltips | 238 // Tooltips |
| 224 case ui::NativeTheme::kColorId_TooltipBackground: | 239 case ui::NativeTheme::kColorId_TooltipBackground: |
| 225 return GetBgColor("GtkTooltip#tooltip"); | 240 return GetBgColor("GtkTooltip#tooltip"); |
| 226 case ui::NativeTheme::kColorId_TooltipText: | 241 case ui::NativeTheme::kColorId_TooltipText: |
| 227 return color_utils::GetReadableColor(GetFgColor("GtkTooltip#tooltip"), | 242 return color_utils::GetReadableColor(GetFgColor("GtkTooltip#tooltip"), |
| 228 GetBgColor("GtkTooltip#tooltip")); | 243 GetBgColor("GtkTooltip#tooltip")); |
| 229 | 244 |
| 230 // Trees and Tables (implemented on GTK using the same class) | 245 // Trees and Tables (implemented on GTK using the same class) |
| 231 case ui::NativeTheme::kColorId_TableBackground: | 246 case ui::NativeTheme::kColorId_TableBackground: |
| 232 case ui::NativeTheme::kColorId_TreeBackground: | 247 case ui::NativeTheme::kColorId_TreeBackground: |
| 233 return GetBgColor("GtkTreeView#treeview.view .view.cell"); | 248 return GetBgColor( |
| 249 "GtkTreeView#treeview.view GtkTreeView#treeview.view.cell"); |
| 234 case ui::NativeTheme::kColorId_TableText: | 250 case ui::NativeTheme::kColorId_TableText: |
| 235 case ui::NativeTheme::kColorId_TreeText: | 251 case ui::NativeTheme::kColorId_TreeText: |
| 236 case ui::NativeTheme::kColorId_TableGroupingIndicatorColor: | 252 case ui::NativeTheme::kColorId_TableGroupingIndicatorColor: |
| 237 return GetFgColor("GtkTreeView#treeview.view .view.cell GtkLabel"); | 253 return GetFgColor( |
| 254 "GtkTreeView#treeview.view GtkTreeView#treeview.view.cell GtkLabel"); |
| 238 case ui::NativeTheme::kColorId_TableSelectedText: | 255 case ui::NativeTheme::kColorId_TableSelectedText: |
| 239 case ui::NativeTheme::kColorId_TableSelectedTextUnfocused: | 256 case ui::NativeTheme::kColorId_TableSelectedTextUnfocused: |
| 240 case ui::NativeTheme::kColorId_TreeSelectedText: | 257 case ui::NativeTheme::kColorId_TreeSelectedText: |
| 241 case ui::NativeTheme::kColorId_TreeSelectedTextUnfocused: | 258 case ui::NativeTheme::kColorId_TreeSelectedTextUnfocused: |
| 242 return GetFgColor( | 259 return GetFgColor( |
| 243 "GtkTreeView#treeview.view .view.cell:selected:focus GtkLabel"); | 260 "GtkTreeView#treeview.view " |
| 261 "GtkTreeView#treeview.view.cell:selected:focus GtkLabel"); |
| 244 case ui::NativeTheme::kColorId_TableSelectionBackgroundFocused: | 262 case ui::NativeTheme::kColorId_TableSelectionBackgroundFocused: |
| 245 case ui::NativeTheme::kColorId_TableSelectionBackgroundUnfocused: | 263 case ui::NativeTheme::kColorId_TableSelectionBackgroundUnfocused: |
| 246 case ui::NativeTheme::kColorId_TreeSelectionBackgroundFocused: | 264 case ui::NativeTheme::kColorId_TreeSelectionBackgroundFocused: |
| 247 case ui::NativeTheme::kColorId_TreeSelectionBackgroundUnfocused: | 265 case ui::NativeTheme::kColorId_TreeSelectionBackgroundUnfocused: |
| 248 return GetBgColor("GtkTreeView#treeview.view .view.cell:selected:focus"); | 266 return GetBgColor( |
| 267 "GtkTreeView#treeview.view " |
| 268 "GtkTreeView#treeview.view.cell:selected:focus"); |
| 249 | 269 |
| 250 // Table Header | 270 // Table Header |
| 251 case ui::NativeTheme::kColorId_TableHeaderText: | 271 case ui::NativeTheme::kColorId_TableHeaderText: |
| 252 return GetFgColor("GtkTreeView#treeview.view GtkButton#button GtkLabel"); | 272 return GetFgColor("GtkTreeView#treeview.view GtkButton#button GtkLabel"); |
| 253 case ui::NativeTheme::kColorId_TableHeaderBackground: | 273 case ui::NativeTheme::kColorId_TableHeaderBackground: |
| 254 return GetBgColor("GtkTreeView#treeview.view GtkButton#button"); | 274 return GetBgColor("GtkTreeView#treeview.view GtkButton#button"); |
| 255 case ui::NativeTheme::kColorId_TableHeaderSeparator: | 275 case ui::NativeTheme::kColorId_TableHeaderSeparator: |
| 256 return GetBorderColor("GtkTreeView#treeview.view GtkButton#button"); | 276 return GetBorderColor("GtkTreeView#treeview.view GtkButton#button"); |
| 257 | 277 |
| 258 // Results Table | 278 // Results Table |
| 259 case ui::NativeTheme::kColorId_ResultsTableNormalBackground: | 279 case ui::NativeTheme::kColorId_ResultsTableNormalBackground: |
| 260 return GetBgColor("GtkEntry#entry"); | 280 return SkColorFromColorId( |
| 281 ui::NativeTheme::kColorId_TextfieldDefaultBackground); |
| 261 case ui::NativeTheme::kColorId_ResultsTableHoveredBackground: | 282 case ui::NativeTheme::kColorId_ResultsTableHoveredBackground: |
| 262 return color_utils::AlphaBlend(GetBgColor("GtkEntry#entry"), | 283 return color_utils::AlphaBlend( |
| 263 GetSelectedBgColor("GtkEntry#entry"), | 284 SkColorFromColorId( |
| 264 0x80); | 285 ui::NativeTheme::kColorId_TextfieldDefaultBackground), |
| 286 SkColorFromColorId( |
| 287 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused), |
| 288 0x80); |
| 265 case ui::NativeTheme::kColorId_ResultsTableSelectedBackground: | 289 case ui::NativeTheme::kColorId_ResultsTableSelectedBackground: |
| 266 return GetSelectedBgColor("GtkEntry#entry"); | 290 return SkColorFromColorId( |
| 291 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); |
| 267 case ui::NativeTheme::kColorId_ResultsTableNormalText: | 292 case ui::NativeTheme::kColorId_ResultsTableNormalText: |
| 268 case ui::NativeTheme::kColorId_ResultsTableHoveredText: | 293 case ui::NativeTheme::kColorId_ResultsTableHoveredText: |
| 269 return GetFgColor("GtkEntry#entry"); | 294 return SkColorFromColorId( |
| 295 ui::NativeTheme::kColorId_TextfieldDefaultColor); |
| 270 case ui::NativeTheme::kColorId_ResultsTableSelectedText: | 296 case ui::NativeTheme::kColorId_ResultsTableSelectedText: |
| 271 return GetSelectedTextColor("GtkEntry#entry"); | 297 return SkColorFromColorId( |
| 298 ui::NativeTheme::kColorId_TextfieldSelectionColor); |
| 272 case ui::NativeTheme::kColorId_ResultsTableNormalDimmedText: | 299 case ui::NativeTheme::kColorId_ResultsTableNormalDimmedText: |
| 273 case ui::NativeTheme::kColorId_ResultsTableHoveredDimmedText: | 300 case ui::NativeTheme::kColorId_ResultsTableHoveredDimmedText: |
| 274 return color_utils::AlphaBlend(GetFgColor("GtkEntry#entry"), | 301 return color_utils::AlphaBlend( |
| 275 GetBgColor("GtkEntry#entry"), 0x80); | 302 SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldDefaultColor), |
| 303 SkColorFromColorId( |
| 304 ui::NativeTheme::kColorId_TextfieldDefaultBackground), |
| 305 0x80); |
| 276 case ui::NativeTheme::kColorId_ResultsTableSelectedDimmedText: | 306 case ui::NativeTheme::kColorId_ResultsTableSelectedDimmedText: |
| 277 return color_utils::AlphaBlend(GetSelectedTextColor("GtkEntry#entry"), | 307 return color_utils::AlphaBlend( |
| 278 GetBgColor("GtkEntry#entry"), 0x80); | 308 SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldSelectionColor), |
| 309 SkColorFromColorId( |
| 310 ui::NativeTheme::kColorId_TextfieldDefaultBackground), |
| 311 0x80); |
| 279 case ui::NativeTheme::kColorId_ResultsTableNormalUrl: | 312 case ui::NativeTheme::kColorId_ResultsTableNormalUrl: |
| 280 case ui::NativeTheme::kColorId_ResultsTableHoveredUrl: | 313 case ui::NativeTheme::kColorId_ResultsTableHoveredUrl: |
| 281 return NormalURLColor(GetFgColor("GtkEntry#entry")); | 314 return NormalURLColor( |
| 315 SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldDefaultColor)); |
| 282 case ui::NativeTheme::kColorId_ResultsTableSelectedUrl: | 316 case ui::NativeTheme::kColorId_ResultsTableSelectedUrl: |
| 283 return SelectedURLColor(GetSelectedTextColor("GtkEntry#entry"), | 317 return SelectedURLColor( |
| 284 GetSelectedBgColor("GtkEntry#entry")); | 318 SkColorFromColorId(ui::NativeTheme::kColorId_TextfieldSelectionColor), |
| 285 | 319 SkColorFromColorId( |
| 320 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused)); |
| 286 case ui::NativeTheme::kColorId_ResultsTablePositiveText: | 321 case ui::NativeTheme::kColorId_ResultsTablePositiveText: |
| 287 return color_utils::GetReadableColor(kPositiveTextColor, | 322 return color_utils::GetReadableColor( |
| 288 GetBgColor("GtkEntry#entry")); | 323 kPositiveTextColor, |
| 324 SkColorFromColorId( |
| 325 ui::NativeTheme::kColorId_TextfieldDefaultBackground)); |
| 289 case ui::NativeTheme::kColorId_ResultsTablePositiveHoveredText: | 326 case ui::NativeTheme::kColorId_ResultsTablePositiveHoveredText: |
| 290 return color_utils::GetReadableColor(kPositiveTextColor, | 327 return color_utils::GetReadableColor( |
| 291 GetBgColor("GtkEntry#entry:hover")); | 328 kPositiveTextColor, |
| 329 SkColorFromColorId( |
| 330 ui::NativeTheme::kColorId_TextfieldDefaultBackground)); |
| 292 case ui::NativeTheme::kColorId_ResultsTablePositiveSelectedText: | 331 case ui::NativeTheme::kColorId_ResultsTablePositiveSelectedText: |
| 293 return color_utils::GetReadableColor( | 332 return color_utils::GetReadableColor( |
| 294 kPositiveTextColor, GetBgColor("GtkEntry#entry:selected")); | 333 kPositiveTextColor, |
| 334 SkColorFromColorId( |
| 335 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused)); |
| 295 case ui::NativeTheme::kColorId_ResultsTableNegativeText: | 336 case ui::NativeTheme::kColorId_ResultsTableNegativeText: |
| 296 return color_utils::GetReadableColor(kNegativeTextColor, | 337 return color_utils::GetReadableColor( |
| 297 GetBgColor("GtkEntry#entry")); | 338 kNegativeTextColor, |
| 339 SkColorFromColorId( |
| 340 ui::NativeTheme::kColorId_TextfieldDefaultBackground)); |
| 298 case ui::NativeTheme::kColorId_ResultsTableNegativeHoveredText: | 341 case ui::NativeTheme::kColorId_ResultsTableNegativeHoveredText: |
| 299 return color_utils::GetReadableColor(kNegativeTextColor, | 342 return color_utils::GetReadableColor( |
| 300 GetBgColor("GtkEntry#entry:hover")); | 343 kNegativeTextColor, |
| 344 SkColorFromColorId( |
| 345 ui::NativeTheme::kColorId_TextfieldDefaultBackground)); |
| 301 case ui::NativeTheme::kColorId_ResultsTableNegativeSelectedText: | 346 case ui::NativeTheme::kColorId_ResultsTableNegativeSelectedText: |
| 302 return color_utils::GetReadableColor( | 347 return color_utils::GetReadableColor( |
| 303 kNegativeTextColor, GetBgColor("GtkEntry#entry:selected")); | 348 kNegativeTextColor, |
| 349 SkColorFromColorId( |
| 350 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused)); |
| 304 | 351 |
| 305 // Throbber | 352 // Throbber |
| 306 // TODO(thomasanderson): Render GtkSpinner directly. | 353 // TODO(thomasanderson): Render GtkSpinner directly. |
| 307 case ui::NativeTheme::kColorId_ThrobberSpinningColor: | 354 case ui::NativeTheme::kColorId_ThrobberSpinningColor: |
| 308 case ui::NativeTheme::kColorId_ThrobberWaitingColor: | 355 case ui::NativeTheme::kColorId_ThrobberWaitingColor: |
| 309 return GetFgColor("GtkMenu#menu GtkSpinner#spinner"); | 356 return GetFgColor("GtkMenu#menu GtkSpinner#spinner"); |
| 310 case ui::NativeTheme::kColorId_ThrobberLightColor: | 357 case ui::NativeTheme::kColorId_ThrobberLightColor: |
| 311 return GetFgColor("GtkMenu#menu GtkSpinner#spinner:disabled"); | 358 return GetFgColor("GtkMenu#menu GtkSpinner#spinner:disabled"); |
| 312 | 359 |
| 313 // Alert icons | 360 // Alert icons |
| (...skipping 22 matching lines...) Expand all Loading... |
| 336 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk3, s_native_theme, ()); | 383 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk3, s_native_theme, ()); |
| 337 return &s_native_theme; | 384 return &s_native_theme; |
| 338 } | 385 } |
| 339 | 386 |
| 340 // Constructors automatically called | 387 // Constructors automatically called |
| 341 NativeThemeGtk3::NativeThemeGtk3() { | 388 NativeThemeGtk3::NativeThemeGtk3() { |
| 342 // These types are needed by g_type_from_name(), but may not be registered at | 389 // These types are needed by g_type_from_name(), but may not be registered at |
| 343 // this point. We need the g_type_class magic to make sure the compiler | 390 // this point. We need the g_type_class magic to make sure the compiler |
| 344 // doesn't optimize away this code. | 391 // doesn't optimize away this code. |
| 345 g_type_class_unref(g_type_class_ref(gtk_button_get_type())); | 392 g_type_class_unref(g_type_class_ref(gtk_button_get_type())); |
| 346 g_type_class_unref(g_type_class_ref(gtk_label_get_type())); | |
| 347 g_type_class_unref(g_type_class_ref(gtk_window_get_type())); | |
| 348 g_type_class_unref(g_type_class_ref(gtk_link_button_get_type())); | |
| 349 g_type_class_unref(g_type_class_ref(gtk_spinner_get_type())); | |
| 350 g_type_class_unref(g_type_class_ref(gtk_menu_get_type())); | |
| 351 g_type_class_unref(g_type_class_ref(gtk_menu_item_get_type())); | |
| 352 g_type_class_unref(g_type_class_ref(gtk_entry_get_type())); | 393 g_type_class_unref(g_type_class_ref(gtk_entry_get_type())); |
| 353 g_type_class_unref(g_type_class_ref(gtk_info_bar_get_type())); | 394 g_type_class_unref(g_type_class_ref(gtk_info_bar_get_type())); |
| 395 g_type_class_unref(g_type_class_ref(gtk_label_get_type())); |
| 396 g_type_class_unref(g_type_class_ref(gtk_menu_get_type())); |
| 397 g_type_class_unref(g_type_class_ref(gtk_menu_bar_get_type())); |
| 398 g_type_class_unref(g_type_class_ref(gtk_menu_item_get_type())); |
| 399 g_type_class_unref(g_type_class_ref(gtk_range_get_type())); |
| 400 g_type_class_unref(g_type_class_ref(gtk_scrollbar_get_type())); |
| 401 g_type_class_unref(g_type_class_ref(gtk_scrolled_window_get_type())); |
| 402 g_type_class_unref(g_type_class_ref(gtk_separator_get_type())); |
| 403 g_type_class_unref(g_type_class_ref(gtk_spinner_get_type())); |
| 404 g_type_class_unref(g_type_class_ref(gtk_text_view_get_type())); |
| 405 g_type_class_unref(g_type_class_ref(gtk_toolbar_get_type())); |
| 354 g_type_class_unref(g_type_class_ref(gtk_tooltip_get_type())); | 406 g_type_class_unref(g_type_class_ref(gtk_tooltip_get_type())); |
| 355 g_type_class_unref(g_type_class_ref(gtk_scrollbar_get_type())); | 407 g_type_class_unref(g_type_class_ref(gtk_tree_view_get_type())); |
| 356 g_type_class_unref(g_type_class_ref(gtk_toolbar_get_type())); | 408 g_type_class_unref(g_type_class_ref(gtk_window_get_type())); |
| 357 g_type_class_unref(g_type_class_ref(gtk_text_view_get_type())); | |
| 358 g_type_class_unref(g_type_class_ref(gtk_separator_get_type())); | |
| 359 g_type_class_unref(g_type_class_ref(gtk_menu_bar_get_type())); | |
| 360 g_type_class_unref(g_type_class_ref(gtk_scrolled_window_get_type())); | |
| 361 g_type_class_unref(g_type_class_ref(gtk_range_get_type())); | |
| 362 | 409 |
| 363 g_signal_connect_after(gtk_settings_get_default(), "notify::gtk-theme-name", | 410 g_signal_connect_after(gtk_settings_get_default(), "notify::gtk-theme-name", |
| 364 G_CALLBACK(OnThemeChanged), this); | 411 G_CALLBACK(OnThemeChanged), this); |
| 365 } | 412 } |
| 366 | 413 |
| 367 // This doesn't actually get called | 414 // This doesn't actually get called |
| 368 NativeThemeGtk3::~NativeThemeGtk3() {} | 415 NativeThemeGtk3::~NativeThemeGtk3() {} |
| 369 | 416 |
| 370 void NativeThemeGtk3::ResetColorCache() { | 417 void NativeThemeGtk3::ResetColorCache() { |
| 371 for (auto& color : color_cache_) | 418 for (auto& color : color_cache_) |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 591 |
| 545 if (frame_top_area.incognito) { | 592 if (frame_top_area.incognito) { |
| 546 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap( | 593 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap( |
| 547 bitmap, kDefaultTintFrameIncognito); | 594 bitmap, kDefaultTintFrameIncognito); |
| 548 } | 595 } |
| 549 | 596 |
| 550 canvas->drawBitmap(bitmap, rect.x(), rect.y()); | 597 canvas->drawBitmap(bitmap, rect.x(), rect.y()); |
| 551 } | 598 } |
| 552 | 599 |
| 553 } // namespace libgtkui | 600 } // namespace libgtkui |
| OLD | NEW |