| 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 27 matching lines...) Expand all Loading... |
| 38 #include "ui/views/focus/view_storage.h" | 38 #include "ui/views/focus/view_storage.h" |
| 39 #include "ui/views/ime/input_method_gtk.h" | 39 #include "ui/views/ime/input_method_gtk.h" |
| 40 #include "ui/views/views_delegate.h" | 40 #include "ui/views/views_delegate.h" |
| 41 #include "ui/views/widget/drop_target_gtk.h" | 41 #include "ui/views/widget/drop_target_gtk.h" |
| 42 #include "ui/views/widget/gtk_views_fixed.h" | 42 #include "ui/views/widget/gtk_views_fixed.h" |
| 43 #include "ui/views/widget/gtk_views_window.h" | 43 #include "ui/views/widget/gtk_views_window.h" |
| 44 #include "ui/views/widget/root_view.h" | 44 #include "ui/views/widget/root_view.h" |
| 45 #include "ui/views/widget/tooltip_manager_gtk.h" | 45 #include "ui/views/widget/tooltip_manager_gtk.h" |
| 46 #include "ui/views/widget/widget_delegate.h" | 46 #include "ui/views/widget/widget_delegate.h" |
| 47 | 47 |
| 48 #if defined(HAVE_IBUS) | |
| 49 #include "ui/views/ime/input_method_ibus.h" | |
| 50 #endif | |
| 51 | |
| 52 using ui::OSExchangeData; | 48 using ui::OSExchangeData; |
| 53 using ui::OSExchangeDataProviderGtk; | 49 using ui::OSExchangeDataProviderGtk; |
| 54 using ui::ActiveWindowWatcherX; | 50 using ui::ActiveWindowWatcherX; |
| 55 | 51 |
| 56 namespace views { | 52 namespace views { |
| 57 | 53 |
| 58 namespace { | 54 namespace { |
| 59 | 55 |
| 60 // Links the GtkWidget to its NativeWidget. | 56 // Links the GtkWidget to its NativeWidget. |
| 61 const char* const kNativeWidgetKey = "__VIEWS_NATIVE_WIDGET__"; | 57 const char* const kNativeWidgetKey = "__VIEWS_NATIVE_WIDGET__"; |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 if (delegate_lost_capture) | 938 if (delegate_lost_capture) |
| 943 delegate_->OnMouseCaptureLost(); | 939 delegate_->OnMouseCaptureLost(); |
| 944 } | 940 } |
| 945 | 941 |
| 946 bool NativeWidgetGtk::HasMouseCapture() const { | 942 bool NativeWidgetGtk::HasMouseCapture() const { |
| 947 return GTK_WIDGET_HAS_GRAB(window_contents_) || has_pointer_grab_; | 943 return GTK_WIDGET_HAS_GRAB(window_contents_) || has_pointer_grab_; |
| 948 } | 944 } |
| 949 | 945 |
| 950 InputMethod* NativeWidgetGtk::CreateInputMethod() { | 946 InputMethod* NativeWidgetGtk::CreateInputMethod() { |
| 951 // Create input method when pure views is enabled but not on views desktop. | 947 // 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. | |
| 954 if (views::Widget::IsPureViews()) { | 948 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 | |
| 961 InputMethod* input_method = new InputMethodGtk(this); | 949 InputMethod* input_method = new InputMethodGtk(this); |
| 962 #endif | |
| 963 input_method->Init(GetWidget()); | 950 input_method->Init(GetWidget()); |
| 964 return input_method; | 951 return input_method; |
| 965 } | 952 } |
| 966 // GTK's textfield will handle IME. | 953 // GTK's textfield will handle IME. |
| 967 return NULL; | 954 return NULL; |
| 968 } | 955 } |
| 969 | 956 |
| 970 void NativeWidgetGtk::CenterWindow(const gfx::Size& size) { | 957 void NativeWidgetGtk::CenterWindow(const gfx::Size& size) { |
| 971 gfx::Rect center_rect; | 958 gfx::Rect center_rect; |
| 972 | 959 |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2221 button_pressed = event->type == GDK_BUTTON_PRESS || | 2208 button_pressed = event->type == GDK_BUTTON_PRESS || |
| 2222 event->type == GDK_2BUTTON_PRESS || | 2209 event->type == GDK_2BUTTON_PRESS || |
| 2223 event->type == GDK_3BUTTON_PRESS; | 2210 event->type == GDK_3BUTTON_PRESS; |
| 2224 gdk_event_free(event); | 2211 gdk_event_free(event); |
| 2225 } | 2212 } |
| 2226 return button_pressed; | 2213 return button_pressed; |
| 2227 } | 2214 } |
| 2228 | 2215 |
| 2229 } // namespace internal | 2216 } // namespace internal |
| 2230 } // namespace views | 2217 } // namespace views |
| OLD | NEW |