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

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

Issue 7761008: minor fixes to get virtual keyboard work on views desktop without ibus (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
« no previous file with comments | « views/ime/mock_input_method.cc ('k') | no next file » | 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) 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/native_widget_gtk.h" 5 #include "views/widget/native_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 #include <X11/Xatom.h> 10 #include <X11/Xatom.h>
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 } 954 }
955 if (delegate_lost_capture) 955 if (delegate_lost_capture)
956 delegate_->OnMouseCaptureLost(); 956 delegate_->OnMouseCaptureLost();
957 } 957 }
958 958
959 bool NativeWidgetGtk::HasMouseCapture() const { 959 bool NativeWidgetGtk::HasMouseCapture() const {
960 return GTK_WIDGET_HAS_GRAB(window_contents_) || has_pointer_grab_; 960 return GTK_WIDGET_HAS_GRAB(window_contents_) || has_pointer_grab_;
961 } 961 }
962 962
963 InputMethod* NativeWidgetGtk::CreateInputMethod() { 963 InputMethod* NativeWidgetGtk::CreateInputMethod() {
964 // Create input method when pure views is enabled. 964 // Create input method when pure views is enabled but not on views desktop.
965 // TODO(suzhe): Always enable input method when we start to use 965 // TODO(suzhe): Always enable input method when we start to use
966 // RenderWidgetHostViewViews in normal ChromeOS. 966 // RenderWidgetHostViewViews in normal ChromeOS.
967 if (views::Widget::IsPureViews()) { 967 if (views::Widget::IsPureViews() &&
968 !ViewsDelegate::views_delegate->GetDefaultParentView()) {
968 #if defined(HAVE_IBUS) 969 #if defined(HAVE_IBUS)
969 InputMethod* input_method = 970 InputMethod* input_method =
970 InputMethodIBus::IsInputMethodIBusEnabled() ? 971 InputMethodIBus::IsInputMethodIBusEnabled() ?
971 static_cast<InputMethod*>(new InputMethodIBus(this)) : 972 static_cast<InputMethod*>(new InputMethodIBus(this)) :
972 static_cast<InputMethod*>(new InputMethodGtk(this)); 973 static_cast<InputMethod*>(new InputMethodGtk(this));
973 #else 974 #else
974 InputMethod* input_method = new InputMethodGtk(this); 975 InputMethod* input_method = new InputMethodGtk(this);
975 #endif 976 #endif
976 input_method->Init(GetWidget()); 977 input_method->Init(GetWidget());
977 return input_method; 978 return input_method;
978 } 979 }
979 // GTK's textfield handles IME. 980 // GTK's textfield or InputMethod in NativeWidgetViews will handle IME.
980 return NULL; 981 return NULL;
981 } 982 }
982 983
983 void NativeWidgetGtk::CenterWindow(const gfx::Size& size) { 984 void NativeWidgetGtk::CenterWindow(const gfx::Size& size) {
984 gfx::Rect center_rect; 985 gfx::Rect center_rect;
985 986
986 GtkWindow* parent = gtk_window_get_transient_for(GetNativeWindow()); 987 GtkWindow* parent = gtk_window_get_transient_for(GetNativeWindow());
987 if (parent) { 988 if (parent) {
988 // We have a parent window, center over it. 989 // We have a parent window, center over it.
989 gint parent_x = 0; 990 gint parent_x = 0;
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 button_pressed = event->type == GDK_BUTTON_PRESS || 2244 button_pressed = event->type == GDK_BUTTON_PRESS ||
2244 event->type == GDK_2BUTTON_PRESS || 2245 event->type == GDK_2BUTTON_PRESS ||
2245 event->type == GDK_3BUTTON_PRESS; 2246 event->type == GDK_3BUTTON_PRESS;
2246 gdk_event_free(event); 2247 gdk_event_free(event);
2247 } 2248 }
2248 return button_pressed; 2249 return button_pressed;
2249 } 2250 }
2250 2251
2251 } // namespace internal 2252 } // namespace internal
2252 } // namespace views 2253 } // namespace views
OLDNEW
« no previous file with comments | « views/ime/mock_input_method.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698