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

Side by Side Diff: views/widget/widget_gtk.cc

Issue 5144005: Converts usage of SetProp/GetProp to a map. Even after making sure we (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Fix build Created 10 years, 1 month 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
« no previous file with comments | « views/widget/widget_gtk.h ('k') | views/widget/widget_win.h » ('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) 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 "views/widget/widget_gtk.h" 5 #include "views/widget/widget_gtk.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 <X11/extensions/shape.h> 9 #include <X11/extensions/shape.h>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "views/widget/gtk_views_window.h" 25 #include "views/widget/gtk_views_window.h"
26 #include "views/widget/root_view.h" 26 #include "views/widget/root_view.h"
27 #include "views/widget/tooltip_manager_gtk.h" 27 #include "views/widget/tooltip_manager_gtk.h"
28 #include "views/widget/widget_delegate.h" 28 #include "views/widget/widget_delegate.h"
29 #include "views/window/window_gtk.h" 29 #include "views/window/window_gtk.h"
30 30
31 namespace { 31 namespace {
32 32
33 // g_object data keys to associate a WidgetGtk object to a GtkWidget. 33 // g_object data keys to associate a WidgetGtk object to a GtkWidget.
34 const char* kWidgetKey = "__VIEWS_WIDGET__"; 34 const char* kWidgetKey = "__VIEWS_WIDGET__";
35 const wchar_t* kWidgetWideKey = L"__VIEWS_WIDGET__";
36 // A g_object data key to associate a CompositePainter object to a GtkWidget. 35 // A g_object data key to associate a CompositePainter object to a GtkWidget.
37 const char* kCompositePainterKey = "__VIEWS_COMPOSITE_PAINTER__"; 36 const char* kCompositePainterKey = "__VIEWS_COMPOSITE_PAINTER__";
38 // A g_object data key to associate the flag whether or not the widget 37 // A g_object data key to associate the flag whether or not the widget
39 // is composited to a GtkWidget. gtk_widget_is_composited simply tells 38 // is composited to a GtkWidget. gtk_widget_is_composited simply tells
40 // if x11 supports composition and cannot be used to tell if given widget 39 // if x11 supports composition and cannot be used to tell if given widget
41 // is composited. 40 // is composited.
42 const char* kCompositeEnabledKey = "__VIEWS_COMPOSITE_ENABLED__"; 41 const char* kCompositeEnabledKey = "__VIEWS_COMPOSITE_ENABLED__";
43 42
44 // CompositePainter draws a composited child widgets image into its 43 // CompositePainter draws a composited child widgets image into its
45 // drawing area. This object is created at most once for a widget and kept 44 // drawing area. This object is created at most once for a widget and kept
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 } 795 }
797 796
798 Window* WidgetGtk::GetWindow() { 797 Window* WidgetGtk::GetWindow() {
799 return GetWindowImpl(widget_); 798 return GetWindowImpl(widget_);
800 } 799 }
801 800
802 const Window* WidgetGtk::GetWindow() const { 801 const Window* WidgetGtk::GetWindow() const {
803 return GetWindowImpl(widget_); 802 return GetWindowImpl(widget_);
804 } 803 }
805 804
806 void WidgetGtk::SetNativeWindowProperty(const std::wstring& name, 805 void WidgetGtk::SetNativeWindowProperty(const char* name, void* value) {
807 void* value) { 806 g_object_set_data(G_OBJECT(widget_), name, value);
808 g_object_set_data(G_OBJECT(widget_), WideToUTF8(name).c_str(), value);
809 } 807 }
810 808
811 void* WidgetGtk::GetNativeWindowProperty(const std::wstring& name) { 809 void* WidgetGtk::GetNativeWindowProperty(const char* name) {
812 return g_object_get_data(G_OBJECT(widget_), WideToUTF8(name).c_str()); 810 return g_object_get_data(G_OBJECT(widget_), name);
813 } 811 }
814 812
815 ThemeProvider* WidgetGtk::GetThemeProvider() const { 813 ThemeProvider* WidgetGtk::GetThemeProvider() const {
816 return default_theme_provider_.get(); 814 return default_theme_provider_.get();
817 } 815 }
818 816
819 ThemeProvider* WidgetGtk::GetDefaultThemeProvider() const { 817 ThemeProvider* WidgetGtk::GetDefaultThemeProvider() const {
820 return default_theme_provider_.get(); 818 return default_theme_provider_.get();
821 } 819 }
822 820
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 if (ignore_events_) 1481 if (ignore_events_)
1484 ConfigureWidgetForIgnoreEvents(); 1482 ConfigureWidgetForIgnoreEvents();
1485 1483
1486 SetAlwaysOnTop(always_on_top_); 1484 SetAlwaysOnTop(always_on_top_);
1487 // The widget needs to be realized before handlers like size-allocate can 1485 // The widget needs to be realized before handlers like size-allocate can
1488 // function properly. 1486 // function properly.
1489 gtk_widget_realize(widget_); 1487 gtk_widget_realize(widget_);
1490 } 1488 }
1491 // Setting the WidgetKey property to widget_, which is used by 1489 // Setting the WidgetKey property to widget_, which is used by
1492 // GetWidgetFromNativeWindow. 1490 // GetWidgetFromNativeWindow.
1493 SetNativeWindowProperty(kWidgetWideKey, this); 1491 SetNativeWindowProperty(kWidgetKey, this);
1494 } 1492 }
1495 1493
1496 void WidgetGtk::ConfigureWidgetForTransparentBackground(GtkWidget* parent) { 1494 void WidgetGtk::ConfigureWidgetForTransparentBackground(GtkWidget* parent) {
1497 DCHECK(widget_ && window_contents_); 1495 DCHECK(widget_ && window_contents_);
1498 1496
1499 GdkColormap* rgba_colormap = 1497 GdkColormap* rgba_colormap =
1500 gdk_screen_get_rgba_colormap(gtk_widget_get_screen(widget_)); 1498 gdk_screen_get_rgba_colormap(gtk_widget_get_screen(widget_));
1501 if (!rgba_colormap) { 1499 if (!rgba_colormap) {
1502 transparent_ = false; 1500 transparent_ = false;
1503 return; 1501 return;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 GtkWindow* window = GTK_WINDOW(element->data); 1654 GtkWindow* window = GTK_WINDOW(element->data);
1657 DCHECK(window); 1655 DCHECK(window);
1658 RootView *root_view = FindRootView(window); 1656 RootView *root_view = FindRootView(window);
1659 if (root_view) 1657 if (root_view)
1660 root_view->NotifyLocaleChanged(); 1658 root_view->NotifyLocaleChanged();
1661 } 1659 }
1662 g_list_free(window_list); 1660 g_list_free(window_list);
1663 } 1661 }
1664 1662
1665 } // namespace views 1663 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/widget_gtk.h ('k') | views/widget/widget_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698