OLD | NEW |
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 "ui/views/widget/native_widget_gtk.h" | 5 #include "ui/views/widget/native_widget_gtk.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 #include <X11/extensions/shape.h> | 9 #include <X11/extensions/shape.h> |
10 #include <gdk/gdk.h> | 10 #include <gdk/gdk.h> |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 if (delegate_lost_capture) | 942 if (delegate_lost_capture) |
943 delegate_->OnMouseCaptureLost(); | 943 delegate_->OnMouseCaptureLost(); |
944 } | 944 } |
945 | 945 |
946 bool NativeWidgetGtk::HasMouseCapture() const { | 946 bool NativeWidgetGtk::HasMouseCapture() const { |
947 return GTK_WIDGET_HAS_GRAB(window_contents_) || has_pointer_grab_; | 947 return GTK_WIDGET_HAS_GRAB(window_contents_) || has_pointer_grab_; |
948 } | 948 } |
949 | 949 |
950 InputMethod* NativeWidgetGtk::CreateInputMethod() { | 950 InputMethod* NativeWidgetGtk::CreateInputMethod() { |
951 // Create input method when pure views is enabled but not on views desktop. | 951 // Create input method when pure views is enabled but not on views desktop. |
| 952 // TODO(suzhe): Always enable input method when we start to use |
| 953 // RenderWidgetHostViewViews in normal ChromeOS. |
952 if (views::Widget::IsPureViews()) { | 954 if (views::Widget::IsPureViews()) { |
| 955 #if defined(HAVE_IBUS) |
| 956 InputMethod* input_method = |
| 957 InputMethodIBus::IsInputMethodIBusEnabled() ? |
| 958 static_cast<InputMethod*>(new InputMethodIBus(this)) : |
| 959 static_cast<InputMethod*>(new InputMethodGtk(this)); |
| 960 #else |
953 InputMethod* input_method = new InputMethodGtk(this); | 961 InputMethod* input_method = new InputMethodGtk(this); |
| 962 #endif |
954 input_method->Init(GetWidget()); | 963 input_method->Init(GetWidget()); |
955 return input_method; | 964 return input_method; |
956 } | 965 } |
957 // GTK's textfield will handle IME. | 966 // GTK's textfield will handle IME. |
958 return NULL; | 967 return NULL; |
959 } | 968 } |
960 | 969 |
961 void NativeWidgetGtk::CenterWindow(const gfx::Size& size) { | 970 void NativeWidgetGtk::CenterWindow(const gfx::Size& size) { |
962 gfx::Rect center_rect; | 971 gfx::Rect center_rect; |
963 | 972 |
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 button_pressed = event->type == GDK_BUTTON_PRESS || | 2221 button_pressed = event->type == GDK_BUTTON_PRESS || |
2213 event->type == GDK_2BUTTON_PRESS || | 2222 event->type == GDK_2BUTTON_PRESS || |
2214 event->type == GDK_3BUTTON_PRESS; | 2223 event->type == GDK_3BUTTON_PRESS; |
2215 gdk_event_free(event); | 2224 gdk_event_free(event); |
2216 } | 2225 } |
2217 return button_pressed; | 2226 return button_pressed; |
2218 } | 2227 } |
2219 | 2228 |
2220 } // namespace internal | 2229 } // namespace internal |
2221 } // namespace views | 2230 } // namespace views |
OLD | NEW |