New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 774974 link

Starred by 10 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 24
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Gtk3 version of chromium will send wrong coordinates to input method

Reported by wen...@gmail.com, Oct 16 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce the problem:
1. Set env var GDK_SCALE=2 GDK_DPI_SCALE=0.5
2. Use input method under linux
3. Type anything that will trigger a input method window

What is the expected behavior?
The coordinates send to input method is down-scaled based on gtk settings.

What went wrong?
IMHO this bug is somewhat related to https://bugs.chromium.org/p/chromium/issues/detail?id=475718

Here's my theory. When chrome scale its interface based on Xft.dpi but not GDK_SCALE or some global GTK settings, the coordinates will be right (gdk scale = 1 but chrome also do the scale). When GDK_SCALE is set, chrome will scale too but it also send the same coordinates regardless of the gdk scale.

But the problem is when Gtk im module implementation try to send coordinates, it will try to scale it again based on information from gtk.

E.g. https://github.com/ibus/ibus/commit/6a3301db85e77e0652f7e00894cce493b6a942f6#diff-864a9b941d52b5d63b6e352614629072

https://github.com/fcitx/fcitx/blob/master/src/frontend/gtk2/fcitximcontext.c#L1041

This causes the "double" scale comparing to the gtk 2 version of chrome.

Also please notice, ibus's latest version does not yet include the commit above. Please use ibus's git, or fcitx's stable to test.

Did this work before? Yes Last Gtk2 chrome.

Chrome version: 61.0.3163.100  Channel: stable
OS Version: 4.13
Flash Version:
 
Labels: Needs-Triage-M61 Needs-Bisect
Cc: divya.pa...@techmahindra.com
Labels: -Needs-Bisect M-64 Triaged-ET
Owner: thomasanderson@chromium.org
Status: Assigned (was: Unconfirmed)
As per C#0, this looks to be specific to GTK3 and used to work with Gtk2, hence assigning to  thomasanderson@(worked on  Issue 79722  ) for more inputs and further investigation of this.
Cc: shuchen@chromium.org
Cc: thomasanderson@chromium.org
Owner: shuchen@chromium.org
shuchen@ can you take a look at this issue?
I cannot repro this on ToT.

A new report of this issue is at https://bugs.chromium.org/p/chromium/issues/detail?id=786299.
Cc: suzhe@chromium.org
+suzhe@ who may help me better understand the linux specific stuff.

I don't understand what is "Gtk3 version of chromium".
Does it mean Chromium currently compiled with Gtk3 lib?
Or Chromium runs under an environment with Gtk3 configured.

Does this issue only repro with the new ibus implementation? Or it also repros with other IME framework (e.g. SCIM, Fcitx, etc.)?
> Does it mean Chromium currently compiled with Gtk3 lib?
Yes, it means that Chromium is compiled with "use_gtk3=true".

> Does this issue only repro with the new ibus implementation? Or it also repros with other IME framework (e.g. SCIM, Fcitx, etc.)?
I don't have IBus to test but it can be reproduced with FCITX. Screenshot attached. Chromium is 63.0.3239.132 (Developer Build) (64-bit).
Screenshot_20180116_132222.png
77.8 KB View Download
^ Chromium is started with:

$ GDK_SCALE=2 GDK_DPI_SCALE=0.5 chromium --user-data-dir="$(mktemp -d)"
Unfortunately, I still cannot repro this issue.

$> gn args out/chrome_local
<there are 3 flags: is_component_build=false is_debug=false use_gtk3=true>

$> ninja -C out/chrome_local -j100 chrome
$> GDK_SCALE=2 GDK_DPI_SCALE=0.5 out/chrome_local/chrome --user-data-dir=~/.temp

Please see the attached screenshot.

Screenshot from 2018-01-18 10-40-44.png
24.2 KB View Download

Comment 11 by wen...@gmail.com, Jan 18 2018

Because ibus has its own bug on hidpi. If you try to use same env var on any other regular gtk3 application (e.g. gtk3-demo, gedit), you will notice that ibus shows input window with the wrong position.

You'll need up-to-date ibus to have this fix so you'll notice the problem.

https://github.com/ibus/ibus/commit/6a3301db85e77e0652f7e00894cce493b6a942f6

Comment 12 by wen...@gmail.com, Jan 18 2018

As you can see the ibus hidpi fix is only included in ibus 1.5.17. Which is the latest version released last year in October. It might not be included in your distro, while I had the similar hidpi code for fcitx already in 2015.

Well, regardless of input method framework, at least chrome should behave same as other gtk3 applications on this so input method can write code more easily to handle the hidpi.
The root cause of the problem is due to that the doc of |gtk_im_context_set_cursor_location| method isn't clear about whether its parameter |area| is in DIP (Device-independent pixel).

I can go for an easy fix to just do the check of GTK_CHECK_VERSION(3, 10, 0), but that will break some users (like myself) with old ibus installed.

Any better solution?

DIP: Density-Independent Pixel.

Comment 15 by int...@gmail.com, Mar 5 2018

I confirm this bug on the current version (Version 64.0.3282.186 (Official Build) (64-bit))

Please attachment
chrome_fcitx_bug.png
905 KB View Download
I confirm this bug and add some info.

First you need a HiDPi (4K or others) screen to reproduce this bug, which is confirmed with iBus devs, use a normal screen with GDK params seems unable to reproduce it.

Second, using Chromium under KDE/Plasma cannot reproduce this bug, only under GNOME it shows, I see one in here seems using iBus under KDE to reproduce this, but it failed.
I'm afraid it's hard to be sane with both versions of IBus, without actively detecting IME program and version, which would look dirty and bloated.

But in my point of view, being correct on this issue is more important than maintaining compatibility with broken old software since other IME programs do not have this bug, and people will eventually upgrade their IBus.

Comment 18 by lzy7...@gmail.com, May 16 2018

Such an issue is reproducible in Version 67.0.3396.48 under Ubuntu 18.04, with Gnome 3.28. 

Just to add a few details: 

1. The input selection works when typing in Chrome's address bar. However, the selection window would be nowhere to be found if the typing was done in window elements of a website.

2. Same issue when typing in Chrome extension such as Google Hangouts. 
Cc: sindhu.chelamcherla@chromium.org sandeepkumars@chromium.org krajshree@chromium.org osh...@chromium.org
 Issue 821255  has been merged into this issue.
Still find this bug with 68.0.3440.106, it annoys everyday, I think there is no need to keep compatibility with buggy old version iBus...
Project Member

Comment 21 by bugdroid1@chromium.org, Aug 24

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5a19eb524012d2eb81339eeac2b4e5fe2bf45c2b

commit 5a19eb524012d2eb81339eeac2b4e5fe2bf45c2b
Author: Shu Chen <shuchen@google.com>
Date: Fri Aug 24 05:07:31 2018

Making correct coordinates for the new version of iBus.

Turns out the new version of iBus (starting from 1.5.17) will multiply the coordinates with the scale factor specified by GDK_SCALE.
Chrome on linux now send the system based coordinates to the system's gtk-base IME, despite the scale factor specified by the app.
The correct coordinates should be divided by the GDK_SCALE of the app window.

Bug:  774974 
Change-Id: I654bacaa1a4eaba13680a33f2516e41b35d31a13
Reviewed-on: https://chromium-review.googlesource.com/1186291
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Shu Chen <shuchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585683}
[modify] https://crrev.com/5a19eb524012d2eb81339eeac2b4e5fe2bf45c2b/chrome/browser/ui/libgtkui/x11_input_method_context_impl_gtk.cc

Components: -UI UI>Input>Text>IME
Labels: M-70
Status: Fixed (was: Assigned)
This should be fixed in M70.

With canary 70.0.3528.4, such an issue seems to be still present in Ubuntu 18.04.
Screenshot from 2018-08-24 08-29-13.png
50.8 KB View Download
Labels: Needs-Feedback
Tried testing the issue on build without fix 64.0.3282.186 using Ubuntu 17.10 with HiDPi by following below steps.

Steps:
=====
1.Launch chrome.
2.Enabled ibus by executing command "sudo apt install ibus-m17n"
3.Tried to invoke the chromium build by executing command  $ GDK_SCALE=2 GDK_DPI_SCALE=0.5 chromium --user-data-dir="$(mktemp -d)"
(As per comment #9) but an error popped up as command not found.

Attached screenshot for reference.
shuchen@ : Could you please check screenshot and let us know if anything is being missed from our end. Requesting you to help us in verifying the fix on the latest M-70 build.

Thanks.!
Screenshot from 2018-08-27 18-25-43.png
272 KB View Download
With version 70.0.3534.4, the issue is resolved for me on Ubuntu 18.04.

Sign in to add a comment