• Prabir Pradhan's avatar
    exo: Allow Pointer Capture when window is active · 43be36f0
    Prabir Pradhan authored
    Pointer Capture was being rejected by chrome when an app came into
    focus using keyboard shortcuts (Alt-Tab), but was working as intended
    when an app came into focus using the mouse or touchscreen. It was being
    rejected because the capture_surface was the sub-surface of the current
    focused surface.
    
    Since the client is responsible for providing the capture surface
    through the wayland pointer constraints protocol, it is possible
    for the client to request capture on a sub-surface of the current
    active surface. Requesting capture on a sub-surface is a valid request
    for capture. Rather than ensuring that the capture surface is focused
    (used for directing key events), we verify that the active window
    contains the window of the capture surface in its hierarchy before we
    allow the pointer to be constrained to the surface.
    
    This also allows the client to change the cursor while the client has
    capture, even when the mouse cursor is not currently over a client
    window.
    
    BUG=b:153973515
    TEST=manual: request pointer capture, leave app, return to app using
    Alt+Tab, verify app has pointer capture.
    TEST=exo_unittests
    
    Change-Id: I56e76469f35ea43100748ebe27966464e32805fc
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2559255Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
    Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
    Commit-Queue: Prabir Pradhan <prabirmsp@chromium.org>
    Auto-Submit: Prabir Pradhan <prabirmsp@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#832613}
    43be36f0
pointer_unittest.cc 54.4 KB