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

Unified Diff: chrome/browser/ui/libgtkui/x11_input_method_context_impl_gtk.cc

Issue 2593323002: Use the physical-pixel space for native IME on linux platform. (Closed)
Patch Set: Use the physical-pixel space for native IME on linux platform. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/base/ime/text_input_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtkui/x11_input_method_context_impl_gtk.cc
diff --git a/chrome/browser/ui/libgtkui/x11_input_method_context_impl_gtk.cc b/chrome/browser/ui/libgtkui/x11_input_method_context_impl_gtk.cc
index 65bbe050e473fba18c3b4a86d3bf6cec1e8f6c1e..cfd6edec9c42abe451ebd15e10c3a89c281c5f90 100644
--- a/chrome/browser/ui/libgtkui/x11_input_method_context_impl_gtk.cc
+++ b/chrome/browser/ui/libgtkui/x11_input_method_context_impl_gtk.cc
@@ -21,7 +21,9 @@
#include "ui/base/ime/text_input_client.h"
#include "ui/events/event.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
+#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/x/x11_types.h"
+#include "ui/views/linux_ui/linux_ui.h"
namespace libgtkui {
@@ -81,9 +83,11 @@ bool X11InputMethodContextImplGtk2::DispatchKeyEvent(
gint x = 0;
gint y = 0;
gdk_window_get_origin(event->key.window, &x, &y);
- GdkRectangle rect = {last_caret_bounds_.x() - x, last_caret_bounds_.y() - y,
- last_caret_bounds_.width(), last_caret_bounds_.height()};
- gtk_im_context_set_cursor_location(gtk_context_, &rect);
+
+ GdkRectangle gdk_rect = {
+ last_caret_bounds_.x() - x, last_caret_bounds_.y() - y,
+ last_caret_bounds_.width(), last_caret_bounds_.height()};
+ gtk_im_context_set_cursor_location(gtk_context_, &gdk_rect);
const bool handled =
gtk_im_context_filter_keypress(gtk_context_, &event->key);
@@ -109,7 +113,12 @@ void X11InputMethodContextImplGtk2::SetCursorLocation(const gfx::Rect& rect) {
// client window, which is unknown at this point. So we'll call
// gtk_im_context_set_cursor_location() later in ProcessKeyEvent() where
// (and only where) we know the client window.
- last_caret_bounds_ = rect;
+ if (views::LinuxUI::instance()) {
+ last_caret_bounds_ = gfx::ConvertRectToPixel(
+ views::LinuxUI::instance()->GetDeviceScaleFactor(), rect);
+ } else {
+ last_caret_bounds_ = rect;
+ }
}
// private:
« no previous file with comments | « no previous file | ui/base/ime/text_input_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698