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

Issue 2925853002: Flag mouse messages received when cursor is hidden.

Created:
3 years, 6 months ago by girard
Modified:
3 years, 3 months ago
Reviewers:
ananta, sky
CC:
chromium-reviews, tfarina, bruthig+ink_drop_chromium.org, dcheng
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Flag mouse messages received when cursor is hidden. <Begin preamble to explain the problem:> Many Windows messages get generated after a touch event, including a number of mouse messages. Some messages are flagged from touch, while others are not flagged by the system. For example, WM_MOUSEMOVE is sent long after the touch event finishes, without flags. Previously, we tested to see if WM_MOUSEMOVE is fired when the cursor has not moved (this is done in IsSynthesizedMouseMessage), within a fixed timeout period from the last touch event. This strategy captures some synthesized events, but some are sent long after the timeout, while others don't match this test [failure cases WM_MOUSEEXIT that does move the cursor.] A further failure case arose when touches happen very quickly, causing apparent mouse movement on unflagged mouse events. Experimentally, we found that tracking a number of recent touch locations would let us flag all (most?) synthesized mouse events, but the number of locations we needed to track was sometimes very large. This touch tracking seems very hacky, and I'm not confident that it would ever work reliably or efficiently. [This case degnerates badly with multitouch.] </end preamble.> Independently, Windows hides the mouse cursor when touch is active, and restores it when the mouse is active. This patch flags mouse events that are fired when the cursor is hidden. Chromium ui elements (such as hover states or tooltips) can choose to ignore such events. BUG=699668

Patch Set 1 #

Patch Set 2 : Inverted IsWindowsCursorVisible to IsWindowsCursorHidden #

Patch Set 3 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -35 lines) Patch
M ui/events/event_constants.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
M ui/events/event_utils.h View 1 1 chunk +2 lines, -0 lines 0 comments Download
M ui/events/win/events_win.cc View 1 1 chunk +8 lines, -0 lines 0 comments Download
M ui/platform_window/win/win_window.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download
M ui/views/animation/ink_drop_host_view.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M ui/views/controls/button/custom_button.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M ui/views/corewm/tooltip_controller.cc View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M ui/views/win/hwnd_message_handler.h View 1 chunk +0 lines, -6 lines 0 comments Download
M ui/views/win/hwnd_message_handler.cc View 1 2 4 chunks +3 lines, -27 lines 0 comments Download

Messages

Total messages: 15 (4 generated)
girard
Ananta, please review this change to windows touch logic - it removes some of your ...
3 years, 6 months ago (2017-06-06 21:05:05 UTC) #2
sadrul
> Chromium ui elements (such as hover states or tooltips) can > choose to ignore ...
3 years, 6 months ago (2017-06-07 22:09:00 UTC) #3
girard
On 2017/06/07 22:09:00, sadrul wrote: > > Chromium ui elements (such as hover states or ...
3 years, 6 months ago (2017-06-08 15:57:24 UTC) #4
ananta
I am a touch worried that the list of controls choosing not to handle these ...
3 years, 5 months ago (2017-07-12 18:40:55 UTC) #5
girard
On 2017/07/12 18:40:55, ananta wrote: > I am a touch worried that the list of ...
3 years, 4 months ago (2017-08-17 19:49:23 UTC) #6
sadrul
I am going to hand this off to sky@ (sorry about sitting on it for ...
3 years, 4 months ago (2017-08-23 06:34:21 UTC) #8
sky
+1 to some how eating the fake mouse messages. I get that missing one may ...
3 years, 4 months ago (2017-08-23 15:44:16 UTC) #11
girard
On 2017/08/23 15:44:16, sky wrote: > +1 to some how eating the fake mouse messages. ...
3 years, 4 months ago (2017-08-24 21:04:10 UTC) #12
sky
I was hoping there was some heuristic we could use that is mostly right. Say ...
3 years, 4 months ago (2017-08-24 23:34:10 UTC) #13
girard
On 2017/08/24 23:34:10, sky wrote: > I was hoping there was some heuristic we could ...
3 years, 3 months ago (2017-08-25 18:44:27 UTC) #14
sky
3 years, 3 months ago (2017-08-25 21:51:10 UTC) #15
I'm still confused as to how we can make controls deal correctly with
EF_CURSOR_HIDDEN, but can't centrally ignore the event. By that I mean if
we know the mouse is generated when the cursor is hidden, then don't
dispatch it. Your concern there is that results in the cursor permanently
hidden. DesktopWindowTreeHostWin can force the cursor to be visible when
necessary.

  -Scott

On Fri, Aug 25, 2017 at 11:44 AM, <girard@chromium.org> wrote:

> On 2017/08/24 23:34:10, sky wrote:
> > I was hoping there was some heuristic we could use that is mostly right.
> > Say location is same as recent touch event?
>
> I worked with that for a while, and found a few troublesome elements
> 1) Sometimes WM_MOUSEMOVE is sent for an earlier touch location, such as
> the third in a series of five for a touch move. I worked around this by
> keeping a large buffer of touch locations.
> 2) Things get more confusing when multitouch gets involved, but the work-
> around in (1) kind of addresses this.
> 3) Sometimes the mouse event gets sent at a point that is near the touch
> event - off by up to 3-5 pixels. I think this might be related to a
> center-of-finger calculation that is different for touch than for mouse?
>
> I ended up with a rolling buffer of 20 recent touch points, with a "fuzz
> factor" of 5 pixels, and discarded any WM_MOUSEMOVE that got matched. Then
> I put a breakpoint on the OnMouseMove and hammered away with my fingers. I
> was able to get a touch to mis-fire every five seconds or so (meaning I
> was catching something like 99% of the fake mouse events).
>
> I could code this up again if you want to see it, but the rolling buffer
> and the fuzzing seemed pretty hacky. (Ick!)
>
> >
> > -Scott
> >
> > On Thu, Aug 24, 2017 at 2:04 PM, <mailto:girard@chromium.org> wrote:
> >
> > > On 2017/08/23 15:44:16, sky wrote:
> > > > +1 to some how eating the fake mouse messages. I get that missing
> one may
> > > > mean the mouse stays hidden, but if the user is really moving the
> mouse
> > > > won't we end up with a slew of mouse events that will trigger
> showing the
> > > > cursor? I know if it were me, I would end up shaking the mouse in
> such a
> > > > situation.
> > >
> > > Unfortunately, no amount of mouse shaking would work, since we'd be
> > > discarding all of them. At the point where we're deciding to eat the
> fakes,
> > > we have no way to tell if they're fake. And therefore we'd eat them
> all,
> > > including the one that restores the cursor.
> > >
> > > Unless you're suggesting that we only eat the first n WM_MOUSEMOVE
> > > messages?
> > >
> > > https://codereview.chromium.org/2925853002/
> > >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-reviews" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> email
> > to mailto:chromium-reviews+unsubscribe@chromium.org.
>
>
>
> https://codereview.chromium.org/2925853002/
>

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698