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

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

Issue 6688049: New InputMethod api for Views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review feedbacks. Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 GList *window_list = gtk_window_list_toplevels(); 1561 GList *window_list = gtk_window_list_toplevels();
1562 for (GList* element = window_list; element; element = g_list_next(element)) { 1562 for (GList* element = window_list; element; element = g_list_next(element)) {
1563 NativeWidget* native_widget = 1563 NativeWidget* native_widget =
1564 NativeWidget::GetNativeWidgetForNativeWindow(GTK_WINDOW(element->data)); 1564 NativeWidget::GetNativeWidgetForNativeWindow(GTK_WINDOW(element->data));
1565 if (native_widget) 1565 if (native_widget)
1566 native_widget->GetWidget()->LocaleChanged(); 1566 native_widget->GetWidget()->LocaleChanged();
1567 } 1567 }
1568 g_list_free(window_list); 1568 g_list_free(window_list);
1569 } 1569 }
1570 1570
1571 // static
1572 bool Widget::ConvertRect(const Widget* source,
1573 const Widget* target,
1574 gfx::Rect* rect) {
1575 DCHECK(source);
1576 DCHECK(target);
1577 DCHECK(rect);
1578
1579 GtkWidget* source_widget = source->GetNativeView();
1580 GtkWidget* target_widget = target->GetNativeView();
1581 if (source_widget == target_widget)
1582 return true;
1583
1584 if (!source_widget || !target_widget)
1585 return false;
1586
1587 GdkRectangle gdk_rect = rect->ToGdkRectangle();
1588 if (gtk_widget_translate_coordinates(source_widget, target_widget,
1589 gdk_rect.x, gdk_rect.y,
1590 &gdk_rect.x, &gdk_rect.y)) {
1591 *rect = gdk_rect;
1592 return true;
1593 }
1594 return false;
1595 }
1596
1571 //////////////////////////////////////////////////////////////////////////////// 1597 ////////////////////////////////////////////////////////////////////////////////
1572 // NativeWidget, public: 1598 // NativeWidget, public:
1573 1599
1574 // static 1600 // static
1575 NativeWidget* NativeWidget::GetNativeWidgetForNativeView( 1601 NativeWidget* NativeWidget::GetNativeWidgetForNativeView(
1576 gfx::NativeView native_view) { 1602 gfx::NativeView native_view) {
1577 if (!native_view) 1603 if (!native_view)
1578 return NULL; 1604 return NULL;
1579 return reinterpret_cast<WidgetGtk*>( 1605 return reinterpret_cast<WidgetGtk*>(
1580 g_object_get_data(G_OBJECT(native_view), kNativeWidgetKey)); 1606 g_object_get_data(G_OBJECT(native_view), kNativeWidgetKey));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 1643
1618 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); 1644 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view);
1619 if (native_widget) 1645 if (native_widget)
1620 children->insert(native_widget); 1646 children->insert(native_widget);
1621 gtk_container_foreach(GTK_CONTAINER(native_view), 1647 gtk_container_foreach(GTK_CONTAINER(native_view),
1622 EnumerateChildWidgetsForNativeWidgets, 1648 EnumerateChildWidgetsForNativeWidgets,
1623 reinterpret_cast<gpointer>(children)); 1649 reinterpret_cast<gpointer>(children));
1624 } 1650 }
1625 1651
1626 } // namespace views 1652 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698