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

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: Rebase. 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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 GList *window_list = gtk_window_list_toplevels(); 1578 GList *window_list = gtk_window_list_toplevels();
1579 for (GList* element = window_list; element; element = g_list_next(element)) { 1579 for (GList* element = window_list; element; element = g_list_next(element)) {
1580 NativeWidget* native_widget = 1580 NativeWidget* native_widget =
1581 NativeWidget::GetNativeWidgetForNativeWindow(GTK_WINDOW(element->data)); 1581 NativeWidget::GetNativeWidgetForNativeWindow(GTK_WINDOW(element->data));
1582 if (native_widget) 1582 if (native_widget)
1583 native_widget->GetWidget()->LocaleChanged(); 1583 native_widget->GetWidget()->LocaleChanged();
1584 } 1584 }
1585 g_list_free(window_list); 1585 g_list_free(window_list);
1586 } 1586 }
1587 1587
1588 // static
1589 bool Widget::ConvertRect(const Widget* source,
1590 const Widget* target,
1591 gfx::Rect* rect) {
1592 DCHECK(source);
1593 DCHECK(target);
1594 DCHECK(rect);
1595
1596 GtkWidget* source_widget = source->GetNativeView();
1597 GtkWidget* target_widget = target->GetNativeView();
1598 if (source_widget == target_widget)
1599 return true;
1600
1601 if (!source_widget || !target_widget)
1602 return false;
1603
1604 GdkRectangle gdk_rect = rect->ToGdkRectangle();
1605 if (gtk_widget_translate_coordinates(source_widget, target_widget,
1606 gdk_rect.x, gdk_rect.y,
1607 &gdk_rect.x, &gdk_rect.y)) {
1608 *rect = gdk_rect;
1609 return true;
1610 }
1611 return false;
1612 }
1613
1588 //////////////////////////////////////////////////////////////////////////////// 1614 ////////////////////////////////////////////////////////////////////////////////
1589 // NativeWidget, public: 1615 // NativeWidget, public:
1590 1616
1591 // static 1617 // static
1592 NativeWidget* NativeWidget::GetNativeWidgetForNativeView( 1618 NativeWidget* NativeWidget::GetNativeWidgetForNativeView(
1593 gfx::NativeView native_view) { 1619 gfx::NativeView native_view) {
1594 if (!native_view) 1620 if (!native_view)
1595 return NULL; 1621 return NULL;
1596 return reinterpret_cast<WidgetGtk*>( 1622 return reinterpret_cast<WidgetGtk*>(
1597 g_object_get_data(G_OBJECT(native_view), kNativeWidgetKey)); 1623 g_object_get_data(G_OBJECT(native_view), kNativeWidgetKey));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 1660
1635 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); 1661 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view);
1636 if (native_widget) 1662 if (native_widget)
1637 children->insert(native_widget); 1663 children->insert(native_widget);
1638 gtk_container_foreach(GTK_CONTAINER(native_view), 1664 gtk_container_foreach(GTK_CONTAINER(native_view),
1639 EnumerateChildWidgetsForNativeWidgets, 1665 EnumerateChildWidgetsForNativeWidgets,
1640 reinterpret_cast<gpointer>(children)); 1666 reinterpret_cast<gpointer>(children));
1641 } 1667 }
1642 1668
1643 } // namespace views 1669 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698